:root {
  --ink: #14213d;
  --muted: #617087;
  --paper: #ffffff;
  --wash: #f4f7f8;
  --line: #dfe7ea;
  --accent: #087f8c;
  --accent-dark: #075e68;
  --sun: #f4b860;
  --shadow: 0 18px 45px rgba(20, 33, 61, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
:root { --header-h: 87px; --section-pad: clamp(3rem, 8vw, 5.5rem); }
html { scroll-behavior: auto; scroll-padding-top: 0; }
[id] { scroll-margin-top: 0; }
#top { scroll-margin-top: 0; }
.section[id] { scroll-margin-top: calc(var(--header-h) - var(--section-pad) + 1rem); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--wash);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 20;
  background: var(--ink);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 999px;
}
.skip-link:focus { top: 1rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 4vw, 3rem);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand img { height: 60px; width: auto; max-width: 220px; object-fit: contain; }
.site-nav { display: flex; align-items: center; gap: 0.4rem; }
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
}
.site-nav a:hover, .site-nav a:focus-visible { background: #e7f3f4; color: var(--accent-dark); }

.hero {
  position: relative;
  min-height: clamp(460px, 70vh, 720px);
  display: grid;
  align-items: stretch;
  isolation: isolate;
  overflow: hidden;
  background: var(--ink);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("images/PLatAnchorNoRed.jpg") center / cover no-repeat;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(7, 23, 35, 0.55), rgba(7, 23, 35, 0.08) 42%, rgba(7, 23, 35, 0.6));
}
.hero-content {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.hero-content .hero-actions { margin-top: auto; padding-top: 2rem; }
.eyebrow {
  margin: 0 0 0.7rem;
  color: #bde7ea;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 760px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 5.6vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}
.hero .lede {
  max-width: 680px;
  margin: 1.2rem 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.7rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.7rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 800;
}
.button:hover, .button:focus-visible { background: var(--accent-dark); }
.button.secondary { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.45); }
.button.secondary:hover, .button.secondary:focus-visible { background: rgba(255, 255, 255, 0.24); }

.stats {
  width: min(1120px, calc(100% - 2rem));
  margin: -2rem auto 0;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}
.stat {
  padding: 1.1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.stat strong { display: block; font-size: clamp(1.5rem, 4vw, 2.4rem); line-height: 1.1; }
.stat span { color: var(--muted); font-size: 0.9rem; }

.section {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5.5rem) 0 0;
}
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.3rem;
}
.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.section-heading p { max-width: 560px; margin: 0; color: var(--muted); }

.story-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 1rem;
}
.search-wrap { position: relative; }
.search-wrap input {
  width: 100%;
  min-height: 50px;
  padding: 0.8rem 1rem 0.8rem 2.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}
.search-wrap::before {
  content: "⌕";
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.4rem;
}
.story-toolbar select {
  min-height: 50px;
  padding: 0.7rem 2.3rem 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
}
.result-count { color: var(--muted); font-size: 0.92rem; white-space: nowrap; }

.reader-shell {
  overflow: hidden;
  margin-bottom: 1.3rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}
.story-reader { min-height: 420px; }
.story-reader > img,
.story-reader > video { width: 100%; max-height: 560px; object-fit: cover; }
.story-reader .w3-container { max-width: 780px; margin: 0 auto; padding: 1.2rem clamp(1rem, 4vw, 2.4rem); }
.story-reader h3 {
  margin: 1rem 0 0.2rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}
.story-reader h5 { margin: 0 0 1.4rem; color: var(--muted); font-size: 0.95rem; font-weight: 700; }
.story-reader p { margin: 1.1rem 0; font-size: 1.05rem; }
.story-reader img { border-radius: 0; }
.reader-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  padding: 0.9rem;
  border-top: 1px solid var(--line);
  background: #f8fbfb;
}
.reader-controls button {
  min-height: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reader-controls button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-dark); }

.story-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.story-card { min-width: 0; }
.story-card-button {
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 28px rgba(20, 33, 61, 0.07);
}
.story-card-button:hover, .story-card-button:focus-visible, .story-card.is-current .story-card-button {
  border-color: var(--accent);
  box-shadow: 0 16px 38px rgba(8, 127, 140, 0.16);
}
.story-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #d7e2e5; }
.story-card-copy { display: grid; gap: 0.35rem; padding: 0.95rem; }
.story-date { color: var(--muted); font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.story-card strong { font-size: 1.02rem; line-height: 1.3; }
.read-link { color: var(--accent); font-size: 0.9rem; font-weight: 800; }

.map-panel {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}
.map-panel a { display: block; min-height: 100%; }
.map-panel img { width: 100%; height: 100%; object-fit: cover; }
.map-copy { padding: clamp(1.2rem, 4vw, 2.2rem); align-self: center; }
.map-copy h3, .about-card h3, .templates-panel h3 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.map-copy p, .about-card p, .templates-panel p { color: var(--muted); }

.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.about-card {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(20, 33, 61, 0.07);
}
.about-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.about-card div { padding: 1.1rem; }

.templates-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1.2rem, 4vw, 2rem);
  background: var(--ink);
  color: white;
  border-radius: 26px;
}
.templates-panel p { color: rgba(255,255,255,0.75); margin-bottom: 0; }
.templates-panel .button { flex: 0 0 auto; background: var(--sun); color: var(--ink); }

.quote {
  margin: 4rem 0 0;
  padding: clamp(2rem, 6vw, 4rem) 1rem;
  color: #dcecee;
  text-align: center;
  background: var(--ink);
}
.quote blockquote { max-width: 900px; margin: 0 auto; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.3rem, 3vw, 2rem); line-height: 1.45; }
.quote cite { display: block; margin-top: 1.2rem; color: #9fc4ca; font-style: normal; }
.footer-image { line-height: 0; }
.footer-image img { width: 100%; max-height: 340px; object-fit: cover; }
.site-footer { padding: 1.4rem; color: var(--muted); text-align: center; font-size: 0.9rem; }
.site-footer p { margin: 0 0 0.5rem; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 1rem; }
.footer-links a { color: var(--accent-dark); font-weight: 700; text-decoration: none; }
.footer-links a:hover, .footer-links a:focus-visible { text-decoration: underline; }

.loading-card { display: grid; gap: 1rem; padding: 2rem; }
.loading-card span { height: 22px; border-radius: 999px; background: linear-gradient(90deg, #edf2f3, #dce7e9, #edf2f3); }
.loading-card span:first-child { width: 55%; height: 42px; }
.error-card { padding: 2rem; }

@media (max-width: 900px) {
  .stats, .about-grid { grid-template-columns: repeat(2, 1fr); }
  .story-grid { grid-template-columns: repeat(2, 1fr); }
  .map-panel { grid-template-columns: 1fr; }
  .map-panel img { max-height: 420px; }
}

@media (max-width: 640px) {
  :root { --header-h: 59px; }
  .site-header { min-height: 58px; gap: 1rem; padding: 0.55rem 0.75rem; }
  .brand { flex: 0 0 auto; }
  .brand img { height: 32px; max-width: 100px; }
  .brand span { display: none; }
  .site-nav { flex: 1; justify-content: flex-end; flex-wrap: nowrap; gap: 0.1rem; overflow-x: auto; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { flex: 0 0 auto; font-size: 0.8rem; padding: 0.42rem 0.4rem; }
  .hero { min-height: 500px; }
  .stats, .story-grid, .about-grid, .reader-controls, .story-toolbar { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; }
  .templates-panel { align-items: stretch; flex-direction: column; }
  .reader-controls button { white-space: normal; }
}

.reader-shell[hidden] { display: none; }
.no-results { grid-column: 1 / -1; padding: 2rem; text-align: center; color: var(--muted); background: #fff; border-radius: 18px; }

/* Templates download page */
.template-hero {
  height: clamp(180px, 32vw, 380px);
  background: url("/images/PLatAnchorNoRed.jpg") center 60% / cover no-repeat;
}
.template-section { padding-bottom: 3rem; max-width: 860px; }
.template-section .section-heading h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}
.template-intro { color: var(--muted); font-size: 1.05rem; line-height: 1.65; }
.template-card {
  margin: 1.6rem 0;
  padding: clamp(1.2rem, 4vw, 2rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.template-card h2 { margin: 0 0 0.6rem; font-family: Georgia, "Times New Roman", serif; font-size: 1.8rem; }
.template-card p, .template-list { color: var(--muted); line-height: 1.6; }
.template-list { padding-left: 1.2rem; }
.template-list li { margin-bottom: 0.6rem; }
.template-card .button { margin-top: 0.6rem; }
.video-frame { position: relative; aspect-ratio: 16 / 9; margin: 1rem 0 1.2rem; border-radius: 12px; overflow: hidden; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.template-return { text-align: center; margin-top: 2rem; }
.button.secondary-dark { background: transparent; color: var(--ink); border-color: var(--ink); }
.button.secondary-dark:hover, .button.secondary-dark:focus-visible { background: var(--ink); color: #fff; }
.template-section .eyebrow { color: var(--accent); }

/* Tighter gap between story date and first paragraph */
.story-reader h5 { margin-bottom: 0.3rem; }
.story-reader .w3-container:has(> h5) { padding-bottom: 0; }
.story-reader .w3-container:has(> h5) + .w3-container { padding-top: 0; }
.story-reader .w3-container:has(> h5) + .w3-container > p:first-child { margin-top: 0.5rem; }

/* Visible sort buttons */
.sort-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sort-buttons button {
  min-height: 50px;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.sort-buttons button:hover { border-color: var(--accent); color: var(--accent-dark); }
.sort-buttons button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.sort-buttons button:focus-visible { outline: 3px solid #9fd8de; outline-offset: 2px; }
@media (max-width: 720px) {
  .sort-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
  .sort-buttons button { padding: 0.5rem 0.3rem; font-size: 0.88rem; white-space: normal; line-height: 1.15; }
}
