/* ==========================================================================
   Relay looks and backgrounds (11/27)

   The suite's five looks, as in My Cairn (src/css/looks.css), Operations and
   Recruit; the approved mock is cairn-looks-style-guide.html. Picked in
   Settings, Appearance: Cairn (no data-look on <html>: today's Relay, which
   nothing in this file touches), Glass, Contrast, Terminal or Bold, each in
   Light and Dark. A look sets Relay's own tokens (style.css, section 1) and a
   few drawing rules; layout, content and behaviour are the same in every look.

   Fixed in every look: the company colour (--green, --button-green) on main
   buttons, your own bubbles, links, the current tab and the counts, and the
   status colours. The Green theme keeps its own colours; a look still sets its
   fonts and shapes there, and there is no picture under Green.

   Fonts: self-hosted latin woff2 files from the @fontsource-variable packages
   (OFL; licences beside them in static/fonts), loaded only when a look uses
   them. The build copies them as fonts/ beside the page.
   ========================================================================== */

@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 100 700; font-display: swap; src: url('/fonts/ibm-plex-sans-latin-wght.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 100 800; font-display: swap; src: url('/fonts/jetbrains-mono-latin-wght.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('/fonts/space-grotesk-latin-wght.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ── The pickers in Settings, Appearance ─────────────────────────────────── */
/* Each look's swatch keeps fixed colours, so it reads the same whatever look is on. */
.lk-sw { flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; border: 1px solid rgba(20, 31, 27, .25); }
:root:is([data-theme="dark"], [data-theme="green"]) .lk-sw { border-color: rgba(255, 255, 255, .3); }
.lk-sw-cairn { background: linear-gradient(135deg, #141f1b 0 50%, #f2f6f4 50%); }
.lk-sw-glass { border-radius: 999px; background: linear-gradient(135deg, #9fd9c4, #b4c6ef 55%, #f3cfa8); }
.lk-sw-contrast { border: 1.5px solid #0b0e0d; background: linear-gradient(135deg, #0b0e0d 0 50%, #ffffff 50%); }
:root:is([data-theme="dark"], [data-theme="green"]) .lk-sw-contrast { border-color: #ffffff; }
.lk-sw-terminal { border-radius: 2px; border: 1px dashed #5be38a; background: #0c110e; }
.lk-sw-bold { background: linear-gradient(90deg, #1b1f1d 0 45%, #efeee9 45%); }
.look-options { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* Background: None, then a row each of Light, Photo and Dark pictures. Hidden under Contrast and Green, and while the device asks for
   reduced transparency (the pick is kept). Thumbnails load only while the picker is on screen. */
.bg-pick { display: grid; grid-template-columns: 52px repeat(3, 72px); gap: 10px; align-items: center; }
.bg-row-name { grid-column: 1; font-size: var(--t-sm); font-weight: 600; color: var(--quiet); }
.bg-pick > .bg-none { grid-column: 2; }
.bg-choice { position: relative; display: grid; place-items: center; width: 72px; height: 44px; border: 1px solid var(--line); border-radius: 8px; background-color: var(--surface); background-position: center; background-size: cover; background-repeat: no-repeat; color: var(--quiet); font-size: var(--t-sm); font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bg-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bg-choice:has(input:checked) { outline: 2px solid var(--text); outline-offset: 2px; color: var(--text); }
.bg-choice:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }
:root[data-input="touch"] .bg-choice:has(input:focus-visible):not(:has(input:checked)) { outline: none; }
.bg-t-silk { background-image: url('/backgrounds/silk-t.jpg'); }
.bg-t-sage { background-image: url('/backgrounds/sage-t.jpg'); }
.bg-t-pastel { background-image: url('/backgrounds/pastel-t.jpg'); }
.bg-t-dunes { background-image: url('/backgrounds/dunes-t.jpg'); }
.bg-t-lake { background-image: url('/backgrounds/lake-t.jpg'); }
.bg-t-hills { background-image: url('/backgrounds/hills-t.jpg'); }
.bg-t-aurora { background-image: url('/backgrounds/aurora-t.jpg'); }
.bg-t-velvet { background-image: url('/backgrounds/velvet-t.jpg'); }
.bg-t-nebula { background-image: url('/backgrounds/nebula-t.jpg'); }
:root:is([data-look="contrast"], [data-theme="green"]) .bg-section { display: none; }
@media (prefers-reduced-transparency: reduce) { .bg-section { display: none; } }
/* In the settings list the looks are rows like the themes above them. */
.settings-detail .look-options { display: flex; flex-direction: column; gap: 0; }
.settings-detail :is(.look-section, .bg-section) { margin-top: 30px; }
.settings-detail .look-section .settings-choices legend { margin-bottom: 4px; }
.settings-detail .bg-section .settings-choices legend { margin-bottom: 12px; }

/* ── Tokens: each look in Light and Dark, mapped onto Relay's own names ───── */
/* --lk-rail-* draw the desktop frame (top bar and sidebar); --lk-ini-* the initials. */
:root[data-look] {
  --lk-head: inherit;
  --lk-rail: var(--ink); --lk-rail-raise: var(--ink-lift); --lk-rail-ink: #ffffff; --lk-rail-quiet: var(--on-ink-quiet);
  --lk-rail-hover: #ffffff14; --lk-rail-line: #ffffff2e; --lk-rail-on: #ffffff; --lk-rail-gold: var(--gold-on-ink);
}

/* GLASS: frosted bars over a soft colour wash; see-through panels. */
:root[data-look="glass"] { --r-sm: 14px; --r-md: 20px; --r-lg: 24px; --r-xl: 32px; }
:root[data-look="glass"][data-theme="light"] {
  --pale-sunk: #e9eef0; --pale: #f1f5f6; --surface: #f7fafb; --surface-end: #f7fafb;
  --wash: #e9eef0; --wash-end: #e9eef0; --sidebar-end: #f1f5f6; --search-start: rgba(30, 50, 60, .07); --search-end: rgba(30, 50, 60, .07);
  --message-end: #f7fafb; --bubble-start: #ffffff; --bubble-end: #ffffff; --quote: rgba(30, 50, 60, .08);
  --text: #1a2124; --text-soft: #2b373c; --quiet: #46535a; --line: rgba(40, 60, 70, .13);
  --lk-panel: rgba(255, 255, 255, .62); --lk-panel-line: rgba(255, 255, 255, .85); --lk-glass: rgba(255, 255, 255, .55); --lk-glass-line: rgba(255, 255, 255, .8);
  --lk-shadow: 0 1px 0 rgba(255, 255, 255, .85) inset, 0 8px 28px rgba(30, 50, 60, .10);
  --lk-wash: radial-gradient(60% 40% at 8% 10%, rgba(124, 200, 170, .5), transparent 70%), radial-gradient(60% 45% at 95% 40%, rgba(150, 180, 235, .45), transparent 70%), radial-gradient(70% 40% at 45% 100%, rgba(240, 200, 160, .4), transparent 70%);
  --lk-rail: #eef3f4; --lk-rail-raise: rgba(255, 255, 255, .8); --lk-rail-ink: #1a2124; --lk-rail-quiet: #46535a;
  --lk-rail-hover: rgba(255, 255, 255, .55); --lk-rail-line: rgba(40, 60, 70, .12); --lk-rail-on: #1a2124; --lk-rail-gold: var(--gold);
}
:root[data-look="glass"][data-theme="dark"] {
  --pale-sunk: #0e1316; --pale: #141b1e; --surface: #1a2226; --surface-end: #1a2226;
  --wash: #0e1316; --wash-end: #0e1316; --sidebar-end: #141b1e; --search-start: rgba(255, 255, 255, .06); --search-end: rgba(255, 255, 255, .06);
  --message-end: #1a2226; --bubble-start: #222b30; --bubble-end: #222b30; --quote: rgba(255, 255, 255, .08);
  --text: #eef3f4; --text-soft: #cfd8db; --quiet: #a6b3b7; --line: rgba(255, 255, 255, .1);
  --lk-panel: rgba(34, 42, 47, .58); --lk-panel-line: rgba(255, 255, 255, .12); --lk-glass: rgba(30, 38, 42, .55); --lk-glass-line: rgba(255, 255, 255, .12);
  --lk-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 10px 30px rgba(0, 0, 0, .35);
  --lk-wash: radial-gradient(60% 40% at 8% 10%, rgba(46, 138, 97, .4), transparent 70%), radial-gradient(60% 45% at 95% 40%, rgba(60, 90, 170, .4), transparent 70%), radial-gradient(70% 40% at 45% 100%, rgba(150, 90, 60, .3), transparent 70%);
  --lk-rail: #141b1e; --lk-rail-raise: rgba(255, 255, 255, .12); --lk-rail-ink: #eef3f4; --lk-rail-quiet: #a6b3b7;
  --lk-rail-hover: rgba(255, 255, 255, .07); --lk-rail-line: rgba(255, 255, 255, .12); --lk-rail-on: #eef3f4;
}

/* CONTRAST: sharp black lines and darker text, for sunlight or weaker eyesight. IBM Plex Sans, bold headings. */
:root[data-look="contrast"] { font-family: 'IBM Plex Sans', -apple-system, system-ui, 'Segoe UI', sans-serif; --r-sm: 6px; --r-md: 6px; --r-lg: 8px; --r-xl: 10px; }
:root[data-look="contrast"][data-theme="light"] {
  --pale-sunk: #ffffff; --pale: #ffffff; --surface: #ffffff; --surface-end: #ffffff;
  --wash: #ffffff; --wash-end: #ffffff; --sidebar-end: #ffffff; --search-start: #eef0ef; --search-end: #eef0ef;
  --selected-end: var(--soft); --message-end: #ffffff; --bubble-start: #eef0ef; --bubble-end: #eef0ef; --quote: #e2e5e3;
  --text: #0b0e0d; --text-soft: #161a18; --quiet: #363c39; --line: #8e9591; --danger: #9a1f18;
  --lk-line: #0b0e0d; --lk-ini-bg: #0b0e0d; --lk-ini-ink: #ffffff;
  --lk-rail: #f2f3f3; --lk-rail-raise: #0b0e0d; --lk-rail-ink: #0b0e0d; --lk-rail-quiet: #363c39;
  --lk-rail-hover: rgba(11, 14, 13, .07); --lk-rail-line: #8e9591; --lk-rail-on: #ffffff; --lk-rail-gold: #0b0e0d;
}
:root[data-look="contrast"][data-theme="dark"] {
  --pale-sunk: #000000; --pale: #000000; --surface: #000000; --surface-end: #000000;
  --wash: #000000; --wash-end: #000000; --sidebar-end: #000000; --search-start: #121413; --search-end: #121413;
  --selected-end: var(--soft); --message-end: #000000; --bubble-start: #1a1d1b; --bubble-end: #1a1d1b; --quote: #2a2e2c;
  --text: #ffffff; --text-soft: #f2f4f3; --quiet: #d2d7d4; --line: #6b726e; --danger: #ff9e96;
  --lk-line: #ffffff; --lk-ini-bg: #ffffff; --lk-ini-ink: #000000;
  --lk-rail: #0d0f0e; --lk-rail-raise: #ffffff; --lk-rail-ink: #ffffff; --lk-rail-quiet: #d2d7d4;
  --lk-rail-hover: rgba(255, 255, 255, .1); --lk-rail-line: #6b726e; --lk-rail-on: #000000; --lk-rail-gold: #ffffff;
}

/* TERMINAL: monospace, like a code terminal. Light is warm paper; dark is green on black. Square corners, dashed lines. */
:root[data-look="terminal"] { font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace; --r-sm: 2px; --r-md: 2px; --r-lg: 2px; --r-xl: 2px; }
:root[data-look="terminal"][data-theme="light"] {
  --pale-sunk: #f4f1e8; --pale: #f4f1e8; --surface: #f4f1e8; --surface-end: #f4f1e8;
  --wash: #f4f1e8; --wash-end: #f4f1e8; --sidebar-end: #f4f1e8; --search-start: #eae6d9; --search-end: #eae6d9;
  --message-end: #f4f1e8; --bubble-start: #fbf9f3; --bubble-end: #fbf9f3; --quote: #eae6d9;
  --text: #1e2a22; --text-soft: #28352c; --quiet: #4f5b53; --line: #c9c3b2; --danger: #a0302a;
  --lk-line: #9e9886;
  --lk-rail: #ece8dc; --lk-rail-raise: #1e2a22; --lk-rail-ink: #1e2a22; --lk-rail-quiet: #4f5b53;
  --lk-rail-hover: rgba(30, 42, 34, .07); --lk-rail-line: #c9c3b2; --lk-rail-on: #f4f1e8; --lk-rail-gold: #1e2a22;
}
:root[data-look="terminal"][data-theme="dark"] {
  --pale-sunk: #0c110e; --pale: #0c110e; --surface: #0c110e; --surface-end: #0c110e;
  --wash: #0c110e; --wash-end: #0c110e; --sidebar-end: #0c110e; --search-start: #121a15; --search-end: #121a15;
  --message-end: #0c110e; --bubble-start: #121a15; --bubble-end: #121a15; --quote: #1a271f;
  --text: #c9f2d4; --text-soft: #b3e0bf; --quiet: #7faa8b; --line: #24372b; --danger: #ff7a70;
  --soft: #15291d; --selected-end: #15291d;
  --lk-line: #2f4a39;
  --lk-rail: #0f1511; --lk-rail-raise: #c9f2d4; --lk-rail-ink: #c9f2d4; --lk-rail-quiet: #7faa8b;
  --lk-rail-hover: rgba(201, 242, 212, .07); --lk-rail-line: #24372b; --lk-rail-on: #0c110e; --lk-rail-gold: #c9f2d4;
}

/* BOLD: a dark tab bar and sidebar, chunkier type (Space Grotesk headings, the app's own font for text), filled initials. */
:root[data-look="bold"] { --lk-head: 'Space Grotesk', -apple-system, system-ui, sans-serif; --r-sm: 10px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; }
:root[data-look="bold"][data-theme="light"] {
  --pale-sunk: #efeee9; --pale: #f6f5f1; --surface: #ffffff; --surface-end: #ffffff;
  --wash: #efeee9; --wash-end: #efeee9; --sidebar-end: #f6f5f1; --search-start: #e5e3dc; --search-end: #e5e3dc;
  --message-end: #ffffff; --bubble-start: #efeee9; --bubble-end: #efeee9; --quote: #e5e3dc;
  --text: #141716; --text-soft: #2a2e2c; --quiet: #565b58; --line: #dedcd6;
  --lk-fill: #1b1f1d; --lk-fill-line: #343b37; --lk-fill-acc: #9cb9b4;
  --lk-rail: #1b1f1d; --lk-rail-raise: #2c322f; --lk-rail-ink: #ffffff; --lk-rail-quiet: #a8b0ac;
  --lk-rail-hover: rgba(255, 255, 255, .08); --lk-rail-line: #343b37; --lk-rail-on: #ffffff;
}
/* The company colour lifted toward white; a plain shade where color-mix is unknown, so the filled tab never vanishes. */
@supports (color: color-mix(in srgb, red, blue)) {
  :root[data-look="bold"][data-theme="light"] { --lk-fill-acc: color-mix(in srgb, var(--button-green) 45%, #ffffff); }
}
:root[data-look="bold"][data-theme="dark"] {
  --pale-sunk: #111312; --pale: #161817; --surface: #1a1d1c; --surface-end: #1a1d1c;
  --wash: #111312; --wash-end: #111312; --sidebar-end: #161817; --search-start: #0c0d0d; --search-end: #0c0d0d;
  --message-end: #1a1d1c; --bubble-start: #222625; --bubble-end: #222625; --quote: #2b302e;
  --text: #edefee; --text-soft: #cdd2cf; --quiet: #9ba19e; --line: #2b302e;
  --lk-fill: #050606; --lk-fill-line: #2b302e; --lk-fill-acc: var(--green);
  --lk-rail: #0a0b0b; --lk-rail-raise: #1f2422; --lk-rail-ink: #edefee; --lk-rail-quiet: #9ba19e;
  --lk-rail-hover: rgba(255, 255, 255, .07); --lk-rail-line: #2b302e; --lk-rail-on: #edefee;
}
:root[data-look="bold"][data-theme="green"] { --lk-fill: #0f1914; --lk-fill-line: #2a3d33; --lk-fill-acc: var(--green); }

/* ── Shared drawing rules ────────────────────────────────────────────────── */
:root[data-look] :is(h1, h2, h3, .room-top strong, .inbox-heading h2, .settings-header h2) { font-family: var(--lk-head); }
/* The Cairn wordmark and the tab labels keep the app's own font in every look, so none is cut off. */
:root[data-look] :is(.suite-wordmark, .brand-name, .cairn-signature, .mobile-nav button span) { font-family: 'Archivo', -apple-system, system-ui, sans-serif; }
/* Washes and pictures sit under see-through layers: the hard-coded light outlines of the Cairn look go. */
:root[data-look] .room-row.is-selected { box-shadow: inset 0 0 0 1px var(--line); }
:root[data-look]:not([data-theme="green"]) .sidebar-head #account { border-color: var(--line); }

/* Desktop: the suite frame (top bar and sidebar) in the look's own colours; Glass, Contrast and Terminal have a light frame in Light,
   Bold a dark one, every look a dark one in Dark. The 12px corner where the canvas starts is drawn in the frame's colour. */
@media (min-width: 701px) {
  :root[data-look] .app,
  :root[data-look] .suite-bar,
  :root[data-look] .app-rail { background: var(--lk-rail); }
  :root[data-look] .app::after { background: radial-gradient(circle at 100% 100%, transparent 11.5px, var(--lk-rail) 12px); }
  :root[data-look] .suite-bar { color: var(--lk-rail-ink); }
  :root[data-look] .suite-wordmark { color: var(--lk-rail-ink); }
  :root[data-look] .suite-wordmark span { color: var(--lk-rail-gold); }
  :root[data-look] .suite-app { color: var(--lk-rail-quiet); }
  :root[data-look] .suite-app:is(:hover, [aria-expanded="true"]) { background: var(--lk-rail-hover); color: var(--lk-rail-ink); }
  :root[data-look] .suite-search { background: color-mix(in srgb, var(--lk-rail-ink) 8%, transparent); color: var(--lk-rail-quiet); }
  :root[data-look] .suite-search input { color: var(--lk-rail-ink); }
  :root[data-look] .suite-search input::placeholder { color: var(--lk-rail-quiet); }
  :root[data-look] .suite-search:focus-within { box-shadow: 0 0 0 2px var(--lk-rail-gold); }
  :root[data-look] .suite-icon { border-color: var(--lk-rail-line); color: var(--lk-rail-ink); }
  :root[data-look] .suite-icon:hover { background: var(--lk-rail-hover); }
  :root[data-look] .suite-me.avatar { border-color: var(--lk-rail-line); background: color-mix(in srgb, var(--lk-rail-ink) 10%, transparent); color: var(--lk-rail-ink); }
  :root[data-look] .app-rail .rail-item { color: var(--lk-rail-quiet); }
  :root[data-look] .app-rail .rail-item:hover { background: var(--lk-rail-hover); color: var(--lk-rail-ink); }
  :root[data-look] .app-rail .rail-item.is-active { background: var(--lk-rail-raise); color: var(--lk-rail-on); }
  :root[data-look] .app-rail .rail-item.is-active::before { background: var(--lk-rail-gold); }
  :root[data-look] .app-rail .nav-unread { background: color-mix(in srgb, var(--lk-rail-ink) 14%, transparent); color: var(--lk-rail-ink); }
  :root[data-look] .app-rail .rail-item.is-active .nav-unread { background: color-mix(in srgb, var(--lk-rail-on) 22%, transparent); color: var(--lk-rail-on); }
  /* A filled current item (Contrast, Terminal) needs no bar beside it. */
  :root:is([data-look="contrast"], [data-look="terminal"]) .app-rail .rail-item.is-active::before { display: none; }
  /* Green keeps its own dark frame. */
  :root[data-look][data-theme="green"] {
    --lk-rail: var(--ink); --lk-rail-raise: var(--ink-lift); --lk-rail-ink: #ffffff; --lk-rail-quiet: var(--on-ink-quiet);
    --lk-rail-hover: #ffffff14; --lk-rail-line: #ffffff2e; --lk-rail-on: #ffffff; --lk-rail-gold: var(--gold-on-ink);
  }
  /* The corner line where the canvas meets a light frame: the frame's own line colour (Terminal's shade warm, as in Recruit). */
  :root:is([data-look="contrast"], [data-look="terminal"])[data-theme="light"] .app::before { box-shadow: inset 1px 1px 0 var(--lk-rail-line); }
  :root[data-look="terminal"][data-theme="light"] .app::before { box-shadow: inset 1px 1px 0 var(--lk-rail-line), inset 10px 10px 20px -12px rgba(70, 60, 30, .16); }
  :root[data-look] .suite-badge { box-shadow: 0 0 0 2px var(--lk-rail); }
}

/* Initials: Glass tints the four tones see-through, Bold fills them, Contrast and Terminal draw their own (below). */
:root[data-look="glass"][data-theme="light"] { --avt-sage-bg: rgba(31, 107, 74, .16); --avt-sage-ink: #1f5a40; --avt-sand-bg: rgba(168, 107, 31, .16); --avt-sand-ink: #6e4a16; --avt-slate-bg: rgba(59, 87, 120, .16); --avt-slate-ink: #2f4763; --avt-clay-bg: rgba(142, 70, 50, .16); --avt-clay-ink: #6e3526; }
:root[data-look="glass"][data-theme="dark"] { --avt-sage-bg: rgba(107, 192, 140, .2); --avt-sage-ink: #bfe6cc; --avt-sand-bg: rgba(224, 180, 94, .2); --avt-sand-ink: #f0d9a8; --avt-slate-bg: rgba(130, 165, 220, .2); --avt-slate-ink: #c6d6ee; --avt-clay-bg: rgba(232, 150, 120, .2); --avt-clay-ink: #f2c6b4; }
:root[data-look="bold"] { --avt-sage-bg: #1f6b4a; --avt-sage-ink: #ffffff; --avt-sand-bg: #95601c; --avt-sand-ink: #ffffff; --avt-slate-bg: #3b5778; --avt-slate-ink: #ffffff; --avt-clay-bg: #8e4632; --avt-clay-ink: #ffffff; }

/* ── GLASS ─────────────────────────────────────────────────────────────── */
/* The wash sits still behind the page on a fixed layer (phones ignore a fixed body background), from the very top of the screen to the
   very bottom, under the status bar and the home indicator. The page itself goes see-through. Not under Green. */
/* As My Cairn (11/27, Aidan's iPhone): the layer is as tall as the screen with Safari's bars put away (100lvh, anchored at the top only),
   so it also lies behind Safari's toolbar and the home indicator. Its page colour is a gradient layer, not a flat colour, and the page's
   own background (html) is the plain page colour; there is no theme-color, so Safari takes its bars from the page. */
/* iOS 26 Safari (Aidan's iPhone, v73): Safari paints the strip under its toolbar itself, in the page's own background colour; a fixed
   layer stops above it. So the page's own background is the colour the wash ends in at the bottom (measured, averaged across the width),
   and on the phone the layer fades into exactly that colour over its last 120px, so the strip continues the wash with no line. */
:root[data-look="glass"] { --lk-edge: #eae7e0; --lk-fade: linear-gradient(transparent calc(100% - 120px), var(--lk-edge)); }
:root[data-look="glass"][data-theme="dark"] { --lk-edge: #221d1c; }
:root[data-look="glass"]:not([data-theme="green"]) { background: var(--lk-edge); }
:root[data-look="glass"]:not([data-theme="green"]) body { background: transparent; }
:root[data-look="glass"]:not([data-theme="green"]) body::after { content: ''; position: fixed; top: 0; right: 0; left: 0; height: 100vh; height: 100lvh; z-index: -1; pointer-events: none; background: var(--lk-wash), linear-gradient(var(--pale-sunk), var(--pale-sunk)); }
:root[data-look="glass"]:not([data-theme="green"]) :is(.app, .sidebar, .messages, .conversation, .room-list) { background: transparent; }
/* On the phone an open chat lies over the chat list, so it carries its own copy of the wash (the same size as the screen, so it lines up). */
@media (max-width: 700px) {
  :root[data-look="glass"]:not([data-theme="green"]) body::after { background: var(--lk-fade), var(--lk-wash), linear-gradient(var(--pale-sunk), var(--pale-sunk)); }
  :root[data-look="glass"]:not([data-theme="green"]) .app .conversation { background: var(--lk-fade), var(--lk-wash), var(--pale-sunk); }
  :root[data-look="glass"]:not([data-theme="green"]) .messages { background: transparent; }
}
/* See-through panels over the wash. */
:root[data-look="glass"]:not([data-theme="green"]) :is(.room-row.is-selected, .group-card, .team-card, .settings-detail, .date-divider) { background: var(--lk-panel); border-color: var(--lk-panel-line); box-shadow: var(--lk-shadow); }
:root[data-look="glass"]:not([data-theme="green"]) .room-row:hover:not(.is-selected) { background: var(--lk-glass); box-shadow: none; }
:root[data-look="glass"]:not([data-theme="green"]) .bubble { background: var(--lk-panel); box-shadow: var(--lk-shadow); }
:root[data-look="glass"] .message.is-mine .bubble { background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0)), linear-gradient(140deg, var(--mine-start), var(--button-green)); box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 16px color-mix(in srgb, var(--button-green) 26%, transparent); }
:root[data-look="glass"]:not([data-theme="green"]) .tabs { background: var(--lk-glass); box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset; }
:root[data-look="glass"]:not([data-theme="green"]) .tabs .is-active { background: var(--lk-panel); }
:root[data-look="glass"] :is(.send, .primary, .confirm-primary) { border-radius: 999px; }
/* Desktop: the chat list and the conversation float as glass panes; the frame is frosted glass too. */
@media (min-width: 701px) {
  :root[data-look="glass"]:not([data-theme="green"]) .app { background: transparent; }
  :root[data-look="glass"]:not([data-theme="green"]) :is(.suite-bar, .app-rail) { background: color-mix(in srgb, var(--lk-rail) 70%, transparent); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%); }
  /* No solid corner patch on glass (it would show as a dark notch); the corner is a thin glass line with a soft shade (as Recruit PR 9). */
  :root[data-look="glass"]:not([data-theme="green"]) .app::after { display: none; }
  :root[data-look="glass"]:not([data-theme="green"]) .sidebar { background: var(--lk-panel); border-top-left-radius: 12px; }
  :root[data-look="glass"][data-theme="light"] .app::before { box-shadow: inset 1px 1px 0 var(--lk-glass-line), inset 8px 8px 16px -10px rgba(30, 50, 60, .14); }
  :root[data-look="glass"][data-theme="dark"] .app::before { box-shadow: inset 1px 1px 0 var(--lk-glass-line), inset 8px 8px 16px -10px rgba(0, 0, 0, .45); }
  :root[data-look="glass"]:not([data-theme="green"]) :is(.chat-head, .compose, .settings-header) { background: var(--lk-panel); }
  :root[data-look="glass"]:not([data-theme="green"]) .settings-pane { background: var(--lk-panel); }
}
/* Frosted layers that content scrolls under: the phone's top, its tab bar and the composer. */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  :root[data-look="glass"]:not([data-theme="green"]) :is(.mobile-nav, .compose) { background: color-mix(in srgb, var(--surface) 72%, transparent); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); }
  @media (max-width: 700px) {
    :root[data-look="glass"]:not([data-theme="green"]) :is(.sidebar-head, .chat-head) { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom-color: transparent; }
    :root[data-look="glass"]:not([data-theme="green"]) .mobile-nav { border-color: var(--lk-glass-line); box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 10px 30px rgba(30, 50, 60, .16); }
    :root[data-look="glass"][data-theme="dark"] .mobile-nav { box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 10px 30px rgba(0, 0, 0, .45); }
  }
}
@media (prefers-reduced-transparency: reduce) {
  :root[data-look="glass"] :is(.mobile-nav, .compose, .sidebar-head, .chat-head, .suite-bar, .app-rail) { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ── CONTRAST ──────────────────────────────────────────────────────────── */
:root[data-look="contrast"] :is(h1, h2, h3, .room-top strong) { font-weight: 700; }
:root[data-look="contrast"]:not([data-theme="green"]) :is(.room-row.is-selected, .group-card, .team-card, .mobile-nav, .compose, .tabs, .date-divider, .settings-detail .theme-choice:has(input:checked)) { border: 1.5px solid var(--lk-line); }
:root[data-look="contrast"]:not([data-theme="green"]) .room-row.is-selected { box-shadow: none; }
:root[data-look="contrast"]:not([data-theme="green"]) .bubble:not(.message.is-mine .bubble) { box-shadow: inset 0 0 0 1.5px var(--lk-line); }
:root[data-look="contrast"]:not([data-theme="green"]) .tabs .is-active { background: var(--button-green); color: var(--on-ink); box-shadow: none; }
:root[data-look="contrast"]:not([data-theme="green"]) .tabs .is-active .tab-count { background: var(--on-ink); color: var(--button-green); }
:root[data-look="contrast"]:not([data-theme="green"]) .nav-pill { background: var(--button-green); }
:root[data-look="contrast"]:not([data-theme="green"]) .mobile-nav.pill-on button.is-active { color: var(--on-ink); }
:root[data-look="contrast"]:not([data-theme="green"]) .mobile-nav button { color: var(--quiet); }
:root[data-look="contrast"]:not([data-theme="green"]) :is(.avatar:not(:has(img)), .symbol.is-initials:not(.has-photo)) { background: var(--lk-ini-bg); color: var(--lk-ini-ink); box-shadow: none; }
:root[data-look="contrast"]:not([data-theme="green"]) :is(.unread, .tab-count, .nav-unread) { box-shadow: 0 0 0 1.5px var(--surface); }
:root[data-look="contrast"] :is(.primary, .confirm-primary, .signout-button) { font-weight: 700; }

/* ── TERMINAL ──────────────────────────────────────────────────────────── */
:root[data-look="terminal"] body { font-size: 14px; }
:root[data-look="terminal"]:not([data-theme="green"]) :is(.room-row.is-selected, .group-card, .team-card, .mobile-nav, .compose, .tabs, .date-divider) { border: 1px dashed var(--lk-line); box-shadow: none; }
:root[data-look="terminal"]:not([data-theme="green"]) .bubble:not(.message.is-mine .bubble) { box-shadow: inset 0 0 0 1px var(--lk-line); }
:root[data-look="terminal"] :is(.top-new, .suite-new, .settings-header button, .nav-pill, .room-row, .group-card, .team-card, .mobile-nav, .mobile-nav button, .compose, .tabs, .tabs button, .bubble, .date-divider, .avatar, .symbol, .room-symbol, .avatar-button,
  .top-search, .head-button, .send, .unread, .tab-count, .nav-unread, .theme-choice, .bg-choice, .lk-sw, .reaction-chip, .search, .primary, .confirm-primary, .signout-button) { border-radius: 2px !important; }
:root[data-look="terminal"] :is(.primary, .confirm-primary, .signout-button) { text-transform: lowercase; }
:root[data-look="terminal"]:not([data-theme="green"]) :is(.avatar:not(:has(img)), .symbol.is-initials:not(.has-photo)) { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--lk-line); }
:root[data-look="terminal"]:not([data-theme="green"]) .tabs .is-active { background: var(--soft); box-shadow: inset 0 0 0 1px var(--green); }
:root[data-look="terminal"]:not([data-theme="green"]) .nav-pill { box-shadow: inset 0 0 0 1px var(--green); }
/* Prompts: "> " before the page and chat titles. */
:root[data-look="terminal"] :is(.inbox-heading h2, .chat-head h1, .settings-header h2):not(:empty)::before { content: '> '; color: var(--quiet); }
:root[data-look="terminal"][data-theme="dark"] .message.is-mine .bubble { background: #173a26; color: #c9f2d4; box-shadow: inset 0 0 0 1px #2f6a46; }

/* ── BOLD ──────────────────────────────────────────────────────────────── */
:root[data-look="bold"] :is(h1, h2, h3) { font-weight: 700; letter-spacing: -.01em; }
/* The dark tab bar; the current tab filled. */
:root[data-look="bold"] .mobile-nav { background: var(--lk-fill); border-color: var(--lk-fill-line); }
:root[data-look="bold"] .mobile-nav button { color: #b9c1bd; }
:root[data-look="bold"] .nav-pill { background: var(--lk-fill-acc); }
:root[data-look="bold"] .mobile-nav.pill-on button.is-active { color: var(--lk-fill); }
:root[data-look="bold"] .mobile-nav .nav-unread { box-shadow: 0 0 0 2px var(--lk-fill); }
:root[data-look="bold"] .tabs .is-active { background: var(--lk-fill, var(--ink)); color: #ffffff; }
:root[data-look="bold"] .tabs .is-active .tab-count { background: var(--lk-fill-acc); color: var(--lk-fill); }
/* Filled initials, a little squarer. */
:root[data-look="bold"]:not([data-theme="green"]) :is(.avatar:not(:has(img)), .symbol.is-initials:not(.has-photo)) { box-shadow: none; }
:root[data-look="bold"] :is(.avatar, .symbol, .avatar img, .symbol img) { border-radius: 28%; }
:root[data-look="bold"] :is(.primary, .confirm-primary) { font-weight: 700; }

/* ======================================================================================================================
   BACKGROUNDS (Aidan 11/26; ids, keys and veil numbers as in My Cairn, Operations and Recruit): a picture behind the page in any look
   but Contrast, picked under the looks. data-bg on <html> (none: no picture, and nothing below applies) with data-bg-tone beside it.
   The app leaves data-bg off under Green and while the device asks for reduced transparency. The pictures are backgrounds/<id>.jpg
   beside the page and load only when picked. Screen only: nothing prints.
   ====================================================================================================================== */
@media screen {
  :root[data-bg="silk"] { --bg-img: url('/backgrounds/silk.jpg'); }
  :root[data-bg="sage"] { --bg-img: url('/backgrounds/sage.jpg'); }
  :root[data-bg="pastel"] { --bg-img: url('/backgrounds/pastel.jpg'); }
  :root[data-bg="dunes"] { --bg-img: url('/backgrounds/dunes.jpg'); }
  :root[data-bg="lake"] { --bg-img: url('/backgrounds/lake.jpg'); }
  :root[data-bg="hills"] { --bg-img: url('/backgrounds/hills.jpg'); }
  :root[data-bg="aurora"] { --bg-img: url('/backgrounds/aurora.jpg'); }
  :root[data-bg="velvet"] { --bg-img: url('/backgrounds/velvet.jpg'); }
  :root[data-bg="nebula"] { --bg-img: url('/backgrounds/nebula.jpg'); }
  /* A veil in the mode's own canvas colour: .40 when the picture's tone matches the mode, photos .50 light and .60 dark, .72 when they clash. */
  :root[data-bg] { --bg-a: .4; --bg-veil-rgb: rgb(246, 248, 248); --bg-veil: rgba(246, 248, 248, var(--bg-a)); }
  :root[data-bg][data-theme="dark"] { --bg-veil-rgb: rgb(12, 15, 18); --bg-veil: rgba(12, 15, 18, var(--bg-a)); }
  :root[data-bg][data-bg-tone="photo"] { --bg-a: .5; }
  :root[data-bg][data-bg-tone="photo"][data-theme="dark"] { --bg-a: .6; }
  :root[data-bg][data-bg-tone="light"][data-theme="dark"], :root[data-bg][data-bg-tone="dark"][data-theme="light"] { --bg-a: .72; }

  /* A still layer behind everything, end to end: from under the status bar to behind the home indicator. The page goes see-through. */
  /* Edge to edge (Aidan's iPhone, 11/27, as My Cairn): the page's own background is the plain page colour, never the raw picture (whose
     unveiled bottom colour Safari showed as a slate band under its toolbar); the still layer below runs 100lvh from the very top. */
  /* iOS 26 Safari (Aidan's iPhone, v73): Safari paints the strip under its toolbar itself, in the page's own background colour; the fixed
     layer stops above it. So the page's own background is the colour the veiled picture ends in at the bottom: each picture's bottom
     colour as a phone shows it (--bg-edge, measured across the centre crop), under the veil at the same strength. On the phone the layer
     fades into exactly that colour over its last 120px, so the strip continues the picture with no line. */
  :root[data-bg="silk"] { --bg-edge: #b89b83; } :root[data-bg="sage"] { --bg-edge: #abbca9; } :root[data-bg="pastel"] { --bg-edge: #d3e1ed; }
  :root[data-bg="dunes"] { --bg-edge: #4b3a39; } :root[data-bg="lake"] { --bg-edge: #6e8aa0; } :root[data-bg="hills"] { --bg-edge: #32391c; }
  :root[data-bg="aurora"] { --bg-edge: #091624; } :root[data-bg="velvet"] { --bg-edge: #18171a; } :root[data-bg="nebula"] { --bg-edge: #201a33; }
  :root[data-bg] { --bg-bottom: color-mix(in srgb, var(--bg-veil-rgb) calc(var(--bg-a) * 100%), var(--bg-edge));
    --bg-fade: linear-gradient(transparent calc(100% - 120px), var(--bg-bottom)); }
  :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) { background: var(--bg-bottom); }
  :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) body { background: transparent; }
  :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) body::after { content: ''; position: fixed; top: 0; right: 0; left: 0; height: 100vh; height: 100lvh; z-index: -1; pointer-events: none;
    background: linear-gradient(var(--bg-veil), var(--bg-veil)), var(--bg-img) center / cover no-repeat, linear-gradient(var(--pale-sunk), var(--pale-sunk)); }
  :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) :is(.app, .sidebar, .messages, .conversation, .app .conversation, .room-list, .settings-pane) { background: transparent; }
  @media (max-width: 700px) {
    :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) body::after { background: var(--bg-fade), linear-gradient(var(--bg-veil), var(--bg-veil)), var(--bg-img) center / cover no-repeat, linear-gradient(var(--pale-sunk), var(--pale-sunk)); }
    :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) .app .conversation { background: var(--bg-fade), linear-gradient(var(--bg-veil), var(--bg-veil)), var(--bg-img) center / cover no-repeat, var(--pale-sunk); }
  }

  /* On the picture: each chat row is a card (solid in Cairn, Terminal and Bold; frosted in Glass), so its text keeps its own shades.
     The bars over the picture (the phone's top, the chat's header, the composer, the tab bar) stay readable the same way. */
  :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) .room-row { background: var(--surface); box-shadow: var(--shadow-soft); }
  :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) .room-row.has-unread { background: var(--soft); }
  :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) .room-row.is-selected { background: linear-gradient(120deg, var(--soft), var(--selected-end)); }
  :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) :is(.date-divider, .tabs, .settings-detail) { background: var(--surface); }
  :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) .bubble { box-shadow: var(--shadow-soft); }
  :root[data-bg]:not([data-look="contrast"],[data-look="glass"]):not([data-theme="green"]) .bubble:not(.message.is-mine .bubble) { background: var(--surface); }
  /* The phone's top bars are see-through over the picture (no band, no colour step): nothing scrolls under them, and their buttons
     have their own surfaces. Their title is drawn like other text on the picture (below). */
  @media (max-width: 700px) {
    :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) :is(.sidebar-head, .chat-head) { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom-color: transparent; }
  }
  /* Text straight on the picture (page titles, section labels, names and times beside the bubbles) in full ink with a soft edge of the
     page's own colour around each letter, so it holds on the busiest part of any picture (seven layers, as measured for My Cairn). */
  :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) :is(.inbox-heading, .section-label, .message-name, .message-foot, .read-receipt, .load-older, .room-list > p, .ghost-msg, .start-conversation, .chat-head-copy) {
    --quiet: var(--text); --text-soft: var(--text); --bg-h: var(--pale-sunk);
    text-shadow: 0 0 1px var(--bg-h), 0 0 1px var(--bg-h), 0 0 2px var(--bg-h), 0 0 2px var(--bg-h), 0 0 3px var(--bg-h), 0 0 5px var(--bg-h), 0 0 10px var(--bg-h); }
  :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) :is(.inbox-heading, .message-foot) button { text-shadow: none; }

  /* Desktop: the frame stays solid (frosted in Glass); the panes show the picture between the cards. */
  @media (min-width: 701px) {
    :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) .app { background: transparent; }
    :root[data-bg]:not([data-look="contrast"],[data-look="glass"]):not([data-theme="green"]) :is(.suite-bar, .app-rail) { background: var(--lk-rail, var(--ink)); }
    :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) :is(.chat-head, .compose, .settings-header) { background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
    :root[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) .sidebar { border-right-color: transparent; }
  }

  /* Glass with a picture: heavier frost on the panels and bars, brighter plain buttons. */
  :root[data-bg][data-look="glass"] { --lk-panel: rgba(255, 255, 255, .62); --lk-panel-line: rgba(255, 255, 255, .85); --lk-glass: rgba(255, 255, 255, .85); }
  :root[data-bg][data-look="glass"][data-theme="dark"] { --lk-panel: rgba(22, 27, 31, .56); --lk-panel-line: rgba(255, 255, 255, .12); --lk-glass: rgba(255, 255, 255, .14); }
  :root[data-bg][data-look="glass"]:not([data-theme="green"]) .room-row { background: var(--lk-panel); box-shadow: var(--lk-shadow); }
  @supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    :root[data-bg][data-look="glass"]:not([data-theme="green"]) :is(.room-row, .bubble:not(.message.is-mine .bubble), .date-divider, .settings-detail) { -webkit-backdrop-filter: blur(28px) saturate(150%); backdrop-filter: blur(28px) saturate(150%); }
    :root[data-bg][data-look="glass"]:not([data-theme="green"]) :is(.mobile-nav, .compose) { -webkit-backdrop-filter: blur(28px) saturate(150%); backdrop-filter: blur(28px) saturate(150%); }
  }
}
@media (prefers-reduced-transparency: reduce) {
  :root[data-bg] body::after { display: none; }
}

/* Edge to edge on the Home Screen (11/27): over a wash or a picture no solid strip is drawn under the clock; the wash or picture runs
   under it, and the frosted top bar (which starts under the clock) holds the clock's edge. */
html.standalone[data-look="glass"]:not([data-theme="green"]) body::before,
html.standalone[data-bg]:not([data-look="contrast"]):not([data-theme="green"]) body::before { display: none; }

/* Ghost pages in looks whose cards are the page's own colour: the outline is the look's own line (dashed in Terminal). */
:root[data-look="terminal"]:not([data-theme="green"]) .ghost-row { border: 1px dashed var(--lk-line); border-radius: 2px; }
:root[data-look="contrast"]:not([data-theme="green"]) .ghost-row { border: 1px solid var(--line); }
:root:is([data-look="terminal"], [data-look="contrast"]):not([data-theme="green"]) :is(.ghost-dot, .ghost-bar) { background: var(--search-start); }
:root[data-look="terminal"] .ghost-dot { border-radius: 2px; }
