:root {
  --ink: #272727;
  --muted: #6f6b65;
  --rule: #dedbd4;
  --paper: #fffefa;
  --link: #226999;
  --quatrain-1: #e0f6ef;
  --quatrain-2: #e4edf9;
  --quatrain-3: #f9e7e7;
  --couplet: #f8f1d5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "EB Garamond", Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

.site-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1380px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.95rem;
}

.site-name {
  color: var(--ink);
  font-weight: 600;
}

.reader {
  max-width: 1380px;
  margin: 0 auto;
  padding: 4.5rem 2rem 3rem;
}

.sonnet-heading {
  margin-bottom: 3.75rem;
  text-align: center;
}

.note-page {
  max-width: 42rem;
  min-height: calc(100vh - 15rem);
  margin: 0 auto;
  padding: clamp(5rem, 14vw, 10rem) 2rem 4rem;
}

.note-page h1 {
  margin-bottom: 1.25rem;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
}

.note-copy {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  line-height: 1.65;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  font-weight: 600;
  line-height: 1.05;
}

.byline {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-style: italic;
}

.comparison {
  width: 100%;
}

.column-headings,
.line-row {
  display: grid;
  grid-template-columns: 2rem repeat(3, minmax(0, 1fr));
  column-gap: clamp(1rem, 2.5vw, 2.75rem);
}

.column-headings {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  background: rgba(255, 254, 250, 0.94);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(8px);
}

.column-heading {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
}

.lines {
  padding-top: 1.5rem;
}

.line-row {
  --line-color: transparent;
  align-items: start;
  min-height: 2.45rem;
}

.line-row[data-group="quatrain-1"] {
  --line-color: var(--quatrain-1);
}

.line-row[data-group="quatrain-2"] {
  --line-color: var(--quatrain-2);
}

.line-row[data-group="quatrain-3"] {
  --line-color: var(--quatrain-3);
}

.line-row[data-group="couplet"] {
  --line-color: var(--couplet);
}

.line-number {
  padding-top: 0.18rem;
  color: transparent;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.line-row:nth-child(5n) .line-number {
  color: #aaa59d;
}

.line-cell {
  min-width: 0;
  padding: 0.08rem 0;
  font-size: clamp(1rem, 1.45vw, 1.24rem);
  line-height: 1.55;
}

.line-text {
  padding: 0.06em 0.14em 0.08em;
  background: var(--line-color);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.line-text.is-empty {
  color: #b5b0a8;
  background: transparent;
}

.translator-note {
  max-width: 48rem;
  margin: 3.5rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  text-align: center;
}

.translator-note h2 {
  margin: 0 0 0.75rem;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.translator-note p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.6;
  white-space: pre-line;
}

.sonnet-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: 1380px;
  margin: 3rem auto 0;
  padding: 1.5rem 2rem 3rem;
  border-top: 1px solid var(--rule);
  font-size: 0.95rem;
}

.sonnet-nav .next {
  justify-self: end;
}

.sonnet-nav [hidden] {
  visibility: hidden;
  display: block;
}

.error {
  max-width: 42rem;
  margin: 6rem auto;
  padding: 0 1.5rem;
  color: #8b2d2d;
  text-align: center;
}

@media (max-width: 760px) {
  .site-bar,
  .reader,
  .sonnet-nav {
    padding-right: 1.1rem;
    padding-left: 1.1rem;
  }

  .reader {
    padding-top: 3rem;
  }

  .sonnet-heading {
    margin-bottom: 2.5rem;
  }

  .column-headings {
    display: none;
  }

  .lines {
    padding-top: 0;
  }

  .line-row {
    grid-template-columns: 1.5rem 1fr;
    gap: 0.35rem 0.75rem;
    margin-bottom: 1.6rem;
  }

  .line-number {
    grid-row: 1 / 4;
    color: #aaa59d;
  }

  .line-cell {
    grid-column: 2;
    font-size: 1.05rem;
  }

  .line-cell::before {
    display: block;
    margin-bottom: 0.18rem;
    color: var(--muted);
    content: attr(data-label);
    font-family: "EB Garamond", Georgia, serif;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.04em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
