/* ==========================================================================
   style.css - layout and components
   All colors come from the active theme file (css/themes/*.css) via
   var(--token). Do NOT add raw hex/rgb/hsl color literals here.
   ========================================================================== */

/* --- Layout-only local tokens --------------------------------------------- */
:root {
  --header-h: 64px;
  --gutter: 16px;
  --ease: 200ms ease;
}

@media (min-width: 761px) {
  :root { --gutter: 24px; }
}

/* --- Reset ---------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

ul {
  list-style: none;
}

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

[hidden] {
  display: none !important;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* --- Base typography ------------------------------------------------------ */
body {
  min-height: 100vh;
  overflow-x: clip;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  transition: background-color var(--ease), color var(--ease);
}

h1,
h2,
h3 {
  line-height: 1.15;
  font-weight: 700;
}

p {
  color: var(--text-dim);
}

::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

/* --- Skip link (hidden until focused) ------------------------------------ */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  transform: translateY(-200%);
}

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

/* --- Background glow ------------------------------------------------------ */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60vmax 40vmax at 15% 0%, var(--glow-1), transparent 70%),
    radial-gradient(50vmax 40vmax at 90% 30%, var(--glow-2), transparent 70%);
}

/* --- Header / nav --------------------------------------------------------- */
/* The fixed header must not cover the top of main when the skip link jumps there */
main {
  scroll-margin-top: var(--header-h);
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background-color var(--ease), border-color var(--ease);
}

.site-header.is-scrolled,
.site-header.nav-open {
  background: var(--nav-bg);
  border-bottom-color: var(--surface-border);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.logo {
  display: inline-flex;
  border-radius: var(--radius-sm);
}

.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links {
  display: none;
  gap: 4px;
}

.nav-links a,
.nav-links-mobile a {
  display: block;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.95rem;
  transition: color var(--ease), background-color var(--ease);
}

.nav-links a:hover,
.nav-links-mobile a:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn,
.nav-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  color: var(--text-dim);
  transition: color var(--ease), background-color var(--ease);
}

.icon-btn:hover,
.nav-toggle:hover {
  color: var(--text);
  background: var(--surface);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Theme icons: dark shows sun (-> light), light shows moon (-> dark) */
.icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .icon-sun { display: none; }
  :root:not([data-theme]) .icon-moon { display: block; }
}

/* Burger -> X */
.nav-toggle {
  align-content: center;
  gap: 4px;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform var(--ease), opacity var(--ease);
}

.site-header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile dropdown panel */
.nav-links-mobile {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding: 8px var(--gutter) 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--surface-border);
  box-shadow: var(--shadow);
}

.nav-links-mobile.is-open {
  display: block;
}

.nav-links-mobile a {
  padding: 12px;
  font-size: 1rem;
}

@media (min-width: 761px) {
  .nav-links { display: flex; }
  .nav-toggle,
  .nav-links-mobile,
  .nav-links-mobile.is-open { display: none; }
}

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease), transform var(--ease);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  background: var(--accent-2);
}

.btn-ghost {
  border-color: var(--surface-border);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.arrow {
  transition: transform var(--ease);
}

.btn:hover .arrow {
  transform: translateX(3px);
}

/* --- Hero ----------------------------------------------------------------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 100vh;
  min-height: 100svh;
  position: relative;
  padding: calc(var(--header-h) + 32px) var(--gutter) 96px;
  text-align: center;
  scroll-margin-top: var(--header-h);
}

/* Staged entrance: children fade/slide up in sequence (off under reduced motion) */
.hero > * {
  animation: hero-in 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero > :nth-child(2) { animation-delay: 80ms; }
.hero > :nth-child(3) { animation-delay: 160ms; }
.hero > :nth-child(4) { animation-delay: 240ms; }
.hero > :nth-child(5) { animation-delay: 320ms; }
.hero > :nth-child(6) { animation-delay: 400ms; }
.hero > :nth-child(7) { animation-delay: 560ms; }

@keyframes hero-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* With a photo the circle is just a frame; without one it holds the initials. */
.avatar.has-photo {
  padding: 0;
  overflow: hidden;
  background: var(--bg-alt);
}

.avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 500;
  box-shadow: var(--shadow);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.85rem;
}

.status-pill .dot {
  position: relative;
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--surface-border);
}

/* Soft pulse ring; static (hidden under the dot) with reduced motion */
.status-pill .dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--success);
  animation: dot-pulse 2.4s ease-out infinite;
}

@keyframes dot-pulse {
  0% {
    opacity: 0.55;
    transform: scale(1);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(2.6);
  }
}

.hero-title {
  font-size: clamp(2.25rem, 8vw, 4.5rem);
  letter-spacing: -0.02em;
}

.script {
  font-family: var(--font-script);
  font-weight: 400;
  color: var(--accent);
}

/* Accent gradient text; plain --accent where background-clip:text is unsupported */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .script {
    padding: 0 0.08em; /* room for Pacifico swashes inside the clipped box */
    background-image: linear-gradient(100deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}

.hero-sub {
  max-width: 36rem;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.location-chip {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* Scroll cue: small mouse outline with a bobbing wheel */
.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  width: 26px;
  height: 40px;
  margin: 0 auto;
  border: 2px solid var(--text-faint);
  border-radius: 13px;
  transition: border-color var(--ease);
}

/* Keeps the mouse-outline art small while the tap target reaches 44x58 */
.scroll-cue::before {
  content: "";
  position: absolute;
  inset: -9px;
}

.scroll-cue span {
  display: block;
  width: 4px;
  height: 8px;
  margin: 7px auto 0;
  border-radius: 2px;
  background: var(--text-faint);
  animation: cue-bob 1.8s ease-in-out infinite;
  transition: background-color var(--ease);
}

.scroll-cue:hover {
  border-color: var(--accent);
}

.scroll-cue:hover span {
  background: var(--accent);
}

@keyframes cue-bob {
  0%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }
  60% {
    opacity: 0.3;
    transform: translateY(10px);
  }
}

@media (max-height: 560px) {
  .scroll-cue { display: none; }
}

/* --- Sections ------------------------------------------------------------- */
.section {
  padding: 64px 0;
  scroll-margin-top: var(--header-h);
}

.section-inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section-label {
  margin-bottom: 8px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-title {
  margin-bottom: 28px;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: -0.01em;
}

/* Used together with .section-title (h3.section-title.section-title-big) */
.section-title.section-title-big {
  margin-bottom: 16px;
  font-size: clamp(2.5rem, 10vw, 5rem);
  letter-spacing: -0.03em;
}

/* --- Bento grid ----------------------------------------------------------- */
.bento-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.bento-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--surface-border);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: background-color var(--ease), border-color var(--ease);
}

.bento-card:hover {
  border-color: var(--accent);
}

.bento-location {
  min-height: 280px;
}

.bento-big {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
}

.bento-label {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.bento-clock-time {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.bento-sub {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.connect-links {
  display: grid;
  gap: 8px;
}

.bento-connect a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;   /* tap target */
  gap: 6px;
  color: var(--accent);
}

.bento-connect a:hover {
  text-decoration: underline;
}

.link-arrow {
  display: inline-block;
  transition: transform var(--ease);
}

/* Generic: any link holding a .link-arrow nudges it on hover */
a:hover .link-arrow {
  transform: translate(2px, -2px);
}

/* --- Globe (canvas driven by js/globe.js) --------------------------------- */
.globe-wrap {
  position: relative;
  width: 100%;
  max-width: 546px;
  aspect-ratio: 1;
  margin: auto;
  cursor: grab;
  touch-action: none;   /* mouse: drags spin and tilt in both directions */
  -webkit-user-select: none;
  user-select: none;     /* double-click zooms instead of selecting text */
}

/* Touch: vertical swipes must still scroll the page, so a finger can spin
   (and double-tap to zoom) but not tilt. Tilting stays a mouse gesture. */
@media (pointer: coarse) {
  .globe-wrap { touch-action: pan-y; }
}

.globe-wrap.is-fallback {
  touch-action: auto;
}

.globe-wrap.is-dragging {
  cursor: grabbing;
}

.globe-wrap.is-fallback {
  cursor: default;
}

#globe {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 800ms ease;
}

/* Overlay for the web of anchor points, drawn in sync with the globe. */
.globe-web {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 800ms ease 200ms;
}

.globe-wrap.is-ready #globe,
.globe-wrap.is-ready .globe-web {
  opacity: 1;
}

.globe-wrap.is-fallback .globe-web {
  display: none;
}

.globe-wrap.is-over-node {
  cursor: pointer;
}

/* City name shown above a hovered (or tapped) node. */
.globe-tip {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, calc(-100% - 8px));
  padding: 4px 10px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  box-shadow: var(--shadow);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  max-width: 14ch;
  white-space: pre-wrap;   /* overlapping nodes list one city per line */
  overflow-wrap: break-word;
  pointer-events: none;
}

.globe-hint {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 800ms ease;
}

.globe-wrap.is-ready .globe-hint {
  opacity: 1;
}

@media (max-width: 480px) {
  .globe-hint { display: none; }
}

.globe-fallback {
  position: absolute;
  inset: 8%;
  display: grid;
  place-items: center;
  border: 2px dashed var(--surface-border);
  border-radius: 50%;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-align: center;
}

/* --- Tool marquee --------------------------------------------------------- */
.tool-marquee {
  --tool-gap: 36px;
  display: flex;
  min-height: 40px;   /* reserved before js/main.js fills it */
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 6px 0;
  /* Edge fade: the mask only uses alpha, so any opaque token works */
  -webkit-mask-image: linear-gradient(90deg, transparent, var(--text) 10%, var(--text) 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, var(--text) 10%, var(--text) 90%, transparent);
}

.tool-track {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-around;
  gap: var(--tool-gap);
  min-width: 100%;
  padding-right: var(--tool-gap); /* same spacing across the seam between the two tracks */
  animation: tool-scroll 30s linear infinite;
}

.tool-marquee:hover .tool-track,
.tool-marquee:focus-within .tool-track {
  animation-play-state: paused;
}

@keyframes tool-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

.tool {
  display: flex;
  flex-shrink: 0;
}

/* Official brand-coloured <img> from cdn.simpleicons.org (js/main.js).
   The size is fixed here and echoed by the width/height attributes, so the row
   never reflows as the icons arrive and both tracks stay exactly as wide. */
.tool-icon {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
  transition: transform var(--ease);
}

/* An icon that failed to load is hidden by main.js; without this the rule above
   would out-specify the browser's own [hidden] { display: none }. */
.tool-icon[hidden] {
  display: none;
}

/* Colour is the brand's, so the hover cue is a nudge in size instead of a tint. */
.tool:hover .tool-icon {
  transform: scale(1.12);
}

/* Name is for screen readers only (the icon + title tooltip carry it visually) */
.tool-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 761px) {
  .bento-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .bento-location {
    grid-column: span 2;
    grid-row: span 2;
    min-height: 360px;
  }

  .bento-tools {
    grid-column: 1 / -1;
  }
}

/* --- About ---------------------------------------------------------------- */
.about-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.about-text p {
  max-width: 68ch;
  font-size: 1.05rem;
}

/* --- Projects ------------------------------------------------------------- */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 600px) {
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .projects-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Whole card is the link to the repo */
.project-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--surface-border);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: background-color var(--ease), border-color var(--ease), transform var(--ease);
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* Projects with no public link are plain cards: no hover affordance. */
.project-card.is-static:hover {
  border-color: var(--surface-border);
  transform: none;
}

.project-card.is-static:hover .project-name {
  color: var(--text);
}

.project-name {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}

.project-card:hover .project-name {
  color: var(--accent);
}

.project-blurb {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* Tags sit on the card floor so cards of unequal height line up */
.project-card .tags {
  margin-top: auto;
  padding-top: 2px;
}

/* --- Tags (projects + skills) --------------------------------------------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  max-width: 100%;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--pill-bg);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.7;
}

/* --- Skills --------------------------------------------------------------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 16px;
}

/* Same shell as .project-card, but not a link */
.skill-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--surface-border);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: background-color var(--ease), border-color var(--ease);
}

.skill-card:hover {
  border-color: var(--accent);
}

.skill-group {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* --- Timeline (experience + education) ------------------------------------ */
/* One rail for the whole list (drawn on the <ul>, not per item) with a dot
   per entry sitting on it. The left padding makes room for both. */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0.4em;          /* starts level with the first dot */
  bottom: 0;
  left: 4px;           /* rail occupies 4-5px; the dots are centred on it */
  width: 1px;
  background: var(--surface-border);
}

.timeline-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* 9px dot pulled back over the rail: spans 0-9px, so its centre is 4.5px */
.timeline-item::before {
  content: '';
  position: absolute;
  top: 0.4em;
  left: -28px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);   /* masks the rail behind the dot */
}

.timeline-role {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}

.timeline-meta {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* Several titles at one employer: each rung gets its own marker on a short
   inner rail, so a promotion reads as a progression. */
.timeline-roles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--surface-border);
}

.timeline-roles li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline-roles li::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 0.45em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* The current title is filled; earlier ones are hollow. */
.timeline-roles li:not(:first-child)::before {
  background: var(--bg);
  border: 1px solid var(--accent);
}

.timeline-subrole {
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}

.timeline-subdates {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.timeline-blurb {
  max-width: 68ch;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.timeline-item .tags {
  margin-top: 2px;
}

/* --- Activity ------------------------------------------------------------- */
/* The chart keeps a readable width; narrow screens scroll it inside the card
   instead of squashing a year of contributions or widening the page. */
.activity-card:focus-visible {
  border-radius: var(--radius);
}

.activity-card {
  display: grid;
  /* Capped track: the chart may overflow it without dragging the caption and
     the link off-screen with it. */
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  overflow-x: auto;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--surface-border);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  transition: background-color var(--ease), border-color var(--ease);
}

/* main.js swaps these two with the `hidden` attribute on a load error, so
   neither may declare `display` - the global [hidden] rule has to win. */
.activity-chart {
  width: 100%;
  min-width: 520px;
  max-width: 700px;
  height: auto;
  margin: 0 auto; /* resolves to 0 while it overflows, so it scrolls from the left */
}

/* Contribution grid: one square per day, drawn by js/main.js from the raw
   counts so every shade is a theme token (the hosted image is the fallback). */
.activity-grid {
  display: grid;
  grid-template-rows: repeat(7, 11px);
  grid-auto-flow: column;
  grid-auto-columns: 11px;
  gap: 3px;
  justify-content: start;
  min-width: 0;
}

.activity-months {
  display: grid;
  grid-auto-columns: 11px;
  grid-auto-flow: column;
  gap: 3px;
  justify-content: start;
  min-width: 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.4;
}

.activity-day {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--pill-bg);
  border: 1px solid var(--surface-border);
}

.activity-day.is-pad {
  background: none;
  border-color: transparent;
}

/* Levels 1-4 layer the accent over the empty square, so the ramp behaves the
   same in both themes. The lightest step starts at 0.55, not near-zero: the
   hosted chart's faintest shade washed out on a light card. */
.activity-day[data-level="1"] { background: var(--accent); opacity: 0.55; border-color: transparent; }
.activity-day[data-level="2"] { background: var(--accent); opacity: 0.7; border-color: transparent; }
.activity-day[data-level="3"] { background: var(--accent); opacity: 0.85; border-color: transparent; }
.activity-day[data-level="4"] { background: var(--accent); opacity: 1; border-color: transparent; }

.activity-plot {
  position: relative;
  display: grid;
  gap: 4px;
  min-width: 0;
}

/* Day tooltip: follows the hovered square, styled like the globe's label. */
.activity-tip {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, calc(-100% - 6px));
  padding: 4px 10px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  box-shadow: var(--shadow);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  white-space: nowrap;
  pointer-events: none;
}

.activity-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-self: end;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.activity-fallback {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.activity-card .see-all {
  justify-self: center;
}

/* --- Contact -------------------------------------------------------------- */
.contact-text {
  max-width: 36rem;
  margin-bottom: 28px;
  font-size: 1.1rem;
}

/* Left-aligned to match the rest of the contact section */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 20px;
  margin-top: 28px;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;   /* tap target */
  gap: 6px;
  color: var(--accent);
}

.contact-links a:hover {
  text-decoration: underline;
}

/* --- See-all / inline accent links ---------------------------------------- */
.see-all {
  display: inline-flex;
  align-items: center;
  min-height: 44px;   /* tap target */
  gap: 6px;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
}

.see-all:hover {
  text-decoration: underline;
}

.see-all:hover .arrow {
  transform: translateX(3px);
}

/* --- Placeholder stubs ---------------------------------------------------- */
.placeholder {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 24px;
  border: 2px dashed var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
}

/* --- Footer --------------------------------------------------------------- */
.site-footer {
  margin-top: 32px;
  border-top: 1px solid var(--surface-border);
  background: var(--bg-alt);
  transition: background-color var(--ease);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 48px var(--gutter);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 22rem;
}

.footer-heading {
  margin-bottom: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footer-col ul {
  display: grid;
  gap: 8px;
}

.footer-col a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;   /* tap target */
  color: var(--text-dim);
  transition: color var(--ease);
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px var(--gutter);
  border-top: 1px solid var(--surface-border);
  color: var(--text-faint);
  font-size: 0.85rem;
}

@media (min-width: 761px) {
  .footer-inner {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

/* --- Scroll reveal -------------------------------------------------------- */
/* The hidden start state is scoped to :root.js, a class the inline head script
   adds before any stylesheet loads and only when IntersectionObserver exists.
   With JS off (or no observer) these rules never match and everything is just
   there; main.js adds .is-visible once a section enters the viewport. */
:root.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms ease, transform 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

/* Cards inside Projects and Skills, and the entries of each timeline, arrive
   in sequence behind their section */
:root.js .reveal .projects-grid > *,
:root.js .reveal .skills-grid > *,
:root.js .reveal .timeline > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 500ms ease, transform 500ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

:root.js .reveal.is-visible .projects-grid > *,
:root.js .reveal.is-visible .skills-grid > *,
:root.js .reveal.is-visible .timeline > * {
  opacity: 1;
  transform: none;
}

/* 60ms steps, capped at six so a long grid never trails far behind */
:root.js .reveal.is-visible .projects-grid > :nth-child(2),
:root.js .reveal.is-visible .skills-grid > :nth-child(2),
:root.js .reveal.is-visible .timeline > :nth-child(2) { transition-delay: 60ms; }
:root.js .reveal.is-visible .projects-grid > :nth-child(3),
:root.js .reveal.is-visible .skills-grid > :nth-child(3),
:root.js .reveal.is-visible .timeline > :nth-child(3) { transition-delay: 120ms; }
:root.js .reveal.is-visible .projects-grid > :nth-child(4),
:root.js .reveal.is-visible .skills-grid > :nth-child(4),
:root.js .reveal.is-visible .timeline > :nth-child(4) { transition-delay: 180ms; }
:root.js .reveal.is-visible .projects-grid > :nth-child(5),
:root.js .reveal.is-visible .skills-grid > :nth-child(5),
:root.js .reveal.is-visible .timeline > :nth-child(5) { transition-delay: 240ms; }
:root.js .reveal.is-visible .projects-grid > :nth-child(6),
:root.js .reveal.is-visible .skills-grid > :nth-child(6),
:root.js .reveal.is-visible .timeline > :nth-child(6) { transition-delay: 300ms; }
:root.js .reveal.is-visible .projects-grid > :nth-child(n+7),
:root.js .reveal.is-visible .skills-grid > :nth-child(n+7),
:root.js .reveal.is-visible .timeline > :nth-child(n+7) { transition-delay: 360ms; }

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

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  /* Tool strip: static, wrapped, single copy */
  .tool-marquee {
    -webkit-mask-image: none;
    mask-image: none;
  }

  .tool-track {
    flex-shrink: 1;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px 28px;
    padding-right: 0;
  }

  .tool-track[aria-hidden="true"] {
    display: none;
  }

  /* Hover effects stay, but nothing moves */
  .project-card:hover,
  .skill-card:hover,
  .tool:hover .tool-icon {
    transform: none;
  }

  a:hover .link-arrow,
  .btn:hover .arrow,
  .see-all:hover .arrow {
    transform: none;
  }

  /* Scroll reveal: nothing hides and nothing moves, revealed or not */
  :root.js .reveal,
  :root.js .reveal .projects-grid > *,
  :root.js .reveal .skills-grid > *,
  :root.js .reveal .timeline > * {
    opacity: 1;
    transform: none;
  }
}
