/* billjalouk.com homepage. Plain CSS, no build step.
   Final look chosen by Bill on 2026-11-08: wireframe object, extruded name, drift motion,
   rose accent on a violet-tinted near-black, Fraunces, outlined cards, split layout.
   The arrival's build mode is still random per visit; home.js writes it to html[data-building]. */

@font-face { font-family: "Fraunces"; src: url(/assets/fonts/fraunces-latin.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

/* ---------- tokens ---------- */
:root {
  --bg: #0b0a12;
  --bg-2: #15132a;
  --ink: #f1eef9;
  --muted: rgba(241, 238, 249, 0.56);
  --faint: rgba(241, 238, 249, 0.5);   /* text: 4.8:1 on --bg, the minimum is 4.5:1 */
  --line: rgba(241, 238, 249, 0.1);
  --accent: #ff5c8a;
  --font: "Fraunces";
  --w-thin: 300;
  --w-black: 900;
  --track-tight: -0.02em;
  --pad: clamp(18px, 4vw, 56px);
  --e: min(86vw, 380px);
  --radius: 5px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font), serif;
  font-weight: var(--w-thin);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* a phone held sideways: the content stays clear of the notch (viewport-fit=cover lets the page reach under it).
   Not on the simple pages: the door and the 404 page do not reach under it, and the room has its own layout. */
body:not(.simple) { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
main[tabindex="-1"]:focus { outline: none; }   /* the page itself takes the focus after skip: no ring around everything */

/* ---------- background: three layers so stillness has depth ---------- */
.bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.bg::before {
  content: ""; position: absolute; inset: -10%;
  background:
    radial-gradient(55% 45% at 22% 28%, color-mix(in oklab, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(45% 55% at 84% 78%, color-mix(in oklab, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(120% 90% at 50% 110%, rgba(0, 0, 0, 0.55), transparent 60%),
    linear-gradient(170deg, var(--bg-2), var(--bg) 70%);
}
.bg::after {
  content: ""; position: absolute; inset: 0; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

/* ---------- canvas layout ---------- */
.canvas {
  position: relative;
  min-height: 100svh;
  padding: calc(var(--pad) + 36px) var(--pad) var(--pad);
  display: grid;
  gap: clamp(28px, 5vw, 48px);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "e" "statement" "cards";
  align-content: start;
}
.e { grid-area: e; justify-self: center; }
.statement { grid-area: statement; }
.cards { grid-area: cards; }

@media (min-width: 720px) {
  :root { --e: min(60vw, 440px); }
}
@media (min-width: 1024px) {
  :root { --e: clamp(380px, min(40vw, 58vh), 560px); }
  .canvas {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "e statement" "cards cards";
    align-items: center;
    column-gap: clamp(32px, 5vw, 96px);
    padding-top: var(--pad);
  }
  .statement { align-self: center; }
}
@media (min-width: 1600px) {
  :root { --e: clamp(480px, min(36vw, 62vh), 640px); }
  .canvas { padding: clamp(48px, 4vw, 80px) clamp(56px, 6vw, 140px); }
}

/* ---------- E: the name inside the wireframe ---------- */
.e { position: relative; width: var(--e); height: var(--e); perspective: 1100px; --build: 0; }
html.arrived .e { --build: 1; }
.e-3d { position: absolute; inset: 0; transform-style: preserve-3d; }
.e-frame { position: absolute; inset: 0; transform-style: preserve-3d; }
.e-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.e-name {
  position: absolute; left: 50%; top: 50%; margin: 0;
  transform: translate(-50%, -50%);
  text-align: center;
  font-weight: var(--w-black);
  font-size: calc(var(--e) * 0.115);
  line-height: 0.95;
  letter-spacing: var(--track-tight);
  white-space: nowrap;
  --ex: color-mix(in oklab, var(--accent) 38%, #000);
  text-shadow: 1px 1px 0 var(--ex), 2px 2px 0 var(--ex), 3px 3px 0 var(--ex), 4px 4px 0 var(--ex),
    5px 5px 0 var(--ex), 6px 6px 0 var(--ex), 7px 7px 0 var(--ex), 8px 8px 0 var(--ex),
    12px 16px 32px rgba(0, 0, 0, 0.7);
}
.e-name .l { display: inline-block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.e-status {
  position: absolute; left: 0; right: 0; bottom: -6%;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; align-items: baseline;
  font-size: calc(var(--e) * 0.034);
  color: var(--muted);
  white-space: nowrap;
}
.clock-city { color: var(--faint); }
.clock-time { color: var(--ink); font-variant-numeric: tabular-nums; }
.e-beam {
  display: none; position: absolute; top: -4%; bottom: -4%; width: 2px; z-index: 3;
  left: calc(var(--build) * 100%);
  background: linear-gradient(180deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 18px color-mix(in oklab, var(--accent) 70%, transparent);
}

/* ---------- E motion after arrival: a slow drift ---------- */
@keyframes e-drift {
  from { transform: rotateY(-9deg) rotateX(4deg); }
  to   { transform: rotateY(9deg) rotateX(-4deg); }
}
html.arrived .e-3d { animation: e-drift 12s ease-in-out infinite alternate; }
html.measuring .e-3d { animation: none !important; transform: none !important; transition: none !important; }

/* ---------- E build: how the agents create it. One of four modes per visit.
   home.js writes the mode to html[data-building] and drives --build, --dx, --dy. ---------- */
html:not([data-building]):not(.arrived) .e-3d { opacity: 0; }
[data-building="scan"] .e-3d { clip-path: inset(-6% calc((1 - var(--build)) * 100%) -6% 0); }
html:not(.arrived)[data-building="scan"] .e-beam { display: block; }
[data-building="assemble"] .e-frame { transform: scale(calc(0.3 + 0.7 * var(--build))); opacity: var(--build); }
[data-building="drag"] .e-3d { transform: translate(calc(var(--dx, 0px) * (1 - var(--build))), calc(var(--dy, 0px) * (1 - var(--build)))); }
html.arrived .e-3d, html.arrived .e-frame { clip-path: none; }
html.arrived .e-frame { transform: none; opacity: 1; }

/* ---------- D: statement ---------- */
.statement { max-width: 640px; }
.headline {
  margin: 0;
  max-width: 16ch;
  font-weight: var(--w-black);
  font-size: clamp(40px, 5vw, 84px);
  line-height: 0.98;
  letter-spacing: var(--track-tight);
  text-wrap: balance;
  overflow-wrap: break-word;
  min-height: 1em;
}
.headline .untyped { visibility: hidden; }
.headline .caret { display: inline-block; width: 0.06em; height: 0.85em; margin-left: 0.04em; background: var(--accent); vertical-align: -0.08em; }
.sub {
  margin: 18px 0 0;
  max-width: 36ch;
  font-size: clamp(16px, 1.3vw, 20px);
  color: var(--muted);
}

/* ---------- F: cards. The agents trace each card's rectangle (--trace 1 to 0),
   then the card fills in (--card-in) and its title is written (--text-in). ---------- */
.cards { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card {
  position: relative;
  --trace: 1; --card-in: 0; --text-in: 0;
  display: flex; flex-direction: column; gap: 8px; justify-content: flex-end;
  min-height: 120px; padding: 22px 22px 20px 24px;
  border: 1px solid rgba(241, 238, 249, calc(0.1 * var(--card-in)));
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(241, 238, 249, calc(0.035 * var(--card-in))), rgba(241, 238, 249, calc(0.012 * var(--card-in))));
  transition: border-color 0.25s var(--ease-out), background 0.25s var(--ease-out);
  transform-origin: 30% 110%;
}
html:not(.arrived) .card { transition: none; }
html.arrived .card { --trace: 0; --card-in: 1; --text-in: 1; transform: none; }
.card::before {
  content: ""; position: absolute; left: -1px; top: 20px; width: 2px; height: 28px;
  background: var(--accent); opacity: var(--card-in);
  transition: height 0.3s var(--ease-out), top 0.3s var(--ease-out);
}
.card-trace { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; opacity: calc(1 - var(--text-in)); }
.card-trace path { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: var(--trace); }
html.arrived .card-trace { opacity: 0; }
.card-title { font-weight: var(--w-black); font-size: 24px; line-height: 1; letter-spacing: var(--track-tight); clip-path: inset(-4px calc((1 - var(--text-in)) * 100%) -4px -4px); }

/* ---------- G: Bill Access. An agent draws the corner brackets (--door-frame 1 to 0),
   decodes the bits one by one, and the door flashes once (--door-flash). ---------- */
.access {
  position: absolute; top: calc(var(--pad) * 0.6); right: calc(var(--pad) * 0.8 + env(safe-area-inset-right, 0px)); z-index: 5;
  --door-frame: 1; --door-flash: 0;
  display: inline-flex; align-items: center;
  min-height: 44px; min-width: 44px; padding: 0 14px;
  font-size: 12px; letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  transition: color 0.3s var(--ease-out);
}
html.arrived .access { --door-frame: 0; }
.access-frame { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.access-frame path {
  fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; vector-effect: non-scaling-stroke;
  stroke-dasharray: 1; stroke-dashoffset: var(--door-frame);
  opacity: 0.7; transition: opacity 0.3s var(--ease-out);
}
.access::after {
  content: ""; position: absolute; inset: -10px; border-radius: 6px; pointer-events: none;
  background: radial-gradient(ellipse at center, color-mix(in oklab, var(--accent) 38%, transparent), transparent 70%);
  opacity: var(--door-flash);
}
.access-bits { position: relative; white-space: nowrap; }
.access-bits .bit { opacity: 0; }
html.arrived .access-bits .bit { opacity: 1; }
.access:focus-visible { color: var(--accent); }
.access:focus-visible .access-frame path { opacity: 1; }
@media (hover: hover) {
  .access:hover { color: var(--accent); }
  .access:hover .access-frame path { opacity: 1; }
  .card:hover { border-color: color-mix(in oklab, var(--accent) 45%, var(--line)); background: linear-gradient(180deg, rgba(241, 238, 249, 0.06), rgba(241, 238, 249, 0.02)); }
  .card:hover::before { top: 12px; height: calc(100% - 24px); }
}

/* ---------- agents (arrival only) ---------- */
.agents { position: fixed; inset: 0; z-index: 20; pointer-events: none; overflow: hidden; }
.agent { position: absolute; left: 0; top: 0; will-change: transform; }
.agent::before {
  content: ""; position: absolute; left: -16px; top: -16px; width: 58px; height: 58px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 42%, transparent), color-mix(in oklab, var(--accent) 10%, transparent) 45%, transparent 70%);
}
.agent svg {
  position: relative; display: block; width: 26px; height: 26px; overflow: visible;
  filter: drop-shadow(0 0 5px color-mix(in oklab, var(--accent) 85%, transparent)) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}
.agent-cursor { fill: var(--ink); stroke: var(--accent); stroke-width: 1.4; stroke-linejoin: round; }
.agent-label {
  position: absolute; left: 22px; top: 22px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; line-height: 1.4; white-space: nowrap;
  color: var(--bg); background: var(--accent);
  box-shadow: 0 0 14px color-mix(in oklab, var(--accent) 55%, transparent), 0 2px 8px rgba(0, 0, 0, 0.5);
  font-weight: 600;
}
.agent-2 .agent-label, .agent-5 .agent-label { background: var(--ink); box-shadow: 0 0 14px rgba(241, 238, 249, 0.35), 0 2px 8px rgba(0, 0, 0, 0.5); }
.agent-3 .agent-label, .agent-6 .agent-label { background: color-mix(in oklab, var(--accent) 60%, var(--ink)); }
.agent-4 .agent-label, .agent-7 .agent-label { background: color-mix(in oklab, var(--accent) 80%, #fff); }

/* ---------- pre-arrival state (JS adds html.arrived when done) ---------- */
.sub, .e-status { opacity: 0; }
html.arrived .sub, html.arrived .e-status { opacity: 1; transform: none; }
html.arrived .skip, html.arrived .headline .caret { display: none; }
@media (prefers-reduced-motion: reduce) {
  .e { --build: 1; }
  .e-3d, .e-frame { clip-path: none !important; transform: none !important; opacity: 1 !important; animation: none !important; }
  .card { --trace: 0; --card-in: 1; --text-in: 1; transform: none; }
  .card-trace { opacity: 0; }
  .access { --door-frame: 0; }
  .access-bits .bit { opacity: 1; }
  .sub, .e-status { opacity: 1; transform: none; }
  .skip { display: none; }
  *, *::before, *::after { transition: none !important; }
}

/* ---------- skip: nearly invisible, still a 44px target ---------- */
.skip {
  position: fixed; right: calc(6px + env(safe-area-inset-right, 0px)); bottom: calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  min-width: 44px; min-height: 44px; padding: 0 12px;
  border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 12px; letter-spacing: 0.08em;
  opacity: 0.18; cursor: pointer;
  transition: opacity 0.2s;
}
.skip:hover, .skip:focus-visible { opacity: 0.8; }

/* ---------- pause: two small bars in the corner opposite skip (Bill, 2026-11-20, from three live variants). They stop
   the drift and the turning wire, and the pause holds from page to page (home.js). They come when the arrival ends,
   and they stay away under reduced motion, where nothing moves. ---------- */
.pause {
  position: fixed; left: calc(6px + env(safe-area-inset-left, 0px)); bottom: calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  width: 44px; height: 44px; padding: 16px; border: 0; background: transparent; cursor: pointer;
  color: rgba(241, 238, 249, 0.4);              /* about 3.4:1 on --bg, a control needs 3:1 */
  transition: color 0.2s;
}
.pause:hover, .pause:focus-visible { color: var(--ink); }
.pause svg { display: block; width: 100%; height: 100%; overflow: visible; fill: currentColor; }
.pause-play, html.paused .pause-bars { display: none; }
html.paused .pause-play { display: inline; }
html:not(.arrived) .pause { display: none; }
html.paused .e-3d { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .pause { display: none; } }

/* ---------- simple pages: access.html, skills.html ---------- */
.simple-main {
  min-height: 100svh; display: grid; align-content: center; justify-items: start;
  padding: var(--pad); max-width: 720px; margin: 0 auto; gap: 14px;
}
.simple-cipher { margin: 0; font-size: 12px; letter-spacing: 0.14em; color: var(--accent); }
.simple-title { margin: 0; font-weight: var(--w-black); font-size: clamp(40px, 7vw, 96px); line-height: 0.95; letter-spacing: var(--track-tight); }
.simple-line { margin: 0; color: var(--muted); font-size: 18px; }
.simple-back { display: inline-flex; align-items: center; min-height: 44px; margin-top: 18px; color: var(--accent); border-bottom: 1px solid currentColor; }
