/* Hubris landing page. Type scale, radii and control shapes are the app's (crates/ui: typography.rs,
   radius, the control ladder); colour is theme.css, generated from its Tokens. */

:root {
  /* Motion. Built-in easings are too weak; these are the strong pair. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --d-enter: 520ms;
  --d-exit: 300ms;
  --d-card: 560ms;
  --d-control: 160ms;
  --d-tint: 260ms;

  --gutter: 16px;
  /* The page's own column: the header and the shot share it. */
  /* On a big screen the column and the video in it grow; buttons and words keep their size. */
  --page: clamp(1192px, 78vw, 1520px);
  /* 28px content + a 16px gutter on all four sides. */
  --bar-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }


html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  /* The cursor and ink layers fill the document through inset: 0. */
  position: relative;
  margin: 0;
  font-family: var(--font-sans);
  font-optical-sizing: auto;
  font-feature-settings: 'cv11';
  font-size: var(--text-paragraph-sm);
  line-height: 20px;
  letter-spacing: -0.006em;
  color: var(--text-primary);
  background: var(--surface-app);
  -webkit-font-smoothing: antialiased;
}
/* The section's halo reaches past the window's sides on a phone; clip, so the page never scrolls sideways. */
main { overflow-x: clip; }

/* The app's scrollbar (index.css): a transparent gutter and a 4px thumb, 6px on hover. */
::-webkit-scrollbar { width: 12px; height: 12px; background: transparent; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  background-clip: padding-box;
  border: 4px solid transparent;
  min-height: 32px;
}
::-webkit-scrollbar-thumb:hover { border-width: 3px; background-color: var(--scrollbar-thumb-hover); }
::-webkit-scrollbar-button { display: none; }

/* Re-tint on a theme change. Named properties only — never `all`. */
body, .bar, .mark, .cta {
  transition:
    background-color var(--d-tint) var(--ease-out),
    border-color var(--d-tint) var(--ease-out),
    color var(--d-tint) var(--ease-out);
}

/* ── Header: one centred mark, nothing else ── */

/* The bar: the mark and the name at the left, the actions at the right, on the page's column at its top. It scrolls
   away with the page: nothing stays over the examples. */
.bar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--bar-h);
  padding-inline: max(var(--gutter), calc((100% - var(--page)) / 2 + var(--gutter)));
}
/* The mark alone at the left, the actions at the right. */
.bar .mark { margin-right: auto; }


.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Square on the header action's own height, so the two chrome items match. */
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  /* Quiet at rest, full on hover: the brightening is the affordance. */
  opacity: 0.72;
  cursor: pointer;
  transition: opacity var(--d-control) var(--ease-out);
}

.mark svg {
  display: block;
  transition: transform 420ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .mark:hover { opacity: 1; }
}
.mark:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }

/* The `sm` rung (28): a header action sits below the hero's controls. */
/* .cta is defined later, so this needs to out-specify it, not just follow it. */
.cta:has(> .i) { padding: 0 12px; }
/* shadcn's sm: the header's and the footer's. */
.cta.bar-cta, .cta.compact { height: 32px; padding: 0 12px; gap: 6px; }
.cta.bar-cta:has(> .i), .cta.compact:has(> .i) { padding: 0 10px; }

/* ── Hero: one centred column, the product shot cropped by the fold ── */

.hero {
  /* Wide enough that the title keeps to two lines at its largest. */
  max-width: 1280px;
  margin: 0 auto;
  /* Shorter on a short window, so the panel under it always rises a third of the way into view. */
  padding: calc(var(--bar-h) + clamp(24px, 9vh - 5px, 110px)) var(--gutter) 0;
  text-align: center;
}

/* Close over the title, as its own kicker. */
.eyebrow { margin: 0 0 16px; }

/* The app's tag: a rounded pill one rung off the page, its words quiet. */
.pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-control);
  box-shadow: inset 0 0 0 1px var(--border-faint);
  color: var(--text-secondary);
  font-size: var(--text-label-sm);
  line-height: var(--text-label-sm--line-height);
  letter-spacing: var(--text-label-sm--letter-spacing);
  font-weight: 500;
}

.os-logo {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  margin-left: 6px;
}

.display {
  /* Two balanced lines at every size, whatever the column leaves it. */
  max-width: 15em;
  margin: 0 auto;
  /* Grows with the window: 64 at a tablet's width, 70 on a laptop, a little more on a big screen (about 90 at 2560);
     held by its height on a short window. Tight enough not to read wide. */
  font-size: clamp(32px, min(calc((100vw - 2 * var(--gutter)) / 11), calc(48px + 2vw), 8.6vh), calc(70px + max(0px, 100vw - 1440px) * 0.018));
  line-height: 1.06;
  letter-spacing: -0.034em;
  font-weight: 600;
  color: var(--text-primary);
  text-wrap: balance;
}

.lede {
  margin: 16px auto 0;
  max-width: 34em;
  font-size: clamp(18px, calc(14px + 0.25vw), 21px);
  line-height: 1.55;
  letter-spacing: var(--text-paragraph-lg--letter-spacing);
  color: var(--text-tertiary);
  text-wrap: balance;
}

/* ── CTAs. Buy and Trial paint with the HTML, always — the bridge never gates them. ── */

.cta-cluster {
  margin-top: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* The app's Medium control: 36 tall, rounded-md, label-sm, no stroke; a standing one one rung off the page. */
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface-control);
  box-shadow: inset 0 0 0 1px var(--border-subtle), 0 1px 2px rgb(0 0 0 / 0.05);
  color: var(--text-primary);
  font-size: var(--text-label-sm);
  font-weight: 500;
  letter-spacing: var(--text-label-sm--letter-spacing);
  text-decoration: none;
  white-space: nowrap;
  gap: 8px;
  transition:
    background-color var(--d-control) var(--ease-out),
    color var(--d-control) var(--ease-out),
    box-shadow var(--d-control) var(--ease-out),
    transform var(--d-control) var(--ease-out);
}

.cta.primary {
  background: var(--accent-primary);
  color: var(--text-on-accent);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

@media (hover: hover) and (pointer: fine) {
  .cta:hover { background: var(--surface-control-hover); }
  .cta.primary:hover { box-shadow: 0 1px 2px rgb(0 0 0 / 0.05); }
  .cta.primary:hover { background: var(--accent-primary-hover); color: var(--text-on-accent); }
}
.cta:active { transform: scale(0.98); }
.cta:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }

/* An author `display` beats [hidden] — the attribute alone leaves these painted. */
.cta[hidden] { display: none; }

/* The tooltip: a raised surface in the theme, edged and lifted, rounded-md, px-3 py-1.5, text-xs; it fades and
   zooms in from 95% after a beat, centred over its button. */
.tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  translate: -50% 2px;
  scale: 0.95;
  transform-origin: 50% 100%;
  width: max-content;
  max-width: 260px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px var(--border-subtle), 0 4px 16px -4px var(--shadow-color);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0;
  font-weight: 400;
  text-align: center;
  text-wrap: balance;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms var(--ease-out), translate 150ms var(--ease-out), scale 150ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .cta:hover .tip { opacity: 1; translate: -50% 0; scale: 1; transition-delay: 120ms; }
}
.cta:focus-visible .tip { opacity: 1; translate: -50% 0; scale: 1; }

/* The download (download.js): the visitor's OS on the button, the chevron beside it opens the other builds. */
.split { display: inline-flex; }
.split > .cta:first-child { border-start-end-radius: 0; border-end-end-radius: 0; }
.split > .cta.split-more {
  padding: 0;
  aspect-ratio: 1;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
  /* A groove a shade under the accent, not a highlight. */
  box-shadow: inset 1px 0 0 color-mix(in oklab, var(--accent-primary), black 22%);
}
.split > .cta:active { transform: none; }

/* The app's menu (crates/ui menu.rs, popover.rs): the overlay surface in a --border-default edge, rounded 8, its
   rows 4 in, shadcn's shadow-md; 150ms in, fading and zooming from 95%, the last 8px of a slide out of the button. */
.dl-menu {
  inset: auto;
  margin: 0;
  min-width: 224px;
  padding: 4px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-overlay);
  box-shadow: 0 4px 6px -1px var(--shadow-color), 0 2px 4px -2px var(--shadow-color);
  color: var(--text-primary);
  transform-origin: top right;
  transition: opacity 150ms ease, scale 150ms ease, translate 150ms ease, display 150ms allow-discrete, overlay 150ms allow-discrete;
}
.foot .dl-menu { transform-origin: bottom left; }
.dl-menu:not(:popover-open) { opacity: 0; scale: 0.95; }
@starting-style {
  .dl-menu:popover-open { opacity: 0; scale: 0.95; translate: 0 -8px; }
  .foot .dl-menu:popover-open { translate: 0 8px; }
}
/* A menu row: 32 tall, 8 in and 12 at its end, paragraph-sm in the primary ink, its icon tertiary; the size as a
   menu's count (paragraph-xs, muted, tabular). Hover = the app's neutral hover wash, nothing else lit. */
.dl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px 0 8px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--text-paragraph-sm);
  line-height: var(--text-paragraph-sm--line-height);
  letter-spacing: var(--text-paragraph-sm--letter-spacing);
  font-weight: 400;
  white-space: nowrap;
  transition: background-color var(--d-control) var(--ease-out);
}
.dl-item .os-logo { width: 16px; height: 16px; margin: 0; flex: none; color: var(--text-tertiary); }
.dl-item small { margin-left: auto; padding-left: 16px; color: var(--text-muted); font-size: var(--text-paragraph-xs); line-height: var(--text-paragraph-xs--line-height); font-variant-numeric: tabular-nums; }
.dl-item:hover, .dl-item:focus-visible { background: var(--surface-hover); outline: none; }
.dl-item:hover .os-logo, .dl-item:focus-visible .os-logo { color: var(--text-primary); }

/* currentColor so it reads right on either button, filled or standing. */
.was { color: currentColor; opacity: 0.5; }

/* Yard marks <html> for owners before the page paints: they lose Buy/Trial and get Gift and Library. Unmarked (anyone
   else, or a bridge that never answers), the owners' buttons stay hidden and Buy/Trial stay exactly where they are. */
html[data-yard-owned] [data-owned-hide] { display: none; }
html:not([data-yard-owned]) [data-yard-when="owned"] { display: none !important; }

/* ── Reduced motion: keep the state changes, drop the travel ── */

@media (prefers-reduced-motion: reduce) {
  :root { --d-enter: 200ms; --d-exit: 160ms; --d-card: 200ms; }
  .mark svg { transform: none !important; }
  .shot { animation: none; }
  .tip { translate: -50% 0; scale: 1; }
  .dl-menu { scale: 1 !important; translate: none !important; }
  .cta:active { transform: none; }
}

@media (max-width: 640px) {
  .hero { padding-top: calc(var(--bar-h) + 48px); }
  /* Stacked and centred, not full-bleed. */
  .cta-cluster { flex-direction: column; }
  .cta-cluster .cta { width: 100%; max-width: 280px; }
  .shot { margin-top: 48px; }
}

/* ── Live peers ── */

/* Absolute over the DOCUMENT, like the ink: a peer sits where they are in the
   page and scrolls with it, no per-scroll repositioning. Clipped to the
   document, so a plate at the edge never widens the page. */
.cursors {
  position: absolute;
  inset: 0;
  overflow: clip;
  z-index: 20;
  pointer-events: none;
}

.peer {
  /* Presence moves constantly; a short linear tween smooths the 16ms throttle
     without lagging behind the pointer. */
  transition: transform 40ms linear;
}
/* My own plate tracks the pointer directly: viewport coords, like the native cursor. */
.peer.me { position: fixed; transition: none; }
.peer.me[hidden] { display: none; }

/* components/cursor.js. Placed by transform from the layer's top-left. */
hb-cursor {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  pointer-events: none;
  will-change: transform;
}
/* Tip at (5,1), like the native one; a press pushes it in from the tip. */
hb-cursor svg { display: block; margin: -1px 0 0 -5px; transform-origin: 5px 1px; transition: transform 120ms var(--ease-out); }
hb-cursor[data-down] svg { transform: scale(0.85); }

/* Everyone's live ink. Absolute over the DOCUMENT, not fixed to the viewport,
   so it scrolls with the content it was drawn on. */
.live-ink {
  position: absolute;
  inset: 0;
  /* An svg is replaced: inset alone leaves it at 300x150. */
  width: 100%;
  height: 100%;
  z-index: 19;
  pointer-events: none;
  overflow: clip;
}

/* Highlighter ink: multiplies into a light page, screens onto a dark one, so
   the same hue reads as a marker in either scheme. */
.live-ink { mix-blend-mode: multiply; }
[data-scheme="dark"] .live-ink { mix-blend-mode: screen; }

/* While a stroke is in progress, nothing under the pointer should select. */
body.drawing { user-select: none; }
/* One pointer everywhere, as in the app. */
a, button { cursor: inherit; }

.hb-cursor-name {
  /* The app's tag (plugins/pointers ui.rs): off the arrow's tail at (10, 18), 20 tall, 6 either side, 4px
     corners, Inter medium 12, its ink white or near-black, whichever reads on the peer's colour.
     Absolute, since an inline box can't rise past its line's strut. */
  position: absolute;
  top: 18px;
  left: 10px;
  height: 20px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0;
  font-weight: 500;
  color: #fff;
  color: oklch(from var(--c) clamp(0.16, (0.72 - l) * 1000, 1) 0 0);
  background: var(--c);
  white-space: nowrap;
}
.hb-cursor-name:empty { display: none; }
/* The chat under the plate: closed (0 tall) until a scene's actor system fills it. */
.hb-cursor-chat { position: absolute; height: 0; overflow: clip; }

@media (prefers-reduced-motion: reduce) {
  .peer { transition: none; }
}

/* ── Product shot: the app, hand-built, on its own splash ──
   The panel is the app's splash picture (liquid.js glass), the window floats on it as the app's
   window does over the desktop, and the chapters under it say which example is playing. */

.shot {
  --chapters-gap: clamp(12px, 2.2vh, 20px);
  --fit-margin: clamp(12px, 2.4vh, 24px);
  margin: clamp(40px, 10vh - 2px, 120px) auto 96px;
  max-width: var(--page);
  padding: 0 var(--gutter);
  animation: shot-in 700ms var(--ease-out) 120ms both;
}

.panel {
  --pad-x: clamp(14px, 5.2vw, 64px);
  --pad-y: clamp(12px, 3vh, 32px);
  position: relative;
  isolation: isolate;
  padding: var(--pad-y) var(--pad-x) calc(var(--pad-y) + 8px);
  border-radius: 24px;
  overflow: hidden;
  /* Until the glass draws (or with no WebGL): the liquid's ramp, lit from the bottom left. */
  background:
    radial-gradient(120% 120% at 0% 100%, var(--liquid-4), var(--liquid-2) 34%, var(--liquid-1) 62%, var(--liquid-0));
}
/* The light the section throws on the page (liquid.js halo): a canvas reaching 240 past the panel each side (REACH). Screened
   on in dark, so it adds light; laid over in light. */
.panel-box { position: relative; isolation: isolate; }
.halo {
  position: absolute;
  top: -240px;
  left: -240px;
  z-index: -1;
  width: calc(100% + 480px);
  height: calc(100% + 480px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1200ms var(--ease-out);
}
.halo.on { opacity: 1; }
[data-scheme="dark"] .halo { mix-blend-mode: screen; }

.glass {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 900ms var(--ease-out);
}
.glass.on { opacity: 1; }

.window {
  position: relative;
  /* The section (panel and chapters) fits the viewport with --fit-margin above and below: the window is as wide as
     that leaves its 3:2 room for, after the panel's pads and the chapters. */
  width: min(100%, calc((100svh - 2 * var(--fit-margin) - 2 * var(--pad-y) - 8px - 32px - var(--chapters-gap)) * 1.5));
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* A tight, short shadow: the glass glows round it (liquid.js), so no deep drop to dull that. */
  box-shadow:
    0 1px 3px rgb(0 0 0 / 0.22),
    0 10px 28px -12px rgb(0 0 0 / 0.35);
}
/* Each child is flattened first, so the rounded clip antialiases one picture once. Clipping layer by layer, every
   background takes the corner's part-covered pixels again, which hardens the curve into stairs against the glow. */
.window > * { opacity: 0.999; }
/* The light edge, inside the clip: a ring outside it leaves a seam of glow between the two curves. */
.window::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14);
  pointer-events: none;
}
/* The window draws its own edge; the stage's and the clip's would double it. */
.window .stage, .window .shot-video, .window .app { border: 0; }

/* The still's 3:2 box, so a change of example never moves the page. Record clips at 3:2. */
.shot-video { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--surface-app); }
/* An author `display` beats [hidden]. */
.shot-video[hidden], .app[hidden] { display: none; }

.app {
  /* A desktop window, not a content-sized box: the screenshot is 1843x1249. */
  aspect-ratio: 3 / 2;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  --pane: var(--surface-canvas);
  background: var(--pane);
}

/* ── Chapters: tabs under the panel, a pill per example; the one playing fills as it plays (--p from app.js) ── */

/* One segmented control: a faint ground and edge, enough to read over the light the panel throws. */
.chapters {
  display: flex;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin: var(--chapters-gap) auto 0;
  padding: 4px;
  border-radius: 999px;
  overflow-x: auto;
  scrollbar-width: none;
  background: color-mix(in oklab, var(--surface-raised) 55%, transparent);
  box-shadow: inset 0 0 0 1px var(--border-faint);
}
.chapters::-webkit-scrollbar { display: none; }
.chapter {
  position: relative;
  flex: none;
  height: 32px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  isolation: isolate;
  background: none;
  font: inherit;
  font-size: var(--text-label-sm);
  line-height: 32px;
  letter-spacing: var(--text-label-sm--letter-spacing);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--d-control) var(--ease-out), background-color var(--d-control) var(--ease-out);
}
/* The one playing: a standing control's pill, a lighter neutral growing across it as its example plays. */
.chapter[aria-current] { color: var(--text-primary); background: var(--surface-control-hover); }
.chapter-fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: color-mix(in oklab, var(--text-primary) 14%, transparent);
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  opacity: 0;
}
.chapter[aria-current] .chapter-fill { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .chapter:hover { color: var(--text-primary); }
}
.chapter:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
@media (max-width: 640px) {
  .panel { border-radius: 16px; }
  /* Phones crop the scene to 4:5 (player.js): the window keeps the panel's width. */
  .window { width: 100%; }
  .chapter { height: 28px; padding: 0 10px; line-height: 28px; font-size: var(--text-label-xs); letter-spacing: 0; }
}

@keyframes shot-in {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: none; }
}

.app .i { flex: none; }

/* Title bar */

/* The strip carries the rule; the active tab breaks it by sitting 1px over. */
.tbar {
  flex: none;
  display: flex;
  align-items: stretch;
  height: 36px;
  background: var(--surface-app);
}
.tbar-l {
  display: flex;
  align-items: center;
  flex: none;
  gap: 6px;
  width: 224px;
  padding: 0 12px;
  color: var(--text-tertiary);
  border-right: 1px solid var(--border-default);
  height: 100%;
}

/* Chevron and panel toggle ride together at the cell's right edge. */
.tbar-r { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.tgl { display: inline-flex; }
.logo { display: inline-flex; color: var(--text-primary); }
/* TitleBar's own dots: 14px circles, #FF5F57 / #FFBD2E / #28C840. */
.lights { display: inline-flex; align-items: center; gap: 8px; }
.lights i { width: 11px; height: 11px; border-radius: 50%; background: var(--c); }

/* The rule lives under the TABS only — the sidebar column runs unbroken from
   the top of the window to the bottom. */
.tbar-t {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  flex: 1;
  /* An inset shadow, not a border: it paints under the children, so the active
     tab's own fill covers it and the rule breaks where the tab sits. */
  box-shadow: inset 0 -1px 0 0 var(--border-default);
}

.tb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 12px;
  font-size: var(--text-paragraph-sm);
  line-height: 1;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* TabItem: the active tab fills with the canvas and is ruled on three sides —
   no bottom rule, so it reads as continuous with the pane below it. */
.tb.on {
  position: relative;
  z-index: 1;
  color: var(--text-primary);
  background: var(--pane);
  box-shadow:
    inset 0 1px 0 0 var(--border-default),
    inset 1px 0 0 0 var(--border-default),
    inset -1px 0 0 0 var(--border-default);
}

/* TabItem: `flushLeft && index === 0` drops the left inset, or it doubles with
   the edge already sitting there. */
.tbar-t .tb.on:first-child {
  box-shadow:
    inset 0 1px 0 0 var(--border-default),
    inset -1px 0 0 0 var(--border-default);
}
.tb.plus { padding: 0 8px; }

/* Sidebar */

.abody { display: grid; grid-template-columns: 224px 1fr; flex: 1; min-height: 0; }

/* AppSidebar: bg-surface-app, border-r border-border-default. */
.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 12px 12px;
  background: var(--surface-app);
  border-right: 1px solid var(--border-default);
}

.ws {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  margin-bottom: 12px;
  border: 1px solid var(--border-rest);
  background: var(--surface-control-dim);
  font-size: var(--text-paragraph-sm);
  color: var(--text-secondary);
}

.ws span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* SectionLabel: label, a rule that fills the gap, then the trailing control. */
.slabel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  color: var(--text-tertiary);
}

.sl-t {
  flex: none;
  font-size: var(--text-subheading-2xs);
  line-height: var(--text-subheading-2xs--line-height);
  letter-spacing: var(--text-subheading-2xs--letter-spacing);
  font-weight: var(--text-subheading-2xs--font-weight);
  text-transform: uppercase;
}

.sl-rule { flex: 1; height: 1px; background: var(--border-subtle); }

.fr {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding-right: 6px;
  padding-left: calc(6px + var(--d, 0) * 18px);
  font-size: var(--text-paragraph-sm);
  color: var(--text-secondary);
}

.fr .i { color: var(--text-tertiary); }
.fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Counts take the app's count treatment: paragraph-xs, mono, tabular. */
.fc {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: var(--text-paragraph-xs);
  color: var(--text-tertiary);
}
/* Pinned to the bottom of the column, as in the app. */
.sfoot { margin-top: auto; }

/* Home */

/* No left rule here — the sidebar owns that edge. */
.home { min-width: 0; }

/* LibraryContent's header: max-w-[1200px] mx-auto pt-16 pb-9 px-16. */
.hwrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 64px 36px;
}

.hmeta { font-size: var(--text-paragraph-sm); color: var(--text-tertiary); }

/* title-h5: 24/28/-0.01em/500, what LibraryContent uses. */
/* LibraryContent renders this as Heading size="h5". */
.htitle {
  margin-top: 2px;
  font-size: var(--text-title-h5);
  line-height: var(--text-title-h5--line-height);
  letter-spacing: var(--text-title-h5--letter-spacing);
  font-weight: var(--text-title-h5--font-weight);
  color: var(--text-primary);
}

.hbar { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.hbar-r { display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-rest);
  background: var(--surface-control-dim);
  font-size: var(--text-paragraph-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

.btn.ic { width: 32px; padding: 0; justify-content: center; }
.btn.on { background: var(--surface-control); color: var(--text-primary); }
.seg { display: inline-flex; }
.seg .btn { border-right-width: 0; }
.seg .btn:last-child { border-right-width: 1px; }
.caret { flex: none; color: var(--text-tertiary); }

/* HomeSectionHeader: h-8, baseline, gap-2.5; label-md over a mono count. */
.hsec { display: flex; align-items: baseline; gap: 10px; height: 32px; }
.hsec > span:first-child {
  font-size: var(--text-label-md);
  line-height: var(--text-label-md--line-height);
  letter-spacing: var(--text-label-md--letter-spacing);
  font-weight: var(--text-label-md--font-weight);
  color: var(--text-primary);
}
.hcount {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: var(--text-paragraph-xs);
  color: var(--text-tertiary);
}

/* The list region carries the same 1200/px-16 column as the header. */
.hlist {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 64px 64px;
}

/* minmax(0, 1fr): the nowrap chip row gives each card a wide min-content, and
   a bare 1fr would honour it and make the columns uneven. */
.vgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 10px; }

/* The preview is the canvas; everything below it sits on a wash so the card
   reads as two bands rather than one flat ground. */
.vc { border: 1px solid var(--border-subtle); background: var(--surface-card); }
/* Pulled back with the pane — the wash was balanced against the brighter
   canvas and reads heavy now that the ground has come down. */
.vt, .vg { background: color-mix(in oklab, var(--surface-control-dim) 55%, transparent); }
.vt { padding-top: 12px; }
.vg { padding-top: 12px; }

/* Your capture: 405 wide x 167 tall preview, so ~2.4:1 rather than a
   fixed height that goes tall as the column narrows. */
.vp {
  aspect-ratio: 12 / 5;
  background-color: var(--pane);
  background-image:
    linear-gradient(to right, var(--grid-ink) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-ink) 1px, transparent 1px);
  /* grid.ts uses GRID_ALPHA 0.3, but against a brighter base than
     border-subtle, so the multiplier does not carry over: 55% here. */
  --grid-ink: color-mix(in oklab, var(--border-subtle) 55%, transparent);
  /* The preview is a zoomed-out canvas, so the ruling scales down with it:
     ~9 cells across, as in the app. */
  background-size: 20px 20px;
}

.vt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 0; }
.vn { font-size: var(--text-paragraph-sm); font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vk { font-size: var(--text-paragraph-sm); color: var(--text-tertiary); }
.vc.dim .vn { color: var(--text-tertiary); font-weight: 400; }

/* One row: the rest collapse into a +N rather than wrapping the card taller. */
.vg { display: flex; flex-wrap: nowrap; gap: 8px; padding: 12px; min-width: 0; }

/* ui/TagPill: PILL_BOX is `h-7 px-2 pb-0.5 text-paragraph-sm font-sans
   leading-none`, and tagPillColors() mixes the tag colour — which defaults to
   the accent — by the theme's own --tag-* dials. */
.vchip {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  height: 28px;
  padding: 0 8px 2px;
  font-size: var(--text-paragraph-sm);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: color-mix(in srgb, var(--accent-primary) var(--tag-bg-mix), transparent);
  color: oklch(from var(--accent-primary)
    clamp(var(--tag-label-l-lo), l, var(--tag-label-l-hi))
    calc(c * var(--tag-label-c)) h);
}

/* The 'no folders' placeholder is not a tag. */
.vc.dim .vchip { background: var(--surface-inset); color: var(--text-tertiary); }
.vchip.more { flex: none; color: var(--text-tertiary); }

@media (max-width: 900px) {
  .side, .tbar-l { display: none; }
  .abody { grid-template-columns: 1fr; }
  .vgrid { grid-template-columns: repeat(2, 1fr); }
}

/* Phone: one column, the header keeps Search and New, one tab beside home. */
@media (max-width: 640px) {
  /* 3/2 at phone width is 229px tall: the header only. Tall enough for a card. */
  .app { aspect-ratio: auto; height: 520px; }
  .hwrap { padding: 28px 20px 20px; }
  .hlist { padding: 0 20px 20px; }
  .hbar-r > :not(:last-child) { display: none; }
  .tb:nth-child(3) { display: none; }
  .vgrid { grid-template-columns: 1fr; }
}


/* ── Footer ── */

.foot { position: relative; padding-top: 64px; overflow: hidden; }
.foot-top {
  position: relative;
  z-index: 1;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  /* The brand column holds its two buttons on one line. */
  grid-template-columns: minmax(288px, 1.6fr) repeat(3, 1fr);
  gap: 32px;
}
.foot-name {
  display: flex;
  /* The mark sits on the word's baseline: "Hubris" has no descenders, so their bottoms meet. */
  align-items: baseline;
  gap: 10px;
  font-size: var(--text-label-lg);
  line-height: var(--text-label-lg--line-height);
  letter-spacing: var(--text-label-lg--letter-spacing);
  font-weight: 500;
  color: var(--text-primary);
}
.foot-name { align-items: center; }
.foot-name svg { color: var(--text-primary); }
.foot-say { margin: 12px 0 24px; max-width: 34ch; color: var(--text-tertiary); }
.foot-social { display: flex; flex-wrap: wrap; gap: 6px; }
.foot-col h3 {
  margin: 2px 0 14px;
  font-size: var(--text-subheading-xs);
  line-height: var(--text-subheading-xs--line-height);
  letter-spacing: var(--text-subheading-xs--letter-spacing);
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.foot-col a {
  display: block;
  width: fit-content;
  padding: 5px 0;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--d-control) var(--ease-out);
}
.foot-col a:hover { color: var(--text-primary); }
.foot-base {
  position: relative;
  z-index: 1;
  max-width: var(--page);
  margin: 80px auto 0;
  padding: 0 var(--gutter);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--text-paragraph-xs);
  line-height: var(--text-paragraph-xs--line-height);
  color: var(--text-tertiary);
}
.foot-liquid {
  display: block;
  width: 100%;
  /* Risen behind the bottom rows: the base line and the columns' last links sit in its fade. */
  position: relative;
  z-index: 0;
  height: 260px;
  margin-top: -196px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 900ms var(--ease-out);
}
/* Subtle: a tint of the brand under the last rows, not a light. */
.foot-liquid.on { opacity: 0.5; }

@media (max-width: 640px) {
  .foot { padding-top: 40px; }
  .foot-top { grid-template-columns: repeat(3, 1fr); gap: 40px 16px; }
  .foot-brand { grid-column: 1 / -1; }
  .foot-base { flex-direction: column; }
  .foot-liquid { height: 180px; margin-top: -120px; }
}
