/* ============================================
   Rudra Sabaratnam — Author Website
   Minimal literary design
   ============================================ */

:root {
  --paper: #f6f3ec;
  --ink: #201d18;
  --ink-soft: #55503f;
  --brass: #8e6f44;
  --line: rgba(32, 29, 24, 0.16);
  --serif: "EB Garamond", Georgia, serif;
  --display: "Cormorant Garamond", Georgia, serif;
  --sans: "Karla", Helvetica, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

/* ---------- Navigation ---------- */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 4vw;
  transition: background 0.4s ease, box-shadow 0.4s ease, padding 0.4s ease;
}

.nav.scrolled {
  background: rgba(246, 243, 236, 0.95);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--line);
  padding: 0.9rem 4vw;
}

.nav-name {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 2.4rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.nav-links a:hover,
.nav-links a.active {
  border-bottom-color: var(--brass);
  color: var(--brass);
}

.nav.on-image:not(.scrolled) { color: #fff; }
.nav.on-image:not(.scrolled) a { color: #fff; }
.nav.on-image:not(.scrolled) a:hover,
.nav.on-image:not(.scrolled) a.active { color: #fff; border-bottom-color: #fff; }

/* ---------- Hero (home) ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  background-size: cover;
  background-position: center 30%;
  color: #fff;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(20, 18, 15, 0.18) 0%, rgba(20, 18, 15, 0) 35%, rgba(20, 18, 15, 0.62) 100%);
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 4vw 11vh;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 5.2rem);
  letter-spacing: 0.06em;
  line-height: 1.05;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.hero .hero-role {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  margin-top: 1.2rem;
  opacity: 0.92;
}

.hero .hero-quote {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  max-width: 34ch;
  margin-top: 2.2rem;
  line-height: 1.5;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.45);
}

/* ---------- Sections ---------- */

.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6.5rem 4vw;
}

.eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 1.6rem;
}

.section-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  line-height: 1.12;
  margin-bottom: 1.8rem;
}

.lede {
  font-size: 1.28rem;
  max-width: 62ch;
  color: var(--ink-soft);
}

/* ---------- Book panels (home + books page) ---------- */

.book-panel {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}

.book-panel:last-of-type { border-bottom: 1px solid var(--line); }

.book-image {
  min-height: 480px;
  background-size: cover;
  background-position: center;
}

.book-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 5rem 5vw;
}

.book-panel.reverse .book-image { order: 2; }
.book-panel.reverse .book-text { order: 1; }

.book-text h2, .book-text h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  line-height: 1.15;
  margin-bottom: 1.1rem;
}

.book-text .book-tag {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 1.2rem;
}

.book-text p {
  color: var(--ink-soft);
  max-width: 52ch;
  margin-bottom: 2rem;
}

/* ---------- Buttons & links ---------- */

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 0.95rem 2.2rem;
  transition: background 0.25s ease, color 0.25s ease;
  align-self: flex-start;
}

.btn:hover { background: var(--ink); color: var(--paper); }

.btn.brass { border-color: var(--brass); color: var(--brass); }
.btn.brass:hover { background: var(--brass); color: var(--paper); }

.text-link {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--brass);
  border-bottom: 1px solid var(--brass);
  padding-bottom: 3px;
}

.text-link:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- Book detail pages ---------- */

.book-hero {
  position: relative;
  min-height: 62vh;
  display: flex;
  align-items: flex-end;
  background-size: cover;
  background-position: center;
  color: #fff;
}

.book-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(20, 18, 15, 0.3) 0%, rgba(20, 18, 15, 0.05) 40%, rgba(20, 18, 15, 0.66) 100%);
}

.book-hero .hero-inner { padding-bottom: 7vh; }

.book-hero h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 1.08;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.4);
}

.book-hero .hero-role { 
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 1.1rem;
  opacity: 0.92;
}

.book-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 5.5rem 4vw 3rem;
}

.book-body p { margin-bottom: 1.5rem; }

.book-body .opening-line {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.55rem;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 2.4rem;
}

.buy-block {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 4vw 6.5rem;
  text-align: center;
  border-top: 1px solid var(--line);
  padding-top: 3.2rem;
}

.buy-block .avail {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.3rem;
  margin-bottom: 1.6rem;
}

/* ---------- Divider quote ---------- */

.quote-band {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  padding: 4.5rem 4vw;
}

.quote-band p {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.4rem, 3vw, 2rem);
  max-width: 40ch;
  margin: 0 auto;
  line-height: 1.5;
}

/* ---------- Contact ---------- */

.contact-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 10rem 4vw 7rem;
  text-align: center;
}

.contact-wrap .section-title { margin-bottom: 1.2rem; }

.contact-wrap p { color: var(--ink-soft); margin-bottom: 2.4rem; }

.contact-email {
  font-family: var(--display);
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--brass);
  padding-bottom: 4px;
  transition: color 0.25s ease;
}

.contact-email:hover { color: var(--brass); }

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--line);
  padding: 2.6rem 4vw;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

footer .foot-name {
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

footer .foot-meta {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
  .nav { padding: 1rem 5vw; flex-direction: column; gap: 0.7rem; }
  .nav.scrolled { padding: 0.8rem 5vw; }
  .nav-links { gap: 1.4rem; }
  .book-panel { grid-template-columns: 1fr; }
  .book-panel.reverse .book-image { order: 0; }
  .book-image { min-height: 320px; }
  .book-text { padding: 3rem 6vw; }
  .hero-inner { padding-bottom: 14vh; }
  .section { padding: 4.5rem 6vw; }
}
