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

:root {
  --bg:        #0d0f14;
  --bg-2:      #12151c;
  --bg-3:      #181c26;
  --border:    rgba(255,255,255,.07);
  --text:      #e2e4ea;
  --text-2:    #8b919e;
  --accent:    #6366f1;
  --accent-2:  #818cf8;
  --accent-glow: rgba(99,102,241,.25);
  --green:     #34d399;
  --font:      'Inter', system-ui, sans-serif;
  --mono:      'JetBrains Mono', 'Fira Code', monospace;
  --radius:    10px;
  --radius-lg: 16px;
  --nav-h:     64px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

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

/* ─── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }

/* ─── NAV ──────────────────────────────────────────────────────── */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  background: rgba(13,15,20,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .3s;
}
#nav.scrolled { box-shadow: 0 4px 24px rgba(0,0,0,.4); }

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -.02em;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-2);
  transition: color .2s;
}
.nav-links a:hover { color: var(--text); }

.nav-cta {
  background: var(--accent) !important;
  color: #fff !important;
  padding: .4rem .9rem;
  border-radius: 6px;
  font-size: .85rem !important;
  transition: opacity .2s !important;
}
.nav-cta:hover { opacity: .85; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}

/* ─── Section base ─────────────────────────────────────────────── */
section {
  padding: 100px 0;
}
section:nth-child(even) { background: var(--bg-2); }

.section-title {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: 3rem;
  position: relative;
  display: inline-block;
}
.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px; left: 0;
  width: 36px; height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

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

/* ─── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.4rem;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--accent-glow);
}
.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text-2);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Tags ─────────────────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.tags.small .tag { font-size: .75rem; padding: .2rem .55rem; }
.tag {
  background: rgba(99,102,241,.12);
  color: var(--accent-2);
  border: 1px solid rgba(99,102,241,.2);
  padding: .3rem .7rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  font-family: var(--mono);
}

/* ─── Social links ─────────────────────────────────────────────── */
.social-link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-2);
  font-size: .9rem;
  font-weight: 500;
  transition: color .2s;
}
.social-link svg { width: 18px; height: 18px; }
.social-link:hover { color: var(--accent-2); }

/* ─── HERO ─────────────────────────────────────────────────────── */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: calc(var(--nav-h) + 60px) 0 80px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 70% 40%, rgba(99,102,241,.12) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 20% 80%, rgba(99,102,241,.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 700px; }

.hero-greeting {
  font-family: var(--mono);
  color: var(--accent-2);
  font-size: .95rem;
  margin-bottom: .75rem;
  letter-spacing: .06em;
}

#hero h1 {
  font-size: clamp(2.8rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1.05;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-2);
  margin-bottom: 1.5rem;
  font-weight: 400;
}
.divider { margin: 0 .5rem; opacity: .4; }

.hero-desc {
  color: var(--text-2);
  font-size: 1.05rem;
  max-width: 580px;
  margin-bottom: 2rem;
  line-height: 1.8;
}

.hero-actions { display: flex; gap: 1rem; margin-bottom: 2.5rem; flex-wrap: wrap; }
.hero-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }

.scroll-hint {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  color: var(--text-2);
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .5;
  animation: fadeIn 2s 1s both;
}
.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--text-2), transparent);
  animation: scrollPulse 1.8s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: .3; transform: scaleY(1); }
  50% { opacity: .8; transform: scaleY(1.1); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: .5; } }

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

.about-text p {
  color: var(--text-2);
  margin-bottom: 1.2rem;
  font-size: 1.05rem;
  line-height: 1.85;
}
.about-text p strong { color: var(--text); }

.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-2);
  font-family: var(--mono);
  letter-spacing: -.03em;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-2);
  line-height: 1.3;
}

/* ─── SKILLS ───────────────────────────────────────────────────── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.skill-group {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.skill-group h3 {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-2);
  margin-bottom: 1rem;
  font-weight: 600;
}

/* ─── PROJECTS ─────────────────────────────────────────────────── */
.project-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  transition: border-color .3s;
}
.project-card:hover { border-color: rgba(99,102,241,.35); }

.project-card.featured {
  border-color: rgba(99,102,241,.25);
  box-shadow: 0 0 40px rgba(99,102,241,.06);
}

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

.project-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent-2);
  background: rgba(99,102,241,.12);
  border: 1px solid rgba(99,102,241,.2);
  padding: .2rem .6rem;
  border-radius: 4px;
  margin-bottom: .5rem;
}

.project-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: .2rem;
}
.project-tagline {
  color: var(--text-2);
  font-style: italic;
  font-size: .95rem;
}

.project-links { display: flex; gap: .75rem; }
.icon-link {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2);
  transition: all .2s;
}
.icon-link svg { width: 18px; height: 18px; }
.icon-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.project-desc {
  color: var(--text-2);
  margin-bottom: 1.5rem;
  font-size: 1rem;
  line-height: 1.8;
}

/* ─── Tabs ─────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.75rem;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: .6rem 1.1rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all .2s;
  margin-bottom: -1px;
  font-family: var(--font);
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent-2);
  border-bottom-color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Features */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.feature-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color .2s;
  position: relative;
  min-height: 130px;
}
.feature-item:hover { border-color: rgba(99,102,241,.3); }
.feature-icon { font-size: 1.5rem; margin-bottom: .6rem; }
.feature-item h4 {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: .5rem;
  letter-spacing: -.01em;
}
.feature-item p {
  font-size: .875rem;
  color: var(--text-2);
  line-height: 1.65;
}

/* Architecture */
.arch-section {
  margin-bottom: 2rem;
}
.arch-section h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .75rem;
  color: var(--accent-2);
}
.arch-section p {
  color: var(--text-2);
  font-size: .95rem;
  line-height: 1.75;
}
.arch-section code {
  font-family: var(--mono);
  background: rgba(99,102,241,.12);
  color: var(--accent-2);
  padding: .1em .35em;
  border-radius: 4px;
  font-size: .875em;
}

.arch-diagram {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1rem 0 2rem;
  overflow-x: auto;
}

.arch-row {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.arch-row.center { justify-content: center; }

.arch-box {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .6rem 1rem;
  text-align: center;
  font-size: .8rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 110px;
}
.arch-box small { font-size: .7rem; color: var(--text-2); }
.arch-box.actor { border-color: rgba(52,211,153,.25); color: var(--green); }
.arch-box.system {
  border-color: rgba(99,102,241,.4);
  background: rgba(99,102,241,.08);
  color: var(--accent-2);
  min-width: 200px;
  padding: 1rem;
}
.arch-box.system strong { font-size: 1rem; }
.arch-box.infra { border-color: rgba(255,255,255,.1); color: var(--text-2); }

.arch-arrow-down {
  width: 2px;
  height: 28px;
  background: var(--border);
  margin: .5rem auto;
  position: relative;
}
.arch-arrow-down::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--border);
}

.module-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.module-tag {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .3rem .7rem;
  font-size: .8rem;
  font-family: var(--mono);
  color: var(--text-2);
}

.decisions { display: flex; flex-direction: column; gap: .75rem; }
.decision {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  padding: .75rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  align-items: start;
}
.decision-label {
  font-family: var(--mono);
  color: var(--accent-2);
  font-weight: 500;
}
.decision-desc { color: var(--text-2); line-height: 1.6; }

/* Stack */
.stack-cols {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2rem;
}
.stack-col h4 {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-2);
  margin-bottom: .75rem;
  font-weight: 600;
}
.stack-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.stack-tech {
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--text);
  padding: .25rem .5rem;
  background: var(--bg-2);
  border-radius: 5px;
  display: block;
  border: 1px solid var(--border);
}

/* ─── EXPERIENCE ───────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
}
.timeline-item:last-child { margin-bottom: 0; }

.timeline-marker {
  position: absolute;
  left: -25px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px var(--accent-glow);
}

.timeline-body {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color .2s;
}
.timeline-body:hover { border-color: rgba(99,102,241,.3); }

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.timeline-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: .2rem;
}
.company {
  font-size: .85rem;
  color: var(--accent-2);
  font-weight: 500;
}
.period {
  font-size: .8rem;
  color: var(--text-2);
  font-family: var(--mono);
  white-space: nowrap;
  flex-shrink: 0;
}
.timeline-body > p {
  color: var(--text-2);
  font-size: .9rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

/* ─── CONTACT ──────────────────────────────────────────────────── */
#contact { background: var(--bg); }
.contact-inner { text-align: center; }
.contact-sub {
  color: var(--text-2);
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.8;
}
.contact-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.contact-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.5rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  color: var(--text-2);
  transition: all .2s;
}
.contact-card svg { width: 20px; height: 20px; flex-shrink: 0; }
.contact-card:hover {
  border-color: var(--accent);
  color: var(--accent-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

/* ─── Project "more details" link ─────────────────────────────── */
.project-more-link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--accent-2);
  font-size: .9rem;
  font-weight: 500;
  transition: gap .2s, color .2s;
}
.project-more-link svg { width: 16px; height: 16px; }
.project-more-link:hover { color: var(--text); gap: .75rem; }

/* ─── About stats 3-col variant ───────────────────────────────── */
.about-stats-3 {
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* ─── Experience "more" line ───────────────────────────────────── */
.experience-more {
  margin-top: 2rem;
  font-size: .9rem;
  color: var(--text-2);
}
.experience-more a { color: var(--accent-2); transition: color .2s; }
.experience-more a:hover { color: var(--text); }

/* ─── Tabs wrapper (standalone, not inside .project-card) ─────── */
.tabs-wrapper {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 2rem 2rem;
}
.tabs-wrapper > .tabs {
  margin-bottom: 2rem;
}
.tabs-wrapper > .tab-panel.active {
  display: block;
}

/* ─── BOCRM page ───────────────────────────────────────────────── */
.bocrm-overview {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 4rem;
  align-items: start;
}
.bocrm-overview-text p {
  color: var(--text-2);
  margin-bottom: 1.2rem;
  font-size: 1.05rem;
  line-height: 1.85;
}
.bocrm-overview-tags {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ─── Screenshot placeholder ───────────────────────────────────── */
.screenshot-placeholder {
  border: 2px dashed rgba(99,102,241,.3);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  background: rgba(99,102,241,.03);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.screenshot-label {
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: .1em;
  background: rgba(99,102,241,.12);
  border: 1px solid rgba(99,102,241,.2);
  padding: .3rem .75rem;
  border-radius: 4px;
}
.screenshot-placeholder p {
  color: var(--text-2);
  font-size: .9rem;
  max-width: 480px;
  line-height: 1.7;
}

/* ─── MERMAID DIAGRAMS ─────────────────────────────────────────── */
.mermaid-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  margin: 1rem 0 2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mermaid-wrap .mermaid {
  display: flex;
  justify-content: center;
}

/* Let diagrams render at natural size — scroll instead of shrinking */
.mermaid-wrap .mermaid svg {
  background: transparent !important;
  height: auto;
}

/* ── ER diagram dark-theme fixes ──────────────────────────────── */
/* Attribute row backgrounds — force dark alternating rows */
.mermaid-wrap svg .er.attributeBoxEven { fill: #1e2330 !important; }
.mermaid-wrap svg .er.attributeBoxOdd  { fill: #282f3e !important; }

/* All text inside ER entities */
.mermaid-wrap svg .er.entityLabel   { fill: #e2e4ea !important; }
.mermaid-wrap svg .er.attributeType { fill: #818cf8 !important; }

/* Prevent text clipping inside attribute rows */
.mermaid-wrap svg g.er > g { overflow: visible; }
.mermaid-wrap svg .er.entityBox + .er.attributeBoxEven,
.mermaid-wrap svg .er.entityBox + .er.attributeBoxOdd { rx: 0; }
.mermaid-wrap svg .er text { overflow: visible; text-overflow: clip; }

/* Relationship lines and labels */
.mermaid-wrap svg .er.relationshipLine { stroke: #a5b4fc !important; }
.mermaid-wrap svg .er.relationshipLabel { fill: #a5b4fc !important; }

/* ── Flowchart / C4 tweaks ────────────────────────────────────── */
.mermaid-wrap .cluster span,
.mermaid-wrap .cluster p {
  color: #a5b4fc !important;
  font-weight: 600;
}

/* Debug overrides removed — rendering issues fixed by switching to
   SVG labels in Mermaid (`htmlLabels: false`) and using the page
   font family. */

/* Edge / arrow labels */
.mermaid-wrap svg .edgeLabel span,
.mermaid-wrap svg .edgeLabel p {
  background: #1e2330 !important;
  color: #a5b4fc !important;
  padding: 2px 6px;
  border-radius: 3px;
}

/* C4 relationship label text */
.mermaid-wrap svg .messageLine0,
.mermaid-wrap svg .messageLine1 {
  stroke: #a5b4fc !important;
}
.mermaid-wrap svg .messageText {
  fill: #a5b4fc !important;
}

/* ─── FOOTER ───────────────────────────────────────────────────── */
footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
footer p {
  color: var(--text-2);
  font-size: .8rem;
}

/* ─── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  section { padding: 72px 0; }

  .nav-links { display: none; }
  .hamburger { display: flex; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: rgba(13,15,20,.97);
    padding: 1.5rem 24px;
    border-bottom: 1px solid var(--border);
    gap: 1.25rem;
    align-items: flex-start;
  }

  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
  .about-stats { grid-template-columns: 1fr 1fr; }

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

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

  .footer-inner { flex-direction: column; text-align: center; }

  .project-header { flex-direction: column; }

  .hero-actions { flex-direction: column; align-items: flex-start; }

  .contact-card { width: 100%; justify-content: center; }
  .contact-links { flex-direction: column; align-items: center; }

  .bocrm-overview { grid-template-columns: 1fr; gap: 2rem; }
  .bocrm-overview-tags { flex-direction: row; flex-wrap: wrap; }
  .bocrm-overview-tags .stat-card { flex: 1; min-width: 120px; }
}

@media (max-width: 480px) {
  #hero h1 { font-size: 2.4rem; }
  .about-stats { grid-template-columns: 1fr 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .stack-cols { grid-template-columns: 1fr 1fr; }
}

/* ─── Diagram modal & expand control ───────────────────────────────── */
.mermaid-wrap { position: relative; }

.diagram-expand-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: .85rem;
  cursor: pointer;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(4px);
}
.diagram-expand-btn:hover { opacity: .95; transform: translateY(-1px); }

.diagram-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.diagram-modal.open { display: flex; }
.diagram-modal__overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.65); }
.diagram-modal__content {
  position: relative;
  width: calc(100% - 48px);
  max-width: 1600px;
  max-height: calc(100vh - 48px);
  height: auto;
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
}
.diagram-modal__inner {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}
.diagram-modal__inner svg {
  max-width: calc(100% - 36px);
  max-height: calc(100vh - 160px);
  width: auto;
  height: auto;
  display: block;
}
.diagram-modal__close { position: absolute; top: 10px; right: 10px; background: transparent; border: none; color: var(--text-2); font-size: 20px; padding: 6px 8px; cursor:pointer; }
.diagram-modal__info { position: absolute; left: 16px; top: 12px; color: var(--text-2); font-size: .9rem; }

@media (max-width: 768px) {
  .diagram-modal__content { width: calc(100% - 24px); max-height: calc(100vh - 24px); padding: 12px; border-radius: 8px; }
  .diagram-expand-btn { top: 8px; right: 8px; padding: 5px 7px; }
  .diagram-modal__inner svg { max-height: calc(100vh - 120px); }
}

/* Slideshow */
.slideshow-container { position: relative; max-width: 100%; margin: 0 auto; background: var(--bg-2); border-radius: 12px; overflow: hidden; cursor: pointer; }
.slideshow-wrapper { position: relative; width: 100%; padding-bottom: 66.67%; background: var(--bg-3); display: flex; align-items: center; justify-content: center; }
.slideshow-img, .slideshow-img-ai, .slideshow-img-fields { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.5s ease-in-out; }
.slideshow-img.active, .slideshow-img-ai.active, .slideshow-img-fields.active { opacity: 1; }
.slideshow-prev, .slideshow-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0, 0, 0, 0.5); color: white; border: none; font-size: 24px; padding: 12px 16px; cursor: pointer; border-radius: 4px; transition: background 0.3s; z-index: 10; }
.slideshow-prev:hover, .slideshow-next:hover { background: rgba(0, 0, 0, 0.8); }
.slideshow-prev { left: 16px; }
.slideshow-next { right: 16px; }
.slideshow-dots { position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 10; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, 0.6); cursor: pointer; transition: background 0.3s; }
.dot.active { background: white; }
.slideshow-label { position: absolute; bottom: 16px; left: 16px; color: var(--text-2); font-size: 0.9rem; font-weight: 500; }

/* Slideshow Popup */
.slideshow-popup { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; }
.slideshow-popup.open { display: flex; }
.slideshow-popup-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(4px); }
.slideshow-popup-content { position: relative; width: 95vw; height: 95vh; max-width: 1600px; max-height: 1000px; margin: auto; display: flex; align-items: center; justify-content: center; z-index: 10; overflow: hidden; }
.slideshow-popup-close { position: absolute; top: 16px; right: 16px; background: rgba(255, 255, 255, 0.2); border: none; color: white; font-size: 28px; padding: 8px 12px; cursor: pointer; border-radius: 4px; transition: background 0.3s; z-index: 20; }
.slideshow-popup-close:hover { background: rgba(255, 255, 255, 0.4); }
.slideshow-popup-wrapper { position: relative; width: 100%; height: 100%; overflow: hidden; }
.slideshow-popup-img, .slideshow-popup-img-ai, .slideshow-popup-img-fields { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.5s ease-in-out; }
.slideshow-popup-img.active, .slideshow-popup-img-ai.active, .slideshow-popup-img-fields.active { opacity: 1; }
.slideshow-popup-prev, .slideshow-popup-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.2); color: white; border: none; font-size: 32px; padding: 16px 20px; cursor: pointer; border-radius: 4px; transition: background 0.3s; z-index: 15; }
.slideshow-popup-prev:hover, .slideshow-popup-next:hover { background: rgba(255, 255, 255, 0.4); }
.slideshow-popup-prev { left: 16px; }
.slideshow-popup-next { right: 16px; }
.slideshow-popup-dots { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 15; }
.popup-dot { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, 0.6); cursor: pointer; transition: background 0.3s; }
.popup-dot.active { background: white; }

/* Feature Modal */
@keyframes feature-modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.feature-modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; align-items: center; justify-content: center; }
.feature-modal.open { display: flex; }
.feature-modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(6px); }
.feature-modal-content {
  position: relative; width: 90vw; max-width: 860px; max-height: 88vh;
  background: var(--bg-2); border: 1px solid rgba(99,102,241,.25);
  border-radius: 20px; overflow-y: auto; z-index: 10;
  box-shadow: 0 32px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(99,102,241,.1);
  animation: feature-modal-in 0.22s ease-out both;
  scrollbar-width: thin; scrollbar-color: var(--bg-3) transparent;
}
.feature-modal-content::-webkit-scrollbar { width: 6px; }
.feature-modal-content::-webkit-scrollbar-track { background: transparent; }
.feature-modal-content::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
/* Accent bar at top */
.feature-modal-content::before {
  content: ''; display: block; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), transparent);
  border-radius: 20px 20px 0 0;
}
.feature-modal-close {
  position: absolute; top: 14px; right: 14px;
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text-2); font-size: 18px; line-height: 1;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; border-radius: 8px; transition: background 0.2s, color 0.2s, border-color 0.2s; z-index: 20;
}
.feature-modal-close:hover { background: rgba(99,102,241,.2); border-color: var(--accent); color: var(--text); }
.feature-modal-header {
  padding: 36px 40px 28px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.feature-modal-icon {
  font-size: 40px; display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(99,102,241,.18), rgba(129,140,248,.08));
  border: 1px solid rgba(99,102,241,.25);
  margin-bottom: 16px; box-shadow: 0 4px 20px rgba(99,102,241,.15);
}
.feature-modal-header h2 { margin-bottom: 8px; font-size: 1.75rem; letter-spacing: -0.02em; }
.feature-modal-subtitle { color: var(--text-2); font-size: 0.9rem; letter-spacing: 0.01em; }
.feature-modal-body { padding: 32px 40px 40px; }
.feature-modal-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.feature-modal-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.feature-modal-section h3 {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-2); margin-bottom: 14px;
}
.feature-modal-section p { color: var(--text-2); line-height: 1.8; margin-bottom: 10px; }
.feature-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.feature-list li {
  padding: 9px 12px 9px 36px; color: var(--text-2); line-height: 1.65;
  position: relative; border-radius: 7px; transition: background 0.15s;
}
.feature-list li:hover { background: rgba(99,102,241,.06); }
.feature-list li::before {
  content: '✓'; position: absolute; left: 10px; top: 10px;
  color: var(--accent); font-size: 0.8rem; font-weight: 700;
}
.feature-list li strong { color: var(--text); }
.adapter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; }
.adapter-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.adapter-card:hover { border-color: rgba(99,102,241,.35); box-shadow: 0 4px 16px rgba(99,102,241,.1); }
.adapter-name { font-weight: 600; font-size: 0.9rem; color: var(--text); margin-bottom: 6px; }
.adapter-card p { font-size: 0.875rem; color: var(--text-2); line-height: 1.6; margin: 0; }
.feature-modal-screenshot-placeholder { margin-top: 24px; }
.feature-modal-trigger { cursor: pointer; transition: all 0.2s; position: relative; }
.feature-modal-trigger::after { content: '→'; position: absolute; bottom: 12px; right: 12px; opacity: 0; transition: opacity 0.2s, transform 0.2s; transform: translateX(-4px); font-size: 1.2rem; color: var(--accent-2); }
.feature-modal-trigger:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(99,102,241,.15); }
.feature-modal-trigger:hover::after { opacity: 1; transform: translateX(0); }

@media (max-width: 768px) {
  .slideshow-prev, .slideshow-next { padding: 8px 12px; font-size: 18px; }
  .slideshow-label { font-size: 0.85rem; }
  .slideshow-popup-content { width: 100vw; height: 100vh; max-width: none; max-height: none; }
  .slideshow-popup-prev, .slideshow-popup-next { padding: 12px 16px; font-size: 24px; }
  .feature-modal-content { width: 100vw; max-width: 100vw; max-height: 95vh; border-radius: 16px 16px 0 0; margin-top: auto; }
  .feature-modal { align-items: flex-end; }
  .feature-modal-header { padding: 28px 20px 20px; }
  .feature-modal-icon { width: 56px; height: 56px; font-size: 32px; border-radius: 14px; }
  .feature-modal-header h2 { font-size: 1.4rem; }
  .feature-modal-body { padding: 20px 20px 32px; }
  .adapter-grid { grid-template-columns: 1fr; }
  .feature-modal-section { padding-bottom: 24px; margin-bottom: 24px; }
  .feature-modal-section h3 { font-size: 0.7rem; }
}
