/* ==========================================================
   Joseph A. Carosella — style.css
   Mobile-first. Breakpoints: 768px, 1200px.
   ========================================================== */

:root {
  /* Brand colors */
  --forest: #4A7A5A;
  --sky: #6B9EBF;
  --sun: #E8C44A;
  --warm-white: #FAFAF7;
  --ink: #1E2A1E;
  --stone: #8A9080;
  --moss: #EBF2ED;

  /* Derived tones */
  --forest-deep: #3B6449;
  --forest-line: rgba(74, 122, 90, 0.2);
  --sage: #A9BFAE;
  --white: #FFFFFF;
  --ink-soft: #3A463A;

  /* Type */
  --serif: "Cormorant Garamond", "Garamond", "Georgia", serif;
  --sans: "DM Sans", "Helvetica Neue", Arial, sans-serif;

  /* Rhythm */
  --gutter: 20px;
  --section-pad: 88px;
  --nav-h: 68px;
  --ease: 0.3s ease;
  --shadow: 0 18px 50px rgba(30, 42, 30, 0.12);
}

/* ---------- Reset & base ---------- */

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

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

body {
  margin: 0;
  background: var(--warm-white);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

/* Elements with the hidden attribute stay hidden even when a class (like .btn) sets display */
[hidden] { display: none !important; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 300;
  line-height: 1.15;
  margin: 0;
  color: var(--ink);
}

p { margin: 0 0 1.2em; }

a {
  color: var(--forest);
  text-underline-offset: 3px;
  transition: color var(--ease);
}
a:hover { color: var(--sky); }

cite { font-style: italic; }

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

.visually-hidden {
  position: absolute !important;
  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;
  left: 12px; top: -60px;
  z-index: 2000;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--warm-white);
  font-size: 14px;
  transition: top var(--ease);
}
.skip-link:focus { top: 12px; color: var(--warm-white); }

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

.section { padding: var(--section-pad) 0; }
.section--moss { background: var(--moss); }

.section-head { text-align: center; margin-bottom: 48px; }

.section-label,
.eyebrow {
  font-family: var(--sans);
  font-weight: 400;
  text-transform: uppercase;
  color: var(--forest);
  margin: 0 0 14px;
}
.section-label { font-size: 10px; letter-spacing: 0.32em; }
.section-label--light { color: var(--sun); }

.section-title {
  font-size: clamp(36px, 6vw, 52px);
  color: var(--forest);
}

.attribution {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--stone);
  letter-spacing: 0.04em;
  margin: 0;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 15px 28px;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease), transform var(--ease);
}

.btn--primary {
  background: var(--forest);
  color: var(--warm-white);
}
.btn--primary:hover {
  background: var(--forest-deep);
  color: var(--sun);
}

.btn--ghost {
  background: transparent;
  color: var(--forest);
  padding-left: 0;
  padding-right: 0;
  border-bottom-color: var(--forest);
}
.btn--ghost:hover {
  color: var(--forest-deep);
  border-bottom-color: var(--sun);
}

.btn--small {
  font-size: 11px;
  padding: 11px 20px;
  background: transparent;
  color: var(--forest);
  border-color: var(--forest);
}
.btn--small:hover {
  background: var(--forest);
  color: var(--warm-white);
}

.btn--sun {
  background: var(--sun);
  color: var(--ink);
}
.btn--sun:hover {
  background: var(--warm-white);
  color: var(--ink);
}

/* ---------- Photos (graceful when an image file is missing) ---------- */

.photo {
  margin: 0;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 30% 20%, rgba(232, 196, 74, 0.25), transparent 60%),
    linear-gradient(160deg, var(--sage), var(--forest));
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo.is-missing img { visibility: hidden; }

/* ==========================================================
   NAV
   ========================================================== */

.site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1500;
  height: var(--nav-h);
  background: transparent;
  transition: background-color var(--ease), box-shadow var(--ease), backdrop-filter var(--ease);
}
.site-nav.is-scrolled,
.site-nav.is-open {
  background: rgba(250, 250, 247, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--forest-line);
}

.site-nav__inner {
  height: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.wordmark:hover { color: var(--forest); }
.wordmark--light { color: var(--warm-white); }
.wordmark--light:hover { color: var(--sun); }

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  margin-right: -10px;
  padding: 0 10px;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav-toggle__bar {
  display: block;
  height: 1px;
  background: var(--ink);
  transition: transform var(--ease), opacity var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(6px) 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); }

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  transition: color var(--ease);
}
.nav-links a:hover { color: var(--forest); }
.nav-links a.is-active { color: var(--forest); }

/* Mobile menu: slide-down panel (see <noscript> in index.html for the no-JS fallback) */
.nav-links {
  position: absolute;
  top: var(--nav-h);
  left: 0; right: 0;
  padding: 12px var(--gutter) 28px;
  background: var(--warm-white);
  box-shadow: 0 12px 24px rgba(30, 42, 30, 0.08);
  display: none;
}
.site-nav.is-open .nav-links { display: block; }
.nav-links li { border-bottom: 1px solid var(--forest-line); }
.nav-links a { display: block; padding: 14px 0; }

/* ==========================================================
   HERO
   ========================================================== */

.hero {
  display: flex;
  flex-direction: column;
  background: var(--warm-white);
}

.hero__text {
  padding: calc(var(--nav-h) + 48px) var(--gutter) 56px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.34em;
}

.hero__title {
  font-size: clamp(52px, 13vw, 88px);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 8px 0 28px;
}
.hero__title em {
  font-style: italic;
  color: var(--forest);
}

.hero__sub {
  font-size: 17px;
  color: var(--stone);
  max-width: 34em;
  margin-bottom: 36px;
}

.hero__ctas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 32px;
}

.hero__image {
  min-height: 50vw;
  height: 110vw;
  max-height: 80vh;
}
.hero__image::after {
  /* slight warm overlay */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(232, 196, 74, 0.10), rgba(232, 160, 74, 0.08));
  mix-blend-mode: multiply;
  pointer-events: none;
}
.hero__image img { object-position: center 30%; }

/* ==========================================================
   A POEM FOR YOU
   ========================================================== */

.poem-of-day__inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  text-align: center;
}

.featured-poem__title {
  font-style: italic;
  font-size: 28px;
  color: var(--ink);
  margin: 6px 0 8px;
}
.featured-poem__meta {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--stone);
  margin: 0 0 28px;
}

.featured-poem__body {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 2.2;
  color: var(--ink-soft);
  margin-bottom: 30px;
}
.featured-poem__body p { margin: 0 0 1.1em; }
.featured-poem__body p:last-child { margin-bottom: 0; }

.featured-poem__body::after {
  content: "";
  display: block;
  width: 36px;
  height: 1px;
  margin: 34px auto 0;
  background: var(--sun);
}

/* ==========================================================
   ABOUT
   ========================================================== */

.about {
  display: flex;
  flex-direction: column;
}

.about__quote {
  background: var(--forest);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px var(--gutter);
}
.about__quote blockquote { margin: 0; max-width: 420px; }
.about__quote blockquote p {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(34px, 8vw, 42px);
  line-height: 1.25;
  margin-bottom: 22px;
}
.about__quote footer {
  font-size: 13px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.6);
}

.about__bio {
  background: var(--warm-white);
  padding: var(--section-pad) var(--gutter);
}
.about__bio-inner { max-width: 640px; margin: 0 auto; }
.about__bio .section-title { margin-bottom: 30px; }
.about__bio p { color: var(--ink-soft); }

.about__portrait {
  aspect-ratio: 4 / 5;
  margin: 0 0 28px;
  box-shadow: var(--shadow);
}
.about__portrait img { object-position: center 28%; }

/* ==========================================================
   BOOKS
   ========================================================== */

.books { background: var(--warm-white); }

.book-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

.book {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--forest-line);
  transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.book:hover {
  transform: translateY(-4px);
  border-color: var(--forest);
  box-shadow: 0 14px 32px rgba(30, 42, 30, 0.08);
}

.book__cover-placeholder,
.book__cover-frame {
  aspect-ratio: 3 / 4;
  max-height: 260px;
  width: 100%;
}
/* Real covers: the whole cover, never cropped, on a soft moss backdrop */
.book__cover-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: var(--moss);
  border-bottom: 1px solid var(--forest-line);
}
.book__cover {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  box-shadow: 0 10px 24px rgba(30, 42, 30, 0.22), 0 2px 4px rgba(30, 42, 30, 0.12);
  transition: transform var(--ease);
}
.book:hover .book__cover { transform: translateY(-3px) rotate(-0.6deg); }
.book__cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.08)),
    var(--sage);
  border-bottom: 1px solid var(--forest-line);
}
.book__cover-placeholder span {
  font-family: var(--serif);
  font-style: italic;
  font-size: 30px;
  line-height: 1.2;
  color: var(--warm-white);
  border-top: 1px solid rgba(250, 250, 247, 0.6);
  border-bottom: 1px solid rgba(250, 250, 247, 0.6);
  padding: 18px 4px;
}

.book__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px 24px 28px;
}

.badge {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 9.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 4px 10px;
  margin-bottom: 14px;
}
.badge--available { background: var(--moss); color: var(--forest); }
.badge--production { background: #EFEFEA; color: var(--stone); }

.book__title {
  font-style: italic;
  font-size: 25px;
  margin-bottom: 6px;
}
.book__meta {
  font-size: 13px;
  color: var(--stone);
  letter-spacing: 0.03em;
  margin-bottom: 22px;
}
.book .btn,
.book__soon,
.book__actions { margin-top: auto; }
.book__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}
.book__actions .btn,
.book__actions .book__soon { margin-top: 0; }
.book__soon {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--stone);
  margin-bottom: 0;
}

/* ==========================================================
   BOOK EXCERPT READER
   ========================================================== */

html.reader-open { overflow: hidden; }

.reader {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--warm-white);
  color: var(--ink);
}
.reader::backdrop {
  background: rgba(30, 42, 30, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.reader[open] { animation: reader-in 0.3s ease; }
@keyframes reader-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

.reader__scroll {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 64px var(--gutter) 72px;
}

.reader__close {
  position: sticky;
  top: 0;
  float: right;
  margin: -48px -8px 0 0;
  z-index: 2;
  width: 44px;
  height: 44px;
  font-size: 30px;
  line-height: 1;
  color: var(--stone);
  background: var(--warm-white);
  border: 1px solid var(--forest-line);
  border-radius: 50%;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
}
.reader__close:hover { color: var(--forest); border-color: var(--forest); }

.reader__head,
.reader__contents,
.reader__poems,
.reader__end {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.reader__head { text-align: center; margin-bottom: 40px; }
.reader__cover {
  width: 120px;
  margin: 0 auto 26px;
}
.reader__cover img {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 10px 24px rgba(30, 42, 30, 0.22), 0 2px 4px rgba(30, 42, 30, 0.12);
}
.reader__cover .book__cover-placeholder {
  max-height: none;
  padding: 14px;
}
.reader__cover .book__cover-placeholder span { font-size: 17px; padding: 8px 2px; }
.reader__title {
  font-style: italic;
  font-size: clamp(34px, 6vw, 46px);
  color: var(--forest);
}
.reader__subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--ink-soft);
  margin: 6px 0 0;
}
.reader__meta {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--stone);
  margin: 14px 0 0;
}

.reader__contents {
  padding: 22px 24px;
  margin-bottom: 56px;
  background: var(--moss);
}
.reader__contents-label {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--forest);
  margin: 0 0 10px;
}
.reader__contents ol {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2 220px;
  column-gap: 28px;
}
.reader__contents li { break-inside: avoid; }
.reader__contents button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 3px 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-soft);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color var(--ease);
}
.reader__contents button:hover { color: var(--forest); }

.reader__section {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--forest);
  margin: 0 0 40px;
}
.reader__section::before,
.reader__section::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--forest-line);
}

.reader__poem { scroll-margin-top: 24px; }
.reader__poem-title {
  font-style: italic;
  font-size: 28px;
  color: var(--ink);
  margin: 0 0 6px;
}
.reader__poem-date {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--stone);
  margin: 0 0 22px;
}
.reader__poem-body {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.9;
  color: var(--ink-soft);
}
.reader__poem-body p { margin: 0 0 1em; }
.reader__poem-note {
  font-size: 13px;
  font-style: italic;
  color: var(--stone);
  margin: 4px 0 0;
}
.reader__divider {
  width: 36px;
  height: 1px;
  margin: 48px auto;
  background: var(--sun);
  border: 0;
}

.reader__end {
  text-align: center;
  padding-top: 40px;
  margin-top: 16px;
  border-top: 1px solid var(--forest-line);
}
.reader__end p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--ink-soft);
  margin: 0 0 20px;
}

/* ==========================================================
   MAP
   ========================================================== */

.map-section { background: var(--warm-white); padding-bottom: var(--section-pad); }

.map-intro {
  position: relative;
  color: var(--warm-white);
  text-align: center;
  padding: 96px var(--gutter) 88px;
  background-color: var(--forest);
  background-image:
    linear-gradient(180deg, rgba(30, 42, 30, 0.55), rgba(30, 42, 30, 0.72)),
    url("images/landscape.jpeg"),
    linear-gradient(160deg, var(--forest), var(--ink));
  background-size: cover;
  background-position: center;
}
.map-intro__inner { max-width: 620px; margin: 0 auto; }
.map-intro .section-title { color: var(--warm-white); margin-bottom: 18px; }
.map-intro__tagline {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(21px, 3.4vw, 27px);
  line-height: 1.4;
  color: var(--sun);
  max-width: 30em;
  margin: 0 auto 22px;
  text-wrap: balance; /* even line lengths, no lone "over it." */
}
.map-intro__lede { color: rgba(250, 250, 247, 0.82); margin: 0; }

.map-wrap {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--forest-line);
}

.map {
  height: 400px;
  font-family: var(--sans);
}

.map-noscript {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  margin: 0;
  text-align: center;
  color: var(--stone);
}

/* The globe floats on a soft, light sky */
.map {
  background:
    radial-gradient(closest-side at 50% 50%, rgba(107, 158, 191, 0.10), rgba(107, 158, 191, 0) 100%),
    var(--warm-white);
}
.map .maplibregl-canvas:focus { outline: none; }
.map .maplibregl-canvas:focus-visible { outline: 2px solid var(--sun); outline-offset: -2px; }

.map .maplibregl-ctrl-group {
  border-radius: 0;
  box-shadow: 0 2px 10px rgba(30, 42, 30, 0.12);
}
.map .maplibregl-ctrl-group button { width: 34px; height: 34px; }
.map .maplibregl-ctrl-attrib { font-family: var(--sans); font-size: 11px; }
.map .maplibregl-cooperative-gesture-screen {
  font-family: var(--sans);
  background: rgba(30, 42, 30, 0.55);
}

/* Markers (real <button>s, so they're keyboard reachable) */
.poem-marker {
  /* MapLibre positions markers absolutely; that also anchors the label below. */
  padding: 6px;
  margin: 0;
  background: none;
  border: 0;
  cursor: pointer;
  transition: opacity 0.3s ease;
}
/* Footprint marker: a pair of bare feet, green with a sun-yellow edge */
.poem-marker__dot {
  position: relative;
  display: block;
  width: 26px;
  height: 28px;
  transition: transform var(--ease);
}
.poem-marker__print {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: var(--forest);
  stroke: var(--sun);
  filter: drop-shadow(0 1px 2px rgba(30, 42, 30, 0.35));
  transition: fill var(--ease);
}
/* Soft yellow ring that pulses on hover */
.poem-marker__dot::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--sun);
  opacity: 0;
}
.poem-marker:hover .poem-marker__dot,
.poem-marker:focus-visible .poem-marker__dot,
.poem-marker.is-selected .poem-marker__dot {
  transform: scale(1.18);
}
.poem-marker:hover .poem-marker__print,
.poem-marker:focus-visible .poem-marker__print,
.poem-marker.is-selected .poem-marker__print { fill: var(--forest-deep); }
.poem-marker:hover .poem-marker__dot::after,
.poem-marker:focus-visible .poem-marker__dot::after {
  animation: marker-pulse 1.4s ease-out infinite;
}
.poem-marker:hover,
.poem-marker:focus-visible,
.poem-marker.is-selected { z-index: 5; }
.poem-marker:focus { outline: none; }
.poem-marker:focus-visible .poem-marker__dot { outline: 2px solid var(--sky); outline-offset: 3px; }

/* Place name that appears above a marker on hover / focus */
.poem-marker__label {
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 4px 10px;
  white-space: nowrap;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--forest-line);
  box-shadow: 0 6px 18px rgba(30, 42, 30, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease), transform var(--ease);
}
.poem-marker:hover .poem-marker__label,
.poem-marker:focus-visible .poem-marker__label {
  opacity: 1;
  transform: translate(-50%, 0);
}
/* Markers on the far side of the globe are hidden (opacity 0); make them unclickable too */
.poem-marker[style*="opacity: 0"] { pointer-events: none; }

/* Flat fallback map (no WebGL): the image keeps its proportions; markers sit on it by percentage */
.map--flat {
  display: flex;
  align-items: center;
  justify-content: center;
}
.flat-map {
  width: 100%;
  max-width: 1725px; /* 600px tall at the image's 1000:348 shape */
}
.flat-map__inner {
  position: relative;
  aspect-ratio: 1000 / 348;
  width: 100%;
}
.flat-map__img {
  display: block;
  width: 100%;
  height: 100%;
}
.poem-marker--flat {
  position: absolute;
  transform: translate(-50%, -50%);
}
.poem-marker--flat:hover,
.poem-marker--flat:focus-visible,
.poem-marker--flat.is-selected { z-index: 5; }
/* On phones the flat map is small, so neighbours like Japan and Korea sit close: shrink the prints */
@media (max-width: 767px) {
  .poem-marker--flat { padding: 1px; }
  .poem-marker--flat .poem-marker__dot { width: 16px; height: 17px; }
}

@keyframes marker-pulse {
  0%   { transform: scale(1);   opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* Poem panel — slides in from the right */
.poem-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  z-index: 1100;
  width: 100%;
  max-width: 440px;
  padding: 56px 28px 32px;
  overflow-y: auto;
  background: var(--white);
  box-shadow: -18px 0 50px rgba(30, 42, 30, 0.16);
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0s linear 0.3s;
}
.poem-panel.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.3s ease, visibility 0s;
}
.poem-panel:focus { outline: none; }

.poem-panel__close {
  position: absolute;
  top: 12px; right: 12px;
  width: 44px; height: 44px;
  font-size: 28px;
  line-height: 1;
  color: var(--stone);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color var(--ease);
}
.poem-panel__close:hover { color: var(--forest); }

.poem-panel__location {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--sky);
  margin-bottom: 10px;
}
.poem-panel__date {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--stone);
  margin: -14px 0 24px;
}
.poem-panel__title {
  font-style: italic;
  font-size: 30px;
  color: var(--forest);
  margin-bottom: 24px;
}
.poem-panel__body {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 2.05;
  color: var(--ink-soft);
  margin-bottom: 28px;
}
.poem-panel__body p { margin: 0 0 1em; }
.poem-panel__note {
  font-size: 13px;
  font-style: italic;
  color: var(--stone);
  margin: -12px 0 24px;
}
.poem-panel__body .is-placeholder { color: var(--stone); font-style: italic; }

/* Place list under the map: a quiet index + keyboard-friendly way in */
.place-list {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
}
.place-list button {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 13px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--forest-line);
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color var(--ease), color var(--ease), background-color var(--ease);
}
.place-list button:hover,
.place-list button[aria-pressed="true"] {
  border-color: var(--forest);
  color: var(--forest);
  background: var(--moss);
}

/* ==========================================================
   EVENTS
   ========================================================== */

.events__status {
  font-size: 14px;
  color: var(--stone);
  margin: 14px 0 0;
  min-height: 1.85em;
}

.event-group + .event-group { margin-top: 48px; }
.event-group__label {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--forest);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.event-group__label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--forest-line);
}
.event-group__label--near::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--sun);
}

.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
}

.event {
  display: flex;
  gap: 20px;
  padding: 24px 22px;
  background: var(--white);
  border: 1px solid var(--forest-line);
  transition: border-color var(--ease), transform var(--ease);
}
.event:hover { border-color: var(--forest); }

.event__date {
  flex: 0 0 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-right: 20px;
  border-right: 1px solid var(--forest-line);
  line-height: 1.1;
}
.event__month {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--forest);
}
.event__day {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 300;
  color: var(--ink);
  margin: 4px 0;
}
.event__year { font-size: 11px; color: var(--stone); }

.event__body { min-width: 0; }
.event__title {
  font-size: 25px;
  margin-bottom: 6px;
}
.event__where {
  font-size: 13.5px;
  color: var(--stone);
  margin-bottom: 10px;
}
.event__distance { color: var(--sky); white-space: nowrap; }
.event__desc { font-size: 15.5px; color: var(--ink-soft); margin-bottom: 10px; }
.event__link {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.events__toggle-wrap { text-align: center; margin-top: 36px; }

.events__empty {
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--stone);
}

/* ==========================================================
   FOOTER / CONTACT
   ========================================================== */

.site-footer {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.72);
  padding: 80px 0 28px;
}
.site-footer a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
}
.site-footer a:hover { color: var(--sun); }
.site-footer .wordmark { color: var(--warm-white); }
.site-footer .wordmark:hover { color: var(--sun); }

.site-footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 56px;
}

.site-footer__tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 26px;
  color: rgba(250, 250, 247, 0.6);
  margin: 14px 0 36px;
}

.contact-links { list-style: none; margin: 0; padding: 0; }
.contact-links li { margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 0 14px; }
.contact-links__label {
  flex: 0 0 90px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  padding-top: 0.45em;
}
.contact-links a { word-break: break-word; }

.site-footer__heading {
  font-size: 30px;
  color: var(--warm-white);
  margin-bottom: 20px;
}

.contact-form .field { margin-bottom: 18px; }
.contact-form label {
  display: block;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 6px;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  font: 300 16px/1.6 var(--sans);
  color: var(--warm-white);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0;
  padding: 12px 14px;
  transition: border-color var(--ease), background-color var(--ease);
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--sun);
  background: rgba(255, 255, 255, 0.07);
}
.contact-form textarea { resize: vertical; min-height: 120px; }

.site-footer__copy {
  max-width: 1160px;
  margin: 64px auto 0;
  padding: 24px var(--gutter) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.38);
}

/* ==========================================================
   SCROLL REVEAL
   main.js adds .is-pending only to elements below the fold,
   so nothing is ever hidden when JS is off.
   ========================================================== */

.reveal {
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal.is-pending {
  opacity: 0;
  transform: translateY(24px);
}

/* ==========================================================
   ≥ 768px
   ========================================================== */

@media (min-width: 768px) {
  :root {
    --gutter: 40px;
    --section-pad: 112px;
    --nav-h: 76px;
  }

  .wordmark { font-size: 17px; }

  .hero {
    flex-direction: row;
    min-height: 100vh;
    min-height: 100svh;
  }
  .hero__text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: calc(var(--nav-h) + 40px) 56px 64px var(--gutter);
  }
  .hero__image {
    /* main.js sets --hero-photo-w so the photo starts just before "POETRY" in the nav */
    flex: 0 0 var(--hero-photo-w, 40%);
    height: auto;
    max-height: none;
    min-height: 100%;
  }

  .about { flex-direction: row; }
  .about__quote { flex: 0 0 40%; padding: 96px 48px; }
  .about__bio { flex: 0 0 60%; padding: var(--section-pad) 56px; }
  .about__bio-inner { margin: 0; }
  .about__portrait {
    float: right;
    width: 44%;
    margin: 6px 0 20px 32px;
  }

  .book-grid { grid-template-columns: repeat(2, 1fr); }
  .book__cover-placeholder,
  .book__cover-frame { max-height: 360px; }

  .map { height: 600px; }
  .map-intro { padding: 120px var(--gutter) 108px; }
  .poem-panel { padding: 64px 40px 40px; }

  .site-footer__grid { grid-template-columns: 1fr 1fr; gap: 80px; }

  /* Reader becomes a tall centered page with the site dimmed behind it */
  .reader {
    max-width: 820px;
    height: calc(100% - 48px);
    margin: 24px auto;
    box-shadow: 0 30px 80px rgba(30, 42, 30, 0.35);
  }
  .reader__scroll { padding: 72px 64px 88px; }
}

/* ==========================================================
   ≥ 1024px: inline nav links (below this the hamburger menu is
   used, so the name and the links never collide on tablets)
   ========================================================== */

@media (min-width: 1024px) {
  .nav-toggle { display: none; }
  .nav-links {
    position: static;
    display: flex;
    gap: 30px;
    padding: 0;
    background: none;
    box-shadow: none;
  }
  .nav-links li { border: 0; }
  .nav-links a { display: inline; padding: 0; }
}

/* ==========================================================
   ≥ 1200px
   ========================================================== */

@media (min-width: 1200px) {
  .hero__text { padding-left: max(var(--gutter), calc((100vw - 1320px) / 2 + 40px)); }
  .book-grid { grid-template-columns: repeat(3, 1fr); gap: 32px; }
  .about__quote { padding: 120px 72px; }
  .about__bio { padding: 128px 88px; }
}

/* ==========================================================
   Reduced motion
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal.is-pending { opacity: 1; transform: none; }
}
