/* ==========================================================
   RETKEKE – disainisüsteem
   Põhimõtted:
   1. Kõik värvid, vahed, raadiused ja varjud tulevad tokenitest.
   2. Üks aktsentvärv (kontrollpunkti oranž) = tegevus. Roheline = bränd.
   3. Hierarhia tuleb tüpograafiast ja vahedest, mitte varjudest.
   4. Ligipääsetavus: kontrast ≥ 4.5:1, nähtav fookus, vähendatud liikumine.
   ========================================================== */

:root {
  /* Värvid */
  --paper: #f7f3ea;
  --paper-alt: #efe8d9;
  --surface: #fffdf8;
  --ink: #1d2721;
  --ink-muted: #56615a;
  --line: #d9d0bd;
  --line-strong: #b9ad94;

  --forest: #2f5d46;
  --forest-dark: #1b3a2b;
  --forest-soft: #e1ebe3;

  --flag: #f26b21;          /* dekoratiivne (logo, markerid) */
  --action: #c2410c;        /* nupud – valge tekstiga kontrast 5.2:1 */
  --action-hover: #a3370a;
  --action-soft: #fbe6d8;

  --on-dark: #f7f3ea;
  --on-dark-muted: #c3d0c7;

  /* Tüpograafia */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --text-xs: 0.78rem;
  --text-sm: 0.9rem;
  --text-base: 1rem;
  --text-lg: 1.15rem;
  --text-xl: clamp(1.4rem, 1rem + 1vw, 1.6rem);
  --text-2xl: clamp(1.9rem, 1.4rem + 1.6vw, 2.5rem);
  --text-3xl: clamp(2.5rem, 1.6rem + 3.4vw, 4rem);

  /* Vahed (4px baas) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 5rem;

  /* Kuju */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(29, 39, 33, 0.06), 0 2px 8px rgba(29, 39, 33, 0.05);
  --shadow-md: 0 2px 4px rgba(29, 39, 33, 0.05), 0 12px 32px rgba(29, 39, 33, 0.09);

  --focus-ring: 0 0 0 3px var(--paper), 0 0 0 5px var(--forest);

  --container-width: 1120px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}

h1 { font-size: var(--text-3xl); line-height: 1.05; }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-lg); }

p {
  margin: 0 0 var(--space-4);
}

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

/* hidden peab alati peitma, ka siis, kui klass määrab display */
[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

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

.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--forest);
  margin-bottom: var(--space-3);
}

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--ink);
  color: var(--on-dark);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font: 600 var(--text-base) / 1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease),
    transform 0.15s var(--ease);
}

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

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

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

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  border-color: var(--ink);
  background: var(--surface);
}

.btn-sm {
  min-height: 40px;
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
}

.full-width {
  width: 100%;
}

/* ---------- TAGS ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--text-sm);
  color: var(--ink);
}

.tag-accent {
  background: var(--forest-soft);
  border-color: transparent;
  color: var(--forest-dark);
  font-weight: 500;
}

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ---------- HEADER / NAV ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 243, 234, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.brand img {
  display: block;
  height: 42px;
  width: auto;
}

/* Orienteerumise kontrollpunkti lipp */
.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  border: 2px solid var(--ink);
  background: linear-gradient(to top left, var(--flag) 50%, #fff 50%);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
}

.nav-links a {
  color: var(--ink-muted);
  text-decoration: none;
  padding: var(--space-2) 0;
  background: linear-gradient(var(--flag), var(--flag)) no-repeat left bottom / 0 2px;
  transition: color 0.15s var(--ease), background-size 0.2s var(--ease);
}

.nav-links a:hover {
  color: var(--ink);
  background-size: 100% 2px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  align-items: center;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- HERO ---------- */
.hero {
  position: relative;
  padding: var(--space-8) 0;
  overflow: hidden;
}

/* Kõrgusjooned – vaikne kaardiviide */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-radial-gradient(
    ellipse at 85% 30%,
    transparent 0 26px,
    rgba(47, 93, 70, 0.09) 26px 27px
  );
  mask-image: linear-gradient(to left, #000 20%, transparent 75%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: grid;
  gap: var(--space-7);
  align-items: center;
}

.hero h1 em {
  font-style: italic;
  color: var(--forest);
}

.lead {
  max-width: 34rem;
  font-size: var(--text-lg);
  color: var(--ink-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-6) 0;
}

.hero-meta {
  display: grid;
  gap: var(--space-5);
  margin: 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}

.hero-meta dt {
  font-weight: 600;
  font-size: var(--text-sm);
}

.hero-meta dd {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

/* Route card – mängu rada */
.route-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
}

.route-card-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--space-5);
}

.route {
  list-style: none;
  margin: 0;
  padding: 0;
}

.route-step {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
}

/* punktiirjoon markerite vahel */
.route-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 44px;
  bottom: 4px;
  border-left: 2px dashed var(--line-strong);
}

.route-step:last-child {
  padding-bottom: 0;
}

.route-marker {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--flag);
  background: var(--surface);
  color: var(--action);
  font-weight: 700;
  font-size: var(--text-xs);
}

.route-marker-finish {
  background: var(--flag);
  color: #fff;
}

.route-step h3 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  margin: var(--space-2) 0 var(--space-1);
}

.route-step p {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  margin: 0;
}

.route-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}

/* ---------- SECTIONS ---------- */
.section {
  padding: var(--space-8) 0;
}

.section-alt {
  background: var(--paper-alt);
}

.section-header {
  max-width: 40rem;
  margin: 0 auto var(--space-7);
  text-align: center;
}

/* ---------- SPLIT ---------- */
.split {
  display: grid;
  gap: var(--space-7);
  align-items: start;
}

.steps {
  list-style: none;
  counter-reset: step;
  margin: var(--space-6) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: var(--space-3);
  align-items: baseline;
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--flag);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

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

/* ---------- CARDS ---------- */
.card-grid {
  display: grid;
  gap: var(--space-5);
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-index {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--flag);
  margin-bottom: var(--space-3);
}

.card h3 {
  font-size: var(--text-xl);
}

.card p {
  color: var(--ink-muted);
}

.card-list {
  list-style: none;
  margin: auto 0 0;
  padding: var(--space-4) 0 0;
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
  display: grid;
  gap: var(--space-2);
}

.card-list li {
  position: relative;
  padding-left: var(--space-5);
}

.card-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--forest);
}

/* ---------- GALLERY ---------- */
/* Mobiil: üks veerg. Tahvel: 2 veergu. Laud: püstine pilt kõrge veeruna, lai pilt all. */
.gallery {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}

.gallery-item {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--forest-soft);
}

.gallery-item--tall {
  aspect-ratio: 3 / 4;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.gallery-item:hover img {
  transform: scale(1.04);
}

.gallery-item figcaption {
  position: absolute;
  inset: auto 0 0;
  padding: var(--space-8) var(--space-5) var(--space-4);
  /* tume ja kõrge gradient, et tekst oleks loetav ka heledal murul/kruusal */
  background: linear-gradient(
    to top,
    rgba(15, 32, 24, 0.92) 0%,
    rgba(15, 32, 24, 0.6) 55%,
    rgba(15, 32, 24, 0) 100%
  );
  color: #fff;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* Kohatäide, kui pilt puudub (script.js lisab klassi) */
.gallery-item.is-missing {
  background:
    repeating-radial-gradient(circle at 30% 40%, transparent 0 14px, rgba(47, 93, 70, 0.14) 14px 15px),
    var(--forest-soft);
}

.gallery-item.is-missing img {
  display: none;
}

/* ---------- TRUST ---------- */
.trust {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-7);
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.trust p {
  margin: 0;
}

.trust-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink);
}

/* ---------- CONTACT ---------- */
.section-contact {
  background: var(--forest-dark);
  color: var(--on-dark);
}

.section-contact .eyebrow {
  color: #f9a878;
}

.section-contact p {
  color: var(--on-dark-muted);
}

.section-contact :focus-visible {
  box-shadow: 0 0 0 3px var(--forest-dark), 0 0 0 5px #f9a878;
}

.contact-grid {
  display: grid;
  gap: var(--space-7);
  align-items: start;
}

.contact-details {
  margin-top: var(--space-5);
}

.contact-details p {
  margin: 0;
  color: var(--on-dark);
}

.contact-details a {
  color: #f9a878;
  text-underline-offset: 3px;
}

.contact-form {
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.contact-form :focus-visible {
  box-shadow: var(--focus-ring);
}

.form-row {
  display: grid;
  gap: 0 var(--space-4);
}

.form-field {
  margin-bottom: var(--space-5);
}

.form-field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s var(--ease);
}

.form-field textarea {
  resize: vertical;
  min-height: 130px;
}

.form-field input:hover,
.form-field textarea:hover,
.form-field select:hover {
  border-color: var(--ink-muted);
}

.form-field input:focus-visible,
.form-field textarea:focus-visible,
.form-field select:focus-visible {
  border-color: var(--forest);
  border-radius: var(--radius-md);
}

.contact-form .form-status {
  margin: var(--space-3) 0 0;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  text-align: center;
}

.form-status:empty {
  display: none;
}

.contact-form .form-status.is-error {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: #fdecea;
  color: #9b1c1c;
}

.form-status.is-error a {
  color: inherit;
  font-weight: 600;
}

.contact-success {
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-6);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
}

/* fookus liigub siia skriptiga (ekraanilugejale); visuaalset raami pole vaja */
.section-contact .contact-success:focus-visible {
  outline: none;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.contact-success h3 {
  font-size: var(--text-xl);
}

.contact-success p {
  color: var(--ink-muted);
}

.contact-success a {
  color: var(--forest);
  font-weight: 600;
}

.contact-success .btn-secondary {
  color: var(--ink);
}

.contact-form .form-note {
  margin: var(--space-3) 0 0;
  font-size: var(--text-xs);
  color: var(--ink-muted);
  text-align: center;
}

/* ---------- FOOTER ---------- */
.site-footer {
  background: var(--ink);
  color: var(--on-dark-muted);
  padding: var(--space-5) 0;
  font-size: var(--text-sm);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  justify-content: space-between;
}

.footer-grid p {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.footer-links a {
  color: var(--on-dark);
  text-underline-offset: 3px;
}

/* ---------- INTERAKTIIVSUS ---------- */

/* Kerimisel ilmumine – ainult kui JS töötab */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  transition-delay: var(--reveal-delay, 0s);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Päis kerimisel */
.site-header.is-scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-links a.is-active {
  color: var(--ink);
  background-size: 100% 2px;
}

/* Elav rada */
.route-step {
  cursor: default;
}

.route-step > div {
  transition: opacity 0.3s var(--ease);
}

.route.is-live .route-step:not(.is-active) > div {
  opacity: 0.55;
}

.route-marker {
  transition: transform 0.3s var(--ease), background-color 0.3s var(--ease),
    color 0.3s var(--ease);
}

.route-step.is-active .route-marker {
  transform: scale(1.1);
  background: var(--flag);
  color: #fff;
  box-shadow: 0 0 0 6px rgba(242, 107, 33, 0.18);
}

/* Mängu kokkupanija */
.planner {
  display: grid;
  gap: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
}

.planner-controls {
  display: grid;
  gap: var(--space-6);
  align-content: start;
}

/* Segmentnupud */
.seg {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.seg legend,
.slider label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  font-size: var(--text-base);
  font-weight: 500;
  margin-bottom: var(--space-3);
}

.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease),
    color 0.15s var(--ease);
}

.seg span:hover {
  border-color: var(--forest);
}

.seg input:checked + span {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
}

.seg input:focus-visible + span {
  box-shadow: var(--focus-ring);
}

/* „Muu“ teema vabatekst */
.seg-other {
  flex-basis: 100%;
  margin-top: var(--space-1);
}

.seg-other input {
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--forest);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
}

.seg-other input:focus-visible {
  border-radius: var(--radius-md);
}

/* Liugurid – paks rada, valge nupp */
.slider output {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.slider input[type="range"] {
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.slider input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: var(--radius-pill);
  background: linear-gradient(to right, var(--forest) var(--fill), var(--forest-soft) var(--fill));
}

.slider input[type="range"]::-moz-range-track {
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--forest-soft);
}

.slider input[type="range"]::-moz-range-progress {
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--forest);
}

.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -8px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 2px 6px rgba(29, 39, 33, 0.25), 0 0 0 1px rgba(29, 39, 33, 0.06);
  transition: transform 0.15s var(--ease);
}

.slider input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 2px 6px rgba(29, 39, 33, 0.25), 0 0 0 1px rgba(29, 39, 33, 0.06);
}

.slider input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.12);
}

.slider input[type="range"]:focus-visible {
  box-shadow: none;
}

.slider input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: var(--focus-ring);
}

.slider input[type="range"]:focus-visible::-moz-range-thumb {
  box-shadow: var(--focus-ring);
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

/* Eelvaade */
.preview {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.preview-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--space-2);
}

.preview h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.preview.is-updated h3 {
  animation: pop 0.35s var(--ease);
}

@keyframes pop {
  from { opacity: 0.2; transform: translateY(4px); }
}

.preview-story {
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.pv-map {
  width: 100%;
  height: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-4);
}

.pv-map .leg {
  fill: none;
  stroke: var(--flag);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.pv-map .leg.is-drawing {
  animation: draw 0.9s var(--ease) both;
}

@keyframes draw {
  from { stroke-dashoffset: 1; }
}

.pv-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4);
}

.pv-stats dt {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.pv-stats dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pv-mix {
  display: flex;
  height: 8px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  gap: 2px;
  margin-bottom: var(--space-3);
}

.pv-mix span {
  transition: flex-grow 0.3s var(--ease);
}

.mix-logic { background: var(--forest); }
.mix-move { background: var(--flag); }
.mix-create { background: #6c8ebf; }

.pv-tasks {
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: 0;
  display: grid;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.pv-tasks li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: var(--space-3);
  align-items: baseline;
}

.pv-tasks .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.pv-tasks .pct {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.preview .btn {
  margin-top: auto;
}

/* Proovi ise – vahelehed */
.try-tabs {
  display: flex;
  justify-content: center;
  gap: var(--space-1);
  width: fit-content;
  margin: 0 auto var(--space-6);
  padding: var(--space-1);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.try-tabs button {
  min-height: 44px;
  padding: 0 var(--space-5);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  font: 600 var(--text-sm) / 1 var(--font-body);
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.try-tabs button:hover {
  color: var(--ink);
}

.try-tabs button[aria-selected="true"] {
  background: var(--forest);
  color: #fff;
}

.try-panel[hidden] {
  display: none;
}

.try-panel {
  animation: pop 0.3s var(--ease);
}

.link-btn {
  border: 0;
  background: none;
  padding: var(--space-2);
  color: #f9a878;
  font: 500 var(--text-sm) / 1.4 var(--font-body);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Koodilukk */
.puzzle-grid {
  display: grid;
  gap: var(--space-7);
  align-items: center;
}

.hints {
  list-style: none;
  margin: var(--space-5) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.hints li {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.hint-sym {
  color: var(--flag);
  font-size: var(--text-sm);
}

.hints li {
  align-items: baseline;
}

.hints .hint-sym {
  flex: none;
  width: 1rem;
  text-align: center;
}

/* „Näita vihjet“ – vihje avaneb alles klõpsuga */
.hint summary {
  width: fit-content;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
  list-style: none;
}

.hint summary::-webkit-details-marker {
  display: none;
}

.hint summary::before {
  content: "+ ";
  color: var(--flag);
  font-weight: 700;
}

.hint[open] summary::before {
  content: "− ";
}

.hint .hint-hide,
.hint[open] .hint-show {
  display: none;
}

.hint[open] .hint-hide {
  display: inline;
}

.hint summary:hover {
  color: var(--ink);
}

.hint a {
  display: inline-block;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--forest);
  text-underline-offset: 3px;
}

/* luku numbrite tagasiside pärast valet katset */
.dial-value {
  transition: box-shadow 0.2s var(--ease);
}

.dial-value.is-right {
  box-shadow: 0 0 0 3px #7fd18b;
}

.dial-value.is-wrong {
  box-shadow: 0 0 0 3px var(--flag);
}

.lock {
  max-width: 360px;
  margin: 0 auto;
  width: 100%;
}

.lock-shackle {
  width: 56%;
  height: 90px;
  margin: 0 auto -18px;
  border: 16px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 90px 90px 0 0;
  transition: transform 0.5s var(--ease);
}

.lock.is-open .lock-shackle {
  transform: translateY(-28px) translateX(22%);
}

.lock-body {
  position: relative;
  display: grid;
  gap: var(--space-3);
  background: var(--forest-dark);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5) var(--space-5);
  box-shadow: var(--shadow-md);
}

.lock.is-wrong .lock-body {
  animation: shake 0.4s;
}

@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.dials {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-2);
}

.dial {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.dial .hint-sym {
  color: #f9a878;
}

.dial-value {
  width: 64px;
  height: 72px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--ink);
}

.dial-btn {
  width: 64px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-dark);
  font-size: 0.8rem;
  cursor: pointer;
}

.dial-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.lock-body :focus-visible {
  box-shadow: 0 0 0 3px var(--forest-dark), 0 0 0 5px #f9a878;
}

.lock-body .btn-secondary {
  color: var(--on-dark);
  border-color: rgba(247, 243, 234, 0.4);
}

.lock-msg {
  min-height: 1.6em;
  margin: 0;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--on-dark-muted);
}

.lock.is-open .lock-msg {
  color: #fff;
  font-weight: 500;
}

/* 3D põgenemistuba */
.room-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 360px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--forest-dark);
  box-shadow: var(--shadow-md);
}

.room-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  cursor: grab;
}

.room-stage canvas:active {
  cursor: grabbing;
}

.room-stage canvas.is-pointer {
  cursor: pointer;
}

.room-start,
.room-win {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-5);
  text-align: center;
  color: var(--on-dark);
  background:
    repeating-radial-gradient(circle at 50% 50%, transparent 0 30px, rgba(247, 243, 234, 0.05) 30px 31px),
    var(--forest-dark);
}

.room-start p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--on-dark-muted);
}

.room-start-mark {
  width: 56px;
  height: 56px;
  border-color: var(--on-dark);
  border-width: 3px;
}

.room-win {
  background: rgba(27, 58, 43, 0.92);
  backdrop-filter: blur(4px);
  animation: pop 0.4s var(--ease);
}

.room-win h3 {
  font-size: var(--text-2xl);
  margin: 0;
}

.room-win p {
  margin: 0;
}

.room-win-note {
  max-width: 28rem;
  color: var(--on-dark-muted);
  font-size: var(--text-sm);
}

.room-win-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.room-win .btn-secondary,
.room-keypad .btn-secondary {
  color: var(--on-dark);
  border-color: rgba(247, 243, 234, 0.4);
}

.room-win .btn-secondary:hover,
.room-keypad .btn-secondary:hover {
  background: rgba(247, 243, 234, 0.1);
  border-color: var(--on-dark);
}

.room-hud {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  right: var(--space-3);
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.room-hud span {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: rgba(29, 39, 33, 0.7);
  color: var(--on-dark);
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.room-toast {
  position: absolute;
  left: 50%;
  bottom: var(--space-4);
  max-width: calc(100% - 2rem);
  margin: 0;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: rgba(29, 39, 33, 0.85);
  color: var(--on-dark);
  font-size: var(--text-sm);
  text-align: center;
  transform: translate(-50%, 8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.room-toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

.room-keypad {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(280px, calc(100% - 2rem));
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: var(--on-dark);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.room-keypad[hidden],
.room-win[hidden],
.room-start[hidden],
.room-hud[hidden] {
  display: none;
}

.room-keypad label {
  font-size: var(--text-sm);
  font-weight: 600;
}

.room-keypad input {
  width: 100%;
  padding: var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: #0e1410;
  color: #7fd18b;
  font: 700 2rem / 1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.4em;
  text-align: center;
}

.room-keypad input:focus-visible {
  box-shadow: 0 0 0 2px #7fd18b;
}

.room-keypad.is-wrong {
  animation: shake-center 0.4s;
}

@keyframes shake-center {
  20%, 60% { transform: translate(calc(-50% - 8px), -50%); }
  40%, 80% { transform: translate(calc(-50% + 8px), -50%); }
}

.room-keypad-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.room-stage :focus-visible {
  box-shadow: 0 0 0 3px var(--forest-dark), 0 0 0 5px #f9a878;
}

/* ---------- RESPONSIVE ---------- */
@media (min-width: 600px) {
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-item--tall {
    aspect-ratio: 4 / 3;
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
  }

  .hero-meta {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  }

  .split {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }

  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, 280px);
  }

  .gallery-item,
  .gallery-item--tall {
    aspect-ratio: auto;
  }

  .gallery-item--tall {
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .gallery-item--wide {
    grid-column: 2 / 4;
    grid-row: 2;
  }

  .contact-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  }

  .planner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-7);
    padding: var(--space-7);
  }

  .puzzle-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 1023px) {
  .nav-toggle {
    display: flex;
  }

  .nav-right {
    position: absolute;
    right: var(--space-5);
    left: var(--space-5);
    top: calc(100% + var(--space-2));
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
  }

  .nav-right.open {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    gap: 0;
    font-size: var(--text-base);
  }

  .nav-links a {
    display: block;
    padding: var(--space-3) var(--space-2);
    background: none;
  }

  .hero,
  .section {
    padding: var(--space-7) 0;
  }
}

@media (max-width: 599px) {
  .room-stage {
    aspect-ratio: 3 / 4;
  }

  .planner {
    padding: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
