
:root {
  --paper: #140E0C;
  --ink: #F3E6C8;
  --muted: #C2B09A;
  --line: rgba(243, 230, 200, 0.16);
  --mark: #E38B6A;
  --soft: #2A211C;
  --max: 42rem;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body {
  margin: 0;
  font-family: "Source Serif 4", "Iowan Old Style", Palatino, serif;
  font-size: 1.125rem;
  line-height: 1.65;
  min-height: 100dvh;
  position: relative;
  z-index: 0;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 12% 58% at -6% 48%, rgba(226, 148, 70, 0.7), transparent 72%),
    radial-gradient(ellipse 7% 32% at 108% 64%, rgba(176, 108, 58, 0.28), transparent 70%);
}
a { color: inherit; caret-color: var(--ink); }
button, input { font: inherit; color: inherit; }
.skip {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--ink); color: var(--paper); padding: 0.4rem 0.7rem;
}
.skip:focus { top: 0.5rem; z-index: 5; }
.top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 0.75rem 1rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.1rem;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.mark {
  font-family: "Noto Serif Tamil", serif;
  font-weight: 600;
  font-size: 1.15rem;
  text-decoration: none;
  margin-right: auto;
}
.count { margin: 0; color: var(--muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.lang, .rom-btn { display: flex; gap: 0.15rem; }
.lang button, .rom-btn {
  background: transparent;
  border: 0;
  padding: 0.45rem 0.55rem;
  min-height: 44px;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.lang button[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--mark);
}
.rom-btn[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--mark); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 1.75rem 1.15rem 6.5rem; }
.kicker {
  margin: 0 0 0.8rem;
  color: var(--mark);
  font-family: "Noto Serif Tamil", serif;
  font-size: 1.05rem;
}
.kicker .num {
  font-family: "Source Serif 4", serif;
  color: var(--muted);
  margin-right: 0.45rem;
}
.song, .rom { list-style: none; margin: 0; padding: 0; }
.song li, .rom li {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: 0.65rem;
  margin: 0 0 0.35rem;
}
.song { font-family: "Noto Serif Tamil", serif; font-weight: 500; font-size: clamp(1.35rem, 2.6vw, 1.7rem); line-height: 1.85; }
.song .ln, .rom .ln { color: var(--muted); font-family: "Source Serif 4", serif; font-size: 0.85rem; padding-top: 0.55rem; }
.rom { margin-top: 1rem; color: var(--muted); font-size: 1.02rem; line-height: 1.55; }
html:not([data-rom="on"]) .rom { display: none; }
.rom .ln { padding-top: 0.2rem; }
.note {
  margin: 1.1rem 0 0;
  font-family: "Noto Serif Tamil", serif;
  color: var(--muted);
  font-size: 1rem;
}
.context { margin: 1.4rem 0 0; }
.layer { margin-top: 0.4rem; border-top: 1px solid var(--line); }
.layer summary {
  cursor: pointer;
  padding: 0.85rem 0;
  min-height: 48px;
  color: var(--mark);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.layer summary::after {
  content: "Show";
  font-family: "Source Serif 4", serif;
  font-size: 0.95rem;
  color: var(--muted);
}
.layer[open] summary::after { content: "Hide"; }
.layer summary::-webkit-details-marker { display: none; }
.layer summary:focus-visible, .lang button:focus-visible, .rom-btn:focus-visible, .pager a:focus-visible, .jump input:focus-visible {
  outline: 2px solid var(--mark);
  outline-offset: 2px;
}
.layer .body { padding: 0 0 1rem; }
.layer .body p { margin: 0 0 0.9rem; }
.ta-body { font-family: "Noto Serif Tamil", serif; font-size: 1.12rem; line-height: 1.85; }
.line-block { padding: 0.4rem 0 1rem; border-bottom: 1px solid var(--line); }
.line-block h3 { margin: 0.6rem 0 0.25rem; font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.src { font-family: "Noto Serif Tamil", serif; margin: 0 0 0.6rem; font-size: 1.15rem; line-height: 1.7; }
.gloss { margin: 0 0 0.7rem; }
.gloss dt { font-family: "Noto Serif Tamil", serif; font-size: 1.05rem; }
.gloss dd { margin: 0 0 0.45rem; color: var(--muted); }
.why { margin: 0; }
html[data-lang="ta"] .en { display: none; }
html[data-lang="en"] .ta { display: none; }
.wrap.reader { display: flex; flex-direction: column; }
.cols, .col-ta, .col-en { display: contents; }
.kicker { order: 0; }
.song { order: 1; }
.note { order: 2; }
.rom { order: 3; }
.context { order: 4; }
.teach.ta { order: 5; }
.teach.en { order: 6; }
.lines { order: 7; }
.pager { order: 8; }
.pager {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem; align-items: center;
  padding: 0.55rem 0.8rem calc(0.55rem + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.pager a, .pager .dead {
  min-height: 48px;
  display: flex; align-items: center;
  text-decoration: none;
  padding: 0 0.4rem;
}
.pager a:last-child, .pager .dead:last-child { justify-content: flex-end; }
.pager .dead { color: var(--line); }
.jump { display: flex; align-items: center; gap: 0.35rem; }
.jump input {
  width: 4.5rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: center;
  padding: 0.35rem 0;
  border-radius: 0;
}
.home h1 {
  font-family: "Noto Serif Tamil", serif;
  font-weight: 600;
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  line-height: 1.25;
  margin: 0.4rem 0 0.2rem;
}
.lede { font-size: 1.2rem; margin-top: 0.2rem; }
.quiet { color: var(--muted); }
.start {
  display: inline-flex; align-items: center; min-height: 48px;
  margin: 1.2rem 0 0.4rem;
  padding: 0.55rem 1rem;
  background: var(--ink); color: var(--paper);
  text-decoration: none;
}
.continue { margin: 0.6rem 0 0; }
.continue a { color: var(--mark); }
.jump-home { margin: 1.4rem 0 2rem; display: flex; gap: 0.6rem; align-items: center; }
.jump-home input {
  width: 5rem; background: transparent; border: 0; border-bottom: 1px solid var(--ink);
  padding: 0.4rem 0; text-align: center;
}
.marked { list-style: none; padding: 0; margin: 0.4rem 0 2rem; }
.marked li { border-top: 1px solid var(--line); }
.marked a {
  display: flex; gap: 0.8rem; align-items: baseline;
  text-decoration: none; min-height: 48px; padding: 0.7rem 0;
}
.marked .vn { font-variant-numeric: tabular-nums; color: var(--muted); width: 2.2rem; }
.marked .sn { font-family: "Noto Serif Tamil", serif; font-size: 1.15rem; }
.foot { color: var(--muted); font-size: 0.98rem; }
.foot a { color: var(--mark); }
.credit pre {
  white-space: pre-wrap;
  font-family: "Noto Serif Tamil", "Source Serif 4", serif;
  font-size: 1rem;
  line-height: 1.7;
}

.spread { display: none; }
.verse-block { margin-top: 2.25rem; padding-top: 1.75rem; border-top: 1px solid var(--line); }
.verse-block .kicker a { color: inherit; text-decoration: none; }
.verse-block .kicker a:hover { color: var(--mark); }

@media (min-width: 960px) {
  body::before {
    background:
      radial-gradient(ellipse 26% 72% at -4% 46%, rgba(226, 156, 76, 0.62), transparent 70%),
      radial-gradient(ellipse 14% 46% at 106% 58%, rgba(186, 116, 62, 0.32), transparent 72%);
  }
  .wrap.reader { display: block; }
  .cols { display: block; }
  .col-ta, .col-en { display: block; }
  html[data-lang="both"] .wrap.reader { max-width: 68rem; }
  html[data-lang="both"] .cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 3.5rem;
    align-items: start;
  }
  html[data-lang="both"] .col-ta,
  html[data-lang="both"] .col-en { display: block; }
  html[data-lang="both"] .context { margin-top: 0; }
  html[data-lang="ta"] .wrap.reader,
  html[data-lang="en"] .wrap.reader { max-width: 54rem; }
  html[data-lang="ta"] .song,
  html[data-lang="en"] .song { font-size: 1.5rem; line-height: 1.65; }
  .spread { display: block; }
  .pager { position: static; border: 0; padding: 1.5rem 0 0; max-width: 42rem; margin: 1rem auto 0; background: transparent; }
  html[data-lang="both"] .pager { max-width: none; }
  .wrap { padding-bottom: 3rem; }
}

.contents { list-style: none; padding: 0; margin: 0.4rem 0 2rem; }
.contents li { border-top: 1px solid var(--line); }
.contents a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  text-decoration: none; min-height: 48px; padding: 0.75rem 0;
}
.contents .range { font-variant-numeric: tabular-nums; font-size: 1.15rem; }

.go {
  min-height: 44px;
  min-width: 44px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.3rem 0.75rem;
  cursor: pointer;
}
