/* ==========================================================================
   uncommon.casa — design system
   Dark only. Ponsfamily glass, pushed green. No build step: this file is the
   entire visual contract for every page.

   Order:
     1. tokens
     2. reset + document ground
     3. background canvas + stacking
     4. layout primitives
     5. surfaces
     6. type
     7. controls
     8. components
     9. shell (header / footer, owned jointly with ui.js)
    10. state + reveal
    11. responsive + reduced motion
   ========================================================================== */

/* ------------------------------------------------------------------ 1. tokens */

:root{
  /* ground */
  --bg-page:      #080c08;   /* near-black, green-biased */
  --bg-deep:      #050805;
  --bg-white:     #101710;   /* card ground */
  --bg-elevated:  #162014;
  --panel-green:  #18200f;   /* the ponsfamily "graduated" panel green */

  /* ink */
  --text-primary: #f2f4ee;
  --text-muted:   rgba(242,244,238,.58);
  --text-subtle:  rgba(242,244,238,.40);
  --text-faint:   rgba(242,244,238,.28);

  /* accent (ponsfamily lime) */
  --accent:        #d4fc50;
  --accent-hover:  #e2ff66;
  --accent-soft:   #1c2610;
  --accent-mid:    #2a3a14;
  --accent-contrast:#111;
  --accent-line:   rgba(212,252,80,.28);

  /* deep green support */
  --green-deep:   #0d3b1e;
  --green-mid:    #16803c;
  --green-glow:   rgba(153,202,42,.16);

  /* glass */
  --glass-fill:      rgba(16,23,16,.72);
  --glass-border:    rgba(255,255,255,.09);
  --glass-highlight: inset 0 1px 0 rgba(232,255,153,.14);
  --glass-blur:      blur(18px) saturate(1.35);

  /* structure */
  --divider: rgba(242,244,238,.12);
  --radius-float: 28px;
  --radius-card:  24px;
  --radius-panel: 20px;
  --radius-inner: 12px;
  --radius-pill:  999px;
  --max-width:    1080px;
  --nav-height:   56px;

  /* motion */
  --ease-out:  cubic-bezier(.22,1,.36,1);
  --dur-fast:  .18s;
  --dur-norm:  .28s;

  /* shadows */
  --btn-glow:    0 8px 24px rgba(212,252,80,.28);
  --shadow-soft: 0 4px 24px rgba(0,0,0,.45);
  --shadow-card: 0 2px 12px rgba(0,0,0,.35);
}

/* Derived values that are not part of the published token table but are used
   everywhere. Kept separate so the block above stays byte-identical to spec. */
:root{
  --font-sans:  "Inter", "Inter Variable", system-ui, -apple-system, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono:  ui-monospace, "SF Mono", Menlo, monospace;

  --ring: 0 0 0 3px rgba(212,252,80,.28);
  --danger: #ff9a86;
  --warn:   #ffcf6b;

  /* z-scale. Background is 0, page content 1, everything else stacks above. */
  --z-bg: 0;
  --z-content: 1;
  --z-header: 40;
  --z-sheet: 60;
  --z-pop: 70;
  --z-toast: 90;
  --z-modal: 100;
}

/* ------------------------------------------------- 2. reset + document ground */

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

html{
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor targets clear the sticky header. */
  scroll-padding-top: calc(var(--nav-height) + 16px);
}

body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ol, ul{ margin: 0; }
ol, ul{ padding: 0; list-style: none; }

body{
  /* Explicit ground. Never transparent: the canvas sits behind it and the
     viewer's own backdrop must never bleed through. */
  background-color: var(--bg-page);
  background-image:
    radial-gradient(1200px 620px at 50% -10%, rgba(153,202,42,.10), rgba(0,0,0,0) 68%),
    radial-gradient(900px 520px at 100% 100%, rgba(13,59,30,.34), rgba(0,0,0,0) 70%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 22px;
  font-weight: 400;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* The body must never scroll sideways. `clip` (not `hidden`) so the sticky
   header keeps working: `overflow:hidden` would make body a scroll container
   and break position:sticky in every browser. */
html, body{ max-width: 100%; overflow-x: clip; }

img, svg, video, canvas, picture{ display: block; max-width: 100%; }
img, video{ height: auto; }

input, button, textarea, select{ font: inherit; color: inherit; }
button{ background: none; border: 0; padding: 0; cursor: pointer; }

a{ color: inherit; text-decoration: none; }
a:hover{ color: var(--accent); }

hr{ border: 0; border-top: 1px solid var(--divider); margin: 0; }

table{ border-collapse: collapse; border-spacing: 0; }

::selection{ background: var(--accent); color: var(--accent-contrast); }

::-webkit-scrollbar{ width: 10px; height: 10px; }
::-webkit-scrollbar-track{ background: transparent; }
::-webkit-scrollbar-thumb{
  background: rgba(242,244,238,.14);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover{ background: rgba(212,252,80,.3); background-clip: padding-box; }

/* One focus ring for the whole product. Outline (not box-shadow) so component
   shadows are never clobbered, and so it follows the border radius. */
:focus{ outline: none; }
:focus-visible{
  outline: 3px solid var(--accent-line);
  outline-offset: 2px;
}

/* ------------------------------------------ 3. background canvas + stacking */

#bg{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-bg);
  pointer-events: none;
  display: block;
}

/* Everything that is not the canvas sits above it. Direct children only, so
   the rule cannot fight with inner stacking contexts.
   The negation is wrapped in :where() so it contributes NO specificity. A bare
   `:not(#bg)` scores an id, which beat `#site-header{position:sticky}` and every
   `.uc-toasts` / `.modal-back` / `.hdr-sheet` `position:fixed` further down the
   file: the header stopped sticking and the overlays rendered in flow at the
   bottom of the page. This selector must stay weaker than what it lifts. */
body > *:not(:where(#bg)){
  position: relative;
  z-index: var(--z-content);
}

#site-header{
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}

/* --------------------------------------------------- 4. layout primitives */

.wrap{
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 20px;
}
.wrap-wide{
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: 20px;
}

.stack{ display: flex; flex-direction: column; gap: var(--gap, 16px); }
.row{ display: flex; align-items: center; gap: var(--gap, 12px); flex-wrap: wrap; }
.spread{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap, 16px);
  flex-wrap: wrap;
}

/* Column count is driven by three custom properties so pages never need to
   write their own media queries for a plain grid. */
.grid{
  display: grid;
  gap: var(--gap, 20px);
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
}

.section{ padding-block: clamp(56px, 9vw, 112px); }
.center{ text-align: center; }

.sr-only{
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------ 5. surfaces */

/* The signature panel. Recipe is fixed by the spec, do not retune. */
.glass{
  background-image:
    radial-gradient(circle at 14% 0%, rgba(212,252,80,.18), rgba(0,0,0,0) 52%),
    linear-gradient(145deg, var(--panel-green), var(--bg-white) 64%);
  border-radius: var(--radius-card);
  box-shadow:
    inset 0 1px 0 rgba(232,255,153,.18),
    0 0 0 1px rgba(212,252,80,.08),
    0 18px 40px rgba(0,0,0,.45);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* Flatter sibling: no green radial, for tiles and dense repeated surfaces. */
.glass-soft{
  background-color: var(--glass-fill);
  background-image: linear-gradient(150deg, rgba(24,32,15,.72), rgba(16,23,16,.72) 70%);
  border-radius: var(--radius-panel);
  box-shadow:
    var(--glass-highlight),
    0 0 0 1px var(--glass-border),
    var(--shadow-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.panel{
  background-color: var(--bg-white);
  border: 1px solid var(--divider);
  border-radius: var(--radius-panel);
}

.inset{
  background-color: rgba(0,0,0,.28);
  border-radius: var(--radius-inner);
}

.hairline{
  border: 0;
  border-top: 1px solid var(--divider);
  width: 100%;
  height: 0;
}
.dashed{
  border: 0;
  border-top: 1px dashed var(--divider);
  width: 100%;
  height: 0;
}

/* ---------------------------------------------------------------- 6. type */

.display{
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(36px, 6vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.h2{
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(30px, 4.4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.h3{
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.card-title{
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.lead{
  font-size: 17px;
  line-height: 26px;
  color: var(--text-muted);
  text-wrap: pretty;
}
.body{ font-size: 15px; line-height: 22px; }
.small{ font-size: 13px; line-height: 19px; }
.micro{
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-subtle);
}
.mono{ font-family: var(--font-mono); font-size: .95em; letter-spacing: -0.01em; }
.muted{ color: var(--text-muted); }
.subtle{ color: var(--text-subtle); }
.faint{ color: var(--text-faint); }
.accent{ color: var(--accent); }
.tnum{ font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ------------------------------------------------------------ 7. controls */

.btn{
  --btn-h: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--btn-h);
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background-color: transparent;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  text-align: center;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-norm) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.btn > svg{ flex: 0 0 auto; }
.btn:active{ transform: translateY(1px); }

.btn-primary{
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}
.btn-primary:hover{
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-contrast);
  box-shadow: var(--btn-glow);
}

.btn-ghost{
  background-color: rgba(255,255,255,.03);
  border-color: var(--glass-border);
  color: var(--text-primary);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
}
.btn-ghost:hover{
  background-color: rgba(212,252,80,.08);
  border-color: var(--accent-line);
  color: var(--text-primary);
}

.btn-quiet{
  background-color: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-quiet:hover{ color: var(--text-primary); background-color: rgba(255,255,255,.05); }

.btn-sm{ --btn-h: 32px; padding: 0 12px; font-size: 13px; }
.btn-block{ display: flex; width: 100%; }

.btn[disabled],
.btn[aria-disabled="true"]{
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  pointer-events: auto; /* keep the title/tooltip reachable */
}
.btn[disabled]:hover,
.btn[aria-disabled="true"]:hover{
  box-shadow: none;
  background-color: inherit;
}
.btn-primary[disabled]:hover{ background-color: var(--accent); }

.pill{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background-color: rgba(255,255,255,.04);
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
  white-space: nowrap;
}

.chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background-color: rgba(255,255,255,.03);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 18px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.chip:hover{ color: var(--text-primary); border-color: rgba(255,255,255,.18); }
.chip[aria-pressed="true"]{
  background-color: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.chip[disabled]{ opacity: .45; cursor: not-allowed; }

.input,
.textarea,
.select{
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: var(--radius-inner);
  border: 1px solid var(--divider);
  background-color: rgba(0,0,0,.28);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 20px;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
/* --text-faint composites to 2.3:1 over --bg-page, under the 3:1 floor. A
   placeholder is real instruction, not decoration, so it takes --text-subtle
   (3.5:1). The dotted leader rule below stays faint: it is a rule, not text. */
.input::placeholder,
.textarea::placeholder{ color: var(--text-subtle); }
.input:hover,
.textarea:hover,
.select:hover{ border-color: rgba(255,255,255,.2); }
.input:focus,
.textarea:focus,
.select:focus{ border-color: var(--accent-line); background-color: rgba(0,0,0,.4); }
.input[disabled],
.textarea[disabled],
.select[disabled]{ opacity: .5; cursor: not-allowed; }

.textarea{ min-height: 120px; resize: vertical; line-height: 22px; }

.select{
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  /* chevron, drawn inline so there is no extra request */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4fc50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}
.select option{ background-color: var(--bg-white); color: var(--text-primary); }

.range{
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  cursor: pointer;
}
.range::-webkit-slider-runnable-track{
  height: 6px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--green-mid), var(--accent));
  background-color: rgba(255,255,255,.1);
}
.range::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-page);
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.range::-moz-range-track{
  height: 6px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,.1);
}
.range::-moz-range-progress{
  height: 6px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--green-mid), var(--accent));
}
.range::-moz-range-thumb{
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-page);
}
.range:focus-visible{ outline-offset: 4px; }

/* Switch. Works both as a button[role=switch] and as an input[type=checkbox]. */
.toggle{
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--divider);
  background-color: rgba(0,0,0,.35);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.toggle::after{
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  width: 16px; height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  background-color: var(--text-subtle);
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.toggle[aria-checked="true"],
.toggle:checked{ background-color: var(--accent-mid); border-color: var(--accent-line); }
.toggle[aria-checked="true"]::after,
.toggle:checked::after{ transform: translateX(18px); background-color: var(--accent); }
.toggle[disabled]{ opacity: .45; cursor: not-allowed; }

.field{ display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label{
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-subtle);
}
.hint{ font-size: 13px; line-height: 18px; color: var(--text-subtle); }
.err{ font-size: 13px; line-height: 18px; color: var(--danger); }

/* ---------------------------------------------------------- 8. components */

.tag-live{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background-color: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 13px;
  text-transform: uppercase;
  letter-spacing: .1em;
  white-space: nowrap;
}

.tag-verified{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--accent);
  color: var(--accent-contrast);
}
.tag-verified > svg{ width: 11px; height: 11px; stroke-width: 3; }

.avatar{
  flex: 0 0 auto;
  width: var(--size, 40px);
  height: var(--size, 40px);
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--bg-elevated);
  overflow: hidden;
}

.avatar-stack{ display: flex; align-items: center; }
.avatar-stack > *{
  margin-left: -8px;
  border-radius: 50%;
  /* the ring is the page ground, so overlapping faces still read as separate */
  box-shadow: 0 0 0 2px var(--bg-page);
}
.avatar-stack > *:first-child{ margin-left: 0; }

.bar{
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background-color: rgba(255,255,255,.08);
  overflow: hidden;
}
.bar-fill{
  display: block;
  height: 100%;
  width: var(--v, 0%);
  max-width: 100%;
  border-radius: inherit;
  background-image: linear-gradient(90deg, var(--green-mid), var(--accent));
  /* the width transition is what lets a page animate the bar in on scroll */
  transition: width .9s var(--ease-out);
}

/* Dotted-leader receipt row: label, a rule that grows to fill, value.
   Markup: <div class="leader"><span>You pay</span><span class="leader-rule"></span><span>$400</span></div>
   A bare <i> also works as the rule. */
.leader{
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}
/* Shrinkable, not fixed: a long label and a long value ("Robinhood Chain gas"
   / "a fraction of a cent") together exceed a 360px card, and flex:0 0 auto
   would push the value past the viewport edge instead of letting it wrap. */
.leader > *{ flex: 0 1 auto; min-width: 0; }
.leader > .leader-rule,
.leader > i{
  flex: 1 1 auto;
  align-self: center;
  min-width: 14px;
  height: 0;
  border-bottom: 1px dotted var(--text-faint);
  /* nudge the rule off the baseline so it reads as a leader, not an underline */
  transform: translateY(-2px);
}
.leader > :first-child{ color: var(--text-muted); }
.leader > :last-child{ color: var(--text-primary); }

.dot{
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-subtle);
}
.dot-live{
  background-color: var(--accent);
  animation: uc-pulse 2.4s var(--ease-out) infinite;
}
@keyframes uc-pulse{
  0%   { box-shadow: 0 0 0 0 rgba(212,252,80,.45); }
  70%  { box-shadow: 0 0 0 7px rgba(212,252,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(212,252,80,0); }
}

.table{
  width: 100%;
  font-size: 14px;
  line-height: 20px;
  text-align: left;
}
.table th{
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-subtle);
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}
.table td{
  padding: 13px 14px;
  border-bottom: 1px solid var(--divider);
  color: var(--text-muted);
  vertical-align: middle;
}
.table td:first-child{ color: var(--text-primary); }
.table tbody tr:last-child td{ border-bottom: 0; }
.table tbody tr{ transition: background-color var(--dur-fast) var(--ease-out); }
.table tbody tr:hover{ background-color: rgba(255,255,255,.03); }
/* numerals line up */
.table .tnum, .table .mono, .table [data-num]{
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Wide tables scroll inside this, never on the body. */
.table-scroll{
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.table-scroll > .table{ min-width: 560px; }

.tile{
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  /* .tile carries its own glass-soft ground so it is usable on its own */
  background-color: var(--glass-fill);
  background-image: linear-gradient(150deg, rgba(24,32,15,.72), rgba(16,23,16,.72) 70%);
  border-radius: var(--radius-panel);
  box-shadow:
    var(--glass-highlight),
    0 0 0 1px var(--glass-border),
    var(--shadow-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.tile > .micro,
.tile > .tile-label{
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-subtle);
}
.tile > strong,
.tile > .tile-value{
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* Toasts. Stacked bottom-right, announced politely by the live region in ui.js. */
.uc-toasts{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toast{
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border-radius: var(--radius-inner);
  background-color: rgba(12,18,12,.94);
  box-shadow:
    var(--glass-highlight),
    0 0 0 1px var(--glass-border),
    var(--shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: 3px solid var(--text-subtle);
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
  animation: uc-toast-in var(--dur-norm) var(--ease-out) both;
}
.toast[data-leaving="true"]{ animation: uc-toast-out var(--dur-fast) var(--ease-out) both; }
.toast > span{ flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.toast > button{
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  margin-top: -1px;
  border-radius: 6px;
  color: var(--text-subtle);
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.toast > button:hover{ color: var(--text-primary); background-color: rgba(255,255,255,.08); }
.toast-ok{ border-left-color: var(--accent); }
.toast-warn{ border-left-color: var(--warn); }
.toast-err{ border-left-color: var(--danger); }

@keyframes uc-toast-in{
  from{ opacity: 0; transform: translateY(10px) scale(.98); }
  to  { opacity: 1; transform: none; }
}
@keyframes uc-toast-out{
  from{ opacity: 1; transform: none; }
  to  { opacity: 0; transform: translateY(6px) scale(.98); }
}

.modal-back{
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: 20px;
  background-color: rgba(4,7,4,.72);
  backdrop-filter: blur(8px) saturate(1.1);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  animation: uc-fade-in var(--dur-fast) var(--ease-out) both;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal{
  width: min(460px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px;
  /* signature glass, one step brighter */
  background-image:
    radial-gradient(circle at 14% 0%, rgba(212,252,80,.18), rgba(0,0,0,0) 52%),
    linear-gradient(145deg, var(--panel-green), var(--bg-white) 64%);
  background-color: var(--bg-white);
  border-radius: var(--radius-card);
  box-shadow:
    inset 0 1px 0 rgba(232,255,153,.18),
    0 0 0 1px rgba(212,252,80,.1),
    0 24px 60px rgba(0,0,0,.6);
  animation: uc-modal-in var(--dur-norm) var(--ease-out) both;
}
@keyframes uc-fade-in{ from{ opacity: 0 } to{ opacity: 1 } }
@keyframes uc-modal-in{
  from{ opacity: 0; transform: translateY(12px) scale(.985); }
  to  { opacity: 1; transform: none; }
}

/* The collapsing-description card ("door").
   Desktop: fixed height, description collapsed to 0fr, expands on hover or
   focus-within. The height is fixed rather than min-height so an expanding
   description squeezes the mock instead of resizing the whole grid row. */
.door{
  --door-h: 420px;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  padding: 20px;
  overflow: hidden;
  transition: box-shadow var(--dur-norm) var(--ease-out), transform var(--dur-norm) var(--ease-out);
}
.door:hover,
.door:focus-within{
  box-shadow:
    inset 0 1px 0 rgba(232,255,153,.22),
    0 0 0 1px rgba(212,252,80,.18),
    0 22px 48px rgba(0,0,0,.5);
}
.door-mock{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
}
.door-foot{
  flex: 0 0 auto;
  padding-top: 16px;
}
.door-foot > .card-title,
.door-foot > .h3{ margin-bottom: 0; }
.door-desc{
  display: grid;
  grid-template-rows: 1fr; /* no-JS / small screens default: readable */
  transition: grid-template-rows var(--dur-norm) var(--ease-out);
}
.door-desc > *{
  overflow: hidden;
  min-height: 0;
  padding-top: 8px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
}

.postcard{
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}
.postcard header,
.postcard .postcard-head{
  display: flex;
  align-items: center;
  gap: 10px;
}
.postcard header > .row,
.postcard .postcard-head > .row{ flex: 1 1 auto; min-width: 0; }
.postcard p,
.postcard .postcard-body{
  font-size: 16px;
  line-height: 24px;
  color: var(--text-primary);
  white-space: pre-line; /* the two-line body keeps its own line break */
  overflow-wrap: anywhere;
}
.postcard figure,
.postcard .postcard-media{
  position: relative;
  margin: 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-inner);
  overflow: hidden;
  background-color: rgba(0,0,0,.4);
}
.postcard figure > video,
.postcard figure > img,
.postcard .postcard-media > video,
.postcard .postcard-media > img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.empty{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 24px;
  border: 1px dashed var(--divider);
  border-radius: var(--radius-panel);
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 22px;
}
.empty > strong{
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.2;
  color: var(--text-primary);
}

/* -------------------------------------------------------------- 9. shell */
/* Header and footer markup is produced by ui.js. These classes belong to the
   shell only; pages never author them. */

.hdr{
  position: relative;
  height: var(--nav-height);
  background-color: rgba(8,12,8,.66);
  border-bottom: 1px solid transparent;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: background-color var(--dur-norm) var(--ease-out), border-color var(--dur-norm) var(--ease-out), box-shadow var(--dur-norm) var(--ease-out);
}
.hdr-scrolled{
  background-color: rgba(8,12,8,.86);
  border-bottom-color: var(--divider);
  box-shadow: 0 8px 28px rgba(0,0,0,.42);
}
.hdr-inner{
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}
.hdr-brand{
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  border-radius: 8px;
}
.hdr-brand:hover{ color: var(--text-primary); }
.hdr-brand > svg{ color: var(--accent); }
.hdr-nav{
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.hdr-link{
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.hdr-link:hover{ color: var(--text-primary); background-color: rgba(255,255,255,.05); }
.hdr-link[aria-current="page"]{ color: var(--accent); background-color: var(--accent-soft); }
.hdr-spacer{ flex: 1 1 auto; }
.hdr-actions{ display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.hdr-burger{
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  background-color: rgba(255,255,255,.03);
}
.hdr-burger:hover{ border-color: var(--accent-line); }

/* wallet pill */
.hdr-wallet{ position: relative; flex: 0 0 auto; }
.hdr-wallet-btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  background-color: var(--accent);
  color: var(--accent-contrast);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-norm) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.hdr-wallet-btn:hover{ background-color: var(--accent-hover); border-color: var(--accent-hover); box-shadow: var(--btn-glow); }
/* connected: quiet glass pill with a live dot */
.hdr-wallet-btn[data-state="connected"]{
  background-color: rgba(255,255,255,.04);
  border-color: var(--glass-border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: -0.01em;
}
.hdr-wallet-btn[data-state="connected"]:hover{
  background-color: rgba(212,252,80,.08);
  border-color: var(--accent-line);
  box-shadow: none;
}
/* wrong chain */
.hdr-wallet-btn[data-state="wrongchain"]{
  background-color: rgba(255,207,107,.1);
  border-color: rgba(255,207,107,.4);
  color: var(--warn);
  font-weight: 500;
}
.hdr-wallet-btn[data-state="wrongchain"]:hover{
  background-color: rgba(255,207,107,.16);
  border-color: rgba(255,207,107,.6);
  box-shadow: none;
  color: var(--warn);
}

.hdr-menu{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: var(--z-pop);
  min-width: 236px;
  padding: 6px;
  border-radius: var(--radius-inner);
  background-color: rgba(12,18,12,.96);
  box-shadow:
    var(--glass-highlight),
    0 0 0 1px var(--glass-border),
    var(--shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  animation: uc-menu-in var(--dur-fast) var(--ease-out) both;
}
@keyframes uc-menu-in{
  from{ opacity: 0; transform: translateY(-6px); }
  to  { opacity: 1; transform: none; }
}
.hdr-menu-head{
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 6px;
}
.hdr-menu-item{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.hdr-menu-item > svg{ flex: 0 0 auto; color: var(--text-subtle); }
.hdr-menu-item:hover{ background-color: rgba(255,255,255,.06); color: var(--text-primary); }
.hdr-menu-item:hover > svg{ color: var(--accent); }
.hdr-menu-item[data-tone="warn"]{ color: var(--warn); }
.hdr-menu-item[data-tone="warn"] > svg{ color: var(--warn); }
.hdr-menu-item[data-tone="danger"]{ color: var(--danger); }
.hdr-menu-item[data-tone="danger"] > svg{ color: var(--danger); }

/* mobile sheet */
.hdr-sheet{
  position: fixed;
  left: 12px;
  right: 12px;
  top: calc(var(--nav-height) + 8px);
  z-index: var(--z-sheet);
  padding: 10px;
  border-radius: var(--radius-panel);
  background-color: rgba(10,15,10,.97);
  box-shadow:
    var(--glass-highlight),
    0 0 0 1px var(--glass-border),
    var(--shadow-soft);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  animation: uc-menu-in var(--dur-fast) var(--ease-out) both;
}
.hdr-sheet a,
.hdr-sheet button{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 12px;
  border-radius: 10px;
  font-size: 15px;
  color: var(--text-muted);
  text-align: left;
}
.hdr-sheet a:hover,
.hdr-sheet button:hover{ background-color: rgba(255,255,255,.06); color: var(--text-primary); }
.hdr-sheet a[aria-current="page"]{ color: var(--accent); background-color: var(--accent-soft); }

/* provider picker rows, used inside modal() */
.uc-provider{
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-inner);
  border: 1px solid var(--divider);
  background-color: rgba(0,0,0,.24);
  text-align: left;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.uc-provider:hover{ border-color: var(--accent-line); background-color: rgba(212,252,80,.06); }
.uc-provider > img{ width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto; }
.uc-provider-name{ font-size: 15px; font-weight: 500; color: var(--text-primary); }

/* footer */
.ftr{
  margin-top: clamp(48px, 8vw, 96px);
  border-top: 1px solid var(--divider);
  background-color: rgba(5,8,5,.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.ftr-grid{
  display: grid;
  gap: 32px 24px;
  grid-template-columns: 1fr;
  padding-block: clamp(40px, 6vw, 64px);
}
.ftr-rail{ display: flex; flex-direction: column; gap: 12px; max-width: 320px; }
.ftr-wordmark{ font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.ftr-x{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
  width: fit-content;
  border-radius: 6px;
}
.ftr-x:hover{ color: var(--accent); }
.ftr-cols{
  display: grid;
  gap: 28px 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ftr-col{ display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ftr-col > h3{
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-subtle);
  margin-bottom: 2px;
}
.ftr-col a,
.ftr-col button{
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
  text-align: left;
  width: fit-content;
  border-radius: 4px;
  transition: color var(--dur-fast) var(--ease-out);
}
.ftr-col a:hover,
.ftr-col button:hover{ color: var(--accent); }
.ftr-bottom{
  border-top: 1px solid var(--divider);
  padding-block: 18px;
  text-align: center;
  font-size: 12px;
  line-height: 18px;
  color: var(--text-subtle);
}

/* --------------------------------------------------- 10. state + reveal */

.is-hidden{ display: none !important; }

.is-busy{
  position: relative;
  pointer-events: none;
  opacity: .7;
}
.is-busy::after{
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid rgba(242,244,238,.25);
  border-top-color: var(--accent);
  animation: uc-spin .7s linear infinite;
}
@keyframes uc-spin{ to{ transform: rotate(360deg); } }

/* Reveal. Hidden state is gated behind `.js` on <html>, which ui.js adds the
   moment it evaluates. With scripting off the content is simply visible. */
.reveal{ opacity: 1; transform: none; }
.js .reveal{
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
}
.js .reveal.in{ opacity: 1; transform: none; }

/* -------------------------------------- 11. responsive + reduced motion */

@media (min-width: 640px){
  .grid{ grid-template-columns: repeat(var(--cols-sm, var(--cols, 1)), minmax(0, 1fr)); }
  .ftr-cols{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px){
  .grid{ grid-template-columns: repeat(var(--cols-lg, var(--cols-sm, var(--cols, 1))), minmax(0, 1fr)); }

  /* the door only collapses where there is a real hover pointer and room */
  .door{ height: var(--door-h); min-height: var(--door-h); }
  .door-desc{ grid-template-rows: 0fr; }
  .door:hover .door-desc,
  .door:focus-within .door-desc{ grid-template-rows: 1fr; }

  .ftr-grid{ grid-template-columns: minmax(240px, 1.25fr) 3fr; align-items: start; }
}

@media (max-width: 639.98px){
  .hdr-nav{ display: none; }
  .hdr-book{ display: none; }
  .hdr-burger{ display: inline-flex; }
  .hdr-inner{ gap: 10px; }
  .hdr-brand{ font-size: 15px; }
  .hdr-wallet-btn{ padding: 0 11px; font-size: 12px; }
  .uc-toasts{ right: 12px; left: 12px; bottom: 12px; width: auto; }
  .modal-back{ padding: 12px; align-items: end; }
  .modal{ width: 100%; padding: 18px; }
  .section{ padding-block: 56px; }
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto !important; }
  *, *::before, *::after{
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  /* the interactive background is motion by definition, so it goes entirely */
  #bg{ display: none !important; }
  .js .reveal{ opacity: 1; transform: none; }
}

/* Very small phones: give the shell a little more room by trimming gutters. */
@media (max-width: 380px){
  .wrap, .wrap-wide{ padding-inline: 14px; }
  .door{ padding: 16px; }
}
