/* ==========================================================================
   TALVA — minimal photography portfolio
   Plain CSS, no build step. Mobile breakpoint: 767px;
   burger header up to 799px (1024px on touch screens).
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --font: "Inter", "Helvetica Neue", Arial, sans-serif;

  --black: #000;
  --white: #fff;
  --light: hsl(210 3.2% 87.8%);   /* about card */
  --muted: hsl(43 3.9% 64.5%);    /* read more, outlined button */
  --placeholder: #f2f2f2;          /* image background while loading */

  --gutter: 4vw;
  --max-width: 1800px;

  /* fluid type scale: 1rem + k·vw, growing until the 1800px max width */
  --fs-logo: clamp(1.5rem, 1rem + 1.2vw, 2.35rem);
  --fs-h1: clamp(2.6rem, 1rem + 3.6vw, 5.05rem);
  --fs-h2: clamp(2rem, 1rem + 2.16vw, 3.43rem);
  --fs-h3: clamp(1.6rem, 1.5rem + 0.8vw, 2.25rem);
  --fs-h4: 1.2rem;
  --fs-large: 1.5rem;
  --fs-normal: 1rem;
  --fs-small: 0.9rem;
  --fs-meta: 1rem;

  --lh-body: 1.8;
  --lh-heading: 1.2;

  --header-pad: 2.7vw;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* phones use a fixed, slightly larger type scale (like the reference) */
@media (max-width: 767px) {
  :root {
    --gutter: 6vw;
    --fs-logo: 1.633rem;
    --fs-h1: 2.9rem;
    --fs-h2: 2.14rem;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--white);
  scrollbar-gutter: stable; /* no width jump when the menu / lightbox locks scrolling */
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-normal);
  font-weight: 400;
  line-height: var(--lh-body);
  color: var(--black);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 700;
  line-height: var(--lh-heading);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-h1); line-height: 1.15; letter-spacing: -0.015em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); line-height: 1.4; letter-spacing: 0; }

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

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

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.5rem 1rem;
  background: var(--black);
  color: var(--white);
  font-size: var(--fs-small);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Page container: gutter on both sides, max content width 1800px */
.container {
  width: 100%;
  max-width: calc(var(--max-width) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Social icons ---------- */
.social {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social a {
  display: block;
  line-height: 0;
  transition: opacity 0.2s var(--ease);
}

.social a:hover {
  opacity: 0.6;
}

.social svg {
  width: 20px;
  height: 20px;
}

/* ---------- Header ---------- */
.site-header {
  position: relative;
  z-index: 100;
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  max-width: calc(var(--max-width) + 2 * var(--gutter));
  margin-inline: auto;
  padding: var(--header-pad) var(--gutter);
}

.header__left {
  display: flex;
  align-items: center;
  gap: 2.5vw;
}

.logo {
  font-size: var(--fs-logo);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5vw;
}

.nav a {
  font-size: var(--fs-normal);
  line-height: 1.4;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
  transition: text-decoration-color 0.2s var(--ease);
}

.nav a:hover,
.nav a[aria-current] {
  text-decoration-color: currentColor;
}

.header__social .social {
  gap: 1.5vw;
}

/* Burger (phones and touch tablets) */
.burger {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  margin-block: -3.5px; /* 44px tap target that takes 37px of header height */
}

.burger__line {
  position: absolute;
  left: 4px;
  right: 5px;
  top: 50%;
  height: 1px;
  background: currentColor;
  transition: transform 0.3s var(--ease);
}

.burger__line:first-child { transform: translateY(-6px); }
.burger__line:last-child  { transform: translateY(5px); }

.menu-open .burger__line:first-child { transform: translateY(0) rotate(45deg); }
.menu-open .burger__line:last-child  { transform: translateY(0) rotate(-45deg); }

/* Full-screen mobile menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  /* top padding clears the pinned header bar (2 × padding + 37px burger) */
  padding: calc(2 * var(--header-pad) + 37px) var(--gutter) 2.5rem;
  overflow-y: auto;
  background: var(--white);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0s linear 0.3s;
}

/* links centered in the free space, social icons pinned to the bottom */
.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin-block: auto;
}

.mobile-menu__nav a {
  font-size: clamp(2rem, 9vw, 2.8rem);
  font-weight: 400;
  line-height: 1.5;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 8px;
}

.mobile-menu__nav a[aria-current] {
  text-decoration-color: currentColor;
}

.mobile-menu .social {
  gap: 1.5rem;
}

.mobile-menu .social svg {
  width: 26px;
  height: 26px;
}

.menu-open {
  overflow: hidden;
}

.menu-open .mobile-menu {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s var(--ease), visibility 0s;
}

/* While the menu is open the header bar is pinned on top of the overlay
   so the burger (now an X) stays reachable wherever the page was scrolled. */
.menu-open .header__inner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--white);
}

/* Burger header: phones, small windows and touch tablets up to 1024px
   (keep in sync with MENU_QUERY in js/main.js) */
@media (max-width: 799px), (pointer: coarse) and (max-width: 1024px) {
  :root {
    --header-pad: 6vw;
  }

  .header__inner {
    padding: var(--header-pad);
  }

  .nav,
  .header__social {
    display: none;
  }

  .burger {
    display: block;
  }

  /* Without JavaScript, show the plain nav instead of the burger */
  .no-js .burger {
    display: none;
  }

  .no-js .header__left {
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
  }

  .no-js .nav {
    display: flex;
    gap: 1.25rem;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: calc(var(--max-width) + 2 * var(--gutter));
  margin-inline: auto;
  padding: max(2vw, 1.8rem) var(--gutter) 4vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer__name {
  font-size: var(--fs-h4);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: uppercase;
}

.site-footer .social {
  gap: 0.5rem;
}

.site-footer .social svg {
  width: 23px;
  height: 23px;
}

@media (max-width: 767px) {
  .site-footer {
    flex-wrap: wrap;
    row-gap: 0.6rem;
    padding-top: 8vw;
    padding-bottom: 12vw;
  }

  /* icons drop to their own line, aligned right */
  .site-footer .social {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ---------- Home: justified ("strips") gallery ---------- */
.gallery-section {
  padding-top: 4vw;
  padding-bottom: 4vw;
}

.gallery {
  --gallery-gap: 10px;  /* any CSS length */
  --row-height: 360px;  /* target row height; on phones every row ends up with one photo */
  position: relative;
  /* No-JS / pre-layout fallback: flexbox wraps rows at the same points as
     the JS layout (0.93 = MIN_ROW in js/main.js), so nothing jumps when it runs */
  display: flex;
  flex-wrap: wrap;
  gap: var(--gallery-gap);
}

.gallery__item {
  position: relative;
  flex: var(--ratio, 1.5) 1 calc(var(--ratio, 1.5) * var(--row-height) * 0.93);
  aspect-ratio: var(--ratio, 1.5);
  margin: 0;
  overflow: hidden;
  background: var(--placeholder);
}

/* keeps the last fallback row from stretching to full width */
.gallery::after {
  content: "";
  flex: 999 1 0;
}

.gallery.is-justified {
  display: block;
  overflow: hidden; /* no sideways scroll while a resize is being debounced */
}

.gallery.is-justified::after {
  content: none;
}

.gallery.is-justified .gallery__item {
  position: absolute;
  aspect-ratio: auto;
}

.gallery__link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
}

/* two-tone ring on top of the photo, visible on light and dark images */
.gallery__link:focus-visible {
  outline: none;
}

.gallery__link:focus-visible::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 2px var(--black), inset 0 0 0 4px var(--white);
  pointer-events: none;
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Scroll-in animation (only once JS has taken over) */
.gallery.reveal-ready .gallery__item {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.gallery.reveal-ready .gallery__item.is-visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 767px) {
  .gallery-section {
    padding-top: 2vw;
    padding-bottom: 6vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery.reveal-ready .gallery__item {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--white);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0s linear 0.35s;
  touch-action: pan-y pinch-zoom;
}

.lightbox:focus {
  outline: none;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s var(--ease), visibility 0s;
}

.lightbox__stage {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  grid-template-rows: minmax(0, max-content) auto; /* the photo, then its caption (if any), centred together */
  align-content: center;
  place-items: center;
  padding: 5vw 8vw;
}

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.25s var(--ease);
}

.lightbox__img.is-loading {
  opacity: 0.4;
}

.lightbox__img.is-empty {
  opacity: 0;
}

.lightbox__caption {
  max-width: 60ch;
  margin-top: 14px;
  font-size: var(--fs-small);
  line-height: 1.5;
  text-align: center;
}

.lightbox__btn {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  color: var(--black);
  transition: opacity 0.2s var(--ease);
}

.lightbox__btn:hover {
  opacity: 0.55;
}

.lightbox__close {
  top: 1.5vw;
  right: 1.5vw;
}

.lightbox__close svg {
  width: 26px;
  height: 26px;
}

.lightbox__prev,
.lightbox__next {
  top: 50%;
  margin-top: -32px;
}

.lightbox__prev { left: 1.5vw; }
.lightbox__next { right: 1.5vw; }

.lightbox__prev svg,
.lightbox__next svg {
  width: 18px;
  height: 36px;
}

.lightbox__count {
  position: absolute;
  left: 50%;
  bottom: 1.5vw;
  transform: translateX(-50%);
  font-size: var(--fs-small);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lightbox-open {
  overflow: hidden;
}

@media (max-width: 767px) {
  .lightbox__stage {
    padding: 64px 0;
  }

  .lightbox__caption {
    padding: 0 16px;
  }

  .lightbox__prev,
  .lightbox__next {
    top: auto;
    bottom: 4px;
    margin-top: 0;
  }

  .lightbox__prev { left: 4px; }
  .lightbox__next { right: 4px; }

  .lightbox__close {
    top: 4px;
    right: 4px;
  }

  .lightbox__count {
    bottom: 22px;
  }
}

/* ---------- Blog list ---------- */
.blog-list {
  padding-top: 3.5vw;
  padding-bottom: calc(8rem + 3.5vw);
}

.page-title {
  font-size: var(--fs-h2);
  line-height: 1.2;
  text-align: center;
  margin-bottom: max(6.25rem, 8vw);
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 7.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-card {
  text-align: center;
}

.post-card__media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--placeholder);
}

.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s var(--ease);
}

.post-card__media:hover img {
  opacity: 0.9;
}

.post-card__date {
  display: block;
  margin-top: 2.3rem;
  font-size: var(--fs-meta);
  line-height: var(--lh-body);
}

.post-card__title {
  margin-top: 1.9rem;
  font-size: var(--fs-h1);
  line-height: 1.2;
}

.post-card__excerpt {
  margin-top: 2.4rem;
  font-size: var(--fs-normal);
}

.read-more {
  display: inline-block;
  margin-top: 2rem;
  font-size: var(--fs-normal);
  line-height: 1.6;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
  transition: color 0.2s var(--ease);
}

.read-more:hover {
  color: var(--black);
}

@media (min-width: 768px) and (max-width: 1024px) {
  .blog-list {
    padding-top: 10vw;
  }
}

@media (max-width: 767px) {
  .blog-list {
    padding-top: 4rem;
    padding-bottom: 20vw;
  }

  .post-list {
    gap: 22vw;
  }

  .post-card__date { margin-top: 1.6rem; }
  .post-card__title { margin-top: 1rem; }
  .post-card__excerpt { margin-top: 1.5rem; }
  .read-more { margin-top: 0.75rem; }
}

/* ---------- Blog post ---------- */
.post {
  padding-top: 3.7vw;
  padding-bottom: 14vw;
}

.post__article {
  max-width: 46vw;
  margin-inline: auto;
}

.post__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.75rem;
  font-size: var(--fs-meta);
}

.post__title {
  margin-top: 2.2rem;
  font-size: var(--fs-h1);
}

.post__body {
  margin-top: 3.6rem;
}

.post__body p + p {
  margin-top: 1rem;
}

.post__figure {
  margin: 2.25rem 0 0;
  aspect-ratio: 3 / 2;
  background: var(--placeholder);
}

.post__figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post__author {
  margin-top: 4.8rem;
  font-size: var(--fs-small);
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  margin-top: min(10vw, 11.25rem);
}

.pager a {
  display: inline-flex;
  align-items: center;
  gap: 1.5rem;
  font-size: clamp(1.7rem, 1rem + 1.44vw, 2.62rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  transition: opacity 0.2s var(--ease);
}

.pager a:hover {
  opacity: 0.6;
}

.pager svg {
  flex: none;
  width: 14px;
  height: 30px;
}

.pager__next {
  margin-left: auto;
  text-align: right;
}

@media (max-width: 767px) {
  .post {
    padding-top: 4vw;
    padding-bottom: 30vw;
  }

  .post__article {
    max-width: none;
  }

  .post__title {
    margin-top: 1.5rem;
  }

  .post__body {
    margin-top: 4.5rem;
  }

  .post__author {
    margin-top: 3rem;
  }

  .pager {
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 3rem;
  }

  .pager a {
    gap: 0.75rem;
  }

  .pager svg {
    width: 10px;
    height: 22px;
  }
}

/* ---------- About ---------- */
.about {
  padding-top: 6.6vw;
  padding-bottom: 6.6vw;
}

.about__grid {
  --about-w: min(92vw, var(--max-width)); /* content width inside the 4vw gutters */
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  /* row 1: offset before the card · row 2: card · row 3: photo below the card.
     The photo spans all three rows: 3:2 at least, taller when the card needs room. */
  grid-template-rows: calc(var(--about-w) * 0.06) auto minmax(calc(var(--about-w) * 0.15), 1fr);
}

.about__media {
  grid-column: 1 / 18;
  grid-row: 1 / 4;
  margin: 0;
  min-height: calc(var(--about-w) * 17 / 36); /* 3:2 at 17 of 24 columns */
  background: var(--placeholder);
}

.about__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about__card {
  position: relative;
  z-index: 1;
  grid-column: 14 / 25;
  grid-row: 2;
  min-height: calc(var(--about-w) * 0.26); /* about 55% of the photo's height */
  padding: calc(var(--about-w) * 0.041);
  background: var(--light);
}

.about__name {
  font-size: var(--fs-h2);
  text-transform: uppercase;
  letter-spacing: -0.005em;
}

.about__bio {
  margin-top: 2.1rem;
  font-size: var(--fs-normal);
  line-height: var(--lh-body);
}

@media (max-width: 767px) {
  .about {
    padding-top: 10vw;
    padding-bottom: 16vw;
  }

  .about__grid {
    display: flex;
    flex-direction: column;
  }

  /* the card overlaps the top of a full-width photo strip */
  .about__media {
    min-height: 0;
    height: 269px;
    margin-top: -94px;
  }

  .about__card {
    width: 87.5%;
    min-height: 0;
    padding: 7vw;
  }

  .about__bio {
    margin-top: 1.5rem;
  }
}

/* ---------- Contact ---------- */
.contact {
  padding-top: 7vw;
  padding-bottom: 9.7vw;
}

.contact__grid {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  align-items: start;
  text-align: center;
}

.contact__intro {
  grid-column: 4 / 12;
}

.contact__details {
  grid-column: 14 / 23;
}

.contact__title {
  font-size: var(--fs-h2);
  line-height: 1.2;
}

.contact__text {
  margin-top: 2.2rem;
}

.button-outline {
  display: inline-block;
  margin-top: 3.6rem;
  padding: 1.25rem 2.3rem;
  border: 2px solid var(--muted);
  color: var(--muted);
  font-size: var(--fs-normal);
  line-height: 1.2;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.button-outline:hover {
  color: var(--white);
  background: var(--muted);
}

.contact__label {
  font-size: 0.95rem;
  font-weight: 400;
  line-height: var(--lh-body);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.contact__email {
  display: inline-block;
  margin-top: 1.9rem;
  font-size: var(--fs-h4);
  font-weight: 700;
  line-height: 1.4;
}

.contact__email:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.contact__group + .contact__group {
  margin-top: 3.7rem;
}

.contact__details .social {
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2.4rem;
}

.contact__details .social svg {
  width: 24px;
  height: 24px;
}

.contact-hero {
  margin: 0;
  background: var(--placeholder);
}

.contact-hero img {
  width: 100%;
  /* 2:1 on wide screens, 66% of the viewport height on tall ones */
  height: max(66vh, 50vw);
  height: max(66svh, 50vw);
  max-height: 100vh;
  object-fit: cover;
  object-position: 50% 80%;
  /* a touch of tone so the placeholder's pure-white sky still reads as a band
     against the white page; remove if your photo has no white sky */
  filter: brightness(0.965);
}

@media (max-width: 767px) {
  .contact {
    padding-top: 12vw;
    padding-bottom: 24vw;
  }

  .contact__grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4.5rem;
  }

  .contact__text {
    margin-top: 1.4rem;
  }

  .button-outline {
    margin-top: 1.5rem;
  }

  .contact__email {
    margin-top: 1.2rem;
  }

  .contact__group + .contact__group {
    margin-top: 2.6rem;
  }
}

/* ==========================================================================
   CMS additions: rich post/about text, projects, albums, pagination,
   draft banner, empty states, error page
   ========================================================================== */

/* ---------- Rich text from the editor (Markdown) ---------- */
.post__body > * + p,
.about__bio > * + * {
  margin-top: 1rem;
}

.post__body > :first-child {
  margin-top: 0;
}

.post__body h2,
.post__body h3,
.post__body h4 {
  margin-top: 2.6rem;
}

.post__body h2 { font-size: var(--fs-h3); }
.post__body h3 { font-size: var(--fs-large); line-height: 1.3; }

.post__body ul,
.post__body ol,
.about__bio ul,
.about__bio ol {
  margin-bottom: 0;
  padding-left: 1.4em;
}

.post__body ul,
.post__body ol {
  margin-top: 1rem;
}

.post__body li + li {
  margin-top: 0.35rem;
}

.post__body blockquote {
  margin: 1.6rem 0 0;
  padding-left: 1.4rem;
  border-left: 2px solid var(--black);
}

.post__body blockquote p + p {
  margin-top: 1rem;
}

.post__body a,
.about__bio a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.2s var(--ease);
}

.post__body a:hover,
.about__bio a:hover {
  color: var(--muted);
}

.post__body code {
  padding: 0.1em 0.3em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--placeholder);
}

.post__body pre {
  margin: 1.6rem 0 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: var(--fs-small);
  line-height: 1.6;
  background: var(--placeholder);
}

.post__body pre code {
  padding: 0;
  font-size: inherit;
  background: none;
}

.post__body hr {
  margin: 2.6rem 0 0;
  border: 0;
  border-top: 1px solid var(--light);
}

.post__body figure {
  margin: 2.25rem 0 0;
}

.post__body figure img {
  width: 100%;
}

.post__body figcaption {
  margin-top: 0.75rem;
  font-size: var(--fs-small);
  color: var(--muted);
}

/* Photos placed in the text keep their own shape (portrait stays portrait); only the cover photo that
   closes the article is cropped to the template's 3:2. Inline images keep their aspect ratio too. */
.post__body .post__figure:not(.post__figure--cover) {
  aspect-ratio: auto;
  background: none;
}

.post__body .post__figure:not(.post__figure--cover) img,
.post__body p img {
  height: auto;
}

/* ---------- Gallery: ratio for the no-JS / pre-layout fallback ----------
   The static template set style="--ratio: …" on each item; inline styles are blocked by the CSP,
   so browsers that support typed attr() read it from data-ratio instead (others use 1.5). */
@supports (width: attr(data-x type(<length>), 1px)) {
  .gallery__item {
    --ratio: attr(data-ratio type(<number>), 1.5);
  }
}

/* ---------- Draft banner (only visible to a logged-in admin) ---------- */
.draft-banner {
  padding: 0.75rem var(--gutter);
  font-size: var(--fs-small);
  line-height: 1.5;
  text-align: center;
  background: var(--light);
}

/* ---------- Empty states ---------- */
.empty-note {
  padding-top: 8vw;
  padding-bottom: 12vw;
  text-align: center;
}

.empty-note p + p {
  margin-top: 0.25rem;
}

.page-title + .empty-note {
  padding-top: 0;
}

/* ---------- Projects (album grid) ---------- */
.projects {
  padding-top: 3.5vw;
  padding-bottom: calc(8rem + 3.5vw);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6rem var(--gutter);
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-card {
  text-align: center;
}

.project-card__media {
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--placeholder);
}

.project-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s var(--ease);
}

.project-card__media:hover img {
  opacity: 0.9;
}

.project-card__title {
  margin-top: 1.9rem;
  font-size: var(--fs-h3);
  line-height: 1.2;
}

.project-card__meta {
  margin-top: 0.6rem;
  color: var(--muted);
}

@media (min-width: 768px) and (max-width: 1024px) {
  .projects {
    padding-top: 10vw;
  }
}

@media (max-width: 767px) {
  .projects {
    padding-top: 4rem;
    padding-bottom: 20vw;
  }

  .project-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16vw;
  }

  .project-card__title {
    margin-top: 1.4rem;
  }
}

/* ---------- Album header (title + description above the gallery) ---------- */
.album-header {
  padding-top: 3.5vw;
  padding-bottom: max(3.25rem, 4vw); /* + the gallery's own 4vw ≈ the blog title's gap */
  text-align: center;
}

.album-header .page-title {
  margin-bottom: 0;
}

.album-header__text {
  max-width: 640px;
  margin: 2.2rem auto 0;
}

.album-header__text p + p {
  margin-top: 1rem;
}

.album-header + .empty-note {
  padding-top: 4vw;
}

@media (min-width: 768px) and (max-width: 1024px) {
  .album-header {
    padding-top: 10vw;
  }
}

@media (max-width: 767px) {
  .album-header {
    padding-top: 4rem;
    padding-bottom: 5.5rem;
  }

  .album-header__text {
    margin-top: 1.4rem;
  }
}

/* ---------- Blog: posts without a cover image ---------- */
.post-card--no-media .post-card__date {
  margin-top: 0;
}

/* ---------- About without a photo: just the card ---------- */
.about__grid--text {
  display: block;
}

.about__grid--text .about__card {
  max-width: 46rem;
  min-height: 0;
  margin-inline: auto;
}

@media (max-width: 767px) {
  .about__grid--text .about__card {
    width: auto;
  }
}

/* ---------- Error page (404 …) ---------- */
.error {
  min-height: 50vh;
  padding-top: 3.5vw;
  padding-bottom: calc(8rem + 3.5vw);
  text-align: center;
}

.error__code {
  font-size: var(--fs-meta);
  color: var(--muted);
}

.error .page-title {
  margin: 1.9rem 0 0;
}

.error__text {
  max-width: 640px;
  margin: 2.4rem auto 0;
}

.error__trace {
  max-width: 100%;
  margin-top: 3rem;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: left;
  background: var(--placeholder);
}

@media (max-width: 767px) {
  .error {
    padding-top: 4rem;
    padding-bottom: 20vw;
  }
}

/* === Contact form (owned by contact module) === */
/* Sits in the contact page's left column under the intro text: full column width, at most 560px. */
.contact-form {
  --form-error: #b3261e;
  width: 100%;
  max-width: 560px;
  margin: 3rem auto 0;
  text-align: left;
}

.contact-form__fields {
  display: grid;
  gap: 1.6rem;
}

.contact-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.contact-form__label {
  font-size: 0.8rem;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.contact-form__optional {
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: none;
}

.contact-form__input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--muted);
  border-radius: 0;
  background: var(--white);
  color: var(--black);
  font: inherit;
  font-size: var(--fs-normal); /* 16px: no zoom-on-focus on iPhones */
  line-height: 1.5;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.contact-form__input--message {
  min-height: 11rem;
  resize: vertical;
}

.contact-form__input:hover {
  border-color: var(--black);
}

.contact-form__input:focus,
.contact-form__input:focus-visible {
  outline: none;
  border-color: var(--black);
  box-shadow: inset 0 0 0 1px var(--black);
}

.contact-form__input[aria-invalid="true"] {
  border-color: var(--form-error);
}

.contact-form__input[aria-invalid="true"]:focus {
  box-shadow: inset 0 0 0 1px var(--form-error);
}

.contact-form__error {
  color: var(--form-error);
  font-size: var(--fs-small);
  line-height: 1.5;
}

.contact-form__status {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--muted);
  line-height: 1.6;
  text-align: center;
}

.contact-form__status.is-error {
  margin-bottom: 1.6rem;
  border-color: var(--form-error);
  color: var(--form-error);
}

.contact-form__status:focus {
  outline: none;
}

.contact-form [hidden],
.contact-form__error:empty,
.contact-form__status:empty {
  display: none;
}

.contact-form__again {
  margin-top: 1.2rem;
  text-align: center;
}

.contact-form__again a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* Honeypot: off-screen for people, still "visible" to naive bots. */
.contact-form__hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* With the form on, the email address is a quiet text line under it rather than a second outlined button. */
.contact__alt {
  margin-top: 2.4rem;
  color: var(--muted);
  font-size: var(--fs-normal);
  overflow-wrap: anywhere;
}

.contact__alt a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: color 0.2s var(--ease);
}

.contact__alt a:hover {
  color: var(--black);
}

/* Same look as the outlined "Email" button, with a black hover. */
.contact-form__submit {
  justify-self: center;
  margin-top: 0.6rem;
}

.contact-form__submit:hover,
.contact-form__submit:focus-visible {
  border-color: var(--black);
  background: var(--black);
  color: var(--white);
}

.contact-form__submit:disabled {
  cursor: progress;
  opacity: 0.6;
}

@media (max-width: 767px) {
  /* On phones the column shrinks to its content; let it span the full width when it holds the form. */
  .contact__intro:has(> .contact-form) {
    align-self: stretch;
  }

  .contact-form {
    margin-top: 2.2rem;
  }

  .contact-form__fields {
    gap: 1.3rem;
  }
}
