/* Modern CSS reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  /* clip (not hidden) — blocks horizontal scroll without creating a
     scroll container, so position:sticky keeps working */
  overflow-x: clip;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body.nav-open {
  overflow: hidden;
}

/* Subtle paper grain */
body::before {
  content: '';
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.028;
  pointer-events: none;
  z-index: 3000;
}

/* Typography scale */
h1, h2, h3 {
  font-family: var(--font-serif);
}

h4, h5, h6 {
  font-family: var(--font-body);
}

h1 {
  font-size: clamp(2.6rem, 5vw, 4rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

h2 {
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  font-weight: 500;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: 500;
}

p {
  font-size: 1rem;
  max-width: 65ch;
}

a {
  color: var(--ink);
  text-decoration: none;
  transition: color var(--transition-fast);
}

/* Visible keyboard focus, r4-style */
:focus-visible {
  outline: 3px solid var(--vermillion);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--vermillion);
  color: #fff;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-alt);
}
::-webkit-scrollbar-thumb {
  background: rgba(38, 37, 28, 0.28);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--vermillion-deep);
}

/* Layout utilities */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

section {
  padding: var(--spacing-2xl) 0;
  position: relative;
}

/* Section label — small caps with vermillion tick */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--gold);
  margin-bottom: var(--spacing-md);
}
.section-label::before {
  content: '';
  width: 34px;
  height: 1px;
  background: var(--vermillion);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

@media (min-width: 768px) {
  .vertical-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
  }
}

/* Small screens: step the whole rem-based type scale down */
@media (max-width: 640px) {
  html {
    font-size: 15px;
  }
}

.desktop-only {
  display: none;
}
.mobile-only {
  display: none;
}
@media (max-width: 768px) {
  .desktop-only { display: none; }
  .mobile-only { display: block; }
}
