/* One Sun: the Figments design language for figments.dev (DESIGN.md, docs/design.html).
   The rooms live in shell/themes.ts; every origin links the generated themes.css before this file. */

/* Room tokens (colour, studio palette) come first from /assets/themes.css, generated from shell/themes.ts. */

:root {
  /* One sun at azimuth 225°, altitude 40°: every shadow falls down and to the right. */
  --sx: 0.843; --sy: 0.843;
  --font-ui: "Host Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Fragment Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --hair: 1px;
  --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-lg: 22px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px; --s9: 112px;
  --ease-settle: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-lift: cubic-bezier(0.3, 0.7, 0.2, 1);
  --t-tap: 120ms; --t-move: 220ms; --t-settle: 420ms; --t-light: 900ms;
  --gutter: clamp(16px, 4vw, 48px);
  --studio-limestone-line: color-mix(in oklab, var(--studio-limestone-stroke) 22%, transparent);
  --studio-cobalt-line: color-mix(in oklab, var(--studio-cobalt-stroke) 38%, transparent);
  --studio-vermilion-line: color-mix(in oklab, var(--studio-vermilion-stroke) 38%, transparent);
  --studio-sap-line: color-mix(in oklab, var(--studio-sap-stroke) 38%, transparent);
  --studio-ochre-line: color-mix(in oklab, var(--studio-ochre-stroke) 38%, transparent);
  --studio-iris-line: color-mix(in oklab, var(--studio-iris-stroke) 38%, transparent);
}
@media (min-resolution: 2dppx) { :root { --hair: 0.5px; } }

/* ---------- One-sun elevation: heights 0 / 1 / 3 / 8 / 18 ---------- */
.lift { --h: 3;
  box-shadow:
    inset 0 1px 0 var(--rim),
    calc(var(--sx) * var(--h) * 0.35px) calc(var(--sy) * var(--h) * 0.35px) calc(var(--h) * 0.6px + 0.5px) var(--shade-contact),
    calc(var(--sx) * var(--h) * 1.6px) calc(var(--sy) * var(--h) * 1.6px) calc(var(--h) * 2.6px) var(--shade-cast);
}
.lift-1 { --h: 1; } .lift-3 { --h: 3; } .lift-8 { --h: 8; } .lift-18 { --h: 18; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--stone) transparent; scrollbar-width: thin; }
body {
  margin: 0; min-height: 100vh; background: var(--ground); color: var(--ink);
  font: var(--w-body) var(--fs-body)/var(--prose-lh) var(--font-ui); font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background-color var(--t-settle) var(--ease-settle), color var(--t-settle) var(--ease-settle);
}
body::before { /* limestone grain: a material, not an ornament */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: var(--grain-o);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .33 0 0 0 0 .25 0 0 0 1.4 -.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, header, footer { position: relative; z-index: 1; }
::selection { background: var(--cobalt-tint); color: var(--ink); }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; border-radius: 4px; }
a { color: var(--cobalt); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--cobalt-hi); }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: var(--w-ui); letter-spacing: -0.02em; text-wrap: balance; }
code, kbd, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* A made thing's name (a board, a figment): upright Host Grotesk, the title weight, clean numerals. */
.made { font-weight: var(--w-title); letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.mlabel { font-family: var(--font-mono); font-size: var(--fs-caption); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.caption { font-size: var(--fs-secondary); line-height: 1.45; color: var(--ink-3); }
.err { font-size: var(--fs-secondary); line-height: 1.45; color: var(--vermilion-ink); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Mark & wordmark ---------- */
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 770; letter-spacing: -0.04em; font-size: 1.125rem; line-height: 1; }
.brand:hover { color: var(--ink); }
.brand svg { width: 22px; height: 22px; flex: none; }
/* Touch: the mark alone (phones drop the word) still takes a finger. */
@media (pointer: coarse) { .brand { min-width: 36px; min-height: 36px; } }
.stop { color: var(--vermilion); }

/* ---------- Buttons & controls ---------- */
/* Buttons and menus: shell/ui.css (/assets/ui.css), linked before this sheet. */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-md); background: var(--sunk); border: var(--hair) solid var(--line); }
.seg button { appearance: none; border: 0; background: transparent; color: var(--ink-2); height: 28px; padding: 0 12px; border-radius: var(--r-sm); font: var(--w-ui) var(--fs-secondary)/1 var(--font-ui); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background-color var(--t-move) var(--ease-settle), color var(--t-move); }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px var(--shade-contact), inset 0 1px 0 var(--rim); }
.seg button:hover:not([aria-pressed="true"]) { color: var(--ink); }
.input, .select {
  height: 36px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-control);
  background: var(--sunk); color: var(--ink); font: var(--w-body) var(--fs-ui)/1 var(--font-ui); min-width: 0;
}
.input::placeholder { color: var(--ink-3); }
.input:focus-visible, .select:focus-visible { outline: 2px solid var(--cobalt); outline-offset: -1px; }
.input[aria-invalid="true"] { border-color: var(--vermilion-ink); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font: var(--w-ui) var(--fs-caption)/1 var(--font-ui); background: var(--sunk); color: var(--ink-2); border: var(--hair) solid var(--line); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sap); flex: none; }

/* ---------- Sign-in and auth notices ---------- */
.auth { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; background: radial-gradient(90% 75% at 8% 0%, var(--sun-glow), transparent 72%); }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 20px var(--gutter); }
.auth-main { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--s6); align-items: center; width: min(1180px, 100%); margin: 0 auto; padding: var(--s6) var(--gutter) var(--s8); }
.auth-copy { display: grid; gap: var(--s4); justify-items: start; }
.lockup { display: flex; align-items: center; gap: 0.18em; font-size: clamp(3.2rem, 8.6vw, 5.6rem); line-height: 0.9; letter-spacing: -0.04em; font-weight: 770; }
.lockup svg { width: 0.86em; height: 0.86em; flex: none; }
.tagline { font-weight: var(--w-body); font-size: var(--fs-heading); letter-spacing: -0.028em; line-height: 1.1; color: var(--ink); text-wrap: balance; }
.auth-lead { max-width: 44ch; color: var(--ink-2); font-size: var(--fs-body); line-height: var(--prose-lh); text-wrap: pretty; }
.auth-copy .lockup + .tagline { margin-top: calc(var(--s2) * -1); }
.auth-actions .btn.primary { min-width: 168px; }
.auth-actions { display: grid; gap: 10px; justify-items: start; margin-top: var(--s3); }
.auth-foot { display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; padding: 18px var(--gutter) 24px; color: var(--ink-3); }
.notice { width: min(440px, 100%); padding: 28px; border-radius: var(--r-lg); background: var(--paper); border: var(--hair) solid var(--line); display: grid; gap: 12px; justify-items: start; --h: 8; }
.notice h1 { font-size: var(--fs-title); font-weight: var(--w-display); letter-spacing: -0.025em; line-height: 1.15; }
.notice p { color: var(--ink-2); }
.notice .btn { margin-top: 8px; }
.notice-main { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.notice-form { display: grid; gap: 12px; width: 100%; }
.notice .caption.warn { color: var(--ochre); }
/* A room-toned checkbox: the box is drawn from tokens, never the platform's control. */
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 32px; font: var(--w-body) var(--fs-ui)/1.3 var(--font-ui); color: var(--ink); cursor: pointer; }
.check input { appearance: none; -webkit-appearance: none; margin: 0; flex: none; width: 18px; height: 18px; border-radius: 5px; border: var(--hair) solid var(--line); background: var(--sunk); display: grid; place-content: center; cursor: pointer; }
.check input::before { content: ""; width: 10px; height: 10px; clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 38% 70%); background: var(--on-cobalt); transform: scale(0); transition: transform 120ms ease; }
.check input:checked { background: var(--cobalt); border-color: var(--cobalt); }
.check input:checked::before { transform: scale(1); }
.check input:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.sculpture { position: relative; aspect-ratio: 1 / 0.92; width: 100%; max-width: 520px; justify-self: center; }
.sculpture svg { position: relative; width: 100%; height: 100%; overflow: visible; display: block; }
.window-light { position: absolute; inset: -40% -30% -10% -20%; pointer-events: none; }
.window-light span { position: absolute; width: 34%; height: 70%; border-radius: 3px; background: var(--sun-glow); filter: blur(34px); transform: skewX(-18deg); }
.window-light span:first-child { left: 21.6%; top: 10.2%; }
.window-light span:last-child { left: 59.6%; top: 16.2%; }
@media (max-width: 860px) {
  .auth-main { grid-template-columns: 1fr; padding-top: 0; }
  .sculpture { max-width: 340px; order: -1; }
}

/* ---------- Gallery ---------- */
/* One centred column (1120 px) for the rail and the grid, so wide monitors get even margins, not a void. */
.toprail-wrap { position: sticky; top: 12px; z-index: 20; padding: 0 var(--gutter); margin-top: 12px; }
.toprail {
  width: min(1120px, 100%); margin: 0 auto; display: flex; align-items: center; gap: var(--s4);
  height: 56px; padding: 0 10px 0 18px; border-radius: var(--r-md); background: var(--raised-a);
  border: var(--hair) solid var(--line); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.toprail .tools { display: flex; align-items: center; gap: var(--s3); flex: none; margin-left: auto; }
.g-search { position: relative; flex: 1; max-width: 340px; min-width: 0; margin-left: var(--s3); }
.g-search .input { width: 100%; padding-left: 34px; padding-right: 36px; }
.g-search > svg { position: absolute; left: 11px; top: 10px; color: var(--ink-3); pointer-events: none; }
.g-search kbd { position: absolute; right: 8px; top: 8px; }
.g-search .input:focus + kbd, .g-search .input:not(:placeholder-shown) + kbd { display: none; }
.g-body { width: min(calc(1120px + 2 * var(--gutter)), 100%); margin: 0 auto; padding: 36px var(--gutter) 80px; }
.g-titlebar { display: flex; align-items: baseline; gap: var(--s3); margin: 0 0 var(--s5); flex-wrap: wrap; }
.g-titlebar h1 { font-size: var(--fs-heading); letter-spacing: -0.034em; line-height: 1.02; font-weight: var(--w-display); }
.count { font: var(--w-body) var(--fs-caption)/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(256px, 1fr)); gap: 20px; }

/* ---------- People: one avatar for the rail, the menu and Settings ---------- */
.uav {
  --tone-fill: var(--studio-cobalt-fill); --tone-ink: var(--studio-cobalt-ink); --tone-line: var(--studio-cobalt-line);
  position: relative; display: inline-grid; place-items: center; flex: none; overflow: hidden;
  width: 32px; height: 32px; border-radius: 50%; background: var(--tone-fill); color: var(--tone-ink);
  box-shadow: inset 0 0 0 1px var(--tone-line);
  font: var(--w-ui) var(--fs-caption)/1 var(--font-ui); letter-spacing: 0.02em; user-select: none;
}
.uav > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.uav.av-40 { width: 40px; height: 40px; font-size: var(--fs-ui); }
.uav.av-96 { width: 96px; height: 96px; font-size: var(--fs-heading); font-weight: var(--w-ui); letter-spacing: 0; }
.uav[data-tone="limestone"] { --tone-fill: var(--studio-limestone-fill); --tone-ink: var(--studio-limestone-ink); --tone-line: var(--studio-limestone-line); }
.uav[data-tone="vermilion"] { --tone-fill: var(--studio-vermilion-fill); --tone-ink: var(--studio-vermilion-ink); --tone-line: var(--studio-vermilion-line); }
.uav[data-tone="sap"] { --tone-fill: var(--studio-sap-fill); --tone-ink: var(--studio-sap-ink); --tone-line: var(--studio-sap-line); }
.uav[data-tone="ochre"] { --tone-fill: var(--studio-ochre-fill); --tone-ink: var(--studio-ochre-ink); --tone-line: var(--studio-ochre-line); }
.uav[data-tone="iris"] { --tone-fill: var(--studio-iris-fill); --tone-ink: var(--studio-iris-ink); --tone-line: var(--studio-iris-line); }

.acct-btn {
  appearance: none; border: 0; padding: 0; margin: 0 2px 0 0; background: transparent; border-radius: 50%; cursor: pointer; display: inline-flex;
  transition: box-shadow var(--t-move) var(--ease-settle);
}
.acct-btn:hover { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--line-strong); }
.acct-btn[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--cobalt); }
.acct-btn:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; border-radius: 50%; }

.menu.acct-menu { width: 300px; padding: 6px; }
.acct-id { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; }
.acct-who { min-width: 0; display: grid; gap: 3px; }
.acct-name { font: var(--w-ui) var(--fs-ui)/1.25 var(--font-ui); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-email { font: var(--w-body) var(--fs-caption)/1.3 var(--font-mono); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-group { display: grid; gap: var(--pop-gap); }
.acct-room .item { width: 100%; }
.acct-room-name { margin-left: auto; font: var(--w-body) var(--fs-caption)/1 var(--font-ui); color: var(--ink-3); }

/* ---------- Board cards ---------- */
.bcard {
  position: relative; border-radius: var(--r-lg); padding: 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; color: inherit; --h: 1;
  background: radial-gradient(140% 100% at 0% 0%, color-mix(in oklab, var(--sun-glow) 60%, transparent), transparent 64%), var(--paper);
  border: var(--hair) solid var(--line);
  transition: transform var(--t-move) var(--ease-settle), box-shadow var(--t-light) var(--ease-settle), border-color var(--t-move) var(--ease-settle);
}
.bcard:hover, .bcard:focus-within { transform: translateY(-3px); --h: 8; border-color: var(--line-warm); }
.bcard .thumb {
  position: relative; display: grid; text-decoration: none; place-items: center; aspect-ratio: 16 / 10; border-radius: var(--r-md); overflow: hidden; border: var(--hair) solid var(--line);
  /* The empty board: warm limestone with the One Sun dot grid, never a flat black frame. */
  background-color: color-mix(in oklab, var(--paper) 78%, var(--studio-ochre-fill));
  background-image: radial-gradient(80% 100% at 0% 0%, var(--sun-glow), transparent 72%), radial-gradient(circle, color-mix(in oklab, var(--studio-ochre-stroke) 40%, transparent) 1px, transparent 1.5px);
  background-size: 100% 100%, 16px 16px; background-position: 0 0, 8px 8px;
  transition: border-color var(--t-move) var(--ease-settle);
}
.bcard:hover .thumb, .bcard:focus-within .thumb { border-color: var(--line-warm); }
.bcard .thumb:focus-visible { outline-offset: 2px; border-radius: var(--r-md); }
.bcard .thumb .ph {
  max-width: 80%; padding: 0 var(--s3); text-align: center; color: var(--ink-2); text-decoration: none;
  font: var(--w-title) var(--fs-title)/1.15 var(--font-ui); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; opacity: 0.86;
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.bcard .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: var(--paper); }
/* Who is on the board right now ("2 here"); neutral, never a green "Live" tick. */
.bcard .here {
  position: absolute; left: 10px; top: 10px; z-index: 1; display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--r-pill);
  background: var(--paper); color: var(--ink-2); font: var(--w-ui) var(--fs-caption)/1 var(--font-ui); font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
}
/* Row 1: the title and its ⋯; row 2: role · figments, with the time held to the right. */
.bcard .row { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 10px 2px 0 8px; }
.bcard h3 { flex: 1; min-width: 0; font: var(--w-title) var(--fs-title)/1.25 var(--font-ui); letter-spacing: -0.015em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bcard h3[data-editable] { cursor: text; }
.bcard .menu-btn { width: 30px; height: 30px; margin-right: 2px; color: var(--ink-2); }
@media (pointer: coarse) { .bcard .menu-btn { width: 36px; height: 36px; } }
.bcard .sub { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 10px 6px 8px; font: var(--w-body) var(--fs-caption)/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); white-space: nowrap; }
.bcard .sub > * { flex: none; white-space: nowrap; }
.bcard .sub .figs::before { content: "·"; margin-right: 6px; color: var(--ink-3); }
.bcard .sub .when { margin-left: auto; padding-left: 8px; }
.bcard .rename { flex: 1; min-width: 0; height: 32px; margin-left: -9px; font: var(--w-title) var(--fs-title)/1 var(--font-ui); letter-spacing: -0.015em; }
.bcard > .err { margin: 6px 8px 4px; }
.role { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--r-pill); font: var(--w-ui) var(--fs-caption)/1 var(--font-ui); letter-spacing: 0.01em; flex: none; border: 1px solid var(--studio-ochre-line); background: var(--studio-ochre-fill); color: var(--studio-ochre-ink); }
.role.admin { background: var(--studio-cobalt-fill); color: var(--studio-cobalt-ink); border-color: var(--studio-cobalt-line); }
.role.editor { background: var(--studio-sap-fill); color: var(--studio-sap-ink); border-color: var(--studio-sap-line); }

.bcard.sk .thumb { background-image: none; background: var(--sunk); }
.sk-line { height: 14px; width: 62%; border-radius: 6px; background: var(--sunk); margin: 14px 0 0 8px; }
.sk-line.short { height: 10px; width: 38%; margin: 10px 0 10px 8px; }
@media (prefers-reduced-motion: no-preference) {
  .bcard.sk .thumb, .sk-line { animation: sk-pulse 1.6s var(--ease-settle) infinite alternate; }
}
@keyframes sk-pulse { from { opacity: 1; } to { opacity: .55; } }

.state { grid-column: 1 / -1; display: grid; justify-items: center; gap: 10px; text-align: center; padding: 64px 16px; border-radius: var(--r-lg); border: 1.5px dashed var(--line-strong); }
.state .glyph { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--studio-ochre-fill); border: 1px solid var(--studio-ochre-line); color: var(--studio-ochre-ink); margin-bottom: 4px; }
.state h3 { font-size: var(--fs-title); font-weight: var(--w-ui); }
.state p { color: var(--ink-2); max-width: 42ch; }
.state .btn { margin-top: 8px; }
.state.error .glyph { background: var(--studio-vermilion-fill); border-color: var(--studio-vermilion-line); color: var(--studio-vermilion-ink); }

/* ---------- Menus: ui.css's .menu; the board card's Open figment list ---------- */
.menu .figments { display: grid; gap: var(--pop-gap); max-width: 280px; }

/* ---------- Dialogs ---------- */
dialog.sheet {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: var(--hair) solid var(--line);
  border-radius: var(--r-lg); background: var(--raised); color: var(--ink); --h: 18; overflow: auto;
}
dialog.sheet.wide { width: min(580px, calc(100vw - 32px)); }
dialog.sheet::backdrop { background: var(--scrim); }
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation: sheet-in var(--t-settle) var(--ease-settle); }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.sheet-head { padding: 22px 22px 6px; display: grid; gap: 6px; }
.sheet-head h2 { font-size: var(--fs-title); letter-spacing: -0.02em; }
.sheet-head h2 em { font-style: normal; color: var(--ink-2); }
.sheet-head p { color: var(--ink-2); font-size: var(--fs-ui); }
.sheet-body { padding: 14px 22px 6px; display: grid; gap: 16px; }
.sheet-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }
.sheet-foot .start { margin-right: auto; }
.field { display: grid; gap: 6px; }
.field label { font: var(--w-ui) var(--fs-secondary)/1.2 var(--font-ui); color: var(--ink); }
.field label span { color: var(--ink-3); font-weight: var(--w-body); }
.field .input { width: 100%; }
.slug-preview { font: var(--w-body) var(--fs-caption)/1.4 var(--font-mono); color: var(--ink-3); overflow-wrap: anywhere; }
.slug-preview b { font-weight: var(--w-body); color: var(--ink); }
.slug-preview b.placeholder { color: var(--ink-3); }
.codeblock { margin: 0; padding: 14px 16px; border-radius: var(--r-md); background: var(--sunk); border: var(--hair) solid var(--line); font: var(--w-body) var(--fs-caption)/1.6 var(--font-mono); color: var(--ink); overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-note { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-secondary); color: var(--ink-2); }
.agent-note svg { color: var(--cobalt); margin-top: 2px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; max-width: calc(100vw - 32px);
  display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: var(--ground); font: var(--w-ui) var(--fs-secondary)/1.35 var(--font-ui); overflow-wrap: anywhere;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; --h: 8;
  transition: transform var(--t-settle) var(--ease-settle), opacity var(--t-move);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast[data-tone="error"] { background: var(--vermilion-ink); color: var(--on-cobalt); }

@media (max-width: 720px) {
  .toprail { gap: 8px; padding: 0 8px 0 12px; }
  .toprail .tools { gap: 8px; }
  .toprail .brand .word { display: none; }
  .toprail .btn .lbl { display: none; }
  .toprail .btn:not(.icon) { width: 36px; padding: 0; }
  .g-search { margin-left: 0; }
  .g-search kbd { display: none; }
  /* No "/" hint here, so the field gives its room back to the placeholder (never "Filter boa"). */
  .g-search .input { padding-left: 30px; padding-right: 8px; }
  .g-search > svg { left: 9px; }
  .hide-sm { display: none !important; }
  .g-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- Sculpture (sign-in) ---------- */
.sc-cast { color: var(--sculpt-cast); } .sc-contact { color: var(--shade-contact); }
.sc-side { color: var(--stone-side); } .sc-base { color: var(--stone-face); }
.sc-lit { stop-color: var(--stone-lit); } .sc-dim { stop-color: var(--stone-face); }
.sc-top { stroke: var(--line-strong); stroke-width: 0.3; }

/* Empty gallery: the empty state's cobalt "Create board" is the only primary, so the toprail one steps aside. */
body.no-boards #btn-new { display: none; }

/* ---------- Settings: sidebar + panel on desktop, top tabs on a phone ---------- */
dialog.settings {
  width: min(1040px, calc(100vw - 32px)); height: min(720px, calc(100dvh - 48px)); max-width: none; max-height: none; padding: 0;
  border: var(--hair) solid var(--line); border-radius: var(--r-lg); background: var(--raised); color: var(--ink); --h: 18; overflow: hidden;
}
dialog.settings::backdrop { background: var(--scrim); }
@media (prefers-reduced-motion: no-preference) { dialog.settings[open] { animation: sheet-in var(--t-settle) var(--ease-settle); } }
.st-shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); height: 100%; }
.st-nav { display: flex; flex-direction: column; gap: var(--s3); padding: 22px 12px; background: var(--paper); border-right: var(--hair) solid var(--line); }
.st-title { padding: 0 10px 6px; font-size: var(--fs-title); font-weight: var(--w-display); letter-spacing: -0.025em; }
.st-tabs { display: grid; gap: 2px; }
.st-tab-short { display: none; }
.st-tab {
  appearance: none; border: 0; background: transparent; color: var(--ink-2); display: flex; align-items: center; gap: 10px; width: 100%;
  height: 36px; padding: 0 10px; border-radius: var(--r-sm); font: var(--w-body) var(--fs-ui)/1 var(--font-ui); text-align: left; cursor: pointer; white-space: nowrap;
  transition: background-color var(--t-tap) ease, color var(--t-tap) ease;
}
.st-tab:hover { background: var(--hover); color: var(--ink); }
.st-tab[aria-selected="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px var(--shade-contact), inset 0 0 0 1px var(--line); }
.st-tab[aria-selected="true"] svg { color: var(--cobalt); }
.st-tab:focus-visible { outline: 2px solid var(--cobalt); outline-offset: -2px; }
.st-main { position: relative; min-width: 0; overflow-y: auto; padding: 28px 36px 36px; }
.st-close { position: absolute; top: 14px; right: 14px; }
.st-head { display: grid; gap: 6px; padding-right: 40px; margin-bottom: var(--s5); }
.st-head h3 { font-size: var(--fs-title); font-weight: var(--w-display); letter-spacing: -0.028em; line-height: 1.15; }
.st-head p { color: var(--ink-2); font-size: var(--fs-ui); max-width: 52ch; }
.st-label { font: var(--w-ui) var(--fs-secondary)/1.2 var(--font-ui); color: var(--ink); }
.st-field { display: grid; gap: 8px; margin-top: var(--s5); }
.st-avatar-row { display: flex; align-items: center; gap: var(--s5); padding: var(--s4) var(--s5) var(--s4) var(--s4); border-radius: var(--r-md); background: var(--paper); border: var(--hair) solid var(--line); }
.st-avatar-copy { display: grid; gap: 6px; min-width: 0; }
.st-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.st-drop { appearance: none; position: relative; border: 0; padding: 0; background: transparent; border-radius: 50%; cursor: pointer; flex: none; display: inline-flex; }
.st-drop:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; border-radius: 50%; }
.st-drop-hint {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-content: center; justify-items: center; gap: 4px;
  /* 72% keeps the 12 px label at 4.5:1 or better over any photo, white included, in every room. */
  background: color-mix(in oklab, var(--ink) 72%, transparent); color: var(--ground); font: var(--w-ui) var(--fs-caption)/1 var(--font-ui);
  opacity: 0; transition: opacity var(--t-move) var(--ease-settle);
}
.st-drop:hover .st-drop-hint, .st-drop.dragover .st-drop-hint, .st-drop[aria-busy="true"] .st-drop-hint { opacity: 1; }
.st-drop.dragover { box-shadow: 0 0 0 3px var(--raised), 0 0 0 5px var(--cobalt); }
.st-tones { display: flex; gap: 10px; flex-wrap: wrap; }
.st-tone { appearance: none; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; display: grid; place-items: center; }
.st-tone span { width: 26px; height: 26px; border-radius: 50%; background: var(--studio-cobalt-fill); box-shadow: inset 0 0 0 1.5px var(--studio-cobalt-stroke); }
.st-tone[data-tone="limestone"] span { background: var(--studio-limestone-fill); box-shadow: inset 0 0 0 1.5px var(--studio-limestone-line); }
.st-tone[data-tone="vermilion"] span { background: var(--studio-vermilion-fill); box-shadow: inset 0 0 0 1.5px var(--studio-vermilion-stroke); }
.st-tone[data-tone="sap"] span { background: var(--studio-sap-fill); box-shadow: inset 0 0 0 1.5px var(--studio-sap-stroke); }
.st-tone[data-tone="ochre"] span { background: var(--studio-ochre-fill); box-shadow: inset 0 0 0 1.5px var(--studio-ochre-stroke); }
.st-tone[data-tone="iris"] span { background: var(--studio-iris-fill); box-shadow: inset 0 0 0 1.5px var(--studio-iris-stroke); }
.st-tone[aria-checked="true"] { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--ink); }
.st-tone:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 4px; border-radius: 50%; }
@media (pointer: coarse) { .st-tone { width: 32px; height: 32px; } }
.st-profile-form { display: grid; gap: 14px; max-width: 440px; margin-top: var(--s5); }
.st-profile-form .st-field { margin-top: 0; }
.st-profile-form .st-actions { align-items: center; margin-top: 0; }
.st-inline { display: flex; gap: 8px; }
.st-inline .input { flex: 1; min-width: 0; }
.st-inline #st-status-emoji { flex: 0 0 4.5rem; text-align: center; }
.st-inline .btn { flex-shrink: 0; }
.st-email { font-size: var(--fs-secondary); color: var(--ink-2); overflow-wrap: anywhere; }
.st-host { min-width: 0; }
.st-rooms { max-width: 600px; }
@media (max-width: 720px) {
  dialog.settings { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .st-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  /* A "Settings" header level with the close button, then the five tabs on one row, short labels only. */
  .st-nav { gap: 8px; padding: 11px 12px 10px; border-right: 0; border-bottom: var(--hair) solid var(--line); }
  .st-title { display: flex; align-items: center; min-height: 36px; padding: 0 56px 0 4px; }
  .st-tabs { display: flex; flex-wrap: nowrap; gap: 4px; min-width: 0; }
  .st-tab { flex: 1 1 auto; justify-content: center; width: auto; min-width: 0; height: 40px; padding: 0 6px; white-space: nowrap; }
  .st-tab:has(.st-tab-short) .st-tab-long { display: none; }
  .st-tab-short { display: inline; }
  .st-tab svg { display: none; }
  .st-main { padding: 22px 16px 32px; }
  .st-close { position: fixed; top: 11px; right: 10px; z-index: 1; }
  .st-avatar-row { flex-direction: column; align-items: flex-start; }
  .st-rooms { grid-template-columns: minmax(0, 1fr); }
}

/* Install Figments (app.js): the browser's steps when it has no install prompt to offer. */
.install-steps p { margin: 0; color: var(--ink-2); font-size: var(--fs-secondary); line-height: 1.45; }
.install-steps ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; font-size: var(--fs-secondary); color: var(--ink); }
.install-steps li::marker { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* The installed gallery with its window controls overlaid (Chromium desktop). watchTitlebar
   (shell/pwa_install.ts) sets html[data-wco]: "inline" puts the top rail inside the title-bar strip,
   its empty middle dragging the window; "below" lays a bare draggable strip there and starts the page
   under it. Controls never drag. */
.wco-drag { display: none; }
@media (display-mode: window-controls-overlay) {
  :root { --wco-x: env(titlebar-area-x, 0px); --wco-y: env(titlebar-area-y, 0px); --wco-w: env(titlebar-area-width, 100%); --wco-h: env(titlebar-area-height, 33px); }
  :root[data-wco="below"] .wco-drag {
    display: block; position: fixed; z-index: 30; left: var(--wco-x); top: var(--wco-y); width: var(--wco-w); height: var(--wco-h);
    background: var(--ground); app-region: drag; -webkit-app-region: drag;
  }
  :root[data-wco="below"] body { padding-top: calc(var(--wco-y) + var(--wco-h)); }
  :root[data-wco="below"] .toprail-wrap { top: calc(var(--wco-y) + var(--wco-h) + 12px); }
  :root[data-wco="inline"] .toprail-wrap {
    top: calc(var(--wco-y) + (var(--wco-h) - 56px) / 2); margin-top: calc(var(--wco-y) + (var(--wco-h) - 56px) / 2);
    margin-left: var(--wco-x); width: var(--wco-w); box-sizing: border-box;
  }
  :root[data-wco="inline"] .toprail { app-region: drag; -webkit-app-region: drag; }
  :root[data-wco] :is(.toprail a, .toprail button, .toprail input, .toprail select, .toprail [popover], dialog) { app-region: no-drag; -webkit-app-region: no-drag; }
}
