:root {
  --ink: #05104e;
  --ink-soft: #1c2a5a;
  --gold: #f5a623;
  --gold-deep: #c48412;
  --paper: #f6f1e7;
  --card: #fffdf8;
  --line: #e4d8c4;
  --muted: #5d6578;
  --rose: #8c3d4e;
  --shadow: 0 18px 40px rgba(5, 16, 78, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Noto Sans Tamil", sans-serif;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
.top-bar {
  background: #030b36;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(245, 166, 35, 0.25);
}
.brand { text-decoration: none; display: flex; flex-direction: column; }
.brand-en {
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #ffe6b0, #f5a623);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-ta { color: #92a0cf; font-size: 0.75rem; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-nav, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  border: 1px solid transparent;
}
.btn-nav.outline, .btn.ghost {
  border-color: rgba(255, 255, 255, 0.35);
  color: white;
  background: rgba(255, 255, 255, 0.06);
}
.btn-nav.solid, .btn.gold {
  background: var(--gold);
  color: #1a1203;
}
.btn-nav.active { border-color: var(--gold); color: #ffe6b0; }
.btn.gold { border-color: var(--gold); }
.btn.line {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.hero {
  background:
    radial-gradient(circle at 90% 10%, rgba(245, 166, 35, 0.18), transparent 32%),
    linear-gradient(160deg, #07133f, #05104e 55%, #0b1d62);
  color: #f7f1e4;
  padding: 56px 0 48px;
}
.kicker {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  color: #f5c56a;
  margin: 0 0 10px;
}
.hero h1 {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  font-weight: 650;
  line-height: 1.05;
  margin: 0 0 12px;
}
.hero h1 span { display: block; font-size: 0.48em; font-weight: 500; color: #f0d7a0; margin-top: 8px; }
.lede { max-width: 42rem; color: #d5def4; margin: 0; }
.author {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 28px;
  align-items: center;
  margin-top: -36px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.author img {
  width: 148px;
  height: 148px;
  object-fit: cover;
  object-position: center top;
  border-radius: 18px;
  border: 3px solid #f3e2bc;
}
.author h2 { margin: 0 0 4px; font-size: 1.45rem; }
.author .en { margin: 0 0 8px; color: var(--gold-deep); font-weight: 700; }
.author p { margin: 0; color: var(--ink-soft); }
.section { padding: 42px 0; }
.section h2 {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0 0 8px;
}
.section-intro { margin: 0 0 22px; color: var(--muted); max-width: 44rem; }
.book {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 28px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  margin: 0 0 18px;
  box-shadow: var(--shadow);
}
.book img.cover {
  width: 100%;
  border-radius: 12px;
  background: transparent;
}
.book h3 {
  font-family: Fraunces, "Noto Sans Tamil", Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  line-height: 1.25;
  margin: 6px 0;
}
.sub { margin: 0 0 8px; font-weight: 700; color: var(--rose); }
.gloss { margin: 0 0 8px; color: var(--muted); }
.blurb { margin: 0 0 12px; }
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.meta li {
  background: #f3ecdf;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.shelf {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.soon {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 18px 16px;
  min-height: 100%;
}
.soon-label {
  margin: 0 0 8px;
  color: var(--gold-deep);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.soon h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  line-height: 1.35;
}
.soon .btn { margin-top: 12px; }
.note, .limits {
  background: #fff;
  border-left: 4px solid var(--gold);
  padding: 14px 16px;
  border-radius: 12px;
  color: var(--ink-soft);
}
.limits p, .note p { margin: 0 0 8px; }
.limits p:last-child, .note p:last-child { margin: 0; }
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.step strong { display: block; margin-bottom: 4px; }
footer {
  background: #030b36;
  color: #d5def4;
  padding: 28px 0 36px;
  font-size: 0.92rem;
}
footer a { color: #f5c56a; }
footer p { margin: 0 0 8px; }

@media (max-width: 800px) {
  .author, .book, .shelf, .steps { grid-template-columns: 1fr; }
  .author img { width: 112px; height: 112px; }
  .hero { padding: 36px 0 32px; }
  .book img.cover { max-width: 260px; }
}

.reader-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #030b36;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 168px 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  flex-wrap: wrap;
}
.chrome-toggle {
  position: fixed;
  z-index: 30;
  top: calc(8px + env(safe-area-inset-top));
  right: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(5, 16, 78, 0.16);
}
body.reader.reading-full .reader-bar,
body.reader.reading-full .tools,
body.reader.reading-full .pinch-hint {
  display: none;
}
body.reader.reading-full #live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body.reader.reading-full .stage-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
}
body.reader.reading-full .stage {
  border-radius: 0;
  padding: 4px;
}
body.reader.reading {
  background: #070b16;
}
body.reader.reading .stage {
  background: #070b16;
}
body.reader.reading .tools {
  background: #070b16;
  border-top-color: rgba(255, 255, 255, 0.12);
}
body.reader.reading .tools button,
body.reader.reading .tools input {
  background: #161d33;
  color: #f4f1ea;
  border-color: rgba(255, 255, 255, 0.16);
}
body.reader.reading .tools button[aria-pressed="true"] {
  background: #f5a623;
  color: #070b16;
  border-color: #f5a623;
}
body.reader.reading .page-readout,
body.reader.reading .pinch-hint,
body.reader.reading #live {
  color: #d5def4;
}
.reader-bar a { color: #ffe6b0; font-weight: 700; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.reader-bar h1 {
  flex: 1 1 160px;
  min-width: 0;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: right;
  overflow-wrap: anywhere;
}
.gate {
  width: min(720px, calc(100% - 28px));
  margin: 28px auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.gate h2 { font-family: Fraunces, Georgia, serif; margin: 0 0 8px; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
body.reader {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
}
body.reader #shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.reader #shell[hidden] { display: none; }
.stage-wrap {
  flex: 1;
  min-height: 0;
  width: min(980px, calc(100% - 12px));
  margin: 8px auto;
  display: flex;
}
.stage {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #e7e0d4;
  border-radius: 16px;
  padding: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: none;
}
canvas#page {
  display: block;
  background: white;
  box-shadow: 0 10px 28px rgba(5, 16, 78, 0.16);
  max-width: none;
  margin-inline: auto;
  touch-action: none;
}
.pinch-hint {
  display: none;
  margin: 0 12px 6px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}
.tools button[aria-pressed="true"] {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
@media (max-width: 800px) {
  .pinch-hint { display: block; }
  .reader-bar { padding-right: 118px; }
  .reader-bar h1 { font-size: 0.82rem; }
  .tools { gap: 6px; }
  .tools button, .tools input { min-width: 40px; padding: 0 8px; }
}
.tools {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 248, 0.96);
  border-top: 1px solid var(--line);
}
.tools button, .tools input {
  min-height: 44px;
  min-width: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
}
.tools input { width: 72px; text-align: center; }
.page-readout { font-weight: 700; }
.fine {
  width: min(720px, calc(100% - 28px));
  margin: 0 auto 24px;
  color: var(--muted);
  font-size: 0.92rem;
}
@media print {
  body * { display: none !important; }
  body::after {
    content: "Printing is turned off for this reading copy. This is not a guarantee against photographs or screenshots.";
    display: block !important;
    padding: 2rem;
    font-family: sans-serif;
  }
}
