/* Cría Cibao La Pampa */

/* Fonts are self-hosted (SIL Open Font License 1.1, see assets/fonts/LICENSE.txt) */
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
}

:root {
  --ink: #13231a;
  --ink-2: #1a2e22;
  --paper: #f5f1e8;
  --paper-2: #ece5d6;
  --text: #1c231e;
  --muted: #5b645d;
  --brass: #c19a55;
  --brass-dark: #7a5d2b;
  --sold: #b3261e;
  --cream: #f5f1e8;
  --cream-muted: rgba(245, 241, 232, 0.72);
  --line: rgba(19, 35, 26, 0.14);
  --line-dark: rgba(245, 241, 232, 0.16);

  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1240px;
  --header-h: 68px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--announce-h, 0px) + 8px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, p, ol, dl, dd, figure { margin: 0; }

/* Language switching: both languages live in the page, one is hidden. */
html[data-lang="en"] [lang="es"]:not(html),
html[data-lang="es"] [lang="en"]:not(html) { display: none !important; }

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 14px;
  background: var(--brass);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

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

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass-dark);
}
.on-dark .eyebrow { color: var(--brass); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:hover { background: var(--brass-dark); }
.btn-ghost { border-color: var(--line); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--text); }

.on-dark .btn-primary { background: var(--brass); color: var(--ink); }
.on-dark .btn-primary:hover { background: var(--cream); }
.on-dark .btn-ghost { border-color: var(--line-dark); color: var(--cream); }
.on-dark .btn-ghost:hover { border-color: var(--cream); }

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

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  color: var(--cream);
  background: rgba(19, 35, 26, 0.94);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--line-dark); }

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  margin-right: auto;
  min-width: 0;
}
.brand-mark {
  flex: none;
  width: 46px;
  height: 43px;
  background: var(--brass);
  -webkit-mask: url("../img/crest.svg") center / contain no-repeat;
  mask: url("../img/crest.svg") center / contain no-repeat;
}
.site-footer .brand-mark { width: 64px; height: 59px; }
.brand-name {
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.site-nav ul {
  display: flex;
  gap: 30px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--cream-muted);
  transition: color 0.2s;
}
.site-nav a:hover { color: var(--cream); }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  padding: 3px;
}
.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--cream-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.lang-switch button[aria-pressed="true"] { background: var(--cream); color: var(--ink); }

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.menu-toggle span {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 1.5px;
  background: var(--cream);
  transition: transform 0.3s var(--ease), opacity 0.2s;
}
.menu-toggle span:nth-child(1) { top: 16px; }
.menu-toggle span:nth-child(2) { top: 21.5px; }
.menu-toggle span:nth-child(3) { top: 27px; }
.menu-open .menu-toggle span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

@media (max-width: 860px) {
  .menu-toggle { display: block; }
  .brand-name { font-size: 1.2rem; }
  .site-nav {
    position: fixed;
    inset: calc(var(--header-h) + var(--announce-h, 0px)) 0 auto 0;
    background: var(--ink);
    border-top: 1px solid var(--line-dark);
    padding: 12px var(--gutter) 28px;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s linear 0.25s;
  }
  .menu-open .site-nav {
    opacity: 1;
    transform: none;
    visibility: visible;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a {
    display: block;
    padding: 16px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--line-dark);
  }
}
@media (max-width: 480px) {
  .header-inner { gap: 12px; }
  .brand { gap: 10px; }
  .site-header .brand-mark { width: 38px; height: 35px; }
}
@media (max-width: 370px) {
  .site-header .brand-mark { display: none; }
}

/* Announcement bar (admin page); only shown when it has text */
.announce {
  background: var(--brass);
  color: var(--ink);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  padding: 9px var(--gutter);
}
.announce[hidden] { display: none; }
.announce p { max-width: var(--max); margin-inline: auto; overflow-wrap: anywhere; }

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

.hero {
  background: var(--ink);
  color: var(--cream);
  padding-top: calc(var(--header-h) + var(--announce-h, 0px) + clamp(40px, 7vw, 96px));
  padding-bottom: clamp(56px, 8vw, 112px);
  position: relative;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.hero-copy .eyebrow { margin-bottom: 22px; }
.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3.3rem, 7.4vw, 6.6rem);
  line-height: 0.95;
  letter-spacing: -0.015em;
}
.hero h1 em { display: block; font-style: italic; color: var(--brass); }
.hero-lede {
  margin-top: 26px;
  max-width: 30ch;
  font-size: 1.1rem;
  color: var(--cream-muted);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}
.hero-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--ink-2);
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-media figcaption {
  position: absolute;
  left: 0;
  bottom: -30px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--cream-muted);
}
.hero-media::after {
  content: "";
  position: absolute;
  inset: 14px -14px -14px 14px;
  border: 1px solid rgba(193, 154, 85, 0.45);
  z-index: -1;
  pointer-events: none;
}
.hero-media { z-index: 0; isolation: isolate; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-media { margin-right: 14px; }
}

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

.section { padding-block: clamp(72px, 10vw, 140px); }
.section-dark { background: var(--ink); color: var(--cream); }
.section-alt { background: var(--paper-2); }

.section h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.3rem, 4.6vw, 3.8rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
}
.section-head {
  display: grid;
  gap: 18px;
  max-width: 720px;
  margin-bottom: clamp(40px, 5vw, 64px);
}
.section-head p:not(.eyebrow) { color: var(--muted); font-size: 1.05rem; }
.on-dark .section-head p:not(.eyebrow) { color: var(--cream-muted); }

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

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(40px, 7vw, 110px);
  align-items: start;
}
.about-intro { position: sticky; top: calc(var(--header-h) + var(--announce-h, 0px) + 40px); }
.about-intro .eyebrow { margin-bottom: 20px; }
.about-intro h2 { font-size: clamp(2rem, 3.4vw, 2.9rem); line-height: 1.1; }
.signature {
  margin-top: 28px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--brass-dark);
}

.timeline {
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--line);
}
.timeline li {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
  padding-block: 34px;
  border-bottom: 1px solid var(--line);
}
.timeline .tl-date {
  font-family: var(--serif);
  font-size: 1.75rem;
  line-height: 1.1;
  color: var(--ink);
}
.tl-step {
  display: block;
  margin-bottom: 8px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass-dark);
}
.timeline p { font-size: 1.08rem; color: var(--text); }

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-intro { position: static; }
  .timeline li { grid-template-columns: 1fr; gap: 8px; padding-block: 26px; }
}

/* ---------- Horses ---------- */

.horses-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(40px, 5vw, 60px);
}
.horses-head .section-head { margin-bottom: 0; }
.horses-count {
  font-family: var(--serif);
  font-size: clamp(3.5rem, 7vw, 5.5rem);
  line-height: 0.9;
  color: var(--brass-dark);
}

.horse-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 2.6vw, 34px);
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (max-width: 1020px) { .horse-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .horse-grid { grid-template-columns: 1fr; } }

.horse {
  position: relative;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.horse:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -22px rgba(19, 35, 26, 0.45);
}
.horse-photo {
  position: relative;
  aspect-ratio: 6 / 5;
  overflow: hidden;
  background: #d9d2c2;
}
.horse-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}
.horse:hover .horse-photo img { transform: scale(1.035); }

.horse-body { padding: 22px 22px 24px; display: grid; gap: 16px; }
.horse h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.85rem;
  line-height: 1.05;
}
.horse h3 small {
  display: block;
  margin-bottom: 6px;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass-dark);
}
.horse-open {
  all: unset;
  cursor: pointer;
}
.horse-open::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.horse-open:focus-visible::after { outline: 2px solid var(--brass-dark); outline-offset: 3px; }

.meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.meta div { min-width: 0; }
.meta dt {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.meta dd { font-size: 0.98rem; font-weight: 500; }

.horse-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-dark);
}
.horse-more svg { width: 16px; height: 16px; transition: transform 0.3s var(--ease); }
.horse:hover .horse-more svg { transform: translateX(4px); }

/* Sold horses: red band across the photo, top left to bottom right */
.sold-band {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 160%;
  padding: 12px 0;
  transform: translate(-50%, -50%) rotate(39.8deg);
  background: var(--sold);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-align: center;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.sold-band[hidden] { display: none; }
.dlg-photo .sold-band { width: 180%; padding: 16px 0; font-size: 1.35rem; transform: translate(-50%, -50%) rotate(33deg); }

/* Last grid cell: enquiry card */
.horse-cta {
  background: var(--ink);
  color: var(--cream);
  padding: clamp(26px, 3vw, 36px);
  justify-content: flex-end;
  gap: 18px;
  min-height: 320px;
}
.horse-cta:hover { transform: none; box-shadow: none; }
.horse-cta .cta-title {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 2.6vw, 2.4rem);
  line-height: 1.08;
}
.horse-cta .cta-email {
  font-size: 1.02rem;
  color: var(--cream-muted);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.horse-cta .cta-email:hover { color: var(--cream); }
.horse-cta .btn { align-self: flex-start; }

/* ---------- Horse dialog ---------- */

.horse-dialog {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--text);
  overflow: auto;
  overscroll-behavior: contain;
}
.horse-dialog::backdrop {
  background: rgba(10, 18, 13, 0.82);
  backdrop-filter: blur(3px);
}
.horse-dialog[open] { animation: dlg-in 0.35s var(--ease); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(12px); } }

.dlg-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
}
.dlg-photo {
  position: relative;
  overflow: hidden;
  background: var(--ink-2);
  display: grid;
  place-items: center;
  min-height: 280px;
}
.dlg-photo img { width: 100%; height: 100%; max-height: calc(100dvh - 32px); object-fit: contain; }
.dlg-body {
  padding: clamp(24px, 3.4vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.dlg-body h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 3.6vw, 3rem);
  line-height: 1;
  margin-top: -8px;
}
.dlg-body .meta { grid-template-columns: 1fr; gap: 0; padding-top: 0; }
.dlg-body .meta div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 12px;
  border-bottom: 1px solid var(--line);
}
.dlg-body .meta div:first-child { border-top: 1px solid var(--line); }
.dlg-body .meta dd { text-align: right; }
.dlg-actions { display: grid; gap: 10px; margin-top: auto; }
.dlg-email { font-size: 0.85rem; color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.dlg-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.icon-btn:hover { border-color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.dlg-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  background: rgba(245, 241, 232, 0.92);
}

@media (max-width: 760px) {
  .dlg-grid { grid-template-columns: 1fr; }
  .dlg-photo img { max-height: 62dvh; }
}

/* ---------- Video ---------- */

.video-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: center;
}
.video-copy { margin-bottom: 0; }
.video-copy p:not(.eyebrow) { max-width: 46ch; }
.video-copy .btn { margin-top: 10px; }

.video-short { width: min(360px, 100%); justify-self: center; }
.video-frame {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #0b150f;
  outline: 1px solid rgba(193, 154, 85, 0.45);
  outline-offset: 12px;
}
.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-short figcaption {
  margin-top: 26px;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--cream-muted);
}

@media (max-width: 860px) {
  .video-grid { grid-template-columns: 1fr; }
  .video-short { width: min(320px, calc(100% - 28px)); }
}

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

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: end;
}
.contact-grid .section-head { margin-bottom: 0; }
.email-link {
  display: inline-block;
  max-width: 100%;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3.6vw, 2.8rem);
  line-height: 1.15;
  text-decoration: none;
  overflow-wrap: anywhere;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  transition: border-color 0.2s;
}
.email-link:hover { border-color: var(--text); }
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; align-items: start; }
}

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

.site-footer {
  background: var(--ink);
  color: var(--cream-muted);
  padding-block: 56px 40px;
  font-size: 0.88rem;
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line-dark);
}
.footer-top .brand { color: var(--cream); margin-right: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 28px; list-style: none; margin: 0; padding: 0; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--cream); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-top: 24px;
  font-size: 0.8rem;
}
.admin-link {
  color: rgba(245, 241, 232, 0.45);
  text-decoration: none;
  font-size: 0.72rem;
}
.admin-link:hover { color: var(--cream); text-decoration: underline; }

/* ---------- Reveal on scroll ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.js .reveal.is-in { opacity: 1; transform: none; }

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