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

:root {
  --bg: #F9F8F6;
  --text: #2D2D2D;
  --muted: #666;
  --accent: #D97757;
  --border: rgba(217,119,87,0.18);
}

body.dark-navy-mode {
  --accent: #214E8A;
  --border: rgba(33,78,138,0.18);
}

html {
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  font-size: 135%;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family:'Lora', serif; font-weight:500; }
p { color: var(--muted); margin-bottom:1rem; }
a { color: inherit; text-decoration: none; }

/* ── LAYOUT ── */
section {
  position: relative;
  width: 100%;
  min-height: 100vh;
  height: auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 5rem 15%;
  z-index: 10;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* ── NAV ── */
nav {
  position: fixed; top:0; left:0; right:0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.2rem 3rem;
  background: rgba(249,248,246,0.9);
  backdrop-filter: blur(14px);
  border-bottom: none;
}

/* Base Gradient Line for Nav */
nav::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  border-radius: 2px;
}

.nav-links { display:flex; gap:0; width:100%; justify-content:space-evenly; position: relative; }
.nav-links a { 
  font-size: .95rem; 
  color: var(--muted); 
  position: relative; 
  padding: 0.5rem 0.2rem;
  display: flex;
}

/* The animated underline for each tab */
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -1.2rem; /* matches nav padding to hit the baseline */
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  transform-origin: center;
}

@keyframes navBreath {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
}

.nav-links a.active::after {
  animation: navBreath 2.5s infinite ease-in-out;
}

.nav-links a.active {
  font-weight: 600;
}

/* Alternating letter fill animation */
.nav-letter {
  display: inline-block;
  background: linear-gradient(to bottom, var(--text) 50%, var(--muted) 50%);
  background-size: 100% 200%;
  background-position: bottom;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: background-position 1.5s ease-in-out;
}

.nav-letter:nth-child(odd) {
  background-image: linear-gradient(to bottom, var(--accent) 50%, var(--muted) 50%);
}

.nav-links a.active .nav-letter {
  background-position: top;
}

/* ── HERO ── */
.hero {
  align-items: center;
  text-align: center;
  padding-top: 5.5rem;
  gap: 0;
}
.hero h1 {
  font-family: 'Lora', serif;
  font-size: clamp(3.4rem, 7vw, 5.8rem);
  letter-spacing: -.03em;
  margin-bottom: 1.2rem;
  line-height: 1.05;
}
.hero .subtitle {
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  color: var(--accent);
  font-weight: 500;
  letter-spacing: .06em;
  margin-bottom: 2rem;
}
.hero .bio {
  max-width: 660px;
  font-size: clamp(0.92rem, 1.35vw, 1.08rem);
  line-height: 1.8;
  color: var(--muted);
  margin-bottom: 2rem;
}
.contact-bar {
  margin-top: 1.5rem;
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  justify-content: center;
  font-family: monospace;
  font-size: clamp(.85rem, 1.2vw, 1rem);
}
.contact-bar span { color: var(--accent); }

/* ── CTA BUTTONS ── */
.cta-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.72rem 1.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
}

.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 0.7rem 1.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-outline:hover { background: rgba(217,119,87,0.06); }

/* ── EXPERIENCE TIMELINE ── */
.exp-tl {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 2.5rem;
  position: relative;
}

.exp-tl-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin-top: 10px;
  position: relative;
}

.exp-tl-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  gap: 0.75rem;
  flex-shrink: 0;
  width: 150px;
}

.exp-tl-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  transition: all 0.25s;
  position: relative;
  z-index: 1;
}

.exp-tl-node.active .exp-tl-dot,
.exp-tl-node:hover .exp-tl-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 5px rgba(217,119,87,0.15);
}

.exp-tl-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.15rem;
}

.exp-tl-company {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.exp-tl-node.active .exp-tl-company { color: var(--accent); }

.exp-tl-role {
  font-size: 0.68rem;
  color: var(--muted);
}

.exp-tl-date {
  font-size: 0.65rem;
  font-family: monospace;
  color: var(--accent);
}

.exp-tl-loc {
  font-size: 0.6rem;
  color: var(--muted);
}

.exp-tl-node:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

/* ── EXPERIENCE JOB PANELS ── */
.exp-jobs {
  position: relative;
  min-height: 28rem; /* tall enough for the 5-bullet LLM panel */
}

.exp-job {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: none;
}

.exp-job.active { display: block; }

/* Staggered content reveal — each piece slides in from the left */
.exp-job.active .exp-job-header,
.exp-job.active .exp-bullets li,
.exp-job.active .exp-tech {
  animation: expReveal 0.42s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.exp-job.active .exp-job-header          { animation-delay: 0s;    }
.exp-job.active .exp-bullets li:nth-child(1) { animation-delay: 0.08s; }
.exp-job.active .exp-bullets li:nth-child(2) { animation-delay: 0.16s; }
.exp-job.active .exp-bullets li:nth-child(3) { animation-delay: 0.24s; }
.exp-job.active .exp-bullets li:nth-child(4) { animation-delay: 0.32s; }
.exp-job.active .exp-bullets li:nth-child(5) { animation-delay: 0.40s; }
.exp-job.active .exp-tech                { animation-delay: 0.48s; }

@keyframes expReveal {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}

.exp-job-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.exp-job-company {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.exp-company-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s, color 0.2s;
}
.exp-company-link:hover { color: var(--accent); border-color: var(--accent); }

.exp-job-role {
  font-size: 0.82rem;
  color: var(--accent);
  font-family: monospace;
}

.exp-job-badge {
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(0,0,0,0.04);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.25rem 0.9rem;
  white-space: nowrap;
  font-family: monospace;
}

.exp-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.exp-bullets li {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.65;
  padding-left: 1.1rem;
  position: relative;
}

.exp-bullets li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.exp-tech { margin-top: 0.5rem; }

/* Psychological highlight */
.hl { color: var(--accent); font-weight: 500; opacity: 0.9; }

@media(max-width:900px) {
  .exp-tl { flex-direction: column; align-items: flex-start; gap: 1.2rem; }
  .exp-tl-connector { width: 2px; height: 24px; margin: 0 9px; flex: none; }
  .exp-tl-node { flex-direction: row; width: auto; }
  .exp-tl-meta { align-items: flex-start; text-align: left; }
}

/* ── SHARED CARD ── */
.section-title {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.section-title::after { content:''; flex:1; height:1px; background:var(--border); }

.card {
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.04);
  transition: transform .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 16px 36px rgba(0,0,0,.07); }

.pill {
  display: inline-block;
  background: rgba(217,119,87,.1);
  padding: .25rem .65rem;
  border-radius: 4px;
  font-size: .75rem;
  color: var(--accent);
  font-weight: 600;
  margin: 0 .3rem .3rem 0;
}
.meta { font-family:monospace; color:var(--accent); font-size:.82rem; margin-bottom:.6rem; }
.proj-link {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 0.5rem;
}
.proj-link:hover { text-decoration: underline; }

.proj-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

/* ── PUBLICATIONS ── */
.pub-role-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.pub-status {
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-block;
  margin-top: 0.25rem;
}

.pub-status--review   { color: var(--accent); }
.pub-status--published { color: #3d7a4f; }

.pub-grid .card {
  display: flex;
  flex-direction: column;
}

.pub-card-footer {
  margin-top: auto;
  padding-top: 0.75rem;
}

/* ── SKILL CATEGORIES ── */
.skill-categories {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.skill-category {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
}

.skill-category:last-child { border-bottom: 1px solid var(--border); }

.skill-cat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text);
  font-weight: 600;
  padding-top: 0.3rem;
  text-align: right;
  padding-right: 1rem;
}

.skill-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }

/* ── LANGUAGES SECTION ── */
.lang-tiles {
  display: flex;
  justify-content: space-evenly;
  width: 100%;
}

.lang-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  padding: 2.2rem 1.5rem 1.8rem;
  background: transparent;
  transition: transform 0.2s;
  position: relative;
}

.lang-tile:hover {
  transform: translateY(-4px);
}

.lang-tile-code {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.lang-tile-flag {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140px;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
  pointer-events: none;
}

.lang-tile-code,
.lang-tile-name,
.lang-tile-level {
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.lang-tile:hover .lang-tile-code,
.lang-tile:hover .lang-tile-name,
.lang-tile:hover .lang-tile-level {
  opacity: 0;
  transform: translateY(15px);
}

.lang-tile:hover .lang-tile-flag {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.lang-tile-name {
  font-family: 'Lora', serif;
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text);
}

.lang-tile-level {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── NAME SCRIPT ── */
.name-nick {
  font-family: 'Pinyon Script', cursive;
  font-size: 1.55em;
  letter-spacing: -0.01em;
  display: inline-block;
}

/* ── NUMBERS & IMPACTS ── */
.impact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  width: 100%;
}

.impact-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  position: relative;
}

.impact-item .stat-num {
  font-family: 'Lora', serif;
  font-size: clamp(3rem, 6vw, 5rem);
  color: var(--accent);
  line-height: 1;
}

.impact-item .stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  max-width: 140px;
  line-height: 1.4;
}

.impact-tip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: rgba(255,255,255,0.88);
  font-size: 0.72rem;
  line-height: 1.55;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  width: 240px;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  transform: translateX(-50%) translateY(4px);
  z-index: 200;
}

.impact-item:hover .impact-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.impact-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--text);
}

.tip-hl { color: var(--accent); font-weight: 600; }

body.dark-navy-mode .impact-tip {
  background: #D97757;
  color: #fff;
}

body.dark-navy-mode .impact-tip::after {
  border-top-color: #D97757;
}

/* Full page blur on stat hover */
body.stat-focus::before {
  content: '';
  position: fixed;
  inset: 0;
  backdrop-filter: blur(6px);
  background: rgba(249,248,246,0.35);
  z-index: 400;
  pointer-events: none;
  transition: opacity 0.3s;
}

body.stat-focus #impact {
  position: relative;
  z-index: 500;
}

body.stat-focus #impact .section-title,
body.stat-focus .impact-item:not(.focused) {
  filter: blur(6px);
  opacity: 0.35;
  transition: filter 0.3s, opacity 0.3s;
}

.impact-item {
  transition: filter 0.3s, opacity 0.3s;
}

.impact-item.focused {
  position: relative;
  z-index: 501;
}

.impact-item.focused .impact-tip {
  z-index: 502;
}


/* ── HOBBIES ── */
.hobby-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  width: 100%;
}

.hobby-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  perspective: 1000px;
  cursor: pointer;
  border-radius: 8px;
}

.hobby-tile-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s ease;
  transform-style: preserve-3d;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.hobby-tile:hover .hobby-tile-inner {
  transform: scale(1.025);
  box-shadow: 0 12px 36px rgba(0,0,0,0.3);
}

.hobby-tile.flipped .hobby-tile-inner {
  transform: scale(1.025) rotateY(180deg);
}

.hobby-tile-front,
.hobby-tile-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  overflow: hidden;
}

.hobby-tile-front {
  background-size: cover;
  background-position: center;
  background-color: #1c1c1c;
  filter: grayscale(1) contrast(1.1) brightness(0.92);
  transition: filter 0.45s ease;
}

.hobby-tile:hover .hobby-tile-front {
  filter: grayscale(0.12) contrast(1.04) brightness(1.0);
}

.hobby-tile-back {
  transform: rotateY(180deg);
  background: var(--bg-card);
  color: var(--text);
  padding: 1.2rem;
  font-size: 0.8rem;
  line-height: 1.5;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hobby-tile-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 0.9rem 0.75rem;
  background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, transparent 100%);
}

.hobby-tile-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hobby-tile-ref {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.5);
  margin-top: 3px;
  font-family: 'Lora', serif;
  font-style: italic;
}

/* ── SITE END ── */
.site-end {
  padding: 2.5rem 15%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.site-end-line {
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border: none;
  border-radius: 2px;
}

.site-end-text {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  opacity: 0.6;
}

/* ── EDUCATION ROWS ── */
.edu-rows {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.edu-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--border);
}

.edu-row:last-child { border-bottom: 1px solid var(--border); }

.edu-row-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text);
  font-weight: 600;
  text-align: right;
  padding-right: 1rem;
  padding-top: 0.25rem;
}

.edu-row-institution {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.edu-row-note {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  font-style: italic;
}

/* ── EDUCATION TIMELINE ── */
.edu-tl {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 2.5rem;
  position: relative;
}

.edu-tl-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin-top: 10px;
}

.edu-tl-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  gap: 0.75rem;
  flex-shrink: 0;
  width: 180px;
}

.edu-tl-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  transition: all 0.25s;
  position: relative;
  z-index: 1;
}

.edu-tl-node.active .edu-tl-dot,
.edu-tl-node:hover .edu-tl-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 5px rgba(217,119,87,0.15);
}

.edu-tl-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.15rem;
}

.edu-tl-degree {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.edu-tl-node.active .edu-tl-degree { color: var(--accent); }

.edu-tl-school { font-size: 0.68rem; color: var(--muted); }
.edu-tl-date   { font-size: 0.65rem; font-family: monospace; color: var(--accent); }
.edu-tl-loc    { font-size: 0.6rem; color: var(--muted); }

.edu-tl-node:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

.edu-panels { position: relative; min-height: 18rem; }
.edu-panel  { position: absolute; top: 0; left: 0; right: 0; display: none; }
.edu-panel.active { display: block; }

.edu-panel.active .edu-panel-header,
.edu-panel.active .exp-bullets li {
  animation: expReveal 0.42s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
.edu-panel.active .edu-panel-header             { animation-delay: 0s;    }
.edu-panel.active .exp-bullets li:nth-child(1)  { animation-delay: 0.08s; }
.edu-panel.active .exp-bullets li:nth-child(2)  { animation-delay: 0.16s; }
.edu-panel.active .exp-bullets li:nth-child(3)  { animation-delay: 0.24s; }

.edu-panel-header { margin-bottom: 1.2rem; }
.edu-panel-degree { font-size: 1.15rem; font-weight: 600; color: var(--text); margin-bottom: 0.25rem; }
.edu-panel-role   { font-size: 0.82rem; color: var(--accent); font-family: monospace; }

/* ── CERTIFICATIONS GRAPH ── */
.cert-graph-wrap {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#cert-svg {
  width: 100%;
  max-width: 1200px;
  height: auto;
  overflow: visible;
}

.cert-line {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
}

#cert-svg.cert-animated .cert-line {
  animation: certDrawLine 0.5s ease forwards;
  animation-delay: var(--delay, 0ms);
}

@keyframes certDrawLine {
  to { stroke-dashoffset: 0; }
}

.cert-node {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  cursor: pointer;
  transition: opacity 0.15s;
}

#cert-svg.cert-animated .cert-node {
  animation: certPopNode 0.3s ease forwards;
  animation-delay: var(--node-delay, 0ms);
}

@keyframes certPopNode {
  from { opacity: 0; transform: scale(0); }
  to   { opacity: 1; transform: scale(1); }
}

.cert-hub-ring {
  animation: certRingPulse 3s ease-in-out infinite;
}
@keyframes certRingPulse {
  0%, 100% { opacity: 0.08; }
  50%       { opacity: 0.28; }
}

.cert-hub-label {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  pointer-events: none;
  white-space: nowrap;
}

.cert-tooltip {
  position: absolute;
  bottom: -2.2rem;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 0.72rem;
  font-family: 'Inter', sans-serif;
  padding: 0.28rem 0.85rem;
  border-radius: 100px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  white-space: nowrap;
}

/* ── GRIDS ── */
.proj-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:1.5rem; }
.pub-grid  { display:grid; grid-template-columns:repeat(3,1fr); gap:1.5rem; }
.proj-grid .card {
  display: flex;
  flex-direction: column;
}

/* ── MASCOT ── */
#mascot {
  position: fixed;
  right: 1.2%;
  top: 50%;
  width: 80px;
  z-index: 500;
  pointer-events: none;
  animation: floatMascot 5s ease-in-out infinite;
}
#tess-canvas { display:block; margin:0 auto 4px; width:38px; height:38px; }

/* tentacle waves */
.t-leg-1 { animation: wave1 3.0s ease-in-out infinite;       transform-origin: 34px 88px; }
.t-leg-2 { animation: wave2 3.4s ease-in-out infinite  .3s;  transform-origin: 46px 91px; }
.t-leg-3 { animation: wave3 3.2s ease-in-out infinite  .6s;  transform-origin: 64px 91px; }
.t-leg-4 { animation: wave4 2.8s ease-in-out infinite  .9s;  transform-origin: 76px 88px; }
.t-arm-l { animation: armL  4.0s ease-in-out infinite;       transform-origin: 28px 60px; }
.t-arm-r { animation: armR  4.0s ease-in-out infinite  .5s;  transform-origin: 82px 60px; }

@keyframes wave1 { 0%,100%{ transform:rotate(0deg);   } 50%{ transform:rotate(12deg);  } }
@keyframes wave2 { 0%,100%{ transform:rotate(0deg);   } 50%{ transform:rotate(-10deg); } }
@keyframes wave3 { 0%,100%{ transform:rotate(0deg);   } 50%{ transform:rotate(10deg);  } }
@keyframes wave4 { 0%,100%{ transform:rotate(0deg);   } 50%{ transform:rotate(-12deg); } }
@keyframes armL  { 0%,100%{ transform:rotate(0deg);   } 50%{ transform:rotate(-8deg);  } }
@keyframes armR  { 0%,100%{ transform:rotate(0deg);   } 50%{ transform:rotate(8deg);   } }
@keyframes floatMascot {
  0%,100% { transform: translateY(-50%); }
  50%     { transform: translateY(calc(-50% - 12px)); }
}

/* Flag wave animations */
.flag-wave-a {
  transform-origin: 0 14px;
  animation: flagWave 2.2s ease-in-out infinite;
}
.flag-wave-b {
  transform-origin: 0 14px;
  animation: flagWave 2.6s ease-in-out infinite 0.4s;
}
.flag-wave-c {
  transform-origin: 0 14px;
  animation: flagWave 2s ease-in-out infinite 0.8s;
}
@keyframes flagWave {
  0%, 100% { transform: rotate(-5deg); }
  50%       { transform: rotate(10deg); }
}

/* ── MASCOT OVERLAYS (hidden by default) ── */
.tess-mouth-wide,
.tess-mouth-neutral,
.tess-mouth-surprised,
.tess-wave-arm,
.tess-flex-l,
.tess-flex-r,
.tess-cap,
.tess-glasses,
.tess-flags { display: none; }

/* Hero — wave + wide smile */
#mascot.section-hero .tess-wave-arm      { display: block; }
#mascot.section-hero .tess-mouth-wide    { display: block; }
#mascot.section-hero .tess-mouth-default { display: none; }
#mascot.section-hero .t-arm-r            { display: none; }

/* Experience — neutral mouth */
#mascot.section-experience .tess-mouth-neutral  { display: block; }
#mascot.section-experience .tess-mouth-default  { display: none; }

/* Projects — surprised/excited */
#mascot.section-projects .tess-mouth-surprised { display: block; }
#mascot.section-projects .tess-mouth-default   { display: none; }

/* Publications — glasses */
#mascot.section-publications .tess-glasses { display: block; }

/* Skills — flex arms + wide smile */
#mascot.section-skills .tess-flex-l       { display: block; }
#mascot.section-skills .tess-flex-r       { display: block; }
#mascot.section-skills .tess-mouth-wide   { display: block; }
#mascot.section-skills .tess-mouth-default { display: none; }
#mascot.section-skills .t-arm-l,
#mascot.section-skills .t-arm-r { display: none; }

/* Education — cap + wide smile */
#mascot.section-education .tess-cap         { display: block; }
#mascot.section-education .tess-mouth-wide  { display: block; }
#mascot.section-education .tess-mouth-default { display: none; }

/* Certifications — glasses + proud smile */
#mascot.section-certifications .tess-glasses     { display: block; }
#mascot.section-certifications .tess-mouth-wide  { display: block; }
#mascot.section-certifications .tess-mouth-default { display: none; }

/* Contact — wave + wide smile */
#mascot.section-contact .tess-wave-arm    { display: block; }
#mascot.section-contact .tess-mouth-wide  { display: block; }
#mascot.section-contact .tess-mouth-default { display: none; }
#mascot.section-contact .t-arm-r          { display: none; }

/* Impact — wide smile (proud of the numbers) */
#mascot.section-impact .tess-mouth-wide    { display: block; }
#mascot.section-impact .tess-mouth-default { display: none; }

/* Languages — default Octo with wide smile */
#mascot.section-languages .tess-mouth-wide    { display: block; }
#mascot.section-languages .tess-mouth-default { display: none; }

/* Hobbies — wave + wide smile */
#mascot.section-hobbies .tess-wave-arm    { display: block; }
#mascot.section-hobbies .tess-mouth-wide  { display: block; }
#mascot.section-hobbies .tess-mouth-default { display: none; }
#mascot.section-hobbies .t-arm-r          { display: none; }

/* ── MASCOT INTERACTIONS ── */
#mascot { cursor: pointer; pointer-events: auto; }

/* Click: show surprised face regardless of active section */
#mascot.tess-surprised .tess-mouth-surprised { display: block; }
#mascot.tess-surprised .tess-mouth-default   { display: none; }
#mascot.tess-surprised .tess-mouth-wide      { display: none; }
#mascot.tess-surprised .tess-mouth-neutral   { display: none; }

/* Hover: tentacles speed up */
#mascot.tess-hover .t-leg-1,
#mascot.tess-hover .t-leg-2,
#mascot.tess-hover .t-leg-3,
#mascot.tess-hover .t-leg-4,
#mascot.tess-hover .t-arm-l,
#mascot.tess-hover .t-arm-r { animation-duration: 1s !important; }

/* Hover: slight scale up on the SVG */
#mascot.tess-hover svg { transform: scale(1.07); transition: transform 0.25s ease; }

/* Click: spin override */
#mascot.tess-spin { animation: tess-360 0.42s ease !important; }
@keyframes tess-360 {
  from { transform: translateY(-50%) rotate(0deg); }
  to   { transform: translateY(-50%) rotate(360deg); }
}

/* Idle: slow tentacles + dim */
#mascot.tess-idle .t-leg-1,
#mascot.tess-idle .t-leg-2,
#mascot.tess-idle .t-leg-3,
#mascot.tess-idle .t-leg-4 { animation-duration: 9s !important; }
#mascot.tess-idle { opacity: 0.75; transition: opacity 1s; }

/* ── RESPONSIVE ── */

/* Projects, publications & languages go vertical at ≤1024px (tablets + phones) */
@media(max-width:1024px){
  .pub-grid,.proj-grid { grid-template-columns:1fr; }
  .lang-tiles { grid-template-columns: 1fr; max-width: 320px; margin: 0 auto; }
  .lang-tile { max-width: 100%; }
}

@media(max-width:900px){
  section { padding: 4rem 6%; }
  .stats-grid { grid-template-columns:repeat(2,1fr); }
  .skill-category { grid-template-columns: 1fr; }
  .skill-cat-label { text-align: left; padding-right: 0; border-bottom: none; }
  .edu-row { grid-template-columns: 1fr; }
  .edu-row-label { text-align: left; padding-right: 0; }
  .impact-grid { grid-template-columns: repeat(2, 1fr); }
  .hobby-tiles { grid-template-columns: repeat(2, 1fr); }
  #mascot { width: 60px; right: 0.5%; }
  #tess-canvas { width: 44px; height: 44px; }
}

@media(max-width:580px) {
  #mascot { display: none; }
}

/* ── MOBILE (≤480px) ── */
@media(max-width:480px) {
  /* Reduce base font so everything fits without overflow */
  html { font-size: 110%; }

  /* Looser scroll snap on touch — mandatory is too jarring */
  html { scroll-snap-type: y proximity; }

  /* Tighter section padding */
  section { padding: 3rem 5%; }

  /* Nav: shrink letter spacing so 4 tabs fit */
  .nav-links { gap: 0; }
  .nav-letter { letter-spacing: -0.01em; }
  nav { padding: 0 0.5rem; }

  /* Hero: stack buttons vertically on tiny screens */
  .hero-ctas { flex-direction: column; align-items: center; gap: 0.75rem; }
  .hero-contact { flex-direction: column; align-items: center; gap: 0.5rem; }

  /* Experience & Education panels: fixed height is too tall on small screens */
  .exp-jobs { min-height: 22rem; }
  .edu-panels { min-height: 14rem; }

  /* Impact: 1 column on small phones */
  .impact-grid { grid-template-columns: 1fr; }

  /* Hobby tiles: 1 column on small phones */
  .hobby-tiles { grid-template-columns: 1fr; max-width: 320px; margin: 0 auto; }

  /* Section title: slightly smaller */
  .section-title { font-size: 1.8rem; }

  /* Skills: ensure label doesn't overflow */
  .skill-cat-label { font-size: 0.8rem; }

  /* Certifications graph: allow horizontal scroll on tiny screens */
  .cert-graph-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #cert-svg { min-width: 560px; width: 560px; }
}
