/* ============================================================
   COUDELARIA JCL — Horse Profile Template
   Shared stylesheet for all horse pages
   ============================================================ */

/* --- Fonts ---
   Google Fonts loaded in HTML:
   - Cormorant Garamond 400..700 (headings, display)
   - Inter 300..600 (body)
   - Playfair Display SC 400..700 (JCL logo mark)
   ------------------------------------------------------------ */

:root {
  --bg: #0c0b0a;
  --bg-soft: #151311;
  --panel: rgba(255, 255, 255, 0.04);
  --line: rgba(211, 183, 122, 0.22);
  --gold: #d3b77a;
  --gold-soft: #a98d57;
  --gold-bright: #e4ca8f;
  --text: #f4efe6;
  --muted: #c6beb1;
  --white-soft: rgba(255, 255, 255, 0.88);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 8px 30px rgba(0, 0, 0, 0.25);
  --max: 1280px;
  --radius: 24px;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Reset & Base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(211, 183, 122, 0.08), transparent 30%),
    linear-gradient(180deg, #0a0908 0%, #0d0b0a 45%, #11100e 100%);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* --- JCL Logo Typography ----------------------------------- */
.jcl {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* --- Layout ------------------------------------------------ */
.container {
  width: min(calc(100% - 48px), var(--max));
  margin: 0 auto;
}

/* --- Shared Components ------------------------------------- */
.eyebrow {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(8px);
}

.section {
  padding: 110px 0;
  position: relative;
}

.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.5rem, 5vw, 4.25rem);
  line-height: 0.95;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 18px 0 20px;
}

.section-intro {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0;
}

/* --- Reveal Animation -------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* --- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), #b59458);
  color: #17120a;
  box-shadow: 0 10px 30px rgba(211, 183, 122, 0.18);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(211, 183, 122, 0.25);
}

.btn-secondary {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}
.btn-secondary:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.06);
}

/* --- HERO -------------------------------------------------- */
.hero {
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero-media::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(6, 5, 4, 0.88) 0%, rgba(6, 5, 4, 0.52) 42%, rgba(6, 5, 4, 0.15) 100%),
    linear-gradient(180deg, rgba(6, 5, 4, 0.15) 0%, rgba(6, 5, 4, 0.7) 100%);
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 70% 30%, rgba(211, 183, 122, 0.1), transparent 28%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.65fr;
  gap: 40px;
  align-items: end;
  width: 100%;
  padding: 160px 0 110px;
}

/* Ensure hero content has same visual margin as rest of page */
.hero > .container {
  width: min(calc(100% - 80px), var(--max));
}

.hero-content { animation: heroFadeIn 1s var(--ease) both; }

@keyframes heroFadeIn {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(4rem, 10vw, 8rem);
  line-height: 0.88;
  margin: 18px 0;
  font-weight: 600;
  letter-spacing: -0.04em;
  max-width: 10ch;
}

.hero h1 .jcl {
  font-size: 0.85em;
  vertical-align: baseline;
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--white-soft);
  max-width: 720px;
  margin: 0 0 16px;
}

.hero-copy {
  max-width: 700px;
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 36px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* Hero Card */
.hero-card {
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(14, 12, 10, 0.52);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  justify-self: end;
  width: min(100%, 380px);
  animation: heroFadeIn 1s 0.3s var(--ease) both;
}

.hero-card h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.9rem;
  font-weight: 600;
  margin: 0 0 18px;
}

.facts { display: grid; gap: 14px; }

.fact {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.fact:last-child { border-bottom: none; padding-bottom: 0; }

.fact-label {
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-top: 2px;
}

.fact-value {
  color: var(--white-soft);
  font-size: 0.94rem;
}

/* --- Split Layout ------------------------------------------ */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.image-frame {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  background: #120f0d;
  position: relative;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4 / 5;
  transition: transform 0.7s var(--ease);
}

.image-frame:hover img {
  transform: scale(1.03);
}

/* Caption overlay for split image */
.image-frame .gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 36px 14px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.image-frame:hover .gallery-caption { opacity: 1; }

.copy p {
  color: var(--muted);
  margin: 0 0 18px;
  font-size: 1.02rem;
  line-height: 1.7;
}
.copy strong { color: var(--text); font-weight: 600; }

/* --- Stats Grid -------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 42px;
}

.stat {
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  box-shadow: var(--shadow-sm);
  transition: border-color 0.3s var(--ease);
}
.stat:hover { border-color: var(--line); }

.stat-number {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.2rem, 3vw, 3.2rem);
  line-height: 1;
  color: var(--gold);
  margin-bottom: 10px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.95rem;
}

/* --- Title Cards ------------------------------------------- */
.titles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-top: 42px;
}

.title-card,
.quality,
.contact-card,
.pedigree-card {
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  box-shadow: var(--shadow-sm);
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.title-card:hover,
.quality:hover {
  border-color: var(--line);
  transform: translateY(-2px);
}

.title-card small,
.quality small,
.contact-card small,
.pedigree-label {
  display: block;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.7rem;
  margin-bottom: 14px;
}

.title-card h3,
.quality h3,
.contact-card h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.9rem;
  line-height: 1;
  margin: 0 0 10px;
  font-weight: 600;
}

.title-card p,
.quality p,
.contact-card p {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}

/* --- Timeline ---------------------------------------------- */
.timeline {
  margin-top: 36px;
  display: grid;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.timeline-item:first-child { border-top: 1px solid rgba(255, 255, 255, 0.06); }

.timeline-year {
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.78rem;
  padding-top: 5px;
}

.timeline-item h4 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.7rem;
  margin: 0 0 8px;
  font-weight: 600;
}

.timeline-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

/* --- Qualities Grid ---------------------------------------- */
.qualities-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 42px;
}

.quality { text-align: center; padding: 32px 24px; }

/* --- Gallery ----------------------------------------------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  margin-top: 42px;
}

.gallery-item {
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #110f0d;
  min-height: 260px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.gallery-item:hover img { transform: scale(1.05); }

/* Photo credit overlay — visible on hover */
.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 36px 14px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.gallery-item:hover .gallery-caption { opacity: 1; }

.gallery-caption .credit-photo,
.gallery-caption .credit-person {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
}
.gallery-caption .credit-photo { font-style: italic; }
.gallery-caption .credit-person { color: var(--gold-bright); }

/* Image positioning — prioritize head / key subject */
.obj-right  { object-position: 85% center !important; }
.obj-left   { object-position: left center !important; }
.obj-top    { object-position: center 20% !important; }

/* First row: landscape aspect ratio to show full horse */
.gallery-row-wide { grid-column: span 12; display: grid; grid-template-columns: 7fr 5fr; gap: 16px; }
.gallery-row-wide .gallery-item { min-height: 0; }
.gallery-row-wide .gallery-item img { aspect-ratio: 16 / 10; }

.span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
.span-12 img { aspect-ratio: 21 / 9; }

/* Gallery pair — photo + video side by side */
.gallery-pair {
  grid-column: span 12;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 42px;
}

.gallery-pair .gallery-item {
  height: 500px;
  overflow: hidden;
}

.gallery-pair .gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Inline Video in Gallery ------------------------------- */
.video-container video {
  width: auto;
  height: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.video-container { cursor: default; position: relative; }

/* --- Video ------------------------------------------------- */
.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #110f0d;
  box-shadow: var(--shadow);
  margin-top: 42px;
}

.video-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.45);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  pointer-events: none;
}
.video-caption span {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.65);
}
.video-caption .credit-photo { font-style: italic; }

/* Gallery items clickable */
.gallery-item { cursor: pointer; }

/* --- Lightbox ---------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  cursor: pointer;
}
.lightbox.active {
  opacity: 1;
  pointer-events: all;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.15); }

.lightbox-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.7);
}
.lightbox-caption .credit-photo { font-style: italic; }
.lightbox-caption .credit-person { color: var(--gold-bright); }

.video-frame iframe,
.video-frame video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* YouTube Shorts — vertical video */
.video-short {
  aspect-ratio: 9 / 16;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.video-link {
  display: block;
  cursor: pointer;
  text-decoration: none;
}

.video-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 4px;
  transition: all 0.25s ease;
  pointer-events: none;
}

.video-link:hover .video-play {
  background: rgba(211, 183, 122, 0.7);
  border-color: var(--gold);
  transform: translate(-50%, -50%) scale(1.08);
}

.image-frame { cursor: pointer; }

/* --- Pedigree Tree ----------------------------------------- */
.pedigree-tree {
  display: grid;
  grid-template-columns: 0.8fr 1fr 1.2fr;
  gap: 16px;
  margin-top: 42px;
  align-items: stretch;
}

/* 4-generation variant */
.ped-4gen {
  grid-template-columns: 0.7fr 0.9fr 1.1fr 1.3fr;
}

.ped-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
}

.ped-col-subject { justify-content: center; }
.ped-col-parents { justify-content: space-around; }
.ped-col-grandparents { justify-content: space-between; }
.ped-col-great { justify-content: space-between; }

.ped-horse {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  box-shadow: var(--shadow-sm);
  transition: border-color 0.3s var(--ease);
  position: relative;
}

.ped-horse:hover { border-color: var(--line); }

.ped-subject {
  background:
    linear-gradient(135deg, rgba(211, 183, 122, 0.1), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.02);
  border-color: var(--line);
}

.ped-tag {
  display: block;
  color: var(--gold);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.ped-horse h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.1;
  margin: 0 0 6px;
}

.ped-subject h3 {
  font-size: 1.8rem;
}

.ped-grand h3 {
  font-size: 1.25rem;
}

.ped-great {
  padding: 12px;
}

.ped-great h3 {
  font-size: 1rem;
}

.ped-great .ped-breeder {
  font-size: 0.7rem;
}

.ped-great .ped-awards {
  font-size: 0.62rem;
}

.ped-breeder {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
}

.ped-awards {
  display: inline-block;
  margin-top: 6px;
  color: var(--gold);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.pedigree-note {
  margin-top: 24px;
  padding: 20px 24px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.015);
}

.pedigree-note p {
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
  margin: 0;
}

/* --- Contact ----------------------------------------------- */
.contact-panel {
  padding: 36px;
  margin-top: 42px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(135deg, rgba(211, 183, 122, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr 0.7fr 0.7fr;
  gap: 22px;
  align-items: stretch;
}

.contact-main h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 0.95;
  margin: 0 0 14px;
  font-weight: 600;
}
.contact-main p {
  color: var(--muted);
  margin: 0;
  max-width: 560px;
  font-size: 0.95rem;
}

.contact-card {
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.contact-card:hover {
  border-color: var(--line);
  transform: translateY(-2px);
}

.contact-card .contact-handle {
  color: var(--gold-soft);
  font-size: 0.85rem;
  word-break: break-all;
}

/* --- Social Links ------------------------------------------ */
.social-section { padding: 60px 0 20px; }

.social-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.25s var(--ease);
}

.social-link:hover {
  color: var(--gold);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}

.social-link svg {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.25s;
}

.social-link:hover svg { opacity: 1; }

/* --- Footer ------------------------------------------------ */
footer {
  padding: 28px 0 42px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #9f9689;
  font-size: 0.88rem;
}

footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

footer a {
  color: var(--gold-soft);
  transition: color 0.2s;
}
footer a:hover { color: var(--gold); }

/* --- Responsive -------------------------------------------- */
@media (max-width: 1100px) {
  .hero-grid,
  .split,
  .contact-grid,
  .qualities-grid,
  .stats-grid,
  .titles-grid {
    grid-template-columns: 1fr;
  }

  .pedigree-tree {
    grid-template-columns: 0.8fr 1fr 1.2fr;
  }
  .ped-4gen {
    grid-template-columns: 0.7fr 0.9fr 1.1fr 1.3fr;
  }
  .gallery-pair { grid-template-columns: 1fr 1fr; }

  .hero-card { justify-self: start; width: 100%; max-width: 440px; }
  .hero > .container { width: min(calc(100% - 48px), var(--max)); }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-row-wide { grid-template-columns: 1fr 1fr; }
  .span-7, .span-5, .span-4, .span-8 { grid-column: span 1; }
}

@media (max-width: 720px) {
  .section { padding: 80px 0; }
  .container { width: min(calc(100% - 28px), var(--max)); }
  .hero > .container { width: min(calc(100% - 36px), var(--max)); }
  .hero-grid { padding: 120px 0 60px; }
  .hero h1 { max-width: 100%; }

  /* Center hero background on the horse's head on mobile */
  .hero-media { background-position: 35% center; }

  .timeline-item,
  .fact,
  .pedigree-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .gallery-grid { grid-template-columns: 1fr; }
  .gallery-grid > * { grid-column: 1 / -1 !important; }
  .gallery-row-wide { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; }

  .hero-card,
  .stat,
  .title-card,
  .quality,
  .contact-card,
  .ped-horse,
  .contact-panel { padding: 22px; }

  .pedigree-tree {
    grid-template-columns: 0.8fr 1fr 1.2fr;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    padding-bottom: 8px;
  }
  .ped-4gen {
    grid-template-columns: 0.6fr 0.8fr 1fr 1.2fr;
  }
  .ped-col-subject,
  .ped-col-parents,
  .ped-col-grandparents,
  .ped-col-great {
    min-width: 120px;
  }
  .ped-horse { padding: 12px; }
  .ped-horse h3 { font-size: 1rem; }
  .ped-subject h3 { font-size: 1.2rem; }
  .ped-grand h3 { font-size: 0.88rem; }
  .ped-great h3 { font-size: 0.8rem; }
  .ped-breeder { font-size: 0.68rem; }
  .ped-awards { font-size: 0.6rem; }
  .ped-tag { font-size: 0.58rem; margin-bottom: 4px; }
  .ped-great { padding: 8px; }
  .ped-great .ped-breeder { font-size: 0.6rem; }
  .ped-great .ped-awards { font-size: 0.55rem; }

  .gallery-pair { grid-template-columns: 1fr; }
  .gallery-pair .gallery-item { height: 350px; }

  footer .container {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
}
