/* ============================================================
   WEB NOVEL — shared styles
   Palette:  paper #F2ECDF · ink #2A2420 · rule #B99A63 · accent #7C2D28
   Type:     Fraunces (display) · Source Serif 4 (reading text)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;1,9..144,500&family=Source+Serif+4:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --paper: #f2ecdf;
  --paper-dim: #e9e1cf;
  --ink: #2a2420;
  --ink-soft: #55493f;
  --rule: #b99a63;
  --accent: #7c2d28;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body::before {
  /* faint paper texture via layered gradients, no image assets needed */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(122, 45, 40, 0.02), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(122, 45, 40, 0.02), transparent 40%);
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 5rem 1.5rem 6rem;
}

/* ---------- headers / nav ---------- */

.site-nav {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1.5rem 1.5rem 0;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- home / title page ---------- */

.title-block {
  text-align: center;
  margin-bottom: 4rem;
}

.novel-eyebrow {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
}

.novel-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  line-height: 1.1;
  margin: 0 0 1.25rem;
}

.novel-rule {
  width: 64px;
  height: 2px;
  background: var(--rule);
  border: none;
  margin: 1.5rem auto;
}

.novel-tagline {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.1rem;
  max-width: 46ch;
  margin: 0 auto;
}

.toc {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--paper-dim);
}

.toc li {
  border-bottom: 1px solid var(--paper-dim);
}

.toc a {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  padding: 1.15rem 0.25rem;
  color: var(--ink);
  text-decoration: none;
}

.toc a:hover,
.toc a:focus-visible {
  color: var(--accent);
}

.toc .num {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  color: var(--rule);
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 2ch;
}

.toc .chap-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.15rem;
  flex-grow: 1;
}

.toc .chap-sub {
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-style: italic;
}

/* ---------- chapter page ---------- */

.chapter-eyebrow {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  text-align: center;
  color: var(--rule);
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.chapter-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  text-align: center;
  font-size: clamp(2rem, 5vw, 2.6rem);
  line-height: 1.2;
  margin: 0 0 3rem;
}

.chapter-text p {
  margin: 0 0 1.35em;
  text-indent: 1.4em;
}

.chapter-text p:first-of-type {
  text-indent: 0;
}

.chapter-text p:first-of-type::first-letter {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 3.2em;
  float: left;
  line-height: 0.85;
  padding: 0.05em 0.08em 0 0;
  color: var(--accent);
}

.end-mark {
  text-align: center;
  color: var(--rule);
  margin: 3rem 0;
  font-size: 1.3rem;
  letter-spacing: 0.3em;
}

/* ---------- prev / next ---------- */

.chapter-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--paper-dim);
  font-family: 'Fraunces', Georgia, serif;
}

.chapter-pager a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  max-width: 45%;
}

.chapter-pager a:hover,
.chapter-pager a:focus-visible {
  color: var(--accent);
}

.chapter-pager .dir {
  display: block;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 0.2rem;
}

.chapter-pager .next {
  text-align: right;
  margin-left: auto;
}

.chapter-pager .placeholder {
  visibility: hidden;
}

/* ---------- editing helper (visible only in source / as a visual cue) ---------- */

.edit-hint {
  display: block;
  text-align: center;
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-size: 0.85rem;
  color: #a9977c;
  margin: -2.5rem 0 3rem;
}

/* ---------- language toggle ---------- */

.lang-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10;
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper);
}

.lang-btn {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.lang-btn:hover {
  color: var(--accent);
}

.lang-btn.active {
  background: var(--accent);
  color: var(--paper);
}

.lang-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .lang-toggle {
    top: 1rem;
    right: 1rem;
  }
  .lang-btn {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
  }
}

/* ---------- dual-language content blocks ----------
   English shows by default; JS adds .lang-tr to <html>
   when Turkish is selected, which flips the two. ---------- */

.lang-block-tr {
  display: none;
}

html.lang-tr .lang-block-en {
  display: none;
}

html.lang-tr .lang-block-tr {
  display: block;
}

/* ---------- character gallery ---------- */

.char-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.75rem;
}

.char-card {
  display: flex;
  flex-direction: column;
}

.char-portrait {
  aspect-ratio: 3 / 4;
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--paper-dim);
  overflow: hidden;
  margin-bottom: 0.9rem;
}

.char-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.char-portrait.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
}

.char-portrait.placeholder span {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* ---------- dual-variant portrait (e.g. Aurel: unhelmeted / helmeted) ---------- */

.dual-portrait {
  display: flex;
  cursor: pointer;
}

.dual-portrait .variant-base,
.dual-portrait .variant-hover {
  height: 100%;
  object-fit: cover;
  display: block;
  transition: flex-basis 0.35s ease, opacity 0.35s ease, width 0.35s ease;
}

.dual-portrait .variant-base {
  flex: 1 1 100%;
  width: 100%;
}

.dual-portrait .variant-hover {
  flex: 0 0 0%;
  width: 0;
  opacity: 0;
}

.dual-portrait:hover .variant-base,
.dual-portrait:focus-visible .variant-base,
.dual-portrait:focus-within .variant-base {
  flex: 1 1 50%;
  width: 50%;
}

.dual-portrait:hover .variant-hover,
.dual-portrait:focus-visible .variant-hover,
.dual-portrait:focus-within .variant-hover {
  flex: 1 1 50%;
  width: 50%;
  opacity: 1;
}

.char-name {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0 0 0.35rem;
}

.char-blurb {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0;
  text-indent: 0;
}

@media (max-width: 480px) {
  .char-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.1rem;
  }
}

/* ---------- footer credit ---------- */

.site-footer {
  text-align: center;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--paper-dim);
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-style: italic;
  letter-spacing: 0.01em;
}

/* ---------- focus & motion ---------- */

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media (max-width: 480px) {
  .page { padding: 3.5rem 1.25rem 4rem; }
  .site-nav { gap: 1.25rem; flex-wrap: wrap; }
}
