/*
  Sherborn base styles, v2 "Nocturne". Token variables only.
  Load order: brand/fonts/fonts.css -> brand/tokens/tokens.css -> brand/styles/base.css
*/

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

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: var(--font-weight-regular);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Film grain over everything: depth without decoration */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none;
  opacity: var(--grain-opacity); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--color-gold); color: var(--color-night); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-snug);
  margin: 0 0 var(--space-6);
  color: inherit;
  text-wrap: balance;
}
h1 { font-size: clamp(var(--text-4xl), 6.2vw, var(--text-6xl)); line-height: var(--leading-tight); }
h2 { font-size: clamp(var(--text-3xl), 4.4vw, var(--text-5xl)); line-height: 1.08; }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

/* Italic gold accent inside display type: the brand's voice dropping lower */
/* Emphasis inside headlines stays in the headline's own style: no italic or colour change */
h1 em, h2 em, h3 em, .display em { font-style: normal; color: inherit; }

p { margin: 0 0 var(--space-4); max-width: var(--layout-prose); }
.lead { font-size: var(--text-lg); line-height: var(--leading-relaxed); color: var(--text-muted); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.25em; transition: color var(--motion-duration) var(--motion-easing); }
a:hover { color: var(--accent-strong); }

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

hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-12) 0; }

/* Eyebrow: a gold hairline leading into a tracked label */
.eyebrow {
  display: flex; align-items: center; gap: var(--space-4);
  font-family: var(--font-body); font-weight: var(--font-weight-medium); font-size: var(--text-xs);
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase;
  color: var(--accent-text); margin: 0 0 var(--space-8);
}
.eyebrow::before { content: ""; width: var(--space-8); height: 1px; background: currentColor; flex: none; }

.rule { display: block; width: 3rem; height: 1px; background: var(--accent); border: 0; margin: var(--space-8) 0; }

/* Layout */
.container { width: 100%; max-width: var(--layout-container); margin-inline: auto; padding-inline: var(--layout-gutter); }
.section { position: relative; padding-block: var(--layout-section-y); }
.section--raised { background: var(--bg-raised); }
.section--forest { background: var(--bg-forest); }
.section--deep { background: var(--bg-deep); }

/* Daylight: a rare ivory moment, used at most once per page */
.section--light { background: var(--bg-light); color: var(--color-night); }
.section--light .lead { color: var(--color-muted); }
.section--light .eyebrow { color: var(--color-gold-deep); }
.section--light :focus-visible { outline-color: var(--color-gold-deep); }

/* Buttons: gold is the seal on the one action that matters */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-3);
  min-height: 52px; padding: var(--space-3) var(--space-8);
  font-family: var(--font-body); font-weight: var(--font-weight-medium); font-size: var(--text-sm);
  letter-spacing: var(--tracking-label); text-transform: uppercase; text-decoration: none;
  border: 1px solid transparent; border-radius: var(--radius-none); cursor: pointer;
  transition: background-color var(--motion-duration) var(--motion-easing), color var(--motion-duration) var(--motion-easing), border-color var(--motion-duration) var(--motion-easing);
}
.btn--primary { background: var(--color-gold); color: var(--color-night); }
.btn--primary:hover { background: var(--color-gold-light); color: var(--color-night); }
.btn--secondary { background: transparent; color: var(--text); border-color: var(--border-accent); }
.btn--secondary:hover { border-color: var(--color-gold); color: var(--accent-strong); }
.section--light .btn--primary { background: var(--color-night); color: var(--color-ivory); }
.section--light .btn--primary:hover { background: var(--color-forest); color: var(--color-ivory); }

/* Text link with a drawn underline and arrow */
.link-arrow {
  display: inline-flex; align-items: center; gap: var(--space-3); min-height: 44px;
  font-weight: var(--font-weight-medium); font-size: var(--text-sm); letter-spacing: var(--tracking-label);
  text-transform: uppercase; text-decoration: none; color: var(--text);
}
.link-arrow span { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size var(--motion-duration) var(--motion-easing); padding-bottom: 2px; }
.link-arrow:hover span { background-size: 100% 1px; }
.link-arrow svg { transition: transform var(--motion-duration) var(--motion-easing); }
.link-arrow:hover svg { transform: translateX(4px); }

/* Panel: a raised surface with gold corner marks */
.panel { position: relative; background: var(--surface); border: 1px solid var(--border); padding: var(--space-8); }
.panel::before, .panel::after { content: ""; position: absolute; width: var(--space-4); height: var(--space-4); border-color: var(--accent); border-style: solid; transition: width var(--motion-duration) var(--motion-easing), height var(--motion-duration) var(--motion-easing); }
.panel::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.panel::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }
.panel:hover::before, .panel:hover::after { width: var(--space-8); height: var(--space-8); }

/* Roman numerals for sequences */
.numeral { font-family: var(--font-display); font-weight: var(--font-weight-regular); font-size: var(--text-3xl); line-height: 1; color: var(--accent-text); margin: 0 0 var(--space-6); }

/* Scroll reveal (only when JS is present and motion is allowed) */
.js .reveal { opacity: 0; transform: translateY(1.5rem); transition: opacity var(--motion-slow) var(--motion-easing-reveal), transform var(--motion-slow) var(--motion-easing-reveal); transition-delay: var(--delay, 0ms); }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .js .reveal { opacity: 1; transform: none; }
}
