/* ------------------------------------------------------------------
   Rachel Sargent — editorial theme
   Small layer of custom polish on top of Tailwind (loaded via CDN).
   ------------------------------------------------------------------ */

:root {
  --paper: #16425b;
  --paper2: #1b4d69;
  --ink: #e8f2f7;
  --accent: #81c3d7;
  --muted: #9dc4d6;
  --line: #5a93b3;
}

html, body { -webkit-font-smoothing: antialiased; }

/* Optimise Fraunces for display use */
.font-display { font-optical-sizing: auto; }

/* Subtle paper grain over the whole page */
.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Nav links with a fine animated underline */
.nav-link {
  position: relative;
  color: var(--muted, #5C6A78);
  padding-bottom: 2px;
}
.nav-link:hover { color: var(--accent); }
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 100%;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-link:hover::after { transform: scaleX(1); }

/* In-page section nav — tabs read as links via a persistent underline
   (same affordance as the story links); the current section is slate-blue. */
.section-link {
  display: inline-block;
  text-align: center;
  color: var(--ink, #1B2530);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.625rem;
  text-decoration: none;
  text-underline-offset: 5px;
  transition: color 0.25s ease;
}
/* Reserve the bold width so the tab doesn't shift when it becomes active:
   an invisible, zero-height bold copy of the label sets the element's width. */
.section-link::after {
  content: attr(data-label);
  display: block;
  font-weight: 600;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
.section-link:hover {
  color: var(--accent, #3C5A78);
  text-decoration: underline;
  text-decoration-color: var(--accent, #3C5A78);
  text-decoration-thickness: 1px;
}
.section-link.is-active {
  color: var(--accent, #3C5A78);
  font-weight: 600;
}

/* Subtle dot separators between tabs */
#section-nav li {
  display: flex;
  align-items: center;
}
#section-nav li:not(:first-child)::before {
  content: "·";
  margin: 0 0.7rem;
  font-size: 1.35rem;
  line-height: 1;
  color: #8FA2B3;
}

/* Section headings */
.section-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
  letter-spacing: -0.02em;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
}

/* Sub-section headings (e.g. "Books I've Edited") */
.sub-title {
  font-family: 'Newsreader', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: var(--muted, #5C6A78);
  letter-spacing: 0.01em;
  font-size: 1.125rem;
}

/* Portrait tint */
.portrait { box-shadow: 0 30px 60px -40px rgba(27, 37, 48, 0.5); }

/* Book cards */
.book-card { display: block; }
.book-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper2, #DFE7EE);
  box-shadow: 0 20px 40px -30px rgba(27, 37, 48, 0.55);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.book-card:hover .book-cover {
  transform: translateY(-6px);
  box-shadow: 0 34px 55px -30px rgba(27, 37, 48, 0.65);
}
/* contain (not cover) so cover art is never cropped; covers sit ~2:3 so any
   letterboxing blends into the matching background */
.book-cover img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Writing list rows */
.writing-row {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
}
/* The last row sits just above a section rule / footer border — drop its own
   border so the two lines don't double up. */
.writing-row:last-child { border-bottom: none; }

/* Clickable story titles: clear, stable affordance (no layout shift) */
.writing-link {
  color: var(--ink, #1B2530);
  text-decoration: underline;
  text-decoration-color: var(--line, #CDD8E1);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.25s ease, text-decoration-color 0.25s ease;
}
.writing-link:hover {
  color: var(--accent, #3C5A78);
  text-decoration-color: var(--accent, #3C5A78);
}

/* Elements revealed on scroll (books, writing) */
.on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .on-scroll { animation: none !important; opacity: 1 !important; transform: none !important; transition: none !important; }
  .book-card:hover .book-cover { transform: none; }
}
