/* Bellefair 400 — the wordmark face from the brand kit. Self-hosted rather
   than loaded from Google's CDN: no third-party request on every page view,
   nothing external to break, and it matches how Bootstrap and jQuery are
   already vendored. Licence in wwwroot/fonts/OFL.txt (SIL OFL 1.1).
   Two subsets, so a page of English text never downloads the accented glyphs. */
@font-face {
  font-family: 'Bellefair';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/bellefair-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Bellefair';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/bellefair-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --brand-orange: #e7511e;
  --brand-navy: #222a4e;
  --brand-cream: #e8e2d7;

  /* Bellefair is a display face: high contrast, small x-height, one weight.
     Used for headings and chrome only — body copy and comment prose stay on
     the system sans, where it would cost real legibility at 14-16px. */
  --brand-display: 'Bellefair', Georgia, 'Times New Roman', serif;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--brand-orange);
}

/* ---------------------------------------------------------------- branding */

/* The lockup is assembled here rather than shipped as one image: the kit's
   horizontal PNG has a baked-in white background. Proportions come from
   measuring the kit's own lockup — the wordmark sits at ~0.59 of the mark's
   height, and the gap between them is tight. */
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-mark {
  height: 40px;
}

.brand-wordmark {
  height: 23px;
}

/* At its natural size the lockup plus the navbar toggler and the container's
   padding overflows a 320px viewport — the narrowest phones still in use — and
   wraps the navbar. Shrinking it below 360px keeps everything on one line. */
@media (max-width: 360px) {
  .brand-mark {
    height: 32px;
  }

  .brand-wordmark {
    height: 18px;
  }
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--brand-display);
  color: var(--brand-navy);
  /* Bellefair ships one weight. Headings default to 700, which the browser
     would fake by smearing the outlines — badly, on a face with this much
     stroke contrast. Ask for what actually exists. */
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* Sizes are set per level rather than as one relative bump. In a font-size
   declaration `em` resolves against the *parent's* size, not the element's own
   default — so a single `calc(1em + ...)` rule flattens h1 through h6 to
   roughly the same size and inverts the hierarchy. These are Bootstrap's steps
   nudged up slightly, because Bellefair's small x-height reads smaller than a
   sans at the same nominal size. */
h1 { font-size: 2.7rem; }
h2 { font-size: 2.15rem; }
h3 { font-size: 1.9rem; }
h4 { font-size: 1.6rem; }
h5 { font-size: 1.35rem; }
h6 { font-size: 1.1rem; }

/* Links are navy, not the brand orange: #e7511e is 3.75:1 on white, which
   fails WCAG AA for body-size text (4.5:1). Navy is 13.9:1. The orange still
   earns its place on hover and in the underline, where it's decoration rather
   than the thing being read. */
a {
  color: var(--brand-navy);
  text-decoration-color: var(--brand-orange);
  text-underline-offset: 0.15em;
}

a:hover, a:focus {
  color: var(--brand-orange);
}

/* Header and footer carry the cream; the page behind the photos stays white so
   a tinted surround doesn't shift how their colours read. */
header .navbar {
  background-color: var(--brand-cream);
  border-bottom-color: rgba(34, 42, 78, 0.15) !important;
}

header .nav-link {
  font-family: var(--brand-display);
  font-size: 1.15rem;
  color: var(--brand-navy);
}

header .nav-link:hover, header .nav-link:focus {
  color: var(--brand-orange);
}

.footer {
  background-color: var(--brand-cream);
  border-top-color: rgba(34, 42, 78, 0.15) !important;
  font-family: var(--brand-display);
  font-size: 1.05rem;
  color: var(--brand-navy);
}

.footer a {
  color: var(--brand-navy);
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.tile {
  position: relative;
  display: block;
  border-radius: 0.375rem;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #eee;
  color: inherit;
  text-decoration: none;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  color: #fff;
  display: flex;
  flex-direction: column;
}

.tile-title {
  font-family: var(--brand-display);
  /* 400 for the same reason as the headings — Bellefair has no bold to use. */
  font-weight: 400;
  font-size: 1.2rem;
}

.tile-count {
  font-size: 0.8rem;
  opacity: 0.85;
}

.gallery-tile {
  aspect-ratio: 1 / 1;
}

.tile-detail-link {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
}

.tile-detail-link:hover {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
}

.photo-detail {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.photo-detail-image {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 0.375rem;
  flex: 2 1 500px;
}

.photo-detail-meta {
  flex: 1 1 240px;
}

.photo-detail-meta dt {
  font-weight: 600;
  margin-top: 0.75rem;
}

.photo-detail-meta dt:first-child {
  margin-top: 0;
}
.photo-comments {
  margin-top: 2.5rem;
  max-width: 46rem;
}

.content-page-hero {
  position: relative;
  border-radius: 0.375rem;
  overflow: hidden;
  aspect-ratio: 21 / 9;
  background: #eee;
  margin-bottom: 2rem;
  color: #fff;
}

.content-page-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.content-page-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.35) 55%, rgba(0, 0, 0, 0.8));
}

.content-page-hero-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 1.5rem 3rem;
}

.content-page-hero-title {
  font-family: var(--brand-display);
  /* 400 for the same reason as the headings — Bellefair has no bold to use. */
  font-weight: 400;
  font-size: 2.9rem; /* a touch larger than the default h1 (2.7rem) */
  color: #fff;
  margin: 0 0 0.5rem;
}

.content-page-hero-intro {
  max-width: 40rem;
  margin: 0;
  font-size: 1.05rem;
}

.content-page-hero-date {
  position: absolute;
  inset: auto 0 0 0;
  margin: 0;
  padding: 0.5rem 0.75rem;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.9;
}

@media (max-width: 576px) {
  .content-page-hero {
    aspect-ratio: 4 / 3;
  }

  .content-page-hero-title {
    font-size: 2.1rem;
  }
}

.story-text {
  max-width: 46rem;
  margin: 1.5rem 0;
}

.story-text > *:first-child {
  margin-top: 0;
}

/* Empty anchor from "::: bookmark <name>" - a little breathing room above
   the jump target rather than landing flush with the viewport top. */
.story-bookmark {
  scroll-margin-top: 1rem;
}

/* One gap between photos everywhere in a story - inside a block (row, grid,
   mosaic) and between consecutive photo blocks with no text between
   them, which read as one associated group. The mosaic's boxSpacing in
   photo-story.js must match (0.5rem = 8px). */
#story-gallery {
  --story-gap: 0.5rem;
}

.story-photos {
  margin: 1.5rem 0;
}

.story-photos:has(+ .story-photos) {
  margin-bottom: 0;
}

.story-photos + .story-photos {
  margin-top: var(--story-gap);
}

.story-grid {
  gap: var(--story-gap);
}

/* align=full: 1-4 photos side by side filling the content width (one photo is
   simply full width). Each tile's flex-grow is its aspect ratio (set inline),
   so all come out the same height. */
.story-row {
  display: flex;
  gap: var(--story-gap);
}

.story-row .tile {
  flex-basis: 0;
  min-width: 0;
  aspect-ratio: auto;
}

.story-row .tile img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Tile geometry (top/left/width/height) is computed client-side by
   justified-layout from each photo's real aspect ratio — see photo-story.js.
   Container height and per-tile position/size are set there as inline styles. */
.story-mosaic {
  position: relative;
}

.story-mosaic .tile {
  position: absolute;
  aspect-ratio: auto;
}

.comment-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.comment {
  border-top: 1px solid #dee2e6;
  padding: 0.75rem 0;
}

.comment-meta {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  color: #6c757d;
  font-size: 0.875rem;
}

.comment-author {
  font-weight: 600;
  color: var(--brand-navy);
}

.comment-body {
  margin: 0.25rem 0 0;
  /* Comments are user-written prose: honour their line breaks, and break long
     unbroken strings rather than let them widen the page. */
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
