:root {
  --snow: #FAFBFC;
  --paper: #FFFFFF;
  --grid: #DCE4EC;
  --line: #C9D4DF;
  --field: #7A8A9E; /* form borders need 3:1 */
  --ink: #1E3A5F;
  --ink-2: #4A5D75;
  --blue: #3E7CB1;
  --blue-ink: #2C6496;
  --blue-soft: rgba(62, 124, 177, .12);
  --signal: #C83A22;
  --signal-hover: #A93019;
  --fracture: #E0492F;
  --error: #B42318;
  --rock: #E9EEF3;
  --radius: 6px;
  --ruler: 4.5rem;
  --ridge-h: clamp(6rem, 12vw, 10rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
  /* Damped spring: the slab overshoots a little and settles, like mass on friction. */
  --spring: linear(0, .025 2.8%, .101 6.1%, .539 18.9%, .721 25.3%, .849 31.5%, .937 38.1%, .991 45.7%, 1.015 55%, 1.017 63.9%, 1.001 85.9%, 1);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; /* measurements only */
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--snow);
  color: var(--ink);
  font: 400 1rem/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: var(--blue-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
::selection { background: var(--blue); color: var(--paper); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.05; font-weight: 750; letter-spacing: -.03em; text-wrap: balance; }
h1 { font-size: clamp(2.75rem, 8vw, 6rem); letter-spacing: -.04em; }
h2 { font-size: clamp(1.75rem, 3.6vw, 2.75rem); }
h3, .h3 { font-size: 1.125rem; line-height: 1.3; letter-spacing: -.01em; }
p { margin: 0 0 1em; text-wrap: pretty; }
address { font-style: normal; }

.wrap { width: min(100% - 2rem, 72rem); margin-inline: auto; }
.narrow { max-width: 34rem; } /* keeps legal text under ~80 characters per line */
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 20; padding: .5rem 1rem; background: var(--ink); color: var(--paper); border-radius: var(--radius); }
.skip:focus { top: 1rem; }
.skip:hover { color: var(--paper); }
.muted { color: var(--ink-2); }
.hp { position: absolute; left: -9999px; }

/* Navbar */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(250, 251, 252, .82);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--grid);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 4rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 750; text-decoration: none; letter-spacing: -.01em; }
.nav ul { display: flex; gap: .25rem; margin: 0; padding: 0; list-style: none; }
.nav ul a { display: block; padding: .65rem .75rem; border-radius: var(--radius); color: var(--ink-2); font-size: .925rem; text-decoration: none; }
.nav ul a:hover { color: var(--ink); background: var(--blue-soft); }
.nav ul a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px var(--blue); border-radius: 0; }
@media (max-width: 34rem) { .brand span { display: none; } }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 1.25rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: 650 .95rem/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  max-width: 100%;
  overflow-wrap: anywhere;
  transition: background-color .2s, border-color .2s, color .2s;
}
.btn:hover { background: var(--blue-soft); color: var(--ink); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--signal); border-color: var(--signal); color: var(--paper); }
.btn-primary:hover { background: var(--signal-hover); border-color: var(--signal-hover); color: var(--paper); }
.btn:disabled { opacity: .55; cursor: progress; }

/* Status badge: the studio's live station */
.badge { display: inline-flex; align-items: center; gap: .6rem; margin-bottom: 1.5rem; color: var(--ink-2); font-size: .875rem; font-weight: 500; }
.dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.dot::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--blue); }

/* Home: the snow profile. A depth ruler runs down the left edge; sections are layers. */
.profile { position: relative; }
.profile::before {
  content: "";
  position: absolute;
  inset: var(--ridge-h) auto 0 0;
  width: var(--ruler);
  border-right: 1px solid var(--line);
  background:
    repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 60px) right / 1.25rem 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--grid) 0 1px, transparent 1px 12px) right / .6rem 100% no-repeat;
  pointer-events: none;
}
.layer { --pad: clamp(3.5rem, 8vw, 6rem); position: relative; padding-left: var(--ruler); border-top: 1px solid var(--line); }
/* A right-hand gutter holds the hardness bar at every width; wide screens add a label column beside it. */
.layer > .wrap { display: grid; grid-template-columns: 1fr clamp(3rem, 8vw, 4.5rem); column-gap: 1rem; }
.layer > .wrap > :first-child { padding-block: var(--pad); }
@media (min-width: 60rem) { .layer > .wrap { grid-template-columns: 1fr 13rem 14rem; } }
.depth { position: absolute; top: .6rem; left: 0; width: calc(var(--ruler) - 1.6rem); text-align: right; color: var(--ink-2); font: 500 .75rem/1 var(--mono); font-variant-numeric: tabular-nums; }
.layer h2 { max-width: 16ch; }
.layer p { max-width: 36rem; color: var(--ink-2); }

/* Surface slab: ridge, crown fracture, headline */
.surface { padding-top: 0; border-top: 0; overflow: hidden; }
.surface .depth { top: calc(var(--ridge-h) + .6rem); }
.ridge { display: block; height: var(--ridge-h); margin-left: calc(var(--ruler) * -1); width: calc(100% + var(--ruler)); }
.ridge .rock { fill: var(--rock); }
.ridge path { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.ridge .slope { stroke: var(--ink); stroke-width: 1.5; }
.ridge .snowline { stroke: var(--line); stroke-width: 1; }
.slab { --pad: 1.25rem; position: relative; }
.layer > .slab > :first-child { padding-block: clamp(1.25rem, 2.5vw, 1.5rem) var(--pad); }
.slab .badge { margin-bottom: 1rem; }
.slab .actions { margin-top: 1.5rem; flex-wrap: wrap-reverse; } /* the release button stays on the bottom row, at the foot of the fracture */
/* Fracture: the crown steps down the slab's left edge and ends at the release button. */
.fracture { position: absolute; left: -.75rem; width: .75rem; top: calc(var(--ridge-h) * -.35); height: calc(100% + var(--ridge-h) * .35 - var(--pad) - 1.4rem); overflow: visible; }
.fracture path { fill: none; stroke: var(--fracture); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.slab .lead { max-width: 38rem; font-size: clamp(1.1rem, 2vw, 1.3rem); color: var(--ink-2); }

/* Chart column: hand-hardness bar in the gutter, grain symbol and fixed-field band beside it */
/* Bars fill each layer's full height, so the layers stack into one stepped hardness profile. */
.chart { position: relative; grid-column: 2; grid-row: 1 / span 2; }
.hardness { position: absolute; inset: 0 0 0 auto; width: var(--h); background: var(--blue-soft); border-left: 2px solid var(--blue); }
.layer .band { grid-column: 1; grid-row: 2; display: flex; align-items: center; gap: .5rem; max-width: none; margin: calc(1rem - var(--pad)) 0 1.25rem; color: var(--ink-2); font: 500 .75rem/1.4 var(--mono); }
.band svg { flex: none; width: 18px; height: 18px; color: var(--ink); }
@media (min-width: 60rem) {
  .chart { grid-column: 3; grid-row: 1; }
  .layer .band { grid-column: 2; grid-row: 1; align-self: start; justify-content: flex-end; margin: 0; padding-top: .8rem; text-align: right; }
}

/* App list inside the apps layer */
.apps { margin: 2rem 0 0; padding: 0; list-style: none; max-width: 36rem; }
.apps li { display: grid; gap: .1rem 1.5rem; padding: .9rem 0; border-top: 1px solid var(--grid); }
@media (min-width: 40rem) { .apps li { grid-template-columns: 9rem 1fr; } }
.apps strong { font-weight: 700; }
.apps span { color: var(--ink-2); }

/* Ground: rock under the snowpack, with the closing action */
.ground {
  position: relative;
  padding: clamp(4rem, 9vw, 6.5rem) 0 clamp(4rem, 9vw, 6.5rem) var(--ruler);
  border-top: 2px solid var(--ink);
  background: repeating-linear-gradient(135deg, var(--rock) 0 10px, #E2E8EE 10px 11px);
}
.ground .wrap > * { max-width: 36rem; }
.ground p { color: var(--ink-2); }

@media (max-width: 40rem) {
  :root { --ruler: 3.25rem; }
  .depth { font-size: .6875rem; width: calc(var(--ruler) - 1.1rem); white-space: nowrap; }
}

/* Inner pages */
.page-head { position: relative; padding: clamp(6rem, 12vw, 8rem) 0 2rem; border-bottom: 1px solid var(--grid); margin-bottom: 2.5rem; }
.page-head::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: clamp(3rem, 7vw, 5rem);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 160' preserveAspectRatio='none'%3E%3Cpath d='M0 150 260 118 420 128 640 46 760 70 880 20 1000 64 1200 96' fill='none' stroke='%231E3A5F' stroke-width='1.5' vector-effect='non-scaling-stroke' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.page-head h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
.lead { max-width: 38rem; color: var(--ink-2); font-size: clamp(1.05rem, 1.8vw, 1.2rem); }
.prose { padding-bottom: 5rem; }
.prose h2 { margin-top: 2.5rem; font-size: 1.25rem; letter-spacing: -.01em; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .4rem; }

.split { display: grid; gap: 1rem; padding-bottom: 5rem; align-items: start; }
@media (min-width: 56rem) { .split { grid-template-columns: 20rem 1fr; } }
.card { position: relative; overflow: hidden; padding: 1.75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
/* Cursor spotlight, positioned by app.js via --mouse-x / --mouse-y */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(24rem circle at var(--mouse-x, 50%) var(--mouse-y, -30%), var(--blue-soft), transparent 40%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.card:hover::before { opacity: 1; }
.card > * { position: relative; }
.card p { color: var(--ink-2); }
.card > :last-child { margin-bottom: 0; }
.contact dt { color: var(--ink-2); font-size: .8125rem; font-weight: 600; }
.contact dd { margin: 0 0 1rem; overflow-wrap: anywhere; }

/* Form */
.form { display: grid; gap: 1.1rem; }
.row { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.field { display: grid; gap: .4rem; }
label { font-size: .875rem; font-weight: 600; }
input, select, textarea {
  width: 100%;
  padding: .7rem .85rem;
  border: 1px solid var(--field);
  border-radius: var(--radius);
  background: var(--snow);
  color: var(--ink);
  font: inherit;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
textarea { min-height: 10rem; resize: vertical; }
.form .actions { margin-top: .25rem; }
.hint { color: var(--ink-2); font-size: .8125rem; font-weight: 400; }
.status { min-height: 1.5em; margin: 0; color: var(--blue-ink); font-size: .875rem; }
.status.error { color: var(--error); }
::placeholder { color: var(--ink-2); opacity: 1; }

/* Footer */
.footer { padding: 2.5rem 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: .875rem; }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; }
.footer p { margin: 0; }
.footer nav { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--ink); }

/* Motion: one authored moment (fracture, then slab release), plus quiet layer deposits */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .dot::after { animation: pulse 2.4s var(--ease) infinite; }
  .fracture path { stroke-dasharray: 1000; animation: fracture .6s .1s var(--ease) both; }
  /* Longhand: where linear() is unsupported only the easing falls back, not the whole animation. */
  .slab { animation: release 1.2s .55s var(--ease) both; animation-timing-function: var(--spring); }
  .stagger > * { animation: settle .8s var(--ease) both; }
  .stagger > :nth-child(2) { animation-delay: .08s; }
  .stagger > :nth-child(3) { animation-delay: .16s; }
  .js .reveal {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .8s var(--ease) var(--d, 0s), transform .8s var(--ease) var(--d, 0s);
  }
  .js .reveal.in { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@keyframes fracture { from { stroke-dashoffset: 1000; } to { stroke-dashoffset: 0; } }
@keyframes release { from { transform: translate(-56px, -20px); } to { transform: none; } }
@keyframes settle { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pulse { from { transform: scale(1); opacity: .6; } to { transform: scale(3); opacity: 0; } }
