/* =========================================================
   Billion Euro House — styles
   Plain CSS, no dependencies. Edit the tokens below to retheme.
   ========================================================= */

:root {
  --paper: #f5f3ee;
  --paper-2: #ebe8e0;
  --ink: #1d1c1a;
  --ink-soft: #57534c;
  --line: #d9d5cb;
  --accent: #4f5d48;          /* muted banknote green */
  --focus: #2f5d8a;
  --error: #9b2c1f;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --max: 76rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  --space: clamp(4rem, 10vw, 8.5rem);
  --nav-h: 3.5rem;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.7 var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.12; margin: 0; letter-spacing: -.01em; }
p { margin: 0 0 1.1em; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: .6rem 1rem; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---------- Navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header { background: rgba(245, 243, 238, .92); }
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.nav {
  max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto;
  height: var(--nav-h);
  padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.nav__brand {
  font-family: var(--serif); font-size: 1.05rem; text-decoration: none; white-space: nowrap;
}
.nav__links { display: flex; gap: clamp(1rem, 3vw, 2.25rem); list-style: none; margin: 0; padding: 0; }
.nav__links a {
  font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; color: var(--ink-soft);
  padding: .5rem 0; position: relative;
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .25rem;
  height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform .35s var(--ease);
}
.nav__links a:hover, .nav__links a[aria-current="true"] { color: var(--ink); }
.nav__links a:hover::after, .nav__links a[aria-current="true"]::after { transform: scaleX(1); }

@media (max-width: 30rem) {
  .nav__brand { font-size: .95rem; }
  .nav__links { gap: .9rem; }
  .nav__links a { font-size: .7rem; letter-spacing: .1em; }
}

/* ---------- Sections ---------- */
section { padding: var(--space) var(--gutter); }
section > * { max-width: var(--max); margin-left: auto; margin-right: auto; }

.section-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 2rem;
  border-top: 1px solid var(--ink);
  padding-top: 1.25rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.section-head h2 { font-size: clamp(2rem, 4.5vw, 3rem); }
.section-head__note { margin: 0; color: var(--ink-soft); font-size: .9rem; }

.eyebrow {
  font-size: .75rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

/* ---------- Home ---------- */
.home { padding-top: clamp(3rem, 8vw, 6rem); }
.home__grid {
  display: grid; gap: clamp(2rem, 5vw, 4.5rem);
  grid-template-columns: 1fr;
  grid-template-areas: "text" "figure" "body";
}
.home__text { grid-area: text; }
.home__figure { grid-area: figure; margin: 0; }
.home__body { grid-area: body; max-width: 36rem; }

.home h1 { font-size: clamp(2.8rem, 8vw, 5.75rem); margin-bottom: 1.5rem; }
.lede {
  font-family: var(--serif); font-size: clamp(1.2rem, 2.2vw, 1.55rem); line-height: 1.45;
  max-width: 32rem; color: var(--ink);
}
.home__body h2 { font-size: 1.5rem; margin: 2.5rem 0 .9rem; }
.home__figure img { width: 100%; background: var(--paper-2); }
.home__figure figcaption { margin-top: .75rem; font-size: .82rem; color: var(--ink-soft); }
.text-link {
  display: inline-block; margin-top: 1rem;
  font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; text-decoration: none;
  border-bottom: 1px solid currentColor; padding-bottom: .2rem;
}

@media (min-width: 52rem) {
  .home__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "text   figure"
      "body   figure";
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: clamp(3rem, 7vw, 7rem);
    row-gap: 1.5rem;
  }
  .home__figure { position: sticky; top: calc(var(--nav-h) + 2rem); }
  .home__figure img { max-height: calc(100vh - var(--nav-h) - 6rem); width: auto; margin-left: auto; }
  .home__figure figcaption { text-align: right; }
}

/* ---------- Gallery ----------
   Justified rows: each item grows in proportion to its aspect ratio,
   so artwork keeps its shape and is never cropped. */
.gallery { background: var(--paper); }
.gallery__grid {
  list-style: none; margin: 0 auto; padding: 0;
  display: flex; flex-wrap: wrap; gap: clamp(.75rem, 1.6vw, 1.25rem);
  --row: 16rem;
}
.gallery__grid::after { content: ""; flex-grow: 999; } /* keeps the last row from over-stretching */

.gallery__item {
  flex-grow: var(--ar);
  flex-basis: calc(var(--row) * var(--ar));
  min-width: 0;
}
.work {
  display: block; width: 100%;
  padding: 0; margin: 0; border: 0; background: none; cursor: zoom-in;
  text-align: left; color: inherit; font: inherit;
}
.work__frame {
  display: block;
  aspect-ratio: var(--ar);
  background: var(--paper-2);
  overflow: hidden;
}
.work__frame img {
  width: 100%; height: 100%; object-fit: contain;
  opacity: 0; transition: opacity .6s var(--ease), transform .8s var(--ease);
}
.work__frame img.is-loaded { opacity: 1; }
.work:hover .work__frame img.is-loaded { transform: scale(1.015); }
.work__label {
  display: flex; gap: .6rem; margin-top: .55rem;
  font-size: .8rem; color: var(--ink-soft); line-height: 1.4;
}
.work__num { font-variant-numeric: tabular-nums; color: var(--ink); }
.work:focus-visible { outline-offset: 4px; }

@media (min-width: 64rem) { .gallery__grid { --row: 19rem; } }
@media (max-width: 36rem) {
  .gallery__grid { --row: 9rem; }
}
@media (max-width: 26rem) {
  /* single column on small phones */
  .gallery__item { flex: 1 1 100%; }
}

/* ---------- Contact ---------- */
.contact { background: var(--paper-2); }
.form {
  display: grid; gap: 1.5rem 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 40rem) {
  .form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field--full, .form__actions { grid-column: 1 / -1; }
}

.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.optional { text-transform: none; letter-spacing: 0; }
.field input, .field textarea {
  font: inherit; color: var(--ink);
  background: transparent;
  border: 0; border-bottom: 1px solid var(--ink-soft);
  border-radius: 0;
  padding: .55rem 0;
  transition: border-color .2s var(--ease);
}
.field textarea { resize: vertical; min-height: 9rem; line-height: 1.6; }
.field input:focus, .field textarea:focus { outline: none; border-bottom: 2px solid var(--focus); padding-bottom: calc(.55rem - 1px); }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid transparent; }
.field [aria-invalid="true"] { border-bottom-color: var(--error); }
.field__error { margin: 0; min-height: 1.2em; font-size: .82rem; color: var(--error); }

.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.button {
  font: inherit; font-size: .8rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--paper); background: var(--ink);
  border: 1px solid var(--ink); border-radius: 0;
  padding: .95rem 1.8rem; cursor: pointer;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.button:hover { background: transparent; color: var(--ink); }
.button[disabled] { opacity: .55; cursor: progress; }
.form__status { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.form__status.is-error { color: var(--error); }

.thanks { padding: 2rem 0; }
.thanks h3 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: .75rem; }
.thanks p { color: var(--ink-soft); font-size: 1.1rem; }
.thanks:focus { outline: none; }

/* ---------- Footer ---------- */
.site-footer {
  max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto;
  padding: 2rem var(--gutter) 3rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
  font-size: .82rem; color: var(--ink-soft);
}
.site-footer p { margin: 0; }
.site-footer a { text-decoration: none; }

/* ---------- Lightbox ---------- */
.lightbox {
  width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: #121211; color: #eeebe4;
  overflow: hidden;
}
.lightbox::backdrop { background: #121211; }
.lightbox[open] { display: grid; grid-template-rows: 1fr auto; }

.lightbox__stage {
  position: relative; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(3.5rem, 6vw, 4.5rem) clamp(.5rem, 8vw, 6rem) 1rem;
  touch-action: pan-y pinch-zoom;
}
.lightbox__img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto; object-fit: contain;
  user-select: none; -webkit-user-drag: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.lightbox__img.is-changing { opacity: 0; }

.lightbox__bar {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem;
  padding: 0 clamp(1rem, 8vw, 6rem) clamp(1rem, 3vw, 2rem);
}
.lightbox__meta { max-width: 44rem; }
.lightbox__title { font-family: var(--serif); font-size: 1.15rem; margin: 0 0 .2rem; }
.lightbox__caption { margin: 0; font-size: .85rem; color: #a9a59c; }
.lightbox__caption:empty { display: none; }
.lightbox__count { margin: 0; font-size: .8rem; color: #a9a59c; font-variant-numeric: tabular-nums; white-space: nowrap; }

.lb-btn {
  position: absolute; z-index: 2;
  width: 3rem; height: 3rem;
  display: grid; place-items: center;
  background: transparent; color: #eeebe4;
  border: 1px solid transparent; border-radius: 50%;
  cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.lb-btn svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.lb-btn:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); }
.lb-btn:focus-visible { outline: 2px solid #eeebe4; outline-offset: 2px; }
.lb-btn--close { top: .75rem; right: .75rem; }
.lb-btn--prev, .lb-btn--next { top: 50%; transform: translateY(-50%); }
.lb-btn--prev { left: clamp(.25rem, 2vw, 1.5rem); }
.lb-btn--next { right: clamp(.25rem, 2vw, 1.5rem); }

@media (max-width: 40rem) {
  /* on phones, controls sit at the bottom where thumbs can reach them */
  .lightbox__stage { padding: 3.5rem .5rem .5rem; }
  .lightbox__bar { padding: .5rem 1rem 5rem; }
  .lb-btn--prev, .lb-btn--next { top: auto; bottom: 1rem; transform: none; background: rgba(255,255,255,.06); }
  .lb-btn--prev { left: 1rem; }
  .lb-btn--next { right: 1rem; }
}

body.lb-open { overflow: hidden; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .work:hover .work__frame img.is-loaded { transform: none; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .lightbox, .form, .skip-link { display: none !important; }
  body { background: #fff; }
}
