/* Wakeful site. The landing design (index) and the document pages (privacy,
   terms, contact, 404) share these tokens, the header and the footer. System
   fonts only: the CSP allows no font downloads. */
:root {
  color-scheme: dark;
  --bg: #141026;
  --panel: #1d1735;
  --text: #fff5ec;
  --muted: #b2a6cb;
  --amber: #ffc971;
  --coral: #ff9d6e;
  --ink: #21152c;
  --rule: #fff5ec1a;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* The one gap into each content section (lifecycle, screens, naps): each pads
     its TOP only, so those hold their rhythm in any order. The framed sections
     (details, the closing band, facts) keep their own spacing on purpose. */
  --section-gap: 6.25rem;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1.0625rem/1.65 var(--sans); overflow-wrap: anywhere; -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration: underline; text-underline-offset: .22em; border-radius: .25rem; touch-action: manipulation; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 3px solid var(--amber); outline-offset: 4px; }
main:focus, #screens:focus { outline: none; }
.skip-link { position: absolute; top: 1rem; left: 1rem; z-index: 2; padding: .75rem 1rem; background: var(--amber); color: var(--ink); transform: translateY(-200%); }
.skip-link:focus { transform: none; outline: 3px solid var(--text); }

/* Header and footer, every page */
header.site, footer.site { max-width: 77.5rem; margin: auto; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; padding: 2rem 2.5rem; }
header.site a, footer.site a { display: inline-flex; gap: .3em; align-items: center; min-width: 44px; min-height: 44px; padding: .375rem .5rem; }
.site nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .875rem; color: var(--muted); }
.brand { font: 2.375rem var(--serif); letter-spacing: -.05em; text-decoration: none; }
.sun { color: var(--amber); margin-left: .75rem; font-size: 1.875rem; }
footer.site { font-size: .8125rem; color: var(--muted); border-top: 1px solid var(--rule); margin-top: 3rem; }

/* Landing page */
.hero { max-width: 77.5rem; margin: auto; padding: 3.4375rem 2.5rem 5.9375rem; display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); align-items: center; gap: 5.625rem; background: radial-gradient(ellipse at 85% 55%, #ff9d6e12, transparent 55%); }
.intro, article, figure { min-width: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .1875rem; font-size: .8125rem; color: var(--amber); }
h1 { font: clamp(3rem,5.8vw,5rem)/1.1 var(--serif); letter-spacing: -.04em; margin: 1.75rem 0; }
h1 em { font-weight: normal; color: var(--amber); }
.lede { max-width: 26.25rem; color: var(--muted); font-size: 1.1875rem; }
.availability { margin: 1.75rem 0 .75rem; color: var(--amber); font-size: .9375rem; }
.cta { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; }
/* Apple's own badge artwork, unaltered (App Store marketing guidelines): never
   below 40px tall, with clear space around it. 52px keeps it the visual lead
   next to the text link without crowding it. */
.store-badge { display: inline-flex; border-radius: 9px; }
.store-badge img { display: block; height: 52px; width: auto; }
.secondary-link { display: inline-flex; gap: .5rem; align-items: center; min-height: 44px; color: var(--muted); font-size: .9375rem; font-weight: 600; text-decoration: none; }
.secondary-link:hover { color: var(--text); text-decoration: underline; }
.closing .cta { justify-content: center; margin-top: 2rem; }
.fine { font-size: .8125rem; color: var(--muted); margin-top: 1.375rem; }
figure { margin: 0; }
.hero-screen img, .gallery img, .steps img { display: block; width: 100%; height: auto; border-radius: 2.1875rem; border: 1px solid #fff5ec22; box-shadow: 0 1.5625rem 4.375rem #0005; }
.hero-screen { width: 100%; max-width: 19.375rem; justify-self: center; }
.hero-screen figcaption { font-size: .8125rem; color: var(--muted); text-align: center; margin-top: 1.0625rem; }
.details { max-width: 72.5rem; width: calc(100% - 5rem); margin: auto; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 3.4375rem 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 3.75rem; }
.details article > span { font-size: .8125rem; letter-spacing: .125rem; color: var(--coral); }
h2 { font: 2.375rem/1.2 var(--serif); letter-spacing: -.025em; }
.details p { color: var(--muted); font-size: .9375rem; max-width: 17.8125rem; }
.screens { max-width: 68.75rem; margin: auto; padding: var(--section-gap) 2.5rem 0; scroll-margin-top: 1.5rem; }
.section-heading { max-width: 36.25rem; }
.section-heading h2 { font-size: 3.25rem; line-height: 1.08; letter-spacing: -.035em; }
.section-heading p { font-size: .9375rem; color: var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4rem; margin-top: 2.8125rem; }
.gallery figcaption { font: 1.3125rem/1.4 var(--serif); margin-top: 1.25rem; }
.closing { text-align: center; padding: 5rem 1.5rem; margin-top: var(--section-gap); background: linear-gradient(180deg,transparent,#2d1b4e55); }
.closing h2 { font-size: 4.25rem; line-height: 1.05; letter-spacing: -.04em; margin: 1.375rem 0; }
.closing p { color: var(--muted); font-size: .9375rem; }
.facts { max-width: 72.5rem; width: calc(100% - 5rem); margin: 4rem auto 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 3.75rem; }
.facts h2 { font-size: 1.75rem; margin: 0 0 .75rem; }
.facts p { color: var(--muted); font-size: .9375rem; }
.facts a { color: var(--text); }

/* Document pages: privacy, terms, contact, 404 */
.doc { max-width: 46rem; margin: 0 auto; padding: 0 2.5rem 2rem; }
.doc-head { padding: 1.5rem 0 2.25rem; border-bottom: 1px solid var(--rule); margin-bottom: 2.25rem; }
.doc-head h1 { font-size: clamp(2.5rem,5vw,3.5rem); margin: 1rem 0 .75rem; }
.dateline { color: var(--muted); font-size: .9rem; margin: 0; }
.doc h2 { font-size: 1.75rem; margin: 2.75rem 0 .75rem; }
.doc h3 { font: 600 1rem/1.5 var(--sans); color: var(--amber); margin: 1.75rem 0 .5rem; letter-spacing: normal; }
.doc .lede { max-width: none; font-size: 1.1rem; }
.doc li + li { margin-top: .35rem; }
/* Tables and code keep normal word-breaking: the body's overflow-wrap:anywhere
   would squeeze columns to one character and break hostnames mid-word, so the
   .table-wrap sideways scroll could never kick in. */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
table, code { overflow-wrap: normal; word-break: normal; }
td code { white-space: nowrap; }
/* Scrolls sideways on a narrow screen without giving up real table layout. */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
code { background: var(--panel); padding: .12em .4em; border-radius: .25rem; font-size: .88em; }
.note { background: var(--panel); border-left: 3px solid var(--amber); padding: .9rem 1.1rem; border-radius: 0 .4rem .4rem 0; margin: 1.5rem 0; }

/* Contact form */
form.contact { display: grid; gap: .35rem; margin: 2rem 0; }
form.contact label { font-weight: 600; font-size: .92rem; margin-top: .9rem; }
form.contact input, form.contact select, form.contact textarea { width: 100%; font: inherit; color: var(--text); background: var(--panel); border: 1px solid #fff5ec33; border-radius: .6rem; padding: .75rem .85rem; }
form.contact input:focus, form.contact select:focus, form.contact textarea:focus, form.contact button:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
form.contact textarea { resize: vertical; min-height: 9rem; }
form.contact .cf-turnstile { margin-top: 1.2rem; min-height: 65px; }
form.contact button { justify-self: start; margin-top: 1rem; font: inherit; font-size: .9375rem; font-weight: 650; color: var(--ink); background: var(--amber); border: 0; border-radius: 99px; padding: .875rem 1.6rem; min-height: 44px; cursor: pointer; touch-action: manipulation; }
form.contact button:disabled { opacity: .6; cursor: progress; }
.hint { color: var(--muted); font-size: .88rem; margin: .1rem 0 0; }
.status { min-height: 1.5em; color: var(--muted); }
.status.done { color: var(--text); }
/* The honeypot: off-screen rather than display:none, which some bots skip. */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* "A morning, start to finish": the lifecycle strip */
.lifecycle { max-width: 72.5rem; margin: auto; padding: var(--section-gap) 2.5rem 0; }
.steps { list-style: none; margin: 2.8125rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 1.75rem; }
.steps figcaption { font: 1.25rem/1.35 var(--serif); margin-top: 1.1rem; }
.steps figcaption span { display: block; font: .8125rem/1.5 var(--sans); letter-spacing: .125rem; color: var(--coral); margin-bottom: .25rem; }

/* "A nap that keeps time": the Quick Nap scene, drawn live by /nap-scene.js */
.naps { max-width: 68.75rem; margin: auto; padding: var(--section-gap) 2.5rem 0; }
.nap-demos { display: grid; grid-template-columns: repeat(2,minmax(0,18.75rem)); gap: 4rem; margin-top: 2.8125rem; justify-content: center; }
.nap-demos figcaption { font: 1.3125rem/1.4 var(--serif); margin-top: 1.25rem; }
.nap-phone { position: relative; width: 100%; aspect-ratio: 9 / 19.5; border-radius: 2.1875rem; overflow: hidden; border: 1px solid #fff5ec22; box-shadow: 0 1.5625rem 4.375rem #0005; background: var(--bg); }
.nap-sky { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.nap-ui { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text); font-family: var(--sans); }
.nap-title { position: absolute; top: 7%; font-size: .9rem; font-weight: 600; }
.nap-hourglass { width: 44%; height: auto; }
.nap-count { font-size: 2.1rem; font-weight: 200; margin-top: .6rem; font-variant-numeric: tabular-nums; }
.nap-wake { font-size: .78rem; color: #fff5eccc; margin-top: .55rem; }
.nap-cancel { margin-top: 1.4rem; padding: .7rem 1.9rem; border-radius: 999px; font-size: .82rem; font-weight: 700; color: #ff9d8e; background: #ff6e6e29; border: 1px solid #ff6e6e66; }
/* Sand speed: a quiet segmented control under the phones. */
.nap-speed[hidden] { display: none; }
.nap-speed { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem; margin-top: 2rem; }
.nap-speed-label { font-size: .8125rem; letter-spacing: .125rem; text-transform: uppercase; color: var(--muted); margin-right: .5rem; }
.nap-speed button { font: inherit; font-size: .875rem; min-height: 44px; min-width: 44px; padding: .5rem 1.1rem; border-radius: 99px; color: var(--muted); background: transparent; border: 1px solid #7d7398; /* 4:1 on the page, past WCAG's 3:1 for a control's edge */ cursor: pointer; touch-action: manipulation; transition: transform 100ms ease-out, background-color 150ms ease-out, color 150ms ease-out; }
.nap-speed button[aria-checked="true"] { color: var(--ink); background: var(--amber); border-color: var(--amber); font-weight: 650; }
.nap-speed button:active { transform: scale(.97); transition-duration: 0s; }
.nap-speed button:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
/* Nothing moves under Reduce Motion, so there is no speed to choose. */
@media (prefers-reduced-motion: reduce) { .nap-speed { display: none; } }
[data-nap-scene="day"] .nap-cancel { color: #ffd2c4; background: #3c1e2847; border-color: #ffbeaa8c; }

/* Five steps: three across, then the last two centred beneath, so no phone shrinks
   below about 190px and no step is left alone at the edge. */
@media (max-width: 75rem) {
  .steps { grid-template-columns: repeat(6,minmax(0,1fr)); gap: 2.5rem 1.75rem; }
  .steps li { grid-column: span 2; }
  .steps li:nth-child(4) { grid-column: 2 / span 2; }
  .steps li:nth-child(5) { grid-column: 4 / span 2; }
}
@media (max-width: 60rem) {
  .hero { grid-template-columns: 1fr; gap: 2.8125rem; }
  .intro { max-width: 35rem; }
  .hero-screen { max-width: 17.5rem; }
  .details, .facts { grid-template-columns: 1fr; gap: 1.25rem; }
  .details p { max-width: 100%; }
  .details h2 { margin: .875rem 0; }
  .facts { gap: 2rem; }
  .gallery { grid-template-columns: 1fr; gap: 2.1875rem; max-width: 18.125rem; margin: 2.5rem auto 0; }
  .nap-demos { grid-template-columns: minmax(0,18.125rem); gap: 2.5rem; }
  .steps { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 2.5rem 1.75rem; }
  .steps li, .steps li:nth-child(4), .steps li:nth-child(5) { grid-column: auto; }
  /* An odd step out sits centred under the pair, not alone at the left. */
  .steps li:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc((100% - 1.75rem) / 2); }
}
@media (max-width: 40rem) {
  :root { --section-gap: 4.0625rem; }
  header.site, footer.site { padding: 1.5rem; }
  .hero { padding: 2.1875rem 1.5rem 3.75rem; }
  h1 { font-size: clamp(2.25rem,9vw,3rem); }
  .details, .facts { width: calc(100% - 3rem); }
  .details { padding: 2.5rem 0; }
  .screens, .naps, .lifecycle { padding-left: 1.5rem; padding-right: 1.5rem; }
  .steps { grid-template-columns: 1fr; max-width: 18.125rem; margin: 2.5rem auto 0; }
  .steps li:last-child:nth-child(odd) { width: auto; }
  .section-heading h2 { font-size: 2.5rem; }
  .closing h2 { font-size: 3.25rem; }
  .doc { padding: 0 1.5rem 2rem; }
  footer.site { align-items: flex-start; }
}
/* Feedback on the press itself, not on release (Apple, "respond on pointer-down"):
   hover underlines never happen on a phone, so a tap used to show nothing at all.
   Instant in, a quick ease back out. */
.store-badge, form.contact button { transition: transform 100ms ease-out; }
/* transition-duration 0 on :active: the press lands instantly; only the release eases. */
.store-badge:active, form.contact button:active:not(:disabled) { transform: scale(.97); transition-duration: 0s; }
.secondary-link { transition: opacity 100ms ease-out; }
.secondary-link:active { opacity: .6; transition-duration: 0s; }
header.site a, footer.site a, .facts a, .toc a, .doc a { transition: opacity 100ms ease-out; }
header.site a:active, footer.site a:active, .facts a:active, .toc a:active, .doc a:active { opacity: .6; transition-duration: 0s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* Still answers the press — by dimming, not by moving. */
  .store-badge:active, form.contact button:active:not(:disabled) { transform: none; opacity: .8; }
}
@media (prefers-contrast: more) {
  :root { --muted: #fff5ec; }
  .hero, .closing { background: none; }
  .details { border-color: var(--muted); }
}
@media (forced-colors: active) {
  .skip-link, form.contact button { border: 2px solid ButtonText; }
  .store-badge { outline: 2px solid ButtonText; outline-offset: 2px; }
  .secondary-link { text-decoration: underline; }
  a:focus-visible { outline-color: Highlight; }
  /* The choice is the fill, not an outline — an outline here hid the focus ring,
     since focus always lands on the chosen option. Same 1px border: no shift. */
  .nap-speed button[aria-checked="true"] { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
  .nap-speed button:focus-visible { outline: 3px solid CanvasText; outline-offset: 2px; }
}

/* "On this page" list for long documents */
.toc { background: var(--panel); border-radius: .6rem; padding: 1rem 1.25rem; margin: 0 0 2rem; }
.toc h2 { font: 600 .8125rem/1.5 var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 .5rem; }
.toc ol { margin: 0; padding-left: 1.25rem; columns: 2 14rem; column-gap: 2rem; }
.toc li { margin: .2rem 0; break-inside: avoid; }
.toc a { color: var(--text); }
.gallery figcaption small, .steps figcaption small, .nap-demos figcaption small { display: block; font: .875rem/1.5 var(--sans); color: var(--muted); margin-top: .35rem; }

/* Contact form validation */
.req { font-weight: 400; color: var(--muted); font-size: .85em; }
.form-note { margin: 0 0 .25rem; }
.field-error { color: var(--coral); font-size: .9rem; margin: .25rem 0 0; }
form.contact [aria-invalid="true"] { border-color: var(--coral); }

