/* MindMe Presentation — base styles + theme tokens */

:root {
  --bg: #F5F1EA;
  --bg-alt: #EBE5D9;
  --ink: #0A0A0A;
  --ink-soft: #4A4A48;
  --ink-mute: #8A857C;
  --line: rgba(10, 10, 10, 0.12);
  --accent: #FF5100;

  /* Typography stacks — set by JS via data-font */
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;

  /* Density scale — set by JS via data-density */
  --pad-section-y: clamp(96px, 12vw, 180px);
  --pad-block: clamp(24px, 3vw, 48px);
  --gap-tight: 12px;
  --gap: 24px;
  --gap-wide: 48px;

  --radius-sm: 4px;
  --radius: 8px;

  --t-fast: 220ms cubic-bezier(.22,.61,.36,1);
  --t-med: 480ms cubic-bezier(.22,.61,.36,1);
  --t-slow: 900ms cubic-bezier(.22,.61,.36,1);
}

html[data-theme="dark"] {
  --bg: #0A0A0A;
  --bg-alt: #141414;
  --ink: #F5F1EA;
  --ink-soft: #BFB9AD;
  --ink-mute: #6E6A62;
  --line: rgba(245, 241, 234, 0.14);
}

html[data-density="compact"] {
  --pad-section-y: clamp(64px, 8vw, 120px);
  --pad-block: clamp(16px, 2vw, 32px);
  --gap-tight: 8px;
  --gap: 16px;
  --gap-wide: 32px;
}
html[data-density="airy"] {
  --pad-section-y: clamp(140px, 18vw, 260px);
  --pad-block: clamp(40px, 5vw, 80px);
  --gap-tight: 16px;
  --gap: 32px;
  --gap-wide: 80px;
}

html[data-font="grotesque"] {
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
}
html[data-font="techie"] {
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
}
html[data-font="editorial"] {
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Snap-scroll: one section per viewport */
html { scroll-snap-type: y mandatory; scroll-behavior: smooth; }
body { scroll-snap-type: y mandatory; }

body {
  transition: background var(--t-med), color var(--t-med);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* Layout helpers */
.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 64px);
}
.section {
  padding: clamp(40px, 4vw, 64px) 0 clamp(32px, 3vw, 48px);
  position: relative;
  min-height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.section > .shell { width: 100%; }
.section--alt { background: var(--bg-alt); }

/* Day system: timeline rail is mobile-only (variant 4) */
.day-rail { display: none; }
.day-prod-nav { display: none; }

/* Display type */
.display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.eyebrow {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.serif { font-family: var(--font-serif); font-weight: 400; letter-spacing: -0.01em; }

.h-hero { font-size: clamp(44px, 6.4vw, 104px); }
.h-1 { font-size: clamp(48px, 8vw, 128px); }
.h-2 { font-size: clamp(36px, 5vw, 80px); }
.h-3 { font-size: clamp(24px, 3vw, 44px); font-weight: 600; line-height: 1.05; }
.h-4 { font-size: clamp(20px, 2vw, 28px); font-weight: 600; line-height: 1.15; }
.lead { font-size: clamp(18px, 1.6vw, 24px); line-height: 1.45; color: var(--ink-soft); text-wrap: pretty; }
.body-lg { font-size: clamp(16px, 1.2vw, 20px); line-height: 1.55; }

/* Top nav */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px clamp(20px, 4vw, 64px);
  mix-blend-mode: difference;
  color: #F5F1EA;
  pointer-events: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.topnav .nav-meta {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

/* Section meta marker */
.sec-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-bottom: clamp(20px, 2.6vw, 36px);
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}
.sec-meta .sec-num {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
}

/* Scroll reveal helpers */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 900ms cubic-bezier(.22,.61,.36,1), transform 900ms cubic-bezier(.22,.61,.36,1);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.in { opacity: 1; transform: translateY(0); }

html[data-anim="minimal"] .reveal {
  transform: none;
  transition: opacity 400ms ease;
}
html[data-anim="playful"] .reveal {
  transform: translateY(48px) scale(0.96);
  transition: opacity 700ms cubic-bezier(.16,1.2,.3,1), transform 900ms cubic-bezier(.16,1.2,.3,1);
}
html[data-anim="playful"] .reveal.in { transform: translateY(0) scale(1); }

/* Grid utilities */
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
}

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: transparent;
}
.chip--filled { background: var(--ink); color: var(--bg); }

/* Pixel pattern (echoes packaging grid) */
.grid-pattern {
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 80px 80px;
}

/* Tweaks button — pulled out */
.tweaks-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 60;
}

/* Scrollbar restyle (subtle) */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-mute); border-radius: 99px; }

/* Hide focus outline only when not keyboard */
:focus:not(:focus-visible) { outline: none; }

/* Section transition area */
.section + .section { border-top: 1px solid var(--line); }

/* Horizontal peek-slider controls (mobile only; hidden on desktop) */
.why-nav { display: none; }
.why-arrow {
  appearance: none;
  width: 42px; height: 42px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
}
.why-arrow:active { background: var(--ink); color: var(--bg); }

/* Print fallback */
@media print {
  .tweaks-fab, .topnav { display: none; }
  .section { padding: 40px 0; page-break-inside: avoid; }
}

/* Desktop: hide quality accordion (shown only on mobile) */
@media (min-width: 761px) {
  .trust-accordion { display: none !important; }
}

/* ===================== MOBILE ADAPTATION (≤760px) ===================== */
@media (max-width: 760px) {
  html, body { scroll-snap-type: none; font-size: 16px; }

  .section {
    min-height: auto;
    padding: 54px 0 40px;
  }
  .shell { padding: 0 18px; }

  /* Collapse two-column / multi-column CONTENT grids to one column.
     (icon rows like "auto 1fr" / mastheads "auto 1fr auto" have no minmax(0,
     so they are deliberately left intact) */
  .section [style*="minmax(0px,"] {
    grid-template-columns: 1fr !important;
    gap: 13px !important;
  }
  /* repeat(...) grids → max two columns (steps, stat trios, card walls) */
  .section [style*="grid-template-columns: repeat("] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Tighter vertical rhythm on phones so sections fit */
  .section p, .section li { line-height: 1.36 !important; }
  .section .display, .section h1, .section h2, .section h3 { line-height: 1.0 !important; }
  .section [style*="margin-bottom: clamp"] { margin-bottom: 14px !important; }

  /* ---- Cover (00) : stack to a vertical poster ---- */
  section[data-screen-label="00 Cover"] {
    height: auto !important;
    min-height: 100svh;
    overflow: visible !important;
  }
  section[data-screen-label="00 Cover"] > .shell {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "masthead" "headline" "image" "footer" !important;
    padding-top: 38px !important;
    gap: 13px !important;
  }
  /* Hide the tactical status strip on mobile */
  section[data-screen-label="00 Cover"] [style*="grid-area: strip"] { display: none !important; }
  section[data-screen-label="00 Cover"] figure { height: auto !important; max-height: none !important; }
  section[data-screen-label="00 Cover"] figure img { position: static !important; width: 100% !important; height: auto !important; }

  /* ---- Hero (01) : stack ---- */
  section[data-screen-label="01 Hero"] {
    height: auto !important;
    min-height: 100svh;
    overflow: visible !important;
  }
  section[data-screen-label="01 Hero"] > .shell {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "masthead" "headline" "image" "footer" !important;
    padding-top: 38px !important;
    gap: 13px !important;
  }
  section[data-screen-label="01 Hero"] figure { height: auto !important; max-height: none !important; }
  section[data-screen-label="01 Hero"] figure img { position: static !important; width: 100% !important; height: auto !important; }

  /* ---- Why (slide 3) : shrink lifestyle image so text fits ---- */
  section[data-screen-label="02 Why"] figure { aspect-ratio: 16 / 10 !important; max-height: 28vh !important; }

  /* Why three-cards → horizontal peek slider on mobile */
  .section .why-cards {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 14px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .why-cards::-webkit-scrollbar { display: none; }
  .why-cards > * { flex: 0 0 75% !important; scroll-snap-align: start; scroll-snap-stop: always; }
  .why-nav { display: flex !important; gap: 10px; justify-content: flex-end; margin-top: 14px; }

  /* System roles → 2 cards stacked vertically per page, paginated horizontally */
  .section .sys-cards {
    display: grid !important;
    grid-template-columns: none !important;
    grid-auto-flow: column !important;
    grid-template-rows: 1fr 1fr !important;
    grid-auto-columns: 75% !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 14px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sys-cards::-webkit-scrollbar { display: none; }
  .sys-cards > * { scroll-snap-align: start; }

  /* Day system (slide 4) : compact so it fits one screen */
  section[data-screen-label="04 Day system"] { padding-top: 36px !important; padding-bottom: 18px !important; }
  section[data-screen-label="04 Day system"] [style*="clamp(36px, 4vw, 60px)"] { font-size: 26px !important; line-height: 0.95 !important; }
  /* Stack the header (13 продуктів / intro / 5 моментів) so intro text isn't crushed into a narrow column */
  section[data-screen-label="04 Day system"] [style*="grid-template-columns: auto 1fr auto"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    align-items: start !important;
  }
  section[data-screen-label="04 Day system"] [style*="grid-template-columns: auto 1fr auto"] > p { max-width: none !important; }

  /* Slide 03: tighten intro paragraph line-height to reduce block height */
  section[data-screen-label="03 System"] p.lead,
  section[data-screen-label="03 System"] p.body-lg { line-height: 1.2 !important; }

  /* Slide 04: hide redundant left context block on mobile (timeline rail already shows it) */
  section[data-screen-label="04 Day system"] .day-context { display: none !important; }


  /* Cover: hide footer strip (ДАЛІ / 01/09) on mobile */
  .cover-footer { display: none !important; }

  /* Slide 08 Manifesto: hide slide counter on mobile */
  .slide-counter { display: none !important; }

  /* Slide 08: footer as single horizontal flex row on mobile */
  .manifesto-footer {
    display: flex !important;
    gap: 14px !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  .manifesto-footer .brand-logo { height: 36px !important; }
  /* Slide 04: headline grid — 2 cols on mobile (h2 + paragraph side by side), eyebrow full width */
  section[data-screen-label="04 Day system"] .day-headline-grid { grid-template-columns: auto 1fr !important; gap: 12px !important; align-items: start !important; }
  section[data-screen-label="04 Day system"] .day-headline-grid .eyebrow { grid-column: 1 / -1; }
  section[data-screen-label="04 Day system"] .day-tabbar { display: none !important; }
  section[data-screen-label="04 Day system"] .day-rail { display: block !important; margin-top: 4px; }
  section[data-screen-label="04 Day system"] .day-prod-nav { display: flex !important; gap: 10px; justify-content: flex-end; margin-top: 12px; }


  /* Product cards → horizontal snap slider (no vertical growth) */
  section[data-screen-label="04 Day system"] [style*="justify-content: start"] {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  section[data-screen-label="04 Day system"] [style*="justify-content: start"]::-webkit-scrollbar { display: none; }
  section[data-screen-label="04 Day system"] [style*="justify-content: start"] > * {
    flex: 0 0 72% !important;
    min-width: 0 !important;
    scroll-snap-align: start;
  }
  section[data-screen-label="04 Day system"] [style*="margin-top: clamp(18px"] { margin-top: 12px !important; }
  /* Hide the heavy per-daypart detail (context + product cards) on mobile */

  /* Cover/Hero masthead: logo + city in one row, orange strip below */
  section[data-screen-label="00 Cover"] [style*="auto 1fr auto"],
  section[data-screen-label="01 Hero"] [style*="auto 1fr auto"] {
    grid-template-columns: auto auto !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 6px 12px !important;
  }
  section[data-screen-label="00 Cover"] [style*="auto 1fr auto"] > span:nth-child(2),
  section[data-screen-label="01 Hero"] [style*="auto 1fr auto"] > span:nth-child(2) {
    grid-column: 1 / -1 !important;
    justify-self: stretch !important;
    text-align: center !important;
    font-size: 9px !important;
    padding: 5px 10px !important;
  }
  /* swap city → slide number on mobile */
  .masthead-city { display: none !important; }
  .masthead-slide-num { display: inline-flex !important; }

  /* Quality slide 06: show accordion, hide flat tag grid on mobile */
  section[data-screen-label="06 Quality"] .trust-accordion { display: flex !important; }
  section[data-screen-label="06 Quality"] [style*="flex-wrap: wrap"] { display: none !important; }
  section[data-screen-label="00 Cover"] .sec-meta {
    color: rgba(236,232,218,0.55) !important;
    border-top-color: rgba(236,232,218,0.15) !important;
  }

  /* ---- Slide nav : compact, horizontally scrollable, numbers only ---- */
  nav[aria-label="Навігація по слайдах"] {
    max-width: 94vw;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  nav[aria-label="Навігація по слайдах"]::-webkit-scrollbar { display: none; }
  nav[aria-label="Навігація по слайдах"] button { padding: 7px 9px !important; gap: 0 !important; }
  nav[aria-label="Навігація по слайдах"] button > span:last-child { display: none !important; }
}

/* Phones in landscape / very short viewports: let covers breathe */
@media (max-width: 760px) and (max-height: 520px) {
  section[data-screen-label="00 Cover"],
  section[data-screen-label="01 Hero"] { min-height: auto; }
}
