/* =====================================================================
   Josh Colon portfolio: "graphite" theme
   Original stylesheet. Inspired by the dark, framed, low-chroma look of
   graphite.dev (featured in the Tailwind CSS showcase); no code or assets
   were copied from that site.
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;

  --radius-sm: 0.5rem;
  --radius: 0.75rem;
  --radius-lg: 1.1rem;
  --header-h: 4rem;
  --container: 76rem;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* warm-to-cool spectrum used sparingly for edge glows */
  --spectrum: conic-gradient(
    from 180deg,
    #ff8a5b,
    #f7b36a,
    #ffe08a,
    #54e1c1,
    #7dd3fc,
    #a78bfa,
    #f472b6,
    #ff8a5b
  );
}

body.dark-theme {
  color-scheme: dark;
  --bg: #070707;
  --bg-soft: #0b0b0b;
  --panel: #0f0f0f;
  --panel-2: #141414;
  --panel-hover: #181818;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f5f5f5;
  --muted: #a8a8a8;
  --dim: #969696;
  --btn-light-bg: #ececec;
  --btn-light-fg: #0a0a0a;
  --btn-dark-bg: #1a1a1a;
  --btn-dark-fg: #f5f5f5;
  --glow: rgba(255, 255, 255, 0.07);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  --stage-bg: #0a0a0a;
}

body:not(.dark-theme) {
  color-scheme: light;
  --bg: #fafafa;
  --bg-soft: #f4f4f4;
  --panel: #ffffff;
  --panel-2: #f6f6f6;
  --panel-hover: #f1f1f1;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.16);
  --text: #0a0a0a;
  --muted: #4a4a4a;
  --dim: #5f5f5f;
  --btn-light-bg: #0a0a0a;
  --btn-light-fg: #fafafa;
  --btn-dark-bg: #ffffff;
  --btn-dark-fg: #0a0a0a;
  --glow: rgba(0, 0, 0, 0.04);
  --shadow: 0 30px 70px rgba(0, 0, 0, 0.1);
  --stage-bg: #0c0c0c;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition:
    background-color 0.4s ease,
    color 0.4s ease;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

h1,
h2,
h3,
h4 {
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text);
}

::selection {
  background: rgba(125, 211, 252, 0.35);
}

:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 3px;
  border-radius: 6px;
}

body:not(.dark-theme) :focus-visible {
  outline-color: #0369a1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--btn-light-bg);
  color: var(--btn-light-fg);
  font-size: 0.875rem;
  transform: translateY(-200%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: none;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.main {
  position: relative;
  z-index: 1;
}

.section {
  position: relative;
  padding-block: 6.5rem;
}

/* ---------- Layered background ----------
   Four quiet layers, all CSS (works from file:// too):
   1. a deep graphite / paper-white gradient on the fixed layer itself
   2. a fine dot grid, radially masked so it fades toward the edges (dark);
      topographic contour lines instead in the light theme (.bg-topo)
   3. 2-3 soft diagonal light beams drifting very slowly (transform only)
   4. a static film-grain tile (inline SVG feTurbulence)
   plus a spotlight glow behind the hero hex frame (.hero-visual::before).
   Colours are registered custom properties so the theme toggle cross-fades. */
@property --bg-top { syntax: "<color>"; inherits: true; initial-value: #0c0c0f; }
@property --bg-bottom { syntax: "<color>"; inherits: true; initial-value: #050505; }
@property --bg-halo { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0.035); }
@property --dot-color { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0.085); }
@property --beam-color { syntax: "<color>"; inherits: true; initial-value: rgba(214, 206, 255, 0.05); }
@property --spot-core { syntax: "<color>"; inherits: true; initial-value: rgba(236, 232, 255, 0.14); }
@property --spot-edge { syntax: "<color>"; inherits: true; initial-value: rgba(167, 139, 250, 0.05); }

body.dark-theme {
  --bg-top: #0c0c0f;
  --bg-bottom: #050505;
  --bg-halo: rgba(255, 255, 255, 0.035);
  --dot-color: rgba(255, 255, 255, 0.085);
  --beam-color: rgba(214, 206, 255, 0.05);
  --spot-core: rgba(236, 232, 255, 0.14);
  --spot-edge: rgba(167, 139, 250, 0.05);
  --grain-opacity: 0.05;
}

body:not(.dark-theme) {
  --bg-top: #fbfaf7;
  --bg-bottom: #f1f0ec;
  --bg-halo: rgba(255, 255, 255, 0.55);
  --dot-color: rgba(24, 24, 40, 0.17);
  --beam-color: rgba(255, 255, 255, 0.6);
  --spot-core: rgba(250, 251, 252, 0.92);
  --spot-edge: rgba(148, 163, 184, 0.16);
  --grain-opacity: 0.045;
}

body {
  transition:
    background-color 0.4s ease,
    color 0.4s ease,
    --bg-top 0.5s ease,
    --bg-bottom 0.5s ease,
    --bg-halo 0.5s ease,
    --dot-color 0.5s ease,
    --beam-color 0.5s ease,
    --spot-core 0.5s ease,
    --spot-edge 0.5s ease;
}

.bg-layers {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
  background:
    radial-gradient(120% 70% at 50% -10%, var(--bg-halo), transparent 60%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.bg-layers > * {
  position: absolute;
  inset: 0;
}

.bg-dots {
  background-image: radial-gradient(circle at center, var(--dot-color) 1px, transparent 1.6px);
  background-size: 22px 22px;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 38%, #000 0%, rgba(0, 0, 0, 0.45) 45%, transparent 78%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 38%, #000 0%, rgba(0, 0, 0, 0.45) 45%, transparent 78%);
}

/* light theme only: topographic contour lines (static SVG tile, assets/img/topo.svg,
   generated offline and seamless). The tile layer drifts a few dozen px very slowly
   (transform only, no repaint); a static paper-coloured wash (::after) softens the
   lines where the hero copy sits (cheaper than masking the moving layer). Hidden and
   paused in dark mode so the dark background is unchanged. */
.bg-topo {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}

body:not(.dark-theme) .bg-topo {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0s;
}

.bg-topo::before {
  content: "";
  position: absolute;
  inset: -80px;
  background: center / 1200px 1200px repeat;
  animation: topo-drift 70s ease-in-out infinite alternate;
  animation-play-state: paused;
  will-change: transform;
}

/* line strength lives on the moving layer itself, not the group, so the browser
   doesn't re-blend the whole group every frame */
body:not(.dark-theme) .bg-topo::before {
  background-image: url("../img/topo.svg?v=3"); /* light only: dark never fetches it */
  opacity: 0.6;
  animation-play-state: running;
}

.bg-topo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 36% 42% at 26% 42%, rgba(251, 250, 247, 0.78) 0%, rgba(251, 250, 247, 0.45) 55%, rgba(251, 250, 247, 0) 100%);
}

/* flowing contours (assets/js/topo-flow.js, light theme, motion allowed): a WebGL
   canvas redraws the same field as it slowly shifts; once its first frame is up the
   static tile is hidden and its drift paused. Without WebGL2 (or with reduced motion)
   the static tile simply stays. */
.topo-flow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  body:not(.dark-theme) .bg-topo.is-flowing .topo-flow { opacity: 0.6; }
  body:not(.dark-theme) .bg-topo.is-flowing::before { opacity: 0; animation-play-state: paused; }
}

@keyframes topo-drift {
  from { transform: translate3d(-36px, 22px, 0); }
  to { transform: translate3d(36px, -22px, 0); }
}

/* light theme: the contours replace the dot field */
body:not(.dark-theme) .bg-dots {
  opacity: 0;
}

.bg-dots {
  transition: opacity 0.5s ease;
}

.bg-beams span {
  position: absolute;
  top: -40%;
  left: 0;
  width: 18vmax;
  height: 180%;
  background: linear-gradient(90deg, transparent, var(--beam-color) 45%, var(--beam-color) 55%, transparent);
  transform: translate3d(var(--x0), 0, 0) rotate(28deg);
  animation: beam-drift var(--dur) ease-in-out infinite alternate;
  will-change: transform;
}

.bg-beams span:nth-child(1) { --x0: 8vw; --x1: 22vw; --dur: 46s; }
.bg-beams span:nth-child(2) { --x0: 52vw; --x1: 40vw; --dur: 58s; width: 11vmax; opacity: 0.8; animation-delay: -20s; }
.bg-beams span:nth-child(3) { --x0: 78vw; --x1: 92vw; --dur: 64s; width: 24vmax; opacity: 0.6; animation-delay: -35s; }

@keyframes beam-drift {
  from { transform: translate3d(var(--x0), 0, 0) rotate(28deg); }
  to { transform: translate3d(var(--x1), 0, 0) rotate(28deg); }
}

.bg-grain {
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1.4 -.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

body:not(.dark-theme) .bg-grain {
  mix-blend-mode: multiply;
}

/* phones: one beam fewer, a tighter dot field */
@media (max-width: 640px) {
  .bg-beams span:nth-child(3) {
    display: none;
  }

  .bg-beams span:nth-child(1) { --x0: -6vw; --x1: 14vw; width: 34vmax; }
  .bg-beams span:nth-child(2) { --x0: 58vw; --x1: 46vw; width: 20vmax; }

  .bg-dots {
    background-size: 18px 18px;
  }

  /* phones: smaller contour tile, no copy wash (copy spans the full width) */
  .bg-topo::before { background-size: 1000px 1000px; }
  .bg-topo::after { display: none; }
  body:not(.dark-theme) .bg-topo::before { opacity: 0.5; }
  body:not(.dark-theme) .bg-topo.is-flowing .topo-flow { opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-topo::before {
    animation: none !important;
    will-change: auto;
  }

  .bg-beams span {
    animation: none !important;
    will-change: auto;
  }
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
  height: 2px;
  background: linear-gradient(90deg, #f7b36a, #7dd3fc, #a78bfa);
  transform: scaleX(0);
  transform-origin: left;
}


/* ---------- Live demos ticker (projects section) ----------
   Graphite-style pill strip; the track travels left to right and loops
   seamlessly (site.js clones the group; clones are aria-hidden, links tabindex -1). */
.live-ticker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 100%;
  margin: 0 0 2rem;
  padding: 0.3rem 0.3rem 0.3rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: 0.875rem;
  overflow: hidden;
}

.ticker-label {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ticker-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}

.ticker-viewport {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
}

.ticker-track {
  display: flex;
  width: max-content;
}

.ticker-group {
  display: flex;
  flex: none;
  gap: 0.5rem;
  margin: 0;
  padding: 0 0.25rem;
  list-style: none;
}

.ticker-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  overflow: hidden;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

.ticker-link:hover,
.ticker-link:focus-visible {
  background: var(--line);
}

.ticker-link:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

.ticker-tag {
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ticker-text {
  color: var(--muted);
}

.ticker-text strong {
  margin-right: 0.35rem;
  color: var(--text);
  font-weight: 600;
}

.ticker-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--muted);
  transition:
    color 0.2s ease,
    gap 0.2s ease;
}

.ticker-link:hover .ticker-cta,
.ticker-link:focus-visible .ticker-cta {
  color: var(--text);
  gap: 0.45rem;
}

/* motion: only once JS has built the loop and motion is allowed */
.live-ticker.is-looping .ticker-track {
  animation: ticker-ltr var(--ticker-duration, 40s) linear infinite;
}

.live-ticker.is-looping:hover .ticker-track {
  animation-play-state: paused;
}

/* keyboard focus: stop and rest at the start so the real links are in view */
.live-ticker.is-looping:focus-within .ticker-track {
  animation: none;
  transform: none;
}

@keyframes ticker-ltr {
  from { transform: translate3d(-50%, 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}

/* no JS or reduced motion: a static, horizontally scrollable row */
.live-ticker:not(.is-looping) .ticker-viewport {
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-mask-image: none;
  mask-image: none;
}

@media (max-width: 640px) {
  .live-ticker {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    padding: 0.55rem 0.3rem 0.3rem;
    border-radius: 1.1rem;
    font-size: 0.8rem;
  }

  .ticker-label {
    padding-left: 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-ticker .ticker-track {
    animation: none !important;
    transform: none !important;
  }

  .live-ticker .ticker-track {
    width: auto;
  }

  .live-ticker .ticker-viewport {
    overflow: visible;
  }

  .live-ticker .ticker-group {
    flex: 1;
    flex-wrap: wrap;
  }

  .live-ticker .ticker-group li {
    min-width: 0;
  }

  .live-ticker .ticker-link {
    flex-wrap: wrap;
    border-radius: 0.75rem;
    white-space: normal;
  }
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    backdrop-filter 0.3s ease;
}

.site-header.bg-header {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom-color: var(--line);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--header-h);
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.55rem;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 0 0 1px var(--line-strong), 0 0 24px var(--glow);
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav_link {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.9rem;
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
}

.nav_link:hover,
.nav_link.active-link {
  color: var(--text);
  background: var(--glow);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--btn-dark-bg);
  color: var(--text);
  font-size: 1.05rem;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s ease;
}

.icon-btn:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
}

.nav-toggle,
.nav-close {
  display: none;
}

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.925rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  isolation: isolate;
  transition:
    transform 0.15s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.25s ease;
}

.btn-sm {
  min-height: 2.35rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.875rem;
}

.btn i {
  transition: transform 0.2s var(--ease-out);
}

.btn:hover i {
  transform: translateX(2px);
}

.btn:hover i.ri-arrow-right-up-line {
  transform: translate(2px, -2px);
}

/* light pill with a soft spectrum edge glow */
.btn-light {
  background: var(--btn-light-bg);
  color: var(--btn-light-fg);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.2) inset,
    0 6px 24px -8px rgba(247, 179, 106, 0.35),
    0 6px 28px -10px rgba(125, 211, 252, 0.4);
}

.btn-light::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  z-index: -1;
  border-radius: inherit;
  background: var(--spectrum);
  opacity: 0.75;
  filter: blur(0.5px);
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.btn-light::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--btn-light-bg);
}

.btn-light:hover::before {
  opacity: 1;
  filter: blur(3px);
}

.btn-dark {
  border: 1px solid var(--line-strong);
  background: var(--btn-dark-bg);
  color: var(--btn-dark-fg);
}

.btn-dark:hover {
  background: var(--panel-hover);
}

/* ---------- Tap / press feedback (all platforms) ---------- */
.btn:active,
.icon-btn:active,
.tile:active,
.scrollup:active,
.nav_link:active,
.infinite-spiral__button:active {
  transform: scale(0.97);
}

.tap-ripple {
  position: absolute;
  z-index: 3;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.55),
    rgba(125, 211, 252, 0.25) 45%,
    transparent 70%
  );
  animation: tap-ripple 0.6s var(--ease-out) forwards;
}

body:not(.dark-theme) .tap-ripple {
  background: radial-gradient(
    circle,
    rgba(0, 0, 0, 0.25),
    rgba(3, 105, 161, 0.18) 45%,
    transparent 70%
  );
}

.btn-light .tap-ripple {
  background: radial-gradient(
    circle,
    rgba(125, 211, 252, 0.6),
    rgba(247, 179, 106, 0.3) 45%,
    transparent 70%
  );
}

@keyframes tap-ripple {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(18);
  }
}

/* ---------- Section headings ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 2px;
  background: linear-gradient(135deg, #f7b36a, #7dd3fc);
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.6);
}

.section-heading {
  display: grid;
  gap: 1rem;
  max-width: 44rem;
  margin-bottom: 3rem;
}

.section-heading.center {
  justify-items: center;
  margin-inline: auto;
  text-align: center;
}

.section-heading h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.035em;
}

.section-intro {
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.075rem;
}

/* ---------- Frames (bordered panels with corner marks) ---------- */
.frame {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  box-shadow: var(--shadow);
}

.corner {
  position: absolute;
  width: 11px;
  height: 11px;
  pointer-events: none;
  color: var(--dim);
  opacity: 0.8;
}

.corner::before,
.corner::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.corner::before {
  top: 5px;
  left: 0;
  width: 11px;
  height: 1px;
}

.corner::after {
  top: 0;
  left: 5px;
  width: 1px;
  height: 11px;
}

.corner.tl {
  top: 0.85rem;
  left: 0.85rem;
}
.corner.tr {
  top: 0.85rem;
  right: 0.85rem;
}
.corner.bl {
  bottom: 0.85rem;
  left: 0.85rem;
}
.corner.br {
  bottom: 0.85rem;
  right: 0.85rem;
}

/* ---------- Tiles (cards with pointer spotlight) ---------- */
.tile {
  --mx: 50%;
  --my: 50%;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition:
    border-color 0.25s ease,
    background-color 0.25s ease,
    transform 0.2s ease;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    420px circle at var(--mx) var(--my),
    rgba(255, 255, 255, 0.07),
    transparent 45%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

body:not(.dark-theme) .tile::before {
  background: radial-gradient(
    420px circle at var(--mx) var(--my),
    rgba(0, 0, 0, 0.045),
    transparent 45%
  );
}

.tile > * {
  position: relative;
  z-index: 1;
}

.tile:hover,
.tile:focus-visible,
.tile:focus-within {
  border-color: var(--line-strong);
  background: var(--panel-2);
}

.tile:hover::before,
.tile:focus-visible::before {
  opacity: 1;
}

/* ---------- Hero ---------- */
.hero {
  padding-top: 4.5rem;
  padding-bottom: 3rem;
}

.hero-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: center;
  gap: 3rem;
}

.hero-copy {
  display: grid;
  justify-items: start;
  gap: 1.5rem;
}

.hero-copy h1 {
  font-size: clamp(2.6rem, 5.6vw, 4.5rem);
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.hero-lede {
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.hero-actions.center {
  justify-content: center;
}

.hero-note {
  color: var(--dim);
  font-size: 0.875rem;
}

.hero-note a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.hero-note a:hover {
  color: var(--text);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  max-width: 30rem;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
}

.hero-metrics div {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.2rem;
  padding: 1rem 1rem 0 0;
}

.hero-metrics div + div {
  padding-left: 1rem;
  border-left: 1px solid var(--line);
}

.hero-metrics dd {
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.hero-metrics dt {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* hero visual: neon, layered hexagon mark with the portrait in its tunnel.
   Original parametric geometry (three nested, progressively turned rounded
   hexagons joined by two hairpins), stacked smaller/softer/fainter for depth. */
.hero-visual {
  --hex-stroke: #ffffff;
  --hex-glow: 0.825;
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 34rem;
  aspect-ratio: 1;
  margin-inline: auto;
  margin-bottom: 3.25rem;
  color: var(--hex-stroke);
}

body:not(.dark-theme) .hero-visual {
  --hex-stroke: #141414;
  --hex-glow: 0.2;
}

/* spotlight glow behind the hex frame (layer 1 of the background mix) */
.hero-visual::before {
  content: "";
  position: absolute;
  inset: -38%;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(closest-side, var(--spot-core), var(--spot-edge) 45%, transparent 100%);
}

.hero {
  overflow-x: clip;
}

@media (max-width: 640px) {
  /* hex sits under the copy here: keep the glow off the stats and bio */
  .hero-visual::before {
    inset: -12%;
  }
}

.hero-hex {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.hero-hex use {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-hex .hx-line {
  stroke-width: 5.25;
}

.hero-hex .hx-glow {
  stroke-width: 10;
  opacity: var(--hex-glow);
}

/* Neon flicker-on when the rings light up in dark mode.
   Pure CSS: the animation starts whenever body gains .dark-theme, so a quick
   re-toggle simply restarts it, and nothing is held dim afterwards
   (fill-mode backwards only; the resting state is the normal steady glow).
   - first load in dark: one short stutter (~0.85s incl. delay)
   - switching light -> dark (site.js adds .theme-switched): the full ~1.4s start-up
   Photosensitivity (WCAG 2.3.1): at most 2.5 full-contrast flashes in any
   1s window; the "buzz" between them only dips to >= 0.92 opacity, which
   stays above 0.80 relative luminance, so it is not a flash. */
body.dark-theme .hero-hex .hx-layer > g {
  animation: hex-ignite-load 0.7s linear 0.15s backwards;
}

body.dark-theme .hero-hex .hx-layer > g .hx-glow {
  animation: hex-glow-buzz 0.7s linear 0.15s backwards;
}

body.dark-theme.theme-switched .hero-hex .hx-layer > g {
  animation: hex-ignite 1.4s linear backwards;
}

body.dark-theme.theme-switched .hero-hex .hx-layer > g .hx-glow {
  animation: hex-glow-buzz 1.4s linear backwards;
}

/* inner tubes catch a few ms late, like separate neon segments */
body.dark-theme .hero-hex .hx-layer:nth-of-type(2) > g,
body.dark-theme .hero-hex .hx-layer:nth-of-type(2) > g .hx-glow { animation-delay: 0.18s; }
body.dark-theme .hero-hex .hx-layer:nth-of-type(3) > g,
body.dark-theme .hero-hex .hx-layer:nth-of-type(3) > g .hx-glow { animation-delay: 0.2s; }
body.dark-theme .hero-hex .hx-layer:nth-of-type(4) > g,
body.dark-theme .hero-hex .hx-layer:nth-of-type(4) > g .hx-glow { animation-delay: 0.22s; }
body.dark-theme.theme-switched .hero-hex .hx-layer:nth-of-type(2) > g,
body.dark-theme.theme-switched .hero-hex .hx-layer:nth-of-type(2) > g .hx-glow { animation-delay: 0.03s; }
body.dark-theme.theme-switched .hero-hex .hx-layer:nth-of-type(3) > g,
body.dark-theme.theme-switched .hero-hex .hx-layer:nth-of-type(3) > g .hx-glow { animation-delay: 0.05s; }
body.dark-theme.theme-switched .hero-hex .hx-layer:nth-of-type(4) > g,
body.dark-theme.theme-switched .hero-hex .hx-layer:nth-of-type(4) > g .hx-glow { animation-delay: 0.07s; }

/* 1.4s: off, on 150-220ms, off, on 600-680ms (with a small buzz), dim
   half-glow, ignite at 1150ms and settle with a low-amplitude buzz */
@keyframes hex-ignite {
  0%, 10.6% { opacity: 0.06; }
  10.8%, 15.6% { opacity: 1; }
  15.8%, 42.7% { opacity: 0.1; }
  43% { opacity: 1; }
  45% { opacity: 0.94; }
  46.5%, 48.4% { opacity: 1; }
  48.7% { opacity: 0.12; }
  65%, 82% { opacity: 0.2; }
  82.2% { opacity: 1; }
  86% { opacity: 0.93; }
  89% { opacity: 1; }
  93% { opacity: 0.95; }
  96%, 100% { opacity: 1; }
}

/* 0.7s: off, one stutter at ~120-190ms, ignite at ~420ms, settle */
@keyframes hex-ignite-load {
  0%, 17% { opacity: 0.06; }
  17.4%, 27% { opacity: 1; }
  27.4%, 45% { opacity: 0.12; }
  59.6% { opacity: 0.2; }
  60% { opacity: 1; }
  72% { opacity: 0.93; }
  80%, 100% { opacity: 1; }
}

/* glow halo breathes while the tube stabilises */
@keyframes hex-glow-buzz {
  0%, 70% { opacity: calc(var(--hex-glow) * 0.75); }
  78% { opacity: var(--hex-glow); }
  84% { opacity: calc(var(--hex-glow) * 0.8); }
  90%, 100% { opacity: var(--hex-glow); }
}

/* portrait sits in the dark centre of the smallest layer */
.portrait-wrap {
  position: relative;
  z-index: 1;
  width: 28%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #0b0b0b;
  -webkit-clip-path: polygon(78.28% 13.06%, 80.68% 13.95%, 82.76% 15.15%, 84.53% 16.66%, 85.97% 18.47%, 87.10% 20.60%, 87.90% 23.03%, 96.13% 56.02%, 96.56% 58.55%, 96.56% 60.95%, 96.14% 63.23%, 95.29% 65.39%, 94.01% 67.43%, 92.31% 69.34%, 67.85% 92.96%, 65.88% 94.59%, 63.80% 95.80%, 61.61% 96.57%, 59.32% 96.92%, 56.92% 96.83%, 54.41% 96.31%, 21.72% 86.94%, 19.32% 86.05%, 17.24% 84.85%, 15.47% 83.34%, 14.03% 81.53%, 12.90% 79.40%, 12.10% 76.97%, 3.87% 43.98%, 3.44% 41.45%, 3.44% 39.05%, 3.86% 36.77%, 4.71% 34.61%, 5.99% 32.57%, 7.69% 30.66%, 32.15% 7.04%, 34.12% 5.41%, 36.20% 4.20%, 38.39% 3.43%, 40.68% 3.08%, 43.08% 3.17%, 45.59% 3.69%);
  clip-path: polygon(78.28% 13.06%, 80.68% 13.95%, 82.76% 15.15%, 84.53% 16.66%, 85.97% 18.47%, 87.10% 20.60%, 87.90% 23.03%, 96.13% 56.02%, 96.56% 58.55%, 96.56% 60.95%, 96.14% 63.23%, 95.29% 65.39%, 94.01% 67.43%, 92.31% 69.34%, 67.85% 92.96%, 65.88% 94.59%, 63.80% 95.80%, 61.61% 96.57%, 59.32% 96.92%, 56.92% 96.83%, 54.41% 96.31%, 21.72% 86.94%, 19.32% 86.05%, 17.24% 84.85%, 15.47% 83.34%, 14.03% 81.53%, 12.90% 79.40%, 12.10% 76.97%, 3.87% 43.98%, 3.44% 41.45%, 3.44% 39.05%, 3.86% 36.77%, 4.71% 34.61%, 5.99% 32.57%, 7.69% 30.66%, 32.15% 7.04%, 34.12% 5.41%, 36.20% 4.20%, 38.39% 3.43%, 40.68% 3.08%, 43.08% 3.17%, 45.59% 3.69%);
}

/* soft inner falloff so the photo reads as the end of the tunnel */
.portrait-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 52%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
}

body:not(.dark-theme) .portrait-wrap::after {
  background: radial-gradient(circle at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.18) 100%);
}

/* crop: a 540px square of the 1024x1536 source centred on the face
   (face centre measured at x 484, y 270) */
.portrait-photo {
  position: absolute;
  top: 0;
  left: -39.63%;
  width: 189.63%;
  max-width: none;
  height: 284.44%;
  object-fit: fill;
  background: var(--panel);
}

/* Glitch on the hex mark, after the blog-platform title: two colour-split
   copies sliced with clip-path inset() and nudged sideways in steps(1) bursts
   (~0.35s every 7s; a 0.9s loop while hovered). Portfolio spectrum colours:
   sky + pink in dark, deeper cyan + magenta in light. Overlays are absolutely
   positioned and only use opacity/transform/clip-path, so nothing shifts. */
.hex-glitch {
  --glitch-a: #7dd3fc;
  --glitch-b: #f472b6;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
}

body:not(.dark-theme) .hex-glitch {
  --glitch-a: #0891b2;
  --glitch-b: #db2777;
  mix-blend-mode: multiply;
}

.hex-glitch use {
  stroke-width: 5.25;
}

.hex-glitch-a { color: var(--glitch-a); animation: hex-glitch-a 7s steps(1, end) infinite; }
.hex-glitch-b { color: var(--glitch-b); animation: hex-glitch-b 7s steps(1, end) infinite; }
.hero-hex:not(.hex-glitch) { animation: hex-jolt 7s steps(1, end) infinite; }

@media (hover: hover) {
  /* hover = a short sustained burst (~0.5s glitching per 1.2s loop) */
  .hero-visual:hover .hex-glitch-a { animation: hex-glitch-a-hover 1.2s steps(1, end) infinite; }
  .hero-visual:hover .hex-glitch-b { animation: hex-glitch-b-hover 1.2s steps(1, end) infinite; }
  .hero-visual:hover .hero-hex:not(.hex-glitch) { animation: hex-jolt-hover 1.2s steps(1, end) infinite; }
}
@keyframes hex-glitch-a-hover {
  0%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 100% 0); }
  4% { opacity: 0.9; transform: translate(-7px, 2px); clip-path: inset(10% 0 58% 0); }
  14% { opacity: 0.9; transform: translate(5px, -2px); clip-path: inset(60% 0 8% 0); }
  24% { opacity: 0.9; transform: translate(-4px, 0); clip-path: inset(30% 0 44% 0); }
  34% { opacity: 0.9; transform: translate(6px, 1px); clip-path: inset(72% 0 4% 0); }
  44% { opacity: 0; transform: none; clip-path: inset(0 0 100% 0); }
}
@keyframes hex-glitch-b-hover {
  0%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 100% 0); }
  8% { opacity: 0.9; transform: translate(7px, 0); clip-path: inset(38% 0 32% 0); }
  18% { opacity: 0.9; transform: translate(-5px, 2px); clip-path: inset(14% 0 68% 0); }
  28% { opacity: 0.9; transform: translate(4px, -1px); clip-path: inset(52% 0 20% 0); }
  38% { opacity: 0.9; transform: translate(-6px, 1px); clip-path: inset(4% 0 80% 0); }
  46% { opacity: 0; transform: none; clip-path: inset(0 0 100% 0); }
}
@keyframes hex-jolt-hover {
  0%, 100% { transform: none; }
  6% { transform: translate(2px, 0); }
  16% { transform: translate(-2px, 1px); }
  26% { transform: translate(1px, -1px); }
  36% { transform: translate(-1px, 0); }
  46% { transform: none; }
}

@keyframes hex-glitch-a {
  0%, 90%, 100% { opacity: 0; transform: none; clip-path: none; }
  91% { opacity: 0.9; transform: translate(-7px, 2px); clip-path: inset(10% 0 58% 0); }
  93% { opacity: 0.9; transform: translate(5px, -2px); clip-path: inset(60% 0 8% 0); }
  95% { opacity: 0; }
}

@keyframes hex-glitch-b {
  0%, 91%, 100% { opacity: 0; transform: none; clip-path: none; }
  92% { opacity: 0.85; transform: translate(7px, 0); clip-path: inset(38% 0 32% 0); }
  94% { opacity: 0.85; transform: translate(-5px, 2px); clip-path: inset(14% 0 68% 0); }
  96% { opacity: 0; }
}

/* the mark itself twitches a couple of pixels during the burst */
@keyframes hex-jolt {
  0%, 91%, 96%, 100% { transform: none; }
  92% { transform: translateX(-2px); }
  94% { transform: translateX(2px); }
}

/* Scroll replay (site.js): when the portrait scrolls back into view the mark
   replays its theme-switch start-up: the neon ignite in dark mode plus one
   colour-split glitch burst in both themes. .hex-reset drops the animations
   for one frame so the same keyframes restart cleanly every time. */
.hero-visual.hex-reset .hero-hex,
.hero-visual.hex-reset .hero-hex .hx-layer > g,
.hero-visual.hex-reset .hero-hex .hx-layer > g .hx-glow {
  animation: none !important;
}

body.dark-theme .hero-visual.hex-replay .hero-hex .hx-layer > g {
  animation: hex-ignite 1.4s linear backwards;
}

body.dark-theme .hero-visual.hex-replay .hero-hex .hx-layer > g .hx-glow {
  animation: hex-glow-buzz 1.4s linear backwards;
}

body.dark-theme .hero-visual.hex-replay .hero-hex .hx-layer:nth-of-type(2) > g,
body.dark-theme .hero-visual.hex-replay .hero-hex .hx-layer:nth-of-type(2) > g .hx-glow { animation-delay: 0.03s; }
body.dark-theme .hero-visual.hex-replay .hero-hex .hx-layer:nth-of-type(3) > g,
body.dark-theme .hero-visual.hex-replay .hero-hex .hx-layer:nth-of-type(3) > g .hx-glow { animation-delay: 0.05s; }
body.dark-theme .hero-visual.hex-replay .hero-hex .hx-layer:nth-of-type(4) > g,
body.dark-theme .hero-visual.hex-replay .hero-hex .hx-layer:nth-of-type(4) > g .hx-glow { animation-delay: 0.07s; }

.hero-visual.hex-replay .hex-glitch-a { animation: hex-glitch-a-hover 1.2s steps(1, end) 0.1s 1; }
.hero-visual.hex-replay .hex-glitch-b { animation: hex-glitch-b-hover 1.2s steps(1, end) 0.1s 1; }
.hero-visual.hex-replay .hero-hex:not(.hex-glitch) { animation: hex-jolt-hover 1.2s steps(1, end) 0.1s 1; }

.status-pill {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.82rem;
  white-space: nowrap;
  transform: translateX(-50%);
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #54e1c1;
  box-shadow: 0 0 0 0 rgba(84, 225, 193, 0.6);
  animation: status-pulse 2.2s ease-out infinite;
}

@keyframes status-pulse {
  0% { box-shadow: 0 0 0 0 rgba(84, 225, 193, 0.55); }
  70%, 100% { box-shadow: 0 0 0 8px rgba(84, 225, 193, 0); }
}

/* "trusted by" style strip */
.logo-strip {
  display: grid;
  grid-template-columns: minmax(10rem, 13rem) 1fr;
  align-items: center;
  gap: 2rem;
  margin-top: 4.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.logo-strip p {
  color: var(--dim);
  font-size: 0.85rem;
  line-height: 1.4;
}

.brands {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}

.brands li {
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.brands li:hover {
  opacity: 1;
}

/* ---------- Capabilities: isometric layer stack ---------- */
/* Tilted glass plates stacked on translateZ, one per skill layer, with the
   real text beside them. skill-layers.js sets --gap/--origin-y (mobile
   alignment), --spread (scroll ease-in) and .is-active; without JS the stack
   simply renders fanned out. */
.layers {
  --n: 5;
  --plate: 15rem;
  --tilt-x: 58deg;
  --tilt-z: -45deg;
  --gap: 5.25rem;
  --spread: 1;
  --lift: 1.6rem;
  --reveal: 5rem; /* plates above the active one lift away so its face shows */
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  padding: 1.5rem 3rem 1.5rem 2rem;
}

.layers-visual {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
  display: grid;
  place-items: center;
  height: min(40rem, calc(100vh - var(--header-h) - 3rem));
  pointer-events: none;
}

.layers-stage {
  position: relative;
  width: var(--plate);
  height: var(--plate);
  /* drop the stage by half the stack height so the whole stack is centred */
  margin-top: calc(((var(--n) - 1) * var(--gap) * var(--spread) + var(--reveal)) * 0.85);
  transform: rotateX(var(--tilt-x)) rotateZ(var(--tilt-z));
  transform-style: preserve-3d;
}

.layer-plate {
  --is-active: 0;
  --is-above: 0;
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.025) 48%, rgba(255, 255, 255, 0.06)),
    rgba(20, 20, 20, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 1px 0 0 rgba(255, 255, 255, 0.1),
    1.6rem 1.6rem 3rem rgba(0, 0, 0, 0.55);
  transform: translateZ(
    calc(
      (var(--n) - 1 - var(--i)) * var(--gap) * var(--spread) + var(--is-active) * var(--lift) +
        var(--is-above) * var(--reveal)
    )
  );
  transform-style: preserve-3d;
  transition:
    transform 0.7s var(--ease-out),
    border-color 0.4s ease,
    box-shadow 0.4s ease;
}

/* slab underside, so each plate reads as a thick tile */
.layer-plate::before {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: inherit;
  background: #050505;
  transform: translateZ(-0.6rem);
}

/* glass sheen across the face */
.layer-plate::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.09) 46%, transparent 60%);
  pointer-events: none;
}

.layer-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.layer-face img {
  width: 44%;
  height: 44%;
  object-fit: contain;
  /* counter-rotate so the logo faces forward on the tilted plate */
  transform: rotateZ(45deg);
  opacity: 0.55;
  filter: grayscale(0.7);
  transition: opacity 0.4s ease, filter 0.4s ease;
}

.layer-plate.is-above {
  --is-above: 1;
}

.layer-plate.is-active {
  --is-active: 1;
  border-color: color-mix(in srgb, var(--accent) 55%, white);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent),
    0 0 3.5rem -0.5rem color-mix(in srgb, var(--accent) 55%, transparent),
    1.6rem 1.6rem 3rem rgba(0, 0, 0, 0.55);
}

.layer-plate.is-active .layer-face img,
.layers:not(.is-ready) .layer-face img {
  opacity: 1;
  filter: none;
}

body:not(.dark-theme) .layer-plate {
  border-color: rgba(0, 0, 0, 0.1);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.85)),
    rgba(236, 236, 236, 0.9);
  box-shadow:
    inset 0 1px 0 #fff,
    1.4rem 1.4rem 2.6rem rgba(0, 0, 0, 0.12);
}

body:not(.dark-theme) .layer-plate::before {
  border-color: rgba(0, 0, 0, 0.08);
  background: #d6d6d6;
}

body:not(.dark-theme) .layer-plate.is-active {
  border-color: color-mix(in srgb, var(--accent) 70%, black);
  box-shadow:
    inset 0 1px 0 #fff,
    0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent),
    0 0 3rem -0.5rem color-mix(in srgb, var(--accent) 45%, transparent),
    1.4rem 1.4rem 2.6rem rgba(0, 0, 0, 0.14);
}

.layers-copy {
  display: grid;
  list-style: none;
}

.layer-item {
  position: relative;
  display: grid;
  align-content: center;
  gap: 0.7rem;
  min-height: clamp(18rem, 58vh, 30rem);
  padding: 1.5rem 0 1.5rem 1.5rem;
  border-left: 1px solid var(--line);
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, background-color 0.3s ease;
}

.layer-item::before {
  content: "";
  position: absolute;
  top: 1.5rem;
  bottom: 1.5rem;
  left: -1px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.5s var(--ease-out);
}

.layer-item.is-active::before {
  transform: scaleY(1);
}

.layer-item:active {
  transform: scale(0.985);
}

.layer-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.layer-index {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.layer-item h3 {
  color: var(--muted);
  font-size: clamp(1.45rem, 2.6vw, 2.1rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  transition: color 0.4s ease;
}

.layer-item.is-active h3,
.layers:not(.is-ready) .layer-item h3 {
  color: var(--text);
}

.layer-item p {
  max-width: 30rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.layer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.3rem;
  list-style: none;
}

.layer-chips li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.2;
}

.layer-chips img {
  width: 1rem;
  height: 1rem;
  object-fit: contain;
}

/* single-colour black brand marks (Vercel) flip to white on the dark theme */
body.dark-theme .layer-chips img.icon-mono {
  filter: invert(1);
}

/* Tablet and phone: the stack sits beside the text, fully inside the card,
   with each plate lined up with its layer (see skill-layers.js). The plate
   is rotated 45deg, so its projected width is plate * sqrt(2); --glow-pad
   leaves room for the active glow on the left. */
@media (max-width: 899px) {
  .layers {
    --plate: clamp(4.5rem, 32vw - 1.75rem, 8rem);
    --plate-w: calc(var(--plate) * 1.4143);
    --glow-pad: 1.25rem;
    --gap: 9rem;
    --lift: 0.6rem;
    --reveal: 0rem;
    display: block;
    position: relative;
    overflow: clip;
    padding: 1.25rem 1rem 1.25rem 0;
  }

  .layers-visual {
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(var(--glow-pad) + var(--plate-w));
    height: auto;
  }

  .layers-stage {
    position: absolute;
    top: var(--origin-y, 85%);
    left: calc(var(--glow-pad) + var(--plate-w) / 2);
    margin: calc(var(--plate) / -2) 0 0 calc(var(--plate) / -2);
  }

  /* tighter glow and shadow so nothing spills past the card edge */
  .layer-plate,
  .layer-plate.is-active {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.22),
      0.7rem 0.7rem 1.2rem rgba(0, 0, 0, 0.5);
  }

  .layer-plate.is-active {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.3),
      0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent),
      0 0 1.25rem -0.25rem color-mix(in srgb, var(--accent) 60%, transparent),
      0.7rem 0.7rem 1.2rem rgba(0, 0, 0, 0.5);
  }

  body:not(.dark-theme) .layer-plate {
    box-shadow:
      inset 0 1px 0 #fff,
      0.6rem 0.6rem 1.1rem rgba(0, 0, 0, 0.12);
  }

  body:not(.dark-theme) .layer-plate.is-active {
    box-shadow:
      inset 0 1px 0 #fff,
      0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent),
      0 0 1.25rem -0.25rem color-mix(in srgb, var(--accent) 50%, transparent),
      0.6rem 0.6rem 1.1rem rgba(0, 0, 0, 0.14);
  }

  .layers-copy {
    padding-left: calc(var(--glow-pad) + var(--plate-w) + 0.25rem);
  }

  .layer-item {
    min-height: 0;
    gap: 0.55rem;
    padding: 1.1rem 0 1.1rem 1rem;
    border-left-color: transparent;
  }

  .layer-item::before {
    top: 1.1rem;
    bottom: 1.1rem;
  }

  .layer-item h3 {
    font-size: 1.35rem;
  }

  .layer-item p {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  /* compact skill list instead of pills on small screens */
  .layer-chips {
    gap: 0.15rem 0.6rem;
    margin-top: 0.1rem;
  }

  .layer-chips li {
    gap: 0.3rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
  }

  .layer-chips img {
    width: 0.8rem;
    height: 0.8rem;
  }
}

.offer-heading {
  margin-top: 7rem;
}

.bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.offer-card {
  display: grid;
  align-content: end;
  gap: 0.65rem;
  min-height: 15rem;
  padding: 1.75rem;
}

.offer-card.span-2 {
  grid-column: span 2;
}

.offer-card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 60%;
  aspect-ratio: 1;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(125, 211, 252, 0.12),
    transparent 65%
  );
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.6s var(--ease-out);
}

.offer-card:nth-child(2)::after,
.offer-card:nth-child(4)::after {
  background: radial-gradient(
    circle,
    rgba(247, 179, 106, 0.12),
    transparent 65%
  );
}

.offer-card:hover::after {
  transform: scale(1.15);
}

.card-icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: auto;
  border: 1px solid var(--line-strong);
  border-radius: 0.65rem;
  background: var(--bg-soft);
  font-size: 1.3rem;
}

.offer-card h3 {
  margin-top: 2.5rem;
  font-size: 1.3rem;
}

.offer-card p {
  max-width: 28rem;
  color: var(--muted);
}

/* ---------- Projects (same structure, new skin) ---------- */
.project-gallery {
  --scroll-tilt-x: 0deg;
  --scroll-tilt-y: 0deg;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(19rem, 0.95fr);
  gap: 1rem;
  min-height: min(42rem, calc(100vh - 13rem));
  padding: 2.25rem;
  transform: perspective(1400px) rotateX(var(--scroll-tilt-x))
    rotateY(var(--scroll-tilt-y));
  transition: transform 0.2s linear;
}

.project-stage {
  --project-accent: #7dd3fc;
  position: relative;
  min-width: 0;
  height: min(38rem, 68vh);
  min-height: 24rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--project-accent) 45%, transparent);
  border-radius: var(--radius);
  background:
    radial-gradient(
      ellipse 65% 55% at 50% 55%,
      color-mix(in srgb, var(--project-accent) 22%, transparent),
      transparent 70%
    ),
    var(--stage-bg);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--project-accent) 18%, transparent),
    0 0 60px -10px color-mix(in srgb, var(--project-accent) 35%, transparent);
  transition:
    border-color 0.4s ease,
    box-shadow 0.4s ease,
    background 0.4s ease;
}

.project-stage {
  touch-action: pan-y;
}

.project-stage:focus-visible {
  outline: 2px solid var(--project-accent);
  outline-offset: 3px;
}

/* swipe: the cards follow the finger a little, then spring back */
.infinite-spiral__item {
  translate: var(--swipe-x, 0px) 0;
  transition: translate 0.35s var(--ease-out);
}

.infinite-spiral.is-dragging .infinite-spiral__item {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .infinite-spiral__item,
  .project-nav-icon {
    transition: none;
  }
}

.project-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}

.infinite-spiral {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 20rem;
  overflow: hidden;
  isolation: isolate;
}

.infinite-spiral__item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--spiral-card-width);
  height: var(--spiral-card-height);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--spiral-card-radius);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity, filter;
}

.infinite-spiral__button {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: #111;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.infinite-spiral__button::after {
  content: "";
  position: absolute;
  inset: 30% 0 0;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.85));
  pointer-events: none;
}

.infinite-spiral__item.is-selected .infinite-spiral__button,
.infinite-spiral__button:hover,
.infinite-spiral__button:focus-visible {
  outline: 2px solid var(--project-accent);
  outline-offset: 2px;
}

.infinite-spiral__item.is-selected .infinite-spiral__image,
.infinite-spiral__item.is-front .infinite-spiral__image,
.infinite-spiral__button:hover .infinite-spiral__image {
  filter: grayscale(0) !important;
}

.infinite-spiral__image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  user-select: none;
  transition:
    opacity 0.35s ease,
    filter 0.4s ease;
}

/* Light screenshot crossfades in over the dark one on the front card and the picked (selected) card. */
.infinite-spiral__image--light {
  opacity: 0;
}

.infinite-spiral__item.is-front .infinite-spiral__image--light,
.infinite-spiral__item.is-picked .infinite-spiral__image--light {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .infinite-spiral__image {
    transition: none;
  }
}

.infinite-spiral__label {
  position: absolute;
  inset: auto 0 0;
  z-index: 1;
  padding: 0.55rem 0.45rem 0.45rem;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

/* right column: just the selected project's details (picked from the stack) */
.project-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.project-tab-detail {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 15rem;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(
      ellipse 80% 60% at 100% 0%,
      color-mix(in srgb, var(--project-accent, #7dd3fc) 10%, transparent),
      transparent 70%
    ),
    var(--panel);
}

.project-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.project-detail-count {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

/* the selected project's light screenshot, so the panel never looks empty */
.project-detail-preview {
  margin: 1rem 0 0.4rem;
  overflow: hidden;
  aspect-ratio: 720 / 522;
  border: 1px solid color-mix(in srgb, var(--project-accent, #7dd3fc) 40%, var(--line));
  border-radius: calc(var(--radius) - 4px);
  background: var(--stage-bg);
  box-shadow: 0 18px 40px -24px color-mix(in srgb, var(--project-accent, #7dd3fc) 60%, transparent);
}

.project-detail-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: project-preview-in 0.45s var(--ease-out);
}

@keyframes project-preview-in {
  from {
    opacity: 0;
    transform: scale(1.03);
  }
}

/* Previous / Next: graphite buttons joined by a faint contour line */
.project-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1.1rem;
}

.btn.project-nav-btn {
  width: 2.875rem;
  height: 2.875rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  color: var(--muted);
}

.project-nav-btn:hover,
.project-nav-btn:focus-visible {
  color: var(--text, currentColor);
}

.project-nav-icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  transition: transform 0.2s var(--ease-out);
}

#project-prev:hover .project-nav-icon {
  transform: translateX(-2px);
}

#project-next:hover .project-nav-icon {
  transform: translateX(2px);
}

.project-nav-btn:hover,
.project-nav-btn:focus-visible {
  border-color: color-mix(in srgb, var(--project-accent, #7dd3fc) 55%, var(--line-strong));
}

.project-nav-btn:active {
  background: color-mix(in srgb, var(--project-accent, #7dd3fc) 16%, var(--btn-dark-bg));
}

.project-nav-line {
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(
    90deg,
    color-mix(in srgb, var(--project-accent, #7dd3fc) 45%, transparent) 0 6px,
    transparent 6px 11px
  );
  opacity: 0.7;
}

/* phones and tablets: the stack sits right above, so skip the duplicate preview */
@media (max-width: 1023px) {
  .project-detail-preview {
    display: none;
  }
}

.project-detail-type {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.project-tab-detail h3 {
  margin-top: 0.6rem;
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  letter-spacing: -0.035em;
}

.project-tab-detail p {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.project-tab-detail a {
  align-self: flex-start;
  margin-top: 1.3rem;
}

/* live site plus optional demo / GitHub buttons, wrapping on narrow panels */
.project-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.3rem;
}

.project-tab-detail .project-detail-actions a {
  margin-top: 0;
}

.project-detail-actions a[hidden] {
  display: none;
}

/* square icon-only button (GitHub); its name comes from aria-label + title */
.btn-icon {
  width: 2.35rem;
  padding-inline: 0;
}

.btn-icon i {
  font-size: 1.1rem;
}

/* phones: keep Live / demo / GitHub on one row; the decorative arrows go */
@media (max-width: 640px) {
  .project-detail-actions {
    gap: 0.4rem;
  }

  .project-detail-actions .btn-sm:not(.btn-icon) {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 0.6rem;
  }

  .project-detail-actions .ri-arrow-right-up-line {
    display: none;
  }
}

/* read more: the description clamps to two lines (set by project-showcase.js) */
.project-tab-detail .readmore-text {
  overflow: hidden;
  transition: max-height 0.45s var(--ease-out);
}

.project-tab-detail .readmore-text.is-clamped {
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 1.1em), rgba(0, 0, 0, 0.18));
  mask-image: linear-gradient(180deg, #000 calc(100% - 1.1em), rgba(0, 0, 0, 0.18));
}

.readmore-instant {
  transition: none !important;
}

.readmore-toggle {
  position: relative;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.35rem 0 -0.35rem -0.4rem;
  padding: 0.55rem 0.4rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    transform 0.15s ease;
}

.readmore-toggle:hover,
.readmore-toggle[aria-expanded="true"] {
  color: var(--text);
}

.readmore-toggle:hover {
  background: var(--panel-hover);
}

.readmore-toggle:active {
  transform: scale(0.97);
}

.readmore-toggle i {
  font-size: 1rem;
  transition: transform 0.3s var(--ease-out);
}

.readmore-toggle[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.readmore-toggle[hidden] {
  display: none;
}

/* when a case study makes the detail column taller, the stage stays in view */
@media (min-width: 1024px) {
  .project-stage {
    position: sticky;
    top: calc(var(--header-h) + 1.25rem);
    align-self: start;
  }
}

/* case study: expandable panel inside the project detail */
.case-study {
  margin-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.case-study summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0 0.1rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
  transition: color 0.2s ease;
}

.case-study summary::-webkit-details-marker {
  display: none;
}

.case-study summary:hover,
.case-study[open] summary {
  color: var(--text);
}

.case-study summary i {
  font-size: 1rem;
  transition: transform 0.3s var(--ease-out);
}

.case-study[open] summary i {
  transform: rotate(45deg);
}

.case-study-list {
  display: grid;
  gap: 0.95rem;
  margin: 0.9rem 0 0;
}

.case-study-row {
  display: grid;
  grid-template-columns: 7.2rem minmax(0, 1fr);
  gap: 0.9rem;
}

.case-study-row dt {
  padding-top: 0.2rem;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.case-study-row dd {
  margin: 0;
  min-width: 0;
}

.project-tab-detail .case-study-row p,
.case-study-points li {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.case-study-points {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.case-study-points li {
  position: relative;
  padding-left: 1rem;
}

.case-study-points li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 0.4rem;
  height: 1px;
  background: var(--project-accent, var(--dim));
}

.case-study-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.case-study-stack li {
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

@media (max-width: 560px) {
  .case-study-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}

/* ---------- About ---------- */
.about-shell {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 3rem;
  align-items: start;
}

.left-heading {
  position: sticky;
  top: calc(var(--header-h) + 2rem);
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.about-card {
  padding: 1.75rem;
}

.about-card h3 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.4rem;
  font-size: 1.15rem;
}

.about-card h3 i {
  color: var(--muted);
  font-weight: 400;
}

.timeline {
  display: grid;
  gap: 0;
  border-left: 1px solid var(--line-strong);
}

.timeline li {
  position: relative;
  display: grid;
  gap: 0.15rem;
  padding: 0 0 1.15rem 1.2rem;
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  left: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--muted);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.timeline li:hover::before {
  background: #7dd3fc;
  border-color: #7dd3fc;
  box-shadow: 0 0 10px rgba(125, 211, 252, 0.7);
}

.timeline span {
  font-weight: 500;
}

.timeline small {
  color: var(--dim);
  font-size: 0.85rem;
}

/* ---------- Contact / closing CTA ---------- */
.cta {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1.1rem;
  max-width: 48rem;
  margin: 0 auto 4rem;
  text-align: center;
}

.cta-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
  width: min(42rem, 100%);
  height: 18rem;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, rgba(125, 211, 252, 0.13), transparent),
    radial-gradient(closest-side at 30% 60%, rgba(247, 179, 106, 0.1), transparent);
  filter: blur(20px);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.cta-title {
  color: var(--text);
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.cta-lede {
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.075rem;
}

.contact-shell {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 1.25rem;
  align-items: start;
}

.contact-links {
  display: grid;
  gap: 0.75rem;
}

.contact-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.9rem;
  padding: 1.05rem 1.15rem;
  overflow-wrap: anywhere;
}

.contact-row > i:first-child {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--bg-soft);
  font-size: 1.1rem;
}

.contact-row span {
  display: grid;
  font-weight: 500;
}

.contact-row small {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.row-arrow {
  color: var(--dim);
  transition: transform 0.2s var(--ease-out), color 0.2s ease;
}

.contact-row:hover .row-arrow {
  color: var(--text);
  transform: translate(2px, -2px);
}

.contact_form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 2.25rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field-area {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.field textarea {
  min-height: 8.5rem;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--dim);
}

.field input:focus-visible,
.field textarea:focus-visible {
  border-color: #7dd3fc;
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.2);
}

body:not(.dark-theme) .field input:focus-visible,
body:not(.dark-theme) .field textarea:focus-visible {
  border-color: #0369a1;
  box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.15);
}

.form-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.contact_message {
  min-height: 1.4rem;
  font-size: 0.9rem;
}

.color-red {
  color: #fb7185;
}

body:not(.dark-theme) .color-red {
  color: #be123c;
}

.color-blue {
  color: #54e1c1;
}

body:not(.dark-theme) .color-blue {
  color: #047857;
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 2rem;
  padding-top: 4rem;
  padding-bottom: 3rem;
}

.footer-brand-col {
  display: grid;
  align-content: start;
  gap: 0.9rem;
}

.footer-brand-col p {
  color: var(--muted);
  font-size: 0.925rem;
}

.footer-title {
  margin-bottom: 0.9rem;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-links {
  display: grid;
  gap: 0.55rem;
}

.footer-links a {
  color: var(--muted);
  font-size: 0.925rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.85rem;
}

.footer-bottom span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.footer-mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.footer-wordmark {
  margin-bottom: -0.18em;
  padding-inline: 1rem;
  font-size: clamp(4rem, 15vw, 14rem);
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 0.9;
  text-align: center;
  white-space: nowrap;
  color: transparent;
  background: linear-gradient(180deg, var(--line-strong), transparent 85%);
  -webkit-background-clip: text;
  background-clip: text;
  user-select: none;
}

/* ---------- Scroll-up ---------- */
.scrollup {
  position: fixed;
  right: 1.25rem;
  bottom: -4rem;
  z-index: 90;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--btn-dark-bg);
  color: var(--text);
  font-size: 1.15rem;
  transition:
    bottom 0.35s var(--ease-out),
    background-color 0.2s ease,
    transform 0.15s ease;
}

.scrollup:hover {
  background: var(--panel-hover);
}

.scrollup.show-scroll {
  bottom: 1.25rem;
}

/* ---------- Reveal on scroll ---------- */
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.8s var(--ease-out),
    transform 0.8s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Decrypted text helpers ---------- */
.decrypt-word {
  display: inline-block;
  white-space: nowrap;
}

.decrypt-encrypted {
  color: var(--dim);
}

/* ---------- Custom cursor: dot + contour ripple (fine pointers only; see custom-cursor.js, topo-flow.js) ---------- */
/* the native cursor is hidden only while the custom cursor is showing; text fields
   keep their caret (and the custom cursor hides over them) */
body.custom-cursor-active,
body.custom-cursor-active * {
  cursor: none;
}

body.custom-cursor-active :is(input:not([type="button"], [type="submit"], [type="reset"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), textarea, [contenteditable=""], [contenteditable="true"]) {
  cursor: text;
}

.cursor-contour-root {
  --cursor-ink: #334155; /* slate */
  --cursor-halo: rgba(255, 255, 255, 0.85);
  position: fixed;
  inset: 0;
  z-index: 10000; /* below .app-tooltip */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  contain: strict;
}

body.dark-theme .cursor-contour-root {
  --cursor-ink: #7dd3fc; /* site accent */
  --cursor-halo: rgba(0, 0, 0, 0.4);
}

.cursor-contour-root.is-visible { opacity: 1; }
.cursor-contour-root.is-text { opacity: 0; }

.cursor-contour__dot,
.cursor-contour__glow {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
  transform: translate3d(-100px, -100px, 0);
}

.cursor-contour__dot {
  width: 0;
  height: 0;
}

.cursor-contour__dot::before {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: var(--cursor-ink);
  box-shadow: 0 0 0 1.5px var(--cursor-halo);
  transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.cursor-contour-root.is-link .cursor-contour__dot::before { transform: scale(1.7); }
.cursor-contour-root.is-card .cursor-contour__dot::before { transform: scale(2.3); }
.cursor-contour-root.is-pressed .cursor-contour__dot::before { transform: scale(0.75); }

/* the dark theme's stand-in for the contour ripple: a faint trailing glow */
.cursor-contour__glow {
  width: 220px;
  height: 220px;
  margin: -110px 0 0 -110px;
  border-radius: 50%;
  opacity: 0;
  display: none;
  background: radial-gradient(circle, rgba(125, 211, 252, 0.13), rgba(125, 211, 252, 0.05) 40%, transparent 70%);
}

body.dark-theme .cursor-contour__glow { display: block; }

.magnetic {
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
  will-change: transform;
}

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .nav-toggle,
  .nav-close {
    display: inline-grid;
  }

  .nav-menu {
    position: fixed;
    inset: 0 0 auto;
    z-index: 110;
    display: grid;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1.75rem;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    transform: translateY(-105%);
    visibility: hidden;
    transition:
      transform 0.35s var(--ease-out),
      visibility 0s linear 0.35s;
  }

  .nav-menu.show-menu {
    transform: none;
    visibility: visible;
    transition: transform 0.35s var(--ease-out);
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding-top: 2.5rem;
  }

  .nav_link {
    min-height: 3rem;
    padding: 0.6rem 0.9rem;
    font-size: 1.1rem;
  }

  .nav-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
  }

  .hero-shell {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .hero-visual {
    max-width: 24rem;
  }

  .project-gallery {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 1.75rem;
  }

  .project-stage {
    height: 24rem;
    min-height: 20rem;
  }

  .about-shell {
    grid-template-columns: 1fr;
  }

  .left-heading {
    position: static;
    margin-bottom: 0;
  }

  .contact-shell {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand-col {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .container {
    padding-inline: 1.1rem;
  }

  .section {
    padding-block: 4.5rem;
  }

  .hero {
    padding-top: 2.5rem;
  }

  .br-lg {
    display: none;
  }

  .hero-visual {
    max-width: 22rem;
    margin-bottom: 3rem;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
  }

  .nav-resume {
    display: none;
  }


  .logo-strip {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 3rem;
  }

  .brands {
    justify-content: flex-start;
    gap: 0.5rem 1.25rem;
  }

  .brands li {
    font-size: 1rem;
  }

  .bento {
    grid-template-columns: 1fr;
  }

  .offer-card.span-2 {
    grid-column: auto;
  }

  .offer-card {
    min-height: 12rem;
    padding: 1.4rem;
  }

  .offer-heading {
    margin-top: 5rem;
  }

  .project-gallery {
    padding: 2rem 0.85rem 0.85rem;
  }

  .project-stage {
    height: 20rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .contact_form {
    grid-template-columns: 1fr;
    padding: 2rem 1.1rem 1.25rem;
  }

  .form-footer .btn {
    width: 100%;
  }

  .footer-grid {
    padding-top: 3rem;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js-reveal .reveal {
    opacity: 1;
    transform: none;
  }

  .project-gallery {
    transform: none;
  }

  /* hex rings: no flicker, just a soft fade-in when dark mode turns on */
  body.dark-theme .hero-hex .hx-layer > g,
  body.dark-theme.theme-switched .hero-hex .hx-layer > g {
    animation: hex-fade-in 0.6s ease backwards !important;
    animation-duration: 0.6s !important;
    animation-delay: 0s !important;
  }

  body.dark-theme .hero-hex .hx-layer > g .hx-glow {
    animation: none !important;
  }

  /* no glitch: hide the colour-split copies and keep the mark still */
  .hex-glitch {
    display: none !important;
  }

  .hero-hex {
    animation: none !important;
  }

  /* keep a gentle, non-moving tap acknowledgement */
  .tap-ripple {
    animation: tap-flash 0.25s linear forwards !important;
    animation-duration: 0.25s !important;
    transform: scale(10);
  }

  @keyframes tap-flash {
    from { opacity: 0.8; }
    to { opacity: 0; }
  }
}

@keyframes hex-fade-in {
  from { opacity: 0.06; }
  to { opacity: 1; }
}

/* ---------- Tooltips (assets/js/tooltip.js) ---------- */
/* Graphite: small inverted chip, hairline border, mono caption, quiet fade. */
.app-tooltip {
  position: fixed;
  z-index: 2147483000;
  max-width: min(18rem, calc(100vw - 16px));
  pointer-events: none;
  padding: 0.32rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font: 500 0.72rem/1.35 var(--font-mono);
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(var(--tip-shift, -3px));
  transition: opacity 120ms var(--ease-out), transform 160ms var(--ease-out);
}
.app-tooltip[data-side="top"] { --tip-shift: 3px; }
.app-tooltip[data-state="open"] { opacity: 1; transform: none; }
.app-tooltip[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .app-tooltip { transition: none; transform: none; }
}
