/* BackMind marketing site — "Cozy" style.
   Token values are verbatim from the landing-page design handoff. Three themes,
   cycled by the nav pill and stored in localStorage['bm-theme-v2']. */

:root,
html[data-theme="pink"] {
  --bg: #fdf2e2;
  --band: #fbe8d3;
  --surface: #fffaf1;
  --border: #f0dcc2;
  --border-dash: #e5c9a4;
  --ink: #5f4a35;
  --body-c: #7d6248;
  --book-ink: #6b5138;
  --muted: #b08a5f;
  --faint: #d9b78e;
  --accent: #ef8f8f;
  --on-accent: #fffaf1;
  --chip-bg: #fbd9d3;
  --chip-fg: #c96b6b;
  --chip2-bg: #cfe4ef;
  --chip2-fg: #5b8aa6;
  --chip3-bg: #f7e3b8;
  --chip3-fg: #b08a3f;
  --sel: #fbd9d3;
  --nav-bg: rgba(253, 242, 226, 0.94);
}

html[data-theme="green"] {
  --bg: #1d211d;
  --band: #222822;
  --surface: #282e28;
  --border: #3a453b;
  --border-dash: #465246;
  --ink: #e9ece4;
  --body-c: #c2c8ba;
  --book-ink: #d8dccb;
  --muted: #96a091;
  --faint: #6e7a6e;
  --accent: #9db89d;
  --on-accent: #1d211d;
  --chip-bg: #2f3a2f;
  --chip-fg: #aec7ae;
  --chip2-bg: #2b3640;
  --chip2-fg: #9dbdd1;
  --chip3-bg: #3d3828;
  --chip3-fg: #d9c36a;
  --sel: #3d4a3d;
  --nav-bg: rgba(29, 33, 29, 0.92);
}

html[data-theme="colorful"] {
  --bg: #fff6ea;
  --band: #e4f1ee;
  --surface: #ffffff;
  --border: #eddcc3;
  --border-dash: #dfc9a5;
  --ink: #3f4a58;
  --body-c: #5d6b73;
  --book-ink: #4a5563;
  --muted: #8ba394;
  --faint: #b7c9bd;
  --accent: #f4845f;
  --on-accent: #ffffff;
  --chip-bg: #fde0d5;
  --chip-fg: #d06a48;
  --chip2-bg: #d7e9f5;
  --chip2-fg: #4d84ad;
  --chip3-bg: #fdf0c9;
  --chip3-fg: #b3902f;
  --sel: #fdf0c9;
  --nav-bg: rgba(255, 246, 234, 0.94);
}

/* Constants across all three themes */
:root {
  --star: #e9c46a;
  --shadow-soft: 0 12px 30px rgba(160, 110, 70, 0.14);
  --shadow-book: 0 16px 32px rgba(160, 110, 70, 0.18);
  --shadow-lift: 0 8px 24px rgba(160, 110, 70, 0.25);
}

/* ---------------------------------------------------------------- base --- */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body-c);
  font-family: "Quicksand", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

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

::selection {
  background: var(--sel);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

section[id],
header[id] {
  scroll-margin-top: 78px;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

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

/* ------------------------------------------------------------ primitives --- */

.section {
  border-top: 2px solid var(--border);
}

.section--band {
  background: var(--band);
}

.section__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(56px, 9vw, 84px) clamp(20px, 4vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.section__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.h2 {
  margin: 0;
  font-family: "Baloo 2", "Quicksand", sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 4.5vw, 36px);
  color: var(--ink);
  text-wrap: pretty;
}

.badge {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  border-radius: 999px;
  padding: 7px 20px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--on-accent);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.pill--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.pill--primary:hover {
  opacity: 0.9;
  color: var(--on-accent);
}

.pill--ghost {
  background: var(--surface);
  border-color: var(--border-dash);
  color: var(--body-c);
}

.pill--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pill--nav {
  padding: 8px 18px;
  font-size: 13px;
}

.pill--lg {
  padding: 13px 26px;
  font-size: 14.5px;
}

.pill--cta {
  padding: 13px 28px;
  font-size: 14.5px;
}

.chip {
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 700;
  background: var(--chip-bg);
  color: var(--chip-fg);
}

.chip--blue {
  background: var(--chip2-bg);
  color: var(--chip2-fg);
}

.chip--gold {
  background: var(--chip3-bg);
  color: var(--chip3-fg);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid--sm {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.grid--md {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}

.grid--lg {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 24px;
}

.num {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Baloo 2", "Quicksand", sans-serif;
  font-size: 17px;
  font-weight: 700;
}

.num--sm {
  width: 24px;
  height: 24px;
  font-size: 13px;
}

.wordmark {
  display: flex;
  gap: 0.16em;
  font-family: "Baloo 2", "Quicksand", sans-serif;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

/* "reading yourself backwards" — only the K is mirrored */
.wordmark__k {
  display: inline-block;
  transform: scaleX(-1);
}

/* ----------------------------------------------------------------- nav --- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--border);
}

.nav__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 32px);
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav .wordmark {
  font-size: 15px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 13.5px;
  font-weight: 600;
}

.nav__links a {
  color: var(--body-c);
}

.nav__links a:hover {
  color: var(--accent);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 2px solid var(--border-dash);
  background: var(--surface);
  cursor: pointer;
  font-family: "Quicksand", sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--body-c);
}

.theme-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 760px) {
  .nav__links {
    display: none;
  }
}

/* ---------------------------------------------------------------- hero --- */

.hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 80px) clamp(20px, 4vw, 32px) clamp(56px, 9vw, 88px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: clamp(32px, 6vw, 56px);
  align-items: center;
}

.hero__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 2px dashed var(--border-dash);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.hero__title {
  margin: 0;
  font-family: "Baloo 2", "Quicksand", sans-serif;
  font-weight: 700;
  font-size: clamp(38px, 5.8vw, 58px);
  line-height: 1.1;
  color: var(--accent);
  text-wrap: pretty;
}

.hero__sub {
  margin: 0;
  max-width: 480px;
  font-size: 16.5px;
  line-height: 1.75;
  font-weight: 500;
  color: var(--body-c);
  text-wrap: pretty;
}

.hero__ctas {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.hero__note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* -------------------------------------------------------- diary spread --- */

.spread-panel {
  position: relative;
  background: var(--band);
  border: 2px solid var(--border);
  border-radius: 28px;
  padding: clamp(28px, 5vw, 52px) clamp(20px, 4vw, 36px);
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.spread-panel__sticker {
  position: absolute;
  top: 16px;
  right: 20px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  transform: rotate(4deg);
}

/* The spread scales as one unit: every size inside is in cqw, so the pages
   never clip regardless of the column width. */
.spread {
  display: flex;
  width: 100%;
  max-width: 524px;
  container-type: inline-size;
  filter: drop-shadow(var(--shadow-book));
}

.page {
  width: 50%;
  min-width: 0;
  aspect-ratio: 262 / 380;
  background: var(--surface);
  border: 2px solid var(--border);
  padding: 5.7cqw 5cqw 4.2cqw;
  display: flex;
  flex-direction: column;
  gap: 2.5cqw;
  overflow: hidden;
}

.page--left {
  border-radius: 14px 4px 4px 14px;
  background-image: linear-gradient(to left, rgba(160, 110, 70, 0.06), rgba(160, 110, 70, 0) 14%);
}

.page--right {
  border-left: none;
  border-radius: 4px 14px 14px 4px;
  background-image: linear-gradient(to right, rgba(160, 110, 70, 0.06), rgba(160, 110, 70, 0) 14%);
}

.page__chapter {
  text-align: center;
  margin-bottom: 0.8cqw;
  font-size: 2cqw;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--faint);
}

.entry {
  display: flex;
  flex-direction: column;
  gap: 1cqw;
}

.entry__date {
  font-size: 2cqw;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.entry__star {
  color: var(--star);
}

.entry__text {
  font-size: 2.2cqw;
  line-height: 1.75;
  font-weight: 500;
  color: var(--book-ink);
}

.page__num {
  margin-top: auto;
  text-align: center;
  font-size: 1.7cqw;
  font-weight: 600;
  color: var(--faint);
}

@media (max-width: 900px) {
  .spread {
    max-width: 440px;
  }
}

/* ---------------------------------------------------------------- demo --- */

.demo__inner {
  align-items: center;
  gap: 16px;
}

.demo__title {
  text-align: center;
}

.demo__sub {
  margin: 0;
  max-width: 520px;
  font-size: 15px;
  line-height: 1.7;
  font-weight: 500;
  color: var(--body-c);
  text-align: center;
  text-wrap: pretty;
}

.demo__frame {
  position: relative;
  display: block;
  width: 100%;
  max-width: 860px;
  aspect-ratio: 16 / 9;
  margin-top: 12px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.demo__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.demo__frame:hover {
  border-color: var(--accent);
}

.demo__caption {
  position: absolute;
  right: 14px;
  bottom: 14px;
  background: var(--nav-bg);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  box-shadow: var(--shadow-lift);
}

/* --------------------------------------------------------- ingredients --- */

.ingredient {
  background: var(--surface);
  border: 2px dashed var(--border-dash);
  border-radius: 22px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.ingredient__name {
  font-family: "Baloo 2", "Quicksand", sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.ingredient p {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  font-weight: 500;
  color: var(--body-c);
}

/* --------------------------------------------------------------- cards --- */

.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 22px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.card p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  font-weight: 500;
  color: var(--body-c);
}

.card p a {
  color: var(--accent);
  text-decoration: underline;
}

/* ------------------------------------------------------- export guide --- */

.export__intro {
  max-width: 640px;
}

.export__intro p {
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  font-weight: 500;
  color: var(--body-c);
  text-wrap: pretty;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab {
  padding: 10px 22px;
  border: 2px solid var(--border-dash);
  border-radius: 999px;
  background: var(--surface);
  color: var(--body-c);
  font-family: "Quicksand", sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.tab:hover {
  border-color: var(--accent);
}

.tab[aria-selected="true"] {
  border-color: var(--accent);
  background: var(--chip-bg);
  color: var(--chip-fg);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel__title {
  margin: 0;
  font-family: "Baloo 2", "Quicksand", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.step {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 22px;
  padding: 24px 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step__title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}

.step p {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  font-weight: 500;
  color: var(--body-c);
}

.step strong {
  color: var(--ink);
}

.footnote {
  display: inline-flex;
  align-self: flex-start;
  background: var(--band);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

/* ---------------------------------------------------------------- tips --- */

.tips-grid {
  padding: clamp(56px, 9vw, 84px) clamp(20px, 4vw, 32px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 24px;
  max-width: 1120px;
  margin: 0 auto;
}

.tips-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 28px;
  padding: clamp(26px, 4vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tips-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tip {
  display: flex;
  gap: 10px;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 500;
  color: var(--body-c);
}

.tip__heart {
  color: var(--accent);
}

.tip strong {
  color: var(--ink);
}

/* ----------------------------------------------------------------- faq --- */

.faq__inner {
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(56px, 9vw, 84px) clamp(20px, 4vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.faq__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq__item {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 4px 22px;
}

.faq__q {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: "Quicksand", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
}

.faq__marker {
  color: var(--accent);
  font-size: 17px;
  font-weight: 700;
}

.faq__a {
  margin: 0;
  padding: 0 0 18px;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 500;
  color: var(--body-c);
}

/* ----------------------------------------------------------------- cta --- */

.cta__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(60px, 10vw, 92px) clamp(20px, 4vw, 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.cta__title {
  margin: 0;
  max-width: 600px;
  font-family: "Baloo 2", "Quicksand", sans-serif;
  font-weight: 700;
  font-size: clamp(30px, 5vw, 42px);
  color: var(--accent);
  text-wrap: pretty;
}

.cta__sub {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--body-c);
}

.cta__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

/* -------------------------------------------------------------- footer --- */

.footer {
  border-top: 2px solid var(--border);
}

.footer__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px clamp(20px, 4vw, 32px) 36px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.footer__top {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 280px;
}

.footer .wordmark {
  font-size: 14px;
}

.footer__tagline {
  font-size: 13.5px;
  font-weight: 600;
  font-style: italic;
  color: var(--muted);
}

.footer__cols {
  display: flex;
  gap: 56px;
  flex-wrap: wrap;
}

.footer__col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.footer__col a {
  color: var(--body-c);
}

.footer__col a:hover {
  color: var(--accent);
}

.footer__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.footer__privacy {
  max-width: 220px;
}

.footer__privacy p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.65;
  font-weight: 500;
  color: var(--muted);
}

.footer__bottom {
  border-top: 2px solid var(--border);
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--faint);
}

/* ------------------------------------------------ progressive enhancement ---
   Without JS every export panel and every FAQ answer stays open and readable;
   the tab strip and the +/- markers only appear once JS can drive them. */

.tabs,
.faq__marker {
  display: none;
}

html.js .tabs {
  display: flex;
}

html.js .faq__marker {
  display: inline;
}

html.js .panel {
  display: none;
}

html.js .panel.is-active {
  display: flex;
}

html.js .panel__title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html.js .faq__a {
  display: none;
}

html.js .faq__item.is-open .faq__a {
  display: block;
}

/* ------------------------------------------------------------- motion ---
   `anim` is set by the head script only when JS is on AND the visitor has
   not asked for reduced motion. It hides exactly what landing.js animates
   in with GSAP — nothing else — and is removed if GSAP fails to load, so
   the page can never be left invisible. */

html.anim .hero__text > *,
html.anim .spread-panel,
html.anim .demo__inner > *,
html.anim .section__head > *,
html.anim .grid > *,
html.anim .tips-card,
html.anim .faq__item,
html.anim .cta__inner > * {
  opacity: 0;
}

/* Export panels are display:none while their tab is inactive, so a scroll
   trigger would never fire for them. They animate on tab switch instead. */
html.anim .panel .grid > * {
  opacity: 1;
}
