/* Night Sheet — Garden IA wearing Meng To / Design+Code
   Skills: vantajs, atmosphere-background, glass-dark-ui, beautiful-shadows,
   staggered-word-reveal, cinematic-scroll-storytelling (GSAP optional, no Lenis),
   progressive-blur. Sheet + spine + catalog + four bands + slip stay. */

:root {
  --bg-0: #07040c;
  --bg-1: #120814;
  --ink: #f6f0e8;
  --copy: #c9b8a8;
  --mute: #8a7a72;
  --hair: rgba(243, 217, 168, 0.16);
  --line-strong: rgba(246, 240, 232, 0.28);
  --accent: #f3d9a8;
  --accent-2: #b8a4ff;
  --teal: #7edcc4;
  --glass: rgba(18, 8, 22, 0.52);
  --glass-strong: rgba(12, 6, 16, 0.82);
  --safe: #7edcc4;
  --caution: #f4c4b0;
  --display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Sora", "SF Pro Display", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 32px;
  --space-4: 48px;
  --space-5: 96px;
  --sheet: 560px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fade: 720ms var(--ease);
  --shadow-md:
    0 0 0 1px rgba(0, 0, 0, 0.08),
    0 1px 1px -0.5px rgba(0, 0, 0, 0.08),
    0 3px 3px -1.5px rgba(0, 0, 0, 0.08),
    0 6px 6px -3px rgba(0, 0, 0, 0.08),
    0 12px 12px -6px rgba(0, 0, 0, 0.08),
    0 24px 24px -12px rgba(0, 0, 0, 0.16);
  --shadow-lg:
    0 2.8px 2.2px rgba(0, 0, 0, 0.04),
    0 6.7px 5.3px rgba(0, 0, 0, 0.055),
    0 12.5px 10px rgba(0, 0, 0, 0.07),
    0 22.3px 17.9px rgba(0, 0, 0, 0.085),
    0 41.8px 33.4px rgba(0, 0, 0, 0.1),
    0 100px 80px rgba(0, 0, 0, 0.28);
}

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

html {
  background: var(--bg-0);
  scroll-behavior: smooth;
}

body.skin-garden-mengto {
  margin: 0;
  min-height: 100vh;
  min-width: 320px;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: -0.011em;
  text-wrap: pretty;
  background:
    radial-gradient(42rem 28rem at 18% 8%, rgba(184, 164, 255, 0.16), transparent 62%),
    radial-gradient(36rem 30rem at 86% 12%, rgba(243, 217, 168, 0.1), transparent 58%),
    linear-gradient(180deg, #140818, var(--bg-0) 48%, #040208);
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea,
input {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #120814;
  font: 600 13px/1 var(--sans);
}

.skip-link:focus {
  top: 16px;
}

/* ── Atmosphere ── */

#vantaField,
#foldField {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#vantaField {
  background:
    radial-gradient(40rem 26rem at 16% 10%, rgba(184, 164, 255, 0.18), transparent 64%),
    radial-gradient(34rem 28rem at 84% 6%, rgba(243, 217, 168, 0.12), transparent 60%),
    radial-gradient(46rem 34rem at 72% 92%, rgba(126, 220, 196, 0.08), transparent 62%),
    #07040c;
}

#foldField {
  display: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, transparent 42%, rgba(4, 2, 8, 0.55) 100%);
}

.gradient-blur {
  position: fixed;
  z-index: 70;
  inset: 0 0 auto 0;
  height: 11%;
  pointer-events: none;
}

.gradient-blur > div,
.gradient-blur::before,
.gradient-blur::after {
  position: absolute;
  inset: 0;
}

.gradient-blur::before {
  content: "";
  z-index: 1;
  backdrop-filter: blur(0.5px);
  -webkit-backdrop-filter: blur(0.5px);
  mask: linear-gradient(to top, transparent 0%, #000 12.5%, #000 25%, transparent 37.5%);
}

.gradient-blur > div:nth-of-type(1) { z-index: 2; backdrop-filter: blur(1px); -webkit-backdrop-filter: blur(1px); mask: linear-gradient(to top, transparent 12.5%, #000 25%, #000 37.5%, transparent 50%); }
.gradient-blur > div:nth-of-type(2) { z-index: 3; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); mask: linear-gradient(to top, transparent 25%, #000 37.5%, #000 50%, transparent 62.5%); }
.gradient-blur > div:nth-of-type(3) { z-index: 4; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); mask: linear-gradient(to top, transparent 37.5%, #000 50%, #000 62.5%, transparent 75%); }
.gradient-blur > div:nth-of-type(4) { z-index: 5; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); mask: linear-gradient(to top, transparent 50%, #000 62.5%, #000 75%, transparent 87.5%); }
.gradient-blur > div:nth-of-type(5) { z-index: 6; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); mask: linear-gradient(to top, transparent 62.5%, #000 75%, #000 87.5%, transparent 100%); }
.gradient-blur > div:nth-of-type(6) { z-index: 7; backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px); mask: linear-gradient(to top, transparent 75%, #000 87.5%, #000 100%); }

.gradient-blur::after {
  content: "";
  z-index: 8;
  backdrop-filter: blur(48px);
  -webkit-backdrop-filter: blur(48px);
  mask: linear-gradient(to top, transparent 87.5%, #000 100%);
}

/* ── Folio as glass pills ── */

.folio-nav {
  position: relative;
  z-index: 80;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  width: fit-content;
  max-width: calc(100% - 28px);
  margin: 14px auto 0;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(rgba(10, 5, 14, 0.78), rgba(10, 5, 14, 0.78)) padding-box,
    linear-gradient(120deg, rgba(243, 217, 168, 0.42), rgba(184, 164, 255, 0.28), rgba(255, 255, 255, 0.06)) border-box;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.folio-nav a {
  color: var(--copy);
  padding: 8px 11px;
  border-radius: 999px;
  border-bottom: 0;
  transition: color 160ms var(--ease), background 160ms var(--ease), transform 160ms var(--ease);
}

.folio-nav a:hover {
  color: var(--ink);
  background: rgba(243, 217, 168, 0.08);
}

.folio-nav a[aria-current="page"] {
  color: #120814;
  background: var(--accent);
  border-bottom-color: transparent;
}

.folio-nav a:focus-visible,
button:focus-visible,
textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, white);
  outline-offset: 3px;
}

/* ── Desk: emptiness around a glass sheet ── */

.desk {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0;
  width: 100%;
  padding: 72px 48px 200px;
}

.spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 48px;
  padding-top: 48px;
  margin-right: 28px;
  flex-shrink: 0;
}

.iris {
  display: block;
  width: 18px;
  height: 18px;
  margin-bottom: 28px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background:
    radial-gradient(circle at 50% 50%, #120814 28%, transparent 30%),
    conic-gradient(from 20deg, var(--accent), transparent 28%, var(--accent-2), transparent 62%, var(--accent));
  box-shadow: 0 0 18px rgba(243, 217, 168, 0.35);
}

.spine-word {
  margin: 0;
  writing-mode: vertical-rl;
  font-family: var(--display);
  font-size: 18px;
  font-style: italic;
  letter-spacing: 0.28em;
  color: var(--ink);
}

.spine-sku {
  margin: 28px 0 0;
  writing-mode: vertical-rl;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mute);
}

.sheet {
  position: relative;
  width: min(var(--sheet), 100%);
  padding: 44px 36px 52px;
}

.glass-shell {
  position: relative;
  border: 1px solid transparent;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)),
    var(--glass);
  background-clip: padding-box;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.glass-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(145deg, rgba(243, 217, 168, 0.38), rgba(184, 164, 255, 0.26) 48%, rgba(255, 255, 255, 0.05));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ── Film-gate crop marks ── */

.crop {
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  border: 1px solid var(--line-strong);
}

.crop::before,
.crop::after {
  content: none;
}

.crop-tl { top: -10px; left: -22px; border-right: 0; border-bottom: 0; }
.crop-tr { top: -10px; right: -22px; border-left: 0; border-bottom: 0; }
.crop-bl { bottom: -10px; left: -22px; border-right: 0; border-top: 0; }
.crop-br { bottom: -10px; right: -22px; border-left: 0; border-top: 0; }

/* ── Mast ── */

.mast {
  padding-bottom: 64px;
}

.word-latin {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}

h1 {
  margin: 0;
  max-width: 10ch;
  font-family: var(--display);
  font-size: clamp(40px, 7vw, 64px);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.lede {
  margin: 24px 0 0;
  max-width: 38ch;
  color: var(--copy);
  font-size: 16px;
  line-height: 1.6;
}

.mast-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
}

.badge,
#statusBadge {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--copy);
}

.mast-meta .text-btn {
  margin-left: auto;
}

/* ── Bands ── */

.band {
  padding: 56px 0 0;
  border-top: 1px solid var(--hair);
}

.band-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 20px;
}

.num {
  font-family: var(--display);
  font-size: 28px;
  font-style: italic;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--accent);
}

.band-name,
.section-kicker,
.section-label span {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}

.meta,
#historyLinkStatus,
#safetyIndicator {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--mute);
}

#historyLinkStatus {
  margin-left: auto;
}

.aside {
  margin: 0 0 24px;
  color: var(--mute);
  font-size: 13px;
  letter-spacing: 0.01em;
}

/* ── Catalog: still product lines ── */

.catalog {
  list-style: none;
  margin: 0 0 36px;
  padding: 0;
}

.catalog li + li {
  border-top: 1px solid var(--hair);
}

.catalog-item {
  display: flex;
  align-items: baseline;
  gap: 20px;
  width: 100%;
  padding: 14px 0;
  border: 0;
  background: none;
  text-align: left;
  border-radius: 0;
  transition: color 200ms var(--ease), transform 200ms var(--ease);
}

.catalog-item:hover,
.catalog-item:focus-visible {
  color: var(--ink);
  outline: none;
}

.catalog-item:hover .catalog-name {
  color: var(--accent);
}

.sku {
  flex: 0 0 56px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}

.catalog-name {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.02em;
  transition: color 200ms var(--ease);
}

/* ── Field ── */

.field-label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}

textarea#thoughtInput {
  display: block;
  width: 100%;
  min-height: 168px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--hair);
  border-radius: 18px;
  background: rgba(4, 2, 8, 0.55);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  resize: vertical;
  outline: none;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

textarea#thoughtInput::placeholder {
  color: var(--mute);
}

textarea#thoughtInput:focus {
  border-color: rgba(243, 217, 168, 0.5);
  box-shadow: 0 0 0 4px rgba(184, 164, 255, 0.16);
}

.compose-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.hint {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--mute);
}

/* ── Controls ── */

.btn-primary {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: #120814;
  background: var(--accent);
  box-shadow: 0 16px 36px rgba(243, 217, 168, 0.16);
  font: 600 15px/1 var(--sans);
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), filter 180ms var(--ease);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 44px rgba(243, 217, 168, 0.22);
  filter: brightness(1.04);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled,
.btn-primary.is-busy {
  opacity: 0.55;
  cursor: wait;
  transform: none;
  filter: none;
}

.btn-ctrl,
.btn-audio,
.drawer-head button,
.drawer-footer button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink);
  background:
    linear-gradient(rgba(10, 5, 14, 0.55), rgba(10, 5, 14, 0.55)) padding-box,
    linear-gradient(135deg, rgba(243, 217, 168, 0.38), rgba(184, 164, 255, 0.2), rgba(255, 255, 255, 0.04)) border-box;
  font: 500 13px/1 var(--sans);
  box-shadow: none;
  transition: transform 160ms var(--ease), background 160ms var(--ease), color 160ms var(--ease);
}

.btn-ctrl:hover,
.btn-audio:hover,
.drawer-head button:hover,
.drawer-footer button:hover {
  background:
    linear-gradient(rgba(243, 217, 168, 0.1), rgba(243, 217, 168, 0.1)) padding-box,
    linear-gradient(135deg, rgba(243, 217, 168, 0.55), rgba(184, 164, 255, 0.32), rgba(255, 255, 255, 0.08)) border-box;
}

.text-btn {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--copy);
  box-shadow: none;
  transition: border-color 200ms var(--ease), color 200ms var(--ease);
}

.text-btn:hover,
.text-btn:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--accent);
  outline: none;
}

/* ── Pipeline: hidden until JS ── */

#pipelineProgress,
.pipeline-progress {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px dashed rgba(243, 217, 168, 0.28);
  border-radius: 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

#pipelineProgress[style*="flex"] {
  display: flex;
}

#pipelineProgress::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(243, 217, 168, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

/* ── Safety ── */

#safetyBanner,
.safety-banner {
  display: none;
  padding: 14px 16px;
  margin: 0;
  border: 1px solid rgba(244, 196, 176, 0.4);
  border-radius: 16px;
  background: rgba(120, 40, 32, 0.22);
  color: var(--caution);
  font-size: 15px;
  box-shadow: none;
}

.safety-banner.caution {
  display: flex;
}

.safety-banner.safe-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid rgba(126, 220, 196, 0.3);
  border-radius: 999px;
  background: rgba(126, 220, 196, 0.1);
  color: var(--safe);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.safety-alert {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid rgba(244, 196, 176, 0.36);
  border-radius: 999px;
  background: rgba(180, 70, 50, 0.16);
  color: var(--caution);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

#safetyIndicator {
  min-height: 0;
}

/* ── The field ── */

.field-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.canvas-filters,
.canvas-controls,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.filter-btn {
  padding: 8px 12px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(rgba(10, 5, 14, 0.4), rgba(10, 5, 14, 0.4)) padding-box,
    linear-gradient(135deg, rgba(243, 217, 168, 0.22), rgba(184, 164, 255, 0.12)) border-box;
  color: var(--copy);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.filter-btn:hover {
  color: var(--ink);
}

.filter-btn.active {
  color: #120814;
  background: var(--accent);
  border-color: transparent;
}

.btn-ctrl {
  min-width: 36px;
  padding: 0 12px;
  text-align: center;
}

#canvasWrapper,
.canvas-wrapper {
  position: relative;
  width: 100%;
  min-height: 420px;
  height: 48vh;
  overflow: hidden;
  border: 1px solid var(--hair);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 40%, rgba(184, 164, 255, 0.1), transparent 46%),
    radial-gradient(circle at 78% 88%, rgba(243, 217, 168, 0.08), transparent 40%),
    #0a0610;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#graphCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#canvasWrapper:active #graphCanvas {
  cursor: grabbing;
}

#canvasTooltip,
.canvas-tooltip {
  display: none;
  position: absolute;
  z-index: 20;
  max-width: 260px;
  padding: 14px 16px;
  pointer-events: none;
  background: rgba(12, 6, 16, 0.9);
  color: var(--ink);
  border: 1px solid var(--hair);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

#tooltipTitle {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

#tooltipTitle .tooltip-mark {
  margin-right: 8px;
  font-family: var(--display);
  font-style: italic;
  color: var(--accent);
}

#tooltipMeta {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}

#tooltipSnippet {
  margin-top: 8px;
  color: var(--copy);
  font-size: 13px;
  line-height: 1.45;
}

#graphHud,
.graph-hud {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 8px 12px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: rgba(10, 5, 14, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--copy);
  pointer-events: none;
}

#graphHud span span {
  color: var(--ink);
  letter-spacing: 0;
}

/* ── Return / reverse ── */

.card {
  background: none;
  border-radius: 0;
  box-shadow: none;
}

.card-body {
  margin: 0 0 24px;
  min-height: 96px;
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.placeholder-text {
  color: var(--mute);
  opacity: 1;
}

.btn-audio .mark-audio {
  width: 16px;
  height: 16px;
  display: block;
}

.btn-audio.loading {
  opacity: 0.7;
}

.btn-audio.playing {
  color: #120814;
  background: var(--accent);
  border-color: transparent;
}

#audioBtnIcon {
  display: inline-flex;
  color: currentColor;
}

.soundwave {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.soundwave span {
  width: 2px;
  height: 100%;
  background: currentColor;
  animation: wave 0.72s ease-in-out infinite;
}

.soundwave span:nth-child(2) { animation-delay: 0.12s; }
.soundwave span:nth-child(3) { animation-delay: 0.24s; }
.soundwave span:nth-child(4) { animation-delay: 0.36s; }

/* ── History as a glass slip ── */

#historyBackdrop,
.history-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 2, 8, 0.58);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 90;
}

#historyBackdrop.open,
.history-backdrop.open {
  display: block;
  animation: fade-in 560ms var(--ease);
}

#historyDrawer,
.history-drawer {
  position: fixed;
  top: 12vh;
  left: 50%;
  width: min(360px, calc(100% - 48px));
  margin-left: calc(min(360px, 100% - 48px) / -2);
  height: auto;
  max-height: 76vh;
  z-index: 95;
  display: flex;
  flex-direction: column;
  transform: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 480ms var(--ease), visibility 0s linear 480ms;
}

#historyDrawer.open,
.history-drawer.open {
  transform: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 480ms var(--ease), visibility 0s;
}

.history-drawer .crop-tl { top: -10px; left: -18px; }
.history-drawer .crop-tr { top: -10px; right: -18px; }
.history-drawer .crop-bl { bottom: -10px; left: -18px; }
.history-drawer .crop-br { bottom: -10px; right: -18px; }

.drawer-head,
.drawer-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 28px 28px 14px;
}

.drawer-head {
  border-bottom: 1px solid var(--hair);
}

.slip-kicker {
  flex: 1 0 100%;
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
}

.drawer-head strong {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.03em;
}

.drawer-footer {
  border-top: 1px solid var(--hair);
  padding: 14px 28px 28px;
}

#drawerList,
.drawer-list {
  flex: 1;
  overflow: auto;
  padding: 0 28px;
}

.history-empty {
  padding: 40px 0;
  color: var(--mute);
  font-family: var(--display);
  font-size: 22px;
  font-style: italic;
}

.history-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--hair);
  cursor: pointer;
  transition: background 160ms var(--ease), opacity var(--fade);
}

.history-item:hover {
  opacity: 1;
  background: transparent;
}

.history-item:hover .history-item-preview {
  color: var(--ink);
}

.history-item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}

.history-item-preview {
  margin-top: 8px;
  font-size: 14px;
  color: var(--copy);
  line-height: 1.45;
}

.history-item-del {
  border: 0;
  background: transparent;
  color: var(--mute);
  cursor: pointer;
  padding: 0 0 0 8px;
}

/* ── Colophon ── */

.colophon {
  position: relative;
  z-index: 2;
  width: min(calc(var(--sheet) + 80px), calc(100% - 64px));
  margin: 0 auto;
  padding: 0 0 80px;
  border-top: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
}

.colophon p {
  margin: 16px 0 0;
}

/* ── Word reveal ── */

.word-reveal {
  visibility: visible;
}

html.js .word-reveal[data-word-reveal]:not(.is-ready) {
  opacity: 0;
}

.word-reveal__word {
  display: inline-block;
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition:
    opacity 0.8s var(--ease),
    transform 0.8s var(--ease);
  transition-delay: calc(var(--word-index) * 0.07s);
}

.word-reveal.is-visible .word-reveal__word {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes wave {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  html.js .word-reveal[data-word-reveal]:not(.is-ready),
  .word-reveal__word {
    opacity: 1;
    transform: none;
  }

  .btn-primary:hover {
    transform: none;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-shell,
  .folio-nav,
  #canvasTooltip,
  #graphHud {
    background: var(--glass-strong);
  }
}

@media (max-width: 720px) {
  .desk {
    flex-direction: column;
    padding: 40px 20px 140px;
  }

  .spine {
    flex-direction: row;
    align-items: center;
    width: 100%;
    margin: 0 0 24px;
    padding: 0;
    gap: 14px;
  }

  .spine-word,
  .spine-sku {
    writing-mode: horizontal-tb;
    letter-spacing: 0.16em;
  }

  .iris {
    margin: 0;
  }

  .sheet {
    padding: 32px 22px 40px;
  }

  .crop-tl,
  .crop-bl,
  .history-drawer .crop-tl,
  .history-drawer .crop-bl { left: 6px; }

  .crop-tr,
  .crop-br,
  .history-drawer .crop-tr,
  .history-drawer .crop-br { right: 6px; }

  h1 {
    font-size: 36px;
  }

  .mast {
    padding-bottom: 40px;
  }

  .band {
    padding-top: 40px;
  }

  .mast-meta .text-btn {
    margin-left: 0;
  }

  .folio-nav {
    justify-content: flex-start;
    border-radius: 20px;
    margin: 12px 12px 0;
    max-width: calc(100% - 24px);
  }

  .colophon {
    width: calc(100% - 40px);
  }
}
