/* Alpine Court Chalet — Fernie, BC
   Palette: spruce, snow, larch wood, glacier slate, and one squash-court line red. */

:root {
  --spruce: #17332d;
  --spruce-2: #1f423a;
  --snow: #f4f6f5;
  --mist: #e3e9e7;
  --ink: #1b2623;
  --slate: #5f7580;
  --larch: #c99a5b;
  --line: #c73a2f;
  --display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --text: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --max: 1180px;
  --gut: clamp(20px, 5vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--snow);
  color: var(--ink);
  font: 400 1.0625rem/1.7 var(--text);
  -webkit-font-smoothing: antialiased;
}
img, iframe, svg { max-width: 100%; display: block; }
a { color: inherit; }
p { margin: 0 0 1.1em; max-width: 62ch; }
ul { padding-left: 1.2em; margin: 0 0 1.2em; }
li { margin-bottom: .35em; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0;
  margin: 0 0 .55em;
}
h1 { font-size: clamp(3rem, 5vw, 4rem); }
h2 { font-size: clamp(2.5rem, 2rem + 1.4vw, 3rem); font-weight: 500; }
h3 { font-size: 1.75rem; font-weight: 600; letter-spacing: 0; }

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

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gut); }
.skip {
  position: absolute; left: -999px; top: 0; background: var(--larch); color: var(--ink);
  padding: .6rem 1rem; z-index: 100; font-family: var(--display); font-weight: 700;
}
.skip:focus { left: 0; }

/* ---------- Header ---------- */
.site-header { background: var(--spruce); color: var(--snow); position: sticky; top: 0; z-index: 50; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; font: 700 1.15rem/1.1 var(--display); letter-spacing: -.01em; }
.brand small { display: block; font: 400 .78rem var(--text); opacity: .75; letter-spacing: 0; }
.menu-btn {
  background: none; border: 2px solid currentColor; color: inherit; padding: .45rem .8rem;
  font: 700 .95rem var(--display); cursor: pointer;
}
.nav { display: none; width: 100%; padding: .5rem 0 1.2rem; }
.nav.open { display: block; }
.bar-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav li { margin: 0; }
.nav a { display: block; padding: .6rem 0; text-decoration: none; font: 500 1rem var(--display); white-space: nowrap; }
.nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--larch); }
.nav a:hover { color: var(--larch); }
.nav .btn { margin-top: .6rem; text-align: center; }

@media (min-width: 1366px) {
  .menu-btn { display: none; }
  .bar-wrap { flex-wrap: nowrap; }
  .nav { display: block; width: auto; padding: 0; }
  .nav ul { display: flex; align-items: center; gap: 1.35rem; }
  .nav a { padding: 1.35rem 0 1.2rem; font-size: .95rem; }
  .nav .btn { margin: 0; padding: .6rem 1.1rem; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: .85rem 1.5rem; background: var(--larch); color: var(--ink);
  border: 2px solid var(--larch); border-radius: 2px; text-decoration: none; cursor: pointer;
  font: 700 1rem/1.2 var(--display);
}
.btn:hover { background: #d8ab6c; border-color: #d8ab6c; }
.btn.ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn.ghost:hover { background: rgba(255,255,255,.12); }
.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative; display: flex; align-items: flex-end; overflow: hidden; color: #fff;
  min-height: min(88svh, 820px);
  background: url("../images/hero-poster.jpg") center / cover no-repeat, linear-gradient(160deg, var(--spruce-2), var(--slate));
}
.hero-video { position: absolute; inset: 0; overflow: hidden; }
.hero-video iframe {
  position: absolute; top: 50%; left: 50%; border: 0; pointer-events: none;
  width: max(100%, calc(min(88svh, 820px) * 1.7778)); aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(14,30,26,.9), rgba(14,30,26,.3) 55%, rgba(14,30,26,.4));
}
.hero-inner { position: relative; z-index: 2; width: 100%; max-width: var(--max); margin: 0 auto; padding: 6rem var(--gut) 2.4rem; }
.hero h1 { max-width: 12ch; margin-bottom: .35em; }
.hero .lede { font-size: clamp(1.1rem, 2vw, 1.35rem); max-width: 40ch; }

/* The one orchestrated moment: a court line drawing across, then the facts hang off it. */
.facts { position: relative; display: flex; flex-wrap: wrap; margin-top: 2.2rem; padding-top: 1.1rem; }
.facts::before {
  content: none;
  transform-origin: left; animation: draw 1.1s .3s cubic-bezier(.2,.7,.2,1) both;
}
.facts div { padding: .1rem 1.6rem; border-left: 1px solid rgba(255,255,255,.35); margin-bottom: .6rem; }
.facts div:first-child { padding-left: 0; border-left: 0; }
.facts b { display: block; font: 700 1.7rem/1.1 var(--display); }
.facts span { font-size: .95rem; opacity: .85; }
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Sections ---------- */
.sec { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.sec.dark { background: var(--spruce); color: var(--snow); }
.sec.mist { background: var(--mist); }
.sec.tight { padding: clamp(2rem, 5vw, 3.5rem) 0; }

.page-head { background: var(--spruce); color: var(--snow); padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2.4rem, 5vw, 3.6rem); position: relative; }
.page-head::after { content: none; }
.page-head h1 { margin: 0 0 .3em; font-size: clamp(2.4rem, 6vw, 4.4rem); }
.page-head p { margin: 0; font-size: 1.15rem; opacity: .9; }

.split { display: grid; gap: clamp(1.5rem, 5vw, 4rem); align-items: center; grid-template-columns: 1fr; }
@media (min-width: 880px) {
  .split { grid-template-columns: 1.05fr .95fr; }
  .split.rev > :first-child { order: 2; }
}

/* ---------- Photos (graceful when a photo file is missing) ---------- */
.ph {
  position: relative; margin: 0; overflow: hidden; aspect-ratio: 4 / 3;
  background: linear-gradient(150deg, #2b4a43, #5f7580);
}
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph.wide { aspect-ratio: 16 / 9; }
.ph.tall { aspect-ratio: 3 / 4; }
.ph.missing::after {
  content: attr(data-file); position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(255,255,255,.7); font: 500 .85rem var(--display); text-align: center; padding: 1rem;
}

.grid { columns: 3 260px; column-gap: 12px; }
.grid button { padding: 0; border: 0; background: none; cursor: zoom-in; display: block; width: 100%; margin: 0 0 12px; break-inside: avoid; }
.grid .ph { aspect-ratio: auto; }
.grid .ph img { height: auto; }
.grid .ph.missing { aspect-ratio: 3 / 2; }
.trio { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.trio .ph { aspect-ratio: 3 / 2; }

dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
dialog.lightbox::backdrop { background: rgba(10,20,18,.88); }
dialog.lightbox img { max-width: 96vw; max-height: 88vh; object-fit: contain; margin: 0 auto; }
dialog.lightbox button { display: block; margin: .8rem auto 0; }

/* ---------- Court diagram ---------- */
.court { background: var(--spruce-2); padding: clamp(1rem, 3vw, 2rem); display: grid; place-items: center; }
.court svg { width: min(100%, 300px); height: auto; }

/* ---------- Video ---------- */
.video { position: relative; aspect-ratio: 16 / 9; background: #0e1e1a; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Fernie stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.6rem 2rem; margin: 2rem 0 0; }
.stats div { border-top: 1px solid rgba(0,0,0,.25); padding-top: .8rem; }
.stats dt { font: 700 1.9rem/1.1 var(--display); letter-spacing: -.02em; }
.stats dd { margin: .3rem 0 0; }

/* ---------- Lists & cards ---------- */
.cols { columns: 2 220px; column-gap: 2.5rem; }
.cols li { break-inside: avoid; }
.cards { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: #fff; border: 1px solid var(--mist); }
.card-body { padding: 1.4rem 1.4rem 1.6rem; }

.info-grid { display: grid; gap: 2.5rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* ---------- To-do and widget slots (delete these once content is in) ---------- */
.todo { border: 2px dashed var(--line); background: #fff; padding: 1rem 1.2rem; margin: 1.5rem 0; font-size: .95rem; max-width: 62ch; }
.todo strong { color: var(--line); }
.widget-slot { border: 2px dashed var(--slate); background: #fff; padding: 1.5rem; min-height: 220px; }
.widget-slot .slot-note { color: var(--slate); font-size: .95rem; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1.1rem; max-width: 640px; }
.form .row { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .form .row { grid-template-columns: 1fr 1fr; } }
label { display: block; font: 600 .95rem var(--display); margin-bottom: .3rem; }
input, textarea, select {
  width: 100%; padding: .75rem .8rem; border: 1.5px solid var(--slate); border-radius: 2px;
  background: #fff; color: var(--ink); font: 400 1rem var(--text);
}
textarea { min-height: 150px; resize: vertical; }
.hp { position: absolute; left: -9999px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--spruce); color: var(--snow); padding: 3rem 0 2rem; }
.foot { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.foot h3 { font-size: 1.05rem; margin-bottom: .6rem; }
.foot ul { list-style: none; padding: 0; margin: 0; }
.foot a { text-decoration: none; opacity: .9; }
.foot a:hover { color: var(--larch); opacity: 1; }
.legal { margin-top: 2rem; font-size: .85rem; opacity: .7; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .facts::before { animation: none; }
}

/* ---------- Availability calendars (calendar.html in a frame) ---------- */
.ical-frame { display: block; width: 100%; min-height: 300px; border: 0; margin-top: 1rem; }
.cards.stack { grid-template-columns: 1fr; }

/* Hero video stays hidden until Vimeo reports it is playing, so the poster photo shows if it can't load. */
.hero-video iframe { opacity: 0; transition: opacity .9s ease; }
.hero-video iframe.on { opacity: 1; }

/* A photo that fails to load hides itself rather than showing a label. */
.ph.missing { display: none !important; }

/* Header spans the full window: logo on the far left, menu on the far right. */
.site-header .wrap { max-width: none; padding-left: clamp(1.25rem, 3vw, 3rem); padding-right: clamp(1.25rem, 3vw, 3rem); }
.brand { gap: 1rem; }
.brand small { white-space: nowrap; }
@media (max-width: 520px) { .brand small { white-space: normal; } }

/* ---------- Home: full-screen hero, slow push-in, staged entrance, video band ---------- */
.hero { min-height: calc(100svh - 68px); }
.hero-video iframe { width: max(100%, calc((100svh - 68px) * 1.7778)); }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: url("../images/hero-poster.jpg") center / cover no-repeat;
  animation: push 24s ease-out both;
}
@keyframes push { from { transform: scale(1); } to { transform: scale(1.1); } }
.hero-inner h1, .hero-inner .lede, .hero-inner .btn-row { animation: rise .9s cubic-bezier(.2,.7,.2,1) both; }
.hero-inner .lede { animation-delay: .15s; }
.hero-inner .btn-row { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.hero-inner h1 { max-width: 14ch; font-size: clamp(2.8rem, 7vw, 5.6rem); }
.tour h2 { margin-bottom: 1.4rem; }
.tour-video { aspect-ratio: 16 / 9; width: 100%; }
.tour-video iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (prefers-reduced-motion: reduce) {
  .hero::before, .hero-inner h1, .hero-inner .lede, .hero-inner .btn-row { animation: none; }
}

/* ---------- Link lists (Useful info) ---------- */
.links { list-style: none; margin: 1rem 0 0; padding: 0; }
.links li { padding: .8rem 0; border-top: 1px solid rgba(0,0,0,.15); }
.links li:first-child { border-top: 0; padding-top: 0; }
.links a { font: 600 1.05rem var(--display); }
.links span { display: block; margin-top: .15rem; font-size: .95rem; opacity: .8; }
.btn.ghost.dark-text { color: var(--spruce); border-color: var(--spruce); }
.tour + .sec.dark { padding-top: 0; }

/* ---------- Property pages ---------- */
.prop-hero { background: var(--spruce); }
.prop-hero img { display: block; width: 100%; max-height: 56vh; object-fit: cover; }
.prop-lede { font-size: 1.2rem; max-width: 60ch; }
.card .ph.wide { aspect-ratio: 16 / 9; }

/* ---------- Collages, floor plans, looping court video ---------- */
.collage { display: block; margin: 1.4rem 0 0; }
.collage img { display: block; width: 100%; height: auto; }
.plan-toggle { display: flex; gap: .6rem; margin: 1.2rem 0; flex-wrap: wrap; }
.plan-toggle .btn.on { background: var(--spruce); border-color: var(--spruce); color: #fff; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 2rem; }
.plans figure { margin: 0; }
.plans figcaption { font: 600 1.05rem var(--display); margin-bottom: .6rem; }
.plans a img { display: block; width: 100%; height: auto; background: #fff; border: 1px solid rgba(0,0,0,.15); }
.plans[data-mode="bw"] .colour, .plans[data-mode="colour"] .bw { display: none; }
.loop-video { position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden; background: url("../images/court.jpg") center / cover no-repeat; }
.loop-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; opacity: 0; transition: opacity .9s ease; }
.loop-video iframe.on { opacity: 1; }
.loopsec { padding-bottom: 0; }

.winter-video { aspect-ratio: 16 / 9; margin-top: 1.4rem; }
.winter-video .video, .winter-video iframe { width: 100%; height: 100%; }


/* ---------- Typography ----------
   Hero headline: Cormorant Garamond regular, 64-80px.
   Section headings: Cormorant Garamond, 40-48px.
   Body: Manrope 16-18px.  Navigation: Manrope 12-13px, uppercase, wide tracking.
   Booking widget: Manrope 14-16px (calendar.html). */
.hero-inner h1 { font-weight: 400; font-size: clamp(4rem, 3rem + 3.2vw, 5rem); line-height: 1.02; max-width: 16ch; }
.page-head h1 { font-weight: 400; font-size: clamp(3rem, 5vw, 4rem); }
.hero .lede { font-size: 1.125rem; }
.brand { font: 600 1.6rem/1 var(--display); letter-spacing: .01em; }
.brand small { font: 500 .75rem var(--text); letter-spacing: .04em; opacity: .75; }
.nav a, .menu-btn { font: 600 .8125rem/1 var(--text); text-transform: uppercase; letter-spacing: .14em; }
.nav a { font-size: .8125rem; }
.btn { font: 700 .9375rem/1.2 var(--text); letter-spacing: .04em; }
.facts b { font: 500 2.4rem/1.1 var(--display); }
.stats dt { font: 600 2.4rem/1.1 var(--display); letter-spacing: 0; }
.links a, .plans figcaption { font: 600 1.4rem/1.2 var(--display); }
.skip, label, .ph.missing::after { font-family: var(--text); }

/* ---------- Photo-first layout: menu over the picture, white sections ---------- */
html { scroll-padding-top: 84px; }
body { background: #fff; }
.sec.mist, .sec.dark { background: #fff; color: var(--ink); }
.sec.dark .btn.ghost { color: var(--ink); }
.sec.dark .btn.ghost:hover { background: rgba(0,0,0,.06); }

/* Header: no bar. White text over the photo; a white bar only once you scroll. */
.site-header { position: fixed; left: 0; right: 0; top: 0; background: transparent; color: #fff;
  transition: background .3s ease, color .3s ease, box-shadow .3s ease; }
.site-header.solid, .site-header.open { background: #fff; color: var(--ink); box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.nav a { padding: .55rem .8rem; border-radius: 2px; transition: background .2s ease, color .2s ease; }
.nav a:hover { background: rgba(255,255,255,.92); color: var(--ink); }
.site-header.solid .nav a:hover, .site-header.open .nav a:hover { background: var(--ink); color: #fff; }
.nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--larch); }
.nav { background: transparent; }
@media (min-width: 1366px) {
  .nav ul { gap: .15rem; }
  .nav a { padding: .55rem .8rem; }
}
@media (max-width: 1279px) {
  .nav { padding: .5rem 0 1.2rem; }
  .nav a { padding: .8rem .6rem; }
}

/* Hero fills the whole window */
.hero { min-height: 100svh; }
.hero-video iframe { width: max(100%, calc(100svh * 1.7778)); }
.hero::after {
  background: linear-gradient(to bottom, rgba(14,30,26,.6), rgba(14,30,26,0) 24%),
              linear-gradient(to top, rgba(14,30,26,.88), rgba(14,30,26,.2) 55%, rgba(14,30,26,.15));
}

/* Every other page opens on a photo too */
.page-head { min-height: min(64svh, 600px); display: flex; align-items: flex-end; color: #fff;
  background-color: var(--spruce); background-image: var(--bg); background-size: cover; background-position: center;
  padding: 7rem 0 3rem; }
.page-head::before { content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(14,30,26,.6), rgba(14,30,26,.1) 38%, rgba(14,30,26,.72)); }
.page-head .wrap { position: relative; z-index: 1; width: 100%; }

/* ---------- Floor plans page and a menu that fits eight items ---------- */
.plan-list { display: grid; gap: 3rem; margin-top: 1.6rem; max-width: 1000px; }
.plan-list figure { margin: 0; }
.plan-list figcaption { margin-bottom: .8rem; color: var(--slate); font-size: .95rem; }
.plan-list figcaption span { display: block; font: 600 1.7rem/1.2 var(--display); color: var(--ink); }
.plan-list img { display: block; width: 100%; height: auto; border: 1px solid rgba(0,0,0,.15); background: #fff; }
.nav a, .menu-btn { letter-spacing: .1em; }
.nav a { font-size: .75rem; }
@media (min-width: 1366px) {
  .nav ul { gap: .1rem; }
  .nav a { padding: .5rem .7rem; }
}
@media (min-width: 1280px) and (max-width: 1365px) {
  .menu-btn { display: inline-block; }
  .bar-wrap { flex-wrap: wrap; }
  .nav { display: none; width: 100%; padding: .5rem 0 1.2rem; }
  .nav.open { display: block; }
  .nav ul { display: block; gap: 0; }
  .nav a { padding: .8rem .6rem; }
}
