/* Le Verger: a record of the house. Plain CSS, no build step. */

/* Fonts: Cormorant Garamond and Source Serif 4 (SIL Open Font Licence), latin subset, served from this site. */
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500 600; font-display: swap; src: url("../fonts/cormorant-garamond.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 500; font-display: swap; src: url("../fonts/cormorant-garamond-italic.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("../fonts/source-serif-4.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/source-serif-4-italic.woff2") format("woff2"); }

:root {
  --paper: #f5f0e6;
  --paper-2: #ece4d4;
  --ink: #2b2723;
  --ink-soft: #5c544b;
  --green: #34503a;
  --green-deep: #24382a;
  --roof: #9e4a28;
  --rule: #d8cdb8;
  --white: #fffdf8;
  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --text: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --measure: 36rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--roof); }
:focus-visible { outline: 2px solid var(--roof); outline-offset: 3px; }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--white); padding: 0.5rem 1rem; z-index: 20;
}
.skip:focus { left: 1rem; top: 1rem; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0; text-wrap: balance; }
p { margin: 0 0 1.1em; text-wrap: pretty; }

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Top bar ---------- */
/* Fixed throughout. Transparent over the hero; a solid green bar once the hero has scrolled away (class set by js/site.js). */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  height: 4.25rem; padding: 0 var(--gutter);
  color: var(--white);
  text-shadow: 0 1px 8px rgba(0,0,0,0.35);
  transition: background-color 0.25s ease, box-shadow 0.25s ease, height 0.25s ease;
}
.top.solid, .top.open { height: 56px; background: var(--green-deep); text-shadow: none; box-shadow: 0 1px 0 rgba(0,0,0,0.12), 0 6px 18px rgba(20,24,18,0.18); }
.top .mark { font-family: var(--display); font-size: 1.5rem; font-weight: 600; color: inherit; text-decoration: none; letter-spacing: 0.01em; }
.top nav ul { list-style: none; display: flex; gap: 1.6rem; margin: 0; padding: 0; }
.top nav a { color: inherit; text-decoration: none; font-size: 0.95rem; letter-spacing: 0.02em; padding: 0.35rem 0; border-bottom: 1px solid transparent; }
.top nav a:hover { color: inherit; border-bottom-color: rgba(255,255,255,0.6); }
.top nav a[aria-current="true"] { color: #f0c9a6; border-bottom-color: #e2b48f; }
.menu-btn { display: none; }
[id] { scroll-margin-top: 64px; }
@media (prefers-reduced-motion: reduce) { .top { transition: none; } }

@media (max-width: 720px) {
  .top { height: 3.75rem; }
  .top.solid, .top.open { height: 52px; }
  [id] { scroll-margin-top: 60px; }
  .top nav { display: none; }
  .js .menu-btn {
    display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0 0.25rem 0 0.75rem;
    background: none; border: 0; color: inherit; font: inherit; font-size: 0.95rem; letter-spacing: 0.02em; cursor: pointer; text-shadow: inherit;
  }
  .menu-btn .bars, .menu-btn .bars::before, .menu-btn .bars::after { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 1px; position: relative; }
  .menu-btn .bars::before, .menu-btn .bars::after { content: ""; position: absolute; left: 0; }
  .menu-btn .bars::before { top: -6px; }
  .menu-btn .bars::after { top: 6px; }
  .top.open .menu-btn .bars { background: transparent; }
  .top.open .menu-btn .bars::before { top: 0; transform: rotate(45deg); }
  .top.open .menu-btn .bars::after { top: 0; transform: rotate(-45deg); }
  .js .top.open nav {
    display: block; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--green-deep); border-top: 1px solid rgba(255,255,255,0.12); box-shadow: 0 10px 20px rgba(20,24,18,0.25);
  }
  .top.open nav ul { flex-direction: column; gap: 0; padding: 0.25rem 0 0.75rem; }
  .top.open nav a { display: block; padding: 0.8rem var(--gutter); font-size: 1.05rem; border-bottom: 0; }
  .top.open nav a[aria-current="true"] { box-shadow: inset 3px 0 0 #e2b48f; }
}

/* ---------- Hero ---------- */
/* Photograph and words side by side on wide screens, stacked on phones, so the words never sit on the house. */
.hero {
  display: grid;
  grid-template-columns: minmax(24rem, 36%) 1fr;
  min-height: min(100svh, 60rem);
  background: var(--green-deep);
  color: var(--white);
}
.hero-img { position: relative; order: 2; min-height: 0; }
.hero-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 55% 60%; }
.hero-img::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 7rem; background: linear-gradient(rgba(20,24,18,0.5), rgba(20,24,18,0)); z-index: 1; }
.hero-text { order: 1; display: flex; flex-direction: column; justify-content: flex-end; padding: 6rem clamp(1.5rem, 3.5vw, 3.5rem) clamp(2.5rem, 7vh, 4.5rem); }
.hero .place { font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase; margin: 0 0 0.8rem; color: #e2b48f; font-weight: 600; }
.hero h1 { font-size: clamp(3.6rem, 7vw, 6.5rem); font-weight: 500; letter-spacing: -0.01em; }
.hero .line { font-family: var(--display); font-size: clamp(1.35rem, 2.1vw, 1.8rem); line-height: 1.3; max-width: 26rem; margin: 1rem 0 0; font-style: italic; color: #f1ece1; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; grid-template-rows: min(58vh, 34rem) auto; grid-template-rows: min(58svh, 34rem) auto; min-height: 0; }
  .hero-img { order: 1; }
  .hero-text { order: 2; padding: 2rem var(--gutter) 2.5rem; }
}

/* ---------- Opening ---------- */
.opening { padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(2rem, 5vw, 3rem); }
.opening p { max-width: var(--measure); }
@media (min-width: 960px) { .opening .wrap { padding-left: calc(var(--gutter) + 14rem + 3.5rem); } }
.opening .lede { font-family: var(--display); font-size: clamp(1.45rem, 2.6vw, 1.85rem); line-height: 1.4; }

/* ---------- Chapters ---------- */
.chapter { padding: clamp(3rem, 7vw, 5.5rem) 0; border-top: 1px solid var(--rule); }
.chapter-head { display: grid; gap: 0.6rem; margin-bottom: 2rem; }
.when {
  font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--roof); margin: 0; font-weight: 600;
}
.chapter h2 { font-size: clamp(2.3rem, 5vw, 3.6rem); font-weight: 500; }
.prose { max-width: var(--measure); }
.prose p:last-child { margin-bottom: 0; }

@media (min-width: 960px) {
  .chapter .wrap { display: grid; grid-template-columns: 14rem 1fr; column-gap: 3.5rem; }
  .chapter-head { grid-column: 1 / -1; grid-template-columns: 14rem 1fr; column-gap: 3.5rem; align-items: baseline; }
  .chapter-head .when { padding-top: 0.2rem; }
  .chapter .body { grid-column: 2; }
}

/* ---------- Figures ---------- */
figure { margin: 0; }
figcaption { font-size: 0.88rem; line-height: 1.5; color: var(--ink-soft); margin-top: 0.6rem; }
.figs { display: grid; gap: 1rem; margin: 2.5rem 0 0; }
@media (min-width: 640px) {
  .figs.two { grid-template-columns: 1fr 1fr; }
  .figs.three { grid-template-columns: repeat(3, 1fr); }
  .figs.wide-narrow { grid-template-columns: 1.6fr 1fr; }
}
.figs img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--paper-2); }
.figs .tall img { aspect-ratio: 2 / 3; }
.figs.wide-narrow img { height: 100%; }
.figs.wide-narrow figure { display: flex; flex-direction: column; }
.figs.wide-narrow figure img { flex: 1; min-height: 0; aspect-ratio: auto; }
@media (max-width: 639px) { .figs.wide-narrow figure img { aspect-ratio: 4 / 3; } }

/* Full-width photograph between chapters */
.band { margin: 0 auto; padding: 0 var(--gutter) clamp(1rem, 3vw, 2rem); max-width: calc(1272px + 2 * var(--gutter)); }
.band img { width: 100%; }

/* ---------- Quotes ---------- */
.pull {
  margin: 2.5rem 0 0; padding: 0;
  font-family: var(--display); font-size: clamp(1.7rem, 3.4vw, 2.4rem); line-height: 1.25; font-style: italic; color: var(--green);
  max-width: 32rem;
}
.pull p { margin: 0; }
.pull footer { font-family: var(--text); font-style: normal; font-size: 0.92rem; color: var(--ink-soft); margin-top: 0.8rem; }

/* ---------- Events list ---------- */
.events { list-style: none; margin: 1.8rem 0 0; padding: 0; max-width: var(--measure); border-top: 1px solid var(--rule); }
.events li { padding: 1rem 0; border-bottom: 1px solid var(--rule); display: grid; gap: 0.2rem; }
.events .date { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--roof); font-weight: 600; }
@media (min-width: 640px) { .events li { grid-template-columns: 11rem 1fr; gap: 1.2rem; } .events .date { padding-top: 0.25rem; } }

/* ---------- Guest book ---------- */
.guestbook { background: var(--green-deep); color: #f1ece1; border-top: 0; }
.guestbook .when { color: #e2b48f; }
.guestbook h2 { color: var(--white); }
.guestbook .intro { color: #ddd5c6; }
.letters { columns: 1; column-gap: 1.25rem; margin-top: 2.5rem; }
@media (min-width: 700px) { .letters { columns: 2; } }
@media (min-width: 1100px) { .letters { columns: 3; } }
.letter {
  break-inside: avoid; margin: 0 0 1.25rem; padding: 1.5rem 1.5rem 1.25rem;
  background: #2d4433; border: 1px solid #3c5643; border-radius: 3px;
}
.letter p { font-family: var(--display); font-size: 1.32rem; line-height: 1.42; margin: 0 0 0.7em; color: #f6f2e9; }
.letter footer { font-size: 0.9rem; color: #cfc6b5; letter-spacing: 0.02em; }
.letter footer::before { content: ""; display: inline-block; width: 1.4rem; height: 1px; background: #e2b48f; vertical-align: middle; margin-right: 0.6rem; }
.guestbook .wrap { display: block; }
.guestbook .chapter-head, .guestbook .intro { max-width: 46rem; }
@media (min-width: 960px) { .guestbook .chapter-head { grid-template-columns: 1fr; } }

/* ---------- Gallery ---------- */
.gallery { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; margin-top: 2.5rem; }
@media (min-width: 700px) { .gallery { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; } }
@media (min-width: 1100px) { .gallery { grid-template-columns: repeat(4, 1fr); } }
.gallery button {
  all: unset; cursor: zoom-in; display: block; position: relative; overflow: hidden; background: var(--paper-2);
}
.gallery button:focus-visible { outline: 2px solid var(--roof); outline-offset: 3px; }
.gallery img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; transition: transform 0.4s ease; }
.gallery button:hover img { transform: scale(1.03); }
@media (prefers-reduced-motion: reduce) { .gallery img { transition: none; } }
.photos .wrap { display: block; }
@media (min-width: 960px) { .photos .chapter-head { grid-template-columns: 14rem 1fr; } }

/* Lightbox */
.lightbox {
  border: 0; padding: 0; margin: auto; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh;
  background: #121410; color: #eee8dc;
}
.lightbox::backdrop { background: rgba(18, 20, 16, 0.9); }
.lightbox[open] { display: grid; grid-template-rows: 1fr auto; }
.lightbox .stage { display: flex; align-items: center; justify-content: center; padding: 3.5rem 1rem 0.5rem; min-height: 0; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .cap { text-align: center; padding: 0.5rem 4rem 1.4rem; font-size: 0.95rem; color: #d8d0c1; min-height: 3rem; }
.lightbox button {
  position: absolute; background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.25); color: #fff;
  width: 2.75rem; height: 2.75rem; border-radius: 50%; font-size: 1.3rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center; font-family: var(--text);
}
.lightbox button:hover { background: rgba(0,0,0,0.6); }
.lightbox .close { top: 0.75rem; right: 0.75rem; }
.lightbox .prev { left: 0.75rem; top: 50%; transform: translateY(-50%); }
.lightbox .next { right: 0.75rem; top: 50%; transform: translateY(-50%); }

/* ---------- Place ---------- */
.map { margin: 0 0 2rem; }
.map img { width: 100%; border: 1px solid var(--rule); background: #efe8d9; }

/* ---------- Ending ---------- */
.ending { background: var(--paper-2); }
.thanks { font-family: var(--display); font-size: clamp(1.45rem, 2.6vw, 1.85rem); line-height: 1.4; }

.foot { padding: 2.5rem 0 3rem; text-align: center; font-size: 0.92rem; color: var(--ink-soft); background: var(--paper-2); border-top: 1px solid var(--rule); }
.foot p { margin: 0; }

/* Full-width photograph between chapters */
.band.wide { max-width: none; padding: 0; }
.band.wide img { width: 100%; height: clamp(15rem, 46vw, 42rem); object-fit: cover; }
.band.wide figcaption { max-width: 72rem; margin: 0 auto; padding: 0.6rem var(--gutter) 0; }
.band.wide + .chapter, .band + .chapter { border-top: 0; }

/* Gallery themes */
.gallery-title { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 500; margin: 3rem 0 0; }
.gallery-title:first-of-type { margin-top: 2rem; }
.gallery-title + .gallery { margin-top: 1rem; }
@media (min-width: 1100px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 699px) {
  .gallery li:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .gallery li:last-child:nth-child(odd) img { aspect-ratio: 2 / 1; }
}
[tabindex="-1"]:focus { outline: none; }
