/* ============================================================
   The Distance — Paul Herbert
   A literary author site. Spare. Precise. Warm.
   ============================================================ */

:root {
  --bg: #100D0B;
  --text: #EDE8E0;
  --text-muted: #8A837A;
  --accent: #A82020;
  --accent-deep: #8C1818;
  --accent-blue: #C09060;
  --divider: #2A2420;
  --quote-bg: #1A1512;
  --tinted: #161210;

  --measure: 720px;
  --nav-height: 64px;

  --font-serif: 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.7;
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}
a:hover { color: var(--text); }

::selection { background: var(--accent); color: var(--text); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--text);
  color: var(--bg);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  text-decoration: none;
  z-index: 1000;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0; }

/* ============================================================
   Navigation
   ============================================================ */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: rgba(16, 13, 11, 0.92);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--divider);
  z-index: 100;
  font-family: var(--font-sans);
}

.nav-inner {
  max-width: 1080px;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-wordmark {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.18em;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.nav-wordmark:hover { color: var(--text); opacity: 0.7; }

.nav-links {
  display: none;
  gap: 1.75rem;
}
.nav-links a {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.nav-links a:hover { color: var(--accent); }

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px; height: 32px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}
.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.25s ease;
  align-self: center;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (min-width: 760px) {
  .nav-toggle { display: none; }
  .nav-links { display: flex; }
}

/* Mobile open state */
@media (max-width: 759px) {
  .nav-links {
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--divider);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.25rem;
  }
  .nav-links[data-open="true"] { display: flex; }
}

/* ============================================================
   Layout
   ============================================================ */

.container {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: clamp(3rem, 6.5vw, 5.5rem) 0;
  border-top: 1px solid var(--divider);
}
.section:first-of-type { border-top: none; }
.section--tinted { background: var(--tinted); }

h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  margin: 0 0 2rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.25rem;
  margin: 1.75rem 0 0.5rem;
  color: var(--accent-deep);
  letter-spacing: 0.01em;
}

p { margin: 0 0 1.4em; }
p + p { margin-top: 0; }

/* ============================================================
   Hero
   ============================================================ */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  padding: 0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg picture { display: block; height: 100%; }
.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(16, 13, 11, 0.75) 0%,
    rgba(16, 13, 11, 0.30) 50%,
    rgba(16, 13, 11, 0.0) 100%
  );
  z-index: 1;
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 640px;
  text-align: center;
  padding: calc(var(--nav-height) + 3.5rem) 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.5rem;
}

.book-cover-aside {
  display: block;
  max-width: var(--measure);
  width: 100%;
  margin: 2.5rem auto;
}
.book-cover-aside img {
  border-radius: 2px;
  box-shadow:
    0 1px 3px rgba(16, 13, 11, 0.20),
    0 16px 40px -10px rgba(16, 13, 11, 0.55);
}

.hero-tagline {
  font-style: italic;
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  line-height: 1.4;
  margin: 0;
  padding: 0;
  border: none;
  color: var(--text);
}
.hero-tagline p { margin: 0 0 0.4em; }
.hero-tagline cite {
  font-style: normal;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.hero-subline {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
}

/* ============================================================
   CTA button
   ============================================================ */

.cta {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--text);
  padding: 0.875rem 1.75rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.cta:hover,
.cta:focus-visible {
  background: var(--text);
  color: var(--bg);
}

/* ============================================================
   About the Book — pull-quote
   ============================================================ */

.pull-quote {
  margin: 2rem 0 0;
  padding: 1.75rem 2rem;
  background: var(--quote-bg);
  border-left: 2px solid var(--accent);
  font-style: italic;
  font-size: 1.125rem;
  line-height: 1.6;
}
.pull-quote p { margin: 0 0 0.75em; }
.pull-quote p:last-child {
  margin: 0.6rem 0 0;
  font-style: normal;
  font-weight: 600;
}

/* ============================================================
   Behind the Book essay
   ============================================================ */

.essay-meta {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}

.essay-lede {
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  color: var(--text);
  font-weight: 600;
  font-style: italic;
  margin: 0 0 1.5rem;
  line-height: 1.3;
}

.essay-break {
  border: none;
  background: none;
  text-align: center;
  margin: 2.25rem auto;
  padding: 0;
  color: var(--accent-deep);
  font-family: var(--font-serif);
  font-size: 1rem;
  letter-spacing: 1em;
  opacity: 0.55;
  user-select: none;
}
.essay-break::before {
  content: "\00b7 \00b7 \00b7";
}

.essay-figure {
  margin: 2.25rem -1.5rem;
}
.essay-figure img { width: 100%; }
@media (min-width: 760px) {
  .essay-figure { margin: 2.25rem 0; }
}

.essay-sign-off {
  margin-top: 1.75rem;
  font-style: italic;
  color: var(--text-muted);
}

/* ============================================================
   Banner break — full-width 16:9 road image
   ============================================================ */

.banner {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow: hidden;
  background: var(--tinted);
}
.banner picture, .banner img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  max-height: 540px;
}
.banner + .section { border-top: none; }

/* ============================================================
   Author
   ============================================================ */

.author-row {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: flex-start;
}

@media (min-width: 640px) {
  .author-row { flex-direction: row; gap: 3rem; }
}

.author-photo {
  flex: 0 0 auto;
  display: block;
  width: 180px;
}
.author-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(44, 42, 39, 0.06), 0 12px 30px -10px rgba(44, 42, 39, 0.16);
}

@media (min-width: 640px) {
  .author-photo { width: 220px; }
}

.author-bio { flex: 1 1 auto; min-width: 0; }
.author-bio > p:first-of-type { margin-top: 0; }

.bio-toggle {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  color: var(--accent-blue);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin: -0.75em 0 0;
}
.author-bio > p:last-of-type { margin-bottom: 0.5em; }
.bio-toggle:hover { color: var(--text); }

.author-bio-long[hidden] { display: none; }
.author-bio-long > p:first-child { margin-top: 0.5rem; }

/* ============================================================
   Themes
   ============================================================ */

.themes-list {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  margin-top: 2rem;
}

.theme h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}
.theme p { margin: 0; }

/* ============================================================
   Music
   ============================================================ */

.music-intro {
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.apple-music-embed {
  margin: 1.75rem 0 1rem;
  width: 100%;
  max-width: 660px;
}
.apple-music-embed iframe {
  width: 100%;
  height: 450px;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--quote-bg);
  display: block;
}

.music-fallback {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  margin: 0.5rem 0 1.5rem;
}
.music-fallback a {
  color: var(--accent-blue);
}

/* ============================================================
   Contact form
   ============================================================ */

.contact-form {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-row label {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  font-family: var(--font-serif);
  font-size: 1rem;
  padding: 0.75rem 0.875rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--divider);
  border-radius: 0;
  min-width: 0;
  width: 100%;
  line-height: 1.5;
}
.contact-form textarea {
  resize: vertical;
  font-family: var(--font-serif);
}
.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--text);
}

.contact-form select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%232C2A27' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
  margin-top: 0.5rem;
}

.form-message {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  margin: 0;
  padding: 0;
}
.form-message[data-state="success"] { color: var(--text); }
.form-message[data-state="error"]   { color: #a04040; }

/* ============================================================
   FAQ accordion
   ============================================================ */

.faq-item {
  border-bottom: 1px solid var(--divider);
  padding: 1.25rem 0;
}
.faq-item:first-of-type { border-top: 1px solid var(--divider); }

.faq-item summary {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.125rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-right: 0.25rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "";
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-right: 1.5px solid var(--text);
  border-bottom: 1.5px solid var(--text);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.25s ease;
}
.faq-item[open] summary::after {
  transform: rotate(-135deg) translate(-2px, -2px);
}
.faq-item summary:hover { color: var(--accent); }
.faq-item summary:hover::after { border-color: var(--accent); }

.faq-item p {
  margin: 1rem 0 0;
  color: var(--text);
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  background: var(--text);
  color: var(--bg);
  padding: 2.5rem 0 2rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  text-align: center;
}
.footer p { margin: 0 0 0.5em; }
.footer .copyright {
  margin-top: 1rem;
  color: rgba(16, 13, 11, 0.55);
  font-size: 0.8rem;
}

/* ============================================================
   Focus styles (accessibility)
   ============================================================ */

:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 3px;
}
.cta:focus-visible { outline-offset: 4px; }

/* ============================================================
   Reduce motion
   ============================================================ */

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

/* ============================================================
   Print
   ============================================================ */

@media print {
  .nav, .footer, .cta, .nav-toggle, .bio-toggle { display: none !important; }
  body { background: white; color: black; }
  .section, .hero { padding: 1.5rem 0; }
  a { color: black; text-decoration: underline; }
  .section--tinted { background: white; }
}
