:root {
  --ground: #f7f7f5;
  --ink: #151515;
  --muted: #77746e;
  --accent: #e43d30;
  --rule: rgb(21 21 21 / .18);
}

@media (prefers-color-scheme: dark) {
  :root { --ground: #11110f; --ink: #f0f0eb; --muted: #aaa7a0; --accent: #ff584c; --rule: rgb(240 240 235 / .18); }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
button, a { color: inherit; font: inherit; }
a { text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--ground); }

.working-index {
  display: grid;
  grid-template-columns: minmax(14rem, 24%) minmax(26rem, 38%) minmax(20rem, 38%);
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%; height: 100dvh;
  padding: clamp(1.3rem, 3.7vw, 4rem);
}

.profile { align-self: start; padding-right: clamp(1.5rem, 4vw, 4rem); }
.profile img { display: block; width: min(11rem, 75%); aspect-ratio: 1; object-fit: cover; filter: saturate(.82) contrast(.98); }
.profile h1 { margin: 1.2rem 0 1.6rem; font-size: 1.75rem; line-height: 1; letter-spacing: -.035em; }
.profile dl, .profile dd { margin: 0; }
.profile dl { display: grid; gap: 1rem; }
.profile dl div { display: grid; grid-template-columns: 4.2rem 1fr; gap: .65rem; }
.profile dt { color: var(--muted); font: 11px/1.45 ui-monospace, monospace; }
.profile dd { font-size: .82rem; }

.registers { position: relative; align-self: center; padding-right: clamp(1.5rem, 4vw, 4rem); }
.register + .register { margin-top: clamp(1.6rem, 4vh, 3rem); }
.register h2 { margin: 0 0 .55rem; font-size: .82rem; font-weight: 500; }
.register ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.register li { border-bottom: 1px solid var(--rule); }
.entry { display: grid; grid-template-columns: 5rem minmax(0, .95fr) minmax(8rem, 1fr); gap: .8rem; width: 100%; padding: .7rem 0; border: 0; background: transparent; cursor: pointer; text-align: left; }
.entry span { color: var(--muted); font: 11px/1.55 ui-monospace, monospace; }
.entry b { overflow: hidden; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.entry small { color: var(--muted); font-size: .78rem; }
.entry.active b, .entry:hover b { font-weight: 600; }
.witness { position: absolute; top: 0; left: -.75rem; width: 2px; height: 1.2rem; background: var(--accent); transform: translateY(var(--witness-y, 2rem)); transition: transform .14s ease-out; }

.evidence { align-self: center; max-width: 35rem; min-height: 18rem; padding-left: clamp(1.5rem, 5vw, 6rem); border-left: 1px solid var(--rule); }
.evidence > * { transition: opacity .11s ease, transform .11s ease; }
.evidence.changing > * { opacity: 0; transform: translateY(2px); }
.reference { margin: 0 0 3rem; color: var(--accent); font: 11px/1 ui-monospace, monospace; }
.evidence h2 { margin: 0; font-size: 1.55rem; font-weight: 500; letter-spacing: -.025em; }
.evidence-meta { margin: .35rem 0 1.5rem; color: var(--muted); font-size: .85rem; }
.evidence ul { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.evidence li { padding: .35rem 0; border-bottom: 1px solid var(--rule); }
.evidence li:first-child { border-top: 1px solid var(--rule); }
.evidence a[hidden] { display: none; }

footer { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .75rem; }
footer nav { display: flex; gap: 1.4rem; }
footer p { margin: 0; }
footer p > span:first-child { color: var(--ink); }

@media (max-width: 850px) {
  .working-index { grid-template-columns: 1fr 1fr; grid-template-rows: auto minmax(0, 1fr) auto; gap: 1rem; padding: 1rem; }
  .profile { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; padding: 0 0 .8rem; border-bottom: 1px solid var(--rule); }
  .profile img { width: 3.6rem; }
  .profile h1 { margin: 0 0 .3rem; font-size: 1.35rem; }
  .profile dl { display: block; }
  .profile dl div { display: none; }
  .profile dl div:nth-child(4) { display: block; }
  .profile dt { display: none; }
  .profile dd { font-size: .75rem; color: var(--muted); }
  .registers { align-self: start; padding: 0 1rem 0 0; }
  .register + .register { margin-top: 1rem; }
  .entry { display: block; padding: .38rem 0; }
  .entry span, .entry small { display: block; }
  .entry small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .evidence { align-self: stretch; min-height: 0; padding-left: 1rem; }
  .reference { margin-bottom: 1.2rem; }
  .evidence h2 { font-size: 1.2rem; }
  .evidence li { padding: .28rem 0; font-size: .8rem; }
  footer nav a:first-child { display: none; }
}

@media (max-height: 650px) {
  .profile img { width: min(7rem, 60%); }
  .profile dl { gap: .45rem; }
  .entry { padding-top: .4rem; padding-bottom: .4rem; }
  .register + .register { margin-top: .9rem; }
  .reference { margin-bottom: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
