:root {
  --bg: #cfe6fb;
  --head: #2496ed;
  --halo: #2496ed;
  --ink: #0b2a4a;
  --text: #0b2a4a;
  --pupil: #0b2a4a;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  transition: background-color 0.4s ease;
  /* mono + uppercase everywhere by default (the "02 - PROJECTS" look) —
     set here so it cascades to every piece of text on the site; specific
     elements (.eyebrow, .section-label, etc.) still carry their own
     stronger letter-spacing, which simply wins locally since those
     selectors are more specific than this one */
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink);
  overflow-x: hidden;
}

/* --- the scrolling stage: one head, morphs shape/color across 3 sections --- */
.scroll-track {
  height: 300vh;
  position: relative;
}

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

body.section-open .halo,
body.section-open .copy,
body.section-open .scroll-hint,
body.section-open .section-nav,
body.section-open .brand-header,
body.section-open .order-btn,
body.section-open .head-wrap {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.halo {
  position: absolute;
  width: min(70vw, 560px);
  height: min(70vw, 560px);
  border-radius: 50%;
  background: radial-gradient(circle, var(--halo) 0%, transparent 70%);
  opacity: 0.25;
  filter: blur(10px);
  animation: halo-pulse 4s ease-in-out infinite;
  pointer-events: none;
  transition: background-color 0.4s ease, opacity 0.25s ease;
}

@keyframes halo-pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.18; }
  50%      { transform: scale(1.06); opacity: 0.32; }
}

.head-wrap {
  position: relative;
  width: min(60vw, 420px);
  height: min(60vw, 420px);
  animation: head-float 3.6s ease-in-out infinite;
}

@keyframes head-float {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50%      { transform: translateY(-16px) rotate(1.5deg); }
}

/* --- idle speech bubble: random short DevOps quips, popping up on a random side --- */
.speech-bubble {
  position: absolute;
  width: max-content;
  max-width: min(220px, 78vw);
  padding: 0.6rem 0.9rem;
  background: #ffffff;
  color: #14141a;
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 5;
}
.speech-bubble::before,
.speech-bubble::after {
  content: "";
  position: absolute;
  border: 9px solid transparent;
}
.speech-bubble::after { border-width: 7px; }

/* Centering uses inset + margin:auto rather than left:50%/translateX(-50%) —
   percentage-based translate combined with the show/hide transform (scale + a
   second translate) was resolving against the wrong box and pushing the whole
   bubble off toward one edge instead of centering it. inset+auto-margin
   centers reliably regardless of the bubble's own (text-dependent) width. */

/* above the head, tail pointing down */
.speech-bubble.bubble-top {
  bottom: 100%;
  left: 0;
  right: 0;
  margin: 0 auto 16px;
  transform: translateY(8px) scale(0.92);
}
.speech-bubble.bubble-top.visible { opacity: 1; transform: translateY(0) scale(1); }
.speech-bubble.bubble-top::before { top: 100%; left: 50%; transform: translateX(-50%); border-top-color: var(--ink); margin-top: 1px; }
.speech-bubble.bubble-top::after { top: 100%; left: 50%; transform: translateX(-50%); border-top-color: #ffffff; }

/* to the left of the head, tail pointing right — fixed % top instead of
   vertical auto-margin centering, which stretched the bubble full-height */
.speech-bubble.bubble-left {
  right: 100%;
  top: 30%;
  margin-right: 16px;
  transform: translateX(8px) scale(0.92);
}
.speech-bubble.bubble-left.visible { opacity: 1; transform: translateX(0) scale(1); }
.speech-bubble.bubble-left::before { top: 50%; left: 100%; transform: translateY(-50%); border-left-color: var(--ink); margin-left: 1px; }
.speech-bubble.bubble-left::after { top: 50%; left: 100%; transform: translateY(-50%); border-left-color: #ffffff; }

/* to the right of the head, tail pointing left */
.speech-bubble.bubble-right {
  left: 100%;
  top: 30%;
  margin-left: 16px;
  transform: translateX(-8px) scale(0.92);
}
.speech-bubble.bubble-right.visible { opacity: 1; transform: translateX(0) scale(1); }
.speech-bubble.bubble-right::before { top: 50%; right: 100%; transform: translateY(-50%); border-right-color: var(--ink); margin-right: 1px; }
.speech-bubble.bubble-right::after { top: 50%; right: 100%; transform: translateY(-50%); border-right-color: #ffffff; }

/* the SVG canvas itself spans the full browser width — centered on
   .head-wrap's own center point, which is itself centered on the page by
   .stage's flex layout, so this ends up centered on the page regardless of
   .head-wrap's own (much smaller) box. .head-wrap stays a normal head-sized
   box purely so the speech bubble still has a sensible small anchor to
   position around (see .speech-bubble below) and so the existing bobbing
   animation still reads as the head moving, not the whole window. */
#head-svg {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100vw;
  height: min(60vw, 420px);
  transform: translate(-50%, -50%);
  cursor: pointer;
  touch-action: pan-y;
  transition: transform 0.25s ease;
}
#head-svg:hover { transform: translate(-50%, -50%) scale(1.04); }
#head-svg:active { transform: translate(-50%, -50%) scale(0.97); }
#head-svg:focus { outline: none; }
#head-svg:focus-visible { outline: 3px solid var(--ink); outline-offset: -8px; }

.blob {
  fill: var(--head);
  stroke: var(--ink);
  stroke-width: 6;
  stroke-linejoin: round;
  transition: fill 0.4s ease;
  filter: url(#sketchy-edge);
}

/* second wobbly outline layered on top, differently displaced, to fake the
   uneven double-pass build-up of a hand-drawn ink line */
.blob-sketch {
  fill: none;
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linejoin: round;
  opacity: 0.5;
  filter: url(#sketchy-edge-2);
  pointer-events: none;
}

/* only used by the expanded overlay now (the small head's mascots have no
   brows) — the enlarged view is meant to be just the plain eye floating on
   a full-bleed color wash, no linework/contours on top of it */
.brow {
  display: none;
}

/* the sketchy feTurbulence/feDisplacementMap filters are expensive to keep
   re-rasterizing on a large, constantly-resizing element — and once the
   expanded blob overflows the viewBox (see KEYFRAMES comment in script.js)
   its outline isn't even visible anymore. Skip the filter work entirely on
   the overlay so the open/close animation stays smooth. */
#expand-svg .blob,
#expand-svg .brow {
  filter: none;
}
#expand-svg .blob-sketch {
  display: none;
}

/* --- the three mascot logos: accurate, brand-authentic static markup (see
   index.html), laid out as one continuous horizontal filmstrip that scroll
   position pans across (see frame() in script.js). Always fully opaque —
   visibility comes purely from being panned into/out of the SVG viewBox, no
   fading. Only the scrolling head has these; the expanded overlay's blob is
   deliberately just a full-bleed color wash (see the expandedRadii comment
   in script.js), so a specific logo shape would never be visible there
   anyway. */
.mascot {
  opacity: 1;
}
/* slide layer: JS sets a translate() attribute here directly every frame
   (see frame() in script.js) — kept off .mascot-breathe so it doesn't fight
   the CSS breathing animation, since an element can only have one effective
   `transform` source at a time. */
.mascot-breathe {
  transform-box: fill-box;
  transform-origin: center;
  animation: mascot-breathe 4.2s ease-in-out infinite;
}
@keyframes mascot-breathe {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.015) rotate(0.5deg); }
}
@media (prefers-reduced-motion: reduce) {
  .mascot-breathe { animation: none; }
}

/* --- eyes (shared by the scrolling head's mascots and the expanded overlay) --- */
.eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 4.5s ease-in-out infinite;
}
/* no stroke: the small head's logo eyes are meant to stay flat/authentic
   (no contour), and the expanded overlay's eyes drop their contour too */
.eye-white { fill: #ffffff; }
/* the small head's pupils keep their own fixed brand colors (set inline in
   index.html); only the expanded overlay's pupils still color-interpolate
   via --pupil across the scroll */
#expand-svg .pupil { fill: var(--pupil); }

@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%           { transform: scaleY(0.06); }
}

/* shared typographic treatment: uppercase + tracked-out mono, used for the
   eyebrow labels, the big bottom section label, and the top-right nav —
   a terminal/devops accent against the sans-serif body copy */
.eyebrow,
.section-label,
.nav-item {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--mono);
}

/* --- copy blocks, cross-faded by JS as you scroll --- */
.copy {
  position: absolute;
  left: 50%;
  bottom: 12vh;
  transform: translateX(-50%);
  text-align: center;
  max-width: 34rem;
  padding: 0 1.5rem;
  pointer-events: none;
  color: var(--text);
  transition: color 0.4s ease;
}
.eyebrow {
  font-size: 0.75rem;
  opacity: 0.6;
  margin: 0 0 0.5rem;
}
.section-label {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  margin: 0;
}

/* --- top-right nav: jump between sections --- */
.brand-header {
  position: fixed;
  top: 2rem;
  left: 2rem;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--text);
  transition: opacity 0.25s ease, color 0.4s ease;
}
.brand-header span:first-child { font-weight: 700; opacity: 0.9; }
.brand-header span:last-child { opacity: 0.55; }

.order-btn {
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: inline-block;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--mono);
  white-space: nowrap;
  transition: opacity 0.25s ease, transform 0.2s ease;
}
.order-btn:hover { transform: translateX(-50%) translateY(-2px); opacity: 0.9; }

.section-nav {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  transition: opacity 0.25s ease;
}
.nav-item {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--text);
  opacity: 0.45;
  cursor: pointer;
  transition: opacity 0.2s ease, color 0.4s ease;
}
.nav-item:hover { opacity: 0.8; }
.nav-item.current { opacity: 1; }

.scroll-hint {
  position: absolute;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--text);
  transition: opacity 0.25s ease, color 0.4s ease;
  text-transform: uppercase;
  font-family: var(--mono);
  opacity: 0.5;
  animation: hint-bob 1.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes hint-bob {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, 6px); }
}

/* =========================================================================
   Expand overlay: the head "spreads out" from its exact on-screen position
   to a near-fullscreen panel. Position/size are set to raw pixel values by
   JS (a FLIP animation), so top/left/width/height are the only things
   that transition here — no CSS-side layout guessing.
   ========================================================================= */
.expand-overlay {
  position: fixed;
  top: 50vh;
  left: 50vw;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition:
    top 0.7s cubic-bezier(.34, 1.4, .4, 1),
    left 0.7s cubic-bezier(.34, 1.4, .4, 1),
    width 0.7s cubic-bezier(.34, 1.4, .4, 1),
    height 0.7s cubic-bezier(.34, 1.4, .4, 1);
}
/* .visible: the overlay itself is on screen (stays true through the whole shrink,
   so the close animation is actually visible instead of vanishing instantly).
   .active: the content/close-btn should be showing (dropped immediately on close,
   independent of .visible, so text disappears fast while the box keeps shrinking). */
.expand-overlay.visible { opacity: 1; pointer-events: auto; }
/* time-reversed mirror of the opening curve, so closing plays like open-in-reverse */
.expand-overlay.closing { transition-timing-function: cubic-bezier(.6, 0, .66, -.4); }

#expand-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.close-btn {
  /* fixed top-right corner, independent of eye layout — it used to sit
     centered in the gap between two eyes, which broke once a mascot (the
     Kubernetes wheel) has only one eye dead-center in that same spot */
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  transform: scale(0.6);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  /* closed by default: fade out fast, no delay, so it's gone before the box shrinks */
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.close-btn:hover { background: rgba(0, 0, 0, 0.16); }
.expand-overlay.active .close-btn {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  /* opening: wait for the box to (almost) finish growing, then fade in */
  transition: opacity 0.3s ease 0.35s, transform 0.3s ease 0.35s, background 0.2s ease;
}

.panel-content {
  position: absolute;
  top: 27%;
  left: 50%;
  width: 80%;
  max-height: 65%;
  transform: translateX(-50%);
  text-align: center;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: break-word;
  opacity: 0;
  pointer-events: none;
  /* soft fade at the bottom edge: a visual hint that the list scrolls when it overflows */
  mask-image: linear-gradient(to bottom, black calc(100% - 20px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 20px), transparent 100%);
  /* closed by default: fade out fast, no delay */
  transition: opacity 0.2s ease;
}
.expand-overlay.active .panel-content {
  opacity: 1;
  pointer-events: auto;
  /* opening: wait for the box to (almost) finish growing, then fade in */
  transition: opacity 0.35s ease 0.35s;
}
.panel-content .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  opacity: 0.6;
  margin: 0 0 0.5rem;
}
.panel-content h1 {
  font-size: clamp(1.3rem, 3vw, 2rem);
  margin: 0 0 0.6rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.panel-content p { margin: 0 0 0.6rem; opacity: 0.75; line-height: 1.5; }

.cv-btn {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--mono);
  white-space: nowrap;
}
.cv-btn:hover { opacity: 0.85; }
.cv-btn-compact {
  margin-top: 0;
  margin-bottom: 1rem;
  padding: 0.5rem 1.1rem;
  font-size: 0.78rem;
  align-self: flex-start;
}

/* --- single column: CV button sits above the full-width bio/stack text
   (same max-width as .timeline below it, so the two line up) --- */
.about-top {
  display: flex;
  flex-direction: column;
  max-width: 34rem;
  margin: 0 auto;
  text-align: left;
}

.about-role {
  font-weight: 700;
  opacity: 1 !important;
  margin: 0 0 0.4rem !important;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.about-stack { font-size: 0.85rem; }

.timeline {
  text-align: left;
  max-width: 34rem;
  margin: 1.4rem auto 0;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.timeline-item {
  padding-left: 0.9rem;
  border-left: 2px solid rgba(0, 0, 0, 0.15);
  opacity: 0.55;
}
.timeline-item.timeline-current {
  opacity: 1;
  border-left-width: 3px;
  border-left-color: var(--ink);
  padding-bottom: 0.2rem;
}
.timeline-item h3 { margin: 0 0 0.15rem; font-size: 0.7rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.02em; }
.timeline-item p { margin: 0; font-size: 0.68rem; opacity: 0.75; }
.timeline-item.timeline-current h3 { font-size: 1.05rem; }
.timeline-item.timeline-current p { font-size: 0.88rem; opacity: 0.85; }

.project-category {
  text-align: left;
  font-size: 0.95rem;
  font-weight: 700;
  opacity: 1;
  margin: 2.2rem 0 0.9rem;
  letter-spacing: 0.1em;
  /* block-level (not inline) so it sits at the left edge of .panel-content
     like the list below it, instead of following the panel's own
     text-align: center as an inline element would */
  display: block;
  width: 100%;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--ink);
}
.project-category:first-of-type { margin-top: 1rem; }

.project-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  text-align: left;
}
.project-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  padding: 0.5rem;
  margin: -0.5rem;
  border-radius: 14px;
  transition: background 0.2s ease;
}
.project-item:hover { background: rgba(0, 0, 0, 0.05); }
.project-item:hover .project-thumb { transform: scale(1.04); }
.project-thumb {
  flex: 0 0 120px;
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 10px;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}
.project-text h3 { margin: 0 0 0.3rem; font-size: 0.95rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.02em; }
.project-text p { margin: 0 0 0.3rem; font-size: 0.9rem; opacity: 0.75; }
.project-link { font-size: 0.8rem; font-weight: 600; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }

.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.2rem;
  margin-top: 1rem;
}
.cert-thumb {
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  overflow: hidden;
  padding: 0;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.cert-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cert-thumb:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: var(--ink);
}

/* --- lightbox: zoomed certificate view --- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  background: rgba(0, 0, 0, 0.78);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.lightbox.visible { opacity: 1; pointer-events: auto; }
.lightbox-media {
  max-width: 88vw;
  max-height: 74vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-media img {
  max-width: 88vw;
  max-height: 74vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: block;
}
.lightbox-caption { color: #ffffff; text-align: center; max-width: 70vw; }
.lightbox-caption h3 { margin: 0 0 0.2rem; font-weight: 600; }
.lightbox-caption p { margin: 0; opacity: 0.7; font-size: 0.85rem; }
.lightbox-close {
  position: absolute;
  top: 5vh;
  right: 5vw;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 1.5rem;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.24); }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.28); }
.lightbox-prev { left: 3vw; }
.lightbox-next { right: 3vw; }

@media (max-width: 640px) {
  .lightbox-nav { width: 42px; height: 42px; }
  .lightbox-prev { left: 2vw; }
  .lightbox-next { right: 2vw; }
}

@media (max-width: 640px) {
  .close-btn { width: 38px; height: 38px; font-size: 1.3rem; }
  .panel-content { width: 90%; top: 31%; max-height: 62%; }
  .project-item { flex-direction: column; }
  .project-thumb { flex: none; width: 100%; height: 140px; }
  .cert-grid { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
  .copy { bottom: 11vh; }
  .section-label { font-size: 1.3rem; letter-spacing: 0.08em; }
  .section-nav { top: 1.2rem; right: 1.2rem; gap: 0.4rem; }
  .nav-item { font-size: 0.65rem; }
  .brand-header { top: 1.2rem; left: 1.2rem; font-size: 0.65rem; }
  .order-btn { top: 4rem; padding: 0.5rem 1rem; font-size: 0.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  .halo { animation: none; opacity: 0.22; }
  .eye { animation: none; }
  .scroll-hint { animation: none; }
  .head-wrap { animation: none; }
  #head-svg { transition: none; }
}
