/* billjalouk.com CV page. Plain CSS, no build step. Tokens and background are the homepage's (home.css).
   Decided by Bill on 2026-11-08: the drawn map built by the agents on load, the route drawing itself with
   the scroll, an order toggle and a Work / Education switch above the list, email and LinkedIn under the name.
   Scroll-driven animations where the browser has them, a class-based fallback otherwise, nothing moving
   under reduced motion. */

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

/* ---------- tokens (home.css) ---------- */
: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);
  --radius: 5px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --map-top: 42svh;          /* phone: height of the pinned map */
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; scroll-behavior: smooth; }
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) */
  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 (home.css) ---------- */
.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;
}

/* ---------- home link, top left ---------- */
.home {
  position: fixed; top: 8px; left: calc(var(--pad) - 10px + env(safe-area-inset-left, 0px)); z-index: 30;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  font-weight: var(--w-black); font-size: 15px; letter-spacing: var(--track-tight);
  color: var(--muted); transition: color 0.2s;
}
.home:hover, .home:focus-visible { color: var(--ink); }

/* ---------- layout: the map is pinned, the text scrolls past it ---------- */
.cv { position: relative; }
.map-col { display: contents; }                 /* phone: the map sticks to the whole page */
.map {
  position: sticky; top: 0; z-index: 10;
  height: var(--map-top);
  display: grid; place-items: center;
  padding: 50px var(--pad) 10px;
  background: var(--bg);
}
.map::after {                                    /* text dissolves under the map instead of being cut */
  content: ""; position: absolute; left: 0; right: 0; bottom: -28px; height: 28px; pointer-events: none;
  background: linear-gradient(180deg, var(--bg), transparent);
}
.map-box { position: relative; height: 100%; max-width: 100%; }
.text-col { padding: 28px var(--pad) var(--pad); max-width: 640px; }

@media (min-width: 1024px) {
  .cv { display: grid; grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr); align-items: stretch; }
  .map-col { display: block; }
  .map { height: 100svh; padding: clamp(32px, 7vh, 80px) clamp(16px, 2vw, 40px) clamp(32px, 7vh, 80px) var(--pad); background: transparent; }
  .map::after { display: none; }
  .map-box { width: 100%; height: auto; max-height: 100%; }
  .text-col { padding: 16svh clamp(32px, 6vw, 120px) 12vh 0; max-width: 680px; }
}
@media (min-width: 1600px) {
  .cv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .text-col { padding-left: clamp(0px, 2vw, 40px); }
}

/* ---------- the map pieces ---------- */
.land, .route { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; display: block; }
.land {
  -webkit-mask-image: radial-gradient(ellipse 74% 74% at 50% 50%, #000 58%, transparent 100%);
  mask-image: radial-gradient(ellipse 74% 74% at 50% 50%, #000 58%, transparent 100%);
}
.land path {
  fill: none; stroke: var(--accent); stroke-opacity: 0.36; stroke-width: 1; stroke-linejoin: round; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1; stroke-dashoffset: 0;
}
.leg { fill: none; stroke: var(--accent); stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; }
.leg-line { stroke-width: 1.5; }
.leg-glow { stroke-width: 7; stroke-opacity: 0.14; }

/* cities: a 44px target each, dot plus label. Positions (left/top) are at the end of this file. */
.cities, .glows { position: absolute; inset: 0; }
.glows { pointer-events: none; }
.city, .glow { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; }
.city { display: block; border-radius: 50%; }
.city-dot {
  position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: color-mix(in oklab, var(--ink) 75%, var(--accent));
  box-shadow: 0 0 10px color-mix(in oklab, var(--accent) 55%, transparent);
}
.city-label, .glow-label {
  position: absolute; top: 50%; transform: translateY(-0.68em);
  font-size: 13px; line-height: 1.25; white-space: nowrap;
}
.label-right .city-label, .label-right .glow-label { left: calc(50% + 11px); text-align: left; }
.label-left .city-label, .label-left .glow-label { right: calc(50% + 11px); text-align: right; }
.city-name { display: block; color: var(--muted); font-weight: 500; }
.city-years { display: block; color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.city:hover .city-name, .city:focus-visible .city-name { color: var(--ink); }
/* close cities (Bill, 2026-11-20): Hamburg and Berlin, and on small maps Cairo and Damascus, have 44px circles that
   overlap, and the later one took the clicks on the earlier one's dot. The circle now only carries the focus ring.
   A click or a tap lands on the dot, whose zone reaches toward its own name and never toward the neighbour, or on the
   name, a 44px tall strip. Every dot lies above every name, so a dot always takes its own click. The map looks the same. */
.city { pointer-events: none; }
.city-dot, .city-label { pointer-events: auto; }
.city-dot { z-index: 2; }
.city-label { z-index: 1; padding: 8px 4px; margin: -8px -4px; }
.city-dot::before { content: ""; position: absolute; top: -6px; bottom: -6px; }
.label-right .city-dot::before { left: -1px; right: -8px; }
.label-left .city-dot::before { left: -8px; right: -1px; }

/* one glow per stop: the stop's head turns it on, the next head turns it off (see animations) */
.glow { opacity: 0; }
.glow[hidden] { display: none; }
.glow-in { position: absolute; inset: -10px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 60%, transparent) 0, color-mix(in oklab, var(--accent) 22%, transparent) 32%, transparent 64%);
}
.glow-in::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 12px var(--accent), 0 0 3px #fff;
}
.glow-label { color: var(--ink); font-weight: 600; }

/* ---------- intro ---------- */
.intro { max-width: 600px; }
.name { margin: 0; font-weight: var(--w-black); font-size: clamp(44px, 6vw, 84px); line-height: 0.95; letter-spacing: var(--track-tight); text-wrap: balance; }
.title { margin: 18px 0 0; font-size: clamp(18px, 1.6vw, 24px); color: var(--muted); line-height: 1.3; }
.where { margin: 6px 0 0; font-size: 15px; color: var(--faint); }
.contact { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 0 18px; font-size: 15px; color: var(--muted); }
.contact-item { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); border-bottom: 1px solid var(--line); line-height: 1.2; }
.contact-item:hover, .contact-item:focus-visible { border-bottom-color: var(--accent); }
.profile { margin: 26px 0 0; max-width: 56ch; font-size: 17px; line-height: 1.6; color: color-mix(in oklab, var(--ink) 92%, transparent); }

/* ---------- controls: order toggle and Work / Education switch ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: clamp(40px, 8vh, 96px); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; background: rgba(241, 238, 249, 0.02); }
.seg-btn {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; transition: color 0.2s, background-color 0.2s;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"] { color: var(--ink); background: rgba(241, 238, 249, 0.09); }
.seg-btn:focus-visible { outline-offset: -3px; }

/* ---------- the stops: the route continues into the text as a rail ---------- */
.stops { list-style: none; margin: clamp(32px, 6vh, 64px) 0 0; padding: 0; }
.stop { position: relative; padding: 0 0 clamp(56px, 10vh, 120px) 30px; scroll-margin-top: calc(var(--map-top) + 12px); }
.stop[hidden], .role[hidden] { display: none; }
/* without scripts nobody can switch to Education: every stop and role shows, and the switches step aside */
@media (scripting: none) {
  .stop[hidden], .role[hidden] { display: block; }
  .controls { display: none; }
}
@media (min-width: 1024px) { .stop { scroll-margin-top: 14svh; } }
.stop-head { margin: 0 0 18px; }
.stop-years { display: block; font-size: 14px; line-height: 1.5; color: var(--faint); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.stop-city { margin: 0; font-weight: var(--w-black); font-size: clamp(36px, 4.4vw, 60px); line-height: 1; letter-spacing: var(--track-tight); }
.stop-mark {
  position: absolute; left: 0; top: 5px; width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid var(--accent); background: var(--bg);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 14%, transparent);
}
.stop-mark::after { content: ""; position: absolute; inset: 1.5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); opacity: 0; }
.rail {
  position: absolute; left: 5px; top: 24px; bottom: 0; width: 1px;
  background: linear-gradient(180deg, var(--accent), color-mix(in oklab, var(--accent) 35%, transparent));
  transform-origin: top; transform: scaleY(0);
}
.role { margin-top: 30px; }
.role:first-of-type { margin-top: 0; }
.role-title { margin: 0; font-weight: 600; font-size: clamp(20px, 1.6vw, 23px); line-height: 1.2; letter-spacing: -0.01em; }
.role-meta { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 15px; color: var(--muted); }
.role-dates { color: var(--faint); font-variant-numeric: tabular-nums; }
.role-lead { margin: 12px 0 0; font-size: 16px; line-height: 1.55; color: color-mix(in oklab, var(--ink) 90%, transparent); }
.hl { margin: 10px 0 0; padding: 0; list-style: none; }
.hl li { position: relative; margin-top: 8px; padding-left: 18px; font-size: 16px; line-height: 1.55; color: color-mix(in oklab, var(--ink) 84%, transparent); }
.hl li::before { content: ""; position: absolute; left: 0; top: 0.78em; width: 8px; height: 1px; background: var(--accent); opacity: 0.75; }

/* ---------- tail ---------- */
.tail { margin-top: clamp(24px, 6vh, 64px); padding-left: 30px; display: grid; gap: 40px; }
.tail-title { margin: 0 0 14px; font-weight: var(--w-black); font-size: 28px; line-height: 1; letter-spacing: var(--track-tight); }
.tail-small .tail-title { font-size: 20px; margin-top: 22px; }
.tail-small .tail-title:first-child { margin-top: 0; }
.tail p { margin: 0; color: var(--muted); font-size: 15px; }
.skills { margin: 0; display: grid; gap: 14px; }
.skill dt { font-weight: 600; font-size: 15px; }
.skill dd { margin: 3px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.certs { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.certs li { position: relative; padding-left: 18px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.certs li::before { content: ""; position: absolute; left: 0; top: 0.78em; width: 8px; height: 1px; background: var(--accent); opacity: 0.75; }
.back { display: inline-flex; align-items: center; min-height: 44px; margin: 40px 0 0 30px; color: var(--accent); border-bottom: 1px solid currentColor; }
.back:hover { color: var(--ink); }

/* ---------- scroll-driven animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

@supports (animation-timeline: view()) {
  .cv { timeline-scope: --h1, --h2, --h3, --h4, --h5; }
  .stop-1 .stop-head { view-timeline-name: --h1; }
  .stop-2 .stop-head { view-timeline-name: --h2; }
  .stop-3 .stop-head { view-timeline-name: --h3; }
  .stop-4 .stop-head { view-timeline-name: --h4; }
  .stop-5 .stop-head { view-timeline-name: --h5; }

  /* a leg draws while the next stop's head travels from the bottom edge to the upper third */
  .leg { animation: draw linear both; animation-range: entry 0% cover 62%; }
  .leg-2 { animation-timeline: --h2; } .leg-3 { animation-timeline: --h3; } .leg-4 { animation-timeline: --h4; }
  .leg-5 { animation-timeline: --h5; }

  /* the glow of stop k comes on as head k passes the middle, and goes off as head k+1 does;
     the last stop has no next head, so its glow stays on */
  .glow { animation: fade-in linear both; animation-range: cover 42% cover 60%; }
  .glow-1 { animation-timeline: --h1; } .glow-2 { animation-timeline: --h2; } .glow-3 { animation-timeline: --h3; }
  .glow-4 { animation-timeline: --h4; } .glow-5 { animation-timeline: --h5; }
  .glow-in { animation: fade-out linear both; animation-range: cover 42% cover 60%; }
  .glow-1 .glow-in { animation-timeline: --h2; } .glow-2 .glow-in { animation-timeline: --h3; } .glow-3 .glow-in { animation-timeline: --h4; }
  .glow-4 .glow-in { animation-timeline: --h5; }
  .glow-5 .glow-in { animation: none; }

  /* in the text: the mark fills once the stop is reached and stays filled, the rail grows as you read */
  .stop-mark::after { animation: fade-in linear both; animation-timeline: view(); animation-range: cover 6% cover 18%; }
  .rail { animation: grow linear both; animation-timeline: view(); animation-range: cover 4% cover 74%; }
  .role { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 80%; }
  .hl li { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; }
  .tail-block { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
}

/* ---------- fallback: classes set by cv.js with IntersectionObserver. Only where scripts run:
   without them nothing sets the classes, so the entries simply stand. ---------- */
@supports not (animation-timeline: view()) {
@media (scripting: enabled) {
  .role, .hl li, .tail-block { opacity: 0; transform: translateY(14px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
  .role.seen, .seen .hl li, .tail-block.seen { opacity: 1; transform: none; }
  .rail { transition: transform 0.9s var(--ease-out); }
  .stop.seen .rail { transform: scaleY(1); }
  .stop-mark::after { transition: opacity 0.4s; }
  .stop.seen .stop-mark::after { opacity: 1; }
  .leg { transition: stroke-dashoffset 1.1s linear; }
  .leg.on { stroke-dashoffset: 0; }
  .glow { transition: opacity 0.5s; }
  .glow.on { opacity: 1; }
}
}

/* ---------- arrival: the agents build the map on load (cv.js drives --draw, --pop, --write).
   Only where scripts run: without them nobody builds it, so the map stands finished. ---------- */
@media (scripting: enabled) {
html:not(.arrived) .land path { stroke-dashoffset: calc(1 - var(--draw, 0)); }
html:not(.arrived) .city { opacity: var(--pop, 0); transform: scale(calc(0.4 + 0.6 * var(--pop, 0))); }
html:not(.arrived) .label-right .city-label { clip-path: inset(-4px calc((1 - var(--write, 0)) * 100%) -4px -4px); }
html:not(.arrived) .label-left .city-label { clip-path: inset(-4px -4px -4px calc((1 - var(--write, 0)) * 100%)); }
html:not(.arrived) .glows, html:not(.arrived) .route { opacity: 0; }
}

/* agents (home.css) */
.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; font-weight: 600;
  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);
}
.agent-2 .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 { background: color-mix(in oklab, var(--accent) 60%, var(--ink)); }
.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; }
html.arrived .skip { display: none; }
@media (scripting: none) { .skip { display: none; } }

/* ---------- reduced motion: everything visible at once ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .role, .hl li, .tail-block, .rail, .leg, .glow, .glow-in, .stop-mark::after, .land path, .city, .city-label, .glows, .route {
    animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; clip-path: none !important; stroke-dashoffset: 0 !important;
  }
  .rail { transform: scaleY(1) !important; }
  .glow { opacity: 0.5 !important; }
  .glow[hidden] { display: none !important; }
  .glow-label { display: none; }
  .skip { display: none; }
}

/* ---------- city positions on the map (percent of the map box), from the Natural Earth export ---------- */
.map-box { aspect-ratio: 1000 / 860; }
.city-damascus { left: 61.85%; top: 58.81%; }
.city-riyadh { left: 76.51%; top: 70.52%; }
.city-hamburg { left: 36.61%; top: 24.99%; }
.city-berlin { left: 39.24%; top: 27.17%; }
