/*
 * MiseLife landing page. Tokens are copied from the app's src/styles/tokens.css (source of truth:
 * DESIGN.md). Only the ones this page uses are here; if DESIGN.md changes, update both.
 */

/* Fonts ship with the site (SIL Open Font License, from Fontsource). Nothing loads from Google. */
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/schibsted-grotesk-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/schibsted-grotesk-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/schibsted-grotesk-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Fragment Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/fragment-mono-latin-400-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --sans: "Schibsted Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Fragment Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-8: 32px;
  --radius-sm: 10px; --radius-md: 16px; --radius-lg: 22px; --radius-pill: 999px;
  --grain: url("textures/grain.svg");
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 150ms;
  --hover-tint: color-mix(in srgb, var(--text) 7%, transparent);
  --tap: 44px;
  --dot: 22px;
  /* Page rhythm: multiples of the 32px step, so nothing sits between the scale. */
  --gutter: var(--space-4);
  --section-space: calc(var(--space-8) * 2);

  --bg: #EBE9E5; --surface: #F6F4F1; --line: #D6D4CF;
  --text: #121110; --text-2: #5D5A56; --big-2: #84827D; --ink: #121110;
  --off-day: #B3B0A9;
  --accent: #C74400; --accent-text: #B73D00; --on-accent: #FFFFFF;
  --wk-good-1: #FAEB9C; --wk-good-2: #F4C53A;
  --wk-okay: linear-gradient(135deg, #F1C7AC, #AAA0E6);
  --wk-rough: linear-gradient(135deg, #807CC6, #444E91);
  --sage-1: #428557; --sage-1-g1: #D2F5E1; --sage-1-g2: #98DAA9; --sage-1-deep: #0D6332;
  --lavender-1: #6769BF; --lavender-1-g1: #E8E6FF; --lavender-1-g2: #B7BEFF; --lavender-1-deep: #4947A2;
  --lavender-3-g1: #EBE7FF; --lavender-3-g2: #C2C1F6; --lavender-3-deep: #514E83;
  --sky-1: #247DAD;
}

/* Dark follows the system. data-theme="dark" forces it (handy for checking both). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #100F0E; --surface: #1A1917; --line: #2C2B29;
    --text: #F2F0EC; --text-2: #A7A49F; --big-2: #6B6964;
    --off-day: #42403D;
    --accent: #F97C3D; --accent-text: #F97C3D; --on-accent: #121110;
    --wk-good-1: #FBF1B2; --wk-good-2: #F7CC4B;
    --sage-1: #7CC08F; --sage-1-g1: #A6D8BC; --sage-1-g2: #73B785;
    --lavender-1: #9EA4FF; --lavender-1-g1: #C7C2FF; --lavender-1-g2: #959AF4;
    --lavender-3-g1: #CBC5E9; --lavender-3-g2: #9F9ED4;
    --sky-1: #65B8EB;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #100F0E; --surface: #1A1917; --line: #2C2B29;
  --text: #F2F0EC; --text-2: #A7A49F; --big-2: #6B6964;
  --off-day: #42403D;
  --accent: #F97C3D; --accent-text: #F97C3D; --on-accent: #121110;
  --wk-good-1: #FBF1B2; --wk-good-2: #F7CC4B;
  --sage-1: #7CC08F; --sage-1-g1: #A6D8BC; --sage-1-g2: #73B785;
  --lavender-1: #9EA4FF; --lavender-1-g1: #C7C2FF; --lavender-1-g2: #959AF4;
  --lavender-3-g1: #CBC5E9; --lavender-3-g2: #9F9ED4;
  --sky-1: #65B8EB;
}

/* A habit's color is inherited by its dots, rows and gradients (like habitVars() in the app). */
.fam-sage { --habit: var(--sage-1); --habit-g1: var(--sage-1-g1); --habit-g2: var(--sage-1-g2); --habit-deep: var(--sage-1-deep); }
.fam-lavender { --habit: var(--lavender-1); --habit-g1: var(--lavender-1-g1); --habit-g2: var(--lavender-1-g2); --habit-deep: var(--lavender-1-deep); }
.fam-lavender-soft { --habit-g1: var(--lavender-3-g1); --habit-g2: var(--lavender-3-g2); --habit-deep: var(--lavender-3-deep); }
.fam-sky { --habit: var(--sky-1); }

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; -webkit-tap-highlight-color: transparent; }
i { font-style: normal; }

:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.mono {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.3;
}

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

/* ---------- Two-tone headings ---------- */

.tt {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.98;
  text-wrap: balance;
}

.tt-2 { color: var(--big-2); }

/* Sized so "for a messy head." fits one line from a 375px phone up. */
.tt-xl { font-size: clamp(38px, 10.2vw, 124px); letter-spacing: -0.045em; line-height: 0.92; }
.tt-lg { font-size: clamp(34px, 6vw, 56px); }

.lead {
  font-size: 19px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

/* ---------- Buttons (flat, like the app) ---------- */

.btn {
  min-height: var(--tap);
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  border: 1px solid currentColor;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, transform 120ms ease;
}

a.btn:active { transform: scale(0.97); }

.btn-solid { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn-grow { flex: 1; width: 100%; }
.btn-sm { min-height: 40px; padding: 0 var(--space-4); font-size: 14px; }
.btn-lg { min-height: 56px; font-size: 17px; }

.btn-ink { color: var(--ink); }
.btn-ink.btn-solid { background: var(--ink); border-color: var(--ink); color: #F6F4F1; }
.btn-ink:focus-visible { outline-color: var(--ink); }

@media (hover: hover) and (pointer: fine) {
  a.btn:hover { background-color: var(--hover-tint); }
  a.btn-solid:hover {
    background-color: color-mix(in srgb, var(--text) 84%, var(--bg));
    border-color: color-mix(in srgb, var(--text) 84%, var(--bg));
  }
  a.btn-ink.btn-solid:hover { background-color: #2B2926; border-color: #2B2926; }
}

.actions {
  display: flex;
  gap: var(--space-2);
}

/* ---------- Header and footer ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: max(var(--space-4), env(safe-area-inset-top));
  padding-bottom: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.brand-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

/* The logo direction: a 3×3 grid of rounded squares, black on paper, white in dark. */
.mark {
  display: grid;
  grid-template-columns: repeat(3, 6px);
  gap: 2px;
}

.mark i {
  width: 6px;
  height: 6px;
  border-radius: 1.5px;
  background: var(--text);
}

.foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--section-space);
  padding-bottom: max(var(--space-8), env(safe-area-inset-bottom));
  font-size: 14px;
}

/* ---------- Shared pieces from the app ---------- */

/* A soft, grainy gradient field (GradientSurface). Text on it is always ink. */
.gradient {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--ink);
  background-image:
    var(--grain),
    radial-gradient(90% 80% at 15% 15%, var(--habit-g1), transparent 65%),
    radial-gradient(80% 90% at 95% 95%, var(--habit-g2), transparent 70%),
    linear-gradient(160deg, var(--habit-g1), var(--habit-g2));
  background-blend-mode: overlay, normal, normal, normal;
}

/* The faint orange "now" glow, allowed on the Up next card only. */
.glow {
  background-image:
    var(--grain),
    radial-gradient(90% 80% at 15% 15%, var(--habit-g1), transparent 65%),
    radial-gradient(80% 90% at 95% 95%, var(--habit-g2), transparent 70%),
    radial-gradient(50% 45% at 100% 0%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 70%),
    linear-gradient(160deg, var(--habit-g1), var(--habit-g2));
  background-blend-mode: overlay, normal, normal, normal, normal;
}

.honey {
  --habit-g1: var(--wk-good-1);
  --habit-g2: var(--wk-good-2);
}

/* Day dots: filled circles, all the same size, grain in the fill. No rings. */
.dots {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.dot {
  display: block;
  width: var(--dot);
  height: var(--dot);
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background-color: var(--off-day);
  background-image: var(--grain);
  background-blend-mode: overlay;
}

.dot.past { background-color: var(--big-2); }
.dot.done { background-color: var(--habit); }
.dot.planned { background-color: color-mix(in srgb, var(--habit) 38%, var(--bg)); }
.dot.today { background-color: var(--accent); }

/* On the habit's own gradient, which already has grain. */
.dot.on-g { background-image: none; }
.dot.on-g.off { background-color: rgba(18, 17, 16, 0.12); }
.dot.on-g.past { background-color: rgba(18, 17, 16, 0.42); }
.dot.on-g.planned { background-color: color-mix(in srgb, var(--habit-deep) 38%, transparent); }

/* List rows like Today's: a category dot lined up with the title's first line. */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.row-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background-color: var(--habit);
  background-image: var(--grain);
  background-blend-mode: overlay;
}

.row-title {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Deadline chips */
.chip {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

.chip-soon { color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-text); }
.chip-far { color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }

svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- Hero ---------- */

.hero {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.hero-body {
  display: grid;
  gap: calc(var(--space-8) + var(--space-4));
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 34em;
}

.hero-copy .actions { margin-top: var(--space-2); }

.hero-visual {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  width: 100%;
  pointer-events: none;
  user-select: none;
}

.upnext {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.upnext-labels {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.link-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.link-count .gap { width: var(--space-2); }

.upnext-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.upnext-actions {
  display: flex;
  gap: var(--space-2);
}

.rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ---------- Sections: heading beside content on wide screens, like the app's left column ---------- */

.section {
  display: grid;
  gap: var(--space-6);
  padding-top: var(--section-space);
}

.aside {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-self: start;
}

.content { min-width: 0; }

.prose { display: flex; flex-direction: column; gap: var(--space-4); max-width: 36em; }

/* ---------- How it works ---------- */

.steps {
  display: grid;
  gap: var(--space-8);
}

/* Two across once each panel has room (the content column is about 625px on desktop). Side by side,
   the panels share one height so the rows line up. */
@media (min-width: 600px) {
  .steps .step-visual { height: 232px; padding: var(--space-4); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: calc(var(--space-8) + var(--space-4)); }
}

.step {
  display: flex;
  flex-direction: column;
}

.step h3 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-top: var(--space-2);
}

.step > p:last-child {
  margin-top: var(--space-2);
  color: var(--text-2);
}

.step-num { margin-top: var(--space-4); }

/* Every visual sits in the same paper panel, so the four line up. */
.step-visual {
  padding: var(--space-6) var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  pointer-events: none;
  user-select: none;
}

/* 01: the category picks from onboarding */
.picks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.pick {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
}

.pick i {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background-color: var(--off-day);
  background-image: var(--grain);
  background-blend-mode: overlay;
}

.pick.picked { background: var(--habit-g2); border-color: var(--habit-g2); color: var(--ink); }
.pick.picked i { background-color: var(--habit-deep); }

/* 02: two saved links in the Library */
.saved {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  height: 100%;
  min-height: 176px;
}

.saved-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: 18px;
}

.saved-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.12;
}

.saved-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.attached {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.attached span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 03: a habit on Today and its Done */
.doit {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.doit .dots { margin-bottom: var(--space-1); }

/* 04: a month of dots and the week circles, on the same columns */
.progress {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
}

.grid .dot { width: 100%; height: auto; aspect-ratio: 1; }

.sky { aspect-ratio: 1; border-radius: var(--radius-pill); background-blend-mode: overlay, normal; }
.sky.good { background-image: var(--grain), linear-gradient(135deg, var(--wk-good-1), var(--wk-good-2)); }
.sky.okay { background-image: var(--grain), var(--wk-okay); }
.sky.rough { background-image: var(--grain), var(--wk-rough); }

/* ---------- Privacy ---------- */

.facts {
  display: grid;
  gap: var(--space-6);
}

.fact {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 36em;
}

.fact h3 {
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.fact p { color: var(--text-2); font-size: 17px; }

/* ---------- Founding members ---------- */

.founding {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.founding-labels {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.founding-big {
  font-weight: 700;
  font-size: clamp(24px, 3.4vw, 34px);
  letter-spacing: -0.02em;
  line-height: 1.08;
  text-wrap: balance;
}

.founding .btn { margin-top: var(--space-2); }

/* ---------- Home screen ---------- */

#install .content {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.platforms {
  display: grid;
  gap: var(--space-3);
}

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

.platform {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.platform h3 { color: var(--text-2); }

.platform ol {
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: 16px;
  font-weight: 600;
}

.platform li {
  counter-increment: step;
  display: flex;
  gap: var(--space-3);
}

.platform li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 1.2em;
  font-family: var(--mono);
  font-weight: 400;
  color: var(--accent-text);
  line-height: 1.6;
  font-size: 13px;
}

.note { color: var(--text-2); max-width: 36em; }

/* ---------- Last call to action ---------- */

#start .content {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* ---------- Wider screens ---------- */

@media (min-width: 768px) {
  :root {
    --gutter: var(--space-8);
    --section-space: calc(var(--space-8) * 3);
  }

  .hero { padding-top: calc(var(--space-8) * 2); gap: calc(var(--space-8) * 1.5); }
  .lead { font-size: 21px; }

  .foot {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
  }

  .founding { padding: var(--space-8); gap: var(--space-5); }
}

@media (min-width: 1024px) {
  .hero-body {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: calc(var(--space-8) * 2);
    align-items: start;
  }

  .hero-visual { justify-self: end; max-width: 520px; }

  /* Heading in a fixed left column, content scrolling beside it, as in the app. */
  .section {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: calc(var(--space-8) * 2);
  }

  .aside {
    position: sticky;
    top: var(--space-8);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
