/* ============================================================
   The Granary, Chidham
   Palette taken from the building's own materials: limewash,
   flint, weathered timber, saltmarsh.
   ============================================================ */

:root {
  --chalk:      #f5f5f1;
  --chalk-deep: #eceae3;
  --flint:      #1a2a2e;
  --timber:     #5d6b6b;
  --saltmarsh:  #3f6b63;
  --oak:        #cfc4b0;

  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --body: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --gutter: clamp(1.25rem, 5vw, 5.5rem);
  --measure: 34rem;
  --shell: 78rem;

  --step: clamp(4.5rem, 9vw, 8.5rem);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--chalk);
  color: var(--flint);
  font-family: var(--body);
  font-size: clamp(1rem, .96rem + .18vw, 1.075rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 300;
  letter-spacing: -.02em;
  line-height: 1.06;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(2.5rem, 1.2rem + 3.6vw, 4.4rem); }
h2 { font-size: clamp(2rem, 1.3rem + 2.9vw, 3.5rem); }
h3 { font-size: 1.28rem; letter-spacing: -.01em; line-height: 1.25; }

p { margin: 0 0 1.15em; }
a { color: inherit; }

.eyebrow {
  font-family: var(--body);
  font-size: .69rem;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--saltmarsh);
  margin: 0 0 1.15rem;
}

.wordmark {
  font-family: var(--display);
  font-size: 1.16rem;
  font-weight: 400;
  letter-spacing: .01em;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--flint); color: var(--chalk);
  padding: .8rem 1.2rem; text-decoration: none;
}
.skip:focus { left: 0; }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--saltmarsh);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ── Buttons ────────────────────────────────────────────── */

.btn {
  display: inline-block;
  font-size: .85rem;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 1.05rem 1.9rem;
  background: var(--flint);
  color: var(--chalk);
  border: 1px solid var(--flint);
  transition: background .35s var(--ease), color .35s var(--ease);
}
.btn:hover { background: transparent; color: var(--flint); }

.btn--quiet {
  background: transparent;
  color: var(--flint);
  border-color: color-mix(in srgb, var(--flint) 22%, transparent);
}
.btn--quiet:hover { background: var(--flint); color: var(--chalk); border-color: var(--flint); }

.btn--light { background: var(--chalk); color: var(--flint); border-color: var(--chalk); }
.btn--light:hover { background: transparent; color: var(--chalk); }

/* ── Top bar ────────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 1.1rem var(--gutter);
  background: color-mix(in srgb, var(--chalk) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--oak) 55%, transparent);
}
.topbar__place {
  font-size: .69rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--timber); margin-right: auto;
}
.topbar__cta {
  font-size: .72rem; letter-spacing: .13em; text-transform: uppercase;
  text-decoration: none; color: var(--flint);
  border-bottom: 1px solid var(--oak); padding-bottom: 3px;
  transition: border-color .3s var(--ease);
}
.topbar__cta:hover { border-color: var(--flint); }

@media (max-width: 620px) { .topbar__place { display: none; } .wordmark { margin-right: auto; } }

/* ── Hero ───────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) 48%;
  align-items: center;
  gap: 0 clamp(2rem, 4vw, 4.5rem);
  min-height: min(84vh, 46rem);
  padding: clamp(3rem, 7vw, 6rem) 0 clamp(3rem, 7vw, 6rem) var(--gutter);
}

.hero__rail {
  align-self: stretch;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1.6rem;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: .64rem; letter-spacing: .24em; text-transform: uppercase;
  color: var(--timber);
  white-space: nowrap;
}
.hero__rail-line { width: 1px; height: clamp(3rem, 9vh, 7rem); background: var(--oak); }

.hero__text { max-width: 32rem; padding-block: 1rem; }
.hero__text .lede {
  font-size: 1.12rem;
  color: var(--timber);
  max-width: 26rem;
  margin-top: 1.9rem;
}
.hero h1 { margin-top: .1rem; }

.hero__actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2.4rem; }
@media (max-width: 560px) {
  .hero__actions { display: grid; }
  .hero__actions .btn { text-align: center; }
}

.hero__image { position: relative; }
.hero__image img {
  width: 100%;
  aspect-ratio: 4 / 3.35;
  object-fit: cover;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding: clamp(2rem, 6vw, 3rem) var(--gutter) 0;
    min-height: 0;
    gap: 2.75rem;
  }
  .hero__rail { display: none; }
  .hero__text { max-width: none; }
  .hero__image { margin-inline: calc(var(--gutter) * -1); }
  .hero__image img { aspect-ratio: 4 / 3; }
}

/* ── Facts strip ────────────────────────────────────────── */

.facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-block: 1px solid color-mix(in srgb, var(--oak) 65%, transparent);
  margin-top: clamp(3rem, 6vw, 5rem);
}
.facts__item {
  padding: 1.9rem clamp(.75rem, 2vw, 1.5rem);
  text-align: center;
}
.facts__item + .facts__item { border-left: 1px solid color-mix(in srgb, var(--oak) 65%, transparent); }
.facts__item b {
  display: block;
  font-family: var(--display); font-weight: 300;
  font-size: clamp(1.5rem, 1rem + 1.6vw, 2.2rem);
  line-height: 1.1;
}
.facts__item span {
  display: block; margin-top: .45rem;
  font-size: .66rem; letter-spacing: .17em; text-transform: uppercase;
  color: var(--timber);
}
@media (max-width: 640px) {
  .facts { grid-template-columns: 1fr 1fr; }
  .facts__item:nth-child(odd) { border-left: 0; }
  .facts__item:nth-child(n+3) { border-top: 1px solid color-mix(in srgb, var(--oak) 65%, transparent); }
}

/* ── Sections ───────────────────────────────────────────── */

.section {
  max-width: var(--shell);
  margin-inline: auto;
  padding: var(--step) var(--gutter) 0;
}

.section__head { margin-bottom: 2.6rem; }
.prose { max-width: var(--measure); color: var(--timber); }
.prose p:last-child { margin-bottom: 0; }

/* staddle-stone divider — the signature mark */
.rule {
  display: flex; align-items: center; gap: 1.5rem;
  max-width: var(--shell);
  margin: var(--step) auto 0;
  padding-inline: var(--gutter);
}
.rule::before, .rule::after {
  content: ""; flex: 1; height: 1px;
  background: color-mix(in srgb, var(--oak) 75%, transparent);
}
.rule svg {
  width: 20px; height: 17px; flex: none;
  fill: none; stroke: var(--oak); stroke-width: 1.3;
  stroke-linecap: round; stroke-linejoin: round;
}

.figure { margin: 3.5rem 0 0; }
.figure img { width: 100%; }
.figure--wide { max-width: none; }
.figure--wide img { aspect-ratio: 16 / 8; object-fit: cover; }
figcaption {
  margin-top: .95rem;
  font-size: .78rem; letter-spacing: .02em;
  color: var(--timber);
}

/* ── Gallery ────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(.5rem, 1.1vw, .9rem);
}
.grid button {
  display: block; padding: 0; margin: 0;
  border: 0; background: var(--chalk-deep);
  cursor: pointer; overflow: hidden;
}
.grid button img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.1s var(--ease);
}
.grid button picture { display: block; height: 100%; }
.grid button:hover img { transform: scale(1.035); }

/* Spans tile to exactly six columns per row, so no row is ever left ragged.
   Within a row the aspect ratios agree, which keeps every row a clean band:
   rows read 2u, 2.5u, 2u tall against a column unit u. */
.grid button:nth-child(6n+1) { grid-column: span 4; aspect-ratio: 2 / 1; }
.grid button:nth-child(6n+2) { grid-column: span 2; aspect-ratio: 1 / 1; }
.grid button:nth-child(6n+3) { grid-column: span 2; aspect-ratio: 4 / 5; }
.grid button:nth-child(6n+4) { grid-column: span 4; aspect-ratio: 8 / 5; }
.grid button:nth-child(6n+5) { grid-column: span 3; aspect-ratio: 3 / 2; }
.grid button:nth-child(6n+6) { grid-column: span 3; aspect-ratio: 3 / 2; }

@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .grid button,
  .grid button:nth-child(6n+1),
  .grid button:nth-child(6n+2),
  .grid button:nth-child(6n+3),
  .grid button:nth-child(6n+4),
  .grid button:nth-child(6n+5),
  .grid button:nth-child(6n+6) { grid-column: span 1; aspect-ratio: 1 / 1; }
}

/* ── Split section ──────────────────────────────────────── */

.section--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(2.5rem, 6vw, 5.5rem);
  align-items: center;
}
.split__image { margin: 0; }
.split__image img { width: 100%; aspect-ratio: 4 / 4.4; object-fit: cover; }

.spec { list-style: none; margin: 0; padding: 0; }
.spec li {
  padding: 1.05rem 0;
  border-top: 1px solid color-mix(in srgb, var(--oak) 60%, transparent);
  color: var(--timber);
  font-size: .97rem;
}
.spec li:last-child { border-bottom: 1px solid color-mix(in srgb, var(--oak) 60%, transparent); }
.spec b { color: var(--flint); font-weight: 500; }

@media (max-width: 900px) {
  .section--split { grid-template-columns: 1fr; }
  .split__image { order: -1; }
  .split__image img { aspect-ratio: 4 / 3; }
}

/* ── Good to know ───────────────────────────────────────── */

.note {
  background: var(--chalk-deep);
  padding: clamp(2rem, 5vw, 4rem);
}
.note__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: clamp(1.75rem, 3.5vw, 3rem);
}
.note__grid h3 { margin-bottom: .7rem; }
.note__grid p { color: var(--timber); font-size: .95rem; margin: 0; }

/* ── The area ───────────────────────────────────────────── */

.places {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: clamp(1.5rem, 3.5vw, 3rem);
  margin: 3.5rem 0 0;
  padding: 0;
}
.place { border-top: 1px solid color-mix(in srgb, var(--oak) 70%, transparent); padding-top: 1.15rem; }
.place h3 {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin: 0 0 .6rem;
}
.place h3 span {
  font-family: var(--body); font-size: .64rem; font-weight: 500;
  letter-spacing: .17em; text-transform: uppercase; color: var(--saltmarsh);
  flex: none;
}
.place p { color: var(--timber); font-size: .93rem; margin: 0; }

/* ── FAQ ────────────────────────────────────────────────── */

.faq { margin: 0; max-width: 48rem; }
.faq > div {
  padding: 1.5rem 0;
  border-top: 1px solid color-mix(in srgb, var(--oak) 60%, transparent);
}
.faq > div:last-child { border-bottom: 1px solid color-mix(in srgb, var(--oak) 60%, transparent); }
.faq dt { font-family: var(--display); font-size: 1.28rem; font-weight: 400; margin-bottom: .45rem; }
.faq dd { margin: 0; color: var(--timber); font-size: .97rem; max-width: var(--measure); }

/* ── Closing ────────────────────────────────────────────── */

.closing {
  position: relative;
  margin-top: var(--step);
  padding: clamp(5rem, 12vw, 9rem) var(--gutter);
  text-align: center;
  color: var(--chalk);
  isolation: isolate;
}
.closing__bg { position: absolute; inset: 0; z-index: -2; }
.closing__bg img { width: 100%; height: 100%; object-fit: cover; }
.closing::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--flint) 68%, transparent);
}
.closing__inner { max-width: 34rem; margin-inline: auto; }
.closing h2 { margin-bottom: 1.2rem; }
.closing p { color: color-mix(in srgb, var(--chalk) 82%, transparent); margin-bottom: 2.3rem; }

/* ── Footer ─────────────────────────────────────────────── */

.footer {
  display: flex; flex-wrap: wrap; gap: 1.5rem 3rem;
  justify-content: space-between; align-items: flex-end;
  max-width: var(--shell); margin-inline: auto;
  padding: 3.5rem var(--gutter) 4.5rem;
  font-size: .82rem; color: var(--timber);
}
.footer p { margin: .75rem 0 0; line-height: 1.6; }
.footer__meta { max-width: 24rem; }
.footer a { color: var(--flint); text-decoration-color: var(--oak); text-underline-offset: 3px; }

/* ── Sticky mobile CTA ──────────────────────────────────── */

.sticky { display: none; }
@media (max-width: 760px) {
  .sticky {
    display: block; position: fixed; z-index: 45;
    left: 1rem; right: 1rem; bottom: 1rem;
    padding: 1rem; text-align: center;
    background: var(--flint); color: var(--chalk);
    font-size: .78rem; font-weight: 500;
    letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
    transform: translateY(140%);
    transition: transform .45s var(--ease);
  }
  .sticky.is-shown { transform: translateY(0); }
  .footer { padding-bottom: 6rem; }
}

/* ── Lightbox ───────────────────────────────────────────── */

.lb {
  width: 100%; max-width: 100%; height: 100%; max-height: 100%;
  padding: 0; border: 0; background: transparent; color: var(--chalk);
  overflow: hidden;
}
.lb::backdrop { background: color-mix(in srgb, #0d1518 94%, transparent); }
.lb__figure {
  margin: 0; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1.1rem; padding: clamp(2.5rem, 7vw, 4rem);
}
.lb__figure img {
  max-width: 100%; max-height: calc(100% - 3rem);
  width: auto; object-fit: contain;
}
.lb__figure figcaption {
  color: color-mix(in srgb, var(--chalk) 72%, transparent);
  font-size: .8rem; text-align: center; max-width: 36rem; margin: 0;
}
.lb__close, .lb__nav {
  position: absolute; z-index: 2;
  background: transparent; border: 0; color: var(--chalk);
  cursor: pointer; line-height: 1;
  opacity: .65; transition: opacity .25s var(--ease);
}
.lb__close:hover, .lb__nav:hover { opacity: 1; }
.lb__close { top: 1rem; right: 1.35rem; font-size: 2.4rem; padding: .3rem .6rem; }
.lb__nav { top: 50%; transform: translateY(-50%); font-size: 3rem; padding: .5rem 1rem; }
.lb__nav--prev { left: .25rem; }
.lb__nav--next { right: .25rem; }

/* ── Reveal on scroll ───────────────────────────────────── */

/* Hidden only when JS is running, so the page is never blank without it. */
.js .reveal { opacity: 0; transform: translateY(18px); }
.js .reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .reveal.is-in { opacity: 1; transform: none; transition: none; }
  .grid button:hover img { transform: none; }
  .sticky { transition: none; }
}
