/* V2 features, drawn in the original room: warm black, ivory, champagne. */

[hidden] { display: none !important; }

button, input, select, a { -webkit-tap-highlight-color: transparent; }
button, a, input, select { touch-action: manipulation; }

select {
  font: inherit;
  color: inherit;
  color-scheme: dark;
  background: #121210;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}

input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
  height: 4px;
  cursor: pointer;
}

dialog { color: var(--ink); }
dialog::backdrop {
  background: rgba(8, 8, 7, 0.72);
  backdrop-filter: blur(10px);
}

html { scroll-padding-top: calc(var(--nav-h) + 16px); }
section[id],
article[id],
.pointer-term[id],
#magnetic, #following-eyes, #object-follow, #tilt-card {
  scroll-margin-top: calc(var(--nav-h) + 20px);
}

/* ---------- nav extras ---------- */

.nav-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-soft);
  background: transparent;
}
.nav-search svg { width: 14px; height: 14px; }
.nav-search kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-dim);
}
.nav-search:hover { background: var(--bg-elev-2); color: var(--ink); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
}
.text-link:hover { color: var(--accent); }

/* ---------- hero with studio ---------- */

.hero-inner {
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  align-items: center;
  column-gap: 56px;
  row-gap: 36px;
}

.hero-copy .kicker { margin: 0 0 18px; }
.hero .display { white-space: normal; }
.hero .lede {
  max-width: 34em;
  margin: 0;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-dim);
}
.hero-meta strong {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 13px;
  color: var(--accent);
  margin-right: 4px;
}
.hero-meta i {
  width: 1px;
  height: 12px;
  background: var(--line-strong);
}

.hero-bottom {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
  font-size: 12px;
  color: var(--ink-dim);
}
.hero-bottom a {
  color: var(--ink-soft);
  text-decoration: none;
}
.hero-bottom a:hover { color: var(--accent); }

.motion-studio {
  min-width: 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  opacity: 0;
  animation: fade-up var(--d-lg) var(--ease-out) 0.9s forwards;
}
.studio-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
}
.studio-top .kicker { margin: 0; }
.studio-live {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-dim);
}
.studio-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.studio-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 20px 0;
}
.studio-tabs button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-dim);
}
.studio-tabs button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.studio-canvas {
  position: relative;
  height: 220px;
  margin: 16px 20px 0;
  display: grid;
  place-items: center;
  background: #0e0e0c;
  border-radius: 14px;
  overflow: hidden;
}
.canvas-corner {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  z-index: 1;
}
.top-left { top: 12px; left: 14px; }
.bottom-left { left: 14px; bottom: 12px; }
.bottom-right { right: 14px; bottom: 12px; }
.canvas-cross { display: none; }

.demo-objects {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.demo-object {
  width: 72px;
  height: 96px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  position: relative;
  display: grid;
  place-items: center;
}
.demo-object span {
  position: absolute;
  left: 8px;
  top: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--bg);
  opacity: 0.55;
}
.demo-object i {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
}
.demo-object:nth-child(2) { opacity: 0.78; }
.demo-object:nth-child(3) { opacity: 0.56; }
.demo-object:nth-child(2) i { border-radius: 4px; }
.demo-object:nth-child(3) i {
  width: 36px;
  height: 16px;
  border-radius: 99px;
}

.studio-canvas[data-mode="spring"] .demo-objects { gap: 0; }
.studio-canvas[data-mode="spring"] .demo-object {
  width: 88px;
  height: 88px;
  border-radius: 50%;
}
.studio-canvas[data-mode="spring"] .demo-object:not(:first-child) { display: none; }
.studio-canvas[data-mode="fade"] .demo-object:not(:first-child) { display: none; }
.studio-canvas[data-mode="fade"] .demo-object {
  width: 160px;
  height: 96px;
}

.studio-timeline {
  height: 2px;
  background: var(--line);
  margin: 0 20px;
  overflow: hidden;
}
.timeline-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left;
}

.studio-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 40px;
  gap: 16px;
  padding: 16px 20px;
  align-items: end;
}
.duration-control label,
.ease-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-dim);
  margin-bottom: 8px;
}
.ease-control {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
}
.duration-control output {
  font-family: var(--font-mono);
  color: var(--accent);
}
.ease-control select {
  font-size: 12px;
  height: 36px;
  width: 100%;
}
.studio-play {
  width: 40px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 18px;
}
.studio-play:hover { background: var(--bg-elev-2); color: var(--ink); }

.studio-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-dim);
}
.studio-bottom button {
  color: var(--accent);
  font-size: 12px;
  min-height: 32px;
}
.studio-bottom button:hover { color: var(--ink); }

/* ---------- catalog ---------- */

.catalog-section {
  padding: clamp(64px, 10vw, 120px) 0;
  border-top: 1px solid var(--line);
}
.catalog-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 32px;
}
.catalog-heading .kicker { margin: 0 0 12px; }
.catalog-heading h2 { font-size: clamp(32px, 4.4vw, 52px); }
.catalog-heading > p {
  margin: 0;
  max-width: 22em;
  color: var(--ink-soft);
  font-size: 14px;
}

.catalog-toolbar {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.catalog-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.catalog-filters button {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-dim);
}
.catalog-filters button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.catalog-filters small {
  font-family: var(--font-mono);
  font-size: 10px;
  margin-left: 4px;
  opacity: 0.7;
}

.catalog-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 260px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
}
.catalog-search input {
  width: 100%;
  height: 36px;
  border: 0;
  background: none;
  font-size: 13px;
}
.catalog-search:focus-within { border-color: var(--accent); }

.catalog-results {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding-top: 20px;
}
.term-card {
  min-width: 0;
  text-decoration: none;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 18px 16px;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  transition: border-color var(--d-sm), transform var(--d-md) var(--ease-out), background var(--d-sm);
}
.term-card:hover {
  border-color: var(--line-strong);
  background: var(--bg-elev-2);
  transform: translateY(-3px);
}
.term-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: auto;
}
.term-number {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.term-glyph { display: none; }
.term-title {
  display: block;
  font-family: var(--font-serif);
  font-size: 20px;
  margin-top: 18px;
}
.term-en {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  margin-top: 4px;
}
.term-arrow {
  color: var(--ink-dim);
  font-size: 14px;
  margin-top: 10px;
  align-self: flex-end;
}

.catalog-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  font-size: 12px;
  color: var(--ink-dim);
}
.catalog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--ink-dim);
}

.back-index {
  font-size: 12px;
  color: var(--ink-dim);
  text-decoration: none;
}
.back-index:hover { color: var(--accent); }
.section-head { position: relative; }
.section-head .back-index {
  position: absolute;
  top: 4px;
  right: 0;
}

.lab:target,
.ux-card:target {
  border-color: var(--accent);
}

/* ---------- composer extras ---------- */

.composer-layout {
  display: grid;
  grid-template-columns: 0.78fr 1fr;
  gap: 48px;
  align-items: start;
}
.composer-callout {
  border-left: 1px solid var(--accent);
  padding: 4px 0 4px 16px;
  margin-top: 22px;
}
.composer-callout span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.composer-callout p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.composer-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.composer-presets button {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-dim);
}
.composer-presets button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.recipe-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.recipe-fields label {
  display: grid;
  gap: 7px;
  font-size: 11px;
  color: var(--ink-dim);
}
.recipe-context {
  margin: 16px 0 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
.prompt-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 8px;
}
.copy-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
.copy-feedback { font-size: 12px; color: var(--ink-dim); }

/* ---------- dialogs / chrome ---------- */

.search-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(640px, 85svh);
  padding: 24px;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.search-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.search-dialog h2 { font-size: 28px; }
.search-dialog-head button {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.search-dialog input {
  width: 100%;
  height: 44px;
  background: #0e0e0c;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 14px;
}
.quick-results { display: grid; gap: 4px; margin-top: 14px; }
.quick-results a {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px;
}
.quick-results a:hover,
.quick-results a:focus-visible { background: var(--bg-elev-2); }
.quick-results .term-number { width: 28px; }
.quick-results .term-en { margin-left: auto; font-size: 11px; }
.quick-status { font-size: 12px; color: var(--ink-dim); margin: 12px 0 0; }

.back-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(22, 22, 19, 0.9);
  backdrop-filter: blur(10px);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.back-top.is-visible { display: block; }
.back-top:hover { color: var(--ink); }

.lightbox {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(90vw, 840px);
  height: auto;
  max-height: 90svh;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #0e0e0c;
}
.lightbox:not([open]) { display: none; }
.lightbox[open] { display: grid; place-items: center; }
.lightbox img {
  width: 100%;
  max-height: 85svh;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(11, 11, 10, 0.7);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 22px;
  z-index: 2;
}

.carousel-position {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(11, 11, 10, 0.55);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
}
.form-status {
  font-size: 12px;
  color: var(--ink-soft);
  grid-column: 1 / -1;
}
.pointer-term {
  display: block;
  margin: 8px 0;
  font-size: 13px;
}
.pointer-term b { font-weight: 400; color: var(--ink-soft); }

.atelier-cursor {
  position: absolute;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(203, 184, 146, 0.5);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  left: 0;
  top: 0;
  z-index: 5;
  translate: -50% -50%;
}

html.reduce-motion .atelier-cursor { display: none; }
html.reduce-motion .hscroll { height: auto; }
html.reduce-motion .hscroll-pin { position: relative; height: auto; overflow: auto; }
html.reduce-motion .hscroll-track { transform: none !important; }
html.reduce-motion .seq { height: auto; }
html.reduce-motion .seq-pin { position: relative; min-height: 620px; height: auto; }
html.reduce-motion .parallax-img,
html.reduce-motion .parallax-copy,
html.reduce-motion [data-depth],
html.reduce-motion .zoom-frame { transform: none !important; }
html.reduce-motion .zoom-kicker,
html.reduce-motion .zoom-caption { opacity: 1 !important; }

.lab, .stage, .composer, .section-head { min-width: 0; }
.lab-head > div { min-width: 0; }
.lab-head .en { overflow-wrap: anywhere; }

@media (min-width: 961px) {
  .nav-links {
    display: flex !important;
    position: static !important;
    flex-direction: row !important;
    padding: 0 !important;
    background: none !important;
  }
}

@media (max-width: 1180px) {
  .hero-inner { column-gap: 32px; }
  .composer-layout { gap: 32px; }
}

@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; }
  .catalog-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composer-layout { grid-template-columns: 1fr; }
  .section-head .back-index { position: static; margin-top: 4px; }
  .nav-links.is-open {
    display: flex;
    position: absolute;
    top: calc(var(--nav-h) - 1px);
    right: 20px;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(11, 11, 10, 0.94);
  }
  .nav-links.is-open a { display: block; padding: 10px; }
}

@media (max-width: 720px) {
  .nav-search span,
  .nav-search kbd { display: none; }
  .nav-search { width: 40px; justify-content: center; padding: 0; }
  .catalog-heading { flex-direction: column; align-items: start; }
  .catalog-search { flex: 1 1 100%; max-width: none; }
  .catalog-results { grid-template-columns: 1fr 1fr; }
  .recipe-fields { grid-template-columns: 1fr; }
  .studio-controls { grid-template-columns: 1fr 1fr 36px; }
  .hero-meta { display: none; }
}
