/* Base layer: roles, reset, type, layout, header, footer, buttons, seal.
   Colours come from tokens.css (docs/brand-guidelines.md). Dark is the default
   surface; .on-paper remaps the role variables for long reading. */

:root {
  --font-serif: var(--primitive-fontFamily-heading);
  --font-sans: var(--primitive-fontFamily-body);
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --gutter: clamp(20px, 5vw, 72px);
  --max: 1320px;
  --header-h: 76px;
  --ease: var(--primitive-easing-out-expo);
  --dur: var(--primitive-duration-normal);

  --bg: var(--color-background);
  --fg: var(--color-foreground);
  --fg-muted: var(--color-foreground-muted);
  --rule: var(--color-border-subtle);
  --rule-strong: var(--color-border);
  --accent: var(--color-primary);
  --accent-hover: var(--color-primary-hover);
  --ring: var(--color-ring);
}

.on-paper {
  --bg: var(--color-surface-light-bg);
  --fg: var(--color-surface-light-foreground);
  --fg-muted: var(--color-surface-light-muted);
  --rule: var(--color-surface-light-border);
  --rule-strong: var(--color-surface-light-foreground);
  --accent: var(--color-surface-light-link);
  --accent-hover: var(--color-surface);
  --ring: var(--color-surface-light-link);
  background: var(--bg);
  color: var(--fg);
}

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

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

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-foreground);
  font: 400 var(--primitive-fontSize-body-lg) / var(--primitive-lineHeight-body) var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  line-break: strict;
}

body.menu-open,
html.menu-open body { overflow: hidden; }

[hidden] { display: none !important; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font: inherit; color: inherit; border-radius: 0; }
button { cursor: pointer; }
p, h1, h2, h3, h4, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-synthesis: none; /* only the Medium weight is shipped; never fake a bold */
  text-wrap: balance;
}
h1 { font-size: var(--primitive-fontSize-h1); line-height: var(--primitive-lineHeight-h1); }
h2 { font-size: var(--primitive-fontSize-h2); line-height: var(--primitive-lineHeight-h2); }
h3 { font-size: var(--primitive-fontSize-h3); line-height: var(--primitive-lineHeight-h3); }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 4px; }

.sr-only,
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.skip-link:focus {
  clip: auto;
  width: auto;
  height: auto;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 14px 20px;
  background: var(--color-primary);
  color: var(--color-primary-foreground);
}

.shell {
  width: min(var(--max), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ---------- Small recurring parts ---------- */
.kicker {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  color: var(--fg-muted);
}
.kicker .num,
.num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7em;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
}
.breadcrumb a { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--rule); }
.breadcrumb a:hover { text-decoration-color: currentColor; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 32px;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--primitive-radius-sm);
  color: var(--color-primary-foreground);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-align: center;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-primary-foreground);
}
.btn-ghost { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-ghost:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.on-paper .btn { background: var(--accent); border-color: var(--accent); color: var(--color-foreground); }
.on-paper .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--color-foreground); }

.text-link {
  display: inline-block;
  padding: 6px 0;
  border-bottom: 1px solid currentColor;
  color: var(--accent);
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  transition: color var(--dur) var(--ease), letter-spacing var(--dur) var(--ease);
}
.text-link:hover { letter-spacing: 0.16em; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-background);
  border-bottom: 1px solid var(--color-border-subtle);
}
.site-header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
  height: var(--header-h);
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.brand { display: block; width: 152px; }
.brand-art { width: 100%; height: auto; }

.site-nav {
  display: flex;
  justify-self: center;
  gap: clamp(16px, 2.4vw, 38px);
}
.site-nav a {
  position: relative;
  padding: 8px 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a[aria-current] { color: var(--fg); }
.site-nav a[aria-current]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--color-primary);
}

.header-actions { display: flex; align-items: center; gap: 10px; justify-self: end; }
.verify-btn {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-right: 6px;
  padding: 0 18px;
  border: 1px solid rgb(212 175 90 / 0.5);
  border-radius: 8px;
  color: var(--color-primary);
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.verify-btn:hover { border-color: var(--color-primary); background: rgb(212 175 90 / 0.1); color: var(--color-foreground); }

/* On the home page the header floats transparent over the hero, then turns solid once you scroll.
   Only with JavaScript (has-js): without it the header stays solid so it is never unreadable. */
html.has-js body.is-home .site-header {
  position: fixed;
  right: 0;
  left: 0;
  background: transparent;
  border-bottom-color: transparent;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease);
}
html.has-js body.is-home .site-header.is-scrolled,
html.menu-open body.is-home .site-header {
  background: var(--color-background);
  border-bottom-color: var(--color-border-subtle);
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 1px solid var(--color-border-subtle);
  border-radius: 50%;
  color: var(--color-foreground);
  transition: border-color var(--dur) var(--ease);
}
.icon-btn:hover { border-color: var(--color-primary); }
.icon-search {
  position: relative;
  width: 15px;
  height: 15px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  transform: translate(-1px, -1px);
}
.icon-search::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -3px;
  width: 7px;
  height: 1.5px;
  background: currentColor;
  transform: rotate(45deg);
}
.icon-menu,
.icon-menu::before,
.icon-menu::after {
  display: block;
  position: relative;
  width: 18px;
  height: 1.5px;
  background: currentColor;
}
.icon-menu::before,
.icon-menu::after { content: ""; position: absolute; left: 0; }
.icon-menu::before { top: -6px; }
.icon-menu::after { top: 6px; }
.menu-toggle { display: none; }

.mobile-menu {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 49;
  padding: 12px var(--gutter) 40px;
  overflow-y: auto;
  background: var(--color-background);
}
.mobile-menu a {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
  font: 500 1.5rem / 1.3 var(--font-serif);
}

@media (max-width: 920px) {
  .site-nav,
  .verify-btn { display: none; }
  .menu-toggle { display: inline-grid; }
  .site-header-inner { grid-template-columns: 1fr auto; }
  .brand { width: 132px; }
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  padding: 84px 0 28px;
  overflow: hidden;
  background: var(--color-background);
  border-top: 1px solid var(--color-border-subtle);
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  height: 14px;
  background: url("../img/rule-gold.svg") repeat-x center;
  opacity: 0.5;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: clamp(32px, 6vw, 96px);
}
.foot-logo { display: block; width: min(250px, 70%); }
.footer-seal { width: 128px; margin-top: 40px; }
.foot-column h2 {
  margin-bottom: 22px;
  color: var(--color-primary);
  font: 500 0.8rem / 1.4 var(--font-sans);
  letter-spacing: 0.28em;
}
.foot-column a {
  display: block;
  width: fit-content;
  padding: 7px 0;
  color: var(--fg-muted);
}
.foot-column a:hover { color: var(--fg); }
.foot-bottom {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 68px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  color: var(--fg-muted);
  font-size: 0.82rem;
}

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .site-footer { padding-top: 64px; }
}

/* ---------- Seal (decorative) ---------- */
.seal { color: var(--color-primary); }
.seal-disc { fill: var(--color-surface-glow); }
.seal-line { fill: none; stroke: currentColor; stroke-width: 0.8; }
.seal-text {
  fill: currentColor;
  font: 500 11px var(--font-serif);
  letter-spacing: 0.12em;
}
.seal-rosette { fill: none; stroke: currentColor; stroke-width: 0.35; opacity: 0.85; }

@media (max-width: 767px) {
  body { font-size: 1rem; }
}

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