/* The Bareford Wedding: design direction B, "Film first". Mobile first. */

:root {
  --bg: #15171B;
  --text: #E9E3D7;
  --muted: #A8A397;
  --faint: #8E897E;
  --line: #34373E;
  --line-strong: #3A4152;
  --panel: #1D2026;
  --white: #FFFFFF;
  --serif: "Bodoni Moda", "Bodoni 72", Didot, Georgia, serif;
  --sans: "Manrope", "Avenir Next", "Helvetica Neue", sans-serif;
  --gutter: 16px;
  --max: 1320px;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--text); }
a:hover { color: var(--white); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 10;
  padding: 10px 16px; background: var(--text); color: var(--bg); text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap { max-width: var(--max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

.caps { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; }
.muted { color: var(--muted); }
.serif { font-family: var(--serif); font-weight: 400; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 0;
  font-family: var(--sans); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn svg { flex: 0 0 auto; }
.btn-light { background: var(--text); color: var(--bg); }
.btn-light:hover { background: var(--white); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--muted); color: var(--white); }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; background: transparent;
  border: 1px solid var(--line-strong); color: var(--text); cursor: pointer;
}
.btn-icon:hover { border-color: var(--muted); }

.caps-link {
  font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase;
  text-underline-offset: 5px; text-decoration-thickness: 1px;
}

/* ---------------------------------------------------------------- top nav */

.topnav {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 24px;
  padding-top: 18px; padding-bottom: 18px;
}
.topnav a { text-decoration: none; }
.topnav .links { display: flex; gap: 20px; }

/* ---------------------------------------------------------------- home: hero */

.hero-img {
  width: 100%; height: 200px; object-fit: cover; object-position: 30% 50%;
  background: var(--panel);
}
.hero { max-width: var(--max); margin: 0 auto; }
.hero-text { padding: 28px var(--gutter) 0; }
.hero-text h1 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: 56px; line-height: 0.95; letter-spacing: -0.01em;
}
.hero-text h1 i { font-style: italic; }
.hero-meta { margin: 14px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }

/* ---------------------------------------------------------------- home: film */

.film { padding-top: 40px; padding-bottom: 48px; scroll-margin-top: 16px; }
.film-frame {
  position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden;
}
.film-cover {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.45;
}
.film-caption {
  position: absolute; left: 14px; right: 14px; bottom: 14px;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
}
.film-caption .eyebrow { margin: 0; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; }
.film-title { display: none; margin: 0; font-family: var(--serif); font-size: 40px; line-height: 1.1; color: var(--white); }
.film-frame video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.film-meta {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px;
  margin-top: 14px; font-size: 14px; color: var(--muted);
}
.film-meta a { color: var(--text); text-underline-offset: 4px; }

/* ---------------------------------------------------------------- home: gallery rows */

.galleries { display: flex; flex-direction: column; gap: 40px; padding-bottom: 40px; scroll-margin-top: 16px; }
.row { display: flex; flex-direction: column; }
.row-media { display: block; overflow: hidden; background: var(--panel); }
.row-media img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 0.6s ease;
}
.row.tall .row-media img { object-position: 50% 30%; }
.row-media:hover img { transform: scale(1.02); }
.row-text {
  display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; column-gap: 10px;
  padding-top: 12px;
}
.numeral { margin: 0; font-family: var(--serif); font-size: 16px; color: var(--muted); }
.row-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.1; }
.row-count { margin: 0; font-size: 13px; color: var(--muted); }
.row-count .word { display: none; }
.row .caps-link { grid-column: 1 / -1; margin-top: 6px; justify-self: start; }

/* ---------------------------------------------------------------- footer */

.footer { padding-top: 24px; padding-bottom: 48px; }
.footer-inner {
  border-top: 1px solid var(--line); padding-top: 24px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px;
  font-size: 13px; color: var(--faint);
}

/* ---------------------------------------------------------------- gallery page */

.gallery-head {
  display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 20px;
  padding-top: 16px; padding-bottom: 28px;
}
.gallery-head h1 { margin: 4px 0 0; font-family: var(--serif); font-weight: 400; font-size: 56px; line-height: 1; }
.gallery-head .numeral { font-size: 18px; }
.gallery-head .sub { margin: 10px 0 0; color: var(--muted); font-size: 15px; }

/* Justified grid in plain CSS: every tile grows in proportion to its aspect ratio,
   so all tiles on a line scale by the same factor and keep one height. */
.grid {
  --row: 108px;   /* two landscape photos side by side on a phone */
  display: flex; flex-wrap: wrap; gap: 4px;
}
.grid::after { content: ""; flex-grow: 1000000; }
.tile {
  display: block; position: relative; overflow: hidden; background: var(--panel);
  flex-grow: calc(var(--a) * 100);
  flex-basis: calc(var(--a) * var(--row));
  aspect-ratio: var(--a);
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.4s ease; }
.tile:hover img { opacity: 0.88; }

.section-nav { padding-top: 56px; padding-bottom: 56px; }
.section-nav-inner {
  border-top: 1px solid var(--line); padding-top: 32px;
  display: flex; justify-content: space-between; gap: 24px;
}
.section-nav a { text-decoration: none; }
.section-nav .dir { display: block; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.section-nav .name { font-family: var(--serif); font-size: 28px; line-height: 1.2; }
.section-nav .next { text-align: right; margin-left: auto; }

/* ---------------------------------------------------------------- viewer */

.viewer {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans);
}
.viewer[open] { display: flex; flex-direction: column; height: 100dvh; }
.viewer::backdrop { background: #000; }

.v-top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px;
}
.v-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.v-name { font-family: var(--serif); font-size: 22px; white-space: nowrap; }
.v-count { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.v-actions { display: flex; gap: 8px; }
.v-actions .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.v-actions .btn { padding: 0 13px; }
[data-v-play] .i-pause { display: none; }
[data-v-play].is-playing .i-pause { display: block; }
[data-v-play].is-playing .i-play { display: none; }

.v-stage {
  position: relative; flex: 1 1 0; min-height: 0;
  display: flex; align-items: center; gap: 16px; padding: 0 8px;
  touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none;
}
.v-frame { flex: 1 1 0; height: 100%; min-width: 0; display: flex; align-items: center; justify-content: center; }
.v-img { max-width: 100%; max-height: 100%; object-fit: contain; -webkit-user-drag: none; }
.v-img.fade-in { animation: v-fade 0.35s ease both; }
@keyframes v-fade { from { opacity: 0; } to { opacity: 1; } }
.v-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(21, 23, 27, 0.55); border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text);
}
.v-nav:hover { border-color: var(--muted); }
.v-nav.prev { left: 8px; }
.v-nav.next { right: 8px; }

.v-strip {
  display: flex; gap: 6px; overflow-x: auto; padding: 12px 12px 14px;
  scrollbar-width: none; overscroll-behavior-x: contain;
}
.v-strip::-webkit-scrollbar { display: none; }
.v-thumb {
  flex: 0 0 auto; width: 62px; height: 44px; padding: 0; overflow: hidden; cursor: pointer;
  background: var(--panel); border: 2px solid transparent; opacity: 0.5;
}
.v-thumb img { width: 100%; height: 100%; object-fit: cover; }
.v-thumb:hover { opacity: 0.8; }
.v-thumb[aria-current="true"] { border-color: var(--text); opacity: 1; }

/* ---------------------------------------------------------------- larger screens */

@media (min-width: 480px) {
  .grid { --row: 150px; }
}

@media (min-width: 600px) {
  .v-actions .lbl { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .v-actions .btn { padding: 0 16px; }
}

@media (min-width: 761px) {
  :root { --gutter: 32px; }
  .caps { font-size: 13px; }
  .topnav { padding-top: 24px; padding-bottom: 24px; }
  .topnav .links { gap: 28px; }

  .hero { padding: 8px var(--gutter) 0; }
  .hero-img { height: auto; aspect-ratio: 3.6 / 1; object-position: 50% 50%; }
  .hero-text {
    display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 24px;
    padding: 40px 0 0;
  }
  .hero-text h1 { font-size: clamp(52px, 7vw, 104px); }
  .hero-meta { margin: 0; text-align: right; font-size: 15px; }

  .film { padding-top: 96px; padding-bottom: 96px; }
  .film-caption { left: 48px; right: 48px; bottom: 44px; gap: 24px; }
  .film-caption .eyebrow { margin-bottom: 6px; font-size: 13px; letter-spacing: 0.24em; }
  .film-title { display: block; }
  .film-caption .btn { min-height: 52px; padding: 0 26px; font-size: 14px; }

  .galleries { gap: 88px; padding-bottom: 64px; }
  .row { flex-direction: row; align-items: center; gap: 48px; }
  .row.flip { flex-direction: row-reverse; }
  .row .row-media { flex: 0 0 56%; }
  .row.tall .row-media { flex-basis: 38%; }
  .row-media img { aspect-ratio: 3 / 2; }
  .row.tall .row-media img { aspect-ratio: 4 / 5; object-position: 50% 50%; }
  .row-text { display: block; flex: 1 1 0; padding-top: 0; }
  .numeral { font-size: 22px; }
  .row-title { margin: 4px 0 12px; font-size: 64px; line-height: 1; }
  .row-count { margin: 0 0 28px; font-size: 16px; }
  .row-count .word { display: inline; }
  .row .caps-link { margin-top: 0; font-size: 14px; }

  .footer { padding-top: 48px; padding-bottom: 72px; }
  .footer-inner { padding-top: 32px; }

  .gallery-head { padding-top: 32px; padding-bottom: 40px; }
  .gallery-head h1 { font-size: 88px; }
  .gallery-head .numeral { font-size: 22px; }
  .gallery-head .btn { min-height: 52px; padding: 0 26px; font-size: 14px; }
  .grid { --row: 260px; gap: 8px; }
  .section-nav { padding-top: 80px; padding-bottom: 72px; }
  .section-nav-inner { padding-top: 40px; }
  .section-nav .dir { font-size: 13px; }
  .section-nav .name { font-size: 40px; }

  .v-top { padding: 18px 28px; }
  .v-name { font-size: 26px; }
  .v-count { font-size: 14px; }
  .v-stage { padding: 0 20px; }
  .v-nav { position: static; transform: none; flex: 0 0 56px; width: 56px; height: 56px; background: rgba(255, 255, 255, 0.06); }
  .v-strip { justify-content: safe center; gap: 8px; padding: 18px 28px 22px; }
  .v-thumb { width: 72px; height: 48px; }
}

@media (min-width: 1600px) {
  .grid { --row: 300px; }
}

@media (max-height: 520px) {
  .v-strip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
