/* ==========================================================================
   uling19.com — presentation layer, written as one system (2026-11-12).
   Replaces nine stacked stylesheets (~1.1 MB). The markup and scripts are the
   contract: every class and id the scripts read or toggle is styled here, and
   nothing here needs !important except where a script writes an inline style or
   runs an animation that must not show (see the pin on .slide.active).

   Material, three levels (never glass on glass on glass):
     pane   — the page panel. The only large surface with backdrop blur.
     card   — a lit sheet on the pane: tint, specular rim, soft elevation. No blur.
     tile   — inner cell of a card: faint tint only. No border, no blur.
   Controls (dock, theme switch, AI button, panels) are the clearest glass and
   the only other blurred surfaces.

   Sections: 1 tokens · 2 base · 3 layers · 4 shell · 5 header · 6 controls
             7 cards · 8 pages · 9 overlays · 10 mobile · 11 motion
   ========================================================================== */

/* 1. tokens ---------------------------------------------------------------- */
:root {
  color-scheme: dark;
  /* one design pixel. It follows the viewport height (1px at 900px tall), so a
     short desktop window gets the same layout smaller instead of a clipped one.
     Every size on the page is a multiple of it. */
  --u: clamp(.78px, calc(100vh / 900), 1.06px);
  --font: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --base: #070d1c;
  --ink: #f1f6ff;
  --ink-2: #c3d0e6;
  --ink-3: #a2b2cc;
  --accent: #86dcf2;
  --accent-ink: #082331;
  --link: #9fe4f6;

  /* light comes from the top-left: every sheet has a bright top edge, dimmer
     sides and a near-dark bottom edge */
  --pane: rgb(9 14 30 / .44);
  --pane-edge-t: rgb(255 255 255 / .28);
  --pane-edge-s: rgb(255 255 255 / .11);
  --pane-edge-b: rgb(255 255 255 / .05);
  --pane-rim: inset 0 1px 0 rgb(255 255 255 / .08);
  --pane-shadow: 0 34px 90px rgb(0 4 18 / .55), 0 2px 8px rgb(0 4 18 / .34);
  --pane-filter: blur(40px) saturate(1.6);

  --card: linear-gradient(180deg, rgb(255 255 255 / .15), rgb(255 255 255 / .055) 62%, rgb(255 255 255 / .04));
  --card-base: rgb(26 36 68 / .36);
  --card-edge-t: rgb(255 255 255 / .46);
  --card-edge-s: rgb(255 255 255 / .15);
  --card-edge-b: rgb(255 255 255 / .04);
  --card-rim: inset 0 1px 0 rgb(255 255 255 / .14), inset 0 -1px 0 rgb(0 4 18 / .22);
  --card-shadow: 0 0 0 1px rgb(0 3 14 / .34), 0 18px 36px rgb(0 3 14 / .50), 0 3px 7px rgb(0 3 14 / .42);
  --card-rim-hi: inset 0 1px 0 rgb(255 255 255 / .16);
  --card-shadow-hi: 0 0 0 1px rgb(0 3 14 / .34), 0 24px 46px rgb(0 3 14 / .56), 0 4px 9px rgb(0 3 14 / .42);
  --card-edge-hi: rgb(186 236 250 / .66);

  --tile: rgb(255 255 255 / .06);
  --tile-hi: rgb(255 255 255 / .10);
  --tile-rim: inset 0 1px 0 rgb(255 255 255 / .07);
  --hair: rgb(255 255 255 / .09);

  --ctl: rgb(22 32 58 / .56);
  --ctl-edge: rgb(255 255 255 / .16);
  --ctl-rim: inset 0 1px 0 rgb(255 255 255 / .22), inset 0 -1px 0 rgb(0 0 0 / .22);
  --ctl-shadow: 0 14px 36px rgb(0 5 20 / .40);
  --ctl-filter: blur(24px) saturate(1.6);
  --lens: rgb(255 255 255 / .16);
  --lens-rim: inset 0 1px 0 rgb(255 255 255 / .34), 0 2px 8px rgb(0 5 20 / .28);

  --ok: #6fdcae;
  --warn: #f0c477;
  --scrim: rgb(3 8 20 / .62);
  --title-a: #ffffff;
  --title-b: #b9e6f7;
}

html[data-theme="light"] {
  color-scheme: light;
  --base: #e7eef8;
  --ink: #12233d;
  --ink-2: #33475f;
  --ink-3: #455a75;
  --accent: #0d6f8c;
  --accent-ink: #ffffff;
  --link: #0b6480;

  --pane: rgb(244 248 255 / .34);
  --pane-edge-t: rgb(255 255 255 / .96);
  --pane-edge-s: rgb(255 255 255 / .70);
  --pane-edge-b: rgb(255 255 255 / .40);
  --pane-rim: inset 0 1px 0 rgb(255 255 255 / .55);
  --pane-shadow: 0 30px 80px rgb(40 66 116 / .22), 0 2px 8px rgb(40 66 116 / .10);
  --pane-filter: blur(40px) saturate(1.8);

  --card: linear-gradient(180deg, rgb(255 255 255 / .58), rgb(255 255 255 / .26) 62%, rgb(255 255 255 / .20));
  --card-base: rgb(255 255 255 / .10);
  --card-edge-t: rgb(255 255 255 / 1);
  --card-edge-s: rgb(255 255 255 / .82);
  --card-edge-b: rgb(118 148 200 / .26);
  --card-rim: inset 0 1px 0 rgb(255 255 255 / .70);
  --card-shadow: 0 0 0 1px rgb(40 66 116 / .05), 0 16px 34px rgb(40 66 116 / .17), 0 2px 6px rgb(40 66 116 / .12);
  --card-rim-hi: inset 0 1px 0 rgb(255 255 255 / .90);
  --card-shadow-hi: 0 0 0 1px rgb(40 66 116 / .06), 0 24px 46px rgb(40 66 116 / .22), 0 4px 9px rgb(40 66 116 / .13);
  --card-edge-hi: rgb(40 128 172 / .55);

  --tile: rgb(86 124 190 / .085);
  --tile-hi: rgb(86 124 190 / .14);
  --tile-rim: inset 0 1px 2px rgb(40 66 116 / .10), inset 0 -1px 0 rgb(255 255 255 / .80);
  --hair: rgb(34 72 128 / .12);

  --ctl: rgb(255 255 255 / .58);
  --ctl-edge: rgb(255 255 255 / .82);
  --ctl-rim: inset 0 1px 0 rgb(255 255 255 / .98), inset 0 -1px 0 rgb(60 90 140 / .10);
  --ctl-shadow: 0 14px 34px rgb(46 72 120 / .18);
  --ctl-filter: blur(24px) saturate(1.8);
  --lens: rgb(255 255 255 / .92);
  --lens-rim: inset 0 1px 0 rgb(255 255 255 / 1), 0 2px 8px rgb(46 72 120 / .16);

  --ok: #14845c;
  --warn: #7d520a;
  --scrim: rgb(214 226 242 / .62);
  --title-a: #0f2038;
  --title-b: #1d5f86;
}

/* 2. base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, figure, pre { margin: 0; }
h1, h2, h3 { font-weight: 700; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
img, picture { display: block; max-width: 100%; }
b, strong { font-weight: 700; }
i, em { font-style: normal; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
::selection { background: color-mix(in srgb, var(--accent) 34%, transparent); }

/* 3. layers ---------------------------------------------------------------- */
/* canvases are created and sized by the scripts; these are the stacking order only */
#bgCanvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
#cometCanvas { z-index: 1000 !important; }           /* trail stays above panels; script sets 94 inline */
.cursor-glow, .mouse-blur { display: none; }          /* superseded by the comet canvas */
.circuit-overlay, .orientation-tip, .page-no, .footerbar > span { display: none; }

/* 4. shell ----------------------------------------------------------------- */
.deck { position: relative; z-index: 3; width: 100%; height: 100%; }
.slides-wrap { position: relative; width: 100%; height: 100%; }

/* The switch animation in the script is written around translate(-50%,-50%),
   so a slide is always placed by its centre. */
.slide {
  position: absolute;
  left: 50%;
  top: calc(50% - 25px);
  transform: translate(-50%, -50%);
  width: min(100vw - 104px, 1336px);
  height: min(100dvh - 86px, 880px);
  display: none;
  border: 1px solid var(--pane-edge-s);
  border-top-color: var(--pane-edge-t);
  border-bottom-color: var(--pane-edge-b);
  border-radius: calc(34 * var(--u));
  background: var(--pane);
  box-shadow: var(--pane-rim), var(--pane-shadow);
  -webkit-backdrop-filter: var(--pane-filter);
  backdrop-filter: var(--pane-filter);
  overflow: hidden;
}
.slide.active { display: block; }
/* The page-switch animation in the script animates transform (a 3D flip with a 90px
   slide), opacity and filter. Only the focus pull is wanted: the incoming page appears
   in place and sharpens from an 8px blur. Important declarations outrank animations in
   the cascade, so these two pin the pane where it is and at full opacity, exactly as
   the previous stylesheets did. Without them the pane (and its pagination dots) swings
   in from the side while the user is aiming at it. */
.slide.active { transform: translate(-50%, -50%) !important; opacity: 1 !important; }
/* one quiet sheen across the pane: light catching the top-left of a thick sheet */
.slide::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(120% 70% at 0% 0%, rgb(255 255 255 / .07), transparent 58%),
    linear-gradient(180deg, rgb(255 255 255 / .03), transparent 34%);
}
html[data-theme="light"] .slide::before {
  background:
    radial-gradient(120% 70% at 0% 0%, rgb(255 255 255 / .46), transparent 58%),
    linear-gradient(180deg, rgb(255 255 255 / .20), transparent 34%);
}

.slide-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  row-gap: calc(20 * var(--u));
  padding: calc(28 * var(--u)) calc(38 * var(--u)) 70px;
  overflow: hidden;
}
/* the page body: whatever follows the header takes the remaining height. It is the
   scroll container, so content that does not fit scrolls instead of being clipped.
   A scroll container clips at its padding edge, so the padding (cancelled by an
   equal negative margin) is the room card shadows and the hover lift need. */
.slide-inner > :not(.slide-head):not(.footerbar) {
  flex: 1 1 0;
  min-height: 0;
  margin: -14px -26px -46px;
  padding: 14px 26px 46px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--hair) transparent;
}

/* pagination dots: the script pins the paper page's footer at 24px from the
   bottom with inline styles, so every page uses the same place */
.footerbar {
  position: absolute;
  inset: auto 0 24px 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
/* Each dot is a fixed 14x20 slot with the mark drawn inside it. The active mark grows
   to a pill without moving its neighbours (a dot that slides away while the pointer is
   over it makes the click land on the wrong page), and the slot is a far larger target
   than the 6px mark. The negative block margin keeps the row's layout height at the
   mark's 6px, so the marks sit exactly where the footer bar puts them. */
.dot-nav { display: flex; align-items: center; margin-block: -7px; pointer-events: auto; }
.dot-nav button {
  position: relative;
  flex: none;
  width: 14px;
  height: 20px;
}
.dot-nav button::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--ink-2);
  opacity: .46;
  transform: translate(-50%, -50%);
  transition: width .32s var(--ease), opacity .2s ease, background-color .2s ease;
}
.dot-nav button:hover::before { opacity: .8; }
.dot-nav button.active::before { width: 16px; opacity: .9; background: var(--accent); }

/* 5. header ---------------------------------------------------------------- */
.slide-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.slide-head > div:first-child {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 16px;
  row-gap: calc(6 * var(--u));
}
.slide-head .eyebrow, .slide-head .lead { grid-column: 1 / -1; }
.eyebrow {
  width: fit-content;
  color: var(--accent);
  font-size: max(10.5px, calc(11.52 * var(--u)));
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.title, .slide-head .section-title {
  width: fit-content;
  font-size: clamp(calc(36 * var(--u)), 4.2vw, calc(56 * var(--u)));
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--title-a);
  /* restrained two-stop fill; both ends keep full contrast */
  background: linear-gradient(100deg, var(--title-a) 30%, var(--title-b));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-bottom: .06em;
}
.subtitle {
  color: var(--ink-3);
  font-size: max(10.5px, calc(12.8 * var(--u)));
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.lead {
  max-width: 62em;
  color: var(--ink-2);
  font-size: max(11.5px, calc(14.72 * var(--u)));
  line-height: 1.6;
}

/* 6. controls -------------------------------------------------------------- */
/* one material for everything that floats above content */
.top-theme, .left-rail, .mobile-nav, .fab, .ai-panel, .welcome-box, .modal, .award-lightbox-close {
  border: 1px solid var(--ctl-edge);
  background: var(--ctl);
  box-shadow: var(--ctl-rim), var(--ctl-shadow);
  -webkit-backdrop-filter: var(--ctl-filter);
  backdrop-filter: var(--ctl-filter);
}

.top-theme {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  box-shadow: var(--ctl-rim), 0 6px 18px rgb(0 5 20 / .16);
}
.top-theme button {
  min-width: 52px;
  height: calc(30 * var(--u));
  min-height: 28px;
  padding: 0 13px;
  border-radius: 999px;
  color: var(--ink-3);
  font-size: max(12px, calc(13 * var(--u)));
  font-weight: 600;
  transition: color .2s ease, background-color .25s ease, box-shadow .25s ease;
}
.top-theme button:hover { color: var(--ink); }
.top-theme button.active { color: var(--ink); background: var(--lens); box-shadow: var(--lens-rim); }

.left-rail {
  position: fixed;
  left: 50%;
  bottom: 8px;
  z-index: 80;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px;
  border-radius: 999px;
}
.rail-brand {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-right: 2px;
  border-radius: 999px;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .04em;
}
.rail-btn {
  min-width: 54px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: .84rem;
  font-weight: 650;
  letter-spacing: .02em;
  transition: color .2s ease, background-color .25s ease, box-shadow .25s ease, transform .18s var(--ease);
}
.rail-btn:hover { color: var(--ink); }
.rail-btn:not(.active):hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.rail-btn:active { transform: scale(.96); }
.rail-btn.active { color: var(--ink); background: var(--lens); box-shadow: var(--lens-rim); }

.mobile-nav { display: none; }

/* the script positions the AI button and panel with inline styles once they
   are dragged or opened; these are only the resting defaults */
.fab {
  position: fixed;
  right: 8px;
  bottom: 8px;
  z-index: 260;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--ink);
  font-size: .86rem;
  font-weight: 700;
  touch-action: none;
  transition: box-shadow .25s ease, border-color .25s ease;
}
.fab:hover { border-color: var(--card-edge-hi); }
.fab.guide-dragging, .ai-panel.guide-dragging { transition: none; cursor: grabbing; }
.guide-open-hidden { visibility: hidden; pointer-events: none; }

/* buttons */
.mini-btn, .ulh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--hair);
  background: var(--tile-hi);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .12);
  color: var(--ink);
  font-size: max(11.5px, calc(13.44 * var(--u)));
  font-weight: 650;
  letter-spacing: .02em;
  white-space: nowrap;
  transition: background-color .2s ease, border-color .2s ease, transform .18s var(--ease), box-shadow .2s ease;
}
.mini-btn:hover, .ulh-btn:hover { background: color-mix(in srgb, var(--tile-hi) 60%, var(--lens)); border-color: var(--card-edge-hi); }
.mini-btn:active, .ulh-btn:active { transform: scale(.97); }
.mini-btn.primary, .ulh-btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .34), 0 6px 16px color-mix(in srgb, var(--accent) 26%, transparent);
}
.mini-btn.primary:hover, .ulh-btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); }
.mini-btn:disabled { opacity: .55; cursor: default; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 999px;
  background: var(--tile);
  color: var(--ink-2);
  font-size: 1.1rem;
  line-height: 1;
  transition: background-color .2s ease, color .2s ease;
}
.close:hover { background: var(--tile-hi); color: var(--ink); }

/* 7. cards ----------------------------------------------------------------- */
/* A card keeps ONE background-image layer: the pointer-light script reads it and
   prepends its own gradients, so extra layers here would be misplaced. */
.menu-card, .project-card, .award-card, .paper-card, .ability-card, .ulh-card, .stat, .terminal {
  position: relative;
  min-width: 0;
  border: 1px solid var(--card-edge-s);
  border-top-color: var(--card-edge-t);
  border-bottom-color: var(--card-edge-b);
  border-radius: calc(22 * var(--u));
  background-color: var(--card-base);
  background-image: var(--card);
  box-shadow: var(--card-rim), var(--card-shadow);
}
/* interactive cards: rise on a soft curve, settle quickly when pressed */
.menu-card, .project-card, .award-card, .paper-card, .ability-card, .ulh-svc {
  cursor: pointer;
  transition:
    transform .46s var(--ease),
    box-shadow .42s var(--ease),
    border-color .3s ease;
}
.menu-card:hover, .project-card:hover, .award-card:hover, .paper-card:hover, .ability-card:hover,
.menu-card:focus-visible, .project-card:focus-visible, .award-card:focus-visible, .paper-card:focus-visible, .ability-card:focus-visible {
  transform: translate3d(0, -2px, 0);
  border-top-color: var(--card-edge-hi);
  box-shadow: var(--card-rim-hi), var(--card-shadow-hi);
}
.menu-card:active, .project-card:active, .award-card:active, .paper-card:active, .ability-card:active {
  transform: translate3d(0, 0, 0);
  box-shadow: var(--card-rim), var(--card-shadow);
  transition-duration: .12s;
}

/* shared card text */
.menu-card h3, .project-card h3, .award-card h3, .ability-card h3, .stat h3, .card h3 {
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: 0;
}
.menu-card p, .project-card p, .award-card p, .ability-card p, .stat p, .card p, .paper-hero-text, .ulh-lead {
  color: var(--ink-2);
  text-wrap: pretty;
}
/* inner cell of a card: tint only */
.card {
  min-width: 0;
  border-radius: calc(14 * var(--u));
  background: var(--tile);
  box-shadow: var(--tile-rim);
  padding: calc(13 * var(--u)) calc(15 * var(--u));
}
/* small status pill */
.quantum-tag, .ulh-tags span, .ulh-svc em, .ulh-id-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  border-radius: 999px;
  background: var(--tile);
  color: var(--ink-2);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
/* project / award tags: one quiet line under the title, separated by dots */
.quantum-tag {
  padding: 0;
  background: none;
  color: var(--ink-2);
  font-size: max(10.5px, calc(11 * var(--u)));
  font-weight: 650;
  letter-spacing: .08em;
  opacity: .86;
  text-transform: uppercase;
  gap: 0;
}
/* the separator sits inside the following tag. Its left margin is smaller by the
   previous word's trailing letter-spacing, so the dot is optically centred. */
.quantum-tag + .quantum-tag::before { content: "·"; margin: 0 .55em 0 .47em; letter-spacing: 0; opacity: .7; }
/* number badge */
.menu-num, .ability-idx {
  display: grid;
  place-items: center;
  flex: none;
  width: calc(40 * var(--u));
  height: calc(40 * var(--u));
  border-radius: calc(13 * var(--u));
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .16);
  color: var(--accent);
  font-size: max(10.5px, calc(12.48 * var(--u)));
  font-weight: 800;
  letter-spacing: .04em;
}

/* 8. pages ----------------------------------------------------------------- */

/* 8.0 directory: 3 x 2 */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(min-content, calc(214 * var(--u)));
  align-content: safe center;
  gap: calc(20 * var(--u));
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
}
.menu-card {
  display: flex;
  flex-direction: column;
  gap: calc(12 * var(--u));
  padding: calc(20 * var(--u));
}
.card-head, .ability-head { display: flex; align-items: center; gap: calc(13 * var(--u)); }
.menu-card h3 { font-size: calc(19.2 * var(--u)); font-weight: 750; }
.menu-card p { flex: 1 0 auto; font-size: calc(15.2 * var(--u)); line-height: 1.65; }
.menu-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: calc(12 * var(--u));
  border-top: 1px solid var(--hair);
  color: var(--link);
  font-size: max(11.5px, calc(14.72 * var(--u)));
  font-weight: 650;
}
.menu-card-meta b {
  display: grid;
  place-items: center;
  width: calc(28 * var(--u));
  height: calc(28 * var(--u));
  border-radius: 999px;
  background: var(--tile);
  font-weight: 700;
  transition: transform .4s var(--ease), background-color .25s ease;
}
.menu-card:hover .menu-card-meta b { transform: translateX(3px); background: var(--tile-hi); }

/* 8.1 home: profile | service console */
.ulhome-v2 {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  grid-template-rows: minmax(min-content, max-content);
  align-content: safe center;
  gap: calc(22 * var(--u));
}
.ulh-card { padding: calc(24 * var(--u)) calc(28 * var(--u)); }
.ulh-intro {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  /* six blocks; whatever height the card has beyond them is shared between the blocks */
  grid-template-rows: repeat(6, auto);
  align-content: space-between;
  align-items: baseline;
  column-gap: 16px;
  row-gap: calc(14 * var(--u));
}
.ulh-intro > * { grid-column: 1 / -1; min-width: 0; }
.ulh-intro > .ulh-name { grid-column: 1; }
.ulh-intro > .ulh-sub { grid-column: 2; }
.ulh-intro > .ulh-stats { align-self: stretch; }
.ulh-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
  font-size: max(10.5px, calc(11.2 * var(--u)));
  font-weight: 700;
  letter-spacing: .18em;
}
.ulh-eyebrow span { width: 24px; height: 2px; border-radius: 2px; background: currentColor; opacity: .7; }
.ulh-name { font-size: calc(44 * var(--u)); line-height: 1.05; letter-spacing: -.02em; }
.ulh-sub {
  text-align: right;
  color: var(--ink-3);
  font-size: max(10.5px, calc(12.16 * var(--u)));
  font-weight: 600;
  letter-spacing: .2em;
}
.ulh-lead { font-size: calc(16.4 * var(--u)); line-height: 1.78; }
.ulh-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: calc(10 * var(--u)); }
.ulh-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(5 * var(--u));
  padding: calc(15 * var(--u)) 8px;
  border-radius: calc(14 * var(--u));
  background: var(--tile);
  box-shadow: var(--tile-rim);
  text-align: center;
}
.ulh-stat strong { font-size: calc(27 * var(--u)); line-height: 1.05; letter-spacing: -.01em; }
.ulh-stat span { color: var(--ink-3); font-size: max(10.5px, calc(11.52 * var(--u))); letter-spacing: .03em; }
.ulh-tags { display: flex; flex-wrap: wrap; row-gap: 6px; }
.ulh-tags span { padding: 0; background: none; color: var(--ink-3); font-size: max(10.5px, calc(12.5 * var(--u))); letter-spacing: .06em; font-weight: 550; }
.ulh-tags { column-gap: 0; }
.ulh-tags span { gap: 0; }
.ulh-tags span + span::before { content: "/"; display: inline-block; margin: 0 .82em 0 .78em; letter-spacing: 0; opacity: .5; }
.ulh-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.ulh-console {
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: space-between;
  gap: calc(13 * var(--u));
  padding: calc(22 * var(--u));
}
.ulh-console-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ulh-console-title { color: var(--accent); font-size: max(10.5px, calc(11.52 * var(--u))); font-weight: 800; letter-spacing: .26em; }
.ulh-live { display: flex; align-items: center; gap: 7px; color: var(--ink-3); font-size: max(10.5px, calc(10.56 * var(--u))); font-weight: 700; letter-spacing: .12em; }
.ulh-live i, .ulh-id-badge i, .ulh-foot b { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--ok); }
.ulh-id {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: calc(11 * var(--u)) calc(14 * var(--u));
  border-radius: calc(16 * var(--u));
  background: var(--tile);
  box-shadow: var(--tile-rim);
}
.ulh-avatar { width: calc(52 * var(--u)); height: calc(52 * var(--u)); border-radius: calc(15 * var(--u)); overflow: hidden; box-shadow: 0 0 0 1px var(--hair); }
.ulh-avatar picture, .ulh-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ulh-id-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ulh-id-text strong { font-size: calc(16 * var(--u)); letter-spacing: .03em; }
.ulh-id-text span { color: var(--ink-3); font-size: max(10.5px, calc(11.2 * var(--u))); letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ulh-id-badge { padding: 6px 10px; color: var(--ok); font-size: max(10.5px, calc(10.24 * var(--u))); font-weight: 800; letter-spacing: .12em; }
.ulh-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(calc(46 * var(--u)), auto));
  gap: calc(3 * var(--u)) calc(14 * var(--u));
}
.ulh-svc {
  --tone: var(--ink-3);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 0 calc(8 * var(--u));
  border-radius: calc(12 * var(--u));
  transition: background-color .2s ease;
}
.ulh-svc:hover, .ulh-svc:focus-visible { background: var(--tile-hi); }
.ulh-svc:active { background: var(--tile); }
/* tones follow the legend under the list: amber = IP gated, accent = public */
.ulh-svc.tone-gated { --tone: var(--warn); }
.ulh-svc.tone-public, .ulh-svc.tone-mail, .ulh-svc.tone-api { --tone: var(--accent); }
.ulh-svc i {
  display: grid;
  place-items: center;
  width: calc(26 * var(--u));
  height: calc(26 * var(--u));
  border-radius: calc(9 * var(--u));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: max(10.5px, calc(13.12 * var(--u)));
}
.ulh-svc-text { display: flex; flex-direction: column; min-width: 0; }
.ulh-svc-text strong { font-size: max(10.5px, calc(13.12 * var(--u))); line-height: 1.25; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ulh-svc-text span { color: var(--ink-3); font-size: max(11px, calc(11.4 * var(--u))); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ulh-svc em {
  padding: 4px 7px;
  background: color-mix(in srgb, var(--tone) 15%, transparent);
  color: var(--tone);
  font-size: max(10.5px, calc(10.6 * var(--u)));
  font-weight: 800;
  letter-spacing: .06em;
}
.ulh-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding-top: calc(10 * var(--u));
  border-top: 1px solid var(--hair);
  color: var(--ink-3);
  font-size: max(10.5px, calc(10.56 * var(--u)));
  letter-spacing: .05em;
}
.ulh-foot span { display: flex; align-items: center; gap: 6px; }
/* the default state (IP gated) is plain text; only the exceptions get a pill */
.ulh-svc.tone-gated em { padding: 4px 0; background: none; opacity: .82; }
.ulh-foot b.guard { background: var(--warn); }
.ulh-foot b.pub { background: var(--accent); }

/* 8.2 projects: 4 x 3, rows share the height */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(min-content, calc(186 * var(--u)));
  align-content: safe center;
  gap: calc(16 * var(--u));
}
.project-card {
  display: flex;
  flex-direction: column;
  gap: calc(9 * var(--u));
  padding: calc(19 * var(--u)) calc(18 * var(--u)) calc(17 * var(--u));
}
.award-meta { display: flex; flex-wrap: wrap; align-items: center; gap: calc(5 * var(--u)) 0; }
.award-meta h3 { flex: 1 1 100%; }
.project-card h3 { font-size: calc(18.5 * var(--u)); }
.project-card p {
  flex: 1 0 auto;
  font-size: max(11.5px, calc(14.08 * var(--u)));
  line-height: 1.58;
  text-wrap: pretty;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.project-card-foot { color: var(--link); font-size: max(10.5px, calc(13.12 * var(--u))); font-weight: 600; letter-spacing: .01em; overflow-wrap: anywhere; }
.project-card-foot::after { content: "↗"; display: inline-block; margin-left: .4em; font-size: 1.08em; transition: transform .4s var(--ease); }
.project-card:hover .project-card-foot::after { transform: translate(2px, -2px); }

/* 8.3 awards: two labelled rows of four. A cluster is a section label, not a box. */
.awards-board { display: grid; grid-auto-rows: auto; align-content: safe center; gap: calc(22 * var(--u)); }
.award-cluster { display: grid; grid-template-rows: auto auto; gap: calc(12 * var(--u)); }
.cluster-head { display: flex; align-items: center; gap: 14px; }
.cluster-head span { color: var(--ink); font-size: max(11.5px, calc(14.72 * var(--u))); font-weight: 750; letter-spacing: .04em; white-space: nowrap; }
.cluster-head::after { content: ""; order: 1; flex: 1 1 auto; height: 1px; background: var(--hair); }
.cluster-head b { order: 2; color: var(--ink-3); font-size: max(10.5px, calc(12.16 * var(--u))); font-weight: 600; letter-spacing: .08em; white-space: nowrap; }
.awards-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(calc(168 * var(--u)), auto); gap: calc(14 * var(--u)); }
.award-card {
  display: flex;
  flex-direction: column;
  gap: calc(8 * var(--u));
  padding: calc(16 * var(--u)) calc(17 * var(--u));
}
.award-card h3 { font-size: calc(15.7 * var(--u)); line-height: 1.32; }
.award-card p {
  flex: 1 0 auto;
  font-size: max(10.5px, calc(12.8 * var(--u)));
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.award-hint { color: var(--link); font-size: max(10.5px, calc(12.16 * var(--u))); font-weight: 650; }
/* Desktop only (phones list the cards in one column at their natural height):
   the 2025 group is the feature row — taller cards, larger titles, room for a third
   line — and 2024 stays compact, as the page's own intro describes. */
@media (min-width: 901px) {
  .award-cluster-main .awards-grid { grid-auto-rows: minmax(calc(196 * var(--u)), auto); }
  .award-cluster-main .award-card { gap: calc(10 * var(--u)); padding: calc(20 * var(--u)) calc(19 * var(--u)) calc(18 * var(--u)); }
  .award-cluster-main .award-card h3 { font-size: calc(17.6 * var(--u)); line-height: 1.34; }
  .award-cluster-main .award-card p { font-size: max(11.5px, calc(13.6 * var(--u))); line-height: 1.6; -webkit-line-clamp: 3; line-clamp: 3; }
  .award-cluster:not(.award-cluster-main) .awards-grid { grid-auto-rows: minmax(calc(152 * var(--u)), auto); }
  .awards-board { gap: calc(26 * var(--u)); }
}

/* 8.4 paper: article | snapshot + four notes */
.paper-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); grid-template-rows: minmax(min-content, max-content); align-content: safe center; gap: calc(20 * var(--u)); }
.paper-card {
  display: flex;
  flex-direction: column;
  gap: calc(14 * var(--u));
  padding: calc(24 * var(--u)) calc(26 * var(--u));
  color: inherit;
}
/* the title carries an inline font-size in the markup */
.paper-card .section-title {
  color: var(--ink);
  font-size: calc(22 * var(--u)) !important;
  line-height: 1.34 !important;
  font-weight: 700;
  letter-spacing: -.01em;
}
.paper-hero-text { font-size: calc(15.6 * var(--u)); line-height: 1.72; }
.paper-card > .card { flex: 0 0 auto; }
.paper-card .card h3, .stat h3 { font-size: max(11.5px, calc(15 * var(--u))); margin-bottom: calc(5 * var(--u)); }
.paper-card .card p, .stat p { font-size: max(11.5px, calc(13.6 * var(--u))); line-height: 1.6; text-wrap: pretty; }
.paper-card .card strong { color: var(--ink); }
.paper-side-grid {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: auto;
  align-content: start;
  gap: calc(12 * var(--u));
}
.paper-grid > div:not(.paper-card), .paper-grid > :last-child:not(a) {
  display: flex;
  flex-direction: column;
  gap: calc(14 * var(--u));
  min-width: 0;
}
.terminal {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: calc(18 * var(--u)) calc(20 * var(--u)) calc(20 * var(--u));
  background-image: linear-gradient(180deg, rgb(6 12 26 / .46), rgb(6 12 26 / .30));
}
html[data-theme="light"] .terminal { background-image: linear-gradient(180deg, rgb(30 58 104 / .09), rgb(30 58 104 / .05)); }
html[data-theme="light"] .terminal pre { color: var(--ink); }
.terminal .bar { display: flex; gap: 6px; margin-bottom: calc(14 * var(--u)); }
.terminal .bar span { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); opacity: .42; }
.terminal pre {
  font-family: var(--mono);
  color: var(--ink-2);
  font-size: max(11px, calc(13 * var(--u)));
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-block: auto;
}
.signal-grid {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: calc(12 * var(--u));
  margin: 0 !important;                 /* inline margin-top in the markup; the column gap spaces it */
}
.stat { display: flex; flex-direction: column; justify-content: flex-start; padding: calc(15 * var(--u)) calc(17 * var(--u)); border-radius: calc(18 * var(--u)); }

/* 8.5 ability: 3 x 2 */
.ability-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(min-content, calc(214 * var(--u)));
  align-content: safe center;
  gap: calc(18 * var(--u));
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
}
.ability-card { display: flex; flex-direction: column; gap: calc(11 * var(--u)); padding: calc(20 * var(--u)); }
.ability-card h3 { font-size: calc(17.6 * var(--u)); }
.ability-card p { flex: 1 0 auto; font-size: max(11.5px, calc(14.4 * var(--u))); line-height: 1.6; }
.ability-evidence { display: grid; gap: calc(7 * var(--u)); }
.ability-evidence span {
  display: grid;
  grid-template-columns: 4.6em minmax(0, 1fr);
  gap: 8px;
  padding: calc(8 * var(--u)) calc(11 * var(--u));
  border-radius: calc(12 * var(--u));
  background: var(--tile);
  color: var(--ink-2);
  font-size: max(10.5px, calc(12.16 * var(--u)));
  line-height: 1.45;
}
.ability-evidence b { color: var(--ink); font-weight: 700; }

/* 9. overlays -------------------------------------------------------------- */

/* welcome: only the animated background shows behind it */
.welcome {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  transition: opacity .5s ease, visibility 0s linear 0s;
}
.welcome.hide { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .5s ease, visibility 0s linear .5s; }
#welcome:not(.hide) ~ .left-rail,
#welcome:not(.hide) ~ .mobile-nav,
#welcome:not(.hide) ~ .deck,
#welcome:not(.hide) ~ .fab { opacity: 0; visibility: hidden; }
.left-rail, .mobile-nav, .deck, .fab { transition: opacity .45s ease; }
.welcome-box {
  width: min(720px, 100%);
  padding: clamp(28px, 5vw, 44px) clamp(22px, 5vw, 46px);
  border-radius: 32px;
  text-align: center;
}
.welcome-box .title { margin-inline: auto; font-size: clamp(2.4rem, 7vw, 3.6rem); }
.welcome-box .subtitle { margin-top: 10px; }
.welcome-box .lead { max-width: 34em; }
.welcome-box .mini-btn { min-height: 50px; padding: 0 28px; border-radius: 16px; font-size: 1rem; }

/* AI guide panel: the script places it with inline left/top once opened */
.ai-panel {
  position: fixed;
  right: 20px;
  bottom: 70px;
  z-index: 259;
  width: min(390px, 100vw - 16px);
  max-height: min(620px, 100dvh - 96px);
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  overflow: hidden;
}
.ai-panel.hidden { display: none; }
.ai-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px 12px 18px;
  border-bottom: 1px solid var(--hair);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.ai-head strong { display: block; font-size: .98rem; }
.ai-head span { display: block; color: var(--ink-3); font-size: .72rem; }
.ai-body { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 12px; }
.chat { display: flex; flex-direction: column; gap: 8px; min-height: 0; max-height: 270px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--hair) transparent; }
.msg {
  max-width: 92%;
  padding: 10px 13px;
  border-radius: 16px 16px 16px 6px;
  background: var(--tile);
  color: var(--ink);
  font-size: .88rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.msg.user { align-self: flex-end; border-radius: 16px 16px 6px 16px; background: color-mix(in srgb, var(--accent) 20%, transparent); }
.chat-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.chat-input {
  min-width: 0;
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: var(--tile);
  outline: none;
  font-size: .9rem;
  transition: border-color .2s ease, background-color .2s ease;
}
.chat-input::placeholder { color: var(--ink-3); }
.chat-input:focus { border-color: var(--accent); background: var(--tile-hi); }
.chat-input-row .mini-btn { min-height: 40px; }
.chat-status { min-height: 1em; color: var(--ink-3); font-size: .74rem; }
.chat-links { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-links:empty { display: none; }
.chat-link {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--tile);
  color: var(--link);
  font-size: .78rem;
  font-weight: 600;
}
.chat-link:hover { background: var(--tile-hi); }
.ai-body .action-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.ai-body .action-row .mini-btn { min-height: 34px; padding: 0 8px; font-size: .8rem; }

/* project modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 9990; display: none; place-items: center; padding: 16px; background: var(--scrim); }
.modal-backdrop.show { display: grid; }
.modal { width: min(760px, 100%); max-height: 86dvh; overflow: auto; padding: 22px; border-radius: 26px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head p { color: var(--ink-2); }
.modal .menu-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); grid-auto-rows: auto; }

/* certificate lightbox */
.award-lightbox { position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center; padding: 24px; background: var(--scrim); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.award-lightbox.open { display: flex; }
.award-lightbox-inner { position: relative; display: flex; flex-direction: column; max-width: min(1120px, 100%); max-height: 100%; }
.award-lightbox-close {
  position: absolute;
  top: -14px;
  right: -10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
}
.award-lightbox-body { display: flex; align-items: flex-start; justify-content: center; gap: 16px; max-height: calc(100dvh - 72px); overflow: auto; }
.award-fig { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.award-fig img { max-width: 100%; max-height: calc(100dvh - 120px); width: auto; height: auto; object-fit: contain; border-radius: 14px; box-shadow: 0 20px 60px rgb(0 5 20 / .45); }
.award-lightbox-cap { color: var(--ink-2); font-size: .86rem; text-align: center; }

/* narrow desktop (a 1024-wide tablet in landscape, a half-screen window):
   the pane uses more of the width and cards tighten slightly */
@media (min-width: 901px) and (max-width: 1180px) {
  .slide { width: calc(100vw - 48px); }
  .slide-inner { padding: calc(24 * var(--u)) 26px 60px; row-gap: calc(16 * var(--u)); }
  .ulhome-v2, .paper-grid { gap: 14px; }
  .projects-grid, .awards-grid { gap: 12px; }
  .ulh-card { padding-inline: 18px; }
  .paper-card { gap: calc(10 * var(--u)); padding: calc(18 * var(--u)) calc(20 * var(--u)); }
}
/* 1000-1180px: the desktop composition stays (two columns on home and paper, four
   project columns); only what cannot fit changes */
@media (min-width: 1000px) and (max-width: 1180px) {
  /* service list: still two columns of six, but each cell is two lines — name and
     status on the first, the domain on the second with the whole cell width */
  .ulh-grid { grid-template-rows: repeat(6, minmax(36px, auto)); gap: 2px 10px; }
  .ulh-svc { grid-template-rows: auto auto; align-content: center; column-gap: 8px; row-gap: 1px; padding: 3px 6px; }
  .ulh-svc i { grid-area: 1 / 1 / 3 / 2; width: 24px; height: 24px; border-radius: 8px; }
  .ulh-svc-text { display: contents; }
  .ulh-svc-text strong { grid-area: 1 / 2; align-self: end; }
  .ulh-svc-text span { grid-area: 2 / 2 / 3 / 4; align-self: start; }
  .ulh-svc em { grid-area: 1 / 3; align-self: end; padding: 1px 6px; }
  .ulh-svc.tone-gated em { padding: 1px 0; }

  /* four project columns are ~220px wide: tighter card, and the caps line must stay on one row */
  .project-card { gap: calc(7 * var(--u)); padding: calc(15 * var(--u)) 13px calc(13 * var(--u)); }
  .project-card .quantum-tag { letter-spacing: .04em; }
}
/* 901-999px: too tight for that. Home and paper stack into one column, the wide grids
   give up a column, and the page scrolls inside the pane. */
@media (min-width: 901px) and (max-width: 999px) {
  .projects-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .awards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ulhome-v2, .paper-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
}

/* compact header for narrow or short desktop windows: the intro moves onto the
   title's line (it wraps below when it does not fit). Saves ~30px on every page. */
@media (min-width: 901px) and (max-width: 1180px), (min-width: 901px) and (max-height: 700px) {
  .slide-head > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 16px; row-gap: 2px; }
  .slide-head .eyebrow { flex: 0 0 100%; }
  .slide-head .title, .slide-head .section-title { font-size: 40px; }
  .slide-head .lead { flex: 1 1 300px; margin-top: 0; }
}

/* short desktop window (a 1366x768 laptop with browser chrome leaves ~640px).
   Text is already at its size floor here, so space comes from structure instead:
   the margins around the pane tighten and cards give up a little padding.
   Nothing is hidden and no text gets smaller. */
@media (min-width: 901px) and (max-height: 700px) {
  .slide { top: calc(50% - 27px); height: min(100dvh - 74px, 880px); }
  .slide-inner { row-gap: 12px; padding-block: 16px 50px; }

  .projects-grid { gap: 10px; }
  .project-card { padding: 12px 14px 11px; }
  .award-cluster-main .awards-grid { grid-auto-rows: minmax(calc(190 * var(--u)), auto); }
  .award-cluster:not(.award-cluster-main) .awards-grid { grid-auto-rows: minmax(calc(146 * var(--u)), auto); }
  .awards-board { gap: calc(20 * var(--u)); }
  .ulh-card, .paper-card { padding-block: 16px; }
  .paper-card { gap: 8px; }
  .terminal { padding: 12px 16px 14px; }
  .terminal pre { line-height: 1.62; }
  .terminal .bar { margin-bottom: 8px; }
}

/* 10. mobile (<= 900px) ---------------------------------------------------- */
@media (max-width: 900px) {
  :root { --u: 1px; }

  /* On a phone there is no page panel: content runs edge to edge, cards sit straight
     on the animated background, and the page scrolls underneath the tab bar. That is
     one glass level less, and the tab bar is the only blurred surface.
     Page switches are instant here (no centre-based animation). */
  .slide {
    inset: 0;
    width: auto;
    height: auto;
    transform: none;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .slide::before { display: none; }
  /* the desktop pin on the active page is !important and more specific: undo it here,
     where a page is placed by inset and must not be translated */
  .slide.active { transform: none !important; }
  .slide-inner {
    display: block;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 14px calc(92px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    scrollbar-width: none;
  }
  .slide-inner::-webkit-scrollbar { display: none; }
  .slide-inner > :not(.slide-head):not(.footerbar) { margin: 0; padding: 0; overflow: visible; }
  .footerbar, .left-rail, .fab { display: none; }

  /* cards carry the material alone here, so the film is a little denser */
  :root { --card-base: rgb(22 32 62 / .54); }
  html[data-theme="light"] { --card-base: rgb(255 255 255 / .30); }

  /* header: label and theme switch share the first line, title and intro follow */
  .slide-head { position: relative; display: block; margin-bottom: 16px; padding: 2px 2px 0; }
  .slide-head > div:first-child { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
  .eyebrow { display: flex; align-items: center; min-height: 46px; padding-right: 150px; font-size: .72rem; letter-spacing: .1em; }
  .title, .slide-head .section-title { font-size: clamp(2rem, 9vw, 2.5rem); }
  .subtitle { color: var(--ink-2); font-size: .72rem; letter-spacing: .1em; }
  .lead { margin-top: 4px; color: var(--ink); opacity: .86; font-size: .9rem; }
  .top-theme {
    position: absolute;
    top: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(3, 44px);
    gap: 0;
    padding: 3px;
  }
  .top-theme button { min-width: 0; height: 40px; min-height: 40px; padding: 0; font-size: .78rem; }

  /* tab bar: the page scrolls beneath it. It is lighter, clearer glass than the
     desktop dock because here there is always content moving behind it. */
  .mobile-nav {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 180;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    padding: 6px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgb(255 255 255 / .15), rgb(255 255 255 / .07)), rgb(14 22 44 / .44);
    -webkit-backdrop-filter: blur(26px) saturate(1.8);
    backdrop-filter: blur(26px) saturate(1.8);
  }
  html[data-theme="light"] .mobile-nav { background: linear-gradient(180deg, rgb(255 255 255 / .62), rgb(255 255 255 / .42)); }
  /* below the bar the page dissolves into the background instead of showing a sliced
     line of text in the gap (and behind the home indicator) */
  .deck::after {
    content: "";
    position: fixed;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(46px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
    background: linear-gradient(0deg, var(--base) calc(10px + env(safe-area-inset-bottom, 0px)), transparent);
  }
  .mobile-nav .rail-btn { min-width: 0; height: 46px; padding: 0 2px; border-radius: 18px; font-size: .78rem; letter-spacing: 0; }
  .mobile-nav .mobile-guide-btn { font-weight: 800; touch-action: none; }

  /* single column; rows are as tall as their content */
  .menu-grid, .projects-grid, .awards-grid, .ability-grid, .ulhome-v2, .paper-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-rows: auto;
    align-content: start;
    gap: 12px;
    max-width: none;
  }
  .awards-board { gap: 20px; align-content: start; }
  .award-cluster { gap: 10px; }
  .menu-card, .project-card, .award-card, .ability-card, .paper-card { padding: 16px; border-radius: 20px; }
  .ulh-card { padding: 18px 16px; border-radius: 22px; }
  .menu-card { gap: 8px; }
  .menu-card h3, .project-card h3, .ability-card h3 { font-size: 1.08rem; }
  .menu-card p, .project-card p, .ability-card p { font-size: .9rem; line-height: 1.55; }
  .menu-card-meta { padding-top: 10px; }
  .project-card p, .award-card p { display: block; -webkit-line-clamp: unset; line-clamp: unset; overflow: visible; }
  .award-card h3 { font-size: 1rem; }
  .award-card p { font-size: .86rem; }
  .quantum-tag { font-size: .68rem; }
  .menu-card-meta, .project-card-foot, .award-hint { font-size: .86rem; }
  .cluster-head span { font-size: .94rem; }
  .cluster-head b { font-size: .74rem; }

  /* touch has no hover: keep the press, drop the lift */
  .menu-card:hover, .project-card:hover, .award-card:hover, .paper-card:hover, .ability-card:hover {
    transform: none;
    border-top-color: var(--card-edge-t);
    box-shadow: var(--card-rim), var(--card-shadow);
  }
  .menu-card:active, .project-card:active, .award-card:active, .paper-card:active, .ability-card:active { transform: scale(.985); }
  .ulh-svc:hover { background: none; }
  .ulh-svc:active { background: var(--tile-hi); }

  /* home */
  .ulh-intro { display: flex; flex-direction: column; align-items: stretch; row-gap: 14px; }
  .ulh-name { font-size: 2rem; }
  .ulh-sub { margin-top: -8px; text-align: left; font-size: .7rem; letter-spacing: .12em; }
  .ulh-lead { font-size: .93rem; line-height: 1.7; }
  .ulh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ulh-stat { padding: 13px 8px; }
  .ulh-stat strong { font-size: 1.5rem; }
  .ulh-stat span { font-size: .76rem; }
  /* tags wrap here, so they are pills again: a separator must never start a line */
  .ulh-tags { gap: 8px; }
  .ulh-tags span { padding: 6px 12px; background: var(--tile); color: var(--ink-2); font-size: .78rem; letter-spacing: .03em; }
  .ulh-tags span + span::before { content: none; }
  .ulh-actions .ulh-btn { flex: 1 1 calc(50% - 5px); min-height: 46px; font-size: .92rem; }
  .ulh-console { gap: 12px; }
  .ulh-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-rows: 54px; gap: 2px; }
  .ulh-svc { padding: 0 8px; }
  .ulh-svc i { width: 32px; height: 32px; border-radius: 11px; font-size: .95rem; }
  .ulh-svc-text strong { font-size: .94rem; }
  .ulh-svc-text span { font-size: .76rem; }
  .ulh-svc em { font-size: .68rem; }
  .ulh-console-title, .ulh-eyebrow { font-size: .7rem; }
  .ulh-live, .ulh-foot { font-size: .72rem; }
  .ulh-id-badge { font-size: .66rem; }
  .ulh-id-text span { white-space: normal; font-size: .74rem; }

  /* paper */
  .paper-card .section-title { font-size: 1.16rem !important; }
  .paper-hero-text { font-size: .92rem; }
  .paper-card .card p, .stat p { font-size: .87rem; }
  .paper-card .card h3, .stat h3 { font-size: .95rem; }
  .paper-side-grid, .signal-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  .terminal { padding: 16px; }
  .terminal pre { margin-block: 0; font-size: .78rem; line-height: 1.75; }

  /* ability */
  .ability-evidence span { font-size: .83rem; }

  /* overlays */
  .ai-panel { left: 8px; right: 8px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); width: auto; max-height: calc(100dvh - 110px - env(safe-area-inset-bottom, 0px) - env(safe-area-inset-top, 0px)); }
  #closeGuide { min-width: 44px; min-height: 44px; }
  .ai-body .action-row .mini-btn { min-height: 44px; }
  .award-lightbox { padding: 14px; }
  .award-lightbox-inner { width: 100%; min-height: 0; }
  .award-lightbox-close { top: 0; right: 0; width: 44px; height: 44px; }
  .award-lightbox-body { flex: 0 1 auto; min-height: 0; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 54px; overscroll-behavior: contain; }
}

/* large phones in landscape, small tablets: two columns */
@media (min-width: 620px) and (max-width: 900px) {
  .slide-inner { padding-inline: 20px; }
  .menu-grid, .projects-grid, .awards-grid, .ability-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ulh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 52px; column-gap: 14px; }
  .ulh-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ulh-actions .ulh-btn { flex: 0 1 auto; padding: 0 22px; }
  .paper-side-grid, .signal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .mobile-nav .rail-btn { font-size: .72rem; }
  .eyebrow { letter-spacing: .06em; }
}
/* the smallest phones (320px): seven tabs need the whole width to stay 40px wide */
@media (max-width: 340px) {
  .mobile-nav { left: 6px; right: 6px; gap: 1px; padding: 5px; }
  .slide-inner { padding-inline: 10px; }
}

/* 11. motion & fallbacks --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
  .menu-card:hover, .project-card:hover, .award-card:hover, .paper-card:hover, .ability-card:hover, .ulh-svc:hover { transform: none; }
}
/* no backdrop blur available: raise the fills so text stays readable */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --pane: rgb(18 26 48 / .82); --ctl: rgb(22 32 58 / .94); }
  html[data-theme="light"] { --pane: rgb(238 244 252 / .86); --ctl: rgb(250 252 255 / .96); }
}

/* Light-mode background paint: subdued color, real painted layers, no geometry changes. */
html[data-theme="light"] body {
  background-color: #edf1f6 !important;
  background-image:
    radial-gradient(ellipse 82% 64% at 4% 5%, rgb(78 142 164 / .11), transparent 72%),
    radial-gradient(ellipse 72% 58% at 96% 92%, rgb(118 112 158 / .09), transparent 74%),
    linear-gradient(145deg, #edf1f6 0%, #e9eef4 52%, #e8edf3 100%) !important;
  background-attachment: fixed !important;
}
html[data-theme="light"] body #welcome ~ .deck .slides-wrap > section.slide[data-index]::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  inset: 0 !important;
  z-index: 0 !important;
  pointer-events: none !important;
  background:
    radial-gradient(ellipse 54% 40% at 2% 0%, rgb(86 151 169 / .105), transparent 76%),
    radial-gradient(ellipse 58% 46% at 100% 100%, rgb(130 119 163 / .075), transparent 78%),
    linear-gradient(125deg, rgb(255 255 255 / .16), transparent 48%, rgb(85 126 150 / .025)) !important;
  opacity: 1 !important;
}
