/* ============================================================
   Home page only: "The Ledger" (Direction B, see DESIGN.md).
   Loaded by index.html after styles.css; every rule is scoped
   under body.home so category, case, legal and 404 pages are
   untouched. Teal and amber never share an element.
   ============================================================ */

/* styles.css sets overflow-x: hidden on html and body, which makes body a
   scroll container and leaves view() timelines inactive. clip trims the
   same overflow without creating one. hidden stays as the fallback. */
html:has(body.home),
body.home {
  overflow-x: hidden;
  overflow-x: clip;
}

.home {
  --display: "Metamorphous", Georgia, serif;
  --mono: "Chivo Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --hair: rgba(255, 255, 255, 0.07);
}

.home .wrap {
  max-width: 560px;
  padding: 28px 20px 48px;
}

/* ---------- Header ---------- */
.home .site-header {
  margin-bottom: 16px;
}
.home .mark {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
}
.home .wordmark {
  font-family: var(--display);
  font-weight: 400;
  font-size: 2.25rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  margin-bottom: 8px;
}
.home .tagline {
  font-size: 0.9rem;
  max-width: 400px;
}

/* ---------- Language filter: one row at 390px ---------- */
.home .filter-bar {
  flex-wrap: nowrap;
  gap: 0;
  margin: 0 auto 8px;
  width: max-content;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.home .filter-btn {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 10px 18px;
  font-size: 0.85rem;
}
.home .filter-btn + .filter-btn {
  border-left: 1px solid var(--card-border);
}
.home .filter-btn:hover {
  background: var(--card-bg-hover);
  border-color: var(--card-border);
}
.home .filter-btn.active {
  color: var(--bone);
  background: var(--card-bg-hover);
}
.home .filter-btn:active {
  background: var(--card-bg);
}

/* ---------- Ledgers ---------- */
.home .ledgers {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
}
.home .ledger {
  min-width: 0;
}

.home .ledger {
  padding-top: 16px;
  border-top: 1px solid var(--accent);
}
.home .ledger--teal  { --accent: var(--teal); }
.home .ledger--amber { --accent: var(--amber); }

.home .ledger-h {
  margin: 0 0 4px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.15;
  color: var(--bone);
}

.home .pillar-group {
  margin-top: 16px;
}

.home .pillar-h {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}
/* Text-size links get a 44px tap target; the negative margin keeps the layout unchanged. */
.home .pillar-h a,
.home .starting a {
  display: inline-block;
  padding: 12px 0;
  margin: -12px 0;
}
.home .pillar-h a {
  color: var(--bone);
  text-decoration: none;
  border-radius: 4px;
}
.home .pillar-h a:hover {
  color: var(--accent);
}
.home .pillar-h .arrow {
  color: var(--grey);
  font-weight: 400;
}

.home .bio {
  margin: 2px 0 8px;
  color: var(--grey);
  font-size: 0.85rem;
  line-height: 1.5;
}
.home .bio span + span::before {
  content: " · ";
}
.home [data-filter-active="EN"] .bio [data-lang="ES"],
.home [data-filter-active="ES"] .bio [data-lang="EN"] {
  display: none;
}
.home [data-filter-active] .bio span + span::before {
  content: none;
}
.home [data-filter-active="all"] .bio span + span::before {
  content: " · ";
}

/* Rows, not buttons: hairline separators, metadata, one tap target. */
.home .rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hair);
}
.home .row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--hair);
  color: var(--bone);
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.home .row:hover {
  background: var(--card-bg);
}
.home .row:active {
  background: var(--card-bg-hover);
}
.home .row .icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: var(--accent);
}
.home .row-body {
  flex: 1 1 auto;
  min-width: 0;
}
.home .row-name {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
}
.home .row-meta {
  display: block;
  color: var(--grey);
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home .row .pill {
  letter-spacing: 0.06em;
  background: transparent;
}

.home .starting {
  margin: 8px 0 0;
  padding: 12px 8px;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  font-size: 0.9rem;
}
.home .starting a {
  color: var(--teal);
  font-weight: 600;
  text-decoration: none;
}
.home .starting a:hover {
  text-decoration: underline;
}

/* ---------- Case Files: a record ---------- */
.home .section {
  margin-top: 48px;
}
.home .section-title {
  margin: 0 0 4px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.15;
}
.home .section-lede {
  margin: 0 0 12px;
  color: var(--grey);
  font-size: 0.9rem;
}

.home .record {
  --accent: var(--teal);
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--teal);
}
.home .record a {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  column-gap: 12px;
  align-items: baseline;
  min-height: 56px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--hair);
  color: var(--bone);
  text-decoration: none;
  transition: background-color 0.2s ease;
}
.home .record a:hover {
  background: var(--card-bg);
}
.home .record a:active {
  background: var(--card-bg-hover);
}
.home .rec-year {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}
.home .rec-title {
  font-weight: 600;
  font-size: 0.95rem;
}
.home .rec-place {
  grid-column: 2;
  color: var(--grey);
  font-size: 0.85rem;
}
.home .record-more {
  display: inline-block;
  margin-top: 12px;
  color: var(--teal);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.home .record-more:hover {
  text-decoration: underline;
}

/* ---------- The lit room (Submit) ----------
   End state (bone ground, ink text) is the default, so no-JS,
   reduced-motion and unsupported browsers all get a readable panel.
   Approved exception: bone as a ground here only (DESIGN.md §2). */
.home .lit {
  --accent: var(--ink);
  margin: 56px -20px 0;
  padding: 48px 20px 52px;
  background-color: var(--bone);
  color: var(--ink);
}
.home .lit-inner {
  max-width: 520px;
  margin: 0 auto;
  border-top: 1px solid var(--teal); /* the one teal hairline */
  padding-top: 20px;
}
.home .lit .section-title {
  color: inherit;
  font-size: 1.6rem;
}
.home .lit p {
  margin: 12px 0 0;
  font-size: 0.95rem;
  line-height: 1.6;
}
.home .lit .lit-note {
  font-size: 0.85rem;
  opacity: 0.8;
}
.home .lit-cta {
  display: inline-block;
  min-height: 52px;
  line-height: 28px;
  margin-top: 24px;
  padding: 12px 22px;
  background: var(--ink);
  color: var(--bone);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background-color 0.2s ease;
}
.home .lit-cta:hover {
  background: #26262c;
}
.home .lit-cta:active {
  background: #000;
}
.home .lit-cta:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

@keyframes umbra-lights-up {
  0%   { background-color: var(--ink);  color: var(--bone); }
  55%  { color: var(--bone); }
  60%  { color: var(--ink); }
  100% { background-color: var(--bone); color: var(--ink); }
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .home .lit {
      animation: umbra-lights-up linear both;
      animation-timeline: view();
      /* Done within the first ~320px of the section entering, so the
         text is ink-on-bone before anyone reads it. */
      animation-range: entry 0% entry 320px;
    }
  }
  /* IntersectionObserver fallback (set by the page script only when
     scroll-driven animations are unsupported). */
  .home .lit.lit-dark {
    background-color: var(--ink);
    color: var(--bone);
  }
  .home .lit.lit-fade {
    transition: background-color 1.2s ease, color 0.6s ease 0.5s;
  }
}

/* ---------- Footer ---------- */
.home .site-footer {
  margin-top: 0;
  border-top: 0;
  padding-top: 32px;
}
.home .site-footer .sub-links {
  gap: 4px 12px;
}
.home .site-footer a,
.home .site-footer .linklike {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  font-size: 0.85rem;
}
.home .linklike {
  font: inherit;
  color: var(--grey);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.home .linklike:hover {
  color: var(--bone);
}

/* ---------- Desktop: two ledgers side by side ---------- */
@media (min-width: 900px) {
  .home .wrap {
    max-width: 1000px;
    padding-top: 48px;
  }
  .home .ledgers {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0;
  }
  .home .ledger:first-child {
    padding-right: 32px;
    border-right: 1px solid var(--hair);
  }
  .home .ledger:last-child {
    padding-left: 32px;
  }
  .home .lit {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 72px 20px 80px;
  }
  .home #cases {
    max-width: 640px;
  }
  .home .record a {
    grid-template-columns: 4rem 1fr auto;
  }
  .home .rec-place {
    grid-column: 3;
    text-align: right;
  }
}
