/*
  Lun's design system, for the web.

  The app's is Sources/Search/Design.swift in petterblaasmo/lun: Palette,
  Greys, Spaces.colours, Radius and Elevation. This file says the same in
  CSS, by the same names, so the page and the app are drawn from one set of
  numbers. Change a number there, change it here.

  Every colour is a pair, one for a light window and one for a dark. The
  light half is on :root and .look-light; the dark half is on .look-dark,
  on :root when the page is set to dark, and on :root when the Mac is dark
  and the page is left on Auto. Those last two blocks are the same, and
  scripts/check.mjs fails if they part.

  Below the app's tokens are the page's own: the warm paper it is printed
  on, the scenes and the made-up sites in its drawn windows. Nothing in
  css/site.css writes a colour of its own.
*/

/* ---------- Colour, light ---------- */
:root,.look-light{
  /* Palette */
  --ground:#FFFFFF;
  --ink:#171717;
  --muted:#5A5A5A;
  --faint:#D4D4D4;
  --hairline:#E8E8E8;
  --wash:#EFEFEF;
  --hover:#F6F6F6;
  --frame:#F4F4F4;
  --raised:#FFFFFF;
  --fill:rgba(23,23,23,.07);
  --fill-hover:rgba(23,23,23,.11);
  --rule:rgba(23,23,23,.10);
  --knob:#FFFFFF;
  --safe:#14803D;
  --unsafe:#B5540A;
  --soft:rgba(23,23,23,.75);
  --ring:rgba(23,23,23,.35);
  --drop:rgba(23,23,23,.16);
  --danger:rgba(255,59,48,.8);
  --danger-ring:rgba(255,59,48,.35);
  --recording:#FF3B30;
  /* Greys.white: black let through, so a row on a space's colour takes its tint */
  --tint-wash:rgba(0,0,0,.07);
  --tint-hover:rgba(0,0,0,.04);
  /* Greys.frame: a pin, the address, and a pin whose page is shown */
  --tint-tile:rgba(0,0,0,.065);
  --tint-live:rgba(0,0,0,.11);
  /* The page card's one-pixel edge: Color.primary at 8% */
  --card-edge:rgba(0,0,0,.08);
  /* What the demo windows stand on: a quiet blue-grey on light paper, a lifted grey on dark */
  --stage:#E4EAF1;
  /* Palette.fieldDim: the page under the raised field, dimmed a little in light; not in dark */
  --field-dim:rgba(0,0,0,.10);
  /* A painting behind a demo, quietened a little in dark */
  --art-dim:transparent;
  --mark-invert:0;
  /* A section's eyebrow word: the warm of the paper, deepened */
  --eyebrow:#A8521B;
  /* Spaces.wash: how much of a space's colour the chrome wears */
  --space-wash:7%;
  /* Elevation: the shadows' strengths and the hairline round each */
  --edge:.5;
  --edge-lift:rgba(0,0,0,.05);
  --edge-float:rgba(0,0,0,.08);
  --shade-lift:rgba(0,0,0,.07);
  --shade-float-near:rgba(0,0,0,.04);
  --shade-float-far:rgba(0,0,0,.12);
  --shade-overlay-near:rgba(0,0,0,.06);
  --shade-overlay-far:rgba(0,0,0,.18);
  --shade-carried:rgba(0,0,0,.16);
  --shade-knob:rgba(0,0,0,.18);
  /* The Mac's keyboard focus */
  --focus:#007AFF;
  /* Page: the warm paper the page is printed on */
  --paper:#FDFCFA;
}

/* ---------- Colour, dark (twice: the page set to dark, and Auto on a dark Mac) ---------- */
.look-dark{
  --ground:#1C1C1C;
  --ink:#EDEDED;
  --muted:#A3A3A3;
  --faint:#525252;
  --hairline:#333333;
  --wash:#2D2D2D;
  --hover:#262626;
  --frame:#131313;
  --raised:#212121;
  --fill:rgba(237,237,237,.08);
  --fill-hover:rgba(237,237,237,.13);
  --rule:rgba(237,237,237,.10);
  --knob:rgba(255,255,255,.16);
  --safe:#4ADE80;
  --unsafe:#FABF24;
  --soft:rgba(237,237,237,.75);
  --ring:rgba(237,237,237,.35);
  --drop:rgba(237,237,237,.16);
  --danger:rgba(255,69,58,.8);
  --danger-ring:rgba(255,69,58,.35);
  --recording:#FF453A;
  --tint-wash:rgba(255,255,255,.08);
  --tint-hover:rgba(255,255,255,.05);
  /* Greys.frame: a pin, the address, and a pin whose page is shown */
  --tint-tile:rgba(255,255,255,.08);
  --tint-live:rgba(255,255,255,.14);
  /* The page card's one-pixel edge: Color.primary at 8% */
  --card-edge:rgba(255,255,255,.08);
  /* What the demo windows stand on: a quiet blue-grey on light paper, a lifted grey on dark */
  --stage:#2A2B2F;
  /* Palette.fieldDim: the page under the raised field, dimmed a little in light; not in dark */
  --field-dim:transparent;
  /* A painting behind a demo, quietened a little in dark */
  --art-dim:rgba(0,0,0,.28);
  --mark-invert:1;
  --eyebrow:#F0A46E;
  --space-wash:11%;
  --edge:1;
  --edge-lift:rgba(255,255,255,.08);
  --edge-float:rgba(255,255,255,.10);
  --shade-lift:rgba(0,0,0,.3);
  --shade-float-near:rgba(0,0,0,.3);
  --shade-float-far:rgba(0,0,0,.5);
  --shade-overlay-near:rgba(0,0,0,.3);
  --shade-overlay-far:rgba(0,0,0,.6);
  --shade-carried:rgba(0,0,0,.4);
  --shade-knob:rgba(0,0,0,.18);
  --focus:#0A84FF;
  --paper:#141312;
  color-scheme:dark;
}
.look-light{color-scheme:light}

/* ---------- Colour, the same in light and dark ---------- */
:root{
  /* Palette */
  --scrim:rgba(0,0,0,.10);
  --scrim-deep:rgba(0,0,0,.22);
  --over-page:rgba(0,0,0,.72);
  --over-page-edge:rgba(255,255,255,.6);
  --badge:#ED3D36;
  /* Spaces.colours: none, then the five a space can wear */
  --space-none:#737885;
  --space-blue:#4285F5;
  --space-green:#33A873;
  --space-orange:#F59E33;
  --space-red:#E65466;
  --space-violet:#9E66E6;
  /* The Mac's: a window's traffic lights, and its pointer */
  --light-close:#FF5F57;
  --light-minimise:#FEBC2E;
  --light-zoom:#28C840;
  --pointer:#171717;
  --pointer-edge:#FFFFFF;
  /* Icon/icon.swift: the app icon's plate and its mark */
  --icon-plate:#F4EEE6;
  --icon-mark:#171717;
  /* Type: the Mac's own faces, as the app uses */
  --sans:-apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue",system-ui,sans-serif;
  --serif:ui-serif,"New York","Iowan Old Style",Georgia,serif;
  --mono:ui-monospace,"SF Mono",Menlo,monospace;
}

/* ---------- Size: Radius and Elevation ----------
   In the app's points. One point is a pixel on the page; in a Lun window
   drawn on the page (.win) it is a share of the window's own type size, so
   its corners and shadows shrink with it. A shape inside another takes the
   outer's radius less the gap between them, so their curves run alongside. */
:root{--pt:1px}
.win{--pt:.07em}
:root,.win,.lw{
  --r-control:calc(6*var(--pt));
  --r-row:calc(8*var(--pt));
  --r-card:calc(10*var(--pt));
  --r-float:calc(14*var(--pt));
  --r-panel:calc(16*var(--pt));
  --r-middle:calc(20*var(--pt));
  --r-pill:999px;
  /* A card lying on the column (the tab you're on) */
  --lift:inset 0 0 0 calc(var(--edge)*var(--pt)) var(--edge-lift),0 var(--pt) calc(3*var(--pt)) var(--shade-lift);
  /* One floating over the page (the address list, a question) */
  --float:inset 0 0 0 calc(var(--edge)*var(--pt)) var(--edge-float),0 calc(2*var(--pt)) calc(6*var(--pt)) var(--shade-float-near),0 calc(12*var(--pt)) calc(36*var(--pt)) var(--shade-float-far);
  /* One over everything (the tab switcher) */
  --overlay:inset 0 0 0 calc(var(--edge)*var(--pt)) var(--edge-float),0 calc(4*var(--pt)) calc(12*var(--pt)) var(--shade-overlay-near),0 calc(28*var(--pt)) calc(80*var(--pt)) var(--shade-overlay-far);
  /* What the hand has lifted out of its row and is carrying */
  --carried:0 calc(4*var(--pt)) calc(24*var(--pt)) var(--shade-carried);
  /* A switch's knob: its own, not lift, as a hairline is a pale rim round a knob this small */
  --knob-shadow:0 var(--pt) calc(3*var(--pt)) var(--shade-knob);
}

/* ---------- The page's own, built on the above ---------- */
:root{
  --glass:color-mix(in srgb,var(--paper) 82%,transparent);
  /* A word that says more: its dotted line, the sentence stepping back
     round it, and the words in its pill (the pill is ink, its words paper) */
  --tip-line:color-mix(in srgb,var(--ink) 32%,transparent);
  --tip-dim:color-mix(in srgb,var(--muted) 55%,var(--paper));
  --tip-text:color-mix(in srgb,var(--paper) 70%,var(--ink));
  /* What a screenshot opened large stands on: the paper, a little see-through */
  --lb-veil:color-mix(in srgb,var(--paper) 84%,transparent);
  /* A row that scrolls sideways, faded at an edge with more past it */
  --edge-r:linear-gradient(to right,#000 calc(100% - 44px),transparent);
  --edge-l:linear-gradient(to left,#000 calc(100% - 44px),transparent);
  --edge-lr:linear-gradient(to right,transparent,#000 44px,#000 calc(100% - 44px),transparent);
  /* Private's map: the wires out of your Mac, light on any painting, with a
     shade under them, and the spark each now and then carries */
  --wire:rgba(255,255,255,.75);
  --wire-spark:#fff;
  --wire-ring:rgba(255,255,255,.3);
  --wire-shade:rgba(0,0,0,.3);
  /* A thing kept, marked as staying; one Lun has none of, tried */
  --safe-wash:color-mix(in srgb,var(--safe) 14%,transparent);
  --safe-ring:color-mix(in srgb,var(--safe) 50%,transparent);
  /* Larger than anything in the app: the page's groups and its scenes */
  --r-group:24px;
  --r-scene:28px;
  /* The Mac's app icon, a rounded square at 22.37% of its side */
  --r-icon:22.37%;
  /* A whole Mac window, drawn at its own scale (in em, so it scales with .win) */
  /* A Mac window on its stage, as in Lun's own screenshots: a hairline, a wide soft shade and a close one */
  --window-shadow:0 0 0 .5px rgba(0,0,0,.14),0 2.6em 6em -2em rgba(20,30,50,.30),0 .7em 1.8em -.6em rgba(20,30,50,.14);
  --pointer-shadow:drop-shadow(0 1px 2px rgba(0,0,0,.35));
  /* The made-up sites in the drawn windows: their favicons and kickers */
  --site-blue:#2F6FE4;
  --site-orange:#F08A24;
  --site-green:#1E9E62;
  --site-teal:#1C9AA8;
  --site-violet:#7B4FD6;
  --site-red:#E0484F;
  --site-graphite:#3A3A3A;
  --site-black:#262626;
  --site-yellow:#F2C230;
  /* A favicon's mark, on its colour */
  --site-on:#FFFFFF;
  --site-slate:#8FA5B8;
  --site-kicker:#2F59B8;
  --site-kicker-warm:#B5540A;
  /* The low sun in every scene */
  --sun:#FFD79A;
}

/* Scenes: flat fjords at one time of day each, sky to water */
.s-dusk{--sky1:#F0C3A8;--sky2:#F8E7D8;--m1:#D9AB9B;--m2:#A9787E;--m3:#5E4758;--water:#8C7388}
.s-dawn{--sky1:#C7DAEA;--sky2:#F6E8DC;--m1:#A9BFD0;--m2:#7F9AB0;--m3:#4C6379;--water:#6F8AA0}
.s-moss{--sky1:#D9E0C6;--sky2:#F4EEDD;--m1:#B4C19F;--m2:#869973;--m3:#4F6149;--water:#73866A}
.s-night{--sky1:#262A49;--sky2:#77607A;--m1:#45436A;--m2:#2F2D4C;--m3:#1D1B30;--water:#38355A}
.s-clay{--sky1:#EBC6A0;--sky2:#F8EAD5;--m1:#D5A57F;--m2:#A8704F;--m3:#6B4534;--water:#96705A}
.s-heather{--sky1:#D9CAE5;--sky2:#F6E8E5;--m1:#BBA5CC;--m2:#8E77A6;--m3:#544468;--water:#7C6A93}

