/* ============================================
   Joshua Perez — Personal Site
   Transit-inspired design system
   ============================================ */

/* --- Design Tokens --- */
:root {
  /* Surface colors — dark, transit-inspired */
  --bg-primary: #0a0a0f;
  --bg-secondary: #101018;
  --bg-elevated: #16161f;
  --bg-card: #1a1a24;

  /* Text */
  --text-primary: #ededf0;
  --text-secondary: #9898a6;
  --text-muted: #5e5e6e;

  /* Transit line colors */
  --line-orange: #ee7623;
  --line-blue: #0078d4;
  --line-green: #00a651;
  --line-red: #e83e4e;
  --line-yellow: #fccc0a;
  --line-purple: #9b51e0;

  /* Functional */
  --border: #22222e;
  --border-subtle: #1a1a25;

  /* Spacing */
  --section-pad: clamp(4rem, 8vw, 7rem);
  --content-max: 1080px;

  /* Type scale */
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: clamp(2.25rem, 5vw, 3.25rem);

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 0.3s;
}

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

html {
  /* scroll-behavior handled by JS for speed control */
  scroll-padding-top: 3.5rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
}

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

ul {
  list-style: none;
}

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

strong {
  color: var(--text-primary);
  font-weight: 600;
}

::selection {
  background: rgba(238, 118, 35, 0.3);
  color: var(--text-primary);
}

/* --- Express Routes Bar --- */
.express-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 36px;
  background: rgba(22, 22, 31, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.4s var(--ease-out), opacity 0.4s var(--ease-out);
  pointer-events: none;
}

.express-bar.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.express-bar-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.express-bar-name {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: auto;
  white-space: nowrap;
}

.express-bar-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.express-bar-buttons {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.express-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration) var(--ease-out), padding var(--duration) var(--ease-out), gap var(--duration) var(--ease-out);
}

.express-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.express-btn.active {
  background: rgba(255, 255, 255, 0.1);
}

.express-btn.active .express-btn-name {
  color: var(--text-primary);
}

.express-btn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  font-size: 0.5625rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* Transitioning state — badges compact, names hide */
.express-bar.transitioning .express-bar-buttons {
  gap: 0.15rem;
  transition: gap 0.4s var(--ease-out);
}

.express-bar.transitioning .express-btn {
  pointer-events: none;
  padding: 0.2rem 0.25rem;
  gap: 0;
}

.express-bar.transitioning .express-btn-name {
  width: 0;
  opacity: 0;
  overflow: hidden;
  transition: width 0.4s var(--ease-out), opacity 0.25s var(--ease-out);
}

.express-bar.transitioning .express-bar-label {
  opacity: 0.4;
  transition: opacity 0.3s var(--ease-out);
}

.express-btn-name {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: width 0.6s var(--ease-out), opacity 0.6s var(--ease-out);
}

.express-bar-buttons {
  transition: gap 0.6s var(--ease-out);
}

.express-btn:hover .express-btn-name {
  color: var(--text-primary);
}

/* --- Route Transition Overlay --- */
.route-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out);
}

.route-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.route-overlay-inner {
  text-align: center;
  width: 90%;
  max-width: 420px;
}

.route-overlay-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.route-overlay-from,
.route-overlay-to {
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  transition: color 0.4s ease;
}

.route-overlay-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.4s ease;
}

.route-overlay-map {
  width: 100%;
  height: auto;
}

.overlay-route,
.overlay-station {
  opacity: 0.08;
  transition: opacity 0.5s var(--ease-out);
}

.overlay-route.active {
  opacity: 0.9;
  filter: drop-shadow(0 0 8px currentColor);
  transition: opacity 0.4s var(--ease-out), filter 0.4s var(--ease-out);
}

.overlay-station.active {
  opacity: 0.9;
  transition: opacity 0.4s var(--ease-out);
}

.overlay-route.filling {
  opacity: 1;
  filter: drop-shadow(0 0 10px currentColor);
}

.overlay-station.filling {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.overlay-station.filling.arrived {
  opacity: 1 !important;
  transition: opacity 0.2s ease;
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  padding: 8rem 1.5rem 4rem;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 2rem;
}

.hero-route-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.75rem;
  gap: 0;
  flex-shrink: 0;
}

.route-line {
  width: 3px;
  height: 120px;
  background: linear-gradient(to bottom, transparent, var(--line-orange));
  border-radius: 2px;
}

.station-dot {
  width: 14px;
  height: 14px;
  border: 3px solid var(--line-orange);
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.station-dot-active {
  background: var(--line-orange);
  box-shadow: 0 0 0 4px rgba(238, 118, 35, 0.2);
}

.hero-text {
  max-width: 600px;
}

.hero-overline {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--line-orange);
  margin-bottom: 1rem;
  transition: opacity 0.6s var(--ease-out);
}

.hero-overline.faded {
  opacity: 0;
}

.hero-name {
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: var(--fs-lg);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: var(--fs-base);
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1rem;
  max-width: 480px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.hero-subtitle.show {
  opacity: 1;
  transform: translateY(0);
}



/* --- Kinetic Transit Lines --- */
.kinetic-lines {
  position: absolute;
  bottom: 2rem;
  left: -5vw;
  right: -5vw;
  width: 110vw;
  height: 140px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.5s var(--ease-out);
}

.kinetic-lines.visible {
  opacity: 1;
}

.k-line {
  position: absolute;
  height: 2px;
  border-radius: 1px;
  opacity: 0;
}

/* Leading station dot */
.k-dot {
  position: absolute;
  right: -3px;
  top: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: inherit;
}

/* Line 1 — orange, long, medium speed, right */
.k-line--1 {
  width: 220px;
  top: 10px;
  background: linear-gradient(to right, transparent, var(--line-orange));
  animation: kRight 36s linear infinite;
}
.k-line--1 .k-dot { background: var(--line-orange); }

/* Line 2 — blue, shorter, faster, left */
.k-line--2 {
  width: 160px;
  top: 32px;
  background: linear-gradient(to left, transparent, var(--line-blue));
  animation: kLeft 28s linear infinite;
  animation-delay: 1s;
}
.k-line--2 .k-dot { background: var(--line-blue); left: -3px; right: auto; }

/* Line 3 — muted, long, slow, right */
.k-line--3 {
  width: 300px;
  top: 50px;
  background: linear-gradient(to right, transparent, var(--text-muted));
  animation: kRight 50s linear infinite;
  animation-delay: 3s;
}
.k-line--3 .k-dot { background: var(--text-muted); }

/* Line 4 — green, medium, right */
.k-line--4 {
  width: 180px;
  top: 68px;
  background: linear-gradient(to right, transparent, var(--line-green));
  animation: kRight 40s linear infinite;
  animation-delay: 5s;
}
.k-line--4 .k-dot { background: var(--line-green); }

/* Line 5 — red, short, fast, left */
.k-line--5 {
  width: 120px;
  top: 85px;
  background: linear-gradient(to left, transparent, var(--line-red));
  animation: kLeft 24s linear infinite;
  animation-delay: 2s;
}
.k-line--5 .k-dot { background: var(--line-red); left: -3px; right: auto; }

/* Line 6 — muted, very long, slowest, right */
.k-line--6 {
  width: 360px;
  top: 100px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--text-muted));
  animation: kRight 60s linear infinite;
  animation-delay: 7s;
}
.k-line--6 .k-dot { background: var(--text-muted); width: 4px; height: 4px; top: -1.5px; }

/* Line 7 — yellow, thin accent, left */
.k-line--7 {
  width: 140px;
  top: 20px;
  height: 1px;
  background: linear-gradient(to left, transparent, var(--line-yellow));
  animation: kLeft 44s linear infinite;
  animation-delay: 4s;
}
.k-line--7 .k-dot { background: var(--line-yellow); left: -3px; right: auto; width: 4px; height: 4px; top: -1.5px; }

/* Line 8 — orange, thin, left */
.k-line--8 {
  width: 200px;
  top: 15px;
  height: 1px;
  background: linear-gradient(to left, transparent, var(--line-orange));
  animation: kLeft 42s linear infinite;
  animation-delay: 6s;
}
.k-line--8 .k-dot { background: var(--line-orange); left: -3px; right: auto; width: 4px; height: 4px; top: -1.5px; }

/* Line 9 — blue, right */
.k-line--9 {
  width: 260px;
  top: 42px;
  background: linear-gradient(to right, transparent, var(--line-blue));
  animation: kRight 45s linear infinite;
  animation-delay: 8s;
}
.k-line--9 .k-dot { background: var(--line-blue); }

/* Line 10 — muted, left, long */
.k-line--10 {
  width: 320px;
  top: 58px;
  height: 1px;
  background: linear-gradient(to left, transparent, var(--text-muted));
  animation: kLeft 55s linear infinite;
  animation-delay: 2s;
}
.k-line--10 .k-dot { background: var(--text-muted); left: -3px; right: auto; width: 4px; height: 4px; top: -1.5px; }

/* Line 11 — green, left */
.k-line--11 {
  width: 150px;
  top: 78px;
  background: linear-gradient(to left, transparent, var(--line-green));
  animation: kLeft 32s linear infinite;
  animation-delay: 9s;
}
.k-line--11 .k-dot { background: var(--line-green); left: -3px; right: auto; }

/* Line 12 — red, right, thin */
.k-line--12 {
  width: 180px;
  top: 92px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line-red));
  animation: kRight 38s linear infinite;
  animation-delay: 11s;
}
.k-line--12 .k-dot { background: var(--line-red); width: 4px; height: 4px; top: -1.5px; }

/* Line 13 — yellow, right */
.k-line--13 {
  width: 240px;
  top: 108px;
  background: linear-gradient(to right, transparent, var(--line-yellow));
  animation: kRight 48s linear infinite;
  animation-delay: 6s;
}
.k-line--13 .k-dot { background: var(--line-yellow); }

/* Line 14 — muted, left */
.k-line--14 {
  width: 280px;
  top: 3px;
  height: 1px;
  background: linear-gradient(to left, transparent, var(--text-muted));
  animation: kLeft 52s linear infinite;
  animation-delay: 10s;
}
.k-line--14 .k-dot { background: var(--text-muted); left: -3px; right: auto; width: 4px; height: 4px; top: -1.5px; }

@keyframes kRight {
  0%   { transform: translateX(-400px); opacity: 0; }
  5%   { opacity: 0.5; }
  50%  { opacity: 0.35; }
  95%  { opacity: 0.5; }
  100% { transform: translateX(100vw); opacity: 0; }
}

@keyframes kLeft {
  0%   { transform: translateX(110vw); opacity: 0; }
  5%   { opacity: 0.45; }
  50%  { opacity: 0.3; }
  95%  { opacity: 0.45; }
  100% { transform: translateX(-400px); opacity: 0; }
}

/* --- Resume Button --- */
.resume-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.5rem 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  transition: color var(--duration) var(--ease-out), opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  opacity: 0;
  transform: translateY(8px);
}

.resume-btn:hover {
  color: var(--line-orange);
}

.resume-btn svg {
  opacity: 0.6;
  transition: opacity var(--duration) var(--ease-out), transform var(--duration) var(--ease-out);
}

.resume-btn:hover svg {
  opacity: 1;
  transform: translateY(1px);
}

.resume-btn.show {
  opacity: 1;
  transform: translateY(0);
}

/* --- Line Selector (hero) --- */
.line-selector {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 320px;
}

.line-pick {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.4s var(--ease-out);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.line-pick.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.line-pick::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  opacity: 0;
  transition: opacity var(--duration) var(--ease-out);
}

.line-pick[data-line="yellow"]::before { background: var(--line-yellow); }
.line-pick[data-line="red"]::before { background: var(--line-red); }
.line-pick[data-line="green"]::before { background: var(--line-green); }
.line-pick[data-line="blue"]::before { background: var(--line-blue); }
.line-pick[data-line="orange"]::before { background: var(--line-orange); }

.line-pick:hover::before,
.line-pick.active::before {
  opacity: 1;
}

.line-pick:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
  transform: translateX(4px);
}

.line-pick.active {
  background: var(--bg-card);
  border-color: var(--text-muted);
}

.line-pick-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  transition: transform var(--duration) var(--ease-out);
}

.line-pick:hover .line-pick-badge {
  transform: scale(1.1);
}

.line-pick-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--duration) var(--ease-out);
}

.line-pick:hover .line-pick-name {
  color: var(--text-primary);
}

/* --- Hero Route Map --- */
.hero-map-decoration {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  pointer-events: none;
  padding-top: 2rem;
  opacity: 0;
  transition: opacity 1.2s var(--ease-out);
}

.hero-map-decoration.show {
  opacity: 1;
}

.hero-svg {
  width: 100%;
  max-width: 380px;
  height: auto;
}

/* All routes start dim */
.map-route,
.map-station {
  opacity: 0.1;
  transition: opacity 0.5s var(--ease-out);
}

/* When a line is highlighted on hover */
.map-route.highlight {
  opacity: 0.85;
  filter: drop-shadow(0 0 6px currentColor);
  transition: opacity 0.3s var(--ease-out), filter 0.3s var(--ease-out);
}

.map-station.highlight {
  opacity: 0.9;
  transition: opacity 0.3s var(--ease-out);
}

/* Line-fill animation — stroke draws from start to end */
/* The trick: we use a duplicated path approach. The base route stays
   at 0.1 opacity (dim ghost). On top of it, the JS drives
   stroke-dashoffset to reveal the colored stroke progressively.
   To make this work, the filling class makes the route fully visible
   but starts with dashoffset = totalLength so nothing is drawn,
   then JS transitions dashoffset to 0. */
.map-route.filling {
  opacity: 1 !important;
  filter: drop-shadow(0 0 8px currentColor);
}

.map-station.filling {
  opacity: 0 !important;
  transition: opacity 0.15s ease;
}

.map-station.filling.station-arrived {
  opacity: 1 !important;
  transition: opacity 0.2s ease;
}

.hero-svg {
  width: 100%;
  height: auto;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.375rem;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  white-space: nowrap;
}

.btn-primary {
  background: var(--line-orange);
  color: #fff;
}

.btn-primary:hover {
  background: #d96a1e;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(238, 118, 35, 0.25);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: var(--fs-base);
}

/* --- Sections --- */
.section {
  padding: var(--section-pad) 1.5rem;
}

.section-alt {
  background: var(--bg-secondary);
}

.section-last {
  min-height: 80vh;
}

.section-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
}

.section-stop {
  flex-shrink: 0;
}

.stop-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--line-orange);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.stop-number--yellow { background: var(--line-yellow); color: #1a1a24; }
.stop-number--red { background: var(--line-red); }
.stop-number--green { background: var(--line-green); }
.stop-number--blue { background: var(--line-blue); }
.stop-number--orange { background: var(--line-orange); }

.section-title {
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.section-line {
  flex: 1;
  height: 3px;
  background: linear-gradient(to right, var(--border), transparent);
  border-radius: 2px;
}

.section-line--yellow { background: linear-gradient(to right, var(--line-yellow), transparent); }
.section-line--red { background: linear-gradient(to right, var(--line-red), transparent); }
.section-line--green { background: linear-gradient(to right, var(--line-green), transparent); }
.section-line--blue { background: linear-gradient(to right, var(--line-blue), transparent); }
.section-line--orange { background: linear-gradient(to right, var(--line-orange), transparent); }

/* --- About --- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 3rem;
  align-items: start;
}

.about-text p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.75;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-details {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.about-card-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--line-yellow);
  margin-bottom: 0.75rem;
}

.about-card-primary {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.about-card-secondary {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.about-card-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.about-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.about-card-list li {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  padding-left: 0.875rem;
  position: relative;
}

.about-card-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  background: var(--line-yellow);
  border-radius: var(--radius-full);
}

/* --- Timeline (Experience) --- */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5px;
  width: 2px;
  background: var(--line-red);
  opacity: 0.25;
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  display: flex;
  gap: 1.5rem;
  padding-bottom: 2.5rem;
}

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

.timeline-marker {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  padding-top: 1.5rem;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  border: 3px solid var(--text-muted);
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  box-shadow: 0 0 0 3px var(--bg-secondary);
}

.timeline-item[data-line="orange"] .timeline-dot { border-color: var(--line-orange); }
.timeline-item[data-line="blue"] .timeline-dot { border-color: var(--line-blue); }
.timeline-item[data-line="green"] .timeline-dot { border-color: var(--line-green); }
.timeline-item[data-line="red"] .timeline-dot { border-color: var(--line-red); }

.timeline-dot--active {
  background: var(--line-orange);
  border-color: var(--line-orange);
  box-shadow: 0 0 0 3px var(--bg-secondary), 0 0 10px rgba(238, 118, 35, 0.25);
}

.timeline-item[data-line="orange"] .timeline-dot--active { background: var(--line-orange); border-color: var(--line-orange); }
.timeline-item[data-line="blue"] .timeline-dot--active { background: var(--line-blue); border-color: var(--line-blue); box-shadow: 0 0 0 3px var(--bg-secondary), 0 0 10px rgba(0, 120, 212, 0.25); }

.timeline-content {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.timeline-role {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.timeline-company {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

.timeline-date {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0.25rem 0.625rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

.timeline-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.timeline-details li {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  padding-left: 1rem;
  position: relative;
  line-height: 1.6;
}

.timeline-details li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--text-muted);
}

.timeline-tags,
.project-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.tag {
  display: inline-block;
  padding: 0.1875rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

/* --- Projects --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.5rem;
}

.project-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out);
}

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

.project-card-accent,
.project-card[data-line="green"] .project-card-accent { background: var(--line-green); }
.project-card[data-line="red"] .project-card-accent { background: var(--line-red); }
.project-card[data-line="blue"] .project-card-accent { background: var(--line-blue); }
.project-card[data-line="orange"] .project-card-accent { background: var(--line-orange); }
.project-card[data-line="yellow"] .project-card-accent { background: var(--line-yellow); }

.project-card-accent {
  height: 3px;
  width: 100%;
}

.project-card-accent--green { background: var(--line-green); }
.project-card-accent--red { background: var(--line-red); }
.project-card-accent--blue { background: var(--line-blue); }
.project-card-accent--orange { background: var(--line-orange); }

.project-card-body {
  padding: 1.5rem;
}

.project-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.project-card-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.project-card-date {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0.25rem 0.625rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

.project-card-desc {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.project-card-highlights {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.project-card-highlights li {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  padding-left: 0.875rem;
  position: relative;
  line-height: 1.6;
}

.project-card-highlights li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--line-green);
}

.project-card-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.project-repo-private {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.25rem 0.625rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  opacity: 0.6;
}

.project-repo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--duration) var(--ease-out);
}

.project-repo-link:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* --- Project Demo --- */
.project-demo {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.project-demo-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 1.125rem;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
}

.project-demo-toggle:hover {
  color: var(--line-green);
  border-color: var(--line-green);
  background: rgba(0, 166, 81, 0.06);
}

.demo-toggle-icon {
  opacity: 0.7;
  transition: opacity var(--duration) var(--ease-out);
}

.project-demo-toggle:hover .demo-toggle-icon {
  opacity: 1;
}

/* --- Demo Modal --- */
.demo-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.demo-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.demo-modal {
  width: 90vw;
  max-width: 900px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.demo-modal-overlay.visible .demo-modal {
  transform: translateY(0) scale(1);
}

.demo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.demo-modal-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.demo-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
}

.demo-modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border);
}

.demo-modal-video-wrap {
  background: #000;
  line-height: 0;
}

.demo-modal-video {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #000;
}

.demo-modal-note {
  margin: 0;
  padding: 0.875rem 1.25rem;
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.demo-modal-note strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* --- Skills --- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.skill-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.skill-group-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.skill-route-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.skill-group-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.skill-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.skill-chip {
  display: inline-block;
  padding: 0.3125rem 0.6875rem;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: color var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out);
}

.skill-chip:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* --- Contact --- */
.contact-content {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.contact-text {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out);
}

.contact-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-orange);
}

.contact-card-icon {
  color: var(--line-orange);
  margin-bottom: 0.25rem;
}

.contact-card-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.contact-card-value {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  word-break: break-all;
}

/* --- Footer --- */
.footer {
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.footer-route {
  display: flex;
  align-items: center;
  gap: 0;
}

.footer-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
}

.footer-dot--yellow { background: var(--line-yellow); }
.footer-dot--red { background: var(--line-red); }
.footer-dot--green { background: var(--line-green); }
.footer-dot--blue { background: var(--line-blue); }
.footer-dot--orange { background: var(--line-orange); }

.footer-line-segment {
  width: 32px;
  height: 2px;
  background: var(--border);
}

.footer-text {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.footer-built {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.footer-link {
  color: var(--text-secondary);
  transition: color var(--duration) var(--ease-out);
}

.footer-link:hover {
  color: var(--line-orange);
}

/* --- Colored Stop Numbers --- */
.stop-number--yellow { background: var(--line-yellow); color: #000; }
.stop-number--red { background: var(--line-red); }
.stop-number--green { background: var(--line-green); }
.stop-number--blue { background: var(--line-blue); }
.stop-number--orange { background: var(--line-orange); }

/* --- Colored Section Lines --- */
.section-line--yellow { background: linear-gradient(to right, var(--line-yellow), transparent); opacity: 0.25; }
.section-line--red { background: linear-gradient(to right, var(--line-red), transparent); opacity: 0.25; }
.section-line--green { background: linear-gradient(to right, var(--line-green), transparent); opacity: 0.25; }
.section-line--blue { background: linear-gradient(to right, var(--line-blue), transparent); opacity: 0.25; }
.section-line--orange { background: linear-gradient(to right, var(--line-orange), transparent); opacity: 0.25; }

/* --- Colored Footer Dots --- */
.footer-dot--yellow { background: var(--line-yellow); border-color: var(--line-yellow); }
.footer-dot--red { background: var(--line-red); border-color: var(--line-red); }
.footer-dot--green { background: var(--line-green); border-color: var(--line-green); }
.footer-dot--blue { background: var(--line-blue); border-color: var(--line-blue); }
.footer-dot--orange { background: var(--line-orange); border-color: var(--line-orange); }

/* --- Split-Flap Display (Solari Board) --- */
.split-flap-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.split-flap-gap {
  width: 0.35em;
}

.split-flap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.72em;
  height: 1.15em;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 2px 4px rgba(0, 0, 0, 0.4);
}

/* The horizontal split line — signature detail */
.split-flap::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.3);
  z-index: 2;
  pointer-events: none;
}

/* The character inside */
.split-flap-char {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--text-primary);
  font-weight: 700;
  font-size: inherit;
  line-height: 1;
  letter-spacing: -0.03em;
}

/* Flip animation — top half rotates away, new char appears */
.split-flap.flipping .split-flap-char {
  animation: flapChar 0.1s ease-in;
}

@keyframes flapChar {
  0%   { transform: scaleY(1); opacity: 1; }
  50%  { transform: scaleY(0.3); opacity: 0.5; }
  100% { transform: scaleY(1); opacity: 1; }
}

/* Subtle ambient shadow on the row for depth */
.hero-name .split-flap-row {
  padding: 6px 0;
}

/* Solidified state — cells dissolve, clean text remains */
.hero-name.solidified .split-flap {
  background: transparent;
  box-shadow: none;
  transition: background 0.6s var(--ease-out), box-shadow 0.6s var(--ease-out);
}

.hero-name.solidified .split-flap::after {
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}

.hero-name.solidified .split-flap-row {
  gap: 1px;
  transition: gap 0.6s var(--ease-out);
}

.hero-name.solidified .split-flap-char {
  color: var(--text-primary);
  transition: color 0.3s var(--ease-out);
}

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  /* Express bar */
  .express-bar-buttons {
    gap: 0.25rem;
  }

  .express-btn-name {
    display: none;
  }

  .express-bar-name {
    display: none;
  }

  .express-bar.transitioning .express-bar-buttons {
    gap: 0.15rem;
  }

  .express-bar-inner {
    justify-content: center;
  }

  /* Hero — use flex column so content flows naturally */
  .hero {
    padding: 4.5rem 1.25rem 0;
    min-height: auto;
    flex-direction: column;
  }

  .hero-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
    padding-bottom: 2rem;
  }

  .hero-route-indicator {
    flex-direction: row;
    padding: 0 0 1rem;
  }

  .route-line {
    width: 60px;
    height: 3px;
    background: linear-gradient(to right, transparent, var(--line-orange));
  }

  .hero-text {
    max-width: 100%;
  }

  .hero-title {
    font-size: var(--fs-base);
  }

  .hero-map-decoration {
    display: flex;
    justify-content: center;
    padding-top: 0;
  }

  .hero-svg {
    max-width: 220px;
  }

  .hero-subtitle {
    max-width: 100%;
  }

  .line-selector {
    max-width: 100%;
    align-items: center;
  }

  .hero-subtitle {
    max-width: 100%;
  }

  .line-pick {
    padding: 0.5rem 0.75rem;
    width: 100%;
    max-width: 280px;
  }

  .line-pick-badge {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
  }

  /* Kinetic lines — keep absolute but pin to bottom of hero */
  .kinetic-lines {
    position: relative;
    bottom: auto;
    left: -5vw;
    height: 80px;
    margin-top: auto;
    flex-shrink: 0;
  }

  /* Sections */
  .section {
    padding: clamp(3rem, 6vw, 5rem) 1.25rem;
  }

  .section-last {
    min-height: 60vh;
  }

  .section-header {
    gap: 0.75rem;
    margin-bottom: 2.5rem;
  }

  /* About */
  .about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .about-text p {
    font-size: var(--fs-sm);
  }

  .about-card {
    padding: 1.25rem;
  }

  /* Timeline */
  .timeline-item {
    gap: 1rem;
  }

  .timeline-header {
    flex-direction: column;
    gap: 0.375rem;
  }

  .timeline-date {
    align-self: flex-start;
  }

  .timeline-role {
    font-size: var(--fs-base);
  }

  .timeline-details li {
    font-size: var(--fs-sm);
  }

  /* Projects */
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .project-card-title {
    font-size: var(--fs-base);
  }

  .project-card-desc {
    font-size: var(--fs-sm);
  }

  .project-card-highlights li {
    font-size: var(--fs-sm);
  }

  /* Skills */
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .skill-chip {
    font-size: var(--fs-xs);
  }

  /* Contact */
  .contact-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .contact-text {
    font-size: var(--fs-sm);
  }

  /* Overlay map */
  .route-overlay-inner {
    width: 95%;
    max-width: 300px;
  }

  .route-overlay-header {
    gap: 0.5rem;
    margin-bottom: 1.25rem;
  }

  .route-overlay-from,
  .route-overlay-to {
    font-size: 0.625rem;
  }

  /* Footer */
  .footer-inner {
    padding: 1.5rem 1rem;
  }

  .footer-line-segment {
    width: 2rem;
  }

  /* Tags smaller on mobile */
  .tag {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 4rem 1rem 0;
  }

  .hero-name {
    font-size: 2rem;
  }

  .hero-overline {
    font-size: 0.625rem;
  }

  .hero-svg {
    max-width: 180px;
  }

  .split-flap {
    width: 0.68em;
  }

  .split-flap-gap {
    width: 0.25em;
  }

  .line-selector {
    gap: 0.375rem;
  }

  .line-pick {
    padding: 0.4rem 0.65rem;
    gap: 0.5rem;
  }

  .line-pick-name {
    font-size: var(--fs-xs);
  }

  .section-header {
    gap: 0.75rem;
    margin-bottom: 2rem;
  }

  .section-title {
    font-size: var(--fs-xl);
  }

  .stop-number {
    width: 30px;
    height: 30px;
    font-size: var(--fs-xs);
  }

  .timeline-dot {
    width: 12px;
    height: 12px;
  }

  .timeline-track {
    left: 4px;
  }

  .timeline-content {
    padding: 1rem;
  }

  .project-card-body {
    padding: 1rem;
  }

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

  .footer-line-segment {
    width: 1.5rem;
  }

  .kinetic-lines {
    height: 60px;
  }
}

@media (max-width: 360px) {
  .hero-name {
    font-size: 1.65rem;
  }

  .express-bar-label {
    display: none;
  }

  .line-pick-badge {
    width: 22px;
    height: 22px;
    font-size: 0.6rem;
  }

  .hero-svg {
    max-width: 150px;
  }

  .section-title {
    font-size: var(--fs-lg);
  }
}
