/* ==========================================================================
   Bovyn — shared chrome
   Paper & oxblood. Editorial hi-fi.
   ========================================================================== */

:root {
  --paper: #f4eee7;
  --paper-deep: #ece1d5;
  --card: #fbf7f1;
  --card-soft: #f7f1e9;
  --ink: #191512;
  --ink-2: #3d352e;
  --muted: #7d7268;
  --line: rgba(25, 21, 18, 0.15);
  --line-strong: rgba(25, 21, 18, 0.32);
  --ox: #7e2f3a;
  --ox-deep: #581c26;
  --ox-soft: #a2555e;
  --green: #2e7d5b;
  --amber: #b8860b;
  --blue: #2f6e9e;
  --grey: #a29689;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", monospace;

  --max: 1240px;
  --gutter: clamp(20px, 4.2vw, 56px);
  --radius: 14px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::selection,
body *::selection {
  background: var(--ox);
  color: var(--paper);
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

h1, h2, h3, h4, p, dl, dd, ul, ol {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

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

/* Film-grain overlay keeps the paper from looking like flat #fff */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 9;
  pointer-events: none;
  opacity: 0.24;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.16'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 6px;
}

.skip:focus {
  left: 12px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease),
    backdrop-filter 0.5s var(--ease);
}

.nav.scrolled {
  background: rgba(244, 238, 231, 0.84);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  backdrop-filter: blur(16px) saturate(1.1);
  border-bottom-color: var(--line);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 14px -8px rgba(88, 28, 38, 0.55);
}

.brand-name {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1;
}

.brand-sub {
  font-size: 9px;
  color: var(--muted);
  border-left: 1px solid var(--line-strong);
  padding-left: 12px;
  letter-spacing: 0.18em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 34px);
}

.nav-links a {
  position: relative;
  font-size: 13.5px;
  color: var(--ink-2);
  padding: 6px 0;
  transition: color 0.25s var(--ease);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--ox);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}

.nav-links a:hover {
  color: var(--ox);
}

.nav-links a:hover::after {
  transform: scaleX(1);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 1.5px;
  width: 0;
  background: var(--ox);
  opacity: 0.55;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0;
  position: relative;
}

.nav-toggle span {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.3s var(--ease), top 0.3s var(--ease);
}

.nav-toggle span:first-child {
  top: 16px;
}

.nav-toggle span:last-child {
  top: 22px;
}

.nav-toggle[aria-expanded="true"] span:first-child {
  top: 19px;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:last-child {
  top: 19px;
  transform: rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 50px;
  padding: 0 24px;
  border-radius: 999px;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease),
    color 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.btn svg {
  width: 15px;
  height: 15px;
  flex: none;
  transition: transform 0.35s var(--ease);
}

.btn:hover svg {
  transform: translateX(3px);
}

.btn-ink {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 12px 26px -16px rgba(25, 21, 18, 0.9);
}

.btn-ink:hover {
  background: var(--ox);
  transform: translateY(-2px);
  box-shadow: 0 18px 32px -16px rgba(88, 28, 38, 0.75);
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: rgba(25, 21, 18, 0.04);
  transform: translateY(-2px);
}

.btn-sm {
  height: 40px;
  padding: 0 18px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Section scaffolding
   -------------------------------------------------------------------------- */

.section {
  position: relative;
  padding: clamp(72px, 9vw, 128px) 0;
}

section[id],
#limits {
  scroll-margin-top: 96px;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(24px, 5vw, 80px);
  align-items: end;
  padding-bottom: clamp(34px, 4vw, 56px);
  border-top: 1px solid var(--line-strong);
  margin-bottom: clamp(30px, 4vw, 52px);
}

.section-index {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ox);
  margin-bottom: 20px;
}

.section-index::after {
  content: "";
  width: 38px;
  height: 1px;
  background: var(--ox);
  opacity: 0.5;
}

.section-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 4.2vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.section-note {
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
  max-width: 38ch;
  justify-self: end;
  padding-bottom: 6px;
}

.section-note strong {
  color: var(--ink-2);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Scroll reveal
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  position: relative;
  background: var(--ink);
  color: #efe7dd;
  padding: clamp(56px, 7vw, 88px) 0 32px;
  overflow: hidden;
}

.footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 85% 0%, rgba(126, 47, 58, 0.32), transparent 60%);
  pointer-events: none;
}

.footer .wrap {
  position: relative;
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 0.7fr)) minmax(0, 0.9fr);
  gap: clamp(28px, 5vw, 64px);
  padding-bottom: clamp(40px, 5vw, 64px);
  border-bottom: 1px solid rgba(244, 238, 231, 0.15);
}

.footer-brand img {
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
  opacity: 0.92;
}

.footer-brand p {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.35;
  max-width: 22ch;
  color: #f4eee7;
}

.footer-brand .mono {
  margin-top: 18px;
  color: rgba(244, 238, 231, 0.42);
  letter-spacing: 0.18em;
}

.footer h4 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(244, 238, 231, 0.42);
  font-weight: 400;
  margin-bottom: 16px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a,
.footer-links span {
  font-size: 14px;
  color: rgba(244, 238, 231, 0.78);
  transition: color 0.25s var(--ease);
}

.footer-links a:hover {
  color: #fff;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 26px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(244, 238, 231, 0.4);
}

.footer-bottom a {
  color: rgba(244, 238, 231, 0.62);
}

.footer-bottom a:hover {
  color: #fff;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .nav-links {
    position: fixed;
    top: 76px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 10px var(--gutter) 22px;
    background: rgba(244, 238, 231, 0.97);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0.35s;
  }

  .nav-links.open {
    opacity: 1;
    transform: none;
    visibility: visible;
  }

  .nav-links a {
    width: 100%;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    font-size: 15px;
  }

  .nav-toggle {
    display: inline-block;
  }

  .section-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .section-note {
    justify-self: start;
  }

  .footer-top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .brand-sub {
    display: none;
  }

  .nav-actions .btn {
    display: none;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-bottom {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
