@font-face {
  font-family: "TF Lanna";
  src: url("./TF-Lanna.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "TF Manawika";
  src: url("./TF-Manawika.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink: #f5f0df;
  --ink-soft: #c7c6b6;
  --forest-950: #06110e;
  --forest-900: #0a1c17;
  --forest-850: #102921;
  --forest-800: #15382d;
  --jade: #9cb99a;
  --jade-light: #cfddc6;
  --gold: #d4bf89;
  --line: rgba(220, 232, 208, 0.18);
  --glass: rgba(190, 220, 193, 0.075);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.34);
  --serif: "TF Manawika", "Th Sarabun New", Georgia, serif;
  --text: "TF Lanna", "Th Sarabun New", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--forest-950);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 8%, rgba(78, 130, 99, 0.25), transparent 28rem),
    radial-gradient(circle at 12% 42%, rgba(81, 119, 91, 0.11), transparent 30rem),
    linear-gradient(155deg, var(--forest-950) 0%, var(--forest-900) 45%, #071511 100%);
  font-family: var(--text);
  font-size: 22px;
  line-height: 1.55;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, #000, transparent 80%);
}

a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  z-index: 100;
  left: 1rem;
  top: 1rem;
  padding: .55rem .9rem;
  border-radius: 999px;
  color: var(--forest-950);
  background: var(--ink);
  transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }

.site-shell {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  letter-spacing: .08em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(212,191,137,.5);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 28px;
}

.brand strong {
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .24em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.6rem);
}

.site-nav a {
  color: var(--ink-soft);
  font-size: 18px;
  text-decoration: none;
  transition: color .2s ease;
}
.site-nav a:hover, .site-nav a:focus-visible { color: var(--ink); }

.hero {
  position: relative;
  min-height: calc(100svh - 92px);
  padding: clamp(4rem, 9vw, 8.5rem) 0 5rem;
  overflow: hidden;
}

.hero-copy { max-width: 940px; }
.eyebrow {
  margin: 0 0 1rem;
  color: var(--jade-light);
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.hero h1 {
  position: relative;
  z-index: 2;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(72px, 10vw, 164px);
  font-weight: 400;
  line-height: .82;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.hero-intro {
  max-width: 660px;
  margin: 2rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(21px, 2vw, 28px);
}

.hero-orbit {
  position: absolute;
  top: 7%;
  right: -8%;
  width: min(46vw, 660px);
  aspect-ratio: 1;
  border: 1px solid rgba(207,221,198,.13);
  border-radius: 50%;
  box-shadow: inset 0 0 120px rgba(94,156,116,.09), 0 0 100px rgba(68,126,91,.08);
}
.hero-orbit::before,
.hero-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(207,221,198,.12);
}
.hero-orbit::before { inset: 13%; }
.hero-orbit::after { inset: 33%; background: rgba(160,196,162,.035); }

.feature-card {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
  gap: clamp(2rem, 5vw, 5rem);
  margin-top: clamp(3.5rem, 7vw, 7rem);
  padding: clamp(2rem, 4.5vw, 4.2rem);
  border: 1px solid rgba(202,219,195,.3);
  border-radius: 30px;
  background:
    linear-gradient(125deg, rgba(208,229,207,.10), rgba(85,129,98,.035)),
    rgba(10,31,24,.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.feature-card::after {
  content: "";
  position: absolute;
  width: 380px;
  height: 380px;
  right: -150px;
  bottom: -220px;
  border: 1px solid rgba(212,191,137,.18);
  border-radius: 50%;
}

.feature-label {
  display: inline-flex;
  gap: .55rem;
  align-items: center;
  color: var(--gold);
  font-size: 17px;
}
.feature-label::before { content: ""; width: 28px; height: 1px; background: currentColor; }

.feature-card h2 {
  margin: .45rem 0 1rem;
  font-family: var(--serif);
  font-size: clamp(58px, 7vw, 108px);
  font-weight: 400;
  line-height: .86;
}

.feature-card p {
  max-width: 630px;
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(21px, 2vw, 27px);
}

.feature-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.6rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: .55rem 1.15rem .48rem;
  border: 1px solid rgba(220,232,208,.28);
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  font-family: var(--text);
  font-size: 18px;
  text-decoration: none;
  transition: transform .2s ease, background .2s ease, color .2s ease;
}
.button:hover, .button:focus-visible { transform: translateY(-2px); background: rgba(220,232,208,.1); }
.button.primary { color: #0b2018; background: var(--jade-light); border-color: var(--jade-light); }
.button.primary:hover, .button.primary:focus-visible { background: #eef3e8; }

.feature-art {
  position: relative;
  min-height: 330px;
  align-self: stretch;
}

.book-plane {
  position: absolute;
  width: 54%;
  aspect-ratio: .72;
  border: 1px solid rgba(220,232,208,.3);
  border-radius: 10px 26px 10px 10px;
  background: linear-gradient(145deg, rgba(217,228,206,.14), rgba(33,78,57,.09));
  box-shadow: -24px 28px 50px rgba(0,0,0,.22);
  transform: rotate(7deg);
}
.book-plane:nth-child(1) { right: 2%; top: 11%; opacity: .42; transform: rotate(16deg); }
.book-plane:nth-child(2) { right: 15%; top: 6%; opacity: .68; transform: rotate(9deg); }
.book-plane:nth-child(3) { right: 28%; top: 0; transform: rotate(1deg); }
.book-plane:nth-child(3)::after {
  content: "ทางนฤพาน";
  position: absolute;
  inset: 16% 13% auto;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(212,191,137,.4);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(30px, 3vw, 48px);
  line-height: .9;
}

.feature-meta {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--ink-soft);
  font-size: 15px;
}
.feature-meta span { padding: .3rem .65rem; border: 1px solid var(--line); border-radius: 999px; }

.section { padding: clamp(5rem, 10vw, 10rem) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2.2rem; }
.section-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(48px, 6vw, 82px);
  font-weight: 400;
  line-height: .9;
}
.section-heading p { max-width: 500px; margin: 0; color: var(--ink-soft); }

.story-grid, .work-grid { display: grid; gap: 1rem; }
.story-grid { grid-template-columns: repeat(4, 1fr); }
.work-grid { grid-template-columns: repeat(5, 1fr); }

.story-card, .work-card {
  position: relative;
  min-height: 300px;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--glass);
  text-decoration: none;
  overflow: hidden;
  transition: transform .24s ease, border-color .24s ease, background .24s ease;
}
.story-card:hover, .story-card:focus-visible, .work-card:hover, .work-card:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(212,191,137,.45);
  background: rgba(190,220,193,.11);
}
.story-card::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -42px;
  width: 130px;
  height: 130px;
  border: 1px solid rgba(212,191,137,.18);
  border-radius: 50%;
}
.story-card small, .work-card small { color: var(--jade); font-family: Georgia, serif; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.story-card h3, .work-card h3 { margin: 1.4rem 0 .35rem; font-family: var(--serif); font-size: 38px; font-weight: 400; line-height: 1; }
.story-card p, .work-card p { margin: 0; color: var(--ink-soft); font-size: 18px; }
.card-arrow { position: absolute; left: 1.5rem; bottom: 1.35rem; color: var(--gold); font-family: Georgia, serif; }

.work-card { min-height: 260px; }
.work-card:nth-child(2), .work-card:nth-child(4) { transform: translateY(24px); }
.work-card:nth-child(2):hover, .work-card:nth-child(4):hover { transform: translateY(18px); }

/* Homepage portal — follows the selected forest/glass reference */
.portal-home {
  background:
    radial-gradient(ellipse at 72% 54%, rgba(125, 158, 115, .18), transparent 36%),
    radial-gradient(ellipse at 94% 66%, rgba(75, 126, 86, .22), transparent 34%),
    linear-gradient(128deg, #04120f 0%, #092319 48%, #061610 100%);
}

.portal-home::before {
  opacity: .62;
  background:
    radial-gradient(ellipse at 96% 37%, rgba(0, 0, 0, .58), transparent 31%),
    radial-gradient(ellipse at 69% 84%, rgba(0, 0, 0, .36), transparent 35%);
  mask-image: none;
}

.portal-shell { width: min(1500px, calc(100% - 72px)); }
.portal-header { min-height: 98px; }
.portal-header .brand-mark {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  font-family: Georgia, serif;
  font-size: 29px;
  transform: rotate(-10deg);
}
.portal-header .brand strong { color: #eadfc2; font-family: Georgia, serif; font-size: 25px; letter-spacing: .03em; }
.portal-header .site-nav { gap: clamp(.9rem, 2vw, 2.2rem); }
.portal-header .site-nav a { position: relative; font-size: 18px; }
.portal-header .site-nav a.active { color: var(--ink); }
.portal-header .site-nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -.75rem;
  height: 1px;
  background: var(--ink);
}
.portal-header .site-nav .contact-link {
  padding: .45rem 1rem .35rem;
  border: 1px solid rgba(212,191,137,.35);
  border-radius: 999px;
  color: #e7ddc5;
}

.portal-hero {
  position: relative;
  min-height: calc(100svh - 98px);
  padding: clamp(3rem, 6vh, 5.2rem) 0 clamp(4rem, 8vh, 7rem);
  overflow: hidden;
}

.portal-hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 3%;
  right: -4%;
  width: min(54vw, 820px);
  height: 64%;
  border-radius: 90% 20% 60% 30%;
  background:
    radial-gradient(ellipse at 52% 48%, rgba(177, 195, 157, .22), transparent 13%),
    radial-gradient(ellipse at 63% 65%, rgba(0, 0, 0, .7), transparent 43%),
    linear-gradient(125deg, transparent 34%, rgba(119, 154, 111, .14) 35%, transparent 38%);
  filter: blur(16px);
  transform: rotate(-8deg);
  opacity: .92;
}

.portal-hero::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: -7%;
  right: -7%;
  bottom: 5.5%;
  height: 130px;
  border-top: 1px solid rgba(212,191,137,.28);
  border-radius: 50%;
  transform: rotate(-2deg);
  pointer-events: none;
}

.portal-copy { position: relative; z-index: 2; max-width: 680px; margin-left: 2.2rem; }
.portal-copy h1 {
  margin: 0;
  color: #efe4c9;
  font-family: var(--serif);
  font-size: clamp(76px, 8vw, 126px);
  font-weight: 400;
  line-height: .82;
  letter-spacing: -.015em;
}
.portal-copy p { margin: 1.35rem 0 0; color: rgba(232,228,208,.68); font-size: clamp(21px, 1.8vw, 27px); line-height: 1.45; }
.portal-glint { display: block; position: relative; width: 86px; height: 1px; margin: 1.45rem 0 0; background: linear-gradient(90deg, transparent, #b9e4c0, transparent); }
.portal-glint::after { content: ""; position: absolute; left: 47%; top: -3px; width: 7px; height: 7px; border-radius: 50%; background: #c6efd0; box-shadow: 0 0 15px #9ddeb0; }

.portal-card-grid {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  align-items: end;
  gap: clamp(1rem, 2vw, 1.8rem);
  width: min(1240px, calc(100% - 40px));
  margin: clamp(2rem, 4vh, 3.5rem) auto 0;
}

.portal-card {
  position: relative;
  display: block;
  min-height: 410px;
  padding: 2rem 1.5rem;
  border: 1px solid rgba(190,214,184,.47);
  border-radius: 20px;
  color: var(--ink);
  background:
    linear-gradient(165deg, rgba(197,224,198,.11), rgba(23,56,41,.15)),
    rgba(20,55,40,.48);
  box-shadow: 0 26px 60px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.06);
  backdrop-filter: blur(14px);
  text-decoration: none;
  overflow: hidden;
  transition: transform .25s ease, border-color .25s ease, background .25s ease;
}
.portal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(132deg, rgba(255,255,255,.055), transparent 38%, rgba(130,174,135,.06));
  pointer-events: none;
}
.portal-card:hover, .portal-card:focus-visible {
  border-color: rgba(229,217,175,.74);
  background:
    linear-gradient(165deg, rgba(197,224,198,.16), rgba(23,56,41,.19)),
    rgba(20,55,40,.6);
}
.portal-card--fiction { min-height: 440px; transform: translateY(24px); }
.portal-card--dhamma { min-height: 480px; }
.portal-card--article { min-height: 420px; transform: translateY(44px); }
.portal-card--audio { min-height: 460px; transform: translateY(12px); }
.portal-card--fiction:hover { transform: translateY(16px); }
.portal-card--dhamma:hover { transform: translateY(-8px); }
.portal-card--article:hover { transform: translateY(36px); }
.portal-card--audio:hover { transform: translateY(4px); }

.portal-card-copy { position: relative; z-index: 3; text-align: center; }
.portal-card-copy h2 { margin: 1rem 0 .25rem; font-family: var(--text); font-size: clamp(30px, 2.4vw, 39px); font-weight: 400; line-height: 1.06; }
.portal-card-copy p { margin: 0; color: rgba(221,210,171,.72); font-size: 17px; line-height: 1.25; }

.portal-icon { position: relative; z-index: 3; width: 50px; height: 50px; margin: 0 auto; color: #daca9f; }
.icon-book i { position: absolute; top: 12px; width: 19px; height: 24px; border: 1px solid currentColor; }
.icon-book i:first-child { left: 5px; border-radius: 8px 0 0 2px; transform: skewY(9deg); }
.icon-book i:last-child { right: 5px; border-radius: 0 8px 2px 0; transform: skewY(-9deg); }
.icon-leaf i { position: absolute; left: 14px; top: 7px; width: 21px; height: 33px; border: 1px solid currentColor; border-radius: 100% 0 100% 0; transform: rotate(-25deg); }
.icon-leaf i::after { content: ""; position: absolute; left: 9px; top: 3px; width: 1px; height: 30px; background: currentColor; transform: rotate(-20deg); transform-origin: bottom; }
.icon-pen i { position: absolute; left: 22px; top: 5px; width: 8px; height: 37px; border: 1px solid currentColor; transform: rotate(42deg); }
.icon-pen i::after { content: ""; position: absolute; left: 1px; bottom: -7px; border-left: 3px solid transparent; border-right: 3px solid transparent; border-top: 7px solid currentColor; }
.icon-wave { display: flex; align-items: center; justify-content: center; gap: 4px; }
.icon-wave i { width: 1px; height: 12px; background: currentColor; }
.icon-wave i:nth-child(2), .icon-wave i:nth-child(4) { height: 24px; }
.icon-wave i:nth-child(3) { height: 36px; }

.portal-art { position: absolute; z-index: 1; inset: auto 0 0; height: 52%; opacity: .7; }
.art-book i { position: absolute; bottom: 0; width: 49%; height: 70%; border-top: 1px solid rgba(224,215,177,.42); background: linear-gradient(150deg, rgba(205,217,190,.06), transparent); }
.art-book i:first-child { left: 2%; border-radius: 100% 0 0; transform: skewY(9deg); }
.art-book i:last-child { right: 2%; border-radius: 0 100% 0 0; transform: skewY(-9deg); }
.art-leaf i { position: absolute; left: 24%; bottom: -12%; width: 52%; height: 90%; border: 1px solid rgba(224,215,177,.38); border-radius: 100% 0 100% 0; transform: rotate(-38deg); }
.art-leaf i::before, .art-leaf i::after { content: ""; position: absolute; left: 48%; width: 1px; background: rgba(224,215,177,.28); transform-origin: bottom; }
.art-leaf i::before { bottom: 5%; height: 84%; transform: rotate(-23deg); }
.art-leaf i::after { bottom: 26%; height: 42%; transform: rotate(38deg); }
.art-paper i { position: absolute; right: 10%; bottom: -12%; width: 67%; height: 86%; border: 1px solid rgba(224,215,177,.3); background: rgba(218,220,194,.035); transform: rotate(8deg); }
.art-paper i:nth-child(2) { right: 17%; bottom: -17%; transform: rotate(1deg); }
.art-paper i:nth-child(3) { right: 25%; bottom: -20%; transform: rotate(-7deg); }
.art-wave i { position: absolute; left: 8%; right: 8%; bottom: 33%; height: 55px; border-top: 1px solid rgba(224,215,177,.34); border-radius: 50%; box-shadow: 0 -12px 0 -11px rgba(224,215,177,.28), 0 12px 0 -11px rgba(224,215,177,.28); }

.portal-home #stories { position: relative; z-index: 5; background: rgba(5,17,13,.52); }

/* Fiction hub */
.fiction-page {
  background:
    radial-gradient(circle at 88% 9%, rgba(78,130,99,.24), transparent 30rem),
    linear-gradient(155deg, var(--forest-950), var(--forest-900) 52%, #071511);
}
.fiction-hero { padding: clamp(4.5rem, 9vw, 8rem) 0 clamp(5rem, 9vw, 8rem); }
.fiction-heading { max-width: 760px; }
.fiction-heading h1 { margin: 0; font-family: var(--serif); font-size: clamp(76px, 10vw, 150px); font-weight: 400; line-height: .8; }
.fiction-heading > p:last-child { max-width: 650px; margin: 1.4rem 0 0; color: var(--ink-soft); font-size: clamp(21px, 2vw, 27px); }
.fiction-feature { margin-top: clamp(3.5rem, 7vw, 6.5rem); }

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 150px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 16px;
}
.site-footer a { text-decoration: none; }

/* Book landing */
.book-hero { padding: clamp(4.5rem, 9vw, 8rem) 0 4rem; text-align: center; }
.book-hero h1 { margin: .4rem 0 1.2rem; font-family: var(--serif); font-size: clamp(82px, 13vw, 190px); font-weight: 400; line-height: .78; }
.book-hero .lede { max-width: 690px; margin: 0 auto; color: var(--ink-soft); font-size: clamp(22px, 2vw, 29px); }
.book-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .75rem; margin-top: 1.8rem; }
.book-rule { width: 1px; height: 90px; margin: 3.2rem auto 0; background: linear-gradient(var(--gold), transparent); }

.trailer-wrap { max-width: 960px; margin: 0 auto; padding: 0 0 clamp(5rem, 10vw, 9rem); }
.trailer { position: relative; aspect-ratio: 16/9; border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: #000; box-shadow: var(--shadow); }
.trailer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.toc { padding: clamp(5rem, 8vw, 8rem) 0; border-top: 1px solid var(--line); }
.toc h2 { width: min(760px, 100%); margin: 0 auto 2rem; font-family: var(--serif); font-size: clamp(52px, 6vw, 84px); font-weight: 400; }
.toc-grid { display: grid; grid-template-columns: 1fr; gap: .72rem; width: min(760px, 100%); margin: 0 auto; }
.toc-link {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-height: 62px;
  padding: .72rem 1.15rem .62rem;
  border: 1px solid rgba(212,191,137,.42);
  border-radius: 14px;
  color: var(--ink-soft);
  background: transparent;
  text-decoration: none;
  transition: color .2s ease, border-color .2s ease, transform .2s ease;
}
.toc-link::after { content: "→"; color: rgba(212,191,137,.62); font-family: Georgia, serif; font-size: 16px; }
.toc-link:hover, .toc-link:focus-visible { color: var(--ink); border-color: var(--gold); transform: translateX(5px); }
.toc-link span { color: var(--gold); font-family: Georgia, serif; font-size: 12px; letter-spacing: .1em; }
.toc-link strong { font-weight: 400; font-size: 22px; }

/* Reader */
.reader-page {
  color-scheme: dark;
  color: #ddd7c7;
  background:
    radial-gradient(circle at 50% 0%, rgba(52, 91, 70, .22), transparent 32rem),
    linear-gradient(160deg, #06110e 0%, #0a1c17 55%, #07140f 100%);
}
.reader-page::before { display: none; }
.reader-progress { position: fixed; z-index: 100; top: 0; left: 0; width: 0; height: 3px; background: linear-gradient(90deg, var(--jade), var(--gold)); }
.reader-header { position: sticky; z-index: 30; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; padding: 0 24px; border-bottom: 1px solid rgba(212,191,137,.18); background: rgba(6,17,14,.9); backdrop-filter: blur(14px); }
.reader-header a { color: #ddd4bc; font-size: 17px; text-decoration: none; }
.reader-tools { display: flex; align-items: center; gap: .4rem; }
.reader-tools button { width: 38px; height: 38px; border: 1px solid rgba(212,191,137,.28); border-radius: 50%; color: #ddd4bc; background: rgba(255,255,255,.025); font-family: Georgia, serif; cursor: pointer; }
.reader-tools button:hover, .reader-tools button:focus-visible { border-color: var(--gold); color: var(--ink); }

.reading-shell { width: min(760px, calc(100% - 40px)); margin: 0 auto; }
.chapter-heading { padding: clamp(5rem, 12vw, 9rem) 0 3rem; text-align: center; }
.chapter-heading .chapter-kicker { color: var(--jade); font-family: Georgia, serif; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; }
.chapter-heading h1 { margin: .5rem 0 0; color: #efe4c9; font-family: var(--serif); font-size: clamp(60px, 10vw, 104px); font-weight: 400; line-height: .86; }

.reading-body { padding-bottom: 6rem; font-family: var(--text); font-size: var(--reader-font, 25px); line-height: 1.74; }
.reading-body p { margin: 0 0 .72em; text-indent: 1.5em; }
.reading-body p:first-child { text-indent: 0; }
.reading-body p:first-child::first-letter { float: left; margin: .04em .12em 0 0; color: var(--gold); font-family: var(--serif); font-size: 3.8em; line-height: .72; }
.reading-body h2 {
  margin: 2.6em 0 1.4em;
  color: #d8caa2;
  font-family: var(--text);
  font-size: 1.48em;
  font-weight: 700;
  font-style: italic;
  line-height: 1.25;
  text-align: center;
  text-indent: 0;
}

.chapter-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: .75rem; padding: 2rem 0 5rem; border-top: 1px solid rgba(212,191,137,.16); }
.chapter-nav a { display: flex; min-height: 70px; padding: .8rem 1rem; border: 1px solid rgba(212,191,137,.24); border-radius: 14px; color: #d9d2bd; background: rgba(255,255,255,.02); text-decoration: none; align-items: center; }
.chapter-nav a:hover, .chapter-nav a:focus-visible { border-color: var(--gold); color: var(--ink); }
.chapter-nav .next { justify-content: flex-end; text-align: right; }
.chapter-nav .toc-home { justify-content: center; }

body[data-reader-size="small"] { --reader-font: 22px; }
body[data-reader-size="large"] { --reader-font: 29px; }

@media (max-width: 1050px) {
  .feature-card { grid-template-columns: 1fr; }
  .feature-art { min-height: 260px; max-width: 520px; width: 100%; margin: 0 auto; }
  .story-grid { grid-template-columns: repeat(2, 1fr); }
  .work-grid { grid-template-columns: repeat(2, 1fr); }
  .work-card:nth-child(2), .work-card:nth-child(4) { transform: none; }
  .toc-grid { grid-template-columns: 1fr; }
  .portal-shell { width: min(100% - 36px, 1500px); }
  .portal-header .site-nav a:nth-child(3),
  .portal-header .site-nav a:nth-child(4),
  .portal-header .site-nav a:nth-child(5) { display: none; }
  .portal-card-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); width: min(720px, 100%); }
  .portal-card--fiction, .portal-card--dhamma, .portal-card--article, .portal-card--audio { min-height: 390px; transform: none; }
  .portal-card:hover { transform: translateY(-6px); }
  .fiction-feature { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body { font-size: 20px; }
  .site-shell { width: min(100% - 28px, 1440px); }
  .site-header { min-height: 76px; }
  .site-nav a:not(:last-child) { display: none; }
  .hero { min-height: auto; padding-top: 4rem; }
  .hero h1 { font-size: clamp(68px, 22vw, 104px); }
  .hero-orbit { right: -45%; top: 5%; width: 90vw; }
  .feature-card { padding: 1.5rem; border-radius: 22px; }
  .feature-card h2 { font-size: 66px; }
  .feature-art { min-height: 220px; }
  .feature-meta { position: static; justify-content: flex-start; margin-top: 1.3rem; }
  .section-heading { display: block; }
  .section-heading p { margin-top: .8rem; }
  .story-grid, .work-grid, .toc-grid { grid-template-columns: 1fr; }
  .story-card, .work-card { min-height: 230px; }
  .site-footer { display: block; padding: 2rem 0; }
  .site-footer p { margin: .3rem 0; }
  .book-hero h1 { font-size: 90px; }
  .reader-header { padding: 0 14px; }
  .reader-header .reader-home { max-width: 120px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .reading-shell { width: min(100% - 30px, 760px); }
  .reading-body { font-size: var(--reader-font, 23px); line-height: 1.68; }
  body[data-reader-size="small"] { --reader-font: 20px; }
  body[data-reader-size="large"] { --reader-font: 27px; }
  .chapter-nav { grid-template-columns: 1fr 1fr; }
  .chapter-nav .toc-home { grid-column: 1 / -1; grid-row: 2; }
  .portal-shell { width: min(100% - 26px, 1500px); }
  .portal-header .brand strong { font-size: 20px; }
  .portal-header .site-nav a { display: none; }
  .portal-header .site-nav .contact-link { display: inline-flex; font-size: 16px; }
  .portal-hero { min-height: calc(100svh - 76px); padding: 2.8rem 0 3.5rem; }
  .portal-copy { margin-left: .5rem; }
  .portal-copy h1 { font-size: clamp(58px, 17vw, 86px); }
  .portal-copy p { font-size: 19px; }
  .portal-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; width: 100%; margin-top: 2.4rem; }
  .portal-card { min-width: 0; padding: 1.25rem .7rem; border-radius: 16px; }
  .portal-card--fiction, .portal-card--dhamma, .portal-card--article, .portal-card--audio { min-height: 240px; transform: none; }
  .portal-card-copy h2 { font-size: clamp(26px, 7.5vw, 32px); }
  .portal-card-copy p { font-size: 14px; }
  .portal-icon { transform: scale(.82); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Books-first homepage */
.books-shell { width: min(100% - 48px, 1380px); }
.books-header { position: sticky; top: 0; min-height: 82px; padding: 0 18px; background: rgba(6,17,14,.82); backdrop-filter: blur(18px); }
.books-header .site-nav { display: flex; align-items: center; gap: clamp(1rem, 2.5vw, 2.4rem); }
.books-header .site-nav a { position: relative; color: var(--ink-soft); font-size: 18px; text-decoration: none; }
.books-header .site-nav a::after { content: ""; position: absolute; right: 0; bottom: -.4rem; left: 0; height: 1px; background: var(--gold); transform: scaleX(0); transition: transform .2s ease; }
.books-header .site-nav a:hover::after, .books-header .site-nav a:focus-visible::after { transform: scaleX(1); }

.books-hero { padding: clamp(5rem, 10vw, 9rem) 0 clamp(5rem, 8vw, 8rem); text-align: center; }
.books-hero .eyebrow { margin: 0 0 .55rem; color: var(--gold); font-family: Georgia, serif; font-size: 11px; letter-spacing: .28em; }
.books-hero h1 { margin: 0; font-family: var(--serif); font-size: clamp(72px, 10vw, 142px); font-weight: 400; line-height: .88; }
.books-hero > p:last-of-type { max-width: 620px; margin: 1.2rem auto 0; color: var(--ink-soft); }

.category-jump-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(.8rem, 2vw, 1.5rem); margin-top: clamp(3rem, 7vw, 6rem); text-align: left; }
.category-jump-grid a { position: relative; overflow: hidden; border: 1px solid rgba(212,191,137,.32); border-radius: 18px; background: rgba(255,255,255,.04); box-shadow: var(--shadow); text-decoration: none; transition: border-color .2s ease, transform .2s ease; }
.category-jump-grid a:hover, .category-jump-grid a:focus-visible { border-color: var(--gold); transform: translateY(-6px); }
.category-jump-grid img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.category-jump-grid span { display: block; padding: .75rem 1rem .65rem; color: var(--ink); font-size: 25px; }

.book-section { padding: clamp(4.5rem, 8vw, 8rem) 0; border-top: 1px solid var(--line); scroll-margin-top: 80px; }
.book-section-heading { display: grid; grid-template-columns: 48px 1fr; gap: 1rem; align-items: start; margin-bottom: clamp(2rem, 5vw, 4rem); }
.book-section-heading > span { padding-top: .75rem; color: var(--gold); font-family: Georgia, serif; font-size: 11px; letter-spacing: .12em; }
.book-section-heading h2 { margin: 0; font-family: var(--serif); font-size: clamp(58px, 7vw, 96px); font-weight: 400; line-height: .9; }
.book-section-heading p { margin: .65rem 0 0; color: var(--ink-soft); }

.book-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(1rem, 2vw, 1.7rem); }
.book-card { display: flex; min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid rgba(212,191,137,.24); border-radius: 18px; color: inherit; background: rgba(206,224,200,.055); text-decoration: none; }
.book-card > img, .nirupan-cover { display: block; width: 100%; aspect-ratio: 3 / 4.18; object-fit: cover; background: #eeeadd; }
.book-card > div { display: flex; flex: 1; min-height: 185px; flex-direction: column; padding: 1.1rem 1.15rem 1.2rem; }
.book-card h3 { margin: 0; font-family: var(--serif); font-size: 32px; font-weight: 400; line-height: 1.08; }
.book-card p { margin: .35rem 0 1rem; color: var(--ink-soft); font-size: 18px; line-height: 1.35; }
.book-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: auto; }
.book-actions a { display: inline-flex; min-height: 38px; align-items: center; padding: .3rem .75rem .22rem; border: 1px solid rgba(212,191,137,.5); border-radius: 999px; color: var(--ink); font-size: 16px; text-decoration: none; transition: border-color .2s ease, background .2s ease; }
.book-actions a:hover, .book-actions a:focus-visible { border-color: var(--gold); background: rgba(212,191,137,.1); }

.book-card--featured { grid-column: 1 / -1; display: block; width: 100%; max-width: 992px; aspect-ratio: 1984 / 1387; justify-self: center; border-color: rgba(212,191,137,.68); background: #dbe2e1; cursor: pointer; transition: border-color .2s ease, transform .2s ease; }
.book-card--featured:hover, .book-card--featured:focus-visible { border-color: var(--gold); transform: translateY(-5px); }
.book-card--featured > div { min-height: 100%; justify-content: center; padding: clamp(1.3rem, 3vw, 2.5rem); }
.book-card--featured h3 { font-size: clamp(44px, 5vw, 66px); }
.featured-label { align-self: flex-start; margin-bottom: .9rem; color: var(--gold); font-size: 13px; letter-spacing: .12em; }
.nirupan-cover { display: block; width: 100%; height: 100%; min-height: 0; aspect-ratio: auto; padding: 0; object-fit: cover; object-position: center; background: #dbe2e1; }
.fiction-trailer-block { grid-column: 1 / -1; width: 100%; max-width: 480px; margin: 0 0 clamp(1.2rem, 3vw, 2.2rem); justify-self: center; align-self: start; text-align: center; }
.fiction-trailer-block > span { display: block; margin-bottom: .8rem; color: var(--gold); font-family: Georgia, serif; font-size: 11px; letter-spacing: .18em; }
.fiction-trailer { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid rgba(212,191,137,.44); border-radius: 20px; background: #020605; box-shadow: 0 26px 70px rgba(0,0,0,.32); }
.fiction-trailer::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.035); pointer-events: none; }
.fiction-trailer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.fiction-secondary-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2vw, 1.7rem); width: 100%; max-width: 992px; justify-self: center; }
#fable .book-card { grid-column: 1 / -1; width: 100%; max-width: 313px; justify-self: center; }

@media (max-width: 1050px) {
  .category-jump-grid, .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .books-shell { width: min(100% - 26px, 1380px); }
  .books-header { padding: 0 6px; }
  .books-header .site-nav { gap: .75rem; }
  .books-header .site-nav a { display: none; }
  .books-header .site-nav a:nth-child(3) { display: inline-flex; }
  .books-hero { padding-top: 4.5rem; }
  .category-jump-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-jump-grid span { font-size: 21px; }
  .book-grid { grid-template-columns: 1fr 1fr; gap: .8rem; }
  .book-card > div { min-height: 170px; padding: .85rem; }
  .book-card h3 { font-size: 25px; }
  .book-card p { font-size: 16px; }
  .book-actions a { min-height: 34px; padding-inline: .6rem; font-size: 14px; }
  .book-card--featured { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .nirupan-cover { padding: 0; }
  .fiction-secondary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fiction-secondary-grid .book-card:last-child { grid-column: 1 / -1; width: calc(50% - .4rem); justify-self: center; }
}

@media (max-width: 440px) {
  .book-grid { grid-template-columns: 1fr; }
  .book-card--featured { grid-template-columns: 1fr; }
  .nirupan-cover { min-height: 0; }
  .fiction-secondary-grid { grid-template-columns: 1fr; }
  .fiction-secondary-grid .book-card:last-child { grid-column: auto; width: 100%; }
}
