/* ---------------------------------------------------------------------------
   Ροσκά Ευρυτανίας - design ported from the Flutter app's lib/theme.dart
   Primary  #006A72  (AppColors.primary)
   Dark theme, black scaffold background (AppColors.black)
   Body text: Roboto 20/16/12  (bodyLarge / bodyMedium / bodySmall)
   Hero title: Caudex bold, primary colour with a white glow
--------------------------------------------------------------------------- */

:root {
  --primary: #006a72;
  --primary-light: #00969f;
  --secondary: #ffffff;
  --bg: #000000;
  --surface: #101314;
  --surface-2: #171b1c;
  --text: #f2f4f4;
  --text-dim: #a8b1b2;
  --border: rgba(255, 255, 255, 0.12);

  --tag-association: #6d4c41;
  --tag-news: #2196f3;
  --tag-history: #4caf50;
  --tag-events: #e91e63;
  --tag-entertainment: #9c27b0;

  --font-body: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Caudex", Georgia, "Times New Roman", serif;
  /* Navigation face. A humanist sans, so it sits comfortably next to the Caudex
     headings instead of reading as a third unrelated voice. Has Greek and
     Greek-Extended coverage, unlike many display sans families. */
  --font-nav: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;

  --size-lg: 1.25rem; /* 20px - bodyLarge  */
  --size-md: 1rem; /* 16px - bodyMedium */
  --size-sm: 0.75rem; /* 12px - bodySmall  */

  --max-width: 1200px;
  --nav-height: 56px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--size-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--primary-light);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ------------------------------- navigation ------------------------------ */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--primary);
  min-height: var(--nav-height);
  display: flex;
  justify-content: center;
}

.nav__inner {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  /* Keep a sideways swipe inside the bar rather than letting it reach the end and
     trigger the browser's back gesture. */
  overscroll-behavior-x: contain;

  /* web/js/nav.js sets these to 2rem on whichever edge still has tabs behind it,
     fading it out as a hint that the bar continues. Both default to 0, so with
     scripting off the bar is simply unmasked. */
  --nav-fade-start: 0px;
  --nav-fade-end: 0px;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--nav-fade-start),
    #000 calc(100% - var(--nav-fade-end)),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--nav-fade-start),
    #000 calc(100% - var(--nav-fade-end)),
    transparent 100%
  );
}

.nav__inner::-webkit-scrollbar {
  display: none;
}

.nav__link {
  color: #fff;
  padding: 1rem 1.25rem;
  white-space: nowrap;
  font-family: var(--font-nav);
  /* Alegreya Sans runs a little small at a given size, so it is nudged up and
     given light tracking to make the bar feel deliberate rather than default. */
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-bottom: 3px solid transparent;
}

.nav__link:hover {
  background: rgba(0, 0, 0, 0.18);
  text-decoration: none;
}

.nav__link--active {
  border-bottom-color: #fff;
  font-weight: 700;
}

/* ---------------------------------- hero --------------------------------- */

.hero {
  position: relative;
  height: 70vh;
  min-height: 320px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero--compact {
  height: 250px;
  min-height: 250px;
}

/* The poster image is always painted, so there is never an empty hero while
   the video buffers. This is what the Flutter app used the frame asset for. */
.hero__media,
.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__video {
  z-index: 1;
}

.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.1) 45%, rgba(0, 0, 0, 0.55) 100%);
}

.hero__content {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 1rem;
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  font-size: clamp(1.75rem, 6vw, 3.125rem);
  /* Matches the four-way white Shadow list in title_widget.dart */
  text-shadow:
    -1px 0 2px #fff,
    0 1px 2px #fff,
    1px 0 2px #fff,
    0 -1px 2px #fff;
}

.hero__subtitle {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary);
  margin: 0.35rem 0 0;
  font-size: clamp(1.25rem, 3vw, 1.5625rem);
  text-shadow:
    -1px 0 2px #fff,
    0 1px 2px #fff,
    1px 0 2px #fff,
    0 -1px 2px #fff;
}

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

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.section {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: none;
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.section__title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  margin: 0;
  color: var(--text);
}

.section__subtitle {
  color: var(--text-dim);
  font-size: var(--size-sm);
  margin: 0.25rem 0 0;
}

.section__action {
  font-size: var(--size-md);
  color: var(--primary-light);
  white-space: nowrap;
}

/* --------------------------------- grids --------------------------------- */

.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

/* --------------------------------- cards --------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  text-decoration: none;
}

.card__media {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: var(--surface-2);
}

/* ---------------------------- image loading ------------------------------- */

/* Photos come from Storage at full size and can take a moment. Rather than each
   one snapping in as its bytes land - which read as the page assembling itself
   line by line - the tile shimmers while it waits and the photo fades in over
   it. `web/js/media.js` adds `.is-loaded`; with scripting off, the two rules
   below never apply and images just show normally. */

.gallery__item img.is-loaded,
.card__media.is-loaded {
  opacity: 1;
}

@media (scripting: enabled) {
  .gallery__item img,
  .card__media {
    opacity: 0;
  }

  /* Gallery tiles get their opacity transition from the `.gallery__item img` rule
     further down, which would otherwise override one declared here. */
  .card__media {
    transition: opacity 0.45s ease;
  }

  /* The shimmer lives on the tile, which already reserves the final size through
     `aspect-ratio`, so nothing moves when the photo arrives. */
  .gallery__item:not(.is-loaded)::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
      100deg,
      var(--surface-2) 30%,
      rgba(255, 255, 255, 0.45) 50%,
      var(--surface-2) 70%
    );
    background-size: 220% 100%;
    animation: media-shimmer 1.4s ease-in-out infinite;
    pointer-events: none;
  }
}

@keyframes media-shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

/* A shimmer that never stops is worse than none, and a fade is motion too. */
@media (prefers-reduced-motion: reduce) {
  .gallery__item img,
  .card__media {
    opacity: 1;
    transition: none;
  }
  .gallery__item:not(.is-loaded)::after {
    animation: none;
    background: var(--surface-2);
  }
}

.card__body {
  padding: 0.9rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.card__title {
  margin: 0;
  font-size: var(--size-lg);
  font-family: var(--font-display);
  color: var(--text);
  line-height: 1.3;
}

.card__summary {
  margin: 0;
  color: var(--text-dim);
  font-size: var(--size-md);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  font-size: var(--size-sm);
  color: var(--text-dim);
}

/* ---------------------------------- tags --------------------------------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  font-size: var(--size-sm);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
  line-height: 1.7;
}

.tag-association {
  background: var(--tag-association);
}
.tag-news {
  background: var(--tag-news);
}
.tag-history {
  background: var(--tag-history);
}
.tag-events {
  background: var(--tag-events);
}
.tag-entertainment {
  background: var(--tag-entertainment);
}

.badge-pinned {
  background: var(--primary);
  color: #fff;
  font-size: var(--size-sm);
  padding: 0.15rem 0.6rem;
  border-radius: 6px;
}

/* -------------------------------- article -------------------------------- */

.article {
  padding: 2rem 0 3rem;
}

.article__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  margin: 0 0 0.5rem;
}

.article__date {
  color: var(--text-dim);
  font-size: var(--size-sm);
  margin: 0 0 1.5rem;
}

/* Rich text stored as HTML in Firestore (delta_to_html output). */
.rich {
  font-size: var(--size-md);
  line-height: 1.75;
}

.rich img {
  border-radius: 10px;
  margin: 1rem 0;
  height: auto;
}

.rich a {
  color: var(--primary-light);
}

.rich h1,
.rich h2,
.rich h3 {
  font-family: var(--font-display);
  line-height: 1.25;
}

.rich blockquote {
  border-left: 3px solid var(--primary);
  margin: 1rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  color: var(--text-dim);
}

.rich iframe {
  max-width: 100%;
  border: 0;
  border-radius: 10px;
}

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

.gallery {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.gallery__item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-2);
}

/* Videos are tiles of exactly the same size as photos, so an album reads as one
   grid rather than a grid plus a pile of oversized players. */
.gallery__item img,
.gallery__item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Opacity belongs here rather than with the loading rules above: this rule is
     later in the file, so declaring `transition` there too would lose to this one
     and photos would snap in instead of fading. */
  transition: transform 0.2s ease, opacity 0.45s ease;
}

.gallery__item:hover img,
.gallery__item:hover video {
  transform: scale(1.04);
}

/* Play badge marking a video tile. */
.gallery__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.25);
}

.gallery__play::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent #fff;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
  margin-left: 4px;
}

.gallery__item--video::after {
  content: "";
  position: absolute;
  inset: auto auto 8px 8px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--primary-light);
}

/* -------------------------------- lightbox ------------------------------- */

.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.5rem, 3vw, 2.5rem);
}

.lightbox[hidden] {
  display: none;
}

.lightbox__figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

/* Fills as much of the viewport as it can without cropping or distorting.
   Videos in the carousel are sized identically to photos. */
.lightbox__img,
.lightbox__video {
  max-width: 100%;
  max-height: calc(100vh - 6rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.lightbox__img[hidden],
.lightbox__video[hidden] {
  display: none;
}

.lightbox__video {
  background: #000;
}

.lightbox__caption {
  color: var(--text);
  font-size: var(--size-md);
  text-align: center;
  max-width: 70ch;
}

.lightbox__caption[hidden] {
  display: none;
}

.lightbox__counter {
  position: absolute;
  top: 1rem;
  left: 1rem;
  color: var(--text-dim);
  font-size: var(--size-sm);
  font-variant-numeric: tabular-nums;
}

.lightbox__close,
.lightbox__nav {
  position: absolute;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s ease, transform 0.15s ease;
}

.lightbox__close:hover,
.lightbox__nav:hover {
  background: var(--primary);
}

.lightbox__close:focus-visible,
.lightbox__nav:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

.lightbox__close {
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  font-size: 1.75rem;
  line-height: 1;
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 1.25rem;
}

.lightbox__nav[hidden] {
  display: none;
}

.lightbox__nav--prev {
  left: 1rem;
}

.lightbox__nav--next {
  right: 1rem;
}

@media (max-width: 640px) {
  .lightbox__nav {
    width: 44px;
    height: 44px;
  }

  .lightbox__nav--prev {
    left: 0.35rem;
  }

  .lightbox__nav--next {
    right: 0.35rem;
  }

  .lightbox__img {
    max-height: calc(100vh - 8rem);
  }
}

/* Gallery tiles are clickable, so show it. */
.gallery__item {
  cursor: zoom-in;
}

/* ------------------------------ video / embed ---------------------------- */

.embed {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  /* Several YouTube embeds in one announcement were sitting flush against each
     other; this keeps them visibly separate. */
  margin: 1.5rem 0;
}

.embed + .embed {
  margin-top: 2rem;
}

.embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------------------------------- map ---------------------------------- */

.map {
  width: 100%;
  height: min(70vh, 640px);
  border-radius: 12px;
  background: var(--surface-2);
  z-index: 0; /* keep Leaflet panes under the sticky nav */
}

/* Embedded in an article, e.g. on a single sight. */
.map--inline {
  height: min(55vh, 460px);
  margin: 1rem 0;
}

/* Pin + label marker, replacing the Flutter FaIcon(locationPin) + Text. */
.map-pin {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  background: transparent;
  border: 0;
  pointer-events: auto;
}

.map-pin__dot {
  width: 14px;
  height: 14px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.map-pin__label {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #111;
  text-align: center;
  line-height: 1.2;
  /* White outline so labels stay readable over any tile, the same trick the
     Flutter marker used with four white Shadows. */
  text-shadow:
    -1px 0 0 #fff,
    1px 0 0 #fff,
    0 1px 0 #fff,
    0 -1px 0 #fff;
}

.map-legend {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  color: #333;
  font-size: 12px;
  max-width: 160px;
}

.map-legend__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 2px 0;
  font-weight: 700;
}

.map-legend__row i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}

.map-legend__hint {
  margin-top: 0.35rem;
  color: var(--primary);
  font-weight: 700;
  line-height: 1.3;
}

/* Leaflet popups on a dark site. */
.leaflet-popup-content a {
  color: var(--primary);
  font-weight: 700;
}

/* -------------------------------- snackbar ------------------------------- */

/* Replaces the Flutter GetX snackbars: slides up from the bottom, then leaves. */
.snackbar {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: 1.25rem;
  transform: translate(-50%, calc(100% + 2rem));
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: min(560px, calc(100vw - 2rem));
  padding: 0.9rem 1rem 0.9rem 1.15rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.snackbar[hidden] {
  display: none;
}

.snackbar--visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.snackbar--success {
  border-left-color: #43a047;
}

.snackbar--error {
  border-left-color: #e53935;
}

.snackbar__text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  font-size: var(--size-md);
}

.snackbar__text span {
  color: var(--text-dim);
  font-size: var(--size-sm);
}

.snackbar__close {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.snackbar__close:hover {
  color: var(--text);
}

/* ------------------------------ filter chips ----------------------------- */

.filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filters__row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filters__label {
  color: var(--text-dim);
  font-size: var(--size-sm);
  min-width: 4.5rem;
}

/* --------------------------------- notice -------------------------------- */

.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

/* Live banner on the home page.
   A flat row with a divider beneath, matching the Flutter ListTile: no card, no
   filled button. On wide screens the call to action sits on the right; below
   700px it wraps under the title and reads as a subtitle. */
.live-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.live-banner:hover {
  text-decoration: none;
}

.live-banner:hover .live-banner__action {
  color: var(--primary-light);
  text-decoration: underline;
}

.live-banner__title {
  flex: 1;
  font-size: var(--size-lg);
  min-width: 0;
}

.live-banner__action {
  color: var(--text);
  font-size: var(--size-md);
  white-space: nowrap;
}

@media (max-width: 700px) {
  .live-banner {
    align-items: flex-start;
  }

  .live-banner__title {
    flex: 0 0 auto;
    font-size: var(--size-md);
  }

  /* Becomes the subtitle: full width on its own line, smaller and dimmer. */
  .live-banner__action {
    flex-basis: 100%;
    padding-left: 1.3rem;
    font-size: var(--size-sm);
    color: var(--text-dim);
    white-space: normal;
  }
}

.live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e53935;
  margin-right: 0.4rem;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 3rem 1rem;
}

.spacer {
  height: 1.25rem;
}

/* Unselected year / filter chips. */
.tag--muted {
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.tag--muted:hover {
  color: #fff;
  background: var(--primary);
  text-decoration: none;
}

/* ---------------------------------- forms -------------------------------- */

.form__field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.form__field > span {
  font-size: var(--size-sm);
  color: var(--text-dim);
}

.form__field input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  color: var(--text);
  font-family: inherit;
  font-size: var(--size-md);
}

.form__field input:focus {
  outline: 2px solid var(--primary-light);
  outline-offset: 1px;
}

.form__fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem 1rem;
  margin: 0 0 1rem;
}

.form__fieldset legend {
  padding: 0 0.4rem;
  color: var(--text-dim);
  font-size: var(--size-sm);
}

.form__row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  cursor: pointer;
}

/* details/summary used by the association FAQ */
details.notice summary {
  cursor: pointer;
  list-style: none;
}

details.notice summary::-webkit-details-marker {
  display: none;
}

details.notice summary::before {
  content: "+ ";
  color: var(--primary-light);
  font-weight: 700;
}

details.notice[open] summary::before {
  content: "− ";
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: var(--size-md);
  border: 1px solid var(--primary);
  cursor: pointer;
}

.btn:hover {
  background: var(--primary-light);
  text-decoration: none;
}

.btn--outline {
  background: transparent;
  color: var(--primary-light);
}

/* ---------------------------------- icons -------------------------------- */

.icon {
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.icon-link:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
  text-decoration: none;
}

/* --------------------------------- tiles --------------------------------- */

.tiles {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Shared by <a> and <button> so a dialog trigger looks like a link row. */
.tile {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  text-align: left;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.tile:hover {
  background: var(--surface-2);
  transform: translateX(2px);
  text-decoration: none;
}

.tile__text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.tile__title {
  font-size: var(--size-lg);
  font-family: var(--font-display);
}

.tile__subtitle {
  color: var(--text-dim);
  font-size: var(--size-sm);
  white-space: pre-line;
}

.tile__trailing {
  color: var(--primary-light);
  display: flex;
  align-items: center;
}

/* -------------------------------- dialogs -------------------------------- */

/* Lock page scrolling while a dialog is open.
   Driven by the document's real state rather than a JS-toggled class, so it can
   never get stuck locked if a close event is missed. */
html:has(dialog[open]) {
  overflow: hidden;
}

.dialog {
  width: min(640px, 92vw);
  max-height: 85vh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--primary);
}

.dialog__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--size-lg);
  color: #fff;
}

.dialog__close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
}

.dialog__close:hover {
  background: rgba(0, 0, 0, 0.25);
}

.dialog__body {
  padding: 1.25rem;
  overflow-y: auto;
  max-height: calc(85vh - 4.5rem);
}

.dialog__row {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 0.6rem 0;
  color: var(--text);
}

.dialog__row > .icon {
  color: var(--primary-light);
  margin-top: 0.25rem;
}

/* On phones the dialog becomes a bottom sheet, the way the Flutter version
   switched to showModalBottomSheet on mobile. */
@media (max-width: 640px) {
  .dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 88vh;
    margin: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }

  .dialog__body {
    max-height: calc(88vh - 4.5rem);
  }
}

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

.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2.5rem 0 1.5rem;
  margin-top: 2rem;
}

.footer__grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.footer__title {
  font-family: var(--font-display);
  font-size: var(--size-lg);
  margin: 0 0 0.5rem;
}

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

.footer__bottom {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: var(--size-sm);
}

/* Social row + store badge, moved out of the information page. */
.footer__socials {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.footer__badge {
  display: inline-block;
  opacity: 0.9;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.footer__badge:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.footer__badge img {
  height: 48px;
  width: auto;
}

.footer__title--spaced {
  margin-top: 1.5rem;
}

.footer__sponsor {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
  color: var(--text-dim);
}

.footer__sponsor:hover {
  text-decoration: none;
  color: var(--text);
}

/* The logo is black artwork, so instead of a light plate it is flattened into a
   light silhouette directly on the dark footer. This reproduces the Flutter
   version's `Image.asset(..., color: Colors.grey.shade200.withValues(alpha: .5))`,
   which replaced the artwork's colours with a single translucent grey.
   brightness(0) makes it solid black, invert(1) flips that to white, and the
   opacity lands it at the same grey. */
.footer__sponsor-plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.footer__sponsor-plate img {
  height: 72px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.62;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.footer__sponsor:hover .footer__sponsor-plate img {
  opacity: 0.95;
  transform: translateY(-2px);
}

.footer__sponsor-text {
  font-size: var(--size-sm);
  white-space: pre-line;
}

.footer__dev {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-dim);
  font-weight: 700;
}

.footer__dev:hover {
  color: var(--text);
  text-decoration: none;
}

/* ------------------------------- responsive ------------------------------ */

@media (max-width: 640px) {
  /* `dvh` rather than `vh`: on a phone `vh` measures the viewport as if the URL
     bar were hidden, so a hero set in `vh` covers noticeably more of the screen
     than the number suggests. `dvh` tracks what is actually visible. */
  .hero {
    height: 60dvh;
  }

  /* On a phone only the landing page gets a tall hero. Everything else is held
     under half the screen so whatever follows the title is visible without
     scrolling.
     Keyed on `:not(.hero--parallax)` rather than on `.hero--compact` for two
     reasons: it also catches the history page, which opts out of `--compact` for
     its archive photo but is still not the landing page; and its higher
     specificity means it no longer depends on source order. The `.hero` rule
     above is later in the file than `.hero--compact` and equally specific, which
     is why the compact modifier previously did nothing at all on mobile. */
  .hero:not(.hero--parallax) {
    height: 40dvh;
    min-height: 200px;
    max-height: 300px;
  }

  .nav__link {
    padding: 0.9rem 0.85rem;
    /* 12px was too tight for Alegreya Sans, which has a small x-height. */
    font-size: 0.875rem;
  }

  .section {
    padding: 1.75rem 0;
  }

  /* Four across, contact-sheet style, rather than one full-width photo per row.
     `minmax(180px, 1fr)` collapses to a single column on a phone, which turned an
     album of fifty photos into a scroll long enough that nobody reaches the end.
     Small tiles are for choosing, not for viewing - a tap opens the carousel at
     full size, which is where a photo is actually meant to be looked at. */
  .gallery {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
  }

  /* The play triangle was drawn for a 180px tile and swamps an 80px one. */
  .gallery__play::before {
    border-width: 7px 0 7px 11px;
    margin-left: 2px;
  }
}

/* Respect users who prefer no motion: never autoplay the hero video for them. */
@media (prefers-reduced-motion: reduce) {
  .hero__video {
    display: none;
  }

  .live-dot {
    animation: none;
  }
}

/* Popup "show more" link on the map. */
.map-popup__link {
  font-weight: 700;
  color: var(--primary);
}

.footer__attribution {
  font-size: var(--size-sm);
  color: var(--text-dim);
}

/* -------------------------------- comments ------------------------------- */

.comments {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.comments__list {
  list-style: none;
  margin: 1rem 0 2rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comments__item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

/* Name | date, as in the Flutter CommentTile. */
.comments__head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: var(--size-md);
}

.comments__sep,
.comments__date {
  color: var(--text-dim);
  font-weight: 700;
  font-size: var(--size-sm);
}

.comments__body {
  margin: 0.5rem 0 0;
  white-space: pre-line;
}

.comments__form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem;
}

.comments__form h3 {
  margin: 0 0 0.75rem;
}

.comments__form textarea,
.form textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  color: var(--text);
  font-family: inherit;
  font-size: var(--size-md);
  resize: vertical;
  width: 100%;
}

.comments__form textarea:focus,
.form textarea:focus {
  outline: 2px solid var(--primary-light);
  outline-offset: 1px;
}

/* Home page map: taller than an inline sight map, matching the Flutter
   RoutesWidget's 500px desktop / 350px mobile box. */
.map--home {
  height: 500px;
}

@media (max-width: 1000px) {
  .map--home {
    height: 350px;
  }
}

/* Duration / distance facts on a route page (RouteCardWidget's ListTiles). */
.route-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 1.25rem 0;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
}

.route-facts dt {
  color: var(--text-dim);
  font-size: var(--size-sm);
}

.route-facts dd {
  margin: 0;
  font-size: var(--size-md);
}

/* Pinned badge holds an icon now, not a character. */
.badge-pinned {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.4rem;
  line-height: 1;
}

/* ------------------------ album container tiles -------------------------- */

/* No cover art: a container is a year, so the tile is a bordered box with the
   title centred in it, as in the Flutter AlbumContainersWidget grid. */
.container-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.container-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 130px;
  padding: 1.25rem 1rem;
  text-align: center;
  border: 2px solid var(--primary);
  border-radius: 8px;
  background: rgba(0, 106, 114, 0.1);
  color: var(--text);
  transition: background 0.15s ease, transform 0.15s ease;
}

.container-tile:hover {
  background: rgba(0, 106, 114, 0.28);
  transform: translateY(-2px);
  text-decoration: none;
}

.container-tile__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.1;
}

.container-tile__meta {
  color: var(--text-dim);
  font-size: var(--size-sm);
}

/* --------------------------- buttons: large CTA -------------------------- */

.cta {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 1rem;
}

.btn--lg {
  font-size: var(--size-lg);
  padding: 1rem 2.5rem;
  letter-spacing: 0.06em;
  border-radius: 10px;
  border-width: 2px;
}

.btn__chevron {
  font-size: 1.4em;
  line-height: 1;
}

/* A button that reads as an inline link - used for the FAQ's "open the contact
   form" sentence, which is a dialog trigger rather than a navigation. */
.link-button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--primary-light);
  cursor: pointer;
  text-decoration: underline;
}

.link-button:hover {
  color: var(--text);
}

/* Village logo beside the name, as one lockup. */
.footer__brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.5rem;
}

.footer__brand .footer__title {
  margin: 0;
}

.footer__logo {
  display: inline-block;
  flex: 0 0 auto;
  opacity: 0.9;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.footer__logo:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.footer__logo img {
  height: 56px;
  width: auto;
  display: block;
}

/* Breathing room between the comments area and the form below it, so the form
   does not look like part of the last comment. */
.comments__form {
  margin-top: 2rem;
}

/* When there are no comments yet, the "no comments" line needs the gap instead,
   since the list element is absent. */
.comments > .section__subtitle {
  margin-bottom: 2rem;
}

/* ============================ hero motion ================================= */

/* Title fade-in, the CSS equivalent of the Flutter FadeIn widget wrapping the
   hero title (AnimatedOpacity, 1s). */
@keyframes hero-fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero__content {
  animation: hero-fade-in 1s ease-out both;
}

/* --- Parallax: the media is pinned to the viewport and the page scrolls up
   over it. `main` and the footer are opaque and sit on a higher layer, so they
   cover the pinned video as they rise. Only the landing page opts in. --- */

.hero--parallax {
  background: transparent;
}

.hero--parallax .hero__media,
.hero--parallax .hero__video,
.hero--parallax .hero__scrim {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  /* dvh so a mobile browser's collapsing toolbar does not leave a strip. */
  height: 100vh;
  height: 100dvh;
}

/* The content still scrolls normally inside the hero, so the title travels up
   while the footage behind it holds. */
.hero--parallax .hero__content {
  position: relative;
  z-index: 3;
  /* Set by web/js/hero.js: 1 at the top, 0 once the hero is scrolled past. */
  opacity: var(--hero-progress, 1);
  transform: translateY(calc((1 - var(--hero-progress, 1)) * -40px));
  will-change: opacity, transform;
}

/* Everything after the hero rides over the pinned media. */
main,
.footer {
  position: relative;
  z-index: 2;
}

main {
  background: var(--bg);
}

/* Scroll hint under the landing title, fading out with the rest of the hero. */
.hero__hint {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  z-index: 3;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: #fff;
  font-size: var(--size-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: calc(var(--hero-progress, 1) * 0.85);
  pointer-events: none;
}

.hero__hint::after {
  content: "";
  width: 12px;
  height: 12px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  animation: hero-hint-bob 1.8s ease-in-out infinite;
}

@keyframes hero-hint-bob {
  0%,
  100% {
    transform: rotate(45deg) translate(0, 0);
  }
  50% {
    transform: rotate(45deg) translate(3px, 3px);
  }
}

/* Motion is decoration: with reduced-motion the hero is static and unpinned. */
@media (prefers-reduced-motion: reduce) {
  .hero__content {
    animation: none;
  }

  .hero--parallax .hero__media,
  .hero--parallax .hero__video,
  .hero--parallax .hero__scrim {
    position: absolute;
    width: 100%;
    height: 100%;
  }

  .hero--parallax .hero__content {
    opacity: 1;
    transform: none;
  }

  .hero__hint::after {
    animation: none;
  }
}

/* A tile that is not itself clickable - only its trailing icons are. */
.tile--static {
  cursor: default;
}

.tile--static:hover {
  background: var(--surface);
  transform: none;
}

.tile__icons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tile__icons .icon-link {
  width: 38px;
  height: 38px;
}
