/* SleepLog landing page. Tokens follow the app's Sleep Diary theme (SleepLog/Theme/SleepTheme.swift). */
:root {
  --navy: #070d23;
  --navy-2: #0a1230;
  --card: #0e1532;
  --raised: #18214a;
  --ivory: #f2ebdd;
  --text: #ffffff;
  --text-2: #b0b7db;
  --text-3: #8890b8;
  --peri: #93a9ff;
  --peri-deep: #5468f0;
  --amber: #f4b860;
  --teal: #3fc7b5;
  --stroke: rgba(147, 169, 255, 0.18);
  --serif: "New York", ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --hand: "Bradley Hand", "Segoe Print", "Comic Neue", "Chalkboard SE", cursive;
  --wrap: 1180px;
  --gutter: clamp(20px, 5vw, 48px);
  --section-pad: clamp(56px, 7vw, 96px);
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}
::selection { background: var(--peri-deep); color: #fff; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--navy);
  color: var(--text-2);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--peri); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; color: var(--ivory); margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0 0 1em; text-wrap: pretty; }
strong { color: var(--text); font-weight: 600; }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--ivory); color: var(--navy); padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--peri); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); position: relative; }
.wrap.narrow { max-width: 780px; }

/* Header */
.top {
  position: absolute; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 28px;
  background: linear-gradient(180deg, rgba(7, 13, 35, .58), rgba(7, 13, 35, 0));
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ivory); text-decoration: none; font: 22px/1 var(--serif); }
.brand img { border-radius: 9px; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.top-cta {
  color: var(--ivory); text-decoration: none; font-size: 15px; font-weight: 600;
  padding: 9px 16px; border-radius: 999px; border: 1px solid rgba(242, 235, 221, .28);
  background: rgba(7, 13, 35, .45); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.top-cta { transition: border-color .2s ease, background .2s ease; }
.top-cta:hover { border-color: var(--ivory); background: rgba(7, 13, 35, .68); }

/* Eyebrow + moon (the app's DiaryEyebrow) */
.eyebrow { display: flex; align-items: center; gap: 8px; font: 18px/1.2 var(--serif); color: var(--peri); margin-bottom: 14px; }
.moon { width: 18px; height: 18px; fill: var(--peri); filter: drop-shadow(0 0 6px rgba(147, 169, 255, .55)); }

/* Hand notes (the app's HandNote: tilted, pen underline) */
.hand {
  font: 22px/1.2 var(--hand); color: var(--peri); margin: 0;
  transform: rotate(-4deg); display: inline-block; position: relative; padding-bottom: 6px;
}
.hand::after {
  content: ""; position: absolute; left: 4%; right: 0; bottom: 0; height: 2px; border-radius: 2px;
  background: currentColor; opacity: .7; transform: rotate(-1.5deg);
}

/* Phones. Geometry from the real 6.3" iPhone the screens were captured on (1206x2622 px, 402x874 pt):
   screen corner radius 62 pt (15.4% of screen width); black border 1.15 mm and metal band 1.3 mm around a
   66.6 mm-wide screen (1.7% and 2% of screen width). --s is the visible screen width; the screen is never cropped. */
.phone {
  --s: min(282px, 66vw);
  position: relative; width: calc(var(--s) * 1.034); padding: calc(var(--s) * .017);
  border-radius: calc(var(--s) * .171); background: #050608;
  box-shadow:
    0 0 0 calc(var(--s) * .02) #23262f,
    0 0 0 calc(var(--s) * .02 + 1px) rgba(190, 200, 235, .28),
    inset 0 0 0 1px rgba(255, 255, 255, .05),
    0 30px 80px -20px rgba(0, 0, 0, .8), 0 0 60px -10px rgba(84, 104, 240, .22);
}
.phone img { display: block; width: 100%; height: auto; aspect-ratio: 1206 / 2622; border-radius: calc(var(--s) * .154); }
/* No CSS Dynamic Island: the real app screenshots already include it. */
.card-shot {
  width: min(250px, 60vw); border-radius: 26px; overflow: hidden;
  border: 1px solid var(--stroke); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .85);
}

/* Hero */
.hero { position: relative; min-height: min(100svh, 940px); display: flex; align-items: center; overflow: hidden; padding: 110px 0 72px; }
.hero-art { position: absolute; inset: 0; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: 70% 50%; }
.hero::after { /* wall shade under the words; fades into the page below */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(7, 13, 35, .92) 0%, rgba(7, 13, 35, .72) 38%, rgba(7, 13, 35, 0) 62%),
    linear-gradient(180deg, rgba(7, 13, 35, 0) 58%, rgba(7, 13, 35, .55) 82%, var(--navy) 100%);
}
.hero-grid { z-index: 2; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 40px; align-items: center; width: 100%; }
.hero h1 { font-size: clamp(46px, 6.4vw, 88px); line-height: 1.02; margin-bottom: 22px; }
.lede { font-size: clamp(19px, 1.7vw, 22px); color: var(--text); max-width: 34em; }
.definition { max-width: 36em; color: var(--text-2); }
.definition strong { font-weight: 600; }
.trust { font-size: 14px; color: var(--text-3); margin-top: 18px; letter-spacing: .02em; }
.hero-phone { margin: 0 2% 40px 0; justify-self: end; position: relative; display: flex; align-items: flex-end; --hs: min(212px, 16.2vw); }
.hero-phone .phone { --s: var(--hs); transform: rotate(2deg); }
/* Folded iPhone Duo in front of the iPhone: real cover shape (466x678 pt), drawn 1.3x the iPhone's scale (402x874 pt) so it leads. */
.hero-phone .phone.cover { --s: calc(var(--hs) * 466 / 402 * 1.3); z-index: 2; margin: 0 calc(var(--hs) * -.14) calc(var(--hs) * -.1) 0; transform: rotate(-3deg);
  border-radius: calc(var(--s) * .13); }
.hero-phone .phone.cover img { aspect-ratio: 1398 / 2034; border-radius: calc(var(--s) * .115); }
.note-hero { position: absolute; right: 0; bottom: -58px; color: var(--amber); white-space: nowrap; }

/* CTA */
.cta-row { display: flex; align-items: center; gap: 22px; margin-top: 30px; flex-wrap: wrap; }
.cta-row.center { justify-content: center; }
.store-badge {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  background: #000; color: #fff; border: 1px solid #a6a6a6; border-radius: 12px;
  padding: 9px 20px 9px 15px; min-height: 58px; transition: transform .2s ease, box-shadow .2s ease;
}
.store-badge svg { width: 28px; height: 28px; fill: #fff; }
.store-badge span { display: flex; flex-direction: column; font: 600 23px/1.05 var(--sans); letter-spacing: -.01em; }
.store-badge small { font-size: 12px; font-weight: 500; letter-spacing: .01em; }
.store-badge:hover { transform: translateY(-1px); box-shadow: 0 10px 30px -8px rgba(147, 169, 255, .45); }
.qr-card { display: none; align-items: center; gap: 14px; padding: 10px 16px 10px 10px; border-radius: 18px; background: rgba(14, 21, 50, .72); border: 1px solid var(--stroke); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.qr { width: 96px; height: 96px; padding: 8px; background: var(--ivory); border-radius: 12px; }
.qr svg { width: 100%; height: 100%; }
.qr-card p { margin: 0; font-size: 14px; line-height: 1.35; color: var(--text-2); max-width: 11em; }
@media (min-width: 900px) and (hover: hover) and (pointer: fine) { .qr-card { display: flex; } }

/* Sections */
.section, .band-section { position: relative; padding: var(--section-pad) 0; scroll-margin-top: 16px; }
.band-section { padding-top: 0; }
.band { position: relative; height: clamp(220px, 34vw, 440px); overflow: hidden; margin-bottom: clamp(-96px, -6vw, -36px); }
.band img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.band::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, var(--navy) 0%, rgba(7, 13, 35, .45) 14%, rgba(7, 13, 35, 0) 34%, rgba(7, 13, 35, 0) 52%, rgba(7, 13, 35, .55) 82%, var(--navy) 100%); }
.band-section .eyebrow, .band-section h2 { text-shadow: 0 2px 28px rgba(7, 13, 35, .95), 0 1px 8px rgba(7, 13, 35, .8); }
.band.dawn img { object-position: 50% 60%; }
h2 { font-size: clamp(34px, 4.4vw, 58px); line-height: 1.06; margin-bottom: 22px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 88px); align-items: center; }
.split.reverse .copy { order: 2; }
.copy { max-width: 560px; }
.copy.center { margin: 0 auto 48px; text-align: center; }
.copy.center .eyebrow { justify-content: center; }
.small { font-size: 15px; color: var(--text-3); }

.visual { position: relative; }
.pair { display: flex; justify-content: center; align-items: flex-start; }
.pair .phone { --s: min(252px, 44vw); }
.pair .phone.offset, .pair .card-shot { margin-left: -38px; margin-top: 70px; }
.pair .card-shot { width: min(240px, 42vw); position: relative; z-index: 2; margin-left: -24px; }
.note-play { position: absolute; right: 2%; bottom: -8px; }
.note-wake { position: absolute; left: 0; bottom: -10px; color: var(--amber); }

/* Sound legend */
.legend { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.legend li { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--stroke); color: var(--text); font-size: 15px; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.amber { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.dot.teal { background: var(--teal); box-shadow: 0 0 8px var(--teal); }
.dot.peri { background: var(--peri); box-shadow: 0 0 8px var(--peri); }
.dot.grey { background: #8a8ea6; }

/* Diary rows */
.points, .missions { list-style: none; padding: 0; margin: 22px 0 24px; border-top: 1px solid var(--stroke); }
.points li, .missions li { padding: 13px 0; border-bottom: 1px solid var(--stroke); }
.points li { display: grid; grid-template-columns: minmax(148px, 180px) minmax(0, 1fr); column-gap: 18px; align-items: baseline; }
.points strong, .missions strong { font: 19px/1.3 var(--serif); color: var(--ivory); font-weight: 400; }
.missions li { display: grid; grid-template-columns: 38px minmax(128px, 168px) minmax(0, 1fr); align-items: center; column-gap: 14px; }
.mi { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; align-self: center;
  background: var(--raised); color: var(--peri); font: 600 14px/1 var(--sans); box-shadow: inset 0 0 0 1px var(--stroke); }

/* Duo. Real screens: inner 951x669 pt (2853x2007 px), cover 678x466 pt in landscape (2034x1398 px), one scale.
   Book on top; folded sideways (bedside clock) and half open below (columns 678:669, book 951 of that 1347 width).
   Drawn flat (Apple's rule for device imagery) with the phones' thin black border and metal band. */
.duo-row { display: grid; grid-template-columns: minmax(0, 678fr) minmax(0, 669fr); gap: clamp(28px, 4vw, 56px) clamp(24px, 4vw, 48px); max-width: 860px; margin: 0 auto; align-items: end; }
.device.book { grid-column: 1 / -1; width: calc(951 / 1347 * 100%); justify-self: center; }
.device { margin: 0; text-align: center; min-width: 0; }
.device figcaption { font: 22px/1.2 var(--hand); color: var(--peri); margin-top: 18px; transform: rotate(-2deg); }
.device img { --p: clamp(4px, .7vw, 7px); --m: clamp(3px, .6vw, 6px);
  display: block; box-sizing: content-box; width: calc(100% - 2 * (var(--p) + var(--m))); height: auto;
  padding: var(--p); border: var(--m) solid #23262f; border-radius: clamp(16px, 2.6vw, 30px);
  background: #050608; box-shadow: 0 0 0 1px rgba(190, 200, 235, .22), 0 34px 70px -24px rgba(0, 0, 0, .85); }
.device.book img { aspect-ratio: 1400 / 985; }
.device.tabletop img { aspect-ratio: 760 / 1080; }
.device.folded img { aspect-ratio: 1030 / 708; }

/* Plans */
.plan-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; max-width: 920px; margin: 0 auto; }
.plan { background: var(--card); border: 1px solid var(--stroke); border-radius: 24px; padding: 30px 30px 18px; transition: border-color .25s ease, transform .25s var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .plan:hover { border-color: rgba(147, 169, 255, .38); transform: translateY(-2px); } }
.plan.premium { background: linear-gradient(160deg, #1a2457, var(--card) 70%); border-color: rgba(147, 169, 255, .4); }
.plan h3 { font-size: 30px; }
.plan-sub { color: var(--peri); font-size: 15px; margin: 4px 0 16px; }
.plan ul { list-style: none; padding: 0; margin: 0 0 16px; }
.plan li { padding: 11px 0 11px 30px; border-top: 1px solid var(--stroke); position: relative; color: var(--text); }
.plan li::before { content: ""; position: absolute; left: 2px; top: 17px; width: 14px; height: 8px; border-left: 2px solid var(--peri); border-bottom: 2px solid var(--peri); transform: rotate(-45deg); }

/* Privacy */
.privacy { padding-top: 0; }
.privacy-inner { display: flex; gap: 22px; align-items: flex-start; max-width: 860px; background: var(--card); border: 1px solid var(--stroke); border-radius: 24px; padding: 30px; }
.privacy h2 { font-size: clamp(26px, 3vw, 34px); margin-bottom: 10px; }
.privacy p { margin: 0; }
.lock { width: 44px; height: 44px; flex: none; fill: var(--peri); padding: 10px; border-radius: 50%; background: var(--raised); }

/* FAQ */
.faq h2 { margin-bottom: 26px; }
details { border-top: 1px solid var(--stroke); }
details:last-of-type { border-bottom: 1px solid var(--stroke); }
summary { cursor: pointer; list-style: none; padding: 20px 40px 20px 0; min-height: 56px; display: flex; align-items: center; position: relative; font: 21px/1.35 var(--serif); color: var(--ivory); }
summary:hover { color: #fff; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 4px; top: 16px; font: 300 28px/1 var(--sans); color: var(--peri); transition: transform .2s ease; }
details[open] summary::after { transform: rotate(45deg); }
details p { padding-bottom: 8px; max-width: 44em; }

/* Final */
.final { position: relative; padding: clamp(110px, 14vw, 190px) 0; overflow: hidden; text-align: center; }
.final-art { position: absolute; inset: 0; }
.final-art img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 60%; opacity: .55; }
.final::before { content: ""; position: absolute; inset: 0; z-index: 1; background: radial-gradient(ellipse at 50% 55%, rgba(7, 13, 35, .55), var(--navy) 78%), linear-gradient(180deg, var(--navy), rgba(7, 13, 35, 0) 30%); }
.final-inner { z-index: 2; }
.final h2 { font-size: clamp(38px, 5vw, 66px); }
.final p { color: var(--text); font-size: 19px; }

/* Footer */
.foot { border-top: 1px solid var(--stroke); padding: 40px 0 calc(40px + env(safe-area-inset-bottom)); font-size: 14px; color: var(--text-3); }
.foot-inner { display: grid; grid-template-columns: auto 1fr auto; gap: 10px 28px; align-items: center; }
.foot-brand { display: flex; align-items: center; gap: 10px; font: 20px/1 var(--serif); color: var(--ivory); }
.foot-brand img { border-radius: 8px; }
.disclaimer { margin: 0; color: var(--text-2); }
.foot nav { display: flex; gap: 20px; }
.foot nav a { color: var(--text-2); text-decoration: none; padding: 10px 2px; }
.foot nav a:hover { color: var(--ivory); }
.copy-line { grid-column: 1 / -1; margin: 6px 0 0; }

/* Stars (StarFieldView, in CSS) */
.stars { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .7;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 27% 64%, #cfd7ff, transparent),
    radial-gradient(1.4px 1.4px at 41% 12%, #fff, transparent), radial-gradient(1px 1px at 8% 82%, #cfd7ff, transparent),
    radial-gradient(1px 1px at 33% 36%, #fff, transparent), radial-gradient(1.2px 1.2px at 18% 48%, #fff, transparent),
    radial-gradient(1px 1px at 47% 78%, #cfd7ff, transparent), radial-gradient(1px 1px at 4% 30%, #fff, transparent);
  animation: twinkle 6s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: .35; } to { opacity: .8; } }

/* Motion */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
.js .reveal.in { opacity: 1; transform: none; }
.hero-phone.in .phone:not(.cover) { animation: float 7s ease-in-out 1s infinite; }
@keyframes float { 0%, 100% { transform: rotate(2deg) translateY(0); } 50% { transform: rotate(2deg) translateY(-10px); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .stars, .hero-phone.in .phone:not(.cover) { animation: none; }
  .store-badge, .top-cta, .plan, summary::after { transition: none; }
  .store-badge:hover, .plan:hover { transform: none; }
}

/* Tablet and phone */
@media (max-width: 759px) {
  body { font-size: 16px; }
  .hero { --hero-art-h: clamp(232px, 62vw, 280px); min-height: 0; display: block; padding: 0 0 56px; }
  .hero-art { position: relative; inset: auto; height: var(--hero-art-h); }
  .hero-art img { object-position: 74% 50%; }
  .hero::after { background: linear-gradient(180deg, rgba(7, 13, 35, .25) 0%, rgba(7, 13, 35, 0) 18%, rgba(7, 13, 35, 0) calc(var(--hero-art-h) - 132px), rgba(7, 13, 35, .62) calc(var(--hero-art-h) - 44px), var(--navy) var(--hero-art-h)); }
  .stars { display: none; }
  .hero-grid { grid-template-columns: 1fr; gap: 36px; margin-top: -30px; }
  .hero-phone { margin-bottom: 0; }
  .hero h1 { font-size: clamp(40px, 12vw, 54px); }
  .hero-phone { justify-self: center; margin: 0; }
  .hero-phone { flex-wrap: wrap; justify-content: center; --hs: 34vw; }
  .note-hero { position: static; display: table; flex-basis: 100%; text-align: center; margin: 18px auto 0; transform: rotate(-3deg); }
  .cta-row { margin-top: 24px; }
  .store-badge { width: 100%; justify-content: center; }
  .split, .split.reverse { grid-template-columns: 1fr; }
  .split.reverse .copy { order: 0; }
  .copy { max-width: none; }
  .copy.center { text-align: left; }
  .copy.center .eyebrow { justify-content: flex-start; }
  .band { margin-bottom: -40px; }
  .pair .phone { --s: 44vw; }
  .pair .card-shot { width: 42vw; }
  .pair .phone.offset, .pair .card-shot { margin-left: -8vw; margin-top: 48px; }
  .points li { grid-template-columns: 1fr; row-gap: 3px; padding: 12px 0; }
  .missions li { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
  .device figcaption { font-size: 18px; }
  .note-play, .note-wake { position: static; display: table; margin: 22px auto 0; }
  .visual.pair { flex-wrap: wrap; }
  .visual.pair .hand { flex-basis: 100%; text-align: center; }
  .plan-grid { grid-template-columns: 1fr; }
  .privacy-inner { flex-direction: column; padding: 24px; }
  .foot-inner { grid-template-columns: 1fr; }
  .foot nav { flex-wrap: wrap; }
}

/* 404 */
.lost { position: relative; min-height: 80svh; display: grid; place-items: center; text-align: center; overflow: hidden; padding: 80px 0; }
.lost .final-art img { opacity: .45; }
.lost::before { content: ""; position: absolute; inset: 0; z-index: 1; background: radial-gradient(ellipse at 50% 50%, rgba(7, 13, 35, .5), var(--navy) 75%); }
.lost-inner { z-index: 2; }
.lost .eyebrow { justify-content: center; }
.lost h1 { font-size: clamp(40px, 6vw, 72px); margin-bottom: 16px; }
.lost p { color: var(--text); }
.home-link { font: 600 18px/1 var(--sans); padding: 18px 26px; margin-top: 12px; }
