/* ===========================================================
   SPIN Parking Quiz — styles.css
   Palette: warm cream surfaces + bike-lane green accent.
   =========================================================== */

/* ---------- Design tokens ---------- */
:root,
[data-theme='light'] {
  --color-bg: #f6f3ec;
  --color-surface: #ffffff;
  --color-surface-2: #fbfaf6;
  --color-surface-offset: #eee9dd;
  --color-divider: #e6e0d2;
  --color-border: #ddd6c5;

  --color-text: #23281f;
  --color-text-muted: #6b6a5f;
  --color-text-faint: #a9a698;
  --color-text-inverse: #f6f3ec;

  --color-primary: #245a43;
  --color-primary-hover: #1a4432;
  --color-primary-active: #123023;
  --color-primary-highlight: #d9e6dd;

  --color-error: #a13a3a;
  --color-error-hover: #7d2c2c;
  --color-error-highlight: #f0dcdc;

  --color-success: #2f7a52;
  --color-success-highlight: #dcece1;

  --color-warning: #96591c;
  --color-warning-highlight: #f0e6d5;

  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(35, 40, 31, 0.06);
  --shadow-md: 0 4px 16px rgba(35, 40, 31, 0.08);
  --shadow-lg: 0 16px 40px rgba(35, 40, 31, 0.12);

  --transition-interactive: 160ms cubic-bezier(0.16, 1, 0.3, 1);

  --font-display: 'Cabinet Grotesk', system-ui, -apple-system, sans-serif;
  --font-body: 'Satoshi', system-ui, -apple-system, sans-serif;

  --text-xs: clamp(0.75rem, 0.71rem + 0.2vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.82rem + 0.25vw, 0.9375rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.4vw, 1.3125rem);
  --text-xl: clamp(1.375rem, 1.2rem + 0.9vw, 1.75rem);
  --text-2xl: clamp(1.9rem, 1.5rem + 2vw, 2.6rem);

  color-scheme: light;
}

[data-theme='dark'] {
  --color-bg: #141813;
  --color-surface: #1b201a;
  --color-surface-2: #1f251e;
  --color-surface-offset: #242a22;
  --color-divider: #2a2f26;
  --color-border: #35392f;

  --color-text: #e7e4d8;
  --color-text-muted: #9a9888;
  --color-text-faint: #6b6a5c;
  --color-text-inverse: #1b201a;

  --color-primary: #7cc0a0;
  --color-primary-hover: #96cfb2;
  --color-primary-active: #accfbd;
  --color-primary-highlight: #24352c;

  --color-error: #e08a8a;
  --color-error-hover: #e7a2a2;
  --color-error-highlight: #3a2626;

  --color-success: #7ccb9d;
  --color-success-highlight: #223a2c;

  --color-warning: #e0ab6b;
  --color-warning-highlight: #3a2f1e;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);

  color-scheme: dark;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-interactive), color var(--transition-interactive);
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  text-wrap: balance;
  line-height: 1.15;
  font-weight: 700;
}

p,
li {
  text-wrap: pretty;
}

::selection {
  background: var(--color-primary-highlight);
}

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

@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;
  }
}

.wrap {
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 100;
  transition: top var(--transition-interactive);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus {
  top: 1rem;
}

/* ---------- Header / Footer ---------- */
.site-header {
  border-bottom: 1px solid var(--color-divider);
  background: var(--color-surface);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.9rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--color-text);
  text-decoration: none;
}
.brand__mark {
  color: var(--color-primary);
  flex-shrink: 0;
}
.brand__text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: transparent;
}
.theme-toggle:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--color-divider);
  padding-block: 1.5rem;
  text-align: center;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

/* Village Park Easter egg: a small, low-key tap target. Real <button> so
   it's keyboard-focusable and Enter/Space-activatable for free; kept
   visually quiet (low opacity) so it reads as decoration, not a CTA. */
.footer-mark {
  background: transparent;
  border: none;
  font-size: var(--text-sm);
  line-height: 1;
  opacity: 0.35;
  padding: 0.4rem;
  cursor: default;
  transition: opacity var(--transition-interactive);
}
.footer-mark:hover,
.footer-mark:focus-visible {
  opacity: 0.75;
}

/* ---------- Main layout ---------- */
.main-column {
  flex: 1;
  padding-block: 2rem 3rem;
  display: flex;
  flex-direction: column;
}

.screen {
  animation: fade-in 240ms ease;
}
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
}
.card--landing {
  padding: 2rem 1.75rem;
}
.card--center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 2.5rem 1.75rem;
}

@media (min-width: 560px) {
  .card {
    padding: 2.25rem;
  }
}

/* ---------- Landing ---------- */
.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}
.title {
  font-size: var(--text-2xl);
  margin-bottom: 0.9rem;
}
.lede {
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: 1rem;
}
.body-text {
  font-size: var(--text-base);
  color: var(--color-text);
}
.body-text + .body-text {
  margin-top: 0.75rem;
}
.body-text--muted {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.fact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 1.1rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}
.fact-list li {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.fact-list strong {
  color: var(--color-text);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-base);
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 3rem;
  transition: background-color var(--transition-interactive), border-color var(--transition-interactive),
    color var(--transition-interactive), transform 120ms ease, opacity var(--transition-interactive);
  text-decoration: none;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn--block {
  width: 100%;
}
.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn--primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}
.btn--primary:active:not(:disabled) {
  background: var(--color-primary-active);
}
.btn--secondary {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  border-color: var(--color-primary-highlight);
}
.btn--secondary:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

/* ---------- Spinner ---------- */
.spinner {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 3px solid var(--color-divider);
  border-top-color: var(--color-primary);
  animation: spin 800ms linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Progress ---------- */
.progress-block {
  margin-bottom: 1.5rem;
}
.progress-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}
.progress-track {
  height: 0.5rem;
  background: var(--color-surface-offset);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 260ms ease;
  width: 0%;
}

/* ---------- Question / choices ---------- */
.question-fieldset {
  border: none;
}
.question-text {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: block;
}
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}
.choice {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  cursor: pointer;
  min-height: 3.25rem;
  transition: border-color var(--transition-interactive), background-color var(--transition-interactive);
}
.choice:hover {
  border-color: var(--color-primary);
}
.choice input[type='radio'] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}
.choice:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
}
.choice:has(input:focus-visible) {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}
.choice__text {
  font-size: var(--text-base);
}

.quiz-nav {
  display: flex;
  gap: 0.75rem;
}
.quiz-nav .btn {
  flex: 1;
}

/* ---------- Review ---------- */
.status-heading {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.status-heading--error {
  color: var(--color-error);
}
.status-heading--success {
  color: var(--color-success);
}
.review-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1.25rem 0 1.5rem;
}
.review-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: var(--text-sm);
  padding: 0.6rem 0.85rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
}
.review-list li span:first-child {
  color: var(--color-text);
  font-weight: 600;
}

/* ---------- Code block ---------- */
.code-block {
  width: 100%;
  background: var(--color-surface-2);
  border: 1.5px dashed var(--color-primary);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-block: 0.5rem 1rem;
}
.code-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.code-value {
  font-family: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: clamp(0.95rem, 0.8rem + 1vw, 1.25rem);
  font-weight: 700;
  color: var(--color-primary);
  word-break: break-all;
  text-align: center;
  letter-spacing: 0.02em;
  user-select: all;
}

.warning-box {
  width: 100%;
  background: var(--color-warning-highlight);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  text-align: left;
  margin-bottom: 1rem;
}
.warning-box .body-text--muted {
  color: var(--color-text);
}

.telegram-block {
  width: 100%;
  text-align: left;
}
.telegram-steps {
  margin: 0.75rem 0 1.1rem;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ---------- Easter eggs ---------- */
/* The landing title is clickable a few times in a row as a small hidden
   interaction (see public/js/easterEggs.js); this cursor is the only visual
   hint that anything is there. */
.title {
  cursor: pointer;
}

.easter-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 0.5rem);
  max-width: calc(100% - 2.5rem);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  opacity: 0;
  z-index: 50;
  transition: opacity 200ms ease, transform 200ms ease;
}
.easter-toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Utility ---------- */
[hidden] {
  display: none !important;
}
