/* ==========================================================================
   Veranda — global base
   ========================================================================== */

html {
  scroll-behavior: smooth;
  background-color: var(--c-ink);
  color-scheme: dark;
}

/* Lenis drives scrolling when it loads; it needs native smooth scroll off. */
html.lenis,
html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-stopped {
  overflow: hidden;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--ff-body);
  font-size: var(--fs-300);
  line-height: var(--lh-body);
  font-weight: 400;
  overflow-x: hidden;
}

::selection {
  background-color: var(--c-rust);
  color: var(--c-cream);
}

/* --------------------------------------------------------------- focus --- */

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

/* Never remove focus rings — only reshape them. */
.u-focus-inset:focus-visible {
  outline-offset: -3px;
}

/* ----------------------------------------------------------- skip link --- */

.skip-link {
  position: fixed;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: var(--z-skip);
  padding: 0.75rem 1.1rem;
  background-color: var(--c-cream);
  color: var(--c-ink);
  font-size: var(--fs-200);
  font-weight: 600;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  transform: translateY(calc(-100% - var(--sp-5)));
  transition: transform var(--dur) var(--ease-out);
}
.skip-link:focus-visible {
  transform: translateY(0);
}

/* ------------------------------------------------------------ utility --- */

.u-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.u-no-scroll {
  overflow: hidden;
  touch-action: none;
}

/* ------------------------------------------------------------ layout ---- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: var(--container-wide); }
.container--narrow { max-width: var(--container-narrow); }

.section {
  position: relative;
  padding-block: var(--section-y);
}
.section--tight { padding-block: var(--section-y-tight); }

/* Alternating surfaces give the page its cinematic light changes. */
.section--paper {
  --fg: var(--paper-fg);
  --fg-muted: var(--paper-fg-muted);
  --fg-faint: #8b7f63;
  --rule: var(--paper-rule);
  background-color: var(--c-paper);
  color: var(--paper-fg);
}
.section--mint {
  --fg: #1d2116;
  --fg-muted: #3f4a32;
  --fg-faint: #566043;
  --rule: #7f9367;
  background-color: var(--c-mint);
  color: #1d2116;
}
.section--night {
  background-color: #0f0e0a;
}

/* A hairline that reads as a hand-inked rule rather than a browser border. */
.rule {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--rule) 12%, var(--rule) 88%, transparent);
  opacity: 0.9;
}

.stack > * + * { margin-block-start: var(--flow, 1.1em); }

/* ------------------------------------------------------------- grain ---- */
/* One shared overlay element per section rather than a body-wide layer, so
   the paper sections can carry a different grain weight to the ink ones.    */

.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--grain);
  opacity: 0.06;
  mix-blend-mode: overlay;
  z-index: 1;
}
.section--paper .grain { opacity: 0.14; mix-blend-mode: multiply; }
.section--mint .grain { opacity: 0.12; mix-blend-mode: multiply; }

.section > .container { position: relative; z-index: 2; }

/* -------------------------------------------------------- typography ---- */

.display {
  font-family: var(--ff-display);
  font-weight: 800;
  line-height: var(--lh-tight);
  letter-spacing: -0.014em;
  color: var(--fg);
}
.display--xl { font-size: var(--fs-800); }
.display--lg { font-size: var(--fs-700); }
.display--md { font-size: var(--fs-600); }
.display--sm { font-size: var(--fs-500); font-weight: 700; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--ff-body);
  font-size: var(--fs-100);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--c-mint);
}
.section--paper .eyebrow,
.section--mint .eyebrow { color: var(--c-rust-deep); }

.eyebrow::before {
  content: '';
  width: 2rem;
  height: 1px;
  background-color: currentColor;
  opacity: 0.65;
}

.lede {
  font-size: var(--fs-400);
  color: var(--fg-muted);
  max-width: 46ch;
}

.prose {
  max-width: 62ch;
  color: var(--fg-muted);
}
.prose p + p { margin-block-start: 1.1em; }

/* A hand-drawn italic aside, used sparingly. */
.script {
  font-family: var(--ff-display);
  font-style: italic;
  font-weight: 500;
  color: var(--c-gold);
}

/* --------------------------------------------------------------- links -- */

.link {
  color: var(--fg);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size var(--dur) var(--ease);
  padding-block-end: 0.12em;
}
.link:hover { background-size: 0 1px; background-position: 100% 100%; }

/* ---------------------------------------------------------------- media -- */
/*
   Every photograph on the site sits inside a `.media` wrapper carrying an
   explicit aspect ratio, so nothing shifts while images decode. If a file is
   missing the wrapper turns into a labelled, deliberately designed slot —
   which is what keeps the site coherent before the real photography lands.
*/

.media {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: var(--ar, 3 / 2);
  background-color: var(--c-ink-2);
  background-image:
    linear-gradient(140deg, rgb(157 177 133 / 0.14), rgb(126 52 39 / 0.12));
}
.media > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos, 50% 50%);
}
.media--contain > img {
  object-fit: contain;
}

/* Fade the photo in once it has actually decoded. */
.media > img {
  opacity: 0;
  transition: opacity 520ms var(--ease-out);
}
.media > img.is-loaded,
html:not(.has-js) .media > img { opacity: 1; }

/* Missing-file state — an intentional slot, not a broken image. */
.media[data-missing] > img { display: none; }
.media[data-missing] {
  background-color: var(--c-ink-2);
  background-image:
    repeating-linear-gradient(
      -45deg,
      rgb(243 235 218 / 0.035) 0 10px,
      transparent 10px 20px
    );
  border: 1px dashed rgb(243 235 218 / 0.28);
}
.media[data-missing]::after {
  content: attr(data-label);
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.55rem 0.7rem;
  font-family: var(--ff-body);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-align: center;
  color: rgb(243 235 218 / 0.72);
  background-color: rgb(22 21 15 / 0.62);
}
.media[data-missing]::before {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  width: clamp(1.5rem, 12%, 2.75rem);
  aspect-ratio: 1;
  background-color: rgb(243 235 218 / 0.3);
  /* A small aperture glyph, drawn with a mask so it inherits the colour. */
  -webkit-mask: var(--icon-photo) center / contain no-repeat;
  mask: var(--icon-photo) center / contain no-repeat;
}
.section--paper .media[data-missing],
.section--mint .media[data-missing] {
  border-color: rgb(42 37 25 / 0.3);
  background-color: rgb(42 37 25 / 0.05);
  background-image:
    repeating-linear-gradient(-45deg, rgb(42 37 25 / 0.055) 0 10px, transparent 10px 20px);
}
.section--paper .media[data-missing]::after,
.section--mint .media[data-missing]::after {
  color: rgb(42 37 25 / 0.82);
  background-color: rgb(228 215 187 / 0.72);
}
.section--paper .media[data-missing]::before,
.section--mint .media[data-missing]::before { background-color: rgb(42 37 25 / 0.32); }

:root {
  --icon-photo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Crect x='2.5' y='4.5' width='19' height='15' rx='2'/%3E%3Ccircle cx='12' cy='12' r='3.6'/%3E%3Cpath d='M6 8h.01'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------- reveals -- */
/*
   Reveal styling is applied only when JavaScript is present, so a failed
   script can never leave the page blank.
*/

html.has-js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition:
    opacity 760ms var(--ease-out),
    transform 760ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
html.has-js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  html.has-js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------------------------------------------------------- selection ---- */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
