/* ============================================================
   lunar Journal · base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  background-color: var(--ink);
  background:
    radial-gradient(1100px 760px at 82% -8%, rgba(195, 160, 94, 0.10), transparent 62%),
    radial-gradient(900px 700px at 4% 108%, rgba(176, 138, 132, 0.07), transparent 60%),
    radial-gradient(700px 500px at 50% 50%, rgba(37, 28, 48, 0.35), transparent 70%),
    linear-gradient(180deg, #0a080e 0%, #0d0a12 42%, #09070c 100%);
  font-family: var(--serif);
  font-size: var(--fs-body);
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, transparent 52%, rgba(0, 0, 0, 0.34) 100%);
}

body > * { position: relative; z-index: 1; }

::selection {
  background: rgba(195, 160, 94, 0.28);
  color: #fff8e9;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: 0.015em;
  color: var(--paper);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { margin: 0 0 1em; color: var(--paper-2); }
p:last-child { margin-bottom: 0; }

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}

a:hover { color: var(--gold-2); }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

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

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

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

table { border-collapse: collapse; width: 100%; }

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

[hidden] { display: none !important; }

/* ---------- layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap-narrow {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section);
}

.section-sm { padding-block: clamp(40px, 6vw, 72px); }

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

.grid {
  display: grid;
  gap: clamp(18px, 2.4vw, 32px);
}

.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; }
.stack-lg { display: grid; gap: 28px; }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

/* ---------- type utilities ---------- */
.eyebrow,
.label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--gold);
  opacity: 0.7;
}

.label-muted { color: var(--muted); }

.display {
  font-size: var(--fs-display);
  line-height: 1.02;
  letter-spacing: 0.02em;
}

.lead {
  font-size: clamp(18.4px, 1.5vw, 21.6px);
  line-height: 1.85;
  color: var(--paper-2);
}

.muted { color: var(--muted); }
.dim { color: var(--paper-3); }
.gold { color: var(--gold); }
.rose { color: var(--rose); }
.sage { color: var(--sage); }
.sans { font-family: var(--sans); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }
.upper { text-transform: uppercase; letter-spacing: 0.16em; }

.balance { text-wrap: balance; }
.pretty { text-wrap: pretty; }

/* ---------- ornaments ---------- */
.rule {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--gold-3);
}

.rule::before,
.rule::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--line-2), transparent);
}

.rule-diamond {
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  background: var(--gold);
  opacity: 0.75;
}

.starfield {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(232, 221, 198, 0.7), transparent),
    radial-gradient(1px 1px at 34% 68%, rgba(232, 221, 198, 0.45), transparent),
    radial-gradient(1px 1px at 58% 18%, rgba(232, 221, 198, 0.55), transparent),
    radial-gradient(1.4px 1.4px at 72% 54%, rgba(232, 221, 198, 0.55), transparent),
    radial-gradient(1px 1px at 86% 32%, rgba(232, 221, 198, 0.4), transparent),
    radial-gradient(1.2px 1.2px at 92% 76%, rgba(232, 221, 198, 0.35), transparent),
    radial-gradient(1px 1px at 22% 88%, rgba(232, 221, 198, 0.35), transparent);
}

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

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 999;
  padding: 10px 16px;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  transition: top var(--t-fast) var(--ease);
}
.skip-link:focus { top: 16px; }

.divider-dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
  vertical-align: middle;
  margin-inline: 10px;
}

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb {
  background: #33283b;
  border: 3px solid var(--ink);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gold-3); }

/* ---------- page enter ---------- */
.page-main { animation: pageIn 480ms var(--ease) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@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;
  }
  .page-main { animation: none; }
}

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

@media (max-width: 1024px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 760px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .section { padding-block: 64px; }
}

@media (max-width: 420px) {
  .wrap { padding-inline: 18px; }
}
