/* michaelbarber.tech — house system.
   Black ground, white type, one accent. Nothing decorative that isn't carrying meaning,
   and nothing atmospheric that costs information. Targets WCAG 2.2 AA: every text pairing
   below is contrast-checked against #05070C. */

/* ---------- tokens ---------- */
:root {
  --ink:        #05070C;
  --ink-raised: #0B0F18;
  --ink-line:   #1C2333;
  --paper:      #FFFFFF;
  --paper-dim:  #C3CAD9;  /* 11.2:1 on --ink */
  --paper-mute: #8D97AC;  /*  6.4:1 on --ink */
  --accent:     #6E8BFF;  /*  6.9:1 on --ink */
  --accent-soft:#8AA1FF;
  --accent-ink: #0A1026;
  --live:       #5BD6A0;  /* 10.5:1 on --ink */
  --warn:       #FF8B6B;  /*  7.5:1 on --ink */

  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --shell: 76rem;

  /* Fluid type. Scales 320px → 1600px without a single media query. */
  --t-mono:  clamp(0.72rem, 0.68rem + 0.18vw, 0.82rem);
  --t-body:  clamp(1.02rem, 0.97rem + 0.24vw, 1.18rem);
  --t-lead:  clamp(1.18rem, 1.05rem + 0.62vw, 1.55rem);
  --t-h3:    clamp(1.3rem,  1.15rem + 0.72vw, 1.85rem);
  --t-h2:    clamp(1.75rem, 1.4rem  + 1.7vw,  3rem);
  --t-h1:    clamp(2.5rem,  1.5rem  + 4.0vw,  5rem);
  --t-stat:  clamp(2.1rem,  1.5rem  + 2.9vw,  4rem);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* The page commits to dark. Announce it so form controls and scrollbars follow. */
:root { color-scheme: dark; }

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font: 400 var(--t-body)/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* Notched phones: never let content sit under the cutout or home indicator. */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
img, svg, video { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; line-height: 1.05; letter-spacing: -0.03em; font-weight: 800; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* Focus: visible on every interactive thing, never removed. WCAG 2.4.11/2.4.13. */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* ---------- atmosphere ----------
   Two fixed layers: a slow aurora of the accent light, and a film-grain tile.
   Both are pointer-inert, information-free, and frozen under reduced motion. */
.atmosphere {
  position: fixed; inset: -20vmax; z-index: -2; pointer-events: none;
  background:
    radial-gradient(52vmax 38vmax at 16% 4%,  rgba(110,139,255,0.17), transparent 60%),
    radial-gradient(44vmax 34vmax at 86% 12%, rgba(91,214,160,0.05),  transparent 65%),
    radial-gradient(60vmax 46vmax at 62% 96%, rgba(110,139,255,0.09), transparent 62%);
  animation: aurora 46s var(--ease) infinite alternate;
}
@keyframes aurora {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(2vmax, -1.6vmax, 0) scale(1.06); }
}
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/></svg>");
  background-size: 160px 160px;
}

/* ---------- layout primitives ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;          /* the per-device centering, one rule, every width */
  padding-inline: var(--gutter);
}
.measure { max-width: var(--measure); }

.skip {
  position: absolute; left: 0.5rem; top: -100%;
  z-index: 100; padding: 0.75rem 1.25rem;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; border-radius: 0 0 8px 8px; text-decoration: none;
}
.skip:focus { top: 0; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- type helpers ---------- */
.eyebrow {
  font: 600 var(--t-mono)/1.4 var(--mono);
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent);
}
.lead  { font-size: var(--t-lead); line-height: 1.45; color: var(--paper-dim); }
.dim   { color: var(--paper-dim); }
.mute  { color: var(--paper-mute); }
.mono  { font-family: var(--mono); font-size: var(--t-mono); }
.accent{ color: var(--accent); }
.num   { font-variant-numeric: tabular-nums; }

/* ---------- entrances ----------
   Two mechanisms, deliberately separate.

   .rise is pure CSS and is used for the hero — the one thing that must never wait on a
   script to become readable. It runs off the stylesheet, which is render-blocking anyway,
   so the sell paints with the first frame.

   .reveal is scroll-triggered and needs the observer in app.js. It stays visible by
   default and only opts into hiding once .js is set, so a no-script visit still reads a
   complete page. Never put .reveal above the fold. */
.rise {
  animation: rise 0.75s var(--ease) both;
  animation-delay: var(--d, 0s);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

.js .reveal { opacity: 0; transform: translateY(16px); }
.js .reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--d, 0s);
}
@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- header ---------- */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--ink) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ink-line);
  padding-block: 0.85rem;
  padding-top: max(0.85rem, env(safe-area-inset-top));
}
.masthead .shell { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.wordmark { font-weight: 800; letter-spacing: -0.02em; text-decoration: none; font-size: 1.05rem; }
.wordmark .dot { color: var(--accent); }
.nav { display: flex; align-items: center; gap: clamp(0.75rem, 2vw, 1.75rem); }
.nav a { text-decoration: none; color: var(--paper-dim); font-size: 0.95rem; }
.nav a:hover { color: var(--paper); }
.nav .nav-link { position: relative; padding-block: 0.2rem; }
.nav .nav-link::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px; height: 1.5px;
  background: var(--accent); transition: right 0.25s var(--ease);
}
.nav .nav-link:hover::after { right: 0; }
/* Below 52rem the inline links collapse; the CTA always survives. */
@media (max-width: 52rem) { .nav .nav-link { display: none; } }

/* ---------- buttons: 44px min target, WCAG 2.5.8 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px; padding: 0.7rem 1.5rem;
  font: 700 1rem/1 var(--sans); text-decoration: none; text-align: center;
  border: 1px solid transparent; border-radius: 999px; cursor: pointer;
  transition: transform 0.15s var(--ease), background-color 0.15s var(--ease),
              border-color 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover {
  background: var(--accent-soft); transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(110,139,255,0.35);
}
.btn-ghost { background: transparent; color: var(--paper); border-color: #2C3549; }
.btn-ghost:hover { border-color: var(--paper-mute); transform: translateY(-1px); }

/* ---------- hero ----------
   Sized so the portrait AND both buttons clear the fold on a 1280×720 laptop. Measured in
   a real browser, not guessed. The portrait is first in the DOM so the phone layout — a
   single column — leads with the face, which is the whole point of this page. */
.hero { padding-block: clamp(1.75rem, 4.5vh, 4rem) clamp(2.5rem, 7vh, 4.5rem); position: relative; }
.hero-grid { display: grid; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
@media (min-width: 56rem) {
  .hero-grid { grid-template-columns: minmax(260px, 0.72fr) 1.28fr; }
}
.hero-portrait { margin: 0; }
.hero-portrait img {
  width: 100%; max-width: 260px; aspect-ratio: 4 / 5; object-fit: cover;
  /* The face sits high in the frame; crop from the bottom, never through the eyes. */
  object-position: 50% 14%;
  border-radius: 18px; border: 1px solid var(--ink-line);
}
@media (min-width: 56rem) { .hero-portrait img { max-width: none; } }
.hero h1 { font-size: var(--t-h1); max-width: 20ch; margin-top: 0.35rem; }
.hero h1 .accent { color: var(--accent); }
.hero .lead { margin-top: 1.15rem; max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 1.6rem; }
.hero-note { margin-top: 1rem; font-size: 0.92rem; max-width: 56ch; }

/* ---------- bio ---------- */
.bio { max-width: 62ch; margin-top: clamp(1.25rem, 3vw, 2rem); display: grid; gap: 1rem; }

/* ---------- proof strip ---------- */
.proof {
  border-block: 1px solid var(--ink-line);
  background:
    linear-gradient(180deg, rgba(110,139,255,0.05), transparent 40%),
    var(--ink-raised);
  padding-block: clamp(2rem, 5vw, 3.25rem);
}
.proof-grid {
  display: grid; gap: clamp(1.5rem, 4vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
}
.stat dt { font: 600 var(--t-mono)/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--paper-mute); }
.stat dd {
  margin: 0.4rem 0 0; font-size: var(--t-stat); font-weight: 800;
  letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums;
}
.stat dd small { font-size: 55%; font-weight: 700; color: var(--paper-dim); letter-spacing: 0; }
.stat .src { display: block; margin-top: 0.6rem; font-family: var(--mono); font-size: var(--t-mono); color: var(--paper-mute); line-height: 1.5; }

/* ---------- sections ---------- */
.section { padding-block: clamp(3.5rem, 9vw, 7rem); position: relative; }
.section-raised { background: var(--ink-raised); border-block: 1px solid var(--ink-line); }
.section-head { max-width: 54ch; }
.section-head h2 { font-size: var(--t-h2); }
.section-head p { margin-top: 1rem; }

/* ---------- product cards ---------- */
.ships { display: grid; gap: clamp(1.5rem, 4vw, 2.5rem); margin-top: clamp(2rem, 5vw, 3rem); }
.ship {
  display: grid; gap: 0; align-items: stretch;
  grid-template-columns: 1fr;
  border: 1px solid var(--ink-line); border-radius: 18px; overflow: hidden;
  background: linear-gradient(180deg, var(--ink-raised), color-mix(in srgb, var(--ink-raised) 55%, var(--ink)));
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.3s var(--ease);
}
.ship:hover {
  border-color: #2E3A55; transform: translateY(-3px);
  box-shadow: 0 18px 50px rgba(0,0,0,0.45), 0 2px 24px rgba(110,139,255,0.08);
}
@media (min-width: 56rem) {
  .ship { grid-template-columns: 1.05fr 1fr; }
  .ship:nth-child(even) .ship-figure { order: -1; }
}
.ship-body { padding: clamp(1.5rem, 4vw, 2.5rem); display: flex; flex-direction: column; align-items: flex-start; }
.ship-body h3 { font-size: var(--t-h3); }
.ship-body .role { margin-top: 0.6rem; color: var(--paper-dim); font-weight: 600; }
.ship-body .about { margin-top: 0.9rem; color: var(--paper-dim); }
.ship-meta { margin-top: 1.4rem; display: flex; flex-wrap: wrap; gap: 0.6rem 1.25rem; align-items: baseline;
  font-family: var(--mono); font-size: var(--t-mono); color: var(--paper-mute); }
.ship-meta .live { color: var(--live); }
/* A verification link, not a buy button. This page documents the work; Apple sells it. */
.ship-meta .verify {
  font: 600 0.95rem/1.2 var(--sans); color: var(--accent); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  padding-bottom: 2px; min-height: 0;
}
.ship-meta .verify:hover { border-bottom-color: var(--accent); }

/* ---------- dated record entries ---------- */
.entries { display: grid; gap: clamp(1rem, 2.5vw, 1.5rem); margin-top: clamp(1.5rem, 4vw, 2.25rem);
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.entry { border: 1px solid var(--ink-line); border-radius: 14px; padding: 1.5rem;
  background: linear-gradient(180deg, var(--ink-raised), transparent); }
.entry h3 { font-size: 1.15rem; margin-top: 0.5rem; letter-spacing: -0.02em; }
.entry p.dim { margin-top: 0.7rem; font-size: 0.98rem; }
/* The screenshot is the evidence, so it is never cropped: `contain` shows the whole
   application window, letterboxed against the same black the app itself uses. `cover`
   was framing the empty half of Vigil's window and cutting the sidebar off Marketing. */
.ship-figure {
  margin: 0; background: #000; overflow: hidden; position: relative;
  display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center;
  border-top: 1px solid var(--ink-line);
}
@media (min-width: 56rem) { .ship-figure { border-top: 0; border-left: 1px solid var(--ink-line); }
  .ship:nth-child(even) .ship-figure { border-left: 0; border-right: 1px solid var(--ink-line); } }
.ship-figure img {
  width: 100%; height: auto; max-height: 100%; object-fit: contain;
  transition: transform 0.6s var(--ease);
}
.ship:hover .ship-figure img { transform: scale(1.02); }
/* Single column: the image fills the width, so an overlaid caption would sit on top of
   the app UI and be unreadable. It becomes its own bar under the image instead. */
.ship-figure figcaption {
  grid-area: 2 / 1; align-self: end; width: 100%;
  padding: 0.85rem 1.1rem; font-size: 0.85rem; color: var(--paper-dim);
  background: var(--ink-raised); border-top: 1px solid var(--ink-line);
}
/* Two columns: the image is letterboxed, so the caption can float over the black band. */
@media (min-width: 56rem) {
  .ship-figure { grid-template-rows: 1fr; }
  .ship-figure figcaption {
    grid-area: 1 / 1; position: absolute; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.88) 45%);
    border-top: 0;
  }
}

/* ---------- the thesis / how ---------- */
.thesis { display: grid; gap: clamp(1rem, 2.5vw, 1.5rem); margin-top: clamp(2rem, 5vw, 3rem);
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.layer {
  border: 1px solid var(--ink-line); border-radius: 14px; padding: 1.5rem;
  background: linear-gradient(180deg, var(--ink-raised), transparent);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.layer:hover { transform: translateY(-2px); }
.layer h3 { font-size: var(--t-h3); margin-bottom: 0.6rem; }
.layer.is-gap { border-color: var(--accent); background: linear-gradient(180deg, rgba(110,139,255,0.14), transparent); }
.layer .tag { display: inline-block; margin-bottom: 0.9rem; font: 600 var(--t-mono)/1 var(--mono);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--paper-mute); }
.layer.is-gap .tag { color: var(--accent); }

/* ---------- correction ---------- */
.correction { border: 1px solid var(--ink-line); border-left: 3px solid var(--warn); border-radius: 12px;
  padding: clamp(1.5rem, 4vw, 2.5rem); background: var(--ink-raised); margin-top: clamp(2rem, 5vw, 3rem); }
.correction blockquote { margin: 1.25rem 0 0; padding-left: 1.25rem; border-left: 1px solid var(--ink-line);
  font-size: var(--t-lead); line-height: 1.5; color: var(--paper-dim); }
.correction .figure { font-size: var(--t-stat); font-weight: 800; letter-spacing: -0.04em; color: var(--warn);
  text-decoration: line-through; text-decoration-thickness: 3px; font-variant-numeric: tabular-nums; }

/* ---------- contact band ---------- */
.contact-band { text-align: center; }
.contact-band .section-head { margin-inline: auto; }
.contact-band .hero-actions { justify-content: center; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--ink-line); padding-block: clamp(2.5rem, 6vw, 4rem);
  padding-bottom: max(clamp(2.5rem, 6vw, 4rem), env(safe-area-inset-bottom)); color: var(--paper-mute); font-size: 0.92rem; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.footer h2 { font: 600 var(--t-mono)/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--paper-mute); margin-bottom: 0.9rem; }
.footer a { color: var(--paper-dim); text-decoration: none; }
.footer a:hover { color: var(--paper); text-decoration: underline; }
.footer li + li { margin-top: 0.5rem; }
.colophon { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--ink-line); line-height: 1.7; }

/* ---------- legal / prose pages ---------- */
.prose { max-width: 42rem; }
.prose h1 { font-size: var(--t-h2); }
.prose h2 { font-size: var(--t-h3); margin-top: 2.5rem; }
.prose h3 { font-size: 1.1rem; margin-top: 1.75rem; }
.prose p, .prose li { color: var(--paper-dim); }
.prose p + p, .prose h1 + p, .prose h2 + p, .prose h3 + p { margin-top: 0.9rem; }
.prose ul { list-style: disc; padding-left: 1.25rem; margin-top: 0.9rem; }
.prose li + li { margin-top: 0.4rem; }
.prose a { color: var(--accent); }
.contact-card {
  border: 1px solid var(--ink-line); border-radius: 14px; background: var(--ink-raised);
  padding: clamp(1.5rem, 4vw, 2.25rem); margin-top: 2rem;
}
.contact-card .addr { font-family: var(--mono); font-size: clamp(1rem, 2.6vw, 1.35rem); color: var(--paper); word-break: break-word; }
.contact-card .addr a {
  color: var(--paper); text-decoration: none;
  border-bottom: 2px solid var(--accent); padding-bottom: 3px;
}
.contact-card .addr a:hover { color: var(--accent); }

/* ---------- 404 ---------- */
.lost { min-height: 60vh; display: grid; place-content: center; text-align: center; padding-block: 4rem; }
.lost h1 { font-size: var(--t-h1); }
.lost p { margin-top: 1rem; color: var(--paper-dim); }
.lost .hero-actions { justify-content: center; }

/* ---------- print ---------- */
@media print {
  body { background: #fff; color: #000; }
  .masthead, .hero-actions, .skip, .atmosphere, .grain { display: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}

/* ---------- forced colors (Windows high contrast) ---------- */
@media (forced-colors: active) {
  .btn { border: 1px solid ButtonText; }
  .layer, .ship, .correction, .entry, .contact-card { border: 1px solid CanvasText; }
  .atmosphere, .grain { display: none; }
}
