/* ============================================================
   BIRD LIBRARY — shared stylesheet
   This one file styles every page of the site.
   Palette: highveld field-guide — stone paper, olive, grass gold.
   ============================================================ */

:root {
  --paper: #f4f3ee;      /* page background */
  --ink: #2b2a24;        /* main text */
  --ink-soft: #6b6759;   /* captions, secondary text */
  --olive: #56633a;      /* primary accent */
  --olive-deep: #3d4629; /* hover / headings */
  --gold: #b98a2f;       /* small highlights */
  --card: #fdfcf9;       /* card background */
  --line: #d9d5c8;       /* hairline borders */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ---------- Header & navigation (same on every page) ---------- */

header.site-header {
  padding: 2rem 1.5rem 1.25rem;
  text-align: center;
}

.site-title {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: 0.01em;
  color: var(--olive-deep);
}

.site-title a { color: inherit; text-decoration: none; }

.site-subtitle {
  margin: 0.25rem 0 0;
  font-family: "Archivo", Arial, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

nav.site-nav {
  /* Stays pinned to the top of the screen while scrolling */
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 3px double var(--line);
  padding: 0.7rem 1rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  font-family: "Archivo", Arial, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

nav.site-nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 0.3rem 0.1rem;
  border-bottom: 2px solid transparent;
}

nav.site-nav a:hover,
nav.site-nav a:focus-visible { border-bottom-color: var(--gold); }

nav.site-nav a.current {
  color: var(--olive-deep);
  border-bottom-color: var(--olive);
}

/* ---------- Page layout ---------- */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page-intro {
  max-width: 640px;
  margin: 0 auto 2.5rem;
  text-align: center;
  color: var(--ink-soft);
}

/* Alphabetical divider between groups of cards, e.g. "B" */
.letter-divider {
  font-family: "Archivo", Arial, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--olive);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3rem;
  margin: 2.5rem 0 1.25rem;
}

/* ---------- Family card grid (Bird List / Wildlife pages) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.5rem;
}

/* Two-column variant (used on the Wildlife page: 2 across, 3 down) */
.card-grid-2col {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 550px) {
  .card-grid-2col { grid-template-columns: 1fr; }
}

/* Four-column variant (used on the Bird List page) */
.card-grid-4col {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 950px) {
  .card-grid-4col { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .card-grid-4col { grid-template-columns: 1fr; }
}

.family-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.family-card:hover,
.family-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(43, 42, 36, 0.12);
}

/* Photo area — like a field-guide plate, with a thin inner frame.
   If the image file is missing, a tinted panel with the family's
   initial letter shows instead, so the page never looks broken. */
.family-card figure {
  margin: 0.5rem;
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #e8e6db, #d5d6c4);
  border: 1px solid var(--line);
}

.family-card figure::before {
  content: attr(data-initial);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3rem;
  color: #b9b7a6;
  font-style: italic;
}

.family-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.family-card-label {
  padding: 0.6rem 0.9rem 0.9rem;
  text-align: center;
}

.family-card-label h3 {
  margin: 0;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--olive-deep);
}

.family-card-label span {
  font-family: "Archivo", Arial, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Species entries (individual family pages) ---------- */

.back-link {
  font-family: "Archivo", Arial, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--olive);
}

.back-link:hover { color: var(--olive-deep); }

.family-heading {
  margin: 0.75rem 0 0;
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 500;
  color: var(--olive-deep);
}

.family-note {
  margin: 0.25rem 0 2.5rem;
  color: var(--ink-soft);
}

.species {
  display: grid;
  grid-template-columns: minmax(0, 480px) 1fr;
  gap: 1.5rem;
  align-items: start;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
}

.species img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
  background: #e8e6db;
}

.species h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

/* Scientific name — field-guide style italic under the common name */
.sci {
  margin: 0.1rem 0 0.6rem;
  font-style: italic;
  color: var(--olive);
}

.meta {
  margin: 0 0 0.6rem;
  font-family: "Archivo", Arial, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.notes { margin: 0; }

/* Stack species entries on narrow screens */
@media (max-width: 700px) {
  .species { grid-template-columns: 1fr; }
}

/* ---------- Photo gallery (family pages) ---------- */

/* Masonry-style columns: portrait and landscape photos flow together
   naturally, like a print contact sheet. */
.gallery {
  columns: 3;
  column-gap: 1rem;
  margin-top: 1.5rem;
}

@media (max-width: 900px) { .gallery { columns: 2; } }
@media (max-width: 550px) { .gallery { columns: 1; } }

.gallery a {
  display: block;
  margin-bottom: 1rem;
  break-inside: avoid;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0.4rem;
}

.gallery img {
  width: 100%;
  height: auto;
  display: block;
}

.gallery a:hover img,
.gallery a:focus-visible img { opacity: 0.88; }

/* ---------- Lightbox (full-size photo viewer) ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  background: rgba(30, 29, 24, 0.94);
  padding: 2rem 1rem 1rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 94vw;
  max-height: 82vh;
  border: 4px solid #fdfcf9;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  margin-top: 0.9rem;
  color: #efeee6;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.05rem;
  text-align: center;
  max-width: 90vw;
}

.lightbox button {
  position: absolute;
  background: none;
  border: none;
  color: #efeee6;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.5rem 0.9rem;
  font-family: Georgia, serif;
}

.lightbox button:hover,
.lightbox button:focus-visible { color: var(--gold); }

.lightbox-close { top: 0.5rem; right: 0.75rem; }
.lightbox-prev { left: 0.25rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 0.25rem; top: 50%; transform: translateY(-50%); }

/* ---------- Hero carousel (home page) ---------- */

.hero {
  position: relative;
  width: 100%;
  /* Always a 16:9 frame, at every window size and on mobile.
     The height simply follows the width. */
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #1e1d18;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.hero-slide.active { opacity: 1; }

.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;   /* fills the frame, cropping rather than squashing */
  display: block;
}

/* Captions on the carousel are currently hidden. To bring them back,
   delete the "display: none;" line below; the styling (white text in
   a translucent strip along the top) is all still here, ready. */
.hero-caption {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  margin: 0;
  padding: 1.1rem clamp(1.25rem, 5vw, 4rem) 2.5rem;
  color: #ffffff;
  font-family: "Newsreader", Georgia, serif;
  font-size: 11pt;
  line-height: 1.35;
  background: linear-gradient(
    to bottom,
    rgba(20, 19, 15, 0.65) 0%,
    rgba(20, 19, 15, 0) 100%
  );
}

.hero-prev,
.hero-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  background: rgba(30, 29, 24, 0.35);
  border: none;
  color: #ffffff;
  font-size: 2.6rem;
  line-height: 1;
  padding: 0.4rem 0.8rem 0.6rem;
  cursor: pointer;
  font-family: Georgia, serif;
  transition: background 0.15s ease;
}

.hero-prev:hover, .hero-prev:focus-visible,
.hero-next:hover, .hero-next:focus-visible {
  background: rgba(30, 29, 24, 0.65);
}

.hero-prev { left: 0; }
.hero-next { right: 0; }

@media (prefers-reduced-motion: reduce) {
  .hero-slide { transition: none; }
}

/* ---------- About page ---------- */

.about-portrait {
  display: block;
  width: min(260px, 60vw);
  margin: 0 auto 2rem;
  border: 1px solid var(--line);
  background: #e8e6db;
  padding: 0.4rem;
}

/* 2x2 grid of boxes (single column on phones) */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

@media (max-width: 700px) {
  .about-grid { grid-template-columns: 1fr; }
}

.about-box {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.75rem 1.75rem 1.5rem;
}

.about-box .about-icon {
  width: 42px;
  height: 42px;
  color: var(--olive);
  display: block;
  margin-bottom: 0.9rem;
}

.about-box h2 {
  margin: 0 0 0.6rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--olive-deep);
}

.about-box p { margin: 0 0 0.8rem; }
.about-box p:last-child { margin-bottom: 0; }

/* ---------- Contact page ---------- */

/* Embedded Google Form */
.form-embed {
  max-width: 680px;
  margin-top: 1.5rem;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0.4rem;
}

.form-embed iframe {
  display: block;
  width: 100%;
  border: none;
}

/* ---------- Map page ---------- */

.map-embed {
  margin-top: 1.5rem;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0.4rem;
}

.map-embed iframe {
  display: block;
  width: 100%;
  height: 70vh;
  min-height: 420px;
  border: none;
}

/* ---------- Footer ---------- */

footer.site-footer {
  border-top: 3px double var(--line);
  padding: 1.5rem;
  text-align: center;
  font-family: "Archivo", Arial, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

@media (prefers-reduced-motion: reduce) {
  .family-card { transition: none; }
}

/* ---------- Image protection ----------
   Prevents drag-to-desktop and the long-press "Save Image" menu on
   phones/tablets, for all photos on the site. */
img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
