/* tastemaker · macrostructure: App shell (cabinet / vitrine) · mood: elegant · page: journal
 * arc: n/a (tool, not landing) · nav: running-head skin-bar · hero: none · footer: colophon
 * knobs: accession-bleed / catalog-cards / drawer-tab-filters / bone-tickets-on-felt
 * palette: elegant/dark/triadic · seed 8 · base hue 33 · accent hue 153 · contrast: pass (matrix)
 * critique: ShowTell 5 · Phil 5 · Hier 5 · Spec 5 · Restr 4 · Var 5
 *
 * STYLE LOCK — AEM Cognitive Mirror / tastemaker skin
 * Mood: Elegant / editorial, dark — Wunderkammer, not cream folio, not indigo SaaS.
 * Palette:
 *   --text #feeeea · --bg #150f0d · --surface #211a18 · --primary #966b62
 *   --on-primary #ffffff · --secondary #372a27 · --accent #84a98e · --border #2d2624
 *   --muted #c8b4ac · --ticket #efe4d8 · --ticket-ink #150f0d · --caution #6e2d26
 *   --brass #c9a36a · --sage #6d8a78 · --clay #d2b8ae · --fog #b8c4b0
 * Type: EB Garamond (display/body) + DM Mono (indices). No Inter.
 * Radius: 0. Hairlines. Tickets are bone paper on walnut; graph is a felt case.
 * Motion: app-shell only — 120–240ms; drawer 280ms. GSAP entrance stagger.
 * Do not: indigo #6366f1, purple-pink mesh, Inter-on-white cards, rounded-full, letter-in-box,
 *   shared pictograph graph marks, Velocity/Outreach pill clones, cream folio spread.
 *
 * Color contract (check_contrast.py --matrix, seed 8 + extras):
 *   Text-safe: text/bg, text/surface, ticket-ink/ticket, primary/on-primary, bg/accent,
 *              bg/muted, caution/on-caution, bg/brass, bg/fog, bg/clay, bg/sage
 *   UI-safe: bg/primary, surface/primary, primary/border, ticket/sage
 *   Decorative only: bg/border, surface/border, text/accent, primary/accent, text/ticket
 *
 * CREDITS (code only): Iconify fluent (pin, history, copy, add, subtract, dismiss,
 *   speaker-2, folder) fetched then replaced by inlined currentColor marks.
 *   Attribution-free.
 */

:root {
  --text: #feeeea;
  --bg: #150f0d;
  --surface: #211a18;
  --primary: #966b62;
  --on-primary: #ffffff;
  --secondary: #372a27;
  --accent: #84a98e;
  --border: #2d2624;
  --muted: #c8b4ac;
  --ticket: #efe4d8;
  --ticket-ink: #150f0d;
  --caution: #6e2d26;
  --on-caution: #feeeea;
  --brass: #c9a36a;
  --sage: #6d8a78;
  --clay: #d2b8ae;
  --fog: #b8c4b0;
  --felt: #100b0a;
  --font-display: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --font-body: "EB Garamond", "Iowan Old Style", Palatino, serif;
  --font-mono: "DM Mono", "IBM Plex Mono", ui-monospace, monospace;
  --radius-sm: 0;
  --radius-md: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-cross: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --duration-press: 120ms;
  --duration-panel: 240ms;
  --duration-drawer: 280ms;
  --focus-ring: 2px solid var(--accent);
  --felt-dots: radial-gradient(circle at 1px 1px, rgba(254, 238, 234, 0.08) 1px, transparent 1.2px);
}

html,
body {
  overflow-x: clip;
}

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

body.skin-tastemaker {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ico {
  display: block;
  flex: 0 0 auto;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  background: var(--primary);
  color: var(--on-primary);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

button,
textarea,
a {
  transition: color var(--duration-press) var(--ease-out),
    background-color var(--duration-press) var(--ease-out),
    border-color var(--duration-press) var(--ease-out),
    opacity var(--duration-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled),
  .btn-ghost:hover,
  .btn-ctrl:hover,
  .catalog-card:hover,
  .filter-btn:hover {
    transform: translateY(-1px);
    transition: transform var(--duration-press) var(--ease-out),
      color var(--duration-press) var(--ease-out),
      background-color var(--duration-press) var(--ease-out),
      border-color var(--duration-press) var(--ease-out);
  }
}

.btn-primary:active:not(:disabled),
.btn-ghost:active,
.btn-ctrl:active,
.catalog-card:active,
.filter-btn:active {
  transform: translateY(1px);
}

/* --- Running head ------------------------------------------------------- */

.skin-bar {
  background: var(--felt);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.skin-bar a {
  color: var(--muted);
  white-space: nowrap;
  padding: var(--space-2) var(--space-2);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.skin-bar a:hover {
  color: var(--text);
}

.skin-bar a[aria-current="page"] {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* --- Mast / accession --------------------------------------------------- */

.mast {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--space-6);
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-6);
}

.mast-identity {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  margin-top: 6px;
  color: var(--accent);
}

.brand-mark svg {
  display: block;
  width: 28px;
  height: 28px;
}

.index-line {
  margin: 0 0 var(--space-1);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.mast h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  min-width: 0;
}

.sub {
  margin: var(--space-2) 0 0;
  max-width: 28ch;
  color: var(--muted);
  font-style: italic;
}

.accession {
  position: absolute;
  right: 8%;
  top: 18px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 14vw, 9rem);
  line-height: 0.75;
  font-weight: 500;
  color: var(--secondary);
  pointer-events: none;
  transform: rotate(-6deg);
  letter-spacing: -0.04em;
  z-index: 0;
}

.accession span {
  font-family: var(--font-mono);
  font-size: 0.38em;
  letter-spacing: 0.08em;
  margin-left: 0.12em;
  color: var(--primary);
}

.header-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: flex-end;
}

.badge {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 6px 10px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  background: var(--surface);
}

.btn-ghost,
.btn-ctrl,
.drawer-head button,
.drawer-footer button,
.history-item-del {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  min-height: 44px;
  padding: 0 var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  white-space: nowrap;
}

.btn-ghost:hover,
.btn-ctrl:hover,
.drawer-head button:hover,
.drawer-footer button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-primary {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--primary);
  color: var(--on-primary);
  border: 0;
  min-height: 44px;
  padding: 0 var(--space-6);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-audio {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--ticket-ink);
  color: var(--ticket);
  border: 0;
  min-height: 44px;
  padding: 0 var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  white-space: nowrap;
}

.btn-audio.playing {
  background: var(--caution);
  color: var(--on-caution);
}

/* --- Cabinet ------------------------------------------------------------ */

.cabinet {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-6) var(--space-12);
  display: grid;
  gap: var(--space-8);
}

.safety-banner {
  display: none;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--caution);
  color: var(--on-caution);
  font-size: 16px;
}

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

.safe-badge,
.safety-alert {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.safe-badge {
  color: var(--accent);
}

.safety-alert {
  color: var(--clay);
}

/* --- Slip --------------------------------------------------------------- */

.slip {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: var(--space-6);
  display: grid;
  gap: var(--space-4);
}

.slip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: baseline;
  justify-content: space-between;
}

.meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.slip-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.1;
}

.catalog {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}

.catalog-card {
  text-align: left;
  background: var(--ticket);
  color: var(--ticket-ink);
  border: 0;
  padding: var(--space-3);
  min-height: 108px;
  display: grid;
  gap: 4px;
  align-content: start;
  cursor: pointer;
  font: inherit;
}

.catalog-mark {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--caution);
}

.catalog-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
}

.catalog-line {
  font-size: 13px;
  line-height: 1.35;
  color: var(--ticket-ink);
  opacity: 0.72;
}

.field-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

#thoughtInput {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  background: var(--felt);
  color: var(--text);
  border: 1px solid var(--border);
  padding: var(--space-4);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.55;
}

#thoughtInput::placeholder {
  color: var(--muted);
  font-style: italic;
}

.compose-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
}

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

#pipelineProgress {
  display: none;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}

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

.pipeline-bar {
  width: 72px;
  height: 2px;
  background: var(--secondary);
  position: relative;
  overflow: hidden;
}

.pipeline-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  background: var(--accent);
  animation: ink-run 240ms var(--ease-cross) infinite;
}

@keyframes ink-run {
  from { transform: translateX(-100%); }
  to { transform: translateX(280%); }
}

/* --- Tickets ------------------------------------------------------------ */

.tickets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
}

.ticket {
  position: relative;
  background: var(--ticket);
  color: var(--ticket-ink);
  padding: var(--space-6);
  display: grid;
  gap: var(--space-3);
  min-height: 280px;
}

.ticket .index-line {
  color: var(--caution);
}

.ticket h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.65rem;
  line-height: 1.1;
}

.ticket .card-body {
  min-height: 8.5rem;
  font-size: 17px;
  line-height: 1.5;
}

.ticket .placeholder-text .rule {
  display: block;
  height: 1px;
  margin-top: 14px;
  background: rgba(21, 15, 13, 0.18);
}

.ticket .placeholder-text .rule.short {
  width: 62%;
}

.ticket-pin {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border: 1.5px solid var(--caution);
  background: var(--ticket);
  border-radius: 50%;
  box-shadow: 0 10px 0 -5px var(--ticket-ink);
}

.ticket .btn-ghost {
  color: var(--ticket-ink);
  border-color: rgba(21, 15, 13, 0.22);
  width: fit-content;
}

.ticket .btn-ghost:hover {
  color: var(--caution);
  border-color: var(--caution);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* --- Vitrine ------------------------------------------------------------ */

.vitrine {
  display: grid;
  gap: var(--space-4);
}

.vitrine-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: end;
}

.vitrine-caption {
  margin: var(--space-2) 0 0;
  max-width: 42ch;
  color: var(--muted);
  font-style: italic;
}

.vitrine h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.1;
}

.vitrine-body {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: var(--space-4);
  align-items: stretch;
}

.canvas-filters {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.filter-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  min-height: 44px;
  padding: 0 var(--space-3);
  cursor: pointer;
  white-space: nowrap;
}

.filter-btn:last-child {
  border-bottom: 1px solid var(--border);
}

.filter-btn.active {
  background: var(--ticket);
  color: var(--ticket-ink);
  border-color: var(--ticket);
}

.canvas-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

#canvasWrapper {
  min-height: 420px;
  height: 52vh;
  background-color: var(--felt);
  background-image: var(--felt-dots);
  background-size: 14px 14px;
  border: 1px solid var(--border);
}

.crop {
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 2;
}

.crop.tl { top: 8px; left: 8px; border-top: 1px solid var(--brass); border-left: 1px solid var(--brass); }
.crop.tr { top: 8px; right: 8px; border-top: 1px solid var(--brass); border-right: 1px solid var(--brass); }
.crop.bl { bottom: 8px; left: 8px; border-bottom: 1px solid var(--brass); border-left: 1px solid var(--brass); }
.crop.br { bottom: 8px; right: 8px; border-bottom: 1px solid var(--brass); border-right: 1px solid var(--brass); }

.vitrine-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: var(--space-3);
  justify-items: center;
  pointer-events: none;
  z-index: 1;
  color: var(--muted);
  font-style: italic;
}

.vitrine-empty[hidden] {
  display: none;
}

.empty-pin {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
}

.canvas-tooltip {
  background: var(--ticket);
  color: var(--ticket-ink);
  padding: var(--space-3);
  border: 1px solid var(--ticket-ink);
  font-size: 14px;
}

#tooltipTitle {
  font-family: var(--font-display);
  font-size: 18px;
}

#tooltipMeta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 4px 0;
}

.graph-hud {
  position: absolute;
  left: var(--space-3);
  bottom: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fog);
  z-index: 2;
}

/* --- Sleeves ------------------------------------------------------------ */

.history-backdrop {
  background: rgba(21, 15, 13, 0.62);
}

.history-drawer {
  background: var(--ticket);
  color: var(--ticket-ink);
  border-left: 1px solid var(--ticket-ink);
}

.history-drawer .drawer-head,
.history-drawer .drawer-footer {
  border-color: rgba(21, 15, 13, 0.16);
}

.drawer-head {
  border-bottom: 1px solid rgba(21, 15, 13, 0.16);
}

.drawer-head strong {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
}

.drawer-footer {
  border-top: 1px solid rgba(21, 15, 13, 0.16);
}

.history-drawer button {
  color: var(--ticket-ink);
  border-color: rgba(21, 15, 13, 0.22);
}

.history-item {
  border-bottom: 1px solid rgba(21, 15, 13, 0.12);
}

.history-item:hover {
  background: rgba(21, 15, 13, 0.04);
}

.history-empty {
  padding: var(--space-8) var(--space-4);
  font-style: italic;
  color: rgba(21, 15, 13, 0.62);
}

.colophon {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-6);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

@media (max-width: 880px) {
  .catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tickets,
  .vitrine-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .canvas-filters {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .filter-btn {
    border-bottom: 1px solid var(--border);
    flex: 1 1 auto;
  }

  .accession {
    right: 4%;
    font-size: clamp(3.4rem, 18vw, 6rem);
  }
}

@media (max-width: 40rem) {
  .mast,
  .cabinet,
  .colophon {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .catalog,
  .tickets {
    grid-template-columns: minmax(0, 1fr);
  }

  .mast {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .accession {
    transform: none;
  }
}
