:root {
  --bg: #f5efe6;
  --text: #1a1a1a;
  --accent: #ff5500;
  --line-stroke: currentColor;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 2rem;
  --space-4: 4rem;
  --space-5: 8rem;
  --max-width: 72rem;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
img, svg, picture { display: block; max-width: 100%; }

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin-inline: auto;
  padding: var(--space-3) var(--space-2);
}

/* ─── Lines layer ────────────────────────────────────────────────── */
/* Fixed overlay sitting behind page content. The SVG element extends
   beyond the viewport on every side so lines authored outside the
   visible 1200×800 "page area" have a render target — those lines
   live in the off-canvas margin until scroll-triggered translates
   slide them in.
   viewBox: -600 -400 2400 1600
     central 1200×800 = the visible page area
     extra 600px each side horizontally, 400px each side vertically */

#lines-layer {
  position: fixed;
  /* v0.8.18: every vw/vh dimension is multiplied by --zoom-scale
     so the layer's CSS-px box stays constant across browser
     zoom levels. vw shrinks in CSS px as zoom grows, --zoom-scale
     (= current zoom factor, set by app.js) cancels that out. A
     constant CSS box means a constant viewBox→CSS mapping, which
     matches how text behaves: HTML text positions don't change
     in CSS coords with zoom, only in physical px. Default = 1
     so the rule is a no-op until app.js writes the variable.

     transform: translateX compensates for .layout's horizontal
     slide under zoom — centered-column layouts (max-width +
     margin-inline:auto) shift toward the viewport edges in CSS
     coords as the viewport CSS width shrinks. Default = 0px. */
  left:   calc(-50vw * var(--zoom-scale, 1));
  top:    calc(-50vh * var(--zoom-scale, 1));
  width:  calc(200vw * var(--zoom-scale, 1));
  height: calc(200vh * var(--zoom-scale, 1));
  transform: translateX(var(--layout-shift-x, 0px));
  /* Opt out of the global `svg { max-width: 100% }` rule — otherwise
     this SVG gets clamped to viewport width and the off-page area on
     the right gets hidden, which shifts every drawn line leftward and
     distorts the aspect ratio. */
  max-width: none;
  max-height: none;
  pointer-events: none;
  z-index: 0;
}
#lines-layer path {
  fill: none;
  stroke: var(--line-stroke);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  /* Transforms (translate + rotate) are written directly to each
     path's SVG `transform` attribute by the runtime, with `rotate`
     using its built-in `rotate(angle, cx, cy)` origin parameter.
     No CSS transform-origin needed here. */
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); margin-bottom: var(--space-3); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); margin-bottom: var(--space-2); }
p  { margin-bottom: var(--space-2); max-width: 38em; }

a { color: inherit; }

/* ─── Round-rect button ──────────────────────────────────────────── */
/* Ported from reference style.css L96–156. Renamed .button → .rr-button.
   On hover, an accent-colored circle scales up from the center and
   inflates past the button bounds, filling the pill. The width,
   height, and corner radius can each be overridden per instance via
   the --rr-width / --rr-height / --rr-radius custom properties (set
   from the snippet's `width` / `height` / `cornerRadius` params). */

.rr-button {
  /* Fallbacks act as the design default. Pass-through happens
     naturally when the snippet doesn't set the custom prop. */
  width:  var(--rr-width,  auto);
  height: var(--rr-height, auto);
  padding: 0.5rem 1.5rem;
  font-style: italic;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--rr-radius, 2rem);
  transition: color 0.3s ease-in-out;
  z-index: 1;
}
.rr-button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  border: 1px solid var(--text);
  border-radius: inherit;
}
.rr-button::after {
  content: "";
  display: block;
  background-color: var(--accent);
  width: 100%;
  padding-bottom: 100%;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  z-index: -1;
}
.rr-button:hover {
  color: white;
}
.rr-button:hover::after {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
.rr-button:active {
  filter: brightness(95%);
}
@media (max-width: 1000px) {
  .rr-button { padding-block: 0.75rem; }
}

/* ─── Scatter buttons (circle + ellipse) ─────────────────────────── */
/* Ported + simplified from reference .project_link rules.
   Scroll-scatter and drag-with-inertia are added in app.js.
   The wrapping anchor has pointer-events:none on its outer shell so
   the layout container doesn't block; the inner .shape is the actual
   interactive surface. Two shape kinds: .c-button (circle, --rx=--ry)
   and .e-button (ellipse, distinct --rx and --ry). Both share .scatter-btn
   for layout + behavior wiring. */

.c-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0 var(--space-5);
  margin: var(--space-3) 0;
  position: relative;
  z-index: 2;
}
@media (max-width: 1000px) {
  .c-buttons { grid-template-columns: 1fr; }
}

.scatter-btn {
  /* --scrub-x / --scrub-y are written by app.js as scroll progresses.
     They translate the inner shape + text, leaving the anchor itself
     free for Draggable to control. The two transforms compose so
     scroll-drift and user-drag run simultaneously. */
  --scrub-x: 0px;
  --scrub-y: 0px;
  --rx: 5rem;
  --ry: 5rem;
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  pointer-events: all;
  will-change: transform;
  cursor: grab;
}
.c-button { aspect-ratio: 1 / 1; border-radius: 50%; }
.e-button { /* aspect set by inner shape; no anchor constraint */ }
.scatter-btn:active { cursor: grabbing; filter: brightness(95%); }

.scatter-btn .shape {
  position: absolute;
  inset: 50% 0 0 50%;
  width:  calc(var(--rx) * 2);
  height: calc(var(--ry) * 2);
  margin: calc(var(--ry) * -1) 0 0 calc(var(--rx) * -1);
  transform: translate(var(--scrub-x), var(--scrub-y));
  border: 1px solid var(--text);
  border-radius: 50%;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.scatter-btn .shape::after {
  content: "";
  display: block;
  background-color: var(--accent);
  width: calc(100% + 4px);
  padding-bottom: calc(100% + 4px);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  z-index: 1;
}
.scatter-btn:hover { color: white; }
.scatter-btn:hover .shape::after {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.scatter-btn .text {
  position: absolute;
  inset: 0;
  transform: translate(var(--scrub-x), var(--scrub-y));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}
.scatter-btn .title { white-space: nowrap; }
.scatter-btn .subtitle { font-style: italic; font-size: 0.875rem; }

@media (max-width: 1000px) {
  .scatter-btn {
    width: 12rem; max-width: 100%;
    margin-inline: auto;
    transform: translate(0, 0) !important;
  }
}
