/* =========================
   DESIGN TOKENS
   A field notebook, not an editorial page.
========================= */
:root {
  color-scheme: light;

  --paper: #eef2ea;
  --paper-2: #e3e9df;
  --card: #fcfdf8;
  --ink: #12201e;
  --ink-soft: #35443f;
  --muted: #5a6862;

  --line: rgba(18, 32, 30, 0.16);
  --line-strong: rgba(18, 32, 30, 0.42);
  --grid-dot: rgba(18, 32, 30, 0.15);
  --sketch-ink: #38558c;

  --accent: #1d4ed8;
  --accent-strong: #173ea8;
  --accent-soft: rgba(29, 78, 216, 0.11);
  --accent-2: #b83a1b;
  --accent-2-soft: rgba(184, 58, 27, 0.13);
  --accent-3: #2f6b4f;
  --accent-3-soft: rgba(47, 107, 79, 0.13);

  --highlight: #f6d55c;
  --highlight-ink: #17201a;
  --moss: #2f6b4f;

  --contact-bg: #173ea8;
  --contact-ink: #f4f8ff;
  --contact-muted: #c9d6f5;
  --contact-accent: #f6d55c;

  --font-display: 'Bricolage Grotesque', 'Trebuchet MS', sans-serif;
  --font-body: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;
  --font-hand: 'Caveat', 'Segoe Script', cursive;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 2px;
  --max: 1180px;
}

[data-theme="dark"] {
  color-scheme: dark;

  --paper: #0f1715;
  --paper-2: #16201d;
  --card: #1a2622;
  --ink: #edf2ea;
  --ink-soft: #c5d0c8;
  --muted: #96a49c;

  --line: rgba(237, 242, 234, 0.14);
  --line-strong: rgba(237, 242, 234, 0.38);
  --grid-dot: rgba(237, 242, 234, 0.10);
  --sketch-ink: #9bb4e6;

  --accent: #8fb0ff;
  --accent-strong: #b3c8ff;
  --accent-soft: rgba(143, 176, 255, 0.13);
  --accent-2: #ff8a63;
  --accent-2-soft: rgba(255, 138, 99, 0.14);
  --accent-3: #7fd1a6;
  --accent-3-soft: rgba(127, 209, 166, 0.13);

  --highlight: #f0cf63;
  --highlight-ink: #17201a;
  --moss: #8fbf9f;

  --contact-bg: #1b2f6b;
  --contact-ink: #f2f6ff;
  --contact-muted: #c3d0ee;
  --contact-accent: #ffc08c;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  font-family: var(--font-body);
  background-color: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, var(--grid-dot) 1px, transparent 0);
  background-size: 24px 24px;
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.68;
  overflow-x: hidden;
  transition: background-color 0.45s ease, color 0.45s ease;
}

/* Paper grain over the dot grid */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

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

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

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

ul,
ol {
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Skip link */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10000;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  background: var(--highlight);
  color: var(--highlight-ink);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

/* =========================
   SKETCHBOOK BACKGROUND
========================= */
.site {
  position: relative;
  z-index: 1;
}

.sketch-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  opacity: 0.2;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

[data-theme="dark"] .sketch-bg {
  opacity: 0.16;
}

.sketch-art {
  width: 100%;
  height: 100%;
}

.sketch-art path,
.sketch-art circle {
  fill: none;
  stroke: var(--sketch-ink);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: sketchDraw 2.6s var(--ease) forwards;
}

.sketch-art .sketch-doodles path,
.sketch-art .sketch-doodles circle {
  animation-delay: 0.55s;
}

.sketch-art .sketch-accent,
.sketch-art .doodle-accent {
  stroke: var(--accent-2);
}

.sketch-strokes {
  animation: floatSketch 24s ease-in-out infinite alternate;
  transform-origin: center;
}

.sketch-doodles {
  animation: floatSketch 30s ease-in-out infinite alternate-reverse;
  transform-origin: center;
}

.sketch-notes text {
  fill: var(--accent);
  font-family: var(--font-hand);
  font-size: 23px;
  font-weight: 600;
  opacity: 0;
  animation: fadeSketchNote 1.2s ease 1.6s forwards;
}

.sketch-notes text:nth-child(2n) {
  fill: var(--accent-2);
  font-size: 27px;
}

@keyframes sketchDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes floatSketch {
  from { transform: translate3d(-6px, 4px, 0) rotate(-0.25deg); }
  to { transform: translate3d(8px, -6px, 0) rotate(0.25deg); }
}

@keyframes fadeSketchNote {
  to { opacity: 0.8; }
}

/* =========================
   LAYOUT & TYPOGRAPHY HELPERS
========================= */
.wrap {
  width: min(100% - 64px, var(--max));
  margin-inline: auto;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  line-height: 1.5;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hand {
  font-family: var(--font-hand);
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: 600;
  line-height: 1;
  color: var(--accent-2);
}

.section {
  padding: clamp(72px, 9vw, 118px) 0;
  border-top: 1px solid var(--line);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2.65rem, 5.4vw, 4.55rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: -0.055em;
  margin-bottom: 24px;
}

.section-title em {
  font-style: normal;
  color: var(--highlight-ink);
  background: linear-gradient(
    transparent 57%,
    var(--highlight) 57%,
    var(--highlight) 94%,
    transparent 94%
  );
  padding: 0 0.06em;
  margin: 0 -0.06em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

[data-theme="dark"] .section-title em,
[data-theme="dark"] .hero h1 em {
  background: var(--highlight);
}

.section-intro {
  max-width: 58ch;
  margin-bottom: 42px;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.72;
}

.lead {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.5vw, 1.95rem);
  line-height: 1.32;
  letter-spacing: -0.015em;
  max-width: 34ch;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
}

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

/* Screen-reader only */
.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;
}

/* Scroll progress */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--highlight));
  transition: width 0.08s linear;
}

/* Shared status dot */
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 2.6s ease-out infinite;
}

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 var(--accent-soft); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
