/* ==========================================================================
   THE FILED CHARTER — startaup.com motion.css
   --------------------------------------------------------------------------
   Axis motion engine, re-keyed to the engraved charter direction.
   Library-free motion: CSS transitions/keyframes on tokenized speeds and
   easings, plus CSS custom properties written by axis-motion.js (~5KB
   vanilla). No GSAP, no framer-motion, no Lenis, no CDN. All motion gated
   behind html.js (JS present) and prefers-reduced-motion.
   Reveal states only hide content when html.js is set, so a no-JS visitor
   always gets a fully readable page.
   Section 12 appends the charter's signature components (guilloché, seal
   medallion, FILED stamp, bond sheets, stock rules, docket cards).
   ========================================================================== */

/* ==========================================================================
   1. REVEAL ENGINE (IntersectionObserver, driven by axis-motion.js)
   Variants:
     blur-rise   — opacity 0 + blur(10px) + translateY(20%)
                   → clear on --ease-rise. For headlines and hero statements.
     fade-rise   — opacity 0 + translateY(24px). For cards, rows, images.
     scale-settle— opacity 0 + scale(.965). For framed visuals, mockups.
     clip-rise   — vertical wipe via clip-path (curtain-lift from the
                   bottom). For long display statements.
   ========================================================================== */
html.js [data-reveal] {
  opacity: 0;
  transition:
    opacity var(--speed-slow) var(--ease-rise),
    transform var(--speed-slow) var(--ease-rise),
    filter var(--speed-slow) var(--ease-rise),
    clip-path var(--speed-slow) var(--ease-slip);
  will-change: opacity, transform, filter;
}

html.js [data-reveal="blur-rise"] {
  filter: blur(var(--reveal-blur));
  transform: translateY(var(--reveal-distance));
}

html.js [data-reveal="fade-rise"] { transform: translateY(24px); }

html.js [data-reveal="scale-settle"] { transform: scale(.965) translateY(10px); }

html.js [data-reveal="clip-rise"] {
  opacity: 1;                     /* wipe, not fade */
  transform: none;
  clip-path: inset(0 0 100% 0);
}

html.js [data-reveal].is-revealed {
  opacity: 1;
  filter: none;
  transform: none;
  clip-path: inset(0 0 0% 0);
  transition-delay: var(--reveal-delay, 0ms);
}

/* Blur clipping guard — pad the element so blur(10px) + translateY(20%)
   never clips against an overflow-hidden parent. */
.reveal-guard {
  padding: var(--reveal-guard);
  margin: calc(var(--reveal-guard) * -1);
}

/* Stagger: axis-motion.js writes --i on each direct child of [data-stagger];
   --reveal-delay inherits into the child's own reveal. */
[data-stagger] > * { --reveal-delay: calc(var(--i, 0) * var(--stagger, var(--stagger-2))); }

/* ==========================================================================
   2. SCROLL-PROGRESS CONSUMERS (axis-motion.js writes --progress / --page-progress)
   ========================================================================== */
[data-progress] { --progress: 0; }

/* Horizontal hairline progress across a section */
.axis-progress-rail {
  transform: scaleX(var(--progress, 0));
  transform-origin: 0 50%;
  background: var(--sig-500);
  height: 1px;
  width: 100%;
}

/* Vertical progress (fixed page rail) */
.axis-progress-vertical {
  transform: scaleY(var(--progress, 0));
  transform-origin: 50% 0;
}

/* Curtain-lift wipe bound to scroll progress */
[data-clip="wipe-up"] {
  clip-path: inset(0 0 calc((1 - var(--progress, 0)) * 100%) 0);
}

/* Parallax layers — axis-motion.js writes --shift. Apply to WRAPPER layers
   only — never combine with [data-reveal] on the same element. */
[data-parallax] {
  transform: translate3d(0, calc(var(--shift, 0px) * var(--parallax-amount, .2)), 0);
  will-change: transform;
}

/* ==========================================================================
   3. EDGE-HIGHLIGHT CARDS — inner lamp spotlight at --mx/--my plus a border
   signal whose alpha rises near any edge (--edge-int from axis-motion.js).
   ========================================================================== */
[data-edge] {
  position: relative;
  border: 1px solid var(--border-thin);
  transition: border-color var(--speed-fast) var(--ease-settle),
              background var(--speed-fast) var(--ease-settle),
              box-shadow var(--speed-fast) var(--ease-settle);
}

[data-edge] > * { position: relative; z-index: 1; }

/* inner lamp */
[data-edge]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity var(--speed-regular) var(--ease-settle);
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%),
              var(--edge-lamp), transparent 70%);
}

/* border signal — proximity-driven alpha */
[data-edge]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  border: 1px solid var(--sig-500);
  opacity: calc(var(--edge-int, 0) * .55);
  transition: opacity var(--speed-quick) var(--ease-leave);
}

@media (hover: hover) and (pointer: fine) {
  [data-edge]:hover::before { opacity: 1; }
  [data-edge]:hover { box-shadow: var(--shadow-medium); }
}

/* ==========================================================================
   4. PILL CTA — dot-wipe ("iris") hover: the iris starts at the label's
   left (18%), grows radially to fill, text rides above it.
   ========================================================================== */
.pill {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-weight: var(--w-medium);
  font-size: var(--text-small);
  letter-spacing: -.006em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--speed-regular) var(--ease-settle),
              color var(--speed-regular) var(--ease-settle),
              border-color var(--speed-regular) var(--ease-settle),
              box-shadow var(--speed-regular) var(--ease-settle);
}

.pill > * { position: relative; z-index: 1; }
.pill-sm { height: var(--pill-sm); padding: 0 1.05rem; font-size: var(--text-mini); }
.pill-md { height: var(--pill-md); padding: 0 1.5rem; }
.pill-lg { height: var(--pill-lg); padding: 0 2rem; font-size: 0.9375rem; }

.pill-primary { background: var(--cta-bg); color: var(--cta-text); box-shadow: var(--shadow-stack); }
.pill-primary::after {
  content: "";
  position: absolute;
  left: 18%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: var(--radius-circle);
  background: var(--cta-wipe);
  transform: scale(0);
  transition: transform var(--speed-slow) var(--ease-settle);
  z-index: 0;
}
.pill-primary:hover { background: var(--cta-hover); }
.pill-primary:active { transform: translateY(1px); }
@media (hover: hover) and (pointer: fine) {
  .pill-primary:hover::after { transform: scale(48); }
}

.pill-ghost {
  background: var(--cta-secondary-bg);
  border-color: var(--cta-secondary-border);
  color: var(--cta-secondary-text);
}
.pill-ghost:hover { border-color: var(--border-strong); background: var(--lift-1); }

/* ==========================================================================
   5. THIN-UNDERLINE LINK — .05em gradient underline that GROWS from the left
   ========================================================================== */
.u-link {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-size: 0% 0.05em;
  background-position: 0 96%;
  text-decoration: none;
  padding-bottom: .12em;
  transition: background-size var(--speed-regular) var(--ease-settle);
}
.u-link:hover,
.u-link:focus-visible { background-size: 100% 0.05em; }
.u-link-static { background-size: 100% .05em; }

/* ==========================================================================
   6. MARQUEE — proof strip. axis-motion.js duplicates the track content to
   exactly two identical halves for a seamless -50% loop.
   ========================================================================== */
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex;
  align-items: center;
  gap: 3rem;
  width: max-content;
  animation: axis-marquee var(--marquee-duration, 30s) linear infinite;
  will-change: transform;
}
@keyframes axis-marquee { to { transform: translateX(-50%); } }
.marquee:hover .marquee-track { animation-play-state: paused; }

/* ==========================================================================
   7. PRELOADER — mono counter 000→100 over ~750ms with a hairline fill,
   then a curtain lift. Hidden without JS; skipped under reduced motion.
   ========================================================================== */
.preloader { display: none; }
html.js .preloader {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  background: var(--bg-canvas);
  transition: transform .55s var(--ease-slip);
}
html.js.preloader-done .preloader { transform: translateY(-100%); }
.preloader-counter {
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: var(--w-regular);
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
.preloader-hairline {
  width: 220px;
  height: 1px;
  background: var(--border-solid);
  overflow: hidden;
}
.preloader-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--sig-500);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.preloader-word {
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: var(--text-4);
}

/* ==========================================================================
   8. HEADER — fixed, transparent at top, blur + hairline after scroll
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  backdrop-filter: blur(var(--header-blur));
  -webkit-backdrop-filter: blur(var(--header-blur));
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color var(--speed-quick) var(--ease-settle),
              border-color var(--speed-quick) var(--ease-settle);
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg-0) 82%, transparent);
  border-bottom-color: var(--border-thin);
}

/* ==========================================================================
   9. FIXED SCROLL RAIL — fixed right progress rail
   ========================================================================== */
.scroll-rail {
  position: fixed;
  right: 12px;
  top: 50%;
  width: var(--rail-width);
  height: 20vh;
  transform: translateY(-50%);
  background: var(--border-thin);
  border-radius: var(--radius-pill);
  overflow: hidden;
  z-index: 90;
}
.scroll-rail-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--sig-500);
  transform: scaleY(var(--page-progress, 0));
  transform-origin: 50% 0;
}

/* ==========================================================================
   10. SCROLL CUE — restrained nudge (3s loop, transform only)
   ========================================================================== */
@keyframes axis-nudge {
  0%, 100% { transform: translateY(0); opacity: .55; }
  50% { transform: translateY(5px); opacity: 1; }
}
.scroll-cue-arrow { animation: axis-nudge 3s cubic-bezier(.1, 0, .1, 1) infinite; }

/* ==========================================================================
   11. HONEST DEFAULTS — reduced motion + no hover + no JS
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html.js .preloader { display: none; }
  html.js [data-reveal] {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
    clip-path: none !important;
    transition: none !important;
  }
  .marquee-track { animation: none; }
  .scroll-cue-arrow { animation: none; }
  [data-parallax] { transform: none !important; }
}

@media (hover: none) {
  [data-edge]::before,
  [data-edge]::after { display: none; }
}

/* ==========================================================================
   12. THE FILED CHARTER — signature components
   Dark engraved ground, bond-paper certificates, brass rules, the vermilion
   rubber-stamp FILED mark. All graphics are inline SVG in site palette.
   ========================================================================== */

/* 12.1 Charter hero — dark pine ground carrying the guilloché field */
.charter-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-1) 100%);
  padding-top: calc(var(--header-height) + var(--space-6));
  padding-bottom: var(--space-7);
}
.guilloche {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .55;
}
.guilloche svg { width: 100%; height: 100%; display: block; }
.charter-hero-inner { position: relative; z-index: 1; }

/* 12.2 Bond-paper certificate card */
.bond-sheet {
  position: relative;
  background:
    repeating-linear-gradient(0deg,
      rgba(26, 23, 18, 0.018) 0 1px,
      transparent 1px 26px),
    var(--paper-bg);
  color: var(--paper-ink);
  border: 1px solid var(--paper-rule);
  box-shadow: var(--shadow-stack);
  padding: clamp(1.5rem, 3.5vw, 3.5rem);
}
/* double stock rule inside the sheet */
.stock-rule {
  border-top: 1px solid var(--paper-rule);
  border-bottom: 3px double var(--paper-rule);
  padding-block: var(--space-3);
}

/* 12.3 Embossed seal medallion */
.seal-medallion {
  width: clamp(120px, 16vw, 210px);
  height: clamp(120px, 16vw, 210px);
  border-radius: var(--radius-circle);
  display: grid;
  place-items: center;
  position: relative;
  background: radial-gradient(circle at 50% 38%,
      var(--bg-4) 0%, var(--bg-5) 55%, #e4dcc2 100%);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.55),
    inset 0 -6px 14px rgba(139, 98, 48, 0.22),
    0 6px 18px rgba(12, 28, 21, 0.35);
}
.seal-medallion svg { width: 78%; height: 78%; display: block; }
.seal-ribbon {
  position: absolute;
  inset: 7%;
  border-radius: var(--radius-circle);
  border: 1px solid rgba(138, 98, 48, 0.55);
  pointer-events: none;
}

/* 12.4 Vermilion rubber-stamp FILED mark */
.filed-stamp {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: var(--w-bold);
  font-size: clamp(0.9rem, 1.6vw, 1.35rem);
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--action-1);
  border: 3px double currentColor;
  border-radius: 4px;
  padding: .45em .7em .4em 1em; /* trailing space balances letterspacing */
  transform: rotate(-6deg);
  opacity: .88;
  -webkit-mask-image: radial-gradient(circle at 30% 60%, #000 72%, rgba(0, 0, 0, 0.6) 78%, #000 86%, rgba(0, 0, 0, 0.45) 92%, #000 98%);
  mask-image: radial-gradient(circle at 30% 60%, #000 72%, rgba(0, 0, 0, 0.6) 78%, #000 86%, rgba(0, 0, 0, 0.45) 92%, #000 98%);
}

/* 12.5 Topic docket cards — stock-rule frames on dark ground */
.docket-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: color-mix(in srgb, var(--bg-1) 78%, transparent);
  border: 1px solid var(--border-thin);
  border-radius: var(--radius-2);
  padding: clamp(1.5rem, 2.6vw, 2.5rem);
  transition: transform var(--speed-regular) var(--ease-settle),
              border-color var(--speed-regular) var(--ease-settle),
              box-shadow var(--speed-regular) var(--ease-settle);
}
.docket-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid var(--border-thin);
  border-radius: calc(var(--radius-2) - 6px);
  pointer-events: none;
}
.docket-card:hover {
  transform: translateY(-4px);
  border-color: var(--sig-500);
  box-shadow: var(--shadow-medium);
}
.docket-num {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  letter-spacing: .18em;
  color: var(--sig-500);
}

/* 12.6 Signature line — ink flourish under the ruling */
.signature-line {
  display: block;
  width: clamp(180px, 24vw, 300px);
  height: auto;
  margin-top: var(--space-3);
}

/* 12.7 Proof rail (the ledger of filings) */
.proof-rail {
  border-top: 1px solid var(--border-thin);
  border-bottom: 1px solid var(--border-thin);
  background: var(--bg-0);
  padding-block: var(--space-4);
}
.proof-item {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: max-content;
}
.proof-value {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
.proof-key {
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: var(--text-4);
}

/* 12.8 Statute citation block — the article's legal spine */
.cite-block {
  border-left: 2px solid var(--sig-500);
  border-top: 1px solid var(--paper-rule);
  border-bottom: 1px solid var(--paper-rule);
  background: var(--bg-5);
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  border-radius: 0 var(--radius-2) var(--radius-2) 0;
}
.cite-block p {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-size: var(--title-3);
  line-height: 1.35;
  color: var(--ink-1);
}
.cite-block cite {
  display: block;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: var(--text-mini);
  letter-spacing: .08em;
  color: var(--ink-3);
}

/* 12.9 Article body — bond-paper reading sheets */
.article-body {
  background: var(--bg-3);
  color: var(--ink-1);
  border-radius: var(--radius-3);
  border: 1px solid var(--paper-rule);
  box-shadow: var(--shadow-stack);
  padding: clamp(1.75rem, 4.5vw, 4.5rem);
}
.article-body h2 {
  font-family: var(--font-display);
  font-weight: var(--w-book);
  font-size: var(--title-1);
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--ink-1);
  margin: var(--space-5) 0 var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--paper-rule);
}
.article-body h2:first-child { border-top: 0; padding-top: 0; }
.article-body h3 {
  font-family: var(--font-sans);
  font-weight: var(--w-demi);
  font-size: var(--title-3);
  color: var(--ink-1);
  margin: var(--space-4) 0 var(--space-2);
}
.article-body p {
  margin: 0 0 var(--space-3);
  color: var(--ink-2);
  max-width: 72ch;
}
.article-body ul { margin: 0 0 var(--space-3); padding-left: 1.4rem; }
.article-body li { margin-bottom: var(--space-2); color: var(--ink-2); }
.article-body a {
  color: var(--action-2);
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-size: 0% 0.05em;
  background-position: 0 96%;
  padding-bottom: .12em;
  transition: background-size var(--speed-regular) var(--ease-settle);
}
.article-body a:hover,
.article-body a:focus-visible { background-size: 100% 0.05em; }

/* 12.10 Byline block under the article heading */
.byline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--paper-rule);
  margin-bottom: var(--space-4);
}
.byline-photo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-circle);
  border: 1px solid var(--paper-rule);
  object-fit: cover;
}
.byline-name { font-family: var(--font-display); font-size: var(--title-3); color: var(--ink-1); }
.byline-meta { font-family: var(--font-mono); font-size: var(--text-micro); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
