/* ---------- Zmienne i podstawy ---------- */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-muted: #eef1ee;
  --text: #1f2a33;
  --text-muted: #4a5861;      /* kontrast na tle --bg ≈ 7.2:1 */
  --primary: #2f5f6b;         /* kontrast z bielą ≈ 7.3:1 */
  --primary-dark: #244c56;
  --primary-soft: #dde9ec;
  --accent: #74592c;          /* ciepły akcent, kontrast z --bg ≈ 6:1 */
  --border: #d6dbd8;
  --error: #9b2c2c;           /* kontrast z bielą ≈ 7.7:1 */
  --error-bg: #fbeeee;
  --focus: #1f4e5a;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(31, 42, 51, 0.06);
  --dur: 240ms;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

h1, h2, h3 {
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
}

h1 {
  font-size: clamp(1.75rem, 2.2vw + 1.2rem, 2.5rem);
  margin: 0.25rem 0 1rem;
}

h2 {
  font-size: clamp(1.5rem, 1.5vw + 1.1rem, 2rem);
  margin: 0.25rem 0 1rem;
}

h3 {
  font-size: 1.125rem;
  margin: 0 0 0.6rem;
}

p {
  margin: 0 0 1rem;
}

ul {
  margin: 0;
  padding-left: 1.2rem;
}

/* ---------- Fokus i dostępność ---------- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  background: var(--primary);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  z-index: 100;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Nagłówek i stopka ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(246, 245, 241, 0.92);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  margin: 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand__text small {
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.site-nav .btn--ghost {
  font-size: 0.95rem;
}

@media (max-width: 480px) {
  .site-nav .btn--ghost {
    font-size: 0.875rem;
    padding: 0.4rem 0.5rem;
  }
}

.brand__mark {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7fa8b2);
  flex-shrink: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 28px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.site-footer__note {
  margin-bottom: 14px;
}

.site-footer__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: left;
}

.site-footer__row nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.site-footer__row a,
.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-footer a,
.link-button {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

.link-button {
  font: inherit;
  font-weight: 600;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.site-footer a:hover,
.link-button:hover {
  color: var(--primary);
}

@media (max-width: 480px) {
  .site-footer__row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- Strona tekstowa (polityka prywatności) ---------- */
.prose h2 {
  font-size: 1.35rem;
  margin-top: 2rem;
}

.prose h3 {
  margin-top: 1.4rem;
}

.prose ul,
.prose ol {
  margin-bottom: 1rem;
}

.prose li + li {
  margin-top: 0.4rem;
}

.prose a:not(.btn) {
  color: var(--primary-dark);
  text-underline-offset: 3px;
}

.prose a.btn--primary,
a.btn--primary:link,
a.btn--primary:visited {
  color: #fff;
}

.prose address {
  font-style: normal;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
}

.prose .meta {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------- Ekrany ---------- */
.screen {
  padding: 40px 0 48px;
}


.screen.is-entering {
  animation: screen-in 480ms var(--ease);
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.lead {
  font-size: 1.15rem;
  color: var(--text);
}

/* ---------- Karty i siatka ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.grid .card {
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
}

.notice {
  background: var(--surface-muted);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 24px 0;
  color: var(--text);
}

.notice p:last-child {
  margin-bottom: 0;
}

.list li + li {
  margin-top: 0.45rem;
}

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  padding: 0.75rem 1.3rem;
  min-height: 48px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--primary-dark);
}

.btn--secondary {
  background: var(--surface);
  color: var(--primary-dark);
  border-color: var(--primary);
}

.btn--secondary:hover {
  background: var(--primary-soft);
}

.btn--ghost {
  background: transparent;
  color: var(--primary-dark);
  padding: 0.5rem 0.75rem;
  min-height: 40px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn--ghost:hover {
  background: var(--primary-soft);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0;
}

.actions--split {
  justify-content: space-between;
}

@media (max-width: 480px) {
  .actions .btn {
    flex: 1 1 100%;
  }
  .actions--split {
    flex-direction: column-reverse;
  }
}

/* ---------- Postęp ---------- */
.progress {
  margin-bottom: 20px;
}

.progress__meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.progress__bar {
  height: 10px;
  background: var(--surface-muted);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), #6f9ea8);
  border-radius: 999px;
  transition: width 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Pytanie ---------- */
.question-card {
  will-change: transform, opacity;
}

.question-card.is-swapping-forward {
  animation: question-in-forward 420ms var(--ease);
}

.question-card.is-swapping-back {
  animation: question-in-back 420ms var(--ease);
}

@keyframes question-in-forward {
  0% {
    opacity: 0;
    transform: translateX(48px) scale(0.98);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes question-in-back {
  0% {
    opacity: 0;
    transform: translateX(-48px) scale(0.98);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

/* kaskadowe pojawianie się treści pytania i odpowiedzi */
.is-swapping-forward .question__text,
.is-swapping-back .question__text {
  animation: fade-up 380ms var(--ease) both;
  animation-delay: 80ms;
}

.is-swapping-forward .option,
.is-swapping-back .option {
  animation: fade-up 360ms var(--ease) both;
  animation-delay: calc(140ms + var(--i, 0) * 55ms);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* potwierdzenie wyboru odpowiedzi */
.option__label.is-picked {
  animation: pick 320ms var(--ease);
}

@keyframes pick {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.04);
    box-shadow: 0 0 0 6px var(--primary-soft);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  }
}

.question {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.question__legend {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0;
  margin-bottom: 0.6rem;
}

.question__text {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 1.2rem;
}

.options {
  display: grid;
  gap: 10px;
}

@media (min-width: 768px) {
  .options {
    grid-template-columns: repeat(5, 1fr);
  }
}

.option {
  position: relative;
}

.option__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.option__label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 52px;
  padding: 0.7rem 0.8rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.option__label:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.option__input:checked + .option__label {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.option__input:checked + .option__label::before {
  content: "✓";
  margin-right: 0.45rem;
  font-size: 0.95em;
}

.option__input:focus-visible + .option__label {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* ---------- Formularz ---------- */
.field {
  margin-bottom: 8px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input[type="email"] {
  width: 100%;
  font: inherit;
  padding: 0.75rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  min-height: 48px;
}

.field input[type="email"]:focus {
  border-color: var(--primary);
}

.field input[aria-invalid="true"] {
  border-color: var(--error);
}

.hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 8px 0 0;
}

.error {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error);
  font-weight: 600;
  border: 1px solid rgba(155, 44, 44, 0.25);
}

.error[hidden] {
  display: none;
}

/* ---------- Wynik ---------- */
.result-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.6rem;
}

.result-title__code {
  font-family: "Georgia", "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.result-title__sep {
  color: var(--text-muted);
}

.result-description {
  font-size: 1.08rem;
  margin: 0;
}

.dims {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}

.dim {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-muted);
}

.dim strong {
  color: var(--primary-dark);
}

.dim span,
.dim small {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------- Dialog ---------- */
.dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  width: min(92vw, 720px);
  max-height: 88vh;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(31, 42, 51, 0.25);
}

.dialog::backdrop {
  background: rgba(31, 42, 51, 0.45);
}

.dialog__inner {
  padding: 24px;
  overflow-y: auto;
  max-height: 88vh;
}

.dialog__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.dialog__header h2 {
  margin: 0;
}

.dialog h3 {
  margin-top: 1.4rem;
}

/* ---------- Ograniczenie animacji ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
