/* ============================================================
   PRESTIGE — Monochrome Editorial Design System
   Eyüp Altuğ Tunç Personal Site
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,600;1,9..144,300;1,9..144,600&display=swap');

/* ── Tokens ── */
:root {
  --bg:        #f5f3ef;
  --bg2:       #edeae4;
  --bg3:       #e5e2db;
  --surface:   rgba(0,0,0,0.025);
  --border:    rgba(0,0,0,0.09);
  --border2:   rgba(0,0,0,0.15);
  --ink:       #0f0f0f;
  --ink2:      #2a2a2a;
  --muted:     #7a7570;
  --accent:    #b85c2c;
  --accent2:   rgba(184,92,44,0.12);
  --accent3:   rgba(184,92,44,0.06);
  --green:     #2d7a3a;
  --blue:      #2455a4;

  --serif:     'Fraunces', Georgia, serif;
  --sans:      'Inter', system-ui, sans-serif;
  --mono:      'JetBrains Mono', monospace;

  --radius:    6px;
  --radius-lg: 10px;
  --nav-h:     56px;
  --trans:     0.22s ease;
  --shadow:    0 2px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.07);
}

/* Dark mode */
[data-theme="dark"] {
  --bg:      #111110;
  --bg2:     #1a1917;
  --bg3:     #222120;
  --surface: rgba(255,255,255,0.03);
  --border:  rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --ink:     #f0ede8;
  --ink2:    #d4cfc8;
  --muted:   #7a7570;
  --accent:  #d4733a;
  --accent2: rgba(212,115,58,0.12);
  --accent3: rgba(212,115,58,0.06);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background var(--trans), color var(--trans);
}

a { text-decoration: none; color: inherit; transition: color var(--trans); }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ── Container ── */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ── NAV ── */
.p-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(245,243,239,0.93);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background var(--trans), border-color var(--trans);
}
[data-theme="dark"] .p-nav {
  background: rgba(17,17,16,0.93);
}

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

.p-logo {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.p-nav-links {
  display: flex;
  gap: 0;
}

.p-nav-links a {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink2);
  padding: 8px 13px;
  border-bottom: 2px solid transparent;
  transition: all var(--trans);
  white-space: nowrap;
}
.p-nav-links a:hover,
.p-nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.p-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.p-lang-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 3px;
  transition: color var(--trans);
}
.p-lang-btn:hover { color: var(--ink); }
.p-lang-btn.active { color: var(--accent); font-weight: 600; }

/* Dark mode toggle */
.p-theme-toggle {
  width: 36px; height: 20px;
  border-radius: 10px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0 3px;
  transition: background var(--trans);
  position: relative;
  margin-left: 6px;
}
.p-theme-toggle-knob {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ink2);
  transition: transform var(--trans), background var(--trans);
}
[data-theme="dark"] .p-theme-toggle-knob {
  transform: translateX(16px);
  background: var(--accent);
}

/* Hamburger */
.p-hamburger {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
.p-hamburger span {
  display: block;
  width: 22px; height: 1.5px;
  background: var(--ink);
  transition: all var(--trans);
}

/* ── Page wrapper ── */
.p-page {
  padding-top: calc(var(--nav-h) + 60px);
  padding-bottom: 100px;
  min-height: 100vh;
}

/* ── Section title ── */
.p-section-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  color: var(--ink);
  margin-bottom: 48px;
  letter-spacing: -0.5px;
  position: relative;
  padding-bottom: 16px;
}
.p-section-title::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 40px; height: 2px;
  background: var(--accent);
}

.p-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: block;
}

/* ── Cards ── */
.p-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: border-color var(--trans), box-shadow var(--trans), transform var(--trans);
  position: relative;
}
.p-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
[data-theme="dark"] .p-card { background: var(--bg2); }

/* ── Buttons ── */
.p-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all var(--trans);
  border: 1px solid transparent;
  font-family: var(--sans);
}
.p-btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.p-btn-primary:hover {
  background: var(--ink2);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.p-btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.p-btn-outline:hover {
  background: var(--accent2);
  transform: translateY(-1px);
}
.p-btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border2);
}
.p-btn-ghost:hover {
  color: var(--ink);
  border-color: var(--border2);
  background: var(--surface);
}

/* ── Tags / Chips ── */
.p-tag {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--border2);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink2);
  letter-spacing: 0.3px;
}
.p-tag-accent {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent3);
}

/* ── Mono label ── */
.p-mono {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* ── Divider ── */
.p-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

/* ── Grid ── */
.p-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.p-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 24px; }

/* ── Skill bar ── */
.p-skill-item { margin-bottom: 20px; }
.p-skill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}
.p-skill-name { font-size: 13px; font-weight: 500; color: var(--ink2); }
.p-skill-level { font-size: 11px; font-family: var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.p-skill-track {
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}
.p-skill-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--ink);
  width: 0;
  transition: width 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.p-skill-fill.accent { background: var(--accent); }
.p-skill-fill.green  { background: var(--green); }
.p-skill-fill.blue   { background: var(--blue); }

/* ── Reveal animation ── */
.p-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.p-reveal.active {
  opacity: 1;
  transform: none;
}

/* ── Footer ── */
.p-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
  margin-top: 80px;
}

/* ── Timeline (horizontal → vertical on mobile) ── */
.p-timeline {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 60px 0 40px;
}
.p-timeline::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--border2);
}
.p-timeline-item {
  flex: 1;
  padding: 0 16px;
  position: relative;
}
.p-timeline-item::before {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
}
.p-timeline-year {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}
.p-timeline-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 6px;
}
.p-timeline-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Publication bar chart ── */
.p-pub-chart {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 260px;
  border-bottom: 1px solid var(--border2);
  padding-bottom: 0;
  gap: 8px;
}
.p-pub-year-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 100px;
}
.p-pub-bars {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  height: 220px;
  margin-bottom: 12px;
}
.p-pub-bar {
  width: 28px;
  height: 0;
  border-radius: 3px 3px 0 0;
  transition: height 1.2s cubic-bezier(0.34, 1.2, 0.64, 1);
  position: relative;
}
.p-pub-bar::after {
  content: attr(data-count);
  position: absolute;
  top: -22px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.p-pub-bar.article { background: var(--ink); }
.p-pub-bar.conf    { background: var(--accent); }
.p-pub-bar.rev     { background: var(--muted); }
.p-pub-year-label  {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

/* ── CV inline styles ── */
.p-cv-section { margin-bottom: 48px; }
.p-cv-entry {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.p-cv-entry:last-child { border-bottom: none; }
.p-cv-role {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
}
.p-cv-place { font-size: 13px; color: var(--accent); margin-bottom: 4px; }
.p-cv-desc  { font-size: 13px; color: var(--muted); line-height: 1.6; margin-top: 8px; }
.p-cv-date  {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Contact form ── */
.p-form-group { margin-bottom: 20px; }
.p-form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink2);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.p-form-input,
.p-form-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--ink);
  font-family: var(--sans);
  transition: border-color var(--trans), box-shadow var(--trans);
  outline: none;
}
[data-theme="dark"] .p-form-input,
[data-theme="dark"] .p-form-textarea { background: var(--bg2); }
.p-form-input:focus,
.p-form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent2);
}
.p-form-textarea { resize: vertical; min-height: 120px; }

/* ── Blog card ── */
.p-blog-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
  transition: all var(--trans);
}
[data-theme="dark"] .p-blog-card { background: var(--bg2); }
.p-blog-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}
.p-blog-card:hover .p-blog-img { transform: scale(1.04); }
.p-blog-img-wrap { height: 200px; overflow: hidden; }
.p-blog-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.p-blog-body { padding: 24px; }
.p-blog-cat {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.p-blog-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 10px;
}
.p-blog-meta { font-size: 12px; color: var(--muted); margin-bottom: 12px; font-family: var(--mono); }
.p-blog-excerpt { font-size: 13px; color: var(--muted); line-height: 1.65; }

/* ── Project card ── */
.p-proj-card {
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  background: var(--bg);
  transition: all var(--trans);
  margin-bottom: 20px;
}
[data-theme="dark"] .p-proj-card { background: var(--bg2); }
.p-proj-card:hover {
  border-left-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateX(4px);
}
.p-proj-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.p-proj-title { font-size: 17px; font-weight: 600; color: var(--ink); }
.p-proj-stack {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent3);
  border: 1px solid rgba(184,92,44,0.2);
  padding: 4px 10px;
  border-radius: 3px;
  white-space: nowrap;
}
.p-proj-body { font-size: 14px; color: var(--muted); line-height: 1.75; }
.p-proj-body p { margin-bottom: 8px; }
.p-proj-body strong { color: var(--ink2); font-weight: 600; }
.p-proj-footer { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Featured project (big card) ── */
.p-feat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: 1fr 340px;
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 48px;
  transition: all var(--trans);
}
[data-theme="dark"] .p-feat-card { background: var(--bg2); }
.p-feat-card:hover { box-shadow: var(--shadow-lg); }
.p-feat-body { padding: 40px; border-right: 1px solid var(--border); }
.p-feat-sidebar {
  padding: 40px 32px;
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
[data-theme="dark"] .p-feat-sidebar { background: var(--bg3); }
.p-feat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.p-feat-value { font-size: 13px; color: var(--ink2); line-height: 1.5; }

/* ── Stats strip ── */
.p-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 48px 0;
}
.p-stat-item {
  padding: 28px 24px;
  text-align: center;
  border-right: 1px solid var(--border);
  transition: background var(--trans);
}
.p-stat-item:last-child { border-right: none; }
.p-stat-item:hover { background: var(--surface); }
.p-stat-num {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 300;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 6px;
}
.p-stat-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* ── Interests / tag strip ── */
.p-interests {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Social links ── */
.p-social-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--trans);
  color: var(--ink2);
  font-size: 14px;
}
.p-social-link:hover {
  border-color: var(--accent);
  background: var(--accent3);
  color: var(--accent);
  transform: translateX(4px);
}
.p-social-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--muted); flex-shrink: 0; }
.p-social-link:hover .p-social-icon { color: var(--accent); }

/* ── Teaching card ── */
.p-teach-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  background: var(--bg);
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 20px;
  align-items: flex-start;
  transition: all var(--trans);
}
[data-theme="dark"] .p-teach-card { background: var(--bg2); }
.p-teach-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.p-teach-icon {
  width: 48px; height: 48px;
  background: var(--accent3);
  border: 1px solid rgba(184,92,44,0.2);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--accent);
}
.p-teach-title { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.p-teach-sub   { font-size: 13px; color: var(--accent); margin-bottom: 8px; }
.p-teach-desc  { font-size: 13px; color: var(--muted); line-height: 1.65; }

/* ── Publication card ── */
.p-pub-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  background: var(--bg);
  margin-bottom: 20px;
  transition: all var(--trans);
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 28px;
  align-items: flex-start;
}
[data-theme="dark"] .p-pub-card { background: var(--bg2); }
.p-pub-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.p-pub-thumb {
  width: 140px;
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: white;
  flex-shrink: 0;
}
.p-pub-thumb img { width: 100%; height: 100%; object-fit: cover; }
.p-pub-title { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.5; margin-bottom: 8px; }
.p-pub-authors { font-size: 12px; color: var(--muted); font-family: var(--mono); margin-bottom: 10px; }
.p-pub-venue {
  display: inline-block;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--accent);
  background: var(--accent3);
  border: 1px solid rgba(184,92,44,0.2);
  padding: 3px 9px;
  border-radius: 3px;
  margin-bottom: 12px;
}
.p-pub-abstract { font-size: 13px; color: var(--muted); line-height: 1.7; }

/* ── Section heading with number ── */
.p-cat-heading {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  margin-top: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.p-cat-heading::before {
  content: '';
  display: block;
  width: 20px; height: 1px;
  background: var(--accent);
}

/* ── Mobile nav overlay ── */
.p-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.p-mobile-overlay.open { display: flex; }
.p-mobile-overlay a {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 300;
  color: var(--ink);
  transition: color var(--trans);
}
.p-mobile-overlay a:hover { color: var(--accent); }
.p-mobile-close {
  position: absolute;
  top: 20px; right: 28px;
  background: transparent;
  border: none;
  font-size: 28px;
  color: var(--muted);
  cursor: pointer;
}

/* ── Back to top ── */
.p-back-top {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s;
  z-index: 500;
  pointer-events: none;
}
.p-back-top.visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.p-back-top:hover {
  background: var(--accent);
  transform: translateY(-2px);
}
@media (max-width: 600px) {
  .p-back-top {
    width: 40px;
    height: 40px;
    bottom: 20px;
    right: 16px;
    font-size: 14px;
  }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .p-nav-links { display: none; }
  .p-hamburger { display: flex; }
  .p-feat-card { grid-template-columns: 1fr; }
  .p-feat-body { border-right: none; border-bottom: 1px solid var(--border); }
  .p-stats { grid-template-columns: repeat(2, 1fr); }
  .p-stats .p-stat-item:nth-child(2) { border-right: none; }
  .p-pub-card { grid-template-columns: 1fr; }
  .p-pub-thumb { width: 100%; max-width: 200px; }
  .p-timeline { flex-direction: column; padding: 0 0 0 32px; }
  .p-timeline::before { width: 1px; height: 100%; top: 0; left: 16px; }
  .p-timeline-item { padding: 0 0 32px 24px; }
  .p-timeline-item::before { top: 4px; left: -24px; transform: none; }
}

@media (max-width: 600px) {
  /* Prevent horizontal overflow */
  html, body { overflow-x: hidden; max-width: 100vw; }

  /* Container */
  .container { padding: 0 16px; }

  /* General */
  .p-stats { grid-template-columns: repeat(2, 1fr); }
  .p-section-title { font-size: 1.6rem; margin-bottom: 28px; }
  .p-card { padding: 18px; }
  .p-proj-card { padding: 16px 18px; }
  .p-page { padding-top: calc(var(--nav-h) + 32px); padding-bottom: 60px; }

  /* Eyebrow — prevent overflow */
  .p-eyebrow { font-size: 10px; letter-spacing: 1px; white-space: normal; word-break: break-word; }

  /* Nav */
  .p-logo { font-size: 11px; }
  .p-nav-right { gap: 4px; }
  .p-lang-btn { padding: 2px 5px; font-size: 10px; }
  .p-theme-toggle { width: 30px; height: 17px; }
  .p-theme-toggle-knob { width: 11px; height: 11px; }
  [data-theme="dark"] .p-theme-toggle-knob { transform: translateX(13px); }

  /* Hero */
  .hero-name { font-size: clamp(36px, 12vw, 56px); letter-spacing: -1px; line-height: 0.95; }
  .hero-tagline { font-size: 11px; white-space: normal; word-break: break-word; line-height: 1.6; }
  .hero-bio { font-size: 14px; margin-bottom: 24px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .p-btn { width: 100%; justify-content: center; }
  .profile-ring { width: 120px; height: 120px; }

  /* About */
  .about-photo { width: 110px; height: 110px; box-shadow: 3px 3px 0 var(--accent); }
  .about-name { font-size: 28px; }

  /* Stats */
  .p-stat-num { font-size: 30px; }
  .p-stat-item { padding: 16px 10px; }

  /* Featured proj */
  .p-feat-body { padding: 20px; }
  .p-feat-sidebar { padding: 18px; gap: 14px; }

  /* Pub card */
  .p-pub-card { padding: 18px; gap: 14px; }
  .p-pub-thumb { max-width: 100%; }
  .p-pub-title { font-size: 14px; }
  .p-pub-abstract { font-size: 12px; }

  /* Proj cards */
  .p-proj-header { flex-direction: column; gap: 8px; }
  .p-proj-title { font-size: 15px; }
  .p-proj-stack { font-size: 10px; white-space: normal; word-break: break-word; }

  /* CV */
  .cv-layout { grid-template-columns: 1fr; }
  .cv-aside { position: static; }
  .p-cv-entry { flex-direction: column; gap: 4px; }
  .p-cv-date { text-align: left; }

  /* Contact */
  .contact-layout { grid-template-columns: 1fr; }

  /* Blog */
  .p-blog-title { font-size: 17px; }
  .p-blog-img-wrap { height: 160px; }

  /* Timeline */
  .p-timeline { padding: 0 0 0 24px; }
  .p-timeline-item { padding: 0 0 24px 20px; }

  /* Mobile overlay */
  .p-mobile-overlay a { font-size: 26px; }

  /* Cat heading */
  .p-cat-heading { font-size: 10px; }

  /* Pub chart */
  .p-pub-chart { height: 180px; }
  .p-pub-bar { width: 18px; }

  /* Teaching cards */
  .p-teach-card { grid-template-columns: 1fr; gap: 12px; }

  /* Grids */
  .p-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .container { padding: 0 12px; }
  .hero-name { font-size: clamp(32px, 13vw, 48px); }
  .p-logo { font-size: 10px; }
  .p-stat-num { font-size: 26px; }
  .p-lang-btn { padding: 2px 4px; font-size: 9px; }
}

/* ── Terminal Hero Animation ── */
.hero-anim-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  padding: 28px 24px;
  background: #edeae4;
}
[data-theme="dark"] .hero-anim-panel {
  background: #111110;
}
.terminal-win {
  width: 100%;
  background: #f0ede8;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
[data-theme="dark"] .terminal-win {
  background: #1a1917;
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(0,0,0,0.04);
  border-bottom: 1px solid rgba(0,0,0,0.07);
}
[data-theme="dark"] .terminal-bar {
  background: rgba(255,255,255,0.04);
  border-bottom-color: rgba(255,255,255,0.06);
}
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-title {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-left: 6px;
}
.terminal-body {
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.85;
  min-height: 180px;
}
.t-line { display: block; white-space: pre; }
.t-cmd  { color: #0f0f0f; }
.t-ok   { color: #2d7a3a; }
.t-info { color: #7a7570; }
.t-val  { color: #b85c2c; }
.t-cursor {
  display: inline-block;
  width: 8px; height: 13px;
  background: #b85c2c;
  vertical-align: middle;
  margin-left: 2px;
  animation: t-blink 1s steps(1) infinite;
}
[data-theme="dark"] .t-cmd  { color: #e8e4df; }
[data-theme="dark"] .t-ok   { color: #4ade80; }
[data-theme="dark"] .t-info { color: #888; }
[data-theme="dark"] .t-val  { color: #d4733a; }
[data-theme="dark"] .t-cursor { background: #d4733a; }
@keyframes t-blink { 0%,100%{opacity:1} 50%{opacity:0} }

@media (max-width: 900px) {
  .hero-anim-panel { padding: 24px 20px; }
  .terminal-body { font-size: 11px; padding: 14px 16px; }
}
@media (max-width: 600px) {
  .terminal-body { font-size: 10px; min-height: 120px; }
}
