/* Shared by every page: palette, section colours, typography. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { margin: 0; padding: 0; background: var(--deep); }
img { max-width: 100%; }

@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

:root {
  --deep: #151a18;
  --river: #1795a0;
  --mist: #eeebe3;
  --paper: #f6f4ee;
  --ink: #151a18;
  --sand: #7fd6dc;
  --sand-dark: #0f7a85;
  --rise-h: clamp(110px, 20svh, 220px);
  --river-light: #7fd6dc;
  --river-text: #d9f3f4;
  --serif: "EB Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(20px, 6vw, 96px);
}

/* Section colours: dark water (.on-deep), light paper (.on-paper) and pale mist (.on-mist) */
.on-deep { --sec-bg: var(--deep); --fg: var(--paper); --fg-soft: rgba(246, 244, 238, .86); --fg-muted: rgba(246, 244, 238, .66); --rule: rgba(246, 244, 238, .16); --acc: var(--sand); background: var(--sec-bg); color: var(--fg); }
.on-paper { --sec-bg: var(--paper); --fg: var(--ink); --fg-soft: rgba(21, 26, 24, .88); --fg-muted: rgba(21, 26, 24, .68); --rule: rgba(21, 26, 24, .16); --acc: var(--sand-dark); background: var(--sec-bg); color: var(--fg); }
.on-mist { --sec-bg: var(--mist); --fg: var(--ink); --fg-soft: rgba(21, 26, 24, .88); --fg-muted: rgba(21, 26, 24, .68); --rule: rgba(21, 26, 24, .16); --acc: var(--sand-dark); background: var(--sec-bg); color: var(--fg); }

body { font-family: var(--sans); font-size: 1rem; line-height: 1.6; overflow-x: clip; }
:focus-visible { outline: 1px solid var(--acc); outline-offset: 3px; }
em { font-style: italic; }

.eyebrow {
  font-size: .75rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--acc); margin-bottom: 1.2rem;
}
h2 {
  font-family: var(--serif); font-weight: 400; line-height: .95;
  font-size: clamp(3rem, 10vw, 9rem); letter-spacing: -.01em;
}
h2.h3 { font-size: clamp(2.4rem, 5.4vw, 4.8rem); }

.ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 1.5rem; background: #232a27; border: 1px solid rgba(246, 244, 238, .14);
  font-family: var(--serif); font-size: clamp(1.4rem, 2.2vw, 2rem); color: rgba(246, 244, 238, .34);
}


/* Main menu on every page: a bar across the top with the town name, the pages and the language choice.
   Its colours follow what is under it (nav.js): clear over a photo, dark over dark sections, light over light ones.
   The blur sits on ::before, not on the bar: a backdrop-filter on the bar itself would trap the fixed phone menu inside it. */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  display: flex; align-items: center; gap: clamp(12px, 3vw, 40px);
  min-height: 64px; padding: 0 var(--gutter); color: var(--paper);
  transition: color .3s ease;
}
.site-nav::before {
  content: ""; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background: linear-gradient(to bottom, rgba(8, 11, 10, .5), rgba(8, 11, 10, 0));
  transition: background .3s ease, opacity .3s ease;
}
.site-nav.nav-dark::before {
  background: rgba(21, 26, 24, .84);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.site-nav.nav-dark::before, .site-nav.nav-light::before {
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent); mask-image: linear-gradient(to bottom, #000 62%, transparent);
}
.site-nav.nav-light { color: var(--ink); }
.site-nav.nav-light::before {
  background: rgba(246, 244, 238, .9);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.nav-logo {
  display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap;
  font-family: var(--serif); font-size: 1.5rem; font-weight: 500; color: inherit; text-decoration: none;
}
.nav-links { flex: 1; display: flex; justify-content: center; gap: clamp(16px, 3vw, 44px); }
.nav-links a {
  position: relative; display: inline-flex; align-items: center; min-height: 44px;
  color: inherit; opacity: .8; text-decoration: none;
  font-family: var(--sans); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  transition: opacity .2s ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; }
/* the current page: a line under the word (the right inset takes off the trailing letter-spacing) */
.nav-links a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: .18em; bottom: 9px; height: 1px; background: currentColor; }
.nav-toggle { display: none; }

/* BS | EN (added by i18n.js), always visible */
.lang-switch { display: inline-flex; align-items: center; font-family: var(--sans); font-size: .72rem; letter-spacing: .12em; }
.lang-switch span { opacity: .4; }
.lang-switch button {
  min-height: 44px; min-width: 34px; padding: 0 .3rem; background: none; border: 0; cursor: pointer;
  color: inherit; font: inherit; letter-spacing: inherit; opacity: .55; transition: opacity .2s ease;
}
.lang-switch button:hover { opacity: .85; }
.lang-switch button[aria-pressed="true"] { opacity: 1; font-weight: 500; }

/* phones: name, language and a Menu button; the pages open as a full-screen list, so any number of pages fits */
@media (max-width: 768px) {
  .site-nav { min-height: 58px; gap: 6px; }
  .nav-logo { order: 1; margin-right: auto; font-size: 1.35rem; }
  .lang-switch { order: 2; }
  .nav-toggle {
    order: 3; display: inline-flex; align-items: center; min-height: 40px; padding: 0 .95rem; margin-left: 4px;
    border: 1px solid currentColor; border-radius: 999px; background: none; color: inherit; cursor: pointer;
    font: inherit; font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
  }
  .nav-toggle .t-close, .site-nav.open .nav-toggle .t-open { display: none; }
  .site-nav.open .nav-toggle .t-close { display: inline; }
  .nav-links {
    position: fixed; inset: 0; z-index: -1; flex-direction: column; justify-content: center; gap: 0;
    padding: 80px var(--gutter) 40px; background: var(--deep);
    opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s;
  }
  .site-nav.open { color: var(--paper); }
  .site-nav.open::before { opacity: 0; }
  .site-nav.open .nav-links { opacity: 1; visibility: visible; }
  .nav-links a, .nav-links .nav-home {
    display: flex; opacity: 1; padding: .85rem 0; border-bottom: 1px solid rgba(246, 244, 238, .16); color: var(--paper);
    font-family: var(--serif); font-size: 2.5rem; letter-spacing: 0; text-transform: none; line-height: 1.1;
  }
  .nav-links a[aria-current="page"] { color: var(--river-light); }
  .nav-links a[aria-current="page"]::after { display: none; }
}
@media (prefers-reduced-motion: reduce) { .site-nav, .site-nav::before, .nav-links { transition: none; } }

/* "Then and now" (thennow.js): two photos of the same place, the old one cut off at --p */
.tn { margin: 0; }
.tn-box {
  --p: 50%; position: relative; overflow: hidden; aspect-ratio: var(--ar, 4 / 3); background: #1f2522;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: ew-resize;
}
.tn-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.tn-new { object-position: var(--pos-new, 50% 50%); }
.tn-old { object-position: var(--pos-old, 50% 50%); clip-path: inset(0 calc(100% - var(--p)) 0 0); filter: sepia(.18) contrast(1.02); }
.tn-line { position: absolute; top: 0; bottom: 0; left: var(--p); width: 2px; margin-left: -1px; background: var(--paper); pointer-events: none; }
.tn-knob {
  position: absolute; top: 50%; left: var(--p); width: 44px; height: 44px; transform: translate(-50%, -50%);
  display: grid; place-items: center; border-radius: 50%; background: var(--paper); color: var(--ink);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35); pointer-events: none;
}
.tn-range { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tn-box:has(.tn-range:focus-visible) .tn-knob { outline: 2px solid var(--river-light); outline-offset: 3px; }
.tn-lb {
  position: absolute; bottom: 12px; padding: 4px 8px; background: rgba(0, 0, 0, .55); color: var(--paper);
  font-size: .66rem; letter-spacing: .2em; text-transform: uppercase; line-height: 1.3; pointer-events: none;
}
.tn-l { left: 12px; }
.tn-r { right: 12px; }
.tn figcaption { margin-top: .6rem; font-size: .86rem; line-height: 1.5; color: var(--fg-muted); }

/* Footer on every page: the town, the pages, and who made the site */
.site-foot {
  position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px 48px;
  padding: clamp(48px, 8svh, 88px) var(--gutter) 28px; background: var(--deep); border-top: 1px solid var(--rule); color: var(--fg-muted);
}
.site-foot .foot-name { font-family: var(--serif); font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1; color: var(--fg); }
.sf-country { margin-top: .6rem; font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; }
/* the pages in one row, beside the town name */
.sf-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; align-self: end; column-gap: clamp(18px, 2.4vw, 36px); }
.sf-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--fg-soft); text-decoration: none; font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; white-space: nowrap; transition: color .2s ease; }
.sf-links a:hover { color: var(--acc); }
.sf-base {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px;
  padding-top: 22px; border-top: 1px solid var(--rule); font-size: .8rem;
}
.sf-credit a { color: var(--fg); text-decoration: none; }
.sf-credit a:hover .sf-url { color: var(--acc); }
.sf-url { margin-left: .5rem; color: var(--fg-muted); transition: color .2s ease; }
.site-foot .foot-top { display: inline-flex; align-items: center; min-height: 44px; color: var(--acc); text-decoration: none; font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; }
@media (max-width: 768px) {
  .site-foot { grid-template-columns: minmax(0, 1fr); }
  /* phones: the six pages do not fit one row, so they sit in an even grid of three */
  .sf-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 12px; }
  .sf-base { flex-direction: column; align-items: flex-start; }
}
