/* ==========================================================================
   Muzaffar Mirzaev — Modern Robotics & Industrial AI Portfolio
   Design System: Clean, high-performance, dark/light theme, micro-interactions
   ========================================================================== */

:root {
  /* Color Palette — Light Mode */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --card: #ffffff;
  --footer: #f1f5f9;
  --text: #334155;
  --heading: #0f172a;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-subtle: rgba(2, 132, 199, 0.08);
  --on-accent: #ffffff;
  --rule: #e2e8f0;
  --rule-soft: #f1f5f9;
  --badge-bg: #e0f2fe;
  --badge-text: #0369a1;
  --code-bg: #f1f5f9;
  
  /* Status Colors */
  --status-dev: #0284c7;
  --status-impl: #16a34a;
  --status-proto: #d97706;
  --status-plan: #64748b;
  --trend-up: #16a34a;
  --trend-down: #dc2626;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 0 25px -4px rgba(2, 132, 199, 0.28);

  /* Layout Frame */
  --frame: 74rem;
  --pad: 1.5rem;
  --gutter: var(--pad);
  --sidebar: 16rem;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* Typography */
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Transitions */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --trans: 0.2s var(--ease);

  color-scheme: light;
}

[data-theme="dark"] {
  /* Color Palette — Dark Mode */
  --bg: #0b0f17;
  --surface: #111827;
  --surface-hover: #172033;
  --card: #111827;
  --footer: #070a10;
  --text: #cbd5e1;
  --heading: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-subtle: rgba(56, 189, 248, 0.12);
  --on-accent: #0b0f17;
  --rule: #1e293b;
  --rule-soft: #172033;
  --badge-bg: rgba(56, 189, 248, 0.14);
  --badge-text: #7dd3fc;
  --code-bg: #172033;

  /* Status Colors */
  --status-dev: #38bdf8;
  --status-impl: #4ade80;
  --status-proto: #fbbf24;
  --status-plan: #94a3b8;
  --trend-up: #4ade80;
  --trend-down: #f87171;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.4), 0 2px 6px -2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 14px 32px -4px rgba(0, 0, 0, 0.6), 0 4px 12px -2px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px -4px rgba(56, 189, 248, 0.35);

  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.18em;
  transition: color var(--trans), opacity var(--trans);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

h1,
h2,
h3,
h4 {
  color: var(--heading);
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

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

.skip-link {
  position: absolute;
  top: 0;
  left: -999rem;
  z-index: 50;
  padding: 0.6rem 1.2rem;
  background: var(--heading);
  color: var(--bg);
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  left: 0;
}

/* Icons */
.icon {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

/* ==========================================================================
   Masthead (Glassmorphic Navigation Bar)
   ========================================================================== */
.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(248, 250, 252, 0.85);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

[data-theme="dark"] .masthead {
  background: rgba(11, 15, 23, 0.85);
}

.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(var(--frame), calc(100% - 2 * var(--pad)));
  min-height: 3.85rem;
  margin: 0 auto;
}

.masthead__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--heading);
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.masthead__brand::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.masthead__brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.masthead__end {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  position: relative;
  display: inline-block;
  padding: 0.5rem 0.2rem;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 550;
  letter-spacing: -0.01em;
  transition: color var(--trans);
}

.site-nav a:hover {
  color: var(--heading);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--heading);
  font-weight: 650;
}

.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

/* Theme Toggle Button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--heading);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--trans);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(18deg) scale(1.05);
  box-shadow: var(--shadow-md);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle .icon--sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon--moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon--sun {
  display: block;
}

/* Mobile Nav Toggle */
.nav-toggle {
  display: none;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--heading);
  cursor: pointer;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 1.1rem;
  height: 1.5px;
  margin: 0 auto;
  background: currentColor;
  content: "";
  transition: transform var(--trans);
}

.nav-toggle span {
  position: relative;
}

.nav-toggle span::before,
.nav-toggle span::after {
  position: absolute;
  left: 0;
}

.nav-toggle span::before {
  top: -5px;
}

.nav-toggle span::after {
  top: 5px;
}

/* ==========================================================================
   Main Frame (Sidebar + Content Grid)
   ========================================================================== */
.main {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 3.25rem;
  align-items: start;
  width: min(var(--frame), calc(100% - 2 * var(--pad)));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

/* Sidebar Profile */
.sidebar {
  position: sticky;
  top: 5.5rem;
}

.sidebar__card {
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.author__avatar-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 1.1rem;
}

.author__avatar {
  display: block;
  width: 7.5rem;
  height: 7.5rem;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--rule), var(--shadow-md);
  object-fit: cover;
  object-position: center top;
  transition: transform var(--trans);
}

.author__avatar:hover {
  transform: scale(1.02);
}

/* Active Status Badge */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.author__name {
  margin: 0 0 0.3rem;
  color: var(--heading);
  font-size: 1.25rem;
  font-weight: 750;
  line-height: 1.25;
}

.author__title {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
}

.author__bio {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.author__follow {
  display: none;
}

.author__urls {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
}

.author__urls li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0;
  color: var(--muted);
}

.author__urls a {
  color: var(--text);
  font-weight: 500;
}

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

/* Copy Email Component */
.email-copy-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.copy-email-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--trans);
}

.copy-email-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--badge-bg);
}

.copy-email-btn .icon--copy {
  width: 0.75rem;
  height: 0.75rem;
}

/* ==========================================================================
   Content Elements
   ========================================================================== */
.content h1 {
  margin: 0 0 0.5em;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.content h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 2.5rem 0 0.4em;
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.content h3 {
  margin: 1.2em 0 0.2em;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.content [id] {
  scroll-margin-top: 5rem;
}

.content h1 + hr,
.content h2 + hr {
  margin: 0.4em 0 1.25em;
}

.content p {
  margin: 0 0 1em;
  color: var(--text);
}

.lead {
  color: var(--heading);
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.6;
}

.note {
  color: var(--muted);
  font-size: 0.88rem;
}

/* Intro Paragraphs */
.intro {
  margin-bottom: 2rem;
}

.intro p {
  font-size: 1.025rem;
  line-height: 1.7;
}

/* ==========================================================================
   Hero Section (Homepage)
   ========================================================================== */
.hero {
  margin-bottom: 2.25rem;
  padding-bottom: 0.5rem;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.85rem;
  margin-bottom: 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.content .hero__name {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.content .hero h1 {
  margin: 0;
  max-width: 22ch;
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.hero__focus {
  display: block;
  margin-top: 0.4rem;
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.content .hero__lead {
  max-width: 44rem;
  margin: 1.1rem 0 1.5rem;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.6;
}

/* Action Buttons */
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--heading);
  font-size: 0.925rem;
  font-weight: 650;
  box-shadow: var(--shadow-sm);
  transition: all var(--trans);
  cursor: pointer;
}

.button:hover {
  border-color: var(--heading);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.button--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-glow);
}

.button--primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: var(--on-accent);
  box-shadow: 0 0 25px -2px var(--accent);
}

/* Hero Highlights Grid */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin: 1.75rem 0 2.25rem;
  padding: 0;
  list-style: none;
}

.hero-stat-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: all var(--trans);
}

.hero-stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.hero-stat__number {
  display: block;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-stat__label {
  display: block;
  margin-top: 0.2rem;
  color: var(--heading);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

/* ==========================================================================
   Work Grid (Homepage Cards)
   ========================================================================== */
.work-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.work-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.25rem 1.35rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: all var(--trans);
}

.work-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  text-decoration: none;
}

.work-card__kicker {
  display: inline-block;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.work-card strong {
  display: block;
  margin: 0.35rem 0 0.5rem;
  color: var(--heading);
  font-size: 1.15rem;
  font-weight: 750;
  line-height: 1.3;
}

.work-card__text {
  flex: 1;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.work-card__more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.85rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 650;
}

.work-card__more::after {
  content: "→";
  transition: transform var(--trans);
}

.work-card:hover .work-card__more::after {
  transform: translateX(4px);
}

/* ==========================================================================
   Focus Areas Grid
   ========================================================================== */
.focus-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.focus-list li {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 0.925rem;
  transition: all var(--trans);
}

.focus-list li:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.focus-list strong {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  color: var(--heading);
  font-size: 1rem;
  font-weight: 700;
}

.focus-list strong::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ==========================================================================
   Activity / Timeline Components
   ========================================================================== */
/* Doubled class so these win over the generic .content-list rules below. */
.content-list.activity-list {
  position: relative;
  margin-left: 0.5rem;
  padding-left: 1.5rem;
  border-left: 2px solid var(--rule);
}

.content-list.activity-list > li {
  position: relative;
  padding: 0 0 1.5rem 0.5rem;
  border-bottom: 0;
  list-style: none;
}

/* The dot hangs off the date badge so it stays centred on it. */
.activity-date {
  position: relative;
}

.activity-date::before {
  position: absolute;
  top: 50%;
  left: calc(-2rem - 6px);
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
  content: "";
}

.activity-list > li:first-child .activity-date::before {
  box-shadow: 0 0 0 4px var(--bg), 0 0 12px var(--accent);
}

.activity-date {
  display: inline-block;
  margin-bottom: 0.25rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.activity-body {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Content List */
.content-list {
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.content-list > li {
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--rule-soft);
}

.content-list > li:last-child {
  border-bottom: 0;
}

.content-list strong {
  display: block;
  color: var(--heading);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
}

.content-list strong a {
  color: var(--heading);
}

.content-list strong a:hover {
  color: var(--accent);
}

.item-desc {
  display: block;
  margin-top: 0.4rem;
  color: var(--text);
  font-size: 0.925rem;
  line-height: 1.6;
}

.item-meta {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 550;
}

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

.content-list--compact > li {
  padding: 1.1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Projects Page Components
   ========================================================================== */
.page-nav,
.project-filter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0 1.75rem;
}

.page-nav a,
.filter-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--heading);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans);
}

.page-nav a:hover,
.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.filter-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-glow);
}

/* Project Cards */
.project {
  margin-bottom: 1.5rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: all var(--trans);
}

.project:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.project h3 {
  margin: 0;
  font-size: 1.25rem;
}

.project h3 a {
  color: var(--heading);
}

.project h3 a:hover {
  color: var(--accent);
}

.role__meta {
  display: inline-block;
  margin: 0.25rem 0 0.5rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 550;
}

.project__summary {
  margin: 0.5rem 0 0;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}

.project__note {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Flagship Project Card (AMR Control System) */
.project--flagship {
  position: relative;
  margin: 1.5rem 0 2rem;
  padding: 1.75rem;
  border: 1px solid var(--rule);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.project--flagship h3 {
  font-size: 1.5rem;
  font-weight: 800;
}

.flagship-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Pipeline Flow Pills */
.pipeline-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface-hover);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
}

.pipeline-step {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--heading);
  border: 1px solid var(--rule);
}

.pipeline-arrow {
  color: var(--accent);
}

/* Case Study Grid */
.case {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 0.75rem 1.25rem;
  margin: 1rem 0 0;
  font-size: 0.95rem;
}

.case dt {
  color: var(--heading);
  font-weight: 700;
}

.case dd {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.case ul {
  margin: 0;
  padding-left: 1.2rem;
}

.case li {
  margin-bottom: 0.4rem;
}

/* Status Badges */
.status {
  display: inline-block;
  padding: 0.15rem 0.65rem;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 650;
  white-space: nowrap;
}

.status--implemented {
  color: var(--status-impl);
  background: rgba(34, 197, 94, 0.1);
}

.status--prototype {
  color: var(--status-proto);
  background: rgba(245, 158, 11, 0.1);
}

.status--planned {
  color: var(--status-plan);
  background: rgba(148, 163, 184, 0.1);
}

/* Roles on Experience Page */
.role {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.role h3 {
  margin: 0;
  font-size: 1.15rem;
}

.role ul {
  margin: 0.6rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.95rem;
}

.role li {
  margin-bottom: 0.35rem;
  line-height: 1.6;
}

/* Tech Badges / Pills */
.tech-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.tech-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
}

.table th,
.table td {
  padding: 0.6rem 0.85rem 0.6rem 0;
  border-bottom: 1px solid var(--rule-soft);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--heading);
  font-weight: 700;
}

/* Map Embed */
.map-embed iframe {
  display: block;
  width: 100%;
  height: 290px;
  margin-top: 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  transition: filter 0.25s ease;
}

[data-theme="dark"] .map-embed iframe {
  filter: invert(90%) hue-rotate(180deg) contrast(90%);
}

/* ==========================================================================
   Blog Tabs & Cards
   ========================================================================== */
.tabs {
  display: none;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
}

.js .tabs {
  display: flex;
}

.tabs__tab {
  flex: 0 0 auto;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.925rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--trans);
}

.tabs__tab:hover {
  color: var(--heading);
  background: var(--surface-hover);
}

.tabs__tab[aria-selected="true"] {
  border-color: var(--rule);
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.js .tab-panel__title {
  display: none;
}

/* Video & Blog Cards */
.video-list > .video-card,
.post-list > .post-card {
  display: grid;
  grid-template-columns: 20rem minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: all var(--trans);
}

.video-list > .video-card:hover,
.post-list > .post-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.video-card__thumb img,
.post-card__video img,
.post-card__lead img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.video-card strong a,
.post-card strong a {
  color: var(--heading);
  font-size: 1.15rem;
  font-weight: 750;
}

.video-card strong a:hover,
.post-card strong a:hover {
  color: var(--accent);
}

.item-eyebrow {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.25rem 0.85rem;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.9rem;
}

.facts dt {
  color: var(--heading);
  font-weight: 650;
}

.facts dd {
  margin: 0;
  color: var(--muted);
}

.content details {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  font-size: 0.88rem;
}

.content summary {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.post-card__photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: 0.5rem;
}

.post-card__photos img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  object-fit: cover;
  transition: transform var(--trans);
}

.post-card__photos a:hover img {
  transform: scale(1.05);
}

.post-card__body {
  grid-column: 1 / -1;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

/* ==========================================================================
   Lightbox (Photo Carousel)
   ========================================================================== */
.lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(11, 15, 23, 0.94);
  backdrop-filter: blur(20px);
  color: #fff;
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

.lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 3.5rem 4.5rem;
}

.lightbox__image {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  object-fit: contain;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.lightbox__count {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: #94a3b8;
}

.lightbox__button {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  transition: all var(--trans);
}

.lightbox__button:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

.lightbox__button--close {
  top: 1rem;
  right: 1.25rem;
}

.lightbox__button--prev {
  top: 50%;
  left: 1.25rem;
  transform: translateY(-50%);
}

.lightbox__button--next {
  top: 50%;
  right: 1.25rem;
  transform: translateY(-50%);
}

/* ==========================================================================
   Toast Notification & Back-to-Top Floating UI
   ========================================================================== */
.site-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translate(-50%, 20px);
  z-index: 100;
  padding: 0.65rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--heading);
  font-size: 0.88rem;
  font-weight: 650;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}

.site-toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--surface);
  color: var(--heading);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: all var(--trans);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.page-footer {
  margin-top: 2rem;
  padding: 2.5rem max(var(--pad), calc((100% - var(--frame)) / 2)) 3rem;
  border-top: 1px solid var(--rule);
  background: var(--footer);
  font-size: 0.88rem;
  color: var(--muted);
}

.page-footer ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  margin: 0 0 0.85rem;
  padding: 0;
  list-style: none;
}

.page-footer li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.page-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

/* Visitor stats share the first footer row with the follow links. */
.page-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 2rem;
}

.page-footer > p {
  flex-basis: 100%;
}

.visit-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.85rem auto;
}

.visit-stats__title {
  font-weight: 700;
}

.page-footer .visit-stats__list {
  gap: 0;
  margin: 0;
}

.page-footer .visit-stats__item {
  gap: 0.4rem;
  padding: 0 0.85rem;
  border-left: 1px solid var(--rule);
}

.page-footer .visit-stats__item:first-child {
  padding-left: 0;
  border-left: 0;
}

.visit-stats__value {
  font-weight: 700;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}

.visit-stats__change {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.visit-stats__change.is-up {
  color: var(--trend-up);
}

.visit-stats__change.is-down {
  color: var(--trend-down);
}

.visit-stats__compare {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 60em) {
  .visit-stats {
    margin-left: 0;
  }
}

@media (max-width: 40em) {
  .visit-stats {
    flex-wrap: wrap;
    row-gap: 0.4rem;
  }

  .visit-stats__title {
    flex-basis: 100%;
  }

  .page-footer .visit-stats__list {
    gap: 0.4rem 1.1rem;
  }

  .page-footer .visit-stats__item {
    padding: 0;
    border-left: 0;
  }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 60em) {
  :root {
    --gutter: 1.25rem;
  }

  .nav-toggle {
    display: block;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow-lg);
  }

  .js .site-nav:not(.is-open) {
    display: none;
  }

  .site-nav ul {
    display: block;
    padding: 0.5rem var(--gutter) 0.75rem;
  }

  .site-nav a {
    display: block;
    padding: 0.75rem 0;
  }

  .main {
    display: block;
    padding-top: 1.5rem;
  }

  .sidebar {
    position: static;
    margin-bottom: 2rem;
  }

  .sidebar__card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.25rem;
  }

  .author__avatar-wrap {
    margin-bottom: 0;
  }

  .author__avatar {
    width: 5rem;
    height: 5rem;
  }

  .author__content {
    flex: 1 1 14rem;
  }

  .author__links {
    flex: 1 1 100%;
  }

  .js .author__follow {
    display: block;
    width: 100%;
    min-height: 2.6rem;
    border: 1px solid var(--heading);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--heading);
    font-weight: 650;
    cursor: pointer;
  }

  .js .author__urls:not(.is-open) {
    display: none;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .video-list > .video-card,
  .post-list > .post-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 40em) {
  .hero-stats {
    grid-template-columns: 1fr;
  }

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

  .focus-list,
  .content-list--compact {
    grid-template-columns: 1fr;
  }

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

  .case dt {
    margin-top: 0.75rem;
  }

  .content .hero h1 {
    font-size: 2.15rem;
  }

  .lightbox__stage {
    padding: 3rem 0.5rem;
  }

  .lightbox__button--prev {
    left: 0.5rem;
  }

  .lightbox__button--next {
    right: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
