/* Sleep O'Clock, STRUCTURE: layout, spacing, sizes and states for every look.
   A look is one file, site/looks/<slug>.css, picked before paint by site/looks.js. Everything a visitor would call
   "the look" (colour, typeface, radius, shadow, glow, decoration) comes from custom properties the look sets, or
   from the look's own rules scoped to [data-look="<slug>"]. The token list and the rules: docs/THEMES.md.
   No colour literal appears here outside the neutral fallback palette just below. */

/* Neutral fallback palette: what the page wears if a look's file fails to load. Not a look. */
:root{
  color-scheme:light;
  --ground:#f4f4f2; --ink:#1b1b1a; --ink2:#5c5c58; --rule:#d9d9d4; --rule-in:#e4e4df;
  --surface:#ffffff; --display:#ecece8; --key:#e6e6e1; --key-ink:#1b1b1a; --well:#dcdcd6;
  --accent:#1b1b1a; --cta:#1b1b1a; --cta-ink:#ffffff; --focus:#1b1b1a;
  --digit:#1b1b1a; --digit-off:#1b1b1a; --digit-off-alpha:0; --eyes:#1b1b1a;
  --font:system-ui,-apple-system,"Segoe UI",Arial,sans-serif; --font-head:var(--font); --font-time:var(--font);
  --head-weight:800; --r-case:16px; --r:10px; --r-sm:8px;
  --shadow-case:none; --shadow-display:none; --shadow-inset:none; --shadow-key:none; --shadow-key-down:none;
  --lit-filter:none;
}
:root[data-dim="1"]{
  color-scheme:dark;
  --ground:#121212; --ink:#cfcfcb; --ink2:#9a9a95; --rule:#2a2a28; --rule-in:#222220;
  --surface:#1a1a19; --display:#151514; --key:#262625; --key-ink:#cfcfcb; --well:#1f1f1e;
  --accent:#cfcfcb; --cta:#cfcfcb; --cta-ink:#121212; --focus:#cfcfcb; --digit:#cfcfcb; --digit-off:#cfcfcb; --eyes:#cfcfcb;
}

*{box-sizing:border-box;margin:0}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{background:var(--ground);color:var(--ink);font:400 16px/1.5 var(--font);min-height:100vh;transition:background-color .4s,color .4s}
button,input{font:inherit;color:inherit}
button{cursor:pointer;-webkit-tap-highlight-color:transparent}
a{color:var(--ink);text-underline-offset:3px}
:focus-visible{outline:2px solid var(--focus);outline-offset:3px;border-radius:4px}
[hidden]{display:none!important}
.sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.wrap{max-width:1160px;margin:0 auto;padding:0 16px}

/* top bar */
.bar{display:flex;align-items:center;justify-content:space-between;height:56px}
.brand{font-family:var(--font-head);font-weight:var(--head-weight);font-size:19px;letter-spacing:-.02em;text-decoration:none;color:var(--ink);min-height:44px;display:flex;align-items:center}
/* the Dim switch: a track and a knob; on = the knob slides right and takes the accent */
.dimsw{display:flex;align-items:center;gap:10px;background:none;border:0;padding:8px 0 8px 10px;min-height:44px;font-size:15px;font-weight:700;color:var(--ink2)}
.dimsw .track{width:50px;height:28px;border-radius:var(--r-sm);background:var(--well);box-shadow:var(--shadow-inset);position:relative}
.dimsw .knob{position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:var(--r-sm);background:var(--key);box-shadow:var(--shadow-key);transition:transform .2s}
.dimsw[aria-checked="true"] .track{box-shadow:var(--shadow-inset),inset 0 0 0 2px var(--accent)}
.dimsw[aria-checked="true"] .knob{transform:translateX(22px);background:var(--accent)}
.dimsw[aria-checked="true"]{color:var(--ink)}

/* the clock case (the main card) and its display (the time window) */
.case{background:var(--surface);border-radius:var(--r-case);padding:14px;box-shadow:var(--shadow-case);position:relative}
.screen{background:var(--display);border-radius:var(--r);box-shadow:var(--shadow-display);padding:12px 14px 14px;transition:background-color .4s}

/* times: html[data-digits="led"] draws seven-segment SVG (.seg), "type" draws text (.tdig) in --font-time */
.seg{display:block;overflow:visible}
.seg .off{fill:var(--digit-off);opacity:var(--digit-off-alpha)}
.seg .on{fill:var(--digit)}
.lit{filter:var(--lit-filter)}
.ap{font-weight:800;color:var(--digit);margin-left:.3em;line-height:1}
.led{display:inline-flex;align-items:flex-end;white-space:nowrap}
.tdig{display:block;font-family:var(--font-time);font-weight:var(--time-weight,700);font-variant-numeric:tabular-nums lining-nums;color:var(--digit);line-height:1;letter-spacing:-.02em}
[data-digits="type"] .led{align-items:baseline}
[data-digits="type"] .ap{padding-bottom:0!important}

/* the eyes: the clock's face. Hooks for a look: --eyes-display (none hides them), --eyes (colour), the classes
   .eye .ring .pupil .lid .lidline .smile, the states .closed and .happy, and --lid (0 open to 1 shut) on .eyes */
.eyes{display:var(--eyes-display,flex);justify-content:center;gap:24px;margin:4px 0 2px;min-height:46px}
.eyes svg{height:46px;width:auto;overflow:visible}
.eyes .eye{transform-box:fill-box;transform-origin:center;animation:blink 8s infinite}
.eyes .eye:nth-child(2){animation-delay:.04s}
.eyes .ring{fill:none;stroke:var(--eyes);stroke-width:4}
.eyes .pupil{fill:var(--eyes)}
.eyes .lid{transition:transform .9s cubic-bezier(.3,.7,.3,1)}
.eyes .lidline{stroke:var(--eyes);stroke-width:4;stroke-linecap:round;transition:transform .9s cubic-bezier(.3,.7,.3,1)}
.eyes .smile{fill:none;stroke:var(--eyes);stroke-width:5;stroke-linecap:round}
.eyes.closed .eye,.eyes.happy .eye{animation:none}
@keyframes blink{0%,95%,100%{transform:scaleY(1)}97%{transform:scaleY(.1)}}

/* first screen */
/* no min-height: the page goes straight on into the 6 weeks, it does not hold a screen of empty ground */
.hero{display:flex;flex-direction:column;justify-content:flex-start;gap:18px;padding:6px 0 28px}
.invite{font-size:15px;font-weight:700;color:var(--ink);margin:0 0 10px;line-height:1.35}
h1{text-wrap:balance;font-family:var(--font-head);font-size:clamp(30px,8.4vw,72px);line-height:1.04;letter-spacing:-.035em;font-weight:var(--head-weight);max-width:11.5em}
.ask{display:block;text-align:center;font-size:15px;font-weight:700;color:var(--ink2);margin:6px 0 2px}
.bigtime{position:relative;border-radius:var(--r)}
.bigtime:focus-within{outline:2px solid var(--focus);outline-offset:2px}
.bigdigits{display:flex;justify-content:center;align-items:flex-end;padding:4px 0 2px;min-height:86px}
.bigdigits .seg{height:80px}
.bigdigits .tdig{font-size:76px}
.bigdigits .ap{font-size:20px;padding-bottom:6px}
#wakeInput{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;font-size:16px;border:0;background:transparent}
/* the browser's own picker button carries a "Show time picker" tooltip; hide it, a tap on the clock opens the picker (app.js showPicker) */
#wakeInput::-webkit-calendar-picker-indicator{display:none}
.setrow{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px;margin:14px 0}
.grp{text-align:center;min-width:0}
.lab{display:block;font-size:14px;font-weight:700;color:var(--ink2);margin-bottom:6px}
.pair{display:flex;gap:8px}
.pair .key{flex:1;min-width:0;padding:0}

/* keys */
.key{border:0;border-radius:var(--r);background:var(--key);box-shadow:var(--shadow-key);color:var(--key-ink);min-height:48px;min-width:48px;font-weight:700;font-size:18px;padding:0 14px;transition:transform .08s,box-shadow .08s,background-color .2s}
.key:active{transform:translateY(2px);box-shadow:var(--shadow-key-down)}
/* a latching key (aria-pressed): stays down and takes the accent; a look may add a lamp with ::before */
.key[aria-pressed]{display:inline-flex;align-items:center;justify-content:center;gap:9px}
.key[aria-pressed="false"]{color:var(--ink2)}
.key[aria-pressed="true"]{color:var(--accent);box-shadow:var(--shadow-key-down);transform:translateY(2px)}
.key.sm{min-height:44px;font-size:15px;padding:0 12px}
.key.wide{width:100%}

/* the main button (Start Week 1, Save wake-up time, Start Week 2) */
.snooze{display:block;width:100%;min-height:60px;border:0;border-radius:var(--r);background:var(--cta);color:var(--cta-ink);font-weight:800;font-size:21px;letter-spacing:-.01em;box-shadow:var(--shadow-cta,var(--shadow-key));transition:transform .08s,box-shadow .08s,background-color .4s}
.snooze:active{transform:translateY(3px);box-shadow:var(--shadow-cta-down,var(--shadow-key-down))}
.snooze:focus-visible{outline-color:var(--ink)}
.note{text-align:center;color:var(--ink2);font-size:14px;margin-top:12px}

/* sections */
.blk{padding:44px 0;border-top:1px solid var(--rule)}
.tonightblk{border-top:0;padding-top:8px}
h2{text-wrap:balance;font-family:var(--font-head);font-size:clamp(26px,6.4vw,40px);line-height:1.05;letter-spacing:-.03em;font-weight:var(--head-weight)}
h2 .when{display:block;font-family:var(--font);font-size:16px;font-weight:700;letter-spacing:0;color:var(--ink2);margin-top:6px}
.sub{color:var(--ink2);margin-top:8px;max-width:28em}
.split{display:grid;gap:22px}
.split>*{min-width:0}

/* tonight */
.tonight{display:grid;gap:22px}
.tonight-clock h2{margin-bottom:14px}
.tag{font-size:15px;font-weight:700;color:var(--accent);text-align:center}
.times{display:grid;gap:8px;margin-top:10px}
.trow{display:flex;justify-content:space-between;align-items:center;gap:12px;border-top:1px solid var(--rule-in);padding-top:8px}
.trow:first-child{border-top:0;padding-top:0}
.trow .l{font-size:15px;font-weight:700;color:var(--ink2);line-height:1.25}
.trow .seg{height:32px}
.trow .tdig{font-size:30px}
.trow .ap{font-size:15px;padding-bottom:2px}
/* the week's nights: one lamp each */
.lamps{list-style:none;padding:14px 2px 4px;display:flex;justify-content:space-between;gap:4px}
.lamps li{flex:1;display:grid;justify-items:center;gap:6px;font-size:13px;font-weight:700;color:var(--ink2)}
.lamps i{width:16px;height:16px;border-radius:50%;background:var(--well);box-shadow:var(--shadow-inset)}
.lamps li.on i{background:var(--accent)}
.lamps li.now i{outline:2px solid var(--ink2);outline-offset:3px}
.lamps li.on{color:var(--ink)}
.steps-h{font-family:var(--font-head);font-size:18px;font-weight:var(--head-weight);letter-spacing:-.01em}
.steps{list-style:none;padding:0;margin:8px 0 0}
.steps>li{padding:0 0 6px}
.steps>li+li{margin-top:12px}
/* The step is the night's one action, so the whole row is one big key: the largest target on the card. */
.step{display:flex;align-items:center;gap:16px;width:100%;text-align:left;border:0;border-radius:var(--r);background:var(--key);color:var(--key-ink);box-shadow:var(--shadow-key);padding:16px 16px 16px 14px;min-height:84px;transition:transform .08s,box-shadow .08s}
.step:active{transform:translateY(2px);box-shadow:var(--shadow-key-down)}
.step[aria-pressed="true"]{transform:translateY(2px);box-shadow:var(--shadow-key-down)}
.box{flex:none;width:44px;height:44px;border-radius:var(--r-sm);background:var(--well);border:2px solid var(--ink2);box-shadow:var(--shadow-inset);display:grid;place-items:center}
.step[aria-pressed="true"] .box{border-color:var(--accent)}
.box svg{width:26px;height:26px;opacity:0;transition:opacity .2s}
.box path{fill:none;stroke:var(--accent);stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.step[aria-pressed="true"] .box svg{opacity:1}
.step .t{display:block;font-size:17px;font-weight:700;line-height:1.3}
.step .d{display:block;font-size:15px;color:var(--ink2);line-height:1.4;margin-top:2px}
.step .d b{color:var(--key-ink);font-weight:700}
.step[aria-disabled="true"]{cursor:default}
.step[aria-disabled="true"] .box{opacity:.4}
.lvbtn{font-size:14px;margin-left:2px}
.lv{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:4px}
.help{color:var(--ink2);font-size:15px;margin:10px 0 0}
.help b{color:var(--ink)}
.done{margin:18px 0 4px}
.done h3{font-family:var(--font-head);font-size:24px;font-weight:var(--head-weight);letter-spacing:-.02em;line-height:1.15}
.done p{color:var(--ink2);margin:6px 0 16px}
.actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:22px}
.small{font-size:14px;color:var(--ink2);margin-top:10px}
.status:empty{display:none}
.check{display:flex;align-items:center;gap:10px;min-height:44px;font-size:15px;color:var(--ink);cursor:pointer;margin-top:2px}
.check input{width:22px;height:22px;accent-color:var(--accent);flex:none}
.copyrow input{width:100%;min-height:48px;border-radius:var(--r);border:0;background:var(--well);color:var(--ink);padding:0 12px;box-shadow:var(--shadow-inset);margin-top:8px;font-size:16px}
.links{display:flex;flex-wrap:wrap;gap:4px 22px;margin-top:10px}
.textbtn{display:inline-flex;align-items:center;min-height:44px;background:none;border:0;padding:0;color:var(--ink2);text-decoration:underline;text-underline-offset:3px;font-size:15px}
.textbtn.center{margin:12px auto 0;display:flex}

/* the 6 weeks */
.plan{list-style:none;padding:0}
.wk{display:grid;grid-template-columns:54px 1fr;gap:14px;padding:22px 0;border-top:1px solid var(--rule)}
.wk:first-child{border-top:0;padding-top:0}
.wk .win{display:block;padding-top:2px}  /* a plain number, no tile; a look may style the number with type only */
.wk .win .seg{height:44px}
.wk .win .tdig{font-size:40px;line-height:.9}
.wk.later .win .on,.wk.later .win .tdig{opacity:.35}
.wk h3{font-family:var(--font-head);font-size:20px;line-height:1.25;letter-spacing:-.02em;font-weight:var(--head-weight)}
.wk p{color:var(--ink2);margin-top:4px}
.wk .whylink{color:var(--ink2);font-weight:700;white-space:nowrap;margin-left:2px;padding:13px 6px;margin-right:-6px;margin-top:-13px;margin-bottom:-13px}
#shiftOut a{padding:14px 6px;margin:-14px -6px}
.here{font-size:15px;font-weight:700;color:var(--accent);margin-bottom:2px}

/* shift your clock */
.ctl{display:grid;gap:16px}
.stepper{display:flex;align-items:center;gap:12px}
.stepper .win{flex:1;background:var(--display);border-radius:var(--r);box-shadow:var(--shadow-window,var(--shadow-display));height:60px;display:flex;align-items:center;justify-content:center;gap:10px}
.stepper .win .seg{height:36px}
.stepper .win .tdig{font-size:34px}
.stepper .win>span:not(.led){font-weight:700;color:var(--ink2);font-size:15px}
.dirs{display:grid;grid-template-columns:1fr 1fr;gap:10px}
input[type=date]{width:100%;min-height:50px;border-radius:var(--r);border:0;background:var(--well);color:var(--ink);font-weight:700;font-size:17px;padding:0 14px;box-shadow:var(--shadow-inset)}
.out{margin-top:24px;background:var(--display);border-radius:var(--r);box-shadow:var(--shadow-display);padding:4px 14px 8px}
.outhead{padding:12px 0 10px;border-bottom:1px solid var(--rule-in);font-size:15px;color:var(--ink2)}
.outhead b{color:var(--accent);font-weight:700}
.outhead a{color:var(--ink2)}
.drow{display:grid;grid-template-columns:1fr auto auto;gap:4px 14px;align-items:center;padding:9px 0;border-bottom:1px solid var(--rule-in)}
.drow:last-child{border-bottom:0}
.drow .dd{font-size:14px;color:var(--ink2);line-height:1.25}
.drow .dd b{display:block;color:var(--ink);font-size:15px}
.drow .c{text-align:right;display:grid;justify-items:end;gap:2px}
.drow .c small{font-size:13px;font-weight:700;color:var(--ink2)}
.drow .seg{height:20px}
.drow .tdig{font-size:19px}
.drow .ap{font-size:12px}

/* footer */
.foot{border-top:1px solid var(--rule);padding:34px 0 56px;color:var(--ink2);font-size:15px;display:grid;gap:12px;max-width:44em}
.foot b{color:var(--ink)}
.foot a{font-weight:700;display:inline-flex;min-height:44px;align-items:center}
.footlinks{display:flex;gap:22px;flex-wrap:wrap}
.foot .textbtn{font-weight:700;color:var(--ink)}
.foot a.quiet{font-weight:400;color:var(--ink2)}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  .eyes .eye{animation:none}
  *{transition:none!important}
}
@media (max-width:370px){.setrow{gap:6px}.key{font-size:16px}.bigdigits .seg{height:68px}.bigdigits .tdig{font-size:64px}}

@media (min-width:900px){
  .wrap{padding:0 40px}
  /* First visit: the headline and the 6 weeks read down the left like a printed plan; the setter stands beside
     them on the right and stays in view while the plan is read. No screen-high hero, no centred split.
     The hero is a subgrid over rows 1-2, the plan sits in row 2 of the left column. Once a plan is started
     the hero is hidden and every section is full width again. */
  main{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,460px);column-gap:72px}
  main>section{grid-column:1/-1}
  .hero{grid-column:1/-1;grid-row:1/span 2;display:grid;grid-template-columns:subgrid;grid-template-rows:subgrid;gap:0 72px;padding:0}
  .hero>h1{grid-column:1;grid-row:1;align-self:start;padding-top:40px}
  .hero>.clockcol{grid-column:2;grid-row:1/span 2;align-self:start;position:sticky;top:24px;margin:40px 0 64px}
  main:has(>.hero:not([hidden]))>#plan{grid-column:1;grid-row:2;border-top:0;padding-top:48px}
  main:has(>.hero:not([hidden]))>#plan .split{grid-template-columns:minmax(0,1fr);gap:24px}
  main:has(>.hero:not([hidden]))>#plan .split-head{position:static}
  h1{font-size:clamp(34px,3.3vw,46px);line-height:1.08;max-width:12em}
  .case{padding:18px}
  .screen{padding:18px 24px 20px}
  .eyes svg{height:62px}.eyes{gap:34px;min-height:62px}
  .bigdigits{min-height:136px}
  .bigdigits .seg{height:130px}
  .bigdigits .tdig{font-size:124px}
  .bigdigits .ap{font-size:28px;padding-bottom:10px}
  .ask{font-size:17px}
  .blk{padding:80px 0}
  .tonightblk{padding-top:24px}
  .tonight{grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:64px;align-items:start}
  .tonight-clock{position:sticky;top:24px}
  .trow .seg{height:40px}
  .trow .tdig{font-size:38px}
  .split{grid-template-columns:.8fr 1.2fr;gap:70px}
  .split-head{position:sticky;top:24px;align-self:start}
  .drow{grid-template-columns:1.3fr auto auto}
  .drow .seg{height:24px}
  .drow .tdig{font-size:23px}
}

/* time in bed: a setting in the Change my wake-up time state, inside the clock case */
.bedrow{margin:0 0 14px;text-align:center}
.bedrow .pair{align-items:center;max-width:300px;margin:0 auto}
.bedrow .win{flex:1.4;font-weight:700;font-size:17px}
.bedrow .small{margin:8px 0 0}
