/* Danebury Racing Stables */

:root {
  --paper: #f7f3ec;
  --paper-2: #efe8dc;
  --ink: #17211b;
  --turf: #1d3829;
  --turf-2: #274a37;
  --brand: #f2663c;        /* logo orange: accents and large type only */
  --brand-ink: #b5431c;    /* orange dark enough for text on cream */
  --muted: #56615a;
  --line: rgba(23, 33, 27, 0.14);
  --on-dark: #f4efe6;
  --on-dark-muted: rgba(244, 239, 230, 0.74);

  --serif: 'Cormorant Garamond', 'Iowan Old Style', Palatino, Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --gutter: clamp(16px, 5vw, 48px);
  --max: 1180px;
  --radius: 4px;
  --header-h: 76px;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--brand-ink); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.05; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); }
h3 { font-size: clamp(1.5rem, 2.4vw, 1.9rem); }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

.wrap { width: 100%; max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

.eyebrow {
  display: inline-block;
  font: 600 0.75rem/1.2 var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-ink);
  margin-bottom: 1.1rem;
}

.lede { font-size: clamp(1.1rem, 1.6vw, 1.25rem); color: var(--muted); }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; }
.skip:focus { left: 8px; }

/* ---------- Header ---------- */

.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center;
  transition: background-color .3s ease, box-shadow .3s ease;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 62px; width: auto; }
.brand .logo-dark { display: none; }

.nav { display: flex; gap: clamp(18px, 2.6vw, 34px); }
.nav a {
  color: var(--on-dark); text-decoration: none;
  font: 500 0.82rem/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase;
  padding: 8px 0; border-bottom: 1px solid transparent;
}
.nav a:hover { border-bottom-color: currentColor; }

.menu-btn { display: none; background: none; border: 0; padding: 8px; color: var(--on-dark); cursor: pointer; }
.menu-btn svg { width: 28px; height: 28px; display: block; }

.site-header.scrolled, .site-header.open { background: var(--paper); box-shadow: 0 1px 0 var(--line); }
.site-header.scrolled .logo-light, .site-header.open .logo-light { display: none; }
.site-header.scrolled .logo-dark, .site-header.open .logo-dark { display: block; }
.site-header.scrolled .nav a, .site-header.open .nav a, .site-header.scrolled .menu-btn, .site-header.open .menu-btn { color: var(--ink); }

@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .brand img { height: 46px; }
  .menu-btn { display: block; }
  .nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 16px;
    display: none;
  }
  .site-header.open .nav { display: flex; }
  .nav a { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
  .nav a:last-child { border-bottom: 0; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: flex-end;
  color: var(--on-dark); overflow: hidden; background: var(--turf);
}
.hero picture, .hero picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 18, 13, 0.55) 0%, rgba(10, 18, 13, 0) 26%),
    linear-gradient(90deg, rgba(10, 18, 13, 0) 38%, rgba(10, 18, 13, 0.62) 78%),
    linear-gradient(0deg, rgba(10, 18, 13, 0.55) 0%, rgba(10, 18, 13, 0) 45%);
}
.hero .wrap { position: relative; z-index: 1; display: flex; justify-content: flex-end; padding-bottom: clamp(48px, 10vh, 110px); }
.hero-content { max-width: 600px; }
.hero .eyebrow { color: var(--brand); }
.hero h1 { font-size: clamp(3rem, 7.4vw, 6.2rem); }
.hero p { font-size: clamp(1.1rem, 1.8vw, 1.35rem); max-width: 34rem; margin-top: 1.25rem; color: var(--on-dark); }
.hero .actions { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 760px) {
  .hero picture img { object-position: 30% 50%; }
  .hero::after {
    background:
      linear-gradient(180deg, rgba(10, 18, 13, 0.55) 0%, rgba(10, 18, 13, 0) 22%),
      linear-gradient(0deg, rgba(10, 18, 13, 0.88) 0%, rgba(10, 18, 13, 0.55) 45%, rgba(10, 18, 13, 0) 70%);
  }
  .hero .wrap { justify-content: flex-start; }
}

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 0.82rem/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
  padding: 16px 24px; border-radius: var(--radius); border: 1px solid transparent;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn-primary { background: var(--brand); color: #1a0d07; }
.btn-primary:hover { background: #ff7a50; color: #1a0d07; }
.btn-ghost { border-color: rgba(244, 239, 230, 0.6); color: var(--on-dark); }
.btn-ghost:hover { background: rgba(244, 239, 230, 0.12); color: var(--on-dark); }
.btn-dark { background: var(--turf); color: var(--on-dark); }
.btn-dark:hover { background: var(--ink); color: var(--on-dark); }
.btn-ghost-dark { border-color: rgba(23, 33, 27, 0.35); color: var(--ink); }
.btn-ghost-dark:hover { background: rgba(23, 33, 27, 0.06); color: var(--ink); }

/* ---------- Sections ---------- */

section { padding: clamp(72px, 11vw, 140px) 0; }

.intro { text-align: center; }
.intro .statement {
  font: 500 clamp(1.7rem, 3.4vw, 2.6rem)/1.25 var(--serif);
  max-width: 30ch; margin: 0 auto; color: var(--ink);
}
.stats {
  list-style: none; margin: clamp(48px, 7vw, 80px) auto 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); max-width: 980px;
  border-top: 1px solid var(--line);
}
.stats li { padding: 28px 12px 0; }
.stats li + li { border-left: 1px solid var(--line); }
.stats strong { display: block; font: 600 clamp(2.2rem, 4vw, 3rem)/1 var(--serif); color: var(--brand-ink); }
.stats span { display: block; margin-top: 10px; font-size: 0.88rem; color: var(--muted); }
@media (max-width: 760px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats li:nth-child(3) { border-left: 0; }
  .stats li:nth-child(n+3) { border-top: 1px solid var(--line); margin-top: 28px; }
}

.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 88px); align-items: center; }
.split.reverse > :first-child { order: 2; }
.split figure { margin: 0; }
.split figure img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); }
.split h2 { margin-bottom: 1.5rem; }
figcaption { margin-top: 12px; font-size: 0.82rem; color: var(--muted); }
.figure-stack { display: grid; gap: 28px; }
.figure-stack figure img { aspect-ratio: auto; }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .split.reverse > :first-child { order: 0; }
}

/* History */
.history { background: var(--paper); }
.timeline { list-style: none; margin: clamp(56px, 8vw, 96px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.timeline li { padding: 26px 22px 0 0; }
.timeline .year { display: block; font: 600 1.9rem/1 var(--serif); color: var(--brand-ink); margin-bottom: 10px; }
.timeline p { font-size: 0.95rem; color: var(--muted); }

/* Restoration (dark band) */
.revival { background: var(--turf); color: var(--on-dark); }
.revival .eyebrow { color: var(--brand); }
.revival p { color: var(--on-dark-muted); }
.revival p.big { font: 500 clamp(1.4rem, 2.4vw, 1.8rem)/1.35 var(--serif); color: var(--on-dark); }
.revival a { color: var(--brand); }
.revival a:hover { color: var(--on-dark); }
.memorial { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(244, 239, 230, 0.2); font-size: 0.92rem; }

/* Estate gallery */
.estate-head { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 72px); align-items: end; margin-bottom: clamp(40px, 6vw, 64px); }
@media (max-width: 860px) { .estate-head { grid-template-columns: 1fr; } }
.gallery { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.gallery figure { margin: 0; position: relative; overflow: hidden; border-radius: var(--radius); background: var(--paper-2); }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.gallery figure:hover img { transform: scale(1.03); }
.gallery figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0;
  padding: 40px 18px 16px; color: #fff; font-size: 0.9rem;
  background: linear-gradient(0deg, rgba(10, 18, 13, 0.75), rgba(10, 18, 13, 0));
}
.gallery figcaption strong { display: block; font: 600 1.3rem/1.15 var(--serif); }
.g-wide { grid-column: span 8; aspect-ratio: 16 / 9; }
.g-tall { grid-column: span 4; }
.g-third { grid-column: span 4; aspect-ratio: 4 / 3; }
.g-half { grid-column: span 6; aspect-ratio: 16 / 10; }
@media (max-width: 860px) {
  .g-wide, .g-tall, .g-third, .g-half { grid-column: span 12; aspect-ratio: 16 / 10; }
}

/* Today */
.today { background: var(--paper-2); }
.today .actions { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 12px; }

/* Find us */
.find { text-align: center; }
.find .wrap { max-width: 760px; }
.find h2 { margin-bottom: 1.25rem; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 3rem; border-top: 1px solid var(--line); text-align: left; }
.contact-grid > div { padding: 28px 24px 0 0; }
.contact-grid > div + div { padding-left: 24px; border-left: 1px solid var(--line); }
.contact-grid h3 { font-size: 1.45rem; margin-bottom: 0.6rem; }
.contact-grid p { color: var(--muted); font-size: 0.97rem; }
.contact-grid p a { font-weight: 500; }
.map-link { margin-top: 3rem; }
@media (max-width: 640px) {
  .contact-grid { grid-template-columns: 1fr; }
  .contact-grid > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); margin-top: 28px; }
}

/* Footer */
.site-footer { background: var(--ink); color: var(--on-dark-muted); padding: 56px 0 40px; font-size: 0.88rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
.site-footer img { height: 72px; width: auto; }
.site-footer a { color: var(--on-dark); }
.site-footer a:hover { color: var(--brand); }
.site-footer p { margin: 0; }

/* Reveal on scroll (only when JS runs and motion is welcome) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .gallery img { transition: none; }
}
