:root {
  --night: #16110e;
  --desk: #2b1d17;
  --paper: #efe4cc;
  --paper-deep: #dac7a5;
  --ink: #2a211c;
  --muted: #705d4f;
  --rule: rgba(91, 67, 51, 0.23);
  --red: #a62e23;
  --amber: #d69a39;
  --focus: #ffe18c;
  --serif: "Literata", Charter, Georgia, serif;
  --mono: "Red Hat Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html {
  color: var(--ink);
  background: var(--night);
  scroll-behavior: smooth;
}

body {
  min-width: 18rem;
  margin: 0;
  background:
    radial-gradient(circle at 14% 4%, rgba(214, 154, 57, 0.13), transparent 25rem),
    linear-gradient(108deg, transparent 0 68%, rgba(0, 0, 0, 0.22) 68% 69%, transparent 69%),
    var(--desk);
  font-family: var(--serif);
}

a {
  color: inherit;
  text-decoration-color: var(--red);
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.18em;
}

a:hover { text-decoration-thickness: 0.2em; }
a:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

.skip-link {
  position: fixed;
  z-index: 50;
  top: 0.6rem;
  left: 0.6rem;
  padding: 0.7rem 0.9rem;
  color: #fff;
  background: var(--red);
  font: 600 0.78rem/1 var(--mono);
  transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.site-top {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 3.2rem;
  padding: 0.55rem clamp(0.85rem, 4vw, 2.8rem);
  color: #f5e7cc;
  background: rgba(22, 17, 14, 0.94);
  border-bottom: 1px solid rgba(239, 228, 204, 0.28);
  backdrop-filter: blur(10px);
  font: 600 0.76rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-link { text-decoration: none; }
.language-nav { display: flex; gap: 0.45rem; }
.language-nav a { padding: 0.45rem 0.65rem; text-decoration: none; border: 1px solid #796252; }
.language-nav a[aria-current="page"] { color: var(--night); background: var(--amber); border-color: var(--amber); }

.rehearsal-desk {
  width: min(100% - clamp(1rem, 4vw, 4rem), 78rem);
  margin: clamp(1rem, 4vw, 3.5rem) auto 4rem;
}

.rehearsal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 30rem);
  align-items: center;
  gap: clamp(1.4rem, 5vw, 5rem);
  min-height: 75vh;
  padding: clamp(2rem, 6vw, 5rem);
  color: #f2e8d1;
  border: 1px solid rgba(239, 228, 204, 0.28);
  background:
    radial-gradient(circle at 78% 18%, rgba(214, 154, 57, 0.08), transparent 28rem),
    #1d1713;
  box-shadow: 0.8rem 0.8rem 0 rgba(0, 0, 0, 0.27);
}

.eyebrow,
.article-meta,
.margin-note,
.section-label,
.hero-art figcaption,
.series-nav,
.article-foot { font-family: var(--mono); }

.eyebrow { margin: 0 0 2.2rem; color: var(--amber); font-size: 0.76rem; letter-spacing: 0.16em; text-transform: uppercase; }

h1 {
  max-width: 9ch;
  margin: 0;
  font-size: clamp(3.5rem, 9vw, 8.2rem);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.dek { max-width: 37rem; margin: 2rem 0 1.5rem; font-size: clamp(1.08rem, 1.9vw, 1.45rem); line-height: 1.42; }
.article-meta { margin: 0; color: #bba98f; font-size: 0.78rem; line-height: 1.6; }

.hero-art { position: relative; margin: 0; transform: rotate(1.6deg); }
.hero-art::before { position: absolute; z-index: -1; inset: -0.7rem; content: ""; background: #8d7b65; transform: rotate(-3deg); }
.hero-art img { display: block; width: 100%; height: auto; filter: sepia(0.08) contrast(1.03); box-shadow: 0 1.4rem 2.7rem rgba(0, 0, 0, 0.45); }
.hero-art figcaption { margin-top: 0.75rem; color: #bba98f; font-size: 0.68rem; line-height: 1.45; }

.article-logo {
  width: clamp(5.5rem, 10vw, 8rem);
  margin: 0 0 1.8rem;
  padding: 0.35rem;
  background: #d6c39f;
  box-shadow: 0.4rem 0.45rem 0 var(--red);
  transform: rotate(-2.2deg);
}
.article-logo img { display: block; width: 100%; height: auto; }

.rehearsal-ledger {
  position: relative;
  margin: clamp(1.5rem, 5vw, 5rem) auto;
  background:
    linear-gradient(90deg, transparent 0 4.45rem, rgba(166, 46, 35, 0.58) 4.45rem 4.55rem, transparent 4.55rem),
    radial-gradient(circle at 18% 12%, rgba(112, 93, 79, 0.06), transparent 24rem),
    var(--paper);
  border-radius: 0.15rem 0.6rem 0.2rem 0.3rem;
  box-shadow: 1rem 1.2rem 0 rgba(0, 0, 0, 0.24);
}

.rehearsal-ledger::before {
  position: absolute;
  top: 1.3rem;
  bottom: 1.3rem;
  left: 1.3rem;
  width: 0.72rem;
  content: "";
  background: radial-gradient(circle, var(--desk) 0 0.25rem, transparent 0.28rem) 50% 0 / 0.72rem 2.4rem repeat-y;
}

.opening-log,
.log-entry {
  display: grid;
  justify-content: center;
  gap: clamp(1rem, 4vw, 3rem);
  padding: clamp(3rem, 7vw, 6rem) clamp(1.1rem, 5vw, 5rem);
}

.opening-log { grid-template-columns: 7rem minmax(0, 39rem); }
.log-entry { grid-template-columns: minmax(11rem, 15rem) minmax(0, 39rem); }
.opening-log { min-height: 75vh; align-items: center; }
.log-entry { border-top: 1px dashed rgba(42, 33, 28, 0.34); }
.margin-note,
.log-entry > header { align-self: start; position: sticky; top: 5.2rem; }
.log-entry > header,
.section-body,
.section-copy { min-width: 0; }
.margin-note,
.section-label { color: var(--red); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; line-height: 1.6; text-transform: uppercase; }
.log-entry > header h2 {
  max-width: 100%;
  margin: 0.65rem 0 0;
  font-size: clamp(1.55rem, 3.4vw, 2.8rem);
  line-height: 1.08;
  overflow-wrap: break-word;
  text-wrap: balance;
  hyphens: auto;
}

.opening-log p,
.section-copy p,
.section-copy li {
  font-size: clamp(1rem, 0.95rem + 0.24vw, 1.13rem);
  line-height: 1.72;
  text-align: justify;
  text-wrap: pretty;
  hyphens: auto;
  orphans: 3;
  widows: 3;
}

.opening-log p,
.section-copy p { margin: 0 0 1.35em; }
.section-copy p:last-child { margin-bottom: 0; }
.section-copy ol { margin: 0; padding-left: 1.35rem; }
.section-copy li { margin: 0 0 1rem; }
.section-art {
  position: relative;
  margin: 0 0 2.2rem;
  padding: 0.42rem;
  background: #e5d6b9;
  box-shadow: 0.5rem 0.55rem 0 rgba(166, 46, 35, 0.32);
  transform: rotate(0.45deg);
}
.log-entry:nth-child(even) .section-art { transform: rotate(-0.55deg); }
.section-art img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.references { background: rgba(112, 93, 79, 0.07); }

.series-nav {
  margin: 4rem auto 2rem;
  color: #f2e8d1;
}

.series-nav > p { margin: 0 0 0.85rem; color: var(--amber); font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase; }
.series-nav ol { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 0; padding: 0; list-style: none; background: #6b5446; border: 1px solid #6b5446; }
.series-nav a { display: flex; min-height: 5.5rem; flex-direction: column; gap: 0.8rem; padding: 1rem; background: #1d1713; text-decoration: none; }
.series-nav a[aria-current="page"] { color: var(--night); background: var(--amber); }
.series-nav a span { font-size: 0.65rem; opacity: 0.72; }

.article-foot { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1.3rem; color: #bba98f; border-top: 1px solid #6b5446; font-size: 0.68rem; letter-spacing: 0.06em; }

@media (max-width: 760px) {
  .rehearsal-head { grid-template-columns: 1fr; min-height: auto; }
  .article-logo { width: 6rem; }
  .hero-art { width: min(100%, 25rem); margin: 0 auto; }
  .rehearsal-ledger {
    background:
      linear-gradient(90deg, transparent 0 2.15rem, rgba(166, 46, 35, 0.58) 2.15rem 2.22rem, transparent 2.22rem),
      radial-gradient(circle at 18% 12%, rgba(112, 93, 79, 0.06), transparent 24rem),
      var(--paper);
  }
  .opening-log,
  .log-entry { grid-template-columns: 1fr; padding-left: 3.5rem; }
  .margin-note,
  .log-entry > header { position: static; }
  .log-entry > header h2 { max-width: 18ch; }
  .series-nav ol { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 761px) and (max-width: 980px) {
  .log-entry { grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr); gap: 1.5rem; }
  .log-entry > header h2 { font-size: clamp(1.4rem, 3.2vw, 2.1rem); }
}

@media (max-width: 440px) {
  .rehearsal-desk { width: min(100% - 0.7rem, 78rem); }
  .rehearsal-head { padding: 1.4rem; }
  .opening-log,
  .log-entry { padding: 2.6rem 1rem 2.6rem 2.8rem; }
  .series-nav ol { grid-template-columns: 1fr; }
  .article-foot { flex-direction: column; }
}

@media print {
  body { background: #fff; }
  .site-top, .series-nav { display: none; }
  .rehearsal-desk { width: 100%; margin: 0; }
  .rehearsal-head { min-height: auto; color: #000; background: #fff; box-shadow: none; }
  .hero-art { max-width: 18rem; }
  .rehearsal-ledger { margin: 0; box-shadow: none; }
}
