/* ==========================================================================
   Filippo Barbagelata — Mechanical Engineering Portfolio
   Architectural / Technical Editorial Stylesheet (High Legibility · Crisp Borders)
   ========================================================================== */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f4f6f9;
  --nav-bg: #ffffff;
  --ink: #111827;
  --ink-soft: #1f2937;
  --ink-muted: #4b5563;
  --border: #cbd5e1;
  --border-strong: #94a3b8;
  --rule-heavy: #111827;
  --divider-soft: #e2e8f0;

  --accent: #0f4c81;
  --accent-strong: #0a365c;
  --accent-bg: #eef4fa;
  --accent-border: #b6cde4;

  --teal: #0f5f58;
  --teal-bg: #ebf5f4;
  --teal-border: #a7d4cf;

  --track-bg: #e5eaf0;
  --timeline-line: #94a3b8;
  --thumb-bg: #f1f5f9;
  --plot-frame: #ffffff;

  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 5px;
  --radius-lg: 6px;

  --max-w: 1160px;
  --nav-h: 60px;
  --transition: 0.15s ease;
}

[data-theme="dark"] {
  --bg: #131922;
  --surface: #161d27;
  --surface-alt: #1b2430;
  --nav-bg: #131922;
  --ink: #f1f5f9;
  --ink-soft: #d8e1ec;
  --ink-muted: #94a3b8;
  --border: #2e3b4e;
  --border-strong: #475569;
  --rule-heavy: #e2e8f0;
  --divider-soft: #243040;

  --accent: #60a5fa;
  --accent-strong: #93c5fd;
  --accent-bg: rgba(59, 130, 246, 0.14);
  --accent-border: rgba(96, 165, 250, 0.36);

  --teal: #5eead4;
  --teal-bg: rgba(20, 184, 166, 0.14);
  --teal-border: rgba(94, 234, 212, 0.32);

  --track-bg: #243040;
  --timeline-line: #475569;
  --thumb-bg: #121821;
  --plot-frame: #f8fafc;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 18px);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.62;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

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

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

button {
  font-family: inherit;
  cursor: pointer;
}

.inline-ico {
  flex-shrink: 0;
  vertical-align: -2px;
}

/* ==========================================================================
   Layout & Explicit Section Separations
   ========================================================================== */
.wrap {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

body[data-page="home"] main > section {
  padding: 56px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
}

body[data-page="home"] main > section.alt-bg {
  background: var(--bg);
}

.section-head {
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--rule-heavy);
}

.eyebrow {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

#tesi .eyebrow {
  padding-bottom: 10px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--rule-heavy);
  display: block;
}

.section-head h2 {
  margin: 0 0 6px;
  font-size: clamp(1.55rem, 2.4vw, 1.95rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--ink);
}

.section-head .sub {
  margin: 0;
  font-size: 0.98rem;
  color: var(--ink-soft);
  max-width: 74ch;
}

/* ==========================================================================
   Sticky Top Navigation
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  border-bottom: 2px solid var(--rule-heavy);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

.theme-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background var(--transition), border-color var(--transition);
}

.theme-btn:hover {
  background: var(--surface-alt);
  border-color: var(--ink);
}

.lang-switch {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.lang-btn {
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 11px;
  transition: background var(--transition), color var(--transition);
}

.lang-btn:last-child {
  border-right: none;
}

.lang-btn.on {
  background: var(--ink);
  color: var(--surface);
}

.lang-btn:not(.on):hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  align-items: center;
  justify-content: center;
  padding: 0;
}

.mobile-drawer {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 2px solid var(--rule-heavy);
  padding: 12px 24px 18px;
  z-index: 99;
}

.mobile-drawer.open {
  display: block;
}

.mobile-drawer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.mobile-drawer li {
  border-bottom: 1px solid var(--divider-soft);
}

.mobile-drawer li:last-child {
  border-bottom: none;
}

.mobile-drawer a {
  display: block;
  padding: 11px 4px;
  font-weight: 600;
  color: var(--ink);
  font-size: 0.96rem;
}

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

/* ==========================================================================
   Clean Light-First Editorial Hero Header
   ========================================================================== */
.hero {
  background: var(--surface);
  color: var(--ink);
  padding: 48px 0 52px;
  border-bottom: 1px solid var(--border-strong);
}

.hero-grid {
  display: grid;
  grid-template-columns: 184px 1fr;
  gap: 38px;
  align-items: start;
}

.avatar-wrap {
  width: 184px;
  margin: 0 auto;
}

.avatar {
  width: 184px;
  height: 204px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--border-strong);
  padding: 4px;
  background: var(--surface);
}

.hero-content h1 {
  margin: 0 0 6px;
  font-size: clamp(2rem, 3.6vw, 2.7rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 800;
  color: var(--ink);
}

.hero-role {
  margin: 0 0 12px;
  font-size: clamp(1.02rem, 1.6vw, 1.16rem);
  font-weight: 600;
  color: var(--accent);
}

.hero-badge {
  display: inline-block;
  padding: 5px 11px;
  border-radius: var(--radius-xs);
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.hero-pitch {
  margin: 0 0 22px;
  font-size: 0.99rem;
  line-height: 1.68;
  color: var(--ink-soft);
  max-width: 68ch;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

/* Sharp, Bordered Technical Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.89rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
}

.btn-primary,
.btn-white {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover,
.btn-white:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #ffffff;
}

[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-white {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
}

[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-white:hover {
  background: #1d4ed8;
}

.btn-outline,
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-outline:hover,
.btn-ghost:hover {
  background: var(--surface-alt);
  border-color: var(--ink);
  color: var(--ink);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--divider-soft);
}

/* ==========================================================================
   Technical Chips & Software Logo Badges
   ========================================================================== */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip,
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.77rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-alt);
  color: var(--ink-soft);
  border: 1px solid var(--border);
}

.chip.has-logo,
.hero-tag.has-logo {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
  padding: 3px 8px 3px 5px;
}

.chip-logo {
  width: 15px;
  height: 15px;
  object-fit: contain;
  flex-shrink: 0;
  background: #ffffff;
  border-radius: 2px;
  padding: 1px;
}

.chip-origin {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
}

.chip-origin.academic {
  background: #ffffff;
  color: #0f172a;
  border-color: #64748b;
}

.chip-origin.thesis {
  background: #0f4c81;
  color: #ffffff;
  border-color: #0a365c;
}

.chip-origin.hobby {
  background: #ebf5f4;
  color: #0f5f58;
  border-color: #6ab5ad;
}

/* ==========================================================================
   Featured Thesis Dossier Card
   ========================================================================== */
.featured-card {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition);
}

.featured-card:hover {
  border-color: var(--ink);
}

.featured-media {
  position: relative;
  min-height: 310px;
  background: var(--plot-frame);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-right: 1px solid var(--border-strong);
}

.featured-media img {
  width: 100%;
  height: 100%;
  max-height: 340px;
  object-fit: contain;
}

.featured-body {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-body h3 {
  margin: 0 0 10px;
  font-size: clamp(1.28rem, 2vw, 1.55rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.featured-body p {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.62;
}

.featured-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  margin-bottom: 18px;
  overflow: hidden;
}

.kpi-mini {
  padding: 11px 13px;
  border-right: 1px solid var(--border);
}

.kpi-mini:last-child {
  border-right: none;
}

.kpi-mini .val {
  display: block;
  font-size: 1.06rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 3px;
  white-space: nowrap;
}

.kpi-mini .lbl {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-muted);
  line-height: 1.3;
  font-weight: 500;
}

.featured-link {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--divider-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--accent);
  font-size: 0.92rem;
}

.featured-card:hover .featured-link {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   Experience Cards
   ========================================================================== */
.exp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.exp-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.exp-card .chips {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--divider-soft);
}

.exp-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--divider-soft);
}

.exp-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 0.82rem;
}

.exp-icon.has-img {
  background: #ffffff;
  padding: 4px;
}

.exp-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.exp-meta {
  flex: 1;
}

.exp-period {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 3px;
}

.exp-card h3 {
  margin: 0 0 3px;
  font-size: 1.06rem;
  line-height: 1.3;
  color: var(--ink);
}

.exp-org {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.exp-card p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.62;
  color: var(--ink-soft);
}

/* ==========================================================================
   Projects Gallery & Crisp Segmented Filter Bar
   ========================================================================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.83rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.filter-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--surface-alt);
}

.filter-btn.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

[data-theme="dark"] .filter-btn.on {
  background: #2563eb;
  border-color: #3b82f6;
}

.origin-switch {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.origin-btn {
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  transition: background var(--transition), color var(--transition);
}

.origin-btn:last-child {
  border-right: none;
}

.origin-btn.on {
  background: var(--ink);
  color: var(--surface);
}

.origin-btn:not(.on):hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.project-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin: 0 0 16px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition);
}

.project-card:hover {
  border-color: var(--ink);
}

.project-card.hidden {
  display: none;
}

.card-thumb {
  position: relative;
  height: 188px;
  background: var(--thumb-bg);
  overflow: hidden;
  border-bottom: 1px solid var(--border-strong);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-thumb.contain {
  background: var(--plot-frame);
  padding: 10px;
}

.card-thumb.contain img {
  object-fit: contain;
}

.card-thumb.no-img {
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px 18px;
}

.thumb-typo {
  text-align: center;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-xs);
}

.thumb-typo-kicker {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.thumb-typo-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.pdf-pill {
  display: inline-flex;
  align-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--accent-bg);
  color: var(--accent-strong);
  border: 1px solid var(--accent-border);
  margin-left: 6px;
  vertical-align: middle;
}

.card-badge-wrap {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 5px;
}

.card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-meta {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.card-body h4 {
  margin: 0 0 8px;
  font-size: 1.03rem;
  line-height: 1.32;
  color: var(--ink);
}

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

.card-body p {
  margin: 0 0 14px;
  font-size: 0.89rem;
  line-height: 1.56;
  color: var(--ink-soft);
  flex: 1;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--divider-soft);
}

.card-arrow {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px 20px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
}

/* ==========================================================================
   Certifications & Languages Section
   ========================================================================== */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.cert-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cert-card.hidden {
  display: none;
}

.cert-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--divider-soft);
}

.cert-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
  font-size: 0.78rem;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--ink);
}

.cert-logo.has-img {
  background: #ffffff;
  padding: 4px;
}

.cert-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cert-issuer {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cert-date {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  color: var(--accent);
  font-weight: 600;
}

.cert-card h4 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.32;
  color: var(--ink);
}

.cert-desc {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.58;
  color: var(--ink-soft);
  flex: 1;
}

.cert-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--divider-soft);
}

.cert-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-bg);
  border: 1px solid var(--teal-border);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
}

.cert-link {
  font-size: 0.81rem;
  font-weight: 700;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cert-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cert-verified {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-muted);
}

/* ==========================================================================
   Education Timeline & Software Skills with Logos
   ========================================================================== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.col-title {
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-strong);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.timeline {
  position: relative;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--timeline-line);
}

.tl-item {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 15px 18px;
}

.tl-item::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 19px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
  border: 2px solid var(--surface);
}

.tl-date {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.tl-item h4 {
  margin: 0 0 3px;
  font-size: 0.99rem;
  color: var(--ink);
}

.tl-sub {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.tl-item p {
  margin: 0;
  font-size: 0.87rem;
  line-height: 1.56;
  color: var(--ink-soft);
}

/* Software Skill Rows with Real Logos */
.skills-box {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 20px 22px;
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 20px;
}

.skill-row {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--divider-soft);
}

.skill-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.skill-row .skill-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.87rem;
}

.skill-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.skill-logo-box {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.skill-logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.skill-name {
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.skill-level {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
}

.skill-track {
  height: 7px;
  background: var(--track-bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.skill-fill {
  height: 100%;
  background: var(--accent);
}

.soft-title {
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.77rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.soft-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.soft-pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  background: var(--surface-alt);
  color: var(--ink-soft);
  border: 1px solid var(--border-strong);
}

/* ==========================================================================
   Clean Light Editorial Contact Section & Footer
   ========================================================================== */
.contact-band {
  background: var(--surface);
  color: var(--ink);
  padding: 56px 0;
  border-bottom: 1px solid var(--border-strong);
  text-align: left;
}

.contact-band h2 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 2.6vw, 2rem);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.contact-lead {
  margin: 0 0 14px;
  max-width: 64ch;
  color: var(--ink-soft);
  font-size: 0.99rem;
}

.contact-availability {
  display: inline-block;
  margin: 0 0 22px;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.contact-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.contact-meta {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-muted);
}

.contact-meta a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer {
  background: var(--bg);
  color: var(--ink-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  padding: 22px 0;
  text-align: left;
}

/* ==========================================================================
   Case Study Page (project.html) — Technical Dossier Layout
   ========================================================================== */
.case-hero {
  background: var(--surface);
  color: var(--ink);
  padding: 34px 0 36px;
  border-bottom: 1px solid var(--border-strong);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
}

.back-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.case-eyebrow {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.case-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 3.2vw, 2.4rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 34ch;
}

.case-lead {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.66;
  color: var(--ink-soft);
  max-width: 74ch;
}

.case-tools-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.case-report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--divider-soft);
}

.case-report-actions .btn {
  padding: 8px 15px;
  font-size: 0.86rem;
}

/* Crisp 4-Column Specification Strip (No Floating Overlap) */
.kpi-strip-wrap {
  margin: 24px auto 28px;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.kpi-card {
  padding: 16px 18px;
  border-right: 1px solid var(--border-strong);
  background: var(--surface);
}

.kpi-card:last-child {
  border-right: none;
}

.kpi-card .val {
  display: block;
  font-size: clamp(1.18rem, 1.8vw, 1.42rem);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.18;
  margin-bottom: 4px;
}

.kpi-card .lbl {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.35;
}

.case-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 28px;
  align-items: start;
  padding-bottom: 64px;
}

.case-article {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 32px 36px;
}

.case-section {
  background: transparent;
  padding: 0 0 28px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--divider-soft);
}

.case-section:last-of-type {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.case-section h2 {
  margin: 0 0 12px;
  font-size: 1.3rem;
  color: var(--ink);
  letter-spacing: -0.015em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--rule-heavy);
}

.case-section p {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.74;
}

.case-section strong {
  color: var(--ink);
  font-weight: 600;
}

.case-section em {
  font-style: italic;
}

.case-section sub,
.case-section sup {
  font-size: 0.72em;
  line-height: 0;
}

.case-section ul {
  margin: 0 0 18px;
  padding-left: 20px;
  color: var(--ink-soft);
}

.case-section li {
  margin-bottom: 8px;
  font-size: 0.96rem;
  line-height: 1.68;
}

.case-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: transparent;
  color: var(--ink);
  border: none;
  padding: 0;
  font-weight: 500;
}

.case-fig-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.case-fig-grid .case-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.case-fig-grid .case-figure img {
  height: 240px;
  max-height: 240px;
  object-fit: contain;
  width: 100%;
}

.case-fig-grid .case-figure.cover-fit img {
  object-fit: cover;
}

.case-fig-grid .case-figure figcaption {
  flex: 1;
}

.case-figure {
  margin: 20px 0;
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.case-figure-btn {
  display: block;
  width: 100%;
  border: none;
  padding: 8px;
  background: var(--plot-frame);
  cursor: zoom-in;
  position: relative;
}

.case-figure.cover-fit .case-figure-btn {
  padding: 0;
}

.case-figure img {
  width: 100%;
  max-height: 500px;
  object-fit: contain;
  background: var(--plot-frame);
  margin: 0 auto;
}

.case-figure-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(17, 24, 39, 0.88);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  opacity: 0;
  transition: opacity var(--transition);
}

.case-figure-btn:hover .case-figure-hint {
  opacity: 1;
}

.case-figure figcaption {
  padding: 10px 14px;
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--ink-soft);
  border-top: 1px solid var(--border-strong);
  background: var(--surface-alt);
}

/* Sticky Sidebar */
.case-aside {
  position: sticky;
  top: calc(var(--nav-h) + 18px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.aside-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
}

.aside-card h3 {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--rule-heavy);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.aside-report-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aside-report-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--accent-border);
  background: var(--accent-bg);
  color: var(--accent-strong);
  font-size: 0.83rem;
  font-weight: 700;
  line-height: 1.3;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.aside-report-link:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.meta-dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.meta-dl > div {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--divider-soft);
}

.meta-dl > div:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.meta-dl dt {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin-bottom: 2px;
}

.meta-dl dd {
  margin: 0;
  font-size: 0.89rem;
  font-weight: 600;
  color: var(--ink);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-list a {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-left: 2px solid var(--border);
  transition: all var(--transition);
}

.toc-list a:hover,
.toc-list a.active {
  background: var(--surface-alt);
  color: var(--accent);
  border-left-color: var(--accent);
}

.case-bottom-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 2px solid var(--rule-heavy);
}

/* ==========================================================================
   Lightbox Modal
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(10, 14, 20, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox.open {
  display: flex;
}

.lightbox-inner {
  position: relative;
  max-width: 1120px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid #475569;
  background: #ffffff;
}

.lightbox-caption {
  color: #f1f5f9;
  font-size: 0.9rem;
  text-align: center;
  max-width: 74ch;
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid #64748b;
  background: #111827;
  color: #ffffff;
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover {
  background: #ffffff;
  color: #111827;
}

/* ==========================================================================
   Web-Safe Printable CV Page (cv.html)
   ========================================================================== */
.cv-toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
  padding: 12px 0;
}

.cv-toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cv-sheet {
  max-width: 880px;
  margin: 28px auto 60px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.cv-header {
  background: var(--surface-alt);
  color: var(--ink);
  border-bottom: 2px solid var(--rule-heavy);
  padding: 28px 34px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.cv-avatar {
  width: 96px;
  height: 108px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--border-strong);
  padding: 3px;
  background: var(--surface);
  flex-shrink: 0;
}

.cv-header h1 {
  margin: 0 0 4px;
  font-size: 1.8rem;
  color: var(--ink);
}

.cv-header .role {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.98rem;
  font-weight: 600;
}

.cv-contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.84rem;
  color: var(--ink-muted);
}

.cv-body {
  padding: 28px 34px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cv-block h2 {
  margin: 0 0 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  padding-bottom: 6px;
  border-bottom: 2px solid var(--rule-heavy);
}

.cv-entry {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--divider-soft);
}

.cv-entry:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.cv-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-weight: 700;
  font-size: 0.95rem;
}

.cv-entry-sub {
  font-size: 0.86rem;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.cv-entry p {
  margin: 0;
  font-size: 0.89rem;
  color: var(--ink-soft);
}

.cv-projects-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.89rem;
  color: var(--ink-soft);
}

.cv-projects-list strong {
  color: var(--ink);
}

@media print {
  :root, [data-theme="dark"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --ink: #111827;
    --ink-soft: #1f2937;
    --ink-muted: #4b5563;
    --border: #cbd5e1;
    --border-strong: #94a3b8;
    --rule-heavy: #111827;
    --accent: #0f4c81;
    --accent-strong: #0a365c;
  }
  .navbar, .cv-toolbar, .site-footer {
    display: none !important;
  }
  body {
    background: #ffffff;
    color: #111827;
  }
  .cv-sheet {
    margin: 0;
    max-width: 100%;
    border: none;
    border-radius: 0;
  }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 980px) {
  .featured-card {
    grid-template-columns: 1fr;
  }
  .featured-media {
    border-right: none;
    border-bottom: 1px solid var(--border-strong);
    min-height: 250px;
  }
  .project-grid,
  .cert-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .two-col,
  .exp-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi-card:nth-child(2) {
    border-right: none;
  }
  .kpi-card:nth-child(1),
  .kpi-card:nth-child(2) {
    border-bottom: 1px solid var(--border-strong);
  }
  .case-layout {
    grid-template-columns: 1fr;
  }
  .case-aside {
    position: static;
    order: -1;
  }
}

@media (max-width: 720px) {
  .nav-links {
    display: none;
  }
  .menu-toggle {
    display: inline-flex;
  }
  .hero {
    padding: 34px 0 38px;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .avatar-wrap {
    margin: 0;
  }
  .avatar {
    width: 144px;
    height: 160px;
  }
  .featured-body {
    padding: 22px 20px;
  }
  .featured-kpis {
    grid-template-columns: 1fr;
  }
  .kpi-mini {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .kpi-mini:last-child {
    border-bottom: none;
  }
  .project-grid,
  .cert-grid {
    grid-template-columns: 1fr;
  }
  .kpi-strip {
    grid-template-columns: 1fr;
  }
  .kpi-card {
    border-right: none !important;
    border-bottom: 1px solid var(--border-strong);
  }
  .kpi-card:last-child {
    border-bottom: none;
  }
  .case-article {
    padding: 22px 18px;
  }
  .case-fig-grid {
    grid-template-columns: 1fr;
  }
  .case-fig-grid .case-figure img {
    height: auto;
    max-height: 360px;
  }
  .cv-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 20px;
  }
  .cv-body {
    padding: 22px 20px;
  }
}
