/* ---------- Palettes ---------- */
:root {
  --bg:        oklch(0.18 0.012 60);
  --surface:   oklch(0.215 0.014 60);
  --surface-2: oklch(0.255 0.016 60);
  --line:      oklch(0.32 0.012 60 / 0.55);
  --line-soft: oklch(0.32 0.012 60 / 0.25);
  --fg:        oklch(0.93 0.012 80);
  --fg-dim:    oklch(0.72 0.013 75);
  --fg-faint:  oklch(0.55 0.012 70);
  --accent:    oklch(0.78 0.135 70);
  --accent-dim:oklch(0.62 0.10 70);
}
.theme--parchment {
  --bg:        oklch(0.96 0.012 85);
  --surface:   oklch(0.985 0.008 85);
  --surface-2: oklch(0.93 0.012 85);
  --line:      oklch(0.78 0.014 70 / 0.55);
  --line-soft: oklch(0.78 0.014 70 / 0.25);
  --fg:        oklch(0.24 0.015 70);
  --fg-dim:    oklch(0.42 0.014 70);
  --fg-faint:  oklch(0.60 0.012 70);
  --accent:    oklch(0.55 0.14 50);
  --accent-dim:oklch(0.48 0.10 50);
}
.theme--slate {
  --bg:        oklch(0.19 0.012 240);
  --surface:   oklch(0.225 0.014 240);
  --surface-2: oklch(0.27 0.016 240);
  --line:      oklch(0.36 0.014 240 / 0.55);
  --line-soft: oklch(0.36 0.014 240 / 0.25);
  --fg:        oklch(0.94 0.010 240);
  --fg-dim:    oklch(0.73 0.014 240);
  --fg-faint:  oklch(0.55 0.012 240);
  --accent:    oklch(0.78 0.10 215);
  --accent-dim:oklch(0.62 0.08 215);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body { font-family: 'Geist', system-ui, sans-serif; font-weight: 400; letter-spacing: -0.005em;
       font-feature-settings: 'ss01','cv11'; -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent); color: var(--bg); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 400; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 280px 1fr; height: 100vh; min-height: 100vh; }
.density--compact .app { font-size: 13.5px; }

/* ---------- Rail ---------- */
.rail {
  border-right: 1px solid var(--line); padding: 28px 22px; display: flex; flex-direction: column;
  gap: 28px; background: linear-gradient(180deg, var(--surface), var(--bg) 80%);
}
.rail__brand { display: flex; gap: 12px; align-items: center; }
.brand__mark { color: var(--accent); display: grid; place-items: center; width: 36px; height: 36px;
               border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-family: 'Instrument Serif', Georgia, serif; font-size: 22px; font-weight: 400; letter-spacing: 0; }
.brand__text span { font-family: 'Geist Mono', monospace; font-size: 10.5px; color: var(--fg-faint);
                    text-transform: uppercase; letter-spacing: 0.12em; }

.rail__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rail__list button { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; width: 100%;
                     text-align: left; padding: 10px 12px; border-radius: 7px; align-items: center;
                     color: var(--fg-dim); transition: background .15s, color .15s; }
.rail__list button:hover { background: var(--surface-2); color: var(--fg); }
.rail__list .is-active button { background: var(--surface-2); color: var(--fg); }
.rail__list .is-active button .rail__name::before {
  content: ''; position: absolute; left: -22px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.rail__num { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--fg-faint); }
.rail__name { font-size: 14px; position: relative; font-family: 'Instrument Serif', Georgia, serif;
              font-size: 17px; letter-spacing: 0.005em; }
.rail__count em { font-style: normal; color: var(--accent); font-family: 'Geist Mono', monospace; font-size: 11px; }
.rail__count i { font-style: normal; color: var(--fg-faint); font-family: 'Geist Mono', monospace; font-size: 11px; }

.rail__foot { margin-top: auto; border-top: 1px solid var(--line-soft); padding-top: 18px; display: flex;
              flex-direction: column; gap: 6px; }
.foot__row { display: flex; justify-content: space-between; font-family: 'Geist Mono', monospace;
             font-size: 10.5px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.foot__row span:last-child { color: var(--fg-dim); }
.foot__hint { margin: 10px 0 0; font-size: 12px; color: var(--fg-faint); line-height: 1.5;
              font-family: 'Instrument Serif', Georgia, serif; font-style: italic; font-size: 14px; }

/* ---------- Main ---------- */
.main { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; min-width: 0; }

/* topbar */
.topbar {
  display: grid; grid-template-columns: 1fr auto auto; gap: 20px; align-items: end;
  padding: 32px 40px 18px; border-bottom: 1px solid var(--line-soft); min-width: 0;
}
.topbar > * { min-width: 0; }
.topbar__left h1 { font-family: 'Instrument Serif', Georgia, serif; font-size: 48px; line-height: 1; letter-spacing: -0.01em; }
.topbar__left h1::after { content: '.'; color: var(--accent); }
.topbar__sub { display: block; margin-top: 8px; color: var(--fg-faint); font-size: 13px;
               font-family: 'Geist Mono', monospace; text-transform: uppercase; letter-spacing: 0.1em; }
.topbar__search {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); width: clamp(180px, 26vw, 320px); color: var(--fg-dim);
}
.topbar__search input { min-width: 0; width: 100%; }
.topbar__search:focus-within { border-color: var(--accent-dim); color: var(--fg); }
.topbar__search input { background: none; border: 0; outline: none; flex: 1; font-size: 14px; }
.topbar__search input::placeholder { color: var(--fg-faint); }
.topbar__clear { font-family: 'Geist Mono', monospace; font-size: 10.5px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.1em; }
.topbar__clear:hover { color: var(--accent); }
.topbar__clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.05; }
.topbar__clock span { font-family: 'Instrument Serif', Georgia, serif; font-size: 24px; color: var(--fg); white-space: nowrap; }
.topbar__clock small { font-family: 'Geist Mono', monospace; font-size: 9.5px; color: var(--fg-faint);
                       text-transform: uppercase; letter-spacing: 0.15em; }

/* scroller */
.scroller { overflow: auto; padding: 8px 40px 40px; min-height: 0; }
.scroller::-webkit-scrollbar { width: 10px; }
.scroller::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 10px; border: 3px solid var(--bg); }

/* category block */
.catblock { padding: 36px 0 12px; border-bottom: 1px solid var(--line-soft); }
.catblock:first-child { padding-top: 28px; }
.catblock:last-of-type { border-bottom: 0; }
.catblock__head { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: end;
                  margin-bottom: 26px; min-width: 0; }
.catblock__head > * { min-width: 0; }
.catblock__num { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--fg-faint);
                 text-transform: uppercase; letter-spacing: 0.18em; padding-bottom: 8px;
                 border-bottom: 1px solid var(--accent-dim); }
.catblock__title h2 { font-family: 'Instrument Serif', Georgia, serif; font-size: 38px; line-height: 1.05; letter-spacing: -0.01em; }
.catblock__title p { margin: 6px 0 0; color: var(--fg-faint); font-size: 13px;
                     font-family: 'Geist Mono', monospace; text-transform: uppercase; letter-spacing: 0.1em; }
.catblock__meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.05; }
.catblock__meta span { font-family: 'Instrument Serif', Georgia, serif; font-size: 26px; color: var(--fg); }
.catblock__meta small { font-family: 'Geist Mono', monospace; font-size: 9.5px; color: var(--fg-faint);
                        text-transform: uppercase; letter-spacing: 0.15em; white-space: nowrap; }
.catblock__meta span { white-space: nowrap; }

.catblock__types { display: flex; flex-direction: column; gap: 24px; }

/* type section */
.typesection__head { display: flex; align-items: baseline; justify-content: space-between;
                     padding: 0 0 10px; margin-bottom: 12px; border-bottom: 1px dashed var(--line-soft); }
.typesection__title { font-family: 'Instrument Serif', Georgia, serif; font-size: 22px; font-style: italic;
                      color: var(--fg-dim); }
.typesection__count { font-family: 'Geist Mono', monospace; font-size: 10.5px; color: var(--fg-faint);
                      text-transform: uppercase; letter-spacing: 0.12em; }
.typesection__grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px;
}
.density--compact .typesection__grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }

/* sound card */
.sound {
  display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 12px 14px 12px 12px;
  border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface);
  transition: border-color .2s, background .2s, transform .2s;
  align-items: center; min-height: 64px;
}
.sound:hover { border-color: var(--line); }
.sound--on { border-color: var(--accent-dim); background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.sound__toggle {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--fg-dim); border: 1px solid var(--line);
  transition: background .15s, color .15s, transform .12s;
}
.sound__toggle:hover { color: var(--fg); }
.sound--on .sound__toggle { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.sound--on .sound__toggle:hover { transform: scale(1.04); }

.sound__body { min-width: 0; }
.sound__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.sound__name { font-family: 'Instrument Serif', Georgia, serif; font-size: 18px; line-height: 1.1; color: var(--fg);
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sound--on .sound__name { color: var(--fg); }

.sound__row { display: flex; align-items: center; gap: 10px; }
.sound__pct { font-family: 'Geist Mono', monospace; font-size: 10.5px; color: var(--fg-faint); width: 22px; text-align: right; }
.sound--on .sound__pct { color: var(--accent); }

/* ---------- Range slider ---------- */
input[type=range].sound__slider, .dock__master input[type=range] {
  appearance: none; -webkit-appearance: none; flex: 1; height: 18px; background: transparent; cursor: pointer;
  --v: 60%;
}
input[type=range].sound__slider::-webkit-slider-runnable-track,
.dock__master input[type=range]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) 0 var(--v), var(--line) var(--v) 100%);
}
input[type=range].sound__slider::-moz-range-track,
.dock__master input[type=range]::-moz-range-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) 0 var(--v), var(--line) var(--v) 100%);
}
input[type=range].sound__slider::-webkit-slider-thumb,
.dock__master input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--fg); border: 2px solid var(--bg); margin-top: -6px;
  box-shadow: 0 0 0 1px var(--line);
}
input[type=range].sound__slider::-moz-range-thumb,
.dock__master input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--fg);
  border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--line);
}
.sound--on input[type=range].sound__slider::-webkit-slider-thumb { background: var(--accent); }
.sound--on input[type=range].sound__slider::-moz-range-thumb { background: var(--accent); }

/* ---------- Visualizer ---------- */
.viz { display: flex; gap: 2px; align-items: end; height: 12px; }
.viz span { display: block; width: 2px; height: 3px; background: var(--fg-faint); border-radius: 1px; }
.viz--on span { background: var(--accent); animation: viz 1.1s ease-in-out infinite; }
@keyframes viz {
  0%,100% { height: 3px; }
  30%     { height: 11px; }
  60%     { height: 6px; }
}

/* ---------- Dock ---------- */
.dock {
  border-top: 1px solid var(--line); background: var(--surface);
  padding: 16px 28px; display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 24px; align-items: center;
  position: relative;
}
.dock__left { display: flex; align-items: center; gap: 16px; }
.dock__center { display: flex; align-items: center; min-width: 0; }
.dock__pulse { display: flex; gap: 3px; align-items: end; height: 28px; opacity: 0.35; }
.dock__pulse span { width: 3px; height: 6px; background: var(--accent); border-radius: 1px; }
.dock--on .dock__pulse { opacity: 1; }
.pulse--on .dock--on .dock__pulse span { animation: pulse 1.4s ease-in-out infinite; }
.dock--on .dock__pulse span:nth-child(2) { animation-delay: .2s; }
.dock--on .dock__pulse span:nth-child(3) { animation-delay: .4s; }
@keyframes pulse {
  0%,100% { height: 6px; }
  50%     { height: 22px; }
}
.dock__title { font-family: 'Instrument Serif', Georgia, serif; font-size: 22px; line-height: 1.1; }
.dock--on .dock__title { color: var(--fg); }
.dock__title { color: var(--fg-dim); }
.dock__sub { font-family: 'Geist Mono', monospace; font-size: 10.5px; color: var(--fg-faint);
             text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px;
             max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dock__master { display: flex; align-items: center; gap: 12px; width: 100%; }
.dock__master > span:first-child { font-family: 'Geist Mono', monospace; font-size: 10.5px;
                                   color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.12em; }
.dock__master input[type=range] { flex: 1; }
.dock__mpct { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--fg); min-width: 28px; text-align: right; }

.dock__right { display: flex; gap: 8px; }
.btn { padding: 8px 14px; border-radius: 999px; font-family: 'Geist Mono', monospace;
       font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em;
       border: 1px solid var(--line); color: var(--fg-dim); transition: background .15s, color .15s, border .15s; }
.btn:hover:not(:disabled) { color: var(--fg); border-color: var(--accent-dim); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.dock__presets {
  grid-column: 1 / -1; padding-top: 12px; margin-top: 8px; border-top: 1px dashed var(--line-soft);
  display: flex; flex-wrap: wrap; gap: 6px;
}
.preset { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px;
          border: 1px solid var(--line-soft); background: var(--bg); color: var(--fg-dim); }
.preset:hover { border-color: var(--accent-dim); color: var(--fg); }
.preset span { font-family: 'Instrument Serif', Georgia, serif; font-size: 14px; }
.preset em { font-style: normal; font-family: 'Geist Mono', monospace; font-size: 10px; color: var(--accent); }

/* ---------- End mark + empty ---------- */
.endmark { padding: 40px 0 60px; text-align: center; }
.endmark span { display: block; font-family: 'Instrument Serif', Georgia, serif; font-style: italic;
                font-size: 22px; color: var(--fg-dim); }
.endmark em { display: block; margin-top: 8px; font-style: normal; font-family: 'Geist Mono', monospace;
              font-size: 10.5px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: 0.14em; }
.empty { padding: 80px 0; text-align: center; color: var(--fg-faint);
         font-family: 'Instrument Serif', Georgia, serif; font-style: italic; font-size: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .app { grid-template-columns: 220px 1fr; }
  .topbar { padding: 24px 24px 14px; }
  .scroller { padding: 4px 24px 32px; }
  .topbar__left h1 { font-size: 40px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .topbar { padding: 22px 22px 14px; grid-template-columns: 1fr; }
  .topbar__clock { display: none; }
  .scroller { padding: 0 22px 30px; }
  .dock { grid-template-columns: 1fr; gap: 12px; }
}

/* ---------- Site footer (inside scroller, below end-of-catalog) ---------- */
.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 24px 0 8px;
  margin-top: 8px;
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.footer-brand .logo-icon { font-size: 15px; }
.footer-brand .logo-text {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 17px;
  font-weight: 400;
  color: var(--fg-dim);
  letter-spacing: 0;
}
.footer-copy {
  margin: 0;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.footer-links {
  display: flex;
  gap: 16px;
}
.footer-links a {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--fg-faint);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color .15s;
}
.footer-links a:hover { color: var(--accent); }
.btn-contact-footer {
  margin-left: auto;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  background: none;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-contact-footer:hover {
  border-color: var(--accent-dim);
  color: var(--fg);
}
@media (max-width: 600px) {
  .footer-inner { gap: 12px; }
  .btn-contact-footer { margin-left: 0; }
}

/* ---------- Contact modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 32px;
  position: relative;
  box-shadow: 0 32px 80px oklch(0 0 0 / 0.45);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--fg-faint);
  font-size: 15px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.modal-close:hover { color: var(--fg); background: var(--line); }
.modal-header { margin-bottom: 24px; }
.modal-icon { font-size: 22px; display: block; margin-bottom: 10px; }
.modal-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 30px;
  font-weight: 400;
  color: var(--fg);
  margin: 0 0 6px;
}
.modal-subtitle {
  margin: 0;
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.contact-form { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.form-group input,
.form-group textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  transition: border-color .15s;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent-dim); }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--fg-faint); }
.btn-submit {
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: opacity .15s;
  margin-top: 4px;
}
.btn-submit:hover:not(:disabled) { opacity: 0.85; }
.btn-submit:disabled { opacity: 0.4; cursor: not-allowed; }
.contact-result {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Geist', system-ui, sans-serif;
}
.contact-result--success {
  background: oklch(0.22 0.04 145 / 0.5);
  border: 1px solid oklch(0.4 0.1 145 / 0.5);
  color: oklch(0.72 0.12 145);
}
.contact-result--error {
  background: oklch(0.22 0.04 25 / 0.5);
  border: 1px solid oklch(0.4 0.1 25 / 0.5);
  color: oklch(0.72 0.12 25);
}
