/* ==========================================================
   Amrrit Amberly — Author Website
   Colour palette and fonts live in the :root block below.
   Change a value there and it updates across the whole site.
   ========================================================== */

:root {
  --black: #0a0a0a;
  --black-2: #111010;
  --black-3: #181616;
  --ivory: #f1ead9;
  --ivory-dim: #b9b1a1;
  --ivory-faint: #6f6a61;
  --red: #8e2a2a;
  --red-bright: #b33a3a;
  --red-glow: rgba(142, 42, 42, 0.35);
  --line: rgba(241, 234, 217, 0.12);

  --font-display: "Cormorant Garamond", "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --container: 1160px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --section-y: clamp(5rem, 12vw, 9rem);
  --radius: 2px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--ivory);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
em { font-style: italic; }

::selection { background: var(--red); color: var(--ivory); }

:focus-visible {
  outline: 2px solid var(--red-bright);
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  background: var(--ivory);
  color: var(--black);
  padding: 0.6rem 1rem;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---------- Typography helpers ---------- */
.eyebrow {
  margin: 0 0 1.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--red-bright);
}

.section { padding: var(--section-y) 0; position: relative; }

.section__head { max-width: 680px; margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.section__head--center { margin-left: auto; margin-right: auto; text-align: center; }

.section__title {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.25rem, 1.5rem + 3.5vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.section__lead {
  margin: 0;
  color: var(--ivory-dim);
  font-size: 1.0625rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 48px;
  padding: 0.85rem 1.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.4s var(--ease), color 0.4s var(--ease),
    border-color 0.4s var(--ease), box-shadow 0.4s var(--ease), transform 0.4s var(--ease);
}
.btn--lg { padding: 1rem 2.25rem; }

.btn--primary {
  background: var(--red);
  color: var(--ivory);
  border-color: var(--red);
}
.btn--primary:hover {
  background: var(--red-bright);
  border-color: var(--red-bright);
  box-shadow: 0 10px 40px -10px var(--red-glow);
  transform: translateY(-2px);
}

.btn--ghost {
  background: transparent;
  color: var(--ivory);
  border-color: var(--line);
}
.btn--ghost:hover {
  border-color: var(--ivory);
  transform: translateY(-2px);
}

/* ---------- Navigation ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: rgba(10, 10, 10, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.nav__brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.nav__menu {
  display: flex;
  align-items: center;
  gap: 2.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__menu a {
  position: relative;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ivory-dim);
  transition: color 0.3s var(--ease);
}
.nav__menu a:not(.nav__cta)::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 1px;
  background: var(--red-bright);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.nav__menu a:hover,
.nav__menu a.is-active { color: var(--ivory); }
.nav__menu a:hover::after,
.nav__menu a.is-active::after { transform: scaleX(1); transform-origin: left; }

.nav__cta {
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--red);
  color: var(--ivory) !important;
  transition: background 0.3s var(--ease);
}
.nav__cta:hover { background: var(--red); }

.nav__toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  position: relative;
  z-index: 60;
}
.nav__toggle span {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 1px;
  background: var(--ivory);
  transition: transform 0.4s var(--ease), top 0.4s var(--ease);
}
.nav__toggle span:nth-child(1) { top: 17px; }
.nav__toggle span:nth-child(2) { top: 26px; }
.nav__toggle[aria-expanded="true"] span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { top: 21px; transform: rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(142, 42, 42, 0.28), transparent 60%),
    radial-gradient(ellipse at 50% 50%, #141212 0%, var(--black) 70%);
}

.hero__glow {
  position: absolute;
  left: 50%;
  top: 55%;
  width: min(900px, 140vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--red-glow) 0%, transparent 60%);
  filter: blur(40px);
  opacity: 0.55;
  animation: breathe 9s ease-in-out infinite;
  pointer-events: none;
}

/* Subtle film grain (an inline SVG noise texture) */
.hero__grain {
  position: absolute;
  inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.07;
  animation: grain 8s steps(10) infinite;
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding-top: 72px;
}

.hero__title {
  margin: 0 0 1.75rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.25rem, 1.5rem + 9vw, 9rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.hero__line { display: block; }
.hero__title em {
  color: var(--red-bright);
  font-weight: 400;
}

.hero__series {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.1rem, 1rem + 0.6vw, 1.5rem);
  color: var(--ivory-dim);
}

.hero__author {
  margin: 0 0 2.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--ivory);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 64px;
  background: var(--line);
  overflow: hidden;
}
.hero__scroll span {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent, var(--red-bright));
  animation: drip 2.4s var(--ease) infinite;
}

/* ---------- Featured book ---------- */
.book { background: var(--black); }

.book__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(3rem, 7vw, 6rem);
  align-items: start;
}

/* The cover stays in view while the long description scrolls past (desktop only). */
.book__cover-wrap {
  margin: 0;
  display: flex;
  justify-content: center;
  position: sticky;
  top: 110px;
}

/* Official cover: never cropped or stretched — width and height scale together. */
.book__cover-img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 380px);
  max-height: calc(100vh - 150px);
  object-fit: contain;
  border-radius: 2px;
  box-shadow:
    0 30px 60px -20px rgba(0, 0, 0, 0.95),
    0 0 90px -25px var(--red-glow),
    0 0 0 1px rgba(241, 234, 217, 0.06);
  transition: transform 0.9s var(--ease), box-shadow 0.9s var(--ease);
}
.book__cover-wrap:hover .book__cover-img {
  transform: translateY(-6px);
  box-shadow:
    0 40px 70px -20px rgba(0, 0, 0, 0.95),
    0 0 110px -20px var(--red-glow),
    0 0 0 1px rgba(241, 234, 217, 0.08);
}

.book__subtitle {
  margin: -0.5rem 0 2rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--ivory-dim);
}

/* ---- Book description: built for comfortable long-form reading ---- */
.book__blurb {
  max-width: 62ch;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  font-size: clamp(1.02rem, 0.98rem + 0.2vw, 1.1rem);
  line-height: 1.85;
}
.book__blurb p { margin: 0 0 1.35rem; color: var(--ivory-dim); }

/* Opening lines */
.book__blurb .book__hook {
  margin-bottom: 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem);
  line-height: 1.3;
  color: var(--ivory);
}
.book__blurb .book__hook + p:not(.book__hook) { margin-top: 2rem; }

/* Short turning-point lines ("Then ...") */
.book__blurb .book__beat {
  margin: 2rem 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.45rem);
  line-height: 1.4;
  color: var(--ivory);
}

/* The central question */
.book__blurb .book__question {
  margin: 2rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--red);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 1.15rem + 0.7vw, 1.65rem);
  line-height: 1.35;
  color: var(--ivory);
}

/* Closing triplet */
.book__closing { margin: 2.5rem 0; }
.book__blurb .book__closing p {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 1.15rem + 0.6vw, 1.6rem);
  line-height: 1.35;
  color: var(--ivory);
}
.book__blurb .book__closing p:last-child { color: var(--red-bright); font-style: italic; }

.book__blurb .book__summary {
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
  font-size: 0.98rem;
}

.book__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.75rem;
  margin: 2rem 0;
  padding: 1.5rem 0;
  list-style: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.book__meta span {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ivory-faint);
}

.book__actions { display: flex; flex-wrap: wrap; gap: 1rem; }
.book__actions--end { margin-top: 2.5rem; }

/* ---------- Interlude ---------- */
.interlude {
  padding: clamp(4rem, 10vw, 7rem) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse at center, rgba(142, 42, 42, 0.14), transparent 70%),
    var(--black-2);
  text-align: center;
}
.interlude__text {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.2rem + 2.5vw, 3.25rem);
  line-height: 1.25;
}
.interlude__figure { margin: 0 auto; max-width: 900px; }
.interlude__text em { color: var(--red-bright); }
.interlude__caption {
  margin-top: 1.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ivory-faint);
}

/* ---------- Series ---------- */
.series { background: var(--black); }

.series__kicker {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.45rem);
  color: var(--ivory);
}

.series__note {
  margin: 2rem 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ivory-faint);
}

.series__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.series-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  min-height: 280px;
  padding: 2rem;
  background: var(--black-3);
  border: 1px solid var(--line);
  transition: border-color 0.5s var(--ease), transform 0.5s var(--ease);
}
.series-card:hover { border-color: rgba(179, 58, 58, 0.6); transform: translateY(-4px); }
.series-card--active {
  border-color: rgba(179, 58, 58, 0.45);
  background: linear-gradient(180deg, rgba(142, 42, 42, 0.16), var(--black-3) 70%);
}

.series-card__num {
  font-family: var(--font-display);
  font-size: 3.5rem;
  line-height: 1;
  color: var(--red-bright);
}
.series-card:not(.series-card--active) .series-card__num { color: var(--ivory-faint); }

.series-card__label {
  margin: 0 0 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ivory-faint);
}
.series-card--active .series-card__label { color: var(--red-bright); }

.series-card__title {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.75rem;
  line-height: 1.1;
}
.series-card__title--muted { color: var(--ivory-dim); font-style: italic; }

.series-card__link {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ivory-dim);
  transition: color 0.3s var(--ease);
}
.series-card__link:hover { color: var(--ivory); }

/* ---------- About ---------- */
.about { background: var(--black-2); border-top: 1px solid var(--line); }

.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(3rem, 7vw, 6rem);
  align-items: start;
}

/* Portrait stays beside the biography as it scrolls (desktop only). */
.about__portrait {
  position: sticky;
  top: 120px;
  width: 100%;
  max-width: 400px;
  margin: 0.5rem auto 0;
  padding: 0 14px 14px 0; /* room for the offset frame */
}

/* Thin muted-red frame, offset behind the photo */
.about__portrait::before {
  content: "";
  position: absolute;
  inset: 14px 0 0 14px;
  border: 1px solid rgba(179, 58, 58, 0.45);
  pointer-events: none;
}

/* The photograph itself: whole image, natural proportions, no filters. */
.about__portrait-img {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(241, 234, 217, 0.14);
  box-shadow:
    0 30px 60px -24px rgba(0, 0, 0, 0.95),
    0 0 90px -30px var(--red-glow);
}

.about__bio { max-width: 62ch; }
.about__bio p {
  margin: 0 0 1.5rem;
  color: var(--ivory-dim);
  font-size: clamp(1.02rem, 0.98rem + 0.2vw, 1.1rem);
  line-height: 1.85;
}
.about__bio p:first-child {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.45rem);
  line-height: 1.55;
  color: var(--ivory);
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  margin-top: 0.5rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--line);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--ivory-dim);
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.social-link strong { font-weight: 500; color: var(--ivory); }
.social-link:hover { color: var(--ivory); border-color: var(--red-bright); }

/* ---------- Contact ---------- */
.contact { background: var(--black); border-top: 1px solid var(--line); }
.contact__inner { max-width: 760px; }

.contact__email {
  color: var(--ivory);
  text-decoration: none;
  border-bottom: 1px solid var(--red);
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
  word-break: break-word;
}
.contact__email:hover { color: var(--red-bright); border-color: var(--red-bright); }

.contact-form { display: grid; gap: 1.5rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.field { display: flex; flex-direction: column; gap: 0.5rem; }

.field label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ivory-dim);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  background: var(--black-3);
  color: var(--ivory);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-size: 1rem; /* 16px stops iPhones zooming in on tap */
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ivory-dim) 50%),
    linear-gradient(135deg, var(--ivory-dim) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--red-bright);
  background: #1d1a1a;
}
.field .is-invalid { border-color: var(--red-bright); }

.form-status { margin: 0; min-height: 1.5em; font-size: 0.9rem; color: var(--ivory-dim); }
.form-status.is-error { color: #e07a7a; }

.contact-form .btn { justify-self: start; }

/* ---------- Footer ---------- */
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid var(--line);
  background: var(--black);
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer__links a {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ivory-dim);
}
.footer__links a:hover { color: var(--ivory); }
.footer__copy { margin: 0; width: 100%; font-size: 0.8rem; color: var(--ivory-faint); }

/* ---------- Scroll-reveal animation ---------- */
/* Only hide elements when JavaScript is running, so content is never lost. */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
  transition-delay: var(--delay, 0s);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@keyframes breathe {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.08); }
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-5%, 4%); }
  40% { transform: translate(4%, -6%); }
  60% { transform: translate(-3%, 7%); }
  80% { transform: translate(6%, -2%); }
}
@keyframes drip {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* ---------- Responsive: tablets ---------- */
@media (max-width: 960px) {
  .series__list { grid-template-columns: 1fr; }
  .series-card { min-height: 0; flex-direction: row; align-items: flex-start; gap: 1.75rem; }
  .series-card__num { min-width: 3.5rem; }
}

/* ---------- Responsive: phones & small tablets ---------- */
@media (max-width: 820px) {
  .nav__toggle { display: block; }

  .nav__menu {
    position: fixed;
    inset: 0;
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    background: rgba(10, 10, 10, 0.97);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s var(--ease), visibility 0.4s;
  }
  .nav__menu.is-open { opacity: 1; visibility: visible; }
  .nav__menu a { font-size: 0.95rem; }

  .book__grid,
  .about__grid { grid-template-columns: 1fr; }
  .book__cover-wrap { position: static; }
  .book__cover-img { max-width: min(82%, 340px); max-height: none; }
  .book__info { text-align: left; }
  .about__portrait { position: relative; top: 0; max-width: 340px; margin-top: 0; }
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .hero__actions .btn,
  .book__actions .btn,
  .contact-form .btn { width: 100%; }
  .series-card { padding: 1.5rem; gap: 1.25rem; }
  .series-card__num { font-size: 2.5rem; min-width: 2.5rem; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
}

/* ---------- Respect "reduce motion" accessibility setting ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
