/* Home page: nav, hero, sections, lightbox, footer. Breakpoints at the end of the file. */

/* ---------- Footer ---------- */
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; max-width: var(--max); margin: 0 auto; padding: 24px var(--gutter); color: var(--ink-soft); font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase; }
.footer-name { color: var(--ink); font-size: 22px; }
.footer-brand { display: inline-flex; align-items: center; gap: 12px; }
.footer-logo { width: auto; height: 32px; } /* the favicon's "B." in white on a transparent background */
/* Contact and the footer share one ink band and one contour artwork, so nothing divides them */
.contact-end { position: relative; isolation: isolate; max-width: var(--max); margin: 0 auto; }
.contact-end.tone { padding-bottom: 0; }

/* ---------- Nav: one glass pill that splits into three pills after 40px of scroll ---------- */
.nav {
  position: fixed; top: 16px; left: 50%; z-index: 100;
  display: grid; grid-template-columns: auto auto auto; align-items: stretch;
  width: fit-content; max-width: calc(100% - 32px);
  interpolate-size: allow-keywords; /* animates width from fit-content (Chromium 129+; elsewhere it snaps) */
  transform: translate(-50%);
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-border); border-radius: 999px;
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
  transition: transform 0.45s var(--ease), width 0.6s var(--ease), gap 0.6s var(--ease), background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.nav.is-hidden { transform: translate(-50%, calc(-100% - 64px)); }
.nav-brand, .nav > nav, .nav-end { display: flex; align-items: center; border: 1px solid #0000; border-radius: 999px; transition: padding 0.6s var(--ease), background-color 0.3s, border-color 0.3s, box-shadow 0.3s; }
.nav > nav, .nav-end { padding: 5px; }
.nav-end { justify-content: flex-end; }
.nav.is-scrolled { width: calc(min(100%, var(--max)) - 2 * var(--gutter)); grid-template-columns: 1fr auto 1fr; gap: 12px; background: none; border-color: #0000; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.nav.is-scrolled .nav-brand, .nav.is-scrolled > nav, .nav.is-scrolled .nav-end { background: var(--glass); border-color: var(--glass-border); box-shadow: var(--glass-shadow); -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); }
.nav.is-scrolled .nav-brand { justify-self: start; padding: 0 24px; }
.nav.is-scrolled .nav-end { justify-self: end; }
.nav-brand { padding: 0 8px 0 20px; font: 800 19px/1 var(--display); font-variation-settings: "wdth" 75, "opsz" 48; letter-spacing: 0.01em; text-transform: uppercase; white-space: nowrap; text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 2px; font-size: 14px; }
.nav-links a { display: block; padding: 8px 14px; border-radius: 999px; white-space: nowrap; text-decoration: none; transition: background-color 0.2s; }
.nav-links a:hover { background: #0b102612; }
.nav-links-contact { display: none; }
.nav-cta { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none; transition: background-color 0.2s; }
.nav-cta:hover { background: #222a4d; }
.nav-cta .icon { width: 14px; height: 14px; }
.nav-menu-btn { display: none; place-items: center; width: 42px; height: 42px; margin-left: 4px; border-radius: 999px; }
.nav-menu-btn .icon { width: 20px; height: 20px; }

@media (width <= 768px) {
  .nav { left: 50%; width: 100vw; max-width: none; margin-left: -50vw; padding: 0 max(14px, env(safe-area-inset-left)); grid-template-columns: 1fr auto; gap: 8px; transform: none; background: none; border-color: #0000; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; transition: top 0.4s var(--ease); }
  .nav.is-scrolled { width: 100vw; grid-template-columns: 1fr auto; }
  .nav.is-hidden { top: -70px; transform: none; }
  .nav-brand, .nav.is-scrolled .nav-brand, .nav-menu-btn { padding: 10px 18px; border: 1px solid var(--glass-border); border-radius: 999px; background: var(--glass); box-shadow: var(--glass-shadow); -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); }
  .nav-menu-btn { display: grid; padding: 0; }
  .nav.is-scrolled .nav-end { padding: 0; background: none; border-color: #0000; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav-end .nav-cta { display: none; }
  .nav-links-contact { display: block; }
  /* full-screen ink overlay: solid also when scrolled (.nav.is-scrolled > nav beats the desktop glass rule), unfocusable when closed */
  .nav > nav, .nav.is-scrolled > nav { position: fixed; inset: 0; align-items: start; width: 100%; max-width: none; padding: 96px 24px calc(32px + env(safe-area-inset-bottom)); border: 0; border-radius: 0; background: #0b1026; color: #eef3f4; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; overflow-y: auto; overscroll-behavior: contain; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.3s var(--ease), visibility 0s 0.3s; }
  .nav.is-open > nav { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
  .nav-links { display: grid; align-content: start; gap: 6px; width: 100%; font-family: var(--display); font-variation-settings: "wdth" 75, "opsz" 96; font-size: clamp(34px, 11vw, 48px); font-weight: 800; line-height: 1; text-align: left; text-transform: uppercase; }
  .nav-links a { padding: 10px 0; border-radius: 0; }
  .nav-links a:hover, .nav-links a:active { background: none; color: #29a3ff; }
  .nav-links-contact a { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding: 16px 22px; border-radius: 999px; background: #29a3ff; color: #0b1026; font-size: clamp(20px, 6vw, 26px); }
  .nav-links-contact .icon { width: 20px; height: 20px; }
  .nav.is-open .nav-brand, .nav.is-open .nav-menu-btn { position: relative; z-index: 2; color: #eef3f4; background: none; border-color: #eef3f459; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---------- Hero ---------- */
.hero { --paper: #eef3f4; --ink-soft: #4b5575; --brand: #0063ad; position: relative; height: 100svh; min-height: 680px; overflow: hidden; background: var(--paper); color: var(--ink); }
/* min-content = the name's width, so long meta lines wrap before they reach the portrait */
.hero-intro { position: absolute; top: 50%; left: var(--gutter); z-index: 3; transform: translateY(-42%); width: min-content; }
.hero-name { font-family: var(--display); font-variation-settings: "wdth" 75, "opsz" 96; font-size: clamp(64px, 8.4vw, 136px); font-weight: 800; line-height: 0.84; letter-spacing: -0.01em; text-transform: uppercase; }
.hero-name span { display: block; animation: rise 0.9s var(--ease) both; }
.hero-name span + span { animation-delay: 80ms; }
.hero-meta { letter-spacing: 0.05em; text-transform: uppercase; animation: rise 0.9s 0.2s var(--ease) both; }
.hero-meta li { display: flex; align-items: flex-start; gap: 10px; }
/* icon centred on the first line of a wrapped item (1.6 = inherited line-height) */
.hero-meta .icon { width: 15px; height: 15px; margin-top: calc((1.6em - 15px) / 2); color: var(--brand); }
.hero-meta-top { display: grid; gap: 8px; margin-top: 32px; font-size: 13px; }
.hero-meta-bar { display: none; grid-column: 1 / -1; flex-wrap: wrap; align-items: center; gap: 8px 28px; padding-bottom: 14px; border-bottom: 1px solid #0b102624; font-size: 12px; }
.hero-stage { position: absolute; inset: 0; z-index: 1; }
/* 64vw cap: on tall, narrow desktop windows a purely height-driven portrait runs into the name column */
.hero-portrait { position: absolute; bottom: -40px; left: 50%; height: min(calc(100% - 64px), 64vw); aspect-ratio: 946 / 883; transform: translate(-50%); animation: fade 1s both; }
.hero-portrait img, .hero-portrait canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-portrait canvas { opacity: 0; transition: opacity 0.2s; }
/* Calibration knob: keep equal to photoOffset in portrait-reveal.js; 0 while photo and 3D model share a frame */
.hero-portrait .layer-photo { transform: translateY(0); }
.hero-portrait.is-intro .layer-photo { opacity: 0; }
.hero-portrait.is-static img { transition: opacity 0.6s; }
.hero-portrait.is-static[data-layer="photo"] .layer-alt,
.hero-portrait.is-static[data-layer="alt"] .layer-photo { opacity: 0; }
.hero-portrait.is-webgl img { visibility: hidden; transition: visibility 0s 0.2s; }
.hero-portrait.is-webgl canvas { opacity: 1; }
.hero-panels { position: absolute; top: 50%; right: var(--gutter); z-index: 3; display: grid; gap: 14px; width: 236px; transform: translateY(-50%); }
.hud-title { margin-top: 8px; font-size: 14px; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; }
.hud-sub { color: var(--ink-soft); font-size: 12px; line-height: 1.4; letter-spacing: 0.03em; text-transform: uppercase; }
.hud-spark { display: block; width: 100%; height: 30px; margin-top: 10px; overflow: visible; }
.hud-spark polyline { fill: none; stroke: currentColor; stroke-width: 1.5px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.hud-link:hover .hud-spark { color: var(--brand); }
.hud-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.hud-stats dt { color: var(--ink-soft); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; }
.hud-stats dd { margin-top: 4px; font: 800 34px/1 var(--display); font-variation-settings: "wdth" 75, "opsz" 48; }
.hero-bar { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 28px; z-index: 3; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; animation: fade 1s 0.4s both; }
.hero-switch { justify-self: start; display: inline-flex; align-items: center; gap: 12px; padding: 4px 14px 4px 4px; border-radius: 999px; text-align: left; transition: background-color 0.2s; }
.hero-switch:hover { background: #0b10260f; }
.switch-icon { display: grid; place-items: center; width: 40px; height: 40px; border: 1.5px solid var(--ink); border-radius: 50%; transition: transform 0.5s var(--ease), background-color 0.2s, color 0.2s; }
.switch-icon .icon { width: 18px; height: 18px; stroke-width: 1.8px; }
.hero-switch:hover .switch-icon { background: var(--ink); color: var(--paper); }
.hero-switch[aria-pressed="true"] .switch-icon { transform: rotate(180deg); }
.hero-switch-title { display: block; font-size: 12px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; }
.hero-switch-sub { display: block; color: var(--ink-soft); font-size: 11px; }
.hero-cta-wrap { grid-column: 3; justify-self: end; }
/* outline button: a 1px brand line around a see-through fill of the surface it sits on (also "See on LinkedIn" on the ink band) */
.hero-cta { display: inline-flex; align-items: center; gap: 10px; padding: 12px 22px; border: 1px solid var(--brand); color: var(--brand); background: color-mix(in srgb, var(--paper) 85%, transparent); clip-path: var(--cut); font-size: 13px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; transition: background-color 0.2s, color 0.2s; }
.hero-cta:hover { background: var(--brand); color: var(--paper); }
.hero-cta:focus-visible { outline-color: currentColor; outline-offset: -4px; } /* clip-path clips the outset ring */

@media (width <= 1024px) {
  .hero { display: flex; flex-direction: column; height: auto; min-height: 0; padding: 104px 0 28px; }
  .hero-intro, .hero-panels, .hero-bar { position: relative; inset: auto; transform: none; }
  .hero-intro { width: auto; padding: 0 var(--gutter); }
  .hero-stage { position: relative; margin-top: 12px; }
  .hero-portrait { position: relative; bottom: auto; left: auto; width: min(100%, 720px); height: auto; margin: 0 auto; transform: none; }
  .hero-panels { width: auto; padding: 24px var(--gutter) 0; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .hero-bar { padding: 28px var(--gutter) 0; grid-template-columns: 1fr; justify-items: start; gap: 20px; }
  .hero-cta-wrap { grid-column: auto; justify-self: start; }
}
@media (width <= 768px) {
  .hero { padding: 88px 0 20px; }
  .hero-intro { text-align: center; }
  .hero-meta-top { display: none; }
  .hero-meta-bar { display: flex; gap: 6px 18px; padding-bottom: 12px; font-size: 11px; }
  .hero-name { font-size: 8.5vw; white-space: nowrap; }
  .hero-name span { display: inline; }
  .hero-portrait { width: min(100%, 420px, 44.9966svh); }
  .hero-stage { margin-top: 4px; }
  .hero-panels { grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 18px; }
  .hero-panels > :last-child { grid-column: 1 / -1; }
  .hero-bar { gap: 14px; padding-top: 20px; }
}
@media (width <= 400px) {
  .hero-portrait { width: min(100%, 40.7112svh); }
  .hero-panels { gap: 8px; }
}

/* ---------- Sections ---------- */
.section { position: relative; isolation: isolate; max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); padding-top: clamp(80px, 10vw, 130px); }
.section:has(+ .tone) { padding-bottom: clamp(80px, 10vw, 130px); } /* room before a dark band (Off the clock -> Contact) */
.sec-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: clamp(32px, 4vw, 48px); }
.sec-title { font-size: clamp(56px, 8vw, 120px); }
.sec-meta { padding-bottom: 6px; text-align: right; }
.sec-sub { color: var(--ink-soft); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- About ---------- */
/* text takes the width; the cards sit in a narrow column to its right, vertically centred on it; LinkedIn goes under them, flush right like "Who I am" */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); align-items: center; gap: 32px clamp(32px, 5vw, 72px); }
.about-text p { max-width: 42em; font-size: 20px; line-height: 1.55; }
.about-text p + p { margin-top: 16px; color: var(--ink-soft); }
.facts { display: grid; gap: 14px; }
.facts dd { margin-top: 6px; font-weight: 500; }
.about-cta { grid-column: 2; justify-self: end; } /* holds a .hero-cta, so it matches "View projects" */

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: 1fr 1fr; align-items: end; align-content: center; gap: clamp(40px, 6vw, 96px); padding-bottom: clamp(80px, 10vw, 130px); }
.contact-title { font-size: clamp(80px, 11vw, 170px); }
.contact-sub { margin-top: 20px; color: var(--ink-soft); font-size: 18px; }
.contact-list { display: grid; gap: 18px; }
.paper .contact-list a { display: grid; grid-template-columns: 7em 1fr auto; align-items: center; gap: 16px; padding: 16px 20px; }
.contact-value { display: flex; align-items: center; gap: 10px; min-width: 0; }
.contact-value span { min-width: 0; overflow-wrap: anywhere; }
.contact-logo { width: 20px; height: 20px; flex-shrink: 0; fill: currentColor; }
.contact-list .icon { width: 18px; height: 18px; transition: transform 0.3s var(--ease), color 0.2s; }
.contact-list a:hover .icon { color: var(--brand); transform: translate(2px, -2px); }

/* ---------- Achievements ---------- */
.paper .achievement { --accent: var(--brand); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; gap: clamp(24px, 4vw, 56px); padding: clamp(14px, 1.6vw, 20px); }
/* a straight sideways slider (no loop, no tilt), opening on Cum Laude; one full-width card per slide */
.achievements { display: flex; gap: 28px; padding: 4px 0 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.achievements::-webkit-scrollbar { display: none; }
.paper .achievement { flex: 0 0 100%; scroll-snap-align: start; }
/* every second card mirrors: photo on the right */
.paper .achievement:nth-child(even) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.paper .achievement:nth-child(even) .achievement-media { order: 2; }
.paper .achievement:nth-child(even) .achievement-body { padding: clamp(8px, 1.5vw, 20px) 0 clamp(8px, 1.5vw, 20px) clamp(8px, 1.5vw, 20px); }
.achievement-media { position: relative; }
.carousel { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #0b102614; clip-path: var(--cut-lg); }
.carousel > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; scale: 1.06; transition: opacity 0.9s, scale 0s linear 0.9s, transform 0.7s var(--ease); }
.carousel:hover > img { transform: scale(1.04); } /* with .burn's light sweep: the Projects photo hover */
/* current slide fades in and slowly settles from 1.06x (Ken Burns) */
.carousel > img.is-current { opacity: 1; scale: 1; transition: opacity 0.9s, scale 6s ease-out, transform 0.7s var(--ease); }
.carousel-ui { position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.carousel-btn { display: grid; place-items: center; width: 38px; height: 38px; color: #fff; font-size: 18px; background: #0b102673; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); clip-path: var(--cut); opacity: 0; transition: opacity 0.3s, background-color 0.2s, color 0.2s; }
.carousel:hover .carousel-btn, .carousel-btn:focus-visible { opacity: 1; }
.carousel-btn:hover { background: var(--sky); color: var(--ink); }
.carousel-dots { display: flex; gap: 6px; margin: 0 auto; padding: 8px 10px; border-radius: 999px; background: #0b102666; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.carousel-dots button { width: 8px; height: 8px; border-radius: 999px; background: #ffffff80; transition: width 0.4s var(--ease), background-color 0.3s; }
.carousel-dots button.is-current { width: 26px; background: var(--sky); }
.achievement-badge { position: absolute; top: -10px; right: 18px; z-index: 3; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px 9px 12px; background: var(--sky); color: #0b1026; clip-path: var(--cut); font: 800 18px/1 var(--display); font-variation-settings: "wdth" 75, "opsz" 96; text-transform: uppercase; box-shadow: 0 10px 24px -10px #0b102680; }
.achievement-badge .icon { width: 18px; height: 18px; }
.achievement-body { padding: clamp(8px, 1.5vw, 20px) clamp(8px, 1.5vw, 20px) clamp(8px, 1.5vw, 20px) 0; }
.achievement-body h3 { margin: 12px 0 18px; font-size: clamp(56px, 7vw, 96px); }
.achievement-body h3 span { display: block; margin-top: 8px; color: var(--brand); font-size: 0.42em; }
.achievement-desc { max-width: 34em; color: var(--ink-soft); line-height: 1.6; }
.achievement-facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 12px 28px; margin: 22px 0 18px; padding: 16px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.achievement-facts dt { color: var(--ink-soft); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.achievement-facts dd { margin-top: 4px; font-size: 15px; font-weight: 500; }
.achievement-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin-top: 26px; }
.text-link { padding-bottom: 2px; border-bottom: 1px solid var(--rule); color: var(--ink-soft); font-size: 13px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; transition: color 0.2s, border-color 0.2s; }
.text-link:hover { color: var(--accent, var(--brand)); border-color: var(--accent, var(--brand)); }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.skill h3 { margin: 10px 0; font-size: 36px; }
.skill-desc { margin-bottom: 16px; color: var(--ink-soft); font-size: 15px; }
.logos { display: flex; flex-wrap: wrap; gap: 8px; }
.logos li { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 9px; border: 1px solid var(--rule); background: color-mix(in srgb, var(--paper) 60%, #fff 40%); font-size: 13px; font-weight: 500; line-height: 1; transition: translate 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s; }
.logos img { width: 20px; height: 20px; object-fit: contain; transition: scale 0.3s var(--ease); }
.logos li:hover { translate: 0 -2px; border-color: var(--brand); box-shadow: 0 10px 20px -14px #0b102680; }
.logos li:hover img { scale: 1.15; }

/* ---------- Projects: HUD cards on a sideways scroll-snap track, coverflow like the gallery (main.js initProjects: arrows, wrap-around) ---------- */
/* slider controls shared by Projects and Achievements: "01 / 03" + prev/next (main.js initSliders) */
.slide-nav { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.sec-sub + .slide-nav { margin-top: 12px; }
.slide-count { margin-right: 6px; font-variant-numeric: tabular-nums; }
.icon-btn { padding: 11px; }
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn[aria-disabled="true"] { opacity: 0.35; cursor: default; } /* a straight slider at either end */
/* full width of the section (out to the gutters); side padding lets the first and last card reach the middle */
.projects-track { --card: min(560px, 82vw); position: relative; display: flex; gap: 28px; margin-inline: calc(-1 * var(--gutter)); padding: 12px calc(50% + var(--gutter) - var(--card) / 2) 24px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; perspective: 1200px; -webkit-mask: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); mask: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); }
.projects-track::-webkit-scrollbar { display: none; }
.paper .project { display: flex; flex: 0 0 var(--card); flex-direction: column; padding: 16px 16px 22px; scroll-snap-align: center; }
.project .project-row, .project .project-desc, .project .project-actions { padding-inline: 6px; }
.project-media { aspect-ratio: 1200 / 630; background: #0b10260f; clip-path: var(--cut-lg); }
.project-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease); }
.project:hover .project-media img { transform: scale(1.04); }
.project-row { margin-top: 16px; }
.project h3 { margin-top: 6px; font-size: clamp(30px, 3vw, 40px); }
.project-desc { max-width: 36em; margin-top: 8px; color: var(--ink-soft); font-size: 15px; }
.project-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 16px; } /* auto: buttons line up across cards */
.project-btn { color: #fff; background-color: var(--brand); border-color: var(--brand); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.project-btn:hover, .project-btn:focus-visible { color: #fff; background-color: #006ec2; border-color: #006ec2; transform: translateY(-3px); box-shadow: 0 6px 16px #0063ad66; }
.project-btn:focus-visible { outline-color: currentColor; outline-offset: -4px; }
.project-btn:active { transform: translateY(0); box-shadow: 0 2px 4px #0063ad66; }

/* ---------- Profession: horizontal roadmap, oldest stop first ---------- */
.roadmap { --gap: clamp(20px, 2.4vw, 32px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--gap); }
.stop { display: flex; flex-direction: column; }
.stop-sky { position: relative; height: 250px; }
.stop-road { position: relative; height: 26px; }
/* road: 12px ink with a dashed centre line, drawn from each stop's node to the next one's */
.stop-road::before, .stop:first-child .stop-road::after { content: ""; position: absolute; top: 7px; left: 50%; width: calc(100% + var(--gap)); height: 12px; background: repeating-linear-gradient(90deg, #eef3f4cc 0 10px, transparent 10px 22px) center / 100% 2px no-repeat, var(--ink); }
.stop:first-child .stop-road::after { left: 0; width: 50%; -webkit-mask: linear-gradient(90deg, transparent, #000 60%); mask: linear-gradient(90deg, transparent, #000 60%); }
/* past the current stop the road runs on and fades out: what's next */
.stop:last-child .stop-road::before { width: 50%; -webkit-mask: linear-gradient(90deg, #000 20%, transparent); mask: linear-gradient(90deg, #000 20%, transparent); }
.stop-node { position: absolute; top: 13px; left: 50%; z-index: 1; width: 18px; height: 18px; translate: -50% -50%; rotate: 45deg; border: 2px solid var(--ink); background: var(--paper); }
.stop.is-current .stop-node { border-color: var(--paper); background: var(--brand); animation: node-pulse 2.4s ease-out infinite; }
.stop-flag { position: absolute; bottom: 0; left: 50%; width: 2px; height: 76px; translate: -50%; background: var(--ink); transform-origin: 50% 100%; }
.stop-flag::after { content: ""; position: absolute; top: 0; left: 2px; width: 34px; height: 22px; background: var(--brand); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.stop-date { margin-top: 8px; color: var(--ink-soft); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-align: center; text-transform: uppercase; }
.stop.is-current .stop-date { color: var(--brand); }
/* the cards are Skills cards (.hud.skill, .skill-desc, scan reveal) with .tags; this only lays them out under the road */
.stop-card { display: flex; flex-direction: column; flex: 1; margin-top: 18px; }
.stop-role { margin-bottom: 10px; color: var(--brand); font-weight: 500; }
.stop-card .tags { margin-top: auto; }
@keyframes node-pulse { from { box-shadow: 0 0 0 0 #29a3ffaa; } to { box-shadow: 0 0 0 14px #29a3ff00; } }

/* The figure on the current stop: real CSS 3D. Each <b class="cube"> is a cuboid of six <i> faces;
   its inline style gives size (--w --h --d), centre (--x --y --z, feet at 0 0 0), colour (--c) and an optional --rz tilt.
   A <b class="limb"> is a joint (--x --y: shoulder, hip, knee, ankle): its cubes hang from it, so one rotate swings everything below. */
@property --bend { syntax: "<number>"; inherits: true; initial-value: 0; } /* how far the knees fold, in degrees */
@property --lift { syntax: "<number>"; inherits: true; initial-value: 0; } /* how far his feet are off the road, in px */
.walker-track { position: absolute; inset: 0; pointer-events: none; }
.walker-btn { position: absolute; bottom: 0; left: 50%; width: 110px; height: 240px; margin-left: -55px; perspective: 900px; perspective-origin: 50% 35%; pointer-events: auto; }
.walker-btn:focus-visible { outline-offset: 6px; }
.walker-shadow { position: absolute; bottom: -10px; left: 50%; width: 78px; height: 16px; translate: -50%; border-radius: 50%; background: radial-gradient(closest-side, #0b102655, #0b102600); scale: calc(1 - var(--lift) / 140); opacity: calc(1 - var(--lift) / 120); }
.walker, .avatar-head {
  --skin: #d9a68e; --hair: #151821; --knit: #1d2234; --pants: #2c3348; --shoe: #6e4128; --frame: #3b4358;
  --eye: #141414; --lip: #8a4a48; --dial: #1d4fa8; --wood: #8b5a34; --cloth: #29a3ff; --alu: #c3c8cf; --mouth: #4a1f24;
}
/* folded legs lose 84 * (1 - cos bend) of height; dropping him by that keeps his feet on the road */
.walker {
  position: absolute; bottom: -8px; left: 50%;
  translate: 0 calc((84 * (1 - cos(var(--bend) * 1deg)) - var(--lift)) * 1px);
  transform: rotateX(-10deg) rotateY(30deg);
  animation: walker-look 7s ease-in-out infinite alternate;
}
.walker, .avatar-head, .cube, .limb { transform-style: preserve-3d; }
.limb { position: absolute; translate: calc(var(--x) * 1px) calc(var(--y) * 1px); }
/* hip forward, knee back twice as far, ankle forward again: the thigh and shin fold, the shoe stays flat */
.leg { rotate: x calc(var(--bend) * 1deg); }
.shin { rotate: x calc(var(--bend) * -2deg); }
.ankle { rotate: x calc(var(--bend) * 1deg); }
.arm { transform: rotateX(calc(var(--bend) * -0.6deg)); } /* arms swing back as he crouches */
.cube { position: absolute; transform: translate3d(calc(var(--x) * 1px), calc(var(--y) * 1px), calc(var(--z) * 1px)) rotateZ(calc(var(--rz, 0) * 1deg)); }
.cube i { position: absolute; width: calc(var(--w) * 1px); height: calc(var(--h) * 1px); translate: -50% -50%; background-color: var(--c); }
.cube i:nth-child(1) { transform: translateZ(calc(var(--d) * 0.5px)); }
.cube i:nth-child(2) { transform: rotateY(180deg) translateZ(calc(var(--d) * 0.5px)); background-color: color-mix(in srgb, var(--c) 70%, #000); }
.cube i:nth-child(3) { width: calc(var(--d) * 1px); transform: rotateY(90deg) translateZ(calc(var(--w) * 0.5px)); background-color: color-mix(in srgb, var(--c) 78%, #000); }
.cube i:nth-child(4) { width: calc(var(--d) * 1px); transform: rotateY(-90deg) translateZ(calc(var(--w) * 0.5px)); background-color: color-mix(in srgb, var(--c) 86%, #fff); }
.cube i:nth-child(5) { height: calc(var(--d) * 1px); transform: rotateX(90deg) translateZ(calc(var(--h) * 0.5px)); background-color: color-mix(in srgb, var(--c) 78%, #fff); }
.cube i:nth-child(6) { height: calc(var(--d) * 1px); transform: rotateX(-90deg) translateZ(calc(var(--h) * 0.5px)); background-color: color-mix(in srgb, var(--c) 60%, #000); }
/* glasses: a rim with a tinted lens; the back face goes clear so the eye shows through */
.cube.lens i:nth-child(1) { border: 1.5px solid var(--frame); background-color: #29a3ff2e; }
.cube.lens i:nth-child(2) { background-color: transparent; }
.cube.cloth i { background-image: radial-gradient(#fff 0 1.6px, transparent 2.2px); background-size: 7px 7px; }
/* closed aluminium laptop: a soft glowing mark on the lid (the outward face) */
.cube.laptop i:nth-child(4) { background-image: radial-gradient(circle, #fffffff2 0 2.4px, #ffffff00 3.4px), linear-gradient(160deg, #ffffff59, #ffffff00 60%); }
@keyframes walker-look { from { transform: rotateX(-10deg) rotateY(14deg); } to { transform: rotateX(-10deg) rotateY(44deg); } }

/* Click: his free hand waves and "I Freelance Too!" pops up to the right of his head (main.js initWalker) */
.walker-btn.is-waving .wave-arm { animation: wave 1.6s var(--ease); }
.walker-bubble { position: absolute; bottom: 196px; left: calc(50% + 24px); padding: 7px 12px 6px; border-radius: 12px 12px 12px 2px; background: var(--brand); color: #fff; font: 800 20px/1 var(--display); font-variation-settings: "wdth" 75, "opsz" 48; text-transform: uppercase; white-space: nowrap; box-shadow: 0 10px 24px -12px #0b102699; opacity: 0; scale: 0.5; transform-origin: 0 100%; pointer-events: none; transition: opacity 0.2s, scale 0.35s var(--ease); }
.walker-btn.is-waving .walker-bubble { opacity: 1; scale: 1; }
@keyframes wave {
  0%, 100% { rotate: 0deg; }
  18%, 50%, 82% { rotate: -158deg; }
  34%, 66% { rotate: -128deg; }
}

/* First time the road is in view (main.js initRoadmap adds .hop-ready, then .is-hopping) the figure hops
   stop 1 -> 2 -> 3, and each flag goes up once he has hopped on from it. 100% + gap = one stop to the next. */
.hop-ready .walker-track { translate: calc(-2 * (100% + var(--gap))) 0; }
.hop-ready .stop-flag { scale: 1 0; }
.is-hopping .walker-track { animation: hop-x 2.1s 0.4s both; }
.is-hopping .walker-btn { animation: hop 2.1s 0.4s both; } /* drives --bend and --lift for the legs, arms, body and shadow */
.is-hopping .stop-flag { animation: flag-up 0.5s var(--ease) both; }
.is-hopping .stop:nth-child(1) .stop-flag { animation-delay: 1.3s; } /* 0.4s + landing on stop 2 at 42% */
.is-hopping .stop:nth-child(2) .stop-flag { animation-delay: 2.2s; } /* 0.4s + landing on stop 3 at 85% */
/* sideways only while he's in the air (13-42%, 56-85%), at a steady speed like a real jump */
@keyframes hop-x {
  0%, 13% { translate: calc(-2 * (100% + var(--gap))) 0; animation-timing-function: linear; }
  42%, 56% { translate: calc(-1 * (100% + var(--gap))) 0; animation-timing-function: linear; }
  85%, 100% { translate: 0 0; }
}
/* each hop: crouch and hold, push off, rise and tuck the knees, fall, touch down, sink into a small landing crouch */
@keyframes hop {
  0%    { --bend: 0;  --lift: 0;  animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1); }
  9%    { --bend: 44; --lift: 0; }
  12%   { --bend: 44; --lift: 0;  animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  15%   { --bend: 0;  --lift: 12; animation-timing-function: cubic-bezier(0.3, 0.6, 0.5, 1); }
  28.5% { --bend: 16; --lift: 64; animation-timing-function: cubic-bezier(0.5, 0, 0.7, 0.4); }
  42%   { --bend: 6;  --lift: 0;  animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  46%   { --bend: 28; --lift: 0;  animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1); }
  53%   { --bend: 44; --lift: 0; }
  55%   { --bend: 44; --lift: 0;  animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  58%   { --bend: 0;  --lift: 12; animation-timing-function: cubic-bezier(0.3, 0.6, 0.5, 1); }
  71.5% { --bend: 16; --lift: 64; animation-timing-function: cubic-bezier(0.5, 0, 0.7, 0.4); }
  85%   { --bend: 6;  --lift: 0;  animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  89%   { --bend: 28; --lift: 0;  animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1); }
  97%, 100% { --bend: 0; --lift: 0; }
}
@keyframes flag-up { from { scale: 1 0; } 70% { scale: 1 1.1; } to { scale: 1 1; } }

/* ---------- Off the clock + coverflow gallery ---------- */
.paper .offclock { padding: clamp(22px, 3vw, 34px) 0; }
.offclock-head { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 24px; padding: 0 clamp(20px, 3vw, 34px); }
/* his 3D head (the figure's head cubes) in a round frame, slowly looking around */
.offclock-avatar { position: relative; display: block; width: 96px; height: 96px; overflow: hidden; border: 1px solid var(--rule); border-radius: 50%; background: radial-gradient(circle at 50% 30%, #29a3ff2e, #29a3ff00 70%), color-mix(in srgb, var(--paper) 60%, #fff); perspective: 600px; }
.avatar-head { position: absolute; top: 50%; left: 50%; transform: scale(1.5) rotateX(-8deg) rotateY(24deg) translateY(181px); animation: avatar-look 6s ease-in-out infinite alternate; } /* 181: his eyes sit mid-circle */
@keyframes avatar-look { from { transform: scale(1.5) rotateX(-8deg) rotateY(8deg) translateY(181px); } to { transform: scale(1.5) rotateX(-8deg) rotateY(38deg) translateY(181px); } }
/* what he says: a speech bubble with its tail on his mouth */
.offclock-bubble { position: relative; padding: 18px 22px 20px; border: 1px solid var(--rule); border-radius: 16px; background: #fff; box-shadow: 0 16px 32px -24px #0b102680; }
.offclock-bubble::before { content: ""; position: absolute; top: 52px; left: -8px; width: 14px; height: 14px; rotate: 45deg; border-bottom: 1px solid var(--rule); border-left: 1px solid var(--rule); background: inherit; }
.offclock-desc { margin: 8px 0 14px; color: var(--ink-soft); }
.hobby-tags li { display: inline-flex; align-items: center; gap: 7px; }
.hobby-tags .icon { width: 14px; height: 14px; color: var(--brand); }
/* he talks (main.js initAvatarTalk: first time in view, then every 10 s): the mouth behind his lips opens and closes */
@property --talk { syntax: "<number>"; inherits: true; initial-value: 0; }
.avatar-head.is-talking { animation: avatar-look 6s ease-in-out infinite alternate, talk 1.8s ease-in-out; }
@keyframes talk {
  0%, 100% { --talk: 0; }
  10% { --talk: 3.4; } 20% { --talk: 0.6; } 31% { --talk: 3.8; } 42% { --talk: 1; }
  53% { --talk: 3; } 64% { --talk: 0.4; } 75% { --talk: 3.4; } 87% { --talk: 0.8; }
}
.gallery { display: flex; gap: 20px; margin-top: 28px; padding: 16px clamp(20px, 3vw, 34px); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; perspective: 1200px; }
.gallery::-webkit-scrollbar { display: none; }
.gallery-item { flex: 0 0 clamp(220px, 26vw, 320px); scroll-snap-align: center; }
.gallery-item button { display: block; width: 100%; aspect-ratio: 4 / 5; background: #0b10260f; clip-path: var(--cut-md); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.gallery-item button:hover img { transform: scale(1.04); }
.gallery-item button:focus-visible, .lb-btn:focus-visible { outline-offset: -4px; } /* clip-path would clip an outset ring */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    /* cards rotate in 3D as they cross the horizontal scrollport (.paper beats .paper .hud's animation: none) */
    .gallery-item, .paper .project { animation: coverflow linear both; animation-timeline: view(inline); }
    @keyframes coverflow {
      0% { opacity: 0.6; transform: rotateY(38deg) scale(0.88); }
      50% { opacity: 1; transform: rotateY(0) scale(1); }
      100% { opacity: 0.6; transform: rotateY(-38deg) scale(0.88); }
    }
  }
}

/* ---------- Lightbox (native <dialog>) ---------- */
.lightbox { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 64px 16px; border: 0; background: #0b1026eb; color: inherit; }
.lightbox[open] { display: grid; place-items: center; animation: fade 0.25s; }
.lightbox::backdrop { background: transparent; }
body:has(.lightbox[open]) { overflow: hidden; }
.lightbox img { width: auto; height: auto; max-width: min(92vw, 900px); max-height: 86svh; animation: pop 0.35s var(--ease); }
.lb-btn { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #eef3f480; color: var(--paper); font-size: 22px; clip-path: var(--cut); transition: background-color 0.2s, color 0.2s; }
.lb-btn[hidden] { display: none; }
.lb-btn:hover, .lb-btn:focus-visible { background: var(--sky); color: var(--ink); border-color: var(--sky); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { top: 50%; left: 16px; translate: 0 -50%; }
.lb-next { top: 50%; right: 16px; translate: 0 -50%; }

/* ---------- Home breakpoints (keep last) ---------- */
@media (width <= 1024px) {
  .about, .contact { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .about-cta { grid-column: auto; }
  .skills-grid { grid-template-columns: 1fr 1fr; }
  .skills-grid > :last-child { grid-column: 1 / -1; }
}
@media (width <= 900px) {
  .paper .achievement, .paper .achievement:nth-child(even) { grid-template-columns: 1fr; }
  .achievement-body, .paper .achievement:nth-child(even) .achievement-body { padding: 8px; }
  .paper .achievement:nth-child(even) .achievement-media { order: 0; }
  /* three stops no longer fit "SMARTSOURCING": the roadmap stays horizontal, swipe along it, one stop per snap */
  .roadmap { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: min(78vw, 320px); margin: -48px calc(-1 * var(--gutter)) 0; padding: 48px var(--gutter) 12px; /* headroom: the scroller clips the top of a hop */ overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
  .roadmap::-webkit-scrollbar { display: none; }
  .stop { scroll-snap-align: start; }
}
@media (width <= 768px) {
  .offclock-head { grid-template-columns: 1fr; }
  .sec-head { flex-direction: column; align-items: start; gap: 8px; }
  .sec-meta { text-align: left; }
  .slide-nav { justify-content: flex-start; }
  .about-cta { justify-self: start; } /* "Who I am" is left-aligned at this width */
  .skills-grid { grid-template-columns: 1fr; }
  /* avatar above the bubble: the tail points up at him */
  .offclock-bubble::before { top: -8px; left: 38px; border: 0; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
  .paper .contact-list a { grid-template-columns: 1fr auto; gap: 2px 12px; }
  .contact-list .hud-label, .contact-value { grid-column: 1; }
  .contact-list .icon { grid-area: 1 / 2 / span 2; }
}
@media (width <= 560px) {
  .facts { grid-template-columns: 1fr; }
  .gallery { gap: 14px; }
  .gallery-item { flex-basis: 74vw; }
  .section { padding-top: clamp(56px, 14vw, 80px); }
  .tone, .section:has(+ .tone) { padding-bottom: clamp(56px, 14vw, 80px); }
  .sec-head { margin-bottom: 24px; }
  .sec-title { font-size: clamp(44px, 14vw, 72px); }
  .about-text p { font-size: 17px; }
  .contact-title { font-size: clamp(64px, 20vw, 110px); }
  .contact-sub { font-size: 16px; }
  .skill h3 { font-size: 30px; }
  .project h3 { font-size: 28px; }
  .walker-bubble { left: calc(50% + 16px); font-size: 16px; } /* "I Freelance Too!" stays on narrow phones */
  .footer { flex-direction: column; align-items: start; gap: 8px; }
  .achievement-facts { grid-template-columns: 1fr 1fr; }
  .carousel-btn { opacity: 1; }
}
