/* ==========================================================================
   BASE & RESET STYLES
   ========================================================================== */

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

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

body {
  margin: 0;
  padding: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  position: relative;
  min-height: 100dvh;
}

/* Subtle paper texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 28%, rgba(43, 36, 32, 0.025) 0, transparent 40%),
    radial-gradient(circle at 82% 72%, rgba(43, 36, 32, 0.025) 0, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] body::before {
  background-image:
    radial-gradient(circle at 18% 28%, rgba(246, 239, 228, 0.025) 0, transparent 40%),
    radial-gradient(circle at 82% 72%, rgba(246, 239, 228, 0.025) 0, transparent 40%);
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.12;
  margin: 0;
  color: var(--ink);
}

p {
  margin: 0 0 16px;
  color: inherit;
}

a {
  color: inherit;
  text-decoration-skip-ink: auto;
}

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

/* Containers */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.wrap-wide {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 0 24px;
}

.narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 48px 0;
  position: relative;
  z-index: 2;
}

.section.line-top {
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
}

.section-head .sub {
  max-width: 44ch;
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
}

/* Stitched divider line */
hr.stitch {
  border: none;
  border-top: 1.5px dashed var(--line);
  margin: 36px 0;
}
