/* ============================================================
   NAPERIAN — shared design system
   Editorial paper aesthetic, pushed bolder: deeper contrast,
   kinetic motion, layered depth. Brand DNA (Napier / e) intact.
   ============================================================ */

:root {
  /* Surfaces */
  --bg: #EDE7D5;
  --bg-deep: #E4DCC6;
  --paper-hi: #F4EFE1;
  --ink: #131820;
  --ink-soft: #2A2F3A;
  --ink-900: #0C1016;
  --slate: #6B6F7A;

  /* Accent */
  --rust: #B8431A;
  --rust-deep: #8E3414;
  --rust-glow: rgba(184, 67, 26, 0.16);
  --amber: #D97A2B;

  /* Lines */
  --line: rgba(19, 24, 32, 0.14);
  --line-soft: rgba(19, 24, 32, 0.08);

  /* On-dark tokens (for inverted bands) */
  --on-dark: #F1E6D0;

  /* Type */
  --serif: "Fraunces", "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Courier New", monospace;

  /* Motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  /* Depth */
  --shadow-sm: 0 1px 2px rgba(19,24,32,.04), 0 4px 14px rgba(19,24,32,.05);
  --shadow-md: 0 6px 24px rgba(19,24,32,.08), 0 2px 6px rgba(19,24,32,.05);
  --shadow-lg: 0 24px 60px rgba(19,24,32,.14), 0 6px 18px rgba(19,24,32,.08);

  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  position: relative;
}

/* Paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.09 0 0 0 0 0.13 0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Decorative field: faint exponential contour lines drifting behind everything */
.bg-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-field svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.bg-field .curve {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  opacity: 0.05;
  animation: drift 26s ease-in-out infinite alternate;
}
.bg-field .curve:nth-child(2) { animation-duration: 34s; opacity: 0.04; }
.bg-field .curve:nth-child(3) { animation-duration: 30s; opacity: 0.06; stroke: var(--rust); }
@keyframes drift {
  from { transform: translate3d(-2%, 1%, 0); }
  to   { transform: translate3d(2%, -1.5%, 0); }
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--rust); color: var(--bg); }

/* ───────── LAYOUT ───────── */
.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 40px;
  position: relative;
  z-index: 2;
}
@media (max-width: 720px) { .wrap { padding: 0 22px; } }

/* ───────── SCROLL PROGRESS ───────── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--rust), var(--amber));
  z-index: 60;
  will-change: transform;
}

/* ───────── SKIP LINK ───────── */
.skip-link {
  position: absolute;
  left: -9999px; top: 0;
  z-index: 999;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.skip-link:focus {
  left: 16px; top: 16px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
}

/* ───────── NAVIGATION ───────── */
nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(237, 231, 213, 0.72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: padding 0.35s var(--ease), background 0.35s var(--ease), border-color 0.35s var(--ease);
  padding: 22px 0;
}
nav.condensed {
  padding: 12px 0;
  background: rgba(237, 231, 213, 0.9);
  border-bottom-color: var(--line-soft);
  box-shadow: 0 6px 24px rgba(19,24,32,.05);
}

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.brand {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 32px; height: 32px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.4s var(--ease);
  z-index: -1;
}
.brand:hover .brand-mark { color: var(--bg); border-color: var(--ink); }
.brand:hover .brand-mark::after { transform: scale(1); }

.nav-links {
  display: flex;
  gap: 36px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.nav-links a {
  position: relative;
  padding: 4px 0;
  transition: color 0.2s var(--ease);
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1.5px;
  background: var(--rust);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.3s var(--ease);
}
.nav-links a:hover { color: var(--rust); }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-links a.current { color: var(--rust); }
.nav-links a.current::after { transform: scaleX(1); transform-origin: 0 50%; }

.nav-cta {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 11px 20px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  z-index: 0;
  transition: color 0.3s var(--ease);
}
.nav-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: translateY(101%);
  transition: transform 0.4s var(--ease);
  z-index: -1;
}
.nav-cta:hover { color: var(--bg); }
.nav-cta:hover::before { transform: translateY(0); }

/* Mobile toggle */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 999px;
  width: 42px; height: 42px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: background 0.2s var(--ease);
}
.nav-toggle:hover { background: rgba(19,24,32,0.06); }
.nav-toggle .bar,
.nav-toggle .bar::before,
.nav-toggle .bar::after {
  display: block;
  width: 16px; height: 1.5px;
  background: var(--ink);
  transition: transform 0.3s var(--ease), top 0.3s var(--ease), background 0.2s var(--ease);
}
.nav-toggle .bar { position: relative; }
.nav-toggle .bar::before,
.nav-toggle .bar::after { content: ""; position: absolute; left: 0; }
.nav-toggle .bar::before { top: -5px; }
.nav-toggle .bar::after  { top:  5px; }
.nav-toggle[aria-expanded="true"] .bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .bar::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar::after  { top: 0; transform: rotate(-45deg); }

.mobile-menu {
  display: none;
  flex-direction: column;
  padding: 12px 0 18px;
  border-top: 1px solid var(--line-soft);
}
.mobile-menu a {
  padding: 16px 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--line-soft);
  transition: color 0.2s var(--ease), padding-left 0.25s var(--ease);
}
.mobile-menu a:hover { color: var(--rust); padding-left: 8px; }
.mobile-menu a:last-of-type { border-bottom: none; }
.mobile-menu a.current { color: var(--rust); }
.mobile-menu .mobile-cta {
  margin-top: 18px;
  align-self: flex-start;
  border-bottom: none !important;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 12px 22px;
  border: 1px solid var(--ink);
  border-radius: 999px;
}
.mobile-menu .mobile-cta:hover { background: var(--ink); color: var(--bg); padding-left: 22px; }
nav.is-open .mobile-menu { display: flex; animation: menuIn 0.4s var(--ease); }
@keyframes menuIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

@media (max-width: 820px) {
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .nav-toggle { display: inline-flex; }
}

/* ───────── FOCUS STATES ───────── */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 3px;
  border-radius: 4px;
}
.btn-primary:focus-visible,
.btn-ghost:focus-visible,
.nav-cta:focus-visible,
.nav-toggle:focus-visible {
  outline-offset: 4px;
  border-radius: 999px;
}

/* ───────── BUTTONS ───────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 500;
  font-size: 15px;
  font-family: var(--sans);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  z-index: 0;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, var(--rust), var(--rust-deep));
  transform: translateY(101%);
  transition: transform 0.4s var(--ease);
  z-index: -1;
}
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px var(--rust-glow);
}
.btn-primary:hover::before { transform: translateY(0); }
.btn-primary .arrow { display: inline-block; transition: transform 0.3s var(--ease); }
.btn-primary:hover .arrow { transform: translateX(5px); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 26px;
  font-weight: 500;
  font-size: 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  z-index: 0;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease), transform 0.25s var(--ease);
}
.btn-ghost::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: 50% 100%;
  transition: transform 0.35s var(--ease);
  z-index: -1;
}
.btn-ghost:hover { border-color: var(--ink); color: var(--bg); transform: translateY(-3px); }
.btn-ghost:hover::before { transform: scaleY(1); }

/* magnetic wrapper hook */
.magnetic { will-change: transform; }

/* ───────── SECTION SCAFFOLD ───────── */
section {
  padding: 120px 0;
  position: relative;
  border-top: 1px solid var(--line-soft);
}
.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--slate);
  margin-bottom: 56px;
}
.section-label::before {
  content: "";
  width: 24px; height: 1px;
  background: var(--slate);
  transition: width 0.6s var(--ease);
}
.section-label.in::before { width: 48px; }

h2 {
  font-family: var(--serif);
  font-size: clamp(38px, 5.6vw, 76px);
  font-weight: 350;
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 144;
}
h2 em { font-style: italic; color: var(--rust); font-weight: 350; }

/* ───────── INVERTED DARK BAND ───────── */
.band-dark {
  background: var(--ink-900);
  color: var(--bg);
  border-top: none;
  position: relative;
  overflow: hidden;
}
.band-dark h2 { color: var(--paper-hi); }
.band-dark h2 em { color: var(--amber); }
.band-dark .section-label { color: rgba(244,239,225,0.55); }
.band-dark .section-label::before { background: rgba(244,239,225,0.4); }
.band-dark ::selection { background: var(--amber); color: var(--ink-900); }

/* ───────── FOOTER ───────── */
footer {
  padding: 56px 0 44px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--slate);
}
.foot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.foot-row .mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.foot-brand {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.foot-links { display: flex; gap: 24px; flex-wrap: wrap; }
.foot-links a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.2s var(--ease);
}
.foot-links a:hover { color: var(--rust); }

/* ───────── REVEAL ANIMATIONS ───────── */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: calc(var(--d, 0) * 80ms);
}
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal.d1 { --d: 1; }
.reveal.d2 { --d: 2; }
.reveal.d3 { --d: 3; }
.reveal.d4 { --d: 4; }
.reveal.d5 { --d: 5; }

/* Masked line reveal (for headlines) */
.reveal-mask { overflow: hidden; }
.reveal-mask > * {
  display: block;
  transform: translateY(110%);
  transition: transform 1s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 90ms);
}
.reveal-mask.in > * { transform: translateY(0); }

/* word-by-word hero reveal */
.word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}
.word > span {
  display: inline-block;
  transform: translateY(108%);
  transition: transform 0.9s var(--ease-out);
  transition-delay: calc(var(--wd, 0) * 70ms);
}
.headline.in .word > span { transform: translateY(0); }

/* self-drawing svg path */
.draw-path {
  stroke-dasharray: var(--len, 1000);
  stroke-dashoffset: var(--len, 1000);
  transition: stroke-dashoffset 1.8s var(--ease-out);
  transition-delay: 0.2s;
}
.draw.in .draw-path { stroke-dashoffset: 0; }

/* count-up numerals */
.count { font-variant-numeric: tabular-nums; }

/* tilt cards */
.tilt { transform-style: preserve-3d; will-change: transform; transition: transform 0.4s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal-mask > *, .word > span { opacity: 1 !important; transform: none !important; transition: none !important; }
  .draw-path { stroke-dashoffset: 0 !important; transition: none !important; }
  .bg-field .curve { animation: none !important; }
  .scroll-progress { display: none; }
  * { scroll-behavior: auto !important; }
}
