/* ===========================================================
   Pilgrim Wright — Design tokens & base styles
   =========================================================== */

:root {
  /* Palette — heritage parchment + deep navy + burnished gold */
  --paper: #f4ede0;
  --paper-deep: #ece3cf;
  --paper-edge: #ddd3bb;
  --ink: #1a2540;
  --ink-soft: #2d3850;
  --ink-quiet: #4a5570;
  --accent: #b07a44;
  --accent-deep: #8e5e34;
  --accent-soft: #d9b889;
  --text: #2a2520;
  --text-muted: #6b6256;
  --text-faint: #9b9181;
  --line: rgba(26, 37, 64, 0.16);
  --line-soft: rgba(26, 37, 64, 0.08);
  --rule: #2a2520;

  /* Type */
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --font-sans: "DM Sans", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Spacing */
  --gutter: clamp(20px, 4vw, 56px);
  --maxw: 1240px;
  --rhythm: 1.55;
}

[data-palette="forest"] {
  --ink: #1f3a2c;
  --ink-soft: #2d4a3b;
  --ink-quiet: #4d6657;
  --line: rgba(31, 58, 44, 0.16);
  --line-soft: rgba(31, 58, 44, 0.08);
}
[data-palette="charcoal"] {
  --ink: #2a2620;
  --ink-soft: #3b362e;
  --ink-quiet: #56504a;
  --accent: #a26a3a;
  --line: rgba(42, 38, 32, 0.18);
  --line-soft: rgba(42, 38, 32, 0.08);
}

[data-density="compact"] {
  --rhythm: 1.4;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--paper); -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  font-size: 16.5px;
  line-height: var(--rhythm);
  color: var(--text);
  background: var(--paper);
  /* subtle paper texture via repeating gradient */
  background-image:
    radial-gradient(rgba(120, 95, 60, 0.035) 1px, transparent 1px),
    radial-gradient(rgba(120, 95, 60, 0.025) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
  font-feature-settings: "ss01", "ss02", "kern";
}

/* Sticky-side scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

/* Reset typography for components */
h1, h2, h3, h4, h5, h6, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img { max-width: 100%; display: block; }

/* ---------- Type utilities ---------- */
.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 500;
}
.kicker--muted { color: var(--text-muted); }
.kicker--accent { color: var(--accent-deep); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.serif {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.display {
  font-family: var(--font-serif);
  font-weight: 380;
  font-variation-settings: "opsz" 60;
  letter-spacing: -0.022em;
  color: var(--ink);
  line-height: 0.98;
}

.display-italic {
  font-style: italic;
  font-variation-settings: "opsz" 60;
}

.lede {
  font-family: var(--font-serif);
  font-size: clamp(19px, 1.6vw, 23px);
  line-height: 1.45;
  color: var(--ink-soft);
  letter-spacing: -0.005em;
}

.body-l {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text);
}

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

/* ---------- Layout ---------- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.container--wide {
  max-width: 1420px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Horizon-line + compass-mark motif container */
.horizon {
  position: relative;
}
.horizon::before {
  content: "";
  position: absolute;
  inset: 0 var(--gutter) auto var(--gutter);
  height: 1px;
  top: 0;
  background: var(--line);
}
[data-motif="off"] .horizon::before { display: none; }

.compass-mark {
  display: inline-block;
  width: 12px;
  height: 12px;
  position: relative;
  flex: none;
}
.compass-mark::before, .compass-mark::after {
  content: "";
  position: absolute;
  background: currentColor;
}
.compass-mark::before {
  left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-0.5px);
}
.compass-mark::after {
  top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-0.5px);
}
[data-motif="off"] .compass-mark { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 14px 22px;
  border-radius: 2px;
  border: 1px solid transparent;
  transition: transform 0.18s ease, background 0.2s ease, color 0.2s ease, border 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--ink);
  color: var(--paper);
}
.btn--primary:hover { background: var(--ink-soft); }

.btn--secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn--secondary:hover { background: var(--ink); color: var(--paper); }

.btn--ghost {
  color: var(--ink);
  padding: 12px 0;
}
.btn--ghost .arrow {
  width: 22px; height: 1px; background: currentColor; position: relative; transition: width 0.2s;
}
.btn--ghost .arrow::after {
  content: ""; position: absolute; right: 0; top: -3px;
  width: 7px; height: 7px; border-right: 1px solid currentColor; border-top: 1px solid currentColor;
  transform: rotate(45deg);
}
.btn--ghost:hover .arrow { width: 30px; }

.btn--accent {
  background: var(--accent);
  color: var(--paper);
}
.btn--accent:hover { background: var(--accent-deep); }

/* ---------- Inputs ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.field input, .field textarea, .field select {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  transition: border-color 0.2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-bottom-color: var(--ink);
}
.field input::placeholder, .field textarea::placeholder {
  color: var(--text-faint);
}
.field--error input, .field--error textarea, .field--error select {
  border-bottom-color: var(--accent);
}
.field__error {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--accent-deep);
  margin-top: 4px;
}

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s cubic-bezier(.2,.6,.2,1), transform 0.9s cubic-bezier(.2,.6,.2,1);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(244, 237, 224, 0.85);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
.nav--scrolled {
  border-bottom-color: var(--line);
  background: rgba(244, 237, 224, 0.94);
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 420;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.nav__brand-mark {
  width: 28px; height: 28px;
  border: 1px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  color: var(--ink);
  position: relative;
}
.nav__brand-mark::before, .nav__brand-mark::after {
  content: ""; position: absolute; background: var(--ink);
}
.nav__brand-mark::before { left: 50%; width: 1px; top: -3px; height: 3px; transform: translateX(-0.5px); }
.nav__brand-mark::after { left: 50%; width: 1px; bottom: -3px; height: 3px; transform: translateX(-0.5px); }
.nav__brand-mark span { position: relative; z-index: 1; line-height: 1; }

.nav__links {
  display: flex;
  align-items: center;
  gap: 36px;
  font-size: 14.5px;
}
.nav__links a {
  position: relative;
  color: var(--ink);
  padding: 6px 0;
  font-weight: 400;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s;
}
.nav__links a:hover::after, .nav__links a.active::after {
  transform: scaleX(1);
}
.nav__cta {
  display: flex; align-items: center; gap: 16px;
}
.nav__burger {
  display: none;
  width: 36px; height: 36px;
  border: 1px solid var(--ink);
  align-items: center; justify-content: center;
}
.nav__burger span {
  display: block; width: 14px; height: 1px; background: var(--ink); position: relative;
}
.nav__burger span::before, .nav__burger span::after {
  content: ""; position: absolute; left: 0; right: 0; height: 1px; background: var(--ink);
}
.nav__burger span::before { top: -5px; }
.nav__burger span::after { top: 5px; }

@media (max-width: 880px) {
  .nav__links, .nav__cta .btn { display: none; }
  .nav__burger { display: inline-flex; }
}

.mobile-menu {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 24px var(--gutter);
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(.2,.6,.2,1);
}
.mobile-menu.open { transform: translateY(0); }
.mobile-menu__top {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 24px; border-bottom: 1px solid var(--line);
}
.mobile-menu__close {
  width: 36px; height: 36px; border: 1px solid var(--ink); position: relative;
}
.mobile-menu__close::before, .mobile-menu__close::after {
  content: ""; position: absolute; left: 8px; right: 8px; top: 50%; height: 1px; background: var(--ink);
}
.mobile-menu__close::before { transform: rotate(45deg); }
.mobile-menu__close::after { transform: rotate(-45deg); }
.mobile-menu__links {
  display: flex; flex-direction: column; gap: 4px;
  padding: 36px 0;
}
.mobile-menu__links a {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 380;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mobile-menu__links a .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.18em;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 120px;
  background: var(--ink);
  color: var(--paper);
  padding: 96px 0 32px;
}
.footer .container { color: inherit; }
.footer h3, .footer h4 { color: inherit; }
.footer a { color: rgba(244, 237, 224, 0.78); }
.footer a:hover { color: var(--paper); }
.footer__cols {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
}
.footer__brand .display {
  color: var(--paper);
  font-size: 36px;
}
.footer__col h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 18px;
  color: rgba(244, 237, 224, 0.6);
  font-weight: 500;
}
.footer__col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.footer__news {
  display: flex; gap: 0; border-bottom: 1px solid rgba(244, 237, 224, 0.3);
  margin-top: 8px;
}
.footer__news input {
  flex: 1; background: transparent; border: 0; color: var(--paper);
  font-family: var(--font-sans); font-size: 15px; padding: 10px 0; outline: none;
}
.footer__news input::placeholder { color: rgba(244, 237, 224, 0.5); }
.footer__news button {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--paper); padding: 10px 0 10px 16px;
}
.footer__bottom {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid rgba(244, 237, 224, 0.18);
  margin-top: 72px; padding-top: 28px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(244, 237, 224, 0.55);
}
@media (max-width: 760px) {
  .footer__cols { grid-template-columns: 1fr 1fr; gap: 40px; }
  .footer__brand { grid-column: 1 / -1; }
}

/* ---------- Card patterns ---------- */
.card {
  border: 1px solid var(--line);
  padding: 32px;
  background: rgba(255, 255, 255, 0.25);
  position: relative;
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}
.card:hover {
  background: rgba(255, 255, 255, 0.55);
  border-color: var(--ink);
}
.card__num {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-muted);
}
.card__title {
  font-family: var(--font-serif);
  font-size: 28px;
  line-height: 1.1;
  color: var(--ink);
  margin: 18px 0 14px;
  letter-spacing: -0.01em;
}
.card__body {
  font-size: 15.5px; line-height: 1.55; color: var(--text-muted);
}

/* ---------- Image placeholders ---------- */
.placeholder {
  background:
    repeating-linear-gradient(135deg,
      rgba(26, 37, 64, 0.05) 0 1px,
      transparent 1px 9px),
    var(--paper-deep);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
}

/* ---------- Dividers ---------- */
.divider-topo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  color: var(--text-muted);
}
.divider-topo::before, .divider-topo::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.divider-dot {
  display: flex; gap: 2px; align-items: center;
}
.divider-dot::before, .divider-dot::after {
  content: ""; flex: 1; border-top: 1px dashed var(--line); height: 1px;
}

/* ---------- Page-level transitions ---------- */
.page {
  animation: pageIn 0.55s cubic-bezier(.2,.6,.2,1);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Page hero (shared shell) ---------- */
.page-hero {
  padding: 80px 0 48px;
  border-bottom: 1px solid var(--line);
}
.page-hero__meta {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 28px;
  color: var(--text-muted);
}
.page-hero__title {
  font-size: clamp(54px, 7vw, 96px);
}
.page-hero__lede {
  margin-top: 28px;
  max-width: 620px;
}

/* ---------- Topo lines decoration ---------- */
.topo-svg {
  width: 100%;
  height: 100%;
  display: block;
  color: var(--line);
}

/* ---------- Number badges ---------- */
.num-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: inline-flex; gap: 8px; align-items: center;
}

/* ---------- Section spacing ---------- */
.section { padding: 96px 0; }
.section--tight { padding: 64px 0; }
.section--airy { padding: 128px 0; }
[data-density="compact"] .section { padding: 64px 0; }
[data-density="compact"] .section--airy { padding: 88px 0; }

/* ---------- Hover lift utility ---------- */
.lift {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.lift:hover { transform: translateY(-3px); }

/* ---------- Misc small components ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-muted);
  border: 1px solid var(--line);
  padding: 5px 10px;
}

.quote {
  font-family: var(--font-serif);
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.35;
  color: var(--ink);
  letter-spacing: -0.012em;
  font-weight: 380;
}
.quote-mark {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 72px;
  line-height: 0.6;
  color: var(--accent);
}

/* ---------- Toast / form-success ---------- */
.form-success {
  background: var(--ink);
  color: var(--paper);
  padding: 36px 32px;
  display: flex; flex-direction: column; gap: 12px;
  animation: pageIn 0.5s;
}
.form-success h3 { font-family: var(--font-serif); font-size: 28px; color: var(--paper); }

/* ---------- Smooth scroll ---------- */
html { scroll-behavior: smooth; }

/* ---------- Hero exploration shells ---------- */
.hero-shell {
  width: 100%;
  height: 100%;
  background: var(--paper);
  background-image:
    radial-gradient(rgba(120, 95, 60, 0.035) 1px, transparent 1px),
    radial-gradient(rgba(120, 95, 60, 0.025) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  color: var(--text);
  overflow: hidden;
}
.hero-shell .hero-body { flex: 1; }
