/* Tao Te Ching parallel reader — layout & components (uses site.css tokens) */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: hsl(var(--ink-2));
  padding: .45rem .85rem;
  font-size: .875rem;
}

.btn-ghost:hover {
  background: hsl(var(--wash));
  border-color: hsl(var(--line));
  transform: none;
  box-shadow: none;
  color: hsl(var(--ink));
}

/* ——— chapter bar ——— */
.chapter-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1.5rem;
  background: hsl(var(--paper));
  border-bottom: 1px solid hsl(var(--line));
}

.nav-btn {
  appearance: none;
  border: 1px solid hsl(var(--line));
  background: hsl(var(--paper));
  color: hsl(var(--ink-2));
  width: 2.15rem;
  height: 2.15rem;
  border-radius: var(--radius);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.nav-btn:hover {
  border-color: hsl(var(--accent) / .6);
  color: hsl(var(--accent));
  background: hsl(var(--accent-soft));
}

.chapter-pick {
  appearance: none;
  display: inline-flex;
  align-items: baseline;
  gap: .5rem;
  border: 1px solid transparent;
  background: transparent;
  color: hsl(var(--ink));
  font-family: var(--font-sans);
  font-size: .9375rem;
  padding: .35rem .75rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.chapter-pick:hover {
  background: hsl(var(--wash));
  border-color: hsl(var(--line));
}

.chapter-pick strong {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  color: hsl(var(--accent));
}

.chapter-label, .chapter-hint {
  color: hsl(var(--ink-3));
}

.chapter-bar-spacer { flex: 1; }

.versions-count, .line-sync-hint {
  font-size: .8125rem;
  color: hsl(var(--ink-3));
}

.line-sync-hint {
  font-style: italic;
  margin-right: .75rem;
}

/* ——— columns ——— */
.columns {
  flex: 1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(17.5rem, 1fr);
  gap: 0;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  align-items: stretch;
}

.col {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  border-right: 1px solid hsl(var(--line));
  min-width: 0;
}

.col:last-child { border-right: none; }

.col-head {
  background: hsl(var(--paper));
  padding: .95rem 1.35rem .85rem;
  border-bottom: 1px solid hsl(var(--line));
}

.col-lang {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: hsl(var(--ink-3));
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.col-title {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 600;
  margin: .25rem 0 0;
  line-height: 1.3;
}

.col-by {
  font-size: .8125rem;
  color: hsl(var(--ink-3));
  margin: .15rem 0 0;
}

.badge {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .12rem .45rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge-interp {
  color: hsl(var(--accent));
  background: hsl(var(--accent-soft));
  border-color: hsl(var(--accent) / .35);
}

.badge-pub {
  color: hsl(var(--ink-2));
  background: hsl(var(--wash));
  border-color: hsl(var(--line));
}

.badge-mt {
  color: hsl(260 30% 48%);
  background: hsl(260 40% 96%);
  border-color: hsl(260 25% 82%);
}

[data-theme="night"] .badge-mt {
  color: hsl(260 25% 78%);
  background: hsl(260 25% 18%);
  border-color: hsl(260 18% 30%);
}

.col-body {
  padding: 1.35rem 1.35rem 3.5rem;
  font-family: var(--font-serif);
  font-size: 1.0125rem;
  line-height: 1.8;
  color: hsl(var(--ink));
}

.verse .vline {
  display: block;
  min-height: 1.8em;
  padding: 0 .35rem;
  margin: 0 -.35rem;
  border-radius: .25rem;
}

.verse .vline.lit {
  background: hsl(var(--accent-soft));
  box-shadow: inset 2px 0 0 hsl(var(--accent));
}

.verse .vline.empty {
  min-height: .95em;
}

.col-script-cyr .col-body {
  font-feature-settings: "liga" 1;
}

/* ——— overlays & panels ——— */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: hsl(var(--ink) / .38);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4.5vh 1rem 2rem;
  overflow-y: auto;
}

.overlay[hidden] { display: none; }

.panel {
  width: min(46rem, 100%);
  background: hsl(var(--paper));
  border: 1px solid hsl(var(--line));
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: 0 24px 60px hsl(var(--shadow));
  overflow: hidden;
}

.panel-narrow { width: min(28rem, 100%); }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.5rem .85rem;
  border-bottom: 1px solid hsl(var(--line));
}

.panel-head h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  margin: 0;
}

.panel-close {
  appearance: none;
  border: none;
  background: transparent;
  color: hsl(var(--ink-3));
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius);
  width: 2.15rem;
  height: 2.15rem;
}

.panel-close:hover {
  background: hsl(var(--wash));
  color: hsl(var(--ink));
}

.panel-body {
  padding: 1.15rem 1.5rem 1.5rem;
  max-height: min(64vh, 40rem);
  overflow-y: auto;
}

.panel-foot {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  padding: .95rem 1.5rem 1.15rem;
  border-top: 1px solid hsl(var(--line));
}

/* version picker */
.vgroup + .vgroup { margin-top: 1.35rem; }

.vgroup h3 {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: hsl(var(--ink-3));
  margin: 0 0 .5rem;
}

.vrow {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .45rem .55rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.vrow:hover { background: hsl(var(--wash)); }

.vrow input {
  accent-color: hsl(var(--accent));
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}

.vrow .vrow-main {
  display: flex;
  flex-direction: column;
  gap: .05rem;
  min-width: 0;
}

.vrow .vrow-name {
  font-size: .9375rem;
  font-weight: 500;
  color: hsl(var(--ink));
  display: flex;
  align-items: baseline;
  gap: .55rem;
  flex-wrap: wrap;
}

.vrow .vrow-name .autonym {
  color: hsl(var(--ink-3));
  font-weight: 400;
  font-size: .8125rem;
}

.vrow .vrow-sub {
  font-size: .78125rem;
  color: hsl(var(--ink-3));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* chapter grid */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.75rem, 1fr));
  gap: .45rem;
}

.chapter-grid button {
  appearance: none;
  border: 1px solid hsl(var(--line));
  background: hsl(var(--paper));
  color: hsl(var(--ink-2));
  font-family: var(--font-sans);
  font-size: .875rem;
  padding: .5rem 0;
  border-radius: var(--radius);
  cursor: pointer;
}

.chapter-grid button:hover {
  border-color: hsl(var(--accent) / .6);
  color: hsl(var(--accent));
}

.chapter-grid button.current {
  background: hsl(var(--accent));
  border-color: hsl(var(--accent));
  color: hsl(43 36% 96%);
}

/* about */
.about-text {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.75;
  color: hsl(var(--ink-2));
}

.about-text .preface {
  white-space: pre-line;
}

.credits {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.35rem;
  font-family: var(--font-sans);
  font-size: .84375rem;
}

.credits caption {
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: hsl(var(--ink-3));
  padding-bottom: .55rem;
}

.credits th {
  text-align: left;
  font-weight: 600;
  color: hsl(var(--ink-3));
  font-size: .75rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: .4rem .6rem .4rem 0;
  border-bottom: 1px solid hsl(var(--line));
}

.credits td {
  padding: .45rem .6rem .45rem 0;
  border-bottom: 1px solid hsl(var(--line));
  vertical-align: top;
  color: hsl(var(--ink-2));
}

.credits tr:last-child td { border-bottom: none; }

.credits a {
  color: hsl(var(--accent));
  text-decoration: none;
}

.credits a:hover { text-decoration: underline; }

.credits .type-note {
  display: inline-block;
  font-size: .72rem;
  color: hsl(var(--ink-3));
}

/* ——— mobile ——— */
@media (max-width: 40rem) {
  .site-header { padding: .95rem 1rem; }
  .chapter-bar { padding: .5rem 1rem; }
  .columns {
    grid-auto-columns: minmax(82vw, 82vw);
    scroll-snap-type: x mandatory;
  }
  .col-head { padding: .85rem 1.15rem .75rem; }
  .col-body { padding: 1.15rem 1.15rem 3rem; font-size: .9875rem; }
  .header-actions .btn-ghost { padding: .45rem .6rem; }
  .chapter-label { display: none; }
}
