/* ============================================================
   The Gamekeeper's Cottage — site layout chrome
   Page-level layout only (containers, sections, nav, footer,
   hero, modal, lightbox, calendar). Component look comes from
   the design-system bundle + tokens.
   ============================================================ */

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

/* Canvas switched from warm cream to white; warm oat retained for section bands
   and a faint warm card border added so white cards still read on white. */
:root {
  --gk-canvas: #ffffff;
  --gk-surface-soft: #f5efe3;   /* warm oat bands for rhythm against white */
  --gk-hairline-soft: #ece6da;  /* slightly clearer card hairline on white */
  --surface-dark: #24493a;      /* deep woodland green footer (was bark brown) */
  --gk-moss: #4f6b42;           /* darker moss so eyebrows/labels pass AA on white */
  --gk-muted-soft: #6f6a5e;     /* tertiary text now meets 4.5:1 on white */
  --gk-muted: #6c675b;          /* secondary text clears AA on white AND oat bands */
}

/* Accessibility: visible keyboard focus + skip link */
.skip-link {
  position: absolute; left: 8px; top: -56px; z-index: 200;
  background: var(--color-primary); color: #fff; font-weight: 600;
  padding: 10px 16px; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none; transition: top var(--dur-base) var(--ease-out);
}
.skip-link:focus { top: 0; outline: none; box-shadow: var(--shadow-focus); }
a:focus-visible, button:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: var(--radius-xs);
}
/* a11y: deepen gold badge text to clear AA (4.5:1) on its pale ground */
.gk-badge--gold { color: #6e531f !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-body);
  background: var(--surface-page);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: var(--text-link); }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text-strong); margin: 0; line-height: var(--lh-snug); font-weight: var(--fw-semibold); text-wrap: pretty; }
p { text-wrap: pretty; }

.container { max-width: var(--container-max); margin: 0 auto; padding-left: 32px; padding-right: 32px; }
.container--narrow { max-width: var(--container-narrow); }
.section { padding: 80px 0; }
.section--tight { padding: 56px 0; }
.section--soft { background: var(--surface-soft); border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.section--bark { background: var(--surface-dark); color: #efe7d8; }

.eyebrow-rule { /* matches DS eyebrow without React */ }

.h-display { font-size: var(--fs-display); line-height: 1.04; letter-spacing: var(--ls-tight); }
.h1 { font-size: var(--fs-h1); }
.h2 { font-size: var(--fs-h2); }
.h3 { font-size: var(--fs-h3); }
.lead { font-size: var(--fs-lead); line-height: 1.6; color: var(--text-body); }
.muted { color: var(--text-muted); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60; height: var(--header-height);
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 0 32px;
  background: rgba(255,255,255,0.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand__word { display: flex; flex-direction: column; line-height: 1.08; white-space: nowrap; }
.brand__word b { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--text-strong); }
.brand__word span { font-family: var(--font-display); font-size: 12px; font-weight: 500; letter-spacing: 0.3em; color: var(--color-primary); }
.nav { display: flex; align-items: center; gap: 26px; }
.nav a.navlink {
  font-size: 15px; font-weight: 500; color: var(--text-body); text-decoration: none;
  padding: 6px 0; white-space: nowrap; border-bottom: 2px solid transparent;
  transition: color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.nav a.navlink:hover { color: var(--color-primary); }
.nav a.navlink.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.nav__group { position: relative; }
/* Invisible bridge across the gap between the trigger and the menu, so the menu
   doesn't close as the cursor crosses the gap. Only active while the group is hovered. */
.nav__group::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 14px; display: none; }
.nav__group:hover::after { display: block; }
.nav__menu {
  position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(-6px);
  background: var(--surface-card); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: 8px; min-width: 220px; display: grid; gap: 2px;
  opacity: 0; visibility: hidden; transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.nav__group:hover .nav__menu, .nav__group:focus-within .nav__menu { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.nav__menu a { display: block; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 14.5px; color: var(--text-body); text-decoration: none; }
.nav__menu a:hover { background: var(--accent-fern); color: var(--color-primary-active); }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text-strong); padding: 6px; }
.mobile-nav { display: none; }

@media (max-width: 940px) {
  .nav { display: none; }
  .nav-toggle { display: inline-flex; }
  .mobile-nav.is-open { display: block; position: fixed; inset: var(--header-height) 0 0; z-index: 55; background: var(--surface-page); padding: 16px 24px 40px; overflow:auto; }
  .mobile-nav a { display: block; padding: 14px 4px; border-bottom: 1px solid var(--border-soft); font-size: 18px; color: var(--text-strong); text-decoration: none; font-family: var(--font-display); }
}

/* ---------- Hero ---------- */
.hero { position: relative; }
.hero__media { position: relative; width: 100%; }
.hero__scrim { position: absolute; inset: 0; }
.hero__inner { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; }

/* ---------- Booking bar ---------- */
.bookingbar {
  background: var(--surface-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 16px; display: grid; grid-template-columns: 1.1fr 1.1fr 0.9fr auto; gap: 14px; align-items: end;
}
@media (max-width: 760px){ .bookingbar { grid-template-columns: 1fr 1fr; } .bookingbar .bookingbar__cta{ grid-column: 1 / -1; } }

/* ---------- Generic grids ---------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px){ .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px){ .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Prose ---------- */
.prose { max-width: var(--container-narrow); margin: 0 auto; }
.prose h2 { font-size: var(--fs-h3); margin: 40px 0 12px; }
.prose h3 { font-size: var(--fs-h4); margin: 32px 0 10px; }
.prose p { margin: 0 0 18px; color: var(--text-body); line-height: 1.75; }
.prose ul { margin: 0 0 18px; padding-left: 22px; color: var(--text-body); line-height: 1.8; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface-dark); color: #e9e0d1; padding: 64px 0 0; }
.site-footer a { color: #b9cdb4; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.4fr 1.4fr; gap: 40px; }
@media (max-width: 880px){ .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 540px){ .footer-grid { grid-template-columns: 1fr; } }
.footer-h { font-family: var(--font-display); font-size: 18px; color: #fff; margin: 0 0 18px; font-weight: 600; }
.footer-list { display: grid; gap: 10px; font-size: 15px; }
.footer-bar { margin-top: 56px; background: var(--color-primary); color: #eaf2e8; text-align: center; font-size: 13px; padding: 16px; }

/* ---------- Modal / dialog ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(36,40,30,0.55); display: grid; place-items: center; padding: 24px; }
.dialog { background: var(--surface-page); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 760px; max-height: 90vh; overflow: auto; animation: rise .26s var(--ease-out); }
.dialog__close { position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--border-soft); background: var(--surface-card); cursor: pointer; display: grid; place-items: center; color: var(--text-strong); z-index: 2; }
@keyframes rise { from { transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce){ .dialog { animation: none; } }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(18,20,15,0.92); display: grid; grid-template-rows: 1fr auto; }
.lightbox__stage { display: grid; place-items: center; padding: 40px; overflow: hidden; }
.lightbox__stage img { max-width: 92vw; max-height: 78vh; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.lightbox__bar { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 0 0 26px; color: #f3ead9; }
.lightbox__btn { width: 52px; height: 52px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.08); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lightbox__btn:hover { background: rgba(255,255,255,0.18); }
.lightbox__close { position: absolute; top: 20px; right: 24px; background: none; border: none; color: #fff; cursor: pointer; }

/* ---------- Mini calendar ---------- */
.cal { display: inline-grid; gap: 6px; }
.cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal__title { font-family: var(--font-display); font-weight: 600; color: var(--text-strong); font-size: 16px; }
.cal__nav { width: 30px; height: 30px; border-radius: 999px; border: 1px solid var(--border-soft); background: var(--surface-card); cursor: pointer; display: grid; place-items: center; color: var(--text-body); }
.cal__grid { display: grid; grid-template-columns: repeat(7, 38px); gap: 3px; }
.cal__dow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); text-align: center; padding-bottom: 4px; }
.cal__cell { height: 38px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 14px; }
.cal__cell--out { color: var(--text-soft); }
.cal__cell--free { background: var(--accent-fern); color: var(--color-primary-active); font-weight: 600; }
.cal__cell--busy { background: #f3e3df; color: #9f3d2e; text-decoration: line-through; }
/* Half-day turnover — only where the adjoining dates are free, so a stay can still
   begin or end here. A clean diagonal, half booked / half available, no divider.
   Check-in = free then booked (135deg); checkout = booked then free. Both selectable.
   (Same-day turnovers, where a guest departs and another arrives, are 'busy' pink.) */
.cal__cell--checkin { background: linear-gradient(135deg, var(--accent-fern) 0 50%, #eec7bb 50% 100%); color: var(--color-primary-active); font-weight: 600; }
.cal__cell--checkout { background: linear-gradient(135deg, #eec7bb 0 50%, var(--accent-fern) 50% 100%); color: var(--color-primary-active); font-weight: 600; }
.cal__legend { display: flex; gap: 18px; font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.cal__dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }

/* ---------- Sticky book card ---------- */
.bookcard { position: sticky; top: calc(var(--header-height) + 20px); }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--border-soft); border: 0; margin: 0; }
.tag-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip-link { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--color-primary); text-decoration: none; }
.chip-link:hover { color: var(--color-primary-active); }
.reveal { opacity: 0; transform: translateY(16px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
@media (prefers-reduced-motion: reduce){ .reveal { opacity: 1; transform: none; } }

/* ---------- Responsive: collapse hand-built column layouts on phones ----------
   Inline grid-template-columns can't carry media queries, so these marker classes
   let the two-column sections stack and the photo collages re-flow on small screens. */
/* let inputs shrink inside narrow cards rather than overflow */
.gk-field, .gk-input { min-width: 0; max-width: 100%; }

@media (max-width: 820px) {
  /* two-column text / media sections → single column */
  .gk-stack { grid-template-columns: 1fr !important; }
  /* sticky book card shouldn't stick once it's stacked under the content */
  .bookcard { position: static !important; }
  /* photo collages → feature image full-width, the rest as even 2-up tiles */
  .gk-photos { grid-template-columns: 1fr 1fr !important; grid-template-rows: none !important; grid-auto-rows: 150px !important; }
  .gk-photos > * { grid-column: auto !important; grid-row: auto !important; }
  .gk-photos > *:first-child { grid-column: 1 / -1 !important; grid-row: span 2 !important; }
}
@media (max-width: 480px) {
  .gk-photos { grid-template-columns: 1fr !important; grid-auto-rows: 200px !important; }
}
@media (max-width: 600px) {
  .container { padding-left: 20px; padding-right: 20px; }
  .section { padding: 56px 0; }
}
/* Availability calendar: stack multiple months and let the grid fit narrow screens */
@media (max-width: 620px) {
  .cal__months { grid-template-columns: 1fr !important; gap: 28px !important; }
}
@media (max-width: 380px) {
  .cal__grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .cal__cell { height: 34px; }
}
