/* ==========================================================================
   Foundations — tokens, base, typography, layout, header, menu, footer
   ========================================================================== */

:root {
  --ink: #10162b;
  --ink-2: #172040;
  --ink-3: #232c4f;
  --slate: #2f3647;
  --sand: #d8c6a5;
  --sand-2: #e7dcc7;
  --sand-3: #f1eadc;
  --ivory: #f8f5ef;
  --white: #fdfcf9;
  --brass: #b49a6c;
  --brass-light: #c9b186;
  --brass-ink: #7d6236;
  --brass-deep: #96784a;

  --text: #1b2133;
  --text-muted: #525a6b;
  --text-on-ink: #ece6da;
  --text-on-ink-muted: rgba(236, 230, 218, 0.72);
  --line: rgba(27, 33, 51, 0.14);
  --line-on-ink: rgba(236, 230, 218, 0.16);

  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(20px, 5vw, 72px);
  --max: 1360px;
  --measure: 66ch;
  --header-h: 88px;
  --header-h-compact: 66px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --section-y: clamp(72px, 11vw, 168px);
}

/* ---------- Access gating ---------- */
html[data-access="protected"]:not(.is-authorised) body { visibility: hidden; }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h-compact) + 24px);
}

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

body {
  margin: 0;
  background: var(--ivory);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.menu-open { overflow: hidden; }

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }

button { font: inherit; color: inherit; }

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0; padding: 0; }

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

::selection { background: var(--sand); color: var(--ink); }

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 200;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--text-on-ink);
  font-size: 0.875rem;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus { top: 16px; }

.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;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.005em;
  color: inherit;
  text-wrap: balance;
}

.display {
  font-size: clamp(2.6rem, 6.2vw, 5.6rem);
  line-height: 1.02;
  font-weight: 400;
}

.h-xl { font-size: clamp(2.3rem, 4.8vw, 4.1rem); font-weight: 400; }
.h-lg { font-size: clamp(1.95rem, 3.4vw, 3rem); }
.h-md { font-size: clamp(1.5rem, 2.3vw, 2.05rem); }

.italic { font-style: italic; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 22px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--brass-ink);
}

.eyebrow::before {
  content: "";
  width: 34px;
  height: 1px;
  background: currentColor;
  opacity: 0.8;
}

.eyebrow--plain::before { display: none; }

.on-ink .eyebrow,
.eyebrow--light { color: var(--brass-light); }

.lede {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2vw, 1.62rem);
  line-height: 1.5;
  font-weight: 400;
  color: var(--text);
}

.on-ink .lede { color: var(--text-on-ink); }

.muted { color: var(--text-muted); }
.on-ink .muted { color: var(--text-on-ink-muted); }

.prose { max-width: var(--measure); }
.prose p { font-size: 1.04rem; }
.prose h3 { margin: 2.1em 0 0.6em; font-size: clamp(1.4rem, 2vw, 1.75rem); }
.prose ul { margin: 0 0 1.2em; list-style: none; }
.prose li { position: relative; padding-left: 22px; margin-bottom: 0.55em; }
.prose li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.8em;
  width: 10px;
  height: 1px;
  background: var(--brass);
}

.numeral {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--brass-ink);
}

.on-ink .numeral { color: var(--brass-light); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(56px, 7vw, 104px); }

.on-ink {
  background: var(--ink);
  color: var(--text-on-ink);
}

.on-sand { background: var(--sand-3); }
.on-white { background: var(--white); }

.rule {
  height: 1px;
  border: 0;
  margin: 0;
  background: var(--line);
}

.on-ink .rule { background: var(--line-on-ink); }

/* Subtle geometric lattice used on select dark grounds */
.lattice { position: relative; isolation: isolate; }
.lattice::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23c9b186' stroke-width='0.8'%3E%3Cpath d='M48 12 58 38 84 48 58 58 48 84 38 58 12 48 38 38Z'/%3E%3Cpath d='M22.5 22.5h51v51h-51z'/%3E%3Cpath d='M0 0l22.5 22.5M96 0 73.5 22.5M0 96l22.5-22.5M96 96 73.5 73.5'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 96px 96px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), rgba(0,0,0,0.2));
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), rgba(0,0,0,0.2));
}

/* ---------- Links & buttons ---------- */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
  background-image: linear-gradient(var(--brass), var(--brass));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.45s var(--ease), color 0.3s ease;
}

.link-arrow::after {
  content: "";
  width: 26px;
  height: 9px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 9'%3E%3Cpath d='M0 4.5h24M20 1l4 3.5L20 8' fill='none' stroke='black' stroke-width='1.2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 9'%3E%3Cpath d='M0 4.5h24M20 1l4 3.5L20 8' fill='none' stroke='black' stroke-width='1.2'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.35s var(--ease);
}

.link-arrow:hover { background-size: 100% 1px; }
.link-arrow:hover::after { transform: translateX(5px); }
.on-ink .link-arrow { color: var(--text-on-ink); }

.source-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--brass);
}

.source-link:hover { color: var(--text); }
.on-ink .source-link { color: var(--text-on-ink-muted); }
.on-ink .source-link:hover { color: var(--text-on-ink); }

/* ---------- Figures (images are never cropped) ---------- */
.figure { margin: 0; position: relative; }

.figure__media {
  position: relative;
  display: block;
  background: var(--sand-2);
}

.figure__media img {
  width: 100%;
  height: auto;
  object-fit: contain;
}


.figure figcaption,
.caption {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.figure figcaption::before {
  content: "";
  flex: none;
  width: 18px;
  height: 1px;
  margin-top: 0.75em;
  background: var(--brass);
}

.on-ink .figure figcaption { color: var(--text-on-ink-muted); }

/* Offset brass frame line */
.frame-line { position: relative; }
.frame-line::after {
  content: "";
  position: absolute;
  inset: 16px -16px -16px 16px;
  border: 1px solid var(--brass);
  pointer-events: none;
  z-index: -1;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--header-h);
  color: var(--ink);
  background: rgba(248, 245, 239, 0.94);
  border-bottom: 1px solid transparent;
  transition: height 0.4s var(--ease), background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header {
    background: rgba(248, 245, 239, 0.86);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    backdrop-filter: saturate(140%) blur(12px);
  }
}

.site-header.is-compact {
  height: var(--header-h-compact);
  border-bottom-color: var(--line);
}

.has-dark-hero .site-header:not(.is-compact) {
  background: transparent;
  color: var(--text-on-ink);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.brand__mark {
  flex: none;
  width: 30px;
  height: 40px;
  color: var(--brass);
}

.brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }

.brand__name {
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 500;
  white-space: nowrap;
}

.brand__role {
  margin-top: 5px;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  opacity: 0.72;
  white-space: nowrap;
}

.primary-nav { display: none; }

.primary-nav__list {
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.35vw, 24px);
  list-style: none;
}

.primary-nav__link {
  position: relative;
  display: inline-block;
  padding: 10px 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
  opacity: 0.86;
  transition: opacity 0.25s ease;
}

.primary-nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 1px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

.primary-nav__link:hover { opacity: 1; }
.primary-nav__link:hover::after,
.primary-nav__link[aria-current="page"]::after { transform: scaleX(1); }
.primary-nav__link[aria-current="page"] { opacity: 1; }

.header-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color 0.25s ease;
}

.icon-button:hover { background: rgba(180, 154, 108, 0.16); }
.icon-button svg { width: 20px; height: 20px; }

.menu-toggle { gap: 0; }
.menu-toggle__bars { position: relative; width: 24px; height: 12px; }
.menu-toggle__bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.35s var(--ease), width 0.35s var(--ease);
}
.menu-toggle__bars span:first-child { top: 0; }
.menu-toggle__bars span:last-child { bottom: 0; width: 66%; right: 0; left: auto; }
.menu-toggle:hover .menu-toggle__bars span:last-child { width: 100%; }

/* ==========================================================================
   Menu overlay (tablet & mobile)
   ========================================================================== */
.menu {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: var(--text-on-ink);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.4s var(--ease), visibility 0s linear 0.4s;
  overflow-y: auto;
  overscroll-behavior: contain;
}

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

.menu__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h-compact);
  gap: 16px;
}

.menu__body {
  flex: 1;
  display: grid;
  align-content: center;
  gap: 40px;
  padding-block: 24px 40px;
}

.menu__list { list-style: none; counter-reset: menu; }

.menu__list li {
  border-bottom: 1px solid var(--line-on-ink);
  transform: translateY(14px);
  opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
}

.menu.is-open .menu__list li { transform: none; opacity: 1; }

.menu__list a {
  display: flex;
  align-items: baseline;
  gap: 18px;
  min-height: 56px;
  padding: 12px 0;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 5.4vw, 2.6rem);
  line-height: 1.1;
  text-decoration: none;
  color: var(--text-on-ink);
  transition: color 0.25s ease, padding 0.35s var(--ease);
}

.menu__list a::before {
  counter-increment: menu;
  content: counter(menu, decimal-leading-zero);
  flex: none;
  width: 2.4em;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--brass-light);
}

.menu__list a:hover,
.menu__list a[aria-current="page"] { color: var(--brass-light); }
.menu__list a:hover { padding-left: 8px; }

.menu__meta {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-on-ink-muted);
}

.menu__meta a { color: var(--text-on-ink); text-decoration: none; }
.menu__meta a:hover { color: var(--brass-light); }

.menu__lock {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-on-ink-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
}

.menu__lock:hover { color: var(--brass-light); }
.menu__lock svg { width: 16px; height: 16px; }

/* ==========================================================================
   Page intro (shared spacing below fixed header)
   ========================================================================== */
.page-top { padding-top: calc(var(--header-h) + clamp(48px, 8vw, 110px)); }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 28px;
  list-style: none;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.breadcrumb li + li::before { content: "/"; margin-right: 10px; color: var(--brass); }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.on-ink .breadcrumb { color: var(--text-on-ink-muted); }
.on-ink .breadcrumb a:hover { color: var(--text-on-ink); }

/* Continue-reading block used at the foot of internal pages */
.continue {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--line);
}

.continue__item {
  display: grid;
  gap: 8px;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.continue__label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brass-ink);
}

.continue__title {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  line-height: 1.15;
  transition: transform 0.4s var(--ease);
}

.continue__item:hover .continue__title { transform: translateX(8px); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--ink);
  color: var(--text-on-ink);
  padding-top: clamp(72px, 9vw, 128px);
}

.footer__lead {
  display: grid;
  gap: 32px;
  padding-bottom: clamp(48px, 6vw, 80px);
  border-bottom: 1px solid var(--line-on-ink);
}

.footer__name {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.4vw, 3.6rem);
  font-weight: 400;
  line-height: 1.05;
}

.footer__name em { color: var(--brass-light); }

.footer__grid {
  display: grid;
  gap: 44px;
  padding-block: clamp(48px, 6vw, 72px);
}

.footer__heading {
  margin: 0 0 18px;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--brass-light);
}

.footer__links { list-style: none; display: grid; gap: 4px; }
.footer__links a,
.footer__contact a {
  display: inline-block;
  padding: 6px 0;
  color: var(--text-on-ink-muted);
  text-decoration: none;
  font-size: 0.94rem;
  transition: color 0.25s ease;
}

.footer__links a:hover,
.footer__contact a:hover { color: var(--text-on-ink); }

.footer__links--two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }

.footer__contact { font-style: normal; display: grid; gap: 2px; }
.footer__contact strong { font-weight: 500; font-size: 1rem; color: var(--text-on-ink); margin-bottom: 4px; }

.social { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; }

.social__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-on-ink);
  border-radius: 50%;
  color: var(--text-on-ink-muted);
  cursor: default;
}

.social__icon svg { width: 17px; height: 17px; }

.social__note {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--text-on-ink-muted);
  max-width: 34ch;
}

.footer__notice {
  padding-bottom: 32px;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-on-ink-muted);
  max-width: 88ch;
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  padding-block: 26px 32px;
  border-top: 1px solid var(--line-on-ink);
  font-size: 0.8rem;
  color: var(--text-on-ink-muted);
}

.footer__bottom p { margin: 0; }
.footer__bottom a { color: var(--text-on-ink); text-decoration: none; border-bottom: 1px solid var(--brass); }
.footer__bottom a:hover { color: var(--brass-light); }

/* ==========================================================================
   Motion
   ========================================================================== */
.motion .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--delay, 0s);
}

.motion .reveal.is-visible { opacity: 1; transform: none; }

/* Opacity/scale only: clipping would stop native lazy-loading from starting. */
.motion .reveal-media .figure__media { overflow: hidden; }

.motion .reveal-media .figure__media img {
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.1s var(--ease), transform 1.4s var(--ease);
}

.motion .reveal-media.is-visible .figure__media img { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}

.site-footer .muted { color: var(--text-on-ink-muted); }
.on-ink + .site-footer { border-top: 1px solid var(--line-on-ink); }
