/* ===========================================================
   FAJEM & CO. — BASE STYLES
   Variables, typography, layout primitives, atmospheric layers
   =========================================================== */

:root {
  /* Ink (backgrounds) */
  --ink: #0a0b0e;
  --ink-deep: #05060a;
  --ink-soft: #12141a;
  --ink-card: #101217;
  --ink-line: #1f2228;
  --ink-line-bright: #2b2f38;

  /* Paper (foreground) */
  --paper: #f4efe6;
  --paper-dim: rgba(244, 239, 230, 0.72);
  --paper-mute: rgba(244, 239, 230, 0.52);
  --paper-low: rgba(244, 239, 230, 0.28);
  --paper-faint: rgba(244, 239, 230, 0.12);

  /* Gold (accent) */
  --gold: #c9a86a;
  --gold-bright: #e8c889;
  --gold-soft: rgba(201, 168, 106, 0.14);
  --gold-line: rgba(201, 168, 106, 0.32);
  --gold-glow: rgba(201, 168, 106, 0.18);

  /* Supporting */
  --forest: #3e4a3a;

  /* Typography */
  --serif: "Fraunces", "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;

  /* Layout */
  --max: 1320px;

  /* Safe areas for iPhone */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ========== RESET ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

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

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

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

/* ========== ATMOSPHERIC LAYERS ========== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(201, 168, 106, 0.05), transparent 60%),
    radial-gradient(ellipse 60% 50% at 15% 40%, rgba(62, 74, 58, 0.08), transparent 55%),
    radial-gradient(ellipse 70% 60% at 85% 80%, rgba(201, 168, 106, 0.03), transparent 55%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  z-index: 2;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.cursor-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(201, 168, 106, 0.06) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.6s ease;
  mix-blend-mode: screen;
  will-change: transform, left, top;
}

/* Only show cursor glow on devices with precise pointers */
@media (hover: hover) and (pointer: fine) {
  body:hover .cursor-glow { opacity: 1; }
}

/* ========== CONTAINER ========== */
.container {
  width: min(100% - 48px, var(--max));
  margin: 0 auto;
  position: relative;
  z-index: 10;
}

/* ========== TYPOGRAPHY PRIMITIVES ========== */
.serif { font-family: var(--serif); }
.sans { font-family: var(--sans); }
.gold { color: var(--gold); }
.italic { font-style: italic; }

.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper-mute);
  font-weight: 500;
}

.eyebrow.gold { color: var(--gold); }

/* ========== SECTION LAYOUT PRIMITIVES ========== */
section { position: relative; }

.section-pad {
  padding: 160px 0;
  position: relative;
}

.section-pad-sm {
  padding: 96px 0;
  position: relative;
}

/* ========== REVEAL ON SCROLL ========== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s cubic-bezier(0.2, 0.7, 0.3, 1), transform 1s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.reveal.in { opacity: 1; transform: translateY(0); }
.reveal.d2 { transition-delay: 0.1s; }
.reveal.d3 { transition-delay: 0.2s; }
.reveal.d4 { transition-delay: 0.3s; }
.reveal.d5 { transition-delay: 0.4s; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ========== SECTION HEAD ========== */
.section-head {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 80px;
  align-items: start;
  margin-bottom: 100px;
}

.section-meta {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper-mute);
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-meta .chapter {
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-meta .chapter::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--gold-line);
}

.section-meta .kicker {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--paper-dim);
  text-transform: none;
  letter-spacing: 0.01em;
  line-height: 1.5;
  font-weight: 300;
  max-width: 240px;
}

.section-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(36px, 4.8vw, 68px);
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--paper);
  margin-bottom: 28px;
}

.section-title em { font-style: italic; color: var(--gold); }

.section-lead {
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.65;
  color: var(--paper-dim);
  max-width: 640px;
  font-weight: 400;
}

.section-lead strong { color: var(--paper); font-weight: 500; }

/* ========== KEYFRAMES ========== */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes riseWord {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ping {
  0% { transform: scale(0.8); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes traveler {
  0% { top: -30%; opacity: 0; }
  20% { opacity: 0.6; }
  80% { opacity: 0.6; }
  100% { top: 130%; opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.rise { animation: rise 1s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.3s; }
.delay-3 { animation-delay: 1.0s; }
.delay-4 { animation-delay: 1.15s; }
.delay-5 { animation-delay: 1.4s; }

/* ========== RESPONSIVE PRIMITIVES ========== */
@media (max-width: 1100px) {
  .section-head { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 900px) {
  .section-pad { padding: 96px 0; }
  .section-pad-sm { padding: 72px 0; }
  .section-head { margin-bottom: 56px; }
}

@media (max-width: 560px) {
  .container { width: min(100% - 32px, var(--max)); }
}
