/* khayt, day and night. One palette by day, one by night; the rest of the sheets only ever name a role.
   --ink is what is written and drawn, --ground is what it sits on. By night they trade places.
   An object keeps its own material in both: a basket's face, a printed label, a sheet of paper, a forest panel
   are the same thing at midnight as at noon, so they carry the day palette with them.
   The two night blocks below must stay identical (tests/test_khayt_front.py compares them): one follows the
   device, one follows the key in the top bar. Night is for screens only: paper is always day. */
:root,.face,.plabel,.icard__print,.wsrow,.story--dark,.wtop{
  --forest:#1B3B2E;--cream:#F2EDE2;--ink:#1B3B2E;--ground:#F2EDE2;--card:#FAF7F0;--line:#E3DACA;--terracotta:#C8714E;--sand:#CBB68A;--mute:#4A5A51;
  --terra-ink:#9B4F30;--terra-tint:#F6E2D6;--ok-ink:#2F6B4A;--warn-ink:#7D530B;--warn-tint:#F4E4B8;--bad-ink:#9E3A24;--bad-tint:#F5DCD2;
  --cotton:#EFE6D6;--cotton-row:#DFD2BC;--rope:#CBB68A;--rope-twist:#A98F5E;--field:#7A7F72;
}
:root{
  --veil:rgb(27 59 46 / .78);--bar:rgb(250 247 240 / .86);
  --glow:radial-gradient(120% 100% at 50% 0%,#FDFBF6 0,rgb(253 251 246 / 0) 61.8%);
  --lift:0 1px 0 rgb(255 255 255 / .8) inset,0 13px 21px -21px rgb(27 59 46 / .55);
  --sheen:linear-gradient(rgb(255 255 255 / .1),rgb(255 255 255 / 0) 61.8%);
  --bite:0px;--ray:1;--disc:4px;--logo-day:block;--logo-night:none;
  accent-color:var(--ink);scrollbar-color:var(--cotton-row) transparent;
}
@media screen and (prefers-color-scheme:dark){:root:not([data-theme=light]){
  color-scheme:dark;
  --ink:#F1EBDD;--ground:#0C1410;--card:#141F19;--line:#26372E;--mute:#A3B0A6;
  --terra-ink:#E8A283;--terra-tint:#38241B;--ok-ink:#8CCDA6;--warn-ink:#E6C36C;--warn-tint:#373016;--bad-ink:#F09480;--bad-tint:#3C1E18;
  --cotton:#1D2D25;--cotton-row:#2A3F34;--rope-twist:#8F7748;--field:#76867C;
  --veil:rgb(4 8 6 / .82);--bar:rgb(20 31 25 / .82);
  --glow:radial-gradient(120% 100% at 50% 0%,#1D4233 0,rgb(29 66 51 / 0) 61.8%);
  --lift:0 1px 0 rgb(241 235 221 / .05) inset,0 21px 34px -21px rgb(0 0 0 / .8);
  --sheen:none;--bite:8px;--ray:0;--disc:1px;--logo-day:none;--logo-night:block;
}}
@media screen{:root[data-theme=dark]{
  color-scheme:dark;
  --ink:#F1EBDD;--ground:#0C1410;--card:#141F19;--line:#26372E;--mute:#A3B0A6;
  --terra-ink:#E8A283;--terra-tint:#38241B;--ok-ink:#8CCDA6;--warn-ink:#E6C36C;--warn-tint:#373016;--bad-ink:#F09480;--bad-tint:#3C1E18;
  --cotton:#1D2D25;--cotton-row:#2A3F34;--rope-twist:#8F7748;--field:#76867C;
  --veil:rgb(4 8 6 / .82);--bar:rgb(20 31 25 / .82);
  --glow:radial-gradient(120% 100% at 50% 0%,#1D4233 0,rgb(29 66 51 / 0) 61.8%);
  --lift:0 1px 0 rgb(241 235 221 / .05) inset,0 21px 34px -21px rgb(0 0 0 / .8);
  --sheen:none;--bite:8px;--ray:0;--disc:1px;--logo-day:none;--logo-night:block;
}}

/* light from above the workbench: cotton in the sun by day, the forest under a lamp by night */
body{background:var(--glow) top center / 100% 610px no-repeat,var(--ground)}
::selection{background:var(--rope);color:#1B3B2E}
.obj{box-shadow:var(--lift)}
.btn{background-image:var(--sheen);transition:transform .2s cubic-bezier(.2,.7,.2,1)}
.btn--quiet,.btn--bad{background-image:none}
.btn:active,.chip:active,.tabs__a:active,.theme:active{transform:scale(.975)}
.top{position:sticky;inset-block-start:0;z-index:6;background:var(--bar);-webkit-backdrop-filter:blur(13px) saturate(1.3);backdrop-filter:blur(13px) saturate(1.3)}
.tabs{background:var(--bar);-webkit-backdrop-filter:blur(13px) saturate(1.3);backdrop-filter:blur(13px) saturate(1.3)}
.top__end{display:flex;align-items:center;gap:var(--s1)}
:root img.logo--day{display:var(--logo-day)}
:root img.logo--night{display:var(--logo-night)}
.lhead__t{align-items:center}
.lhead__t>.ico,.lhead__t>.ico-m{flex:none;inline-size:26px;block-size:26px}
.now__q,.ohead__no{display:flex;align-items:center;gap:var(--s2)}
.now__q>.ico,.ohead__no>.ico{flex:none;inline-size:26px;block-size:26px}
.sheet__t{display:flex;align-items:center;gap:var(--s2)}
.sheet__t .ico{flex:none;inline-size:22px;block-size:22px}
.lbl{display:flex;align-items:center;gap:var(--s1)}
.lbl .ico{flex:none;inline-size:16px;block-size:16px}

/* the key between day and night: a sun with eight rays; by night a second circle bites it into a moon */
@property --bite{syntax:"<length>";inherits:true;initial-value:0px}
.theme{display:grid;place-items:center;inline-size:44px;block-size:44px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--ink);cursor:pointer}
.theme__sky{position:relative;inline-size:21px;block-size:21px}
.theme__sky::before{content:"";position:absolute;inset:var(--disc);border-radius:50%;background:currentColor;
  -webkit-mask:radial-gradient(circle at 80% 20%,transparent var(--bite),#000 calc(var(--bite) + .6px));mask:radial-gradient(circle at 80% 20%,transparent var(--bite),#000 calc(var(--bite) + .6px));
  transition:--bite .618s cubic-bezier(.3,.7,.2,1),inset .618s cubic-bezier(.3,.7,.2,1)}
.theme__sky::after{content:"";position:absolute;inset:-1px;border-radius:50%;background:repeating-conic-gradient(from -7deg,currentColor 0 14deg,transparent 14deg 45deg);
  -webkit-mask:radial-gradient(circle,transparent 0 8.4px,#000 8.9px 11px,transparent 11.5px);mask:radial-gradient(circle,transparent 0 8.4px,#000 8.9px 11px,transparent 11.5px);
  transform:scale(var(--ray)) rotate(calc(var(--ray) * 45deg));opacity:var(--ray);transition:transform .618s cubic-bezier(.3,.7,.2,1),opacity .382s}
.login{position:relative}
.login>.theme{position:absolute;inset-block-start:var(--s2);inset-inline-end:var(--s2);z-index:2;color:#F2EDE2} /* it sits on the forest panel, by day and by night */

/* the change itself: night spreads from the key in a circle, in 0.618 of a second */
::view-transition-old(root){animation:none}
::view-transition-new(root){animation:khayt-reveal .618s cubic-bezier(.3,.7,.2,1)}
@keyframes khayt-reveal{from{clip-path:circle(0 at var(--vx,50%) var(--vy,0%))}to{clip-path:circle(150vmax at var(--vx,50%) var(--vy,0%))}}
@media (prefers-reduced-motion:reduce){::view-transition-new(root){animation:none}.theme__sky::before,.theme__sky::after,.btn{transition:none}}
@media print{body{background:#FFF}.obj{box-shadow:none}.theme{display:none}}
