/* Ephemera interface. Every value comes from the brand standards manual v1.0:
   §33 design tokens, §9 color, §10–11 type, §12 grid/spacing, §13 images,
   §14 icons, §15 continuity language, §16 motion, §21 accessibility, §24 print. */

/* ------------------------------------------------------------ tokens (§33) */
:root {
  --ephemera-archive-ivory: #F3F0E8;
  --ephemera-carbon: #111111;
  --ephemera-continuity-green: #173A2E;
  --ephemera-paper-gray: #D9D5CC;
  --ephemera-catalog-gray: #706D67;
  --ephemera-soft-black: #292929;
  --ephemera-record-red: #D94A2B;

  /* §10.4: brand family first, then the manual's operational fallbacks. */
  --ephemera-font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --ephemera-font-sans: "IBM Plex Sans", Arial, Helvetica, sans-serif;
  --ephemera-font-mono: "IBM Plex Mono", "Courier New", monospace;

  --ephemera-space-1: 4px;
  --ephemera-space-2: 8px;
  --ephemera-space-3: 16px;
  --ephemera-space-4: 24px;
  --ephemera-space-5: 32px;
  --ephemera-space-6: 48px;
  --ephemera-space-7: 64px;
  --ephemera-space-8: 96px;
  --ephemera-space-9: 128px;

  /* Roles. Catalog Gray on Archive Ivory is 4.5:1 (AA for text); it is never
     placed on Paper Gray. Record Red (3.7:1) is used for graphics only (§21.1). */
  --field: var(--ephemera-archive-ivory);
  --ink: var(--ephemera-carbon);
  --ink-soft: var(--ephemera-soft-black);
  --meta: var(--ephemera-catalog-gray);
  --rule: var(--ephemera-paper-gray);
  --control: var(--ephemera-catalog-gray); /* 3:1+ boundary for inputs (§21.1) */
  --accent: var(--ephemera-continuity-green);
  --on-accent: var(--ephemera-archive-ivory);
  --current: var(--ephemera-record-red);

  --measure: 70ch; /* §11.3: 65–75 characters */
  color-scheme: light;
}

/* ------------------------------------------------------------ base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--field); color: var(--ink);
  font-family: var(--ephemera-font-sans); font-weight: 400; font-size: 16px; line-height: 1.55;
}
.wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 var(--ephemera-space-5); }
@media (max-width: 640px) { .wrap { padding: 0 20px; } }
main { flex: 1; outline: none; }
main.wrap { padding-top: var(--ephemera-space-6); padding-bottom: var(--ephemera-space-8); }

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0 0 var(--ephemera-space-3); max-width: var(--measure); }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }
code, .mono { font-family: var(--ephemera-font-mono); font-size: .875em; }
[hidden] { display: none !important; }
hr, .rule { border: 0; border-top: 1px solid var(--rule); margin: var(--ephemera-space-5) 0; }

/* §11 hierarchy */
.display {
  font-family: var(--ephemera-font-serif); font-weight: 400;
  font-size: clamp(3rem, 7vw, 7.5rem); line-height: .96; letter-spacing: -.02em;
}
.title { /* editorial section heading, 32–56px */
  font-family: var(--ephemera-font-serif); font-weight: 400;
  font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1.02; letter-spacing: -.01em;
}
.heading { /* functional section heading, IBM Plex Sans Medium 24–40px */
  font-family: var(--ephemera-font-sans); font-weight: 500; font-size: 24px; line-height: 1.25;
}
.label { /* §11.4 */
  font-family: var(--ephemera-font-sans); font-weight: 500; font-size: 12px; line-height: 1.4;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink);
}
.meta { font-size: 14px; color: var(--meta); }
.muted { color: var(--meta); }
.small { font-size: 14px; }
.serif { font-family: var(--ephemera-font-serif); }
.loading { color: var(--meta); padding: var(--ephemera-space-6) 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* §14 icons */
.icon { width: 1.125em; height: 1.125em; flex: none; vertical-align: -.2em; fill: none; stroke: currentColor;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon path { vector-effect: non-scaling-stroke; }

/* ------------------------------------------------------------ header / footer */
.site-header { border-bottom: 1px solid var(--rule); background: var(--field); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--ephemera-space-3);
  min-height: 64px; flex-wrap: wrap; padding-top: var(--ephemera-space-2); padding-bottom: var(--ephemera-space-2); }
/* Logo artwork comes only from the approved masters in /brand (§4). At 48px
   tall the mark is ~27px (min 24px) and the wordmark ~127px (min 110px), §6;
   the masters include their own 0.5X clear space (§5). */
.site-logo { display: block; line-height: 0; }
.site-logo img { display: block; height: 48px; width: auto; }
.nav { display: flex; align-items: center; gap: var(--ephemera-space-4); flex-wrap: wrap; }
.nav > a { color: var(--ink); text-decoration: none; font-size: 15px; }
.nav > a:hover { text-decoration: underline; }
.wallet { display: flex; gap: var(--ephemera-space-3); align-items: center; }
.site-footer { border-top: 1px solid var(--rule); padding: var(--ephemera-space-5) 0 var(--ephemera-space-6); }
.site-footer .wrap { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--ephemera-space-5); row-gap: var(--ephemera-space-3); }
.site-footer .sig { grid-column: span 5; }
.site-footer .about { grid-column: span 7; }
.site-footer p { margin: 0 0 var(--ephemera-space-1); }
@media (max-width: 1024px) { .site-footer .sig, .site-footer .about { grid-column: 1 / -1; } }

/* ------------------------------------------------------------ controls */
button, .btn {
  font: inherit; font-size: 15px; font-weight: 500; line-height: 1.3; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: var(--ephemera-space-2);
  padding: var(--ephemera-space-2) var(--ephemera-space-3); min-height: 40px;
  border-radius: 2px; border: 1px solid var(--ink); background: transparent; color: var(--ink);
}
button:hover, .btn:hover { background: var(--ink); color: var(--field); }
button:disabled { border-color: var(--rule); color: var(--meta); background: transparent; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); }
.btn-quiet { border-color: transparent; padding-left: 0; padding-right: 0; }
.btn-quiet:hover { background: transparent; color: var(--ink); text-decoration: underline; }
.btn-sm { min-height: 32px; padding: var(--ephemera-space-1) var(--ephemera-space-2); font-size: 14px; }
.btn-quiet.btn-sm { padding-left: 0; padding-right: 0; }
.btn-row { display: flex; gap: var(--ephemera-space-2); flex-wrap: wrap; align-items: center; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--field); width: 100%;
  border: 1px solid var(--control); border-radius: 2px; padding: var(--ephemera-space-2) 12px; min-height: 40px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
label, .field-label { display: block; margin-bottom: var(--ephemera-space-1);
  font-weight: 500; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.field { margin-bottom: var(--ephemera-space-3); }
.hint { font-size: 14px; color: var(--meta); margin-top: var(--ephemera-space-1); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ephemera-space-3); }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.radio-row { display: flex; gap: var(--ephemera-space-4); flex-wrap: wrap; }
.radio-row label { display: flex; gap: var(--ephemera-space-2); align-items: center; text-transform: none; letter-spacing: 0; font-size: 16px; font-weight: 400; }
.radio-row input { width: auto; min-height: 0; }

/* Status markers: always text plus icon or shape, never color alone (§21.2). */
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-weight: 500; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.status .icon { width: 16px; height: 16px; }
.point { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.point.current { background: var(--current); }

/* §28/§21: calm notices with an icon and a left rule. */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px var(--ephemera-space-3);
  border: 1px solid var(--rule); border-left: 2px solid var(--ink); margin-bottom: var(--ephemera-space-4); font-size: 15px; max-width: none; }
.notice .icon { margin-top: 2px; }
.notice.info { border-left-color: var(--accent); }
.notice.attention { border-left-color: var(--current); }
.empty { color: var(--meta); padding: var(--ephemera-space-4) 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }

/* ------------------------------------------------------------ layout grid (§12.2) */
.grid12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--ephemera-space-5); row-gap: var(--ephemera-space-4); }
.span-12 { grid-column: 1 / -1; }
.span-8 { grid-column: span 8; }
.span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }
.span-9 { grid-column: span 9; }
@media (max-width: 1024px) { /* tablet: 8 columns */
  .grid12 { grid-template-columns: repeat(8, minmax(0, 1fr)); column-gap: var(--ephemera-space-4); }
  .span-8, .span-7, .span-9, .span-12 { grid-column: 1 / -1; }
  .span-5, .span-4 { grid-column: span 4; }
  .span-3 { grid-column: span 3; }
}
@media (max-width: 640px) { /* mobile: 4 columns */
  .grid12 { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--ephemera-space-3); }
  .span-5, .span-4, .span-3 { grid-column: 1 / -1; }
}
.section { margin-top: var(--ephemera-space-7); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--ephemera-space-3); flex-wrap: wrap;
  padding-bottom: var(--ephemera-space-2); border-bottom: 1px solid var(--rule); margin-bottom: var(--ephemera-space-4); }
.section-head p { margin: 0; }

/* ------------------------------------------------------------ home (§17.2, §31.1) */
.hero { padding: var(--ephemera-space-4) 0 var(--ephemera-space-7); border-bottom: 1px solid var(--rule); text-align: center; }
/* §4.4 primary lockup, centred as drawn. The margin tops up the master's
   built-in space to at least 0.75X (§5). At 640px wide the tagline in the
   artwork is ~13.6px; below 720px the horizontal lockup is used instead and
   the tagline is set as running copy (§4.5, §6). */
.hero-lockup { margin: var(--ephemera-space-2) auto var(--ephemera-space-3); line-height: 0; }
.hero-lockup img { display: block; width: min(640px, 100%); height: auto; margin: 0 auto; }
.hero .tagline { font-family: var(--ephemera-font-serif); font-style: italic; font-size: 20px; line-height: 1.3; margin: 0 auto var(--ephemera-space-3); }
.hero .idea { font-size: 18px; line-height: 1.55; margin: 0 auto var(--ephemera-space-5); }
@media (min-width: 720px) {
  .hero .tagline { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 719px) {
  .hero-lockup img { width: min(340px, 100%); }
}
.cobrand { margin-bottom: var(--ephemera-space-2); }
.cobrand .title { margin: var(--ephemera-space-1) 0 var(--ephemera-space-2); }
.search { display: flex; gap: var(--ephemera-space-2); max-width: 720px; }
.search input { flex: 1; }
.open-form { display: grid; grid-template-columns: minmax(0, 1fr) 180px auto; gap: var(--ephemera-space-3); align-items: end; max-width: 720px; }
@media (max-width: 640px) { .open-form { grid-template-columns: 1fr 1fr; } .open-form .span { grid-column: 1 / -1; } }
/* Records list: filters, order and pages. */
.list-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 240px)); gap: var(--ephemera-space-3); margin-bottom: var(--ephemera-space-2); }
@media (max-width: 640px) { .list-controls { grid-template-columns: 1fr; gap: 0; } }
#records[aria-busy="true"] .records { opacity: .5; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: var(--ephemera-space-3); flex-wrap: wrap;
  margin-top: var(--ephemera-space-6); padding-top: var(--ephemera-space-3); border-top: 1px solid var(--rule); }
.pager-jump { display: flex; align-items: center; gap: var(--ephemera-space-2); }
.pager-jump label { margin: 0; }
.pager-jump input { width: 88px; }

/* Catalog entries, not marketplace cards (§13.5, §17.1). */
.records { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--ephemera-space-5) var(--ephemera-space-4); }
.record { display: block; color: inherit; text-decoration: none; }
.record .img { aspect-ratio: 1; background: var(--rule); overflow: hidden; display: grid; place-items: center;
  font-family: var(--ephemera-font-serif); font-size: 24px; color: var(--ink); }
.record .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.record .caption { padding-top: 12px; border-top: 1px solid var(--rule); margin-top: 12px; }
.record .caption .meta, .record .caption .status { display: flex; }
.record .caption .name { display: block; font-family: var(--ephemera-font-serif); font-size: 20px; line-height: 1.25; margin: var(--ephemera-space-1) 0; }
.record:hover .name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ------------------------------------------------------------ token archive page (§17.3, §31.2) */
.token-intro { align-items: start; margin-bottom: var(--ephemera-space-6); }
.object-image { aspect-ratio: 1; background: var(--rule); overflow: hidden; display: grid; place-items: center;
  font-family: var(--ephemera-font-serif); font-size: 32px; color: var(--ink); }
.object-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.token-intro .title { margin: var(--ephemera-space-2) 0 var(--ephemera-space-4); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--ephemera-space-3) var(--ephemera-space-4);
  margin: 0 0 var(--ephemera-space-4); padding: var(--ephemera-space-3) 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.facts dt { margin-bottom: var(--ephemera-space-1); }
.facts dd { margin: 0; display: flex; align-items: center; gap: var(--ephemera-space-2); overflow-wrap: anywhere; }
.record-span { font-family: var(--ephemera-font-serif); font-size: 20px; margin-bottom: var(--ephemera-space-2); }
.intro-text { font-size: 18px; }
.tabs { display: flex; gap: var(--ephemera-space-4); border-bottom: 1px solid var(--rule); margin: var(--ephemera-space-6) 0 var(--ephemera-space-5); overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--ink);
  padding: var(--ephemera-space-2) 0; white-space: nowrap; min-height: 0; font-weight: 400; }
.tabs button:hover { background: none; color: var(--ink); border-bottom-color: var(--rule); }
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); font-weight: 500; }
.tabs .count { font-family: var(--ephemera-font-mono); font-size: 13px; color: var(--meta); margin-left: 6px; }

/* §17.5 ownership timeline overview: one uninterrupted rule, discrete
   segments, transfer moments, artifacts placed against their period. */
.thread { margin-bottom: var(--ephemera-space-6); }
.thread-track { position: relative; height: 56px; margin: 0 6px; }
.thread-line { position: absolute; left: 0; right: 0; top: 27px; height: 2px; background: var(--accent); transform-origin: left center; }
.thread-seg { position: absolute; top: 18px; height: 20px; border-left: 1px solid var(--ink); }
.thread-seg:first-child { border-left: 0; }
.thread-transfer { position: absolute; top: 22px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: var(--field); border: 2px solid var(--accent); }
.thread-artifact { position: absolute; top: 4px; width: 8px; height: 8px; margin-left: -4px; background: var(--ink); border-radius: 0; }
.thread-artifact.private { background: var(--field); border: 1px solid var(--ink); }
a.thread-artifact:focus-visible { outline-offset: 3px; }
.thread-now { position: absolute; top: 21px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--current); }
.thread-labels { position: relative; height: 40px; margin: 0 6px; }
.thread-labels span { position: absolute; top: 0; white-space: nowrap; font-size: 12px; }
.thread-labels .end { transform: translateX(-100%); }
.thread-key { display: flex; gap: var(--ephemera-space-4); flex-wrap: wrap; font-size: 14px; color: var(--meta); }
.thread-key span { display: inline-flex; align-items: center; gap: var(--ephemera-space-2); }
.key-artifact { width: 8px; height: 8px; background: var(--ink); display: inline-block; }
.key-private { width: 8px; height: 8px; border: 1px solid var(--ink); display: inline-block; }
.key-transfer { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); display: inline-block; }

/* Ownership periods: a continuous thread down the left edge. */
.periods { position: relative; }
.period { position: relative; padding-left: var(--ephemera-space-5); padding-bottom: var(--ephemera-space-6); }
.period::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 0; width: 2px; background: var(--accent); }
.period:last-child::before { bottom: auto; height: calc(100% - 8px); }
.period.ended:last-child::before { height: 100%; }
.period-marker { position: absolute; left: 0; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--field); border: 2px solid var(--accent); }
.period.current .period-marker { background: var(--current); border-color: var(--current); }
.period-head { margin-bottom: var(--ephemera-space-4); }
.period-head h3 { font-family: var(--ephemera-font-serif); font-weight: 400; font-size: 28px; line-height: 1.15; margin: var(--ephemera-space-1) 0; }
.transfer { font-size: 14px; color: var(--meta); display: flex; gap: var(--ephemera-space-2); flex-wrap: wrap; align-items: center; }
.items { display: grid; gap: 0; border-top: 1px solid var(--rule); }

/* §17.4 artifact cards */
.artifact { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: var(--ephemera-space-4); padding: var(--ephemera-space-4) 0; border-bottom: 1px solid var(--rule); }
.artifact.no-thumb { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 640px) { .artifact { grid-template-columns: 96px minmax(0, 1fr); gap: var(--ephemera-space-3); } }
.artifact-thumb { aspect-ratio: 1; background: var(--rule); overflow: hidden; display: grid; place-items: center; color: var(--ink); padding: 0; border: 0; border-radius: 0; min-height: 0; width: 100%; }
.artifact-thumb:hover { background: var(--rule); }
.artifact-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.artifact-thumb .icon { width: 32px; height: 32px; }
.artifact-type { display: flex; justify-content: space-between; gap: var(--ephemera-space-2); flex-wrap: wrap; margin-bottom: var(--ephemera-space-1); }
.artifact h4 { font-family: var(--ephemera-font-serif); font-weight: 600; font-size: 22px; line-height: 1.25; margin: 0 0 var(--ephemera-space-1); }
.artifact .byline { font-size: 14px; color: var(--meta); margin-bottom: var(--ephemera-space-2); max-width: var(--measure); }
.artifact .byline a { color: var(--meta); }
.artifact .caption { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: var(--ephemera-space-2); max-width: var(--measure); }
.artifact .caption.story { font-family: var(--ephemera-font-serif); font-size: 18px; line-height: 1.6; }
.artifact .tech { font-size: 14px; color: var(--meta); margin-top: var(--ephemera-space-1); }
.artifact-actions { display: flex; gap: var(--ephemera-space-2); flex-wrap: wrap; margin-top: var(--ephemera-space-3); }
.revisions { font-size: 14px; color: var(--meta); margin-top: var(--ephemera-space-2); border-left: 1px solid var(--rule); padding-left: 12px; }
/* §13.4 private placeholder: a controlled field, never the private image. */
.private-thumb { aspect-ratio: 1; border: 1px solid var(--ink); display: grid; place-items: center; align-content: center; gap: var(--ephemera-space-1); text-align: center; }
.private-thumb .icon { width: 28px; height: 28px; }
.artifact-detail img { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; margin: 0 auto var(--ephemera-space-3); background: var(--rule); }

/* §29 change requests */
.request { padding: var(--ephemera-space-4) 0; border-bottom: 1px solid var(--rule); }
.request:first-child { border-top: 1px solid var(--rule); }
.request dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--ephemera-space-3) var(--ephemera-space-4); margin: var(--ephemera-space-3) 0; }
.request dd { margin: var(--ephemera-space-1) 0 0; overflow-wrap: anywhere; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ephemera-space-3); margin: var(--ephemera-space-3) 0; }
@media (max-width: 640px) { .compare { grid-template-columns: 1fr; } }
.compare > div { padding: 12px var(--ephemera-space-3); border: 1px solid var(--rule); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.compare > div.requested { border-color: var(--ink); border-style: dashed; }
.compare .label { display: block; margin-bottom: var(--ephemera-space-1); }

/* tables (§12.4 rules) */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 12px var(--ephemera-space-2) 12px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 500; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; border-bottom-color: var(--ink); }
.table-wrap { overflow-x: auto; }

/* ------------------------------------------------------------ dialogs */
dialog { border: 1px solid var(--ink); border-radius: 2px; background: var(--field); color: var(--ink); padding: 0;
  width: min(720px, calc(100vw - 40px)); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgb(17 17 17 / .5); }
.dlg { padding: var(--ephemera-space-5); }
@media (max-width: 640px) { .dlg { padding: 20px; } }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: var(--ephemera-space-3);
  padding-bottom: var(--ephemera-space-3); margin-bottom: var(--ephemera-space-4); border-bottom: 1px solid var(--rule); }
.dlg-head .close { min-height: 40px; min-width: 40px; justify-content: center; padding: 0; border-color: transparent; }
.preview-box { display: flex; gap: var(--ephemera-space-3); align-items: center; padding: 12px; border: 1px solid var(--rule); }
.preview-box img { width: 96px; height: 96px; object-fit: cover; }
.wallet-list { display: grid; gap: var(--ephemera-space-2); }
.wallet-list button, .wallet-list .btn { justify-content: flex-start; padding: 12px var(--ephemera-space-3); border-color: var(--rule); font-weight: 400; }
.wallet-list button:hover, .wallet-list .btn:hover { background: transparent; color: var(--ink); border-color: var(--ink); }
.wallet-list img, .wallet-icon { width: 28px; height: 28px; flex: none; display: grid; place-items: center; }
.wallet-name { display: flex; flex-direction: column; text-align: left; line-height: 1.3; }
.wallet-name small { color: var(--meta); font-size: 14px; }
.wallet-section { margin: var(--ephemera-space-4) 0 var(--ephemera-space-2); }
.wallet-status { margin-top: var(--ephemera-space-3); padding: var(--ephemera-space-3); border: 1px solid var(--accent); }
.delegate-note { max-width: none; margin: var(--ephemera-space-4) 0 0; padding-top: var(--ephemera-space-3); border-top: 1px solid var(--rule); }

/* toast: text plus an icon for the state (§21.2) */
#toast { position: fixed; bottom: var(--ephemera-space-4); left: 50%; transform: translateX(-50%); z-index: 50;
  display: flex; gap: var(--ephemera-space-2); align-items: flex-start; background: var(--ink); color: var(--field);
  padding: 12px var(--ephemera-space-3); border-radius: 2px; border-left: 4px solid var(--accent);
  font-size: 15px; max-width: calc(100vw - 40px); opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
#toast.error { border-left-color: var(--current); }
#toast .icon { margin-top: 2px; }

/* ------------------------------------------------------------ profile */
.profile-head { display: flex; gap: var(--ephemera-space-4); align-items: center; margin-bottom: var(--ephemera-space-5); flex-wrap: wrap; }
.avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center;
  font-family: var(--ephemera-font-serif); font-size: 32px; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.list { display: grid; border-top: 1px solid var(--rule); }
.list-row { display: flex; gap: var(--ephemera-space-3); align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule); text-decoration: none; color: inherit; }
.list-row:hover strong { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.list-row .thumb { width: 56px; height: 56px; flex: none; background: var(--rule); display: grid; place-items: center; overflow: hidden; }
.list-row .thumb img, .list-row .thumb .img { width: 100%; height: 100%; object-fit: cover; }
.list-row .thumb .img { display: grid; place-items: center; font-size: 14px; }
.editor { margin: var(--ephemera-space-4) 0; padding: var(--ephemera-space-4) 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); max-width: 720px; }
details summary { cursor: pointer; font-weight: 500; }

/* ------------------------------------------------------------ yearbook (§24) */
.yearbook { max-width: 960px; margin: 0 auto; }
.yb-toolbar { display: flex; gap: var(--ephemera-space-2); justify-content: space-between; align-items: center; margin-bottom: var(--ephemera-space-5); flex-wrap: wrap; }
.yb-cover { padding: var(--ephemera-space-7) 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin-bottom: var(--ephemera-space-6); }
.yb-cover .object-image { width: 280px; max-width: 100%; margin-bottom: var(--ephemera-space-5); }
.yb-cover .title { margin: var(--ephemera-space-2) 0 var(--ephemera-space-3); }
.yb-signature { margin-top: var(--ephemera-space-6); }
.yb-signature img { display: block; height: 48px; width: auto; margin-bottom: var(--ephemera-space-2); }
.yb-cover dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--ephemera-space-3); margin: var(--ephemera-space-5) 0 0; }
.yb-cover dd { margin: var(--ephemera-space-1) 0 0; }
.yb-toc { padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.yb-toc li { display: flex; justify-content: space-between; gap: var(--ephemera-space-3); padding: 12px 0; border-bottom: 1px solid var(--rule); break-inside: avoid; }
.yb-chapter { margin: var(--ephemera-space-7) 0; }
.yb-chapter-head { border-top: 1px solid var(--ink); padding-top: var(--ephemera-space-3); margin-bottom: var(--ephemera-space-4); display: flex; gap: var(--ephemera-space-3); align-items: center; }
.yb-chapter-head .avatar { width: 64px; height: 64px; font-size: 24px; }
.yb-chapter-head h2 { font-family: var(--ephemera-font-serif); font-weight: 400; font-size: 32px; line-height: 1.1; margin: var(--ephemera-space-1) 0; }
.yb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ephemera-space-4); align-items: start; }
@media (max-width: 640px) { .yb-grid { grid-template-columns: 1fr; } }
.yb-item { break-inside: avoid; border-top: 1px solid var(--rule); padding-top: 12px; }
.yb-item.wide { grid-column: 1 / -1; }
.yb-item img { display: block; max-width: 100%; max-height: 320px; width: auto; margin-bottom: var(--ephemera-space-2); }
.yb-item h3 { font-family: var(--ephemera-font-serif); font-size: 20px; line-height: 1.25; margin: var(--ephemera-space-1) 0; }
.yb-item .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.yb-item .text.story { font-family: var(--ephemera-font-serif); }
.yb-item .source { font-size: 14px; overflow-wrap: anywhere; margin-top: var(--ephemera-space-1); }
.yb-appendix { margin-top: var(--ephemera-space-7); }
.yb-appendix h2 { margin-bottom: var(--ephemera-space-3); }

/* ------------------------------------------------------------ motion (§16) */
@keyframes thread-reveal { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.thread-line { animation: thread-reveal 1000ms cubic-bezier(.4, 0, .2, 1) both; }
.thread-artifact, .thread-transfer, .thread-now { animation: fade-in 400ms ease-out 600ms both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------ print (§24) */
@page {
  size: auto; margin: 18mm 16mm 20mm;
  @bottom-left { content: "Ephemera \2014 The permanent record of temporary moments."; font-family: "IBM Plex Sans", Arial, sans-serif; font-size: 8pt; color: #111; }
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font-family: "IBM Plex Sans", Arial, sans-serif; font-size: 8pt; color: #111; }
}
@media print {
  /* Black, grayscale or Carbon + Continuity Green only; photographs keep their color. */
  :root { --field: #fff; --meta: #444; --rule: #bbb; --current: #111; color-scheme: light; }
  body { background: #fff; font-size: 10.5pt; }
  main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .no-print, .site-header, .site-footer, .yb-toolbar, #toast { display: none !important; }
  .yb-cover { border: 0; min-height: 88vh; display: flex; flex-direction: column; justify-content: center; break-after: page; }
  .yb-toc-page { break-after: page; }
  .yb-chapter { break-before: page; margin-top: 0; }
  .yb-appendix { break-before: page; }
  a { color: inherit; text-decoration: none; }
  .yb-item .source a::after { content: " (" attr(href) ")"; word-break: break-all; }
  .avatar { background: none; border: 1px solid #111; color: #111; }
}
