/* ── 1. Design tokens ──────────────────────────────────────────────────── */
:root {
  --bg-primary:     #0f0f0f;
  --bg-secondary:   #1a1a1a;
  --bg-tertiary:    #2a2a2a;
  --bg-card:        #161616;
  --text-primary:   #e0e0e0;
  --text-secondary: #b0b0b0;
  --text-muted:     #808080;
  --accent:         #10b981;
  --accent-dim:     rgba(16, 185, 129, 0.1);
  --accent-border:  rgba(16, 185, 129, 0.3);
  --border:         rgba(255, 255, 255, 0.06);
  --border-strong:  rgba(255, 255, 255, 0.1);
  --font-sans:      'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:      'JetBrains Mono', 'Fira Code', monospace;
  --r:              8px;

  --mermaid-primary: #2a2a2a;
  --mermaid-text: #e0e0e0;
  --mermaid-accent: #10b981;
}

/* ── 2. Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--accent-dim); color: var(--accent); }

/* ── 3. Top navigation ─────────────────────────────────────────────────── */
#top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--bg-primary);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}
.nav-logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 2rem;
}
.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
  position: relative;
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width 0.3s;
}
.nav-links a:hover::after { width: 100%; }

.btn-theme {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  width: 36px; height: 36px;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.btn-theme:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

.nav-cta {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  padding: 0.5rem 1.25rem;
  border-radius: var(--r);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-cta:hover {
  background: var(--accent);
  color: var(--bg-primary);
}

/* ── 4. Sections ───────────────────────────────────────────────────────── */
section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 6rem 2rem;
}

.section-header { margin-bottom: 3rem; }

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-label::before {
  content: '';
  display: inline-block;
  width: 24px; height: 1px;
  background: var(--accent);
}

.section-title {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.section-desc {
  color: var(--text-secondary);
  margin-top: 0.75rem;
  /*max-width: 600px;*/
  line-height: 1.7;
}

/* ── 5. Hero ───────────────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 5rem;
  max-width: 1100px;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 4rem;
  align-items: center;
}

.hero-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.hero-label::before {
  content: '';
  display: inline-block;
  width: 24px; height: 1px;
  background: var(--accent);
}

.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}
.hero h1 em {
  color: var(--text-secondary);
  font-style: normal;
}

.hero-subtitle {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 2.5rem;
}

.hero-cta-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  padding: 0.875rem 1.75rem;
  border-radius: var(--r);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(34, 211, 238, 0.25);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  padding: 0.875rem 1.75rem;
  border-radius: var(--r);
  font-weight: 600;
  font-size: 0.9375rem;
  border: 1px solid var(--border-strong);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-secondary:hover {
  border-color: var(--text-secondary);
  background: var(--bg-tertiary);
}

/* Hero visual — pulsing ring treatment */
.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-photo {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-strong);
  position: relative;
  z-index: 2;
  filter: grayscale(20%) contrast(1.1);
  transition: filter 0.5s;
}
.hero-photo:hover {
  filter: grayscale(0%) contrast(1);
}

.photo-ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 320px; height: 320px;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  animation: pulse-ring 4s ease-in-out infinite;
}
.photo-ring-2 {
  width: 370px; height: 370px;
  border-color: rgba(34, 211, 238, 0.08);
  animation-delay: 1s;
}

@keyframes pulse-ring {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
  50%       { transform: translate(-50%, -50%) scale(1.04); opacity: 1; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── 6. Philosophy ─────────────────────────────────────────────────────── */
.philosophy-text {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-secondary);
  position: relative;
  z-index: 1;
  margin-bottom: 1.25rem;
}
.philosophy-text:last-child { margin-bottom: 0; }
.philosophy-text strong { color: var(--text-primary); }
.philosophy-text em { color: var(--accent); font-style: normal; }

/* ── Skill mentions — inline contextual skill highlighting ─────────────── */
.skill-mention {
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  white-space: nowrap;
}

/* ── 7. Case Studies ───────────────────────────────────────────────────── */
.case-studies-gallery {
  position: relative;
}

.gallery-container {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.case-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.gallery-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

/* case-studies-list: desktop stacked layout (original design) */
.case-studies-list {
  display: grid;
  gap: 1.5rem;
}

/* Desktop: show gallery, hide list */
.case-studies-list { display: none; }

/* Mobile: hide gallery, show list */
@media (max-width: 768px) {
  .case-studies-gallery { display: none; }
  .case-studies-list { display: grid; }
}

/* case-studies: one card at a time */
.case-studies-gallery .gallery-item {
  flex: 0 0 calc(100% - 1.5rem);
  min-width: 0;
  margin-right: 1.5rem;
}

/* blog: 3 cards visible on desktop, slide by one */
.blog-gallery .gallery-item {
  flex: 0 0 calc(33.333% - 1rem);
  min-width: 0;
  margin-right: auto;
}

/* blog: 1 card at a time on mobile */
@media (max-width: 768px) {
  .blog-gallery .gallery-item {
    flex: 0 0 calc(100% - 1.5rem);
    margin: 0 0 auto 1.0rem;
  }
}

.case-studies-gallery,
.blog-gallery {
  position: relative;
  padding: 0 3.5rem;
}

.gallery-hint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  animation: pulse-hint 1.6s ease-in-out infinite;
  user-select: none;
}

.gallery-hint.gallery-prev { left: 0.25rem; }
.gallery-hint.gallery-next { right: 0.25rem; }

.gallery-hint.visible {
  opacity: 1;
  pointer-events: auto;
}

@keyframes pulse-hint {
  0%, 100% { opacity: 0.5; transform: translateY(-50%) scale(1); }
  50% { opacity: 1; transform: translateY(-50%) scale(1.2); }
}
.case-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.3s;
}

.case-card:hover::before { opacity: 0; }

.case-header {
  margin-bottom: 1.5rem;
}

.case-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.case-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.case-subtitle {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 0.75rem;
}

.case-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.case-company {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
}

.case-period {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.case-impact-statements {
  list-style: none;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 1rem;
}

.case-impact-statements li {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-secondary);
  padding-left: 1.5rem;
  position: relative;
}

.case-impact-statements li::before {
  content: '✔';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.75rem;
  top: 0.2em;
}

.case-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.tech-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 0.375rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.case-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.case-section {
  margin-bottom: 0;
}

.case-section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.case-section p {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 0.9375rem;
  margin-bottom: 0.75rem;
}
.case-section p:last-child { margin-bottom: 0; }

/* ── Mermaid diagrams ──────────────────────────────────────────────────── */
.case-diagram {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  position: relative;
}

.diagram-expand-hint {
  display: none;
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.5);
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  pointer-events: none;
}

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

/* Override Mermaid SVG colors to match theme */
.case-diagram svg {
  max-width: 100%;
  height: auto;
}

.arch-diagram {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  overflow-x: auto;
}
.arch-diagram pre { margin: 0; line-height: 1.6; }

@media (min-width: 769px) {
  .case-diagram {
    cursor: pointer;
    transition: all 0.2s;
  }

  .case-diagram:hover {
    border-color: var(--accent-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }

  .case-diagram:hover .diagram-expand-hint {
    display: block;
  }
}

.diagram-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.diagram-modal.active {
  display: flex;
}

.diagram-modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 90vw;
  max-height: 90vh;
  width: 100%;
  overflow-y: auto;
  position: relative;
}

.diagram-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.diagram-modal-close:hover {
  color: var(--accent);
}

.diagram-modal-body {
  margin-top: 1.5rem;
}

.diagram-modal-body .mermaid {
  display: flex;
  justify-content: center;
}

/* ── 8. Writing ────────────────────────────────────────────────────────── */
.writing-scroll-wrapper {
  position: relative;
}

.writing-grid {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.writing-grid::-webkit-scrollbar { height: 4px; }
.writing-grid::-webkit-scrollbar-track { background: transparent; }
.writing-grid::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.writing-scroll-hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  margin-top: 0.75rem;
  opacity: 0.7;
}

.article-image {
  margin: -2rem -2rem 1.5rem;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.article-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.article-card:hover .article-image img {
  transform: scale(1.04);
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  transition: all 0.3s;
  display: block;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.article-card:hover {
  border-color: var(--accent-border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.article-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.article-title {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.article-excerpt {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.article-read {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── 9. Career Timeline ────────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 2rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 1px;
  background: var(--border-strong);
}

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

.timeline-dot {
  position: absolute;
  left: -2.45rem;
  top: 0.25rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
  border: 2px solid var(--bg-primary);
  transition: background 0.2s;
}
.timeline-item.active .timeline-dot { background: var(--accent); }

.timeline-content { padding-left: 0.5rem; }

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.timeline-role {
  font-weight: 600;
  font-size: 1rem;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.timeline-company {
  font-size: 0.9375rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.timeline-note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.timeline-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
  max-width: 780px;
}

/* ── Timeline chapter marker ───────────────────────────────────────────── */
.timeline-chapter-marker {
  position: relative;
  padding-bottom: 2rem;
  padding-left: 0.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.timeline-marker-dot {
  position: absolute;
  left: -2.45rem;
  top: 0.3rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.timeline-marker-content {
  padding-left: 0.5rem;
}

.timeline-marker-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.timeline-marker-date {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.timeline-marker-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
}


/* ── 10. Background ────────────────────────────────────────────────────── */
.background-narrative {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}
.background-narrative:last-child { margin-bottom: 0; }


/* ── 11. Contact ───────────────────────────────────────────────────────── */
.contact-section {
  text-align: center;
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 4rem 3rem;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.contact-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-border), transparent);
}

.contact-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.contact-desc {
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.contact-links {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.contact-email {
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  color: var(--accent);
  transition: opacity 0.2s;
}
.contact-email:hover { opacity: 0.75; }

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

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}
.social-link:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-dim);
}

.social-link-cta {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}
.social-link-cta:hover {
  background: var(--accent);
  color: var(--bg-primary);
}

/* ── 12. Footer ────────────────────────────────────────────────────────── */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  max-width: 1100px;
  margin: 0 auto;
}

.footer-name {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  color: var(--text-muted);
  font-size: 1rem;
  transition: all 0.2s;
}
.footer-top-link:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-dim);
}

@media (max-width: 640px) {
  footer {
    padding: 1.25rem;
    justify-content: center;
  }
  .footer-top-link { display: none; }
}

/* ── 13. Scroll animations ─────────────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── 14. Light theme overrides ─────────────────────────────────────────── */
body.light {
  --bg-primary:     #fafafa;
  --bg-secondary:   #f5f5f5;
  --bg-tertiary:    #efefef;
  --bg-card:        #ffffff;
  --text-primary:   #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted:     #808080;
  --accent:         #059669;
  --accent-dim:     rgba(5, 150, 105, 0.1);
  --accent-border:  rgba(5, 150, 105, 0.3);
  --border:         rgba(0, 0, 0, 0.08);
  --border-strong:  rgba(0, 0, 0, 0.15);

  --mermaid-primary: #efefef;
  --mermaid-text: #1a1a1a;
  --mermaid-accent: #059669;
}
body.light #top-nav {
  background: var(--bg-primary);
}

/* ── 15. Responsive ────────────────────────────────────────────────────── */
/* ── Wide screens ──────────────────────────────────────────────────────── */
@media (min-width: 1400px) {
  .nav-container,
  section { max-width: 1280px; }
  .hero { max-width: 1280px; }
}

/* ── Tablet ─────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero-grid { gap: 2.5rem; }
  .case-body { grid-template-columns: 1fr; }
  .article-card { flex: 0 0 280px; }
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-visual {
    order: -1;
    justify-content: center;
  }
  .hero-photo { width: 180px; height: 180px; }
  .photo-ring { width: 220px; height: 220px; }
  .photo-ring-2 { width: 260px; height: 260px; }
  .hero-subtitle { max-width: 100%; }
  .nav-links { display: none; }
  section { padding: 4rem 1.25rem; }
  .philosophy-text { font-size: 1rem; }
  .contact-section { padding: 2.5rem 1.25rem; }
  .contact-links { flex-direction: column; align-items: stretch; }
  .social-link { justify-content: center; }
  .case-card { padding: 1.5rem; }
  .case-title { font-size: 1.125rem; }
  .case-subtitle { font-size: 0.875rem; }
  .case-body { grid-template-columns: 1fr; gap: 1rem; }
  .case-diagram { display: none; }
  .case-studies-gallery, .blog-gallery { padding: 0 2rem; }
  .gallery-hint { font-size: 1.1rem; }
  .case-section p { font-size: 0.875rem; }
  .article-card { flex: 0 0 85vw; }
  .article-title { font-size: 1rem; }
  .article-excerpt { display: none; }
  .article-date { font-size: 0.7rem; }
  .footer-top-link { display: none; }
}

/* ── Small mobile ───────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .hero h1 { font-size: 2rem; }
  .section-title { font-size: 1.5rem; }
  .nav-container { padding: 0.875rem 1.25rem; }
  section { padding: 3rem 1.25rem; }
  .case-title { font-size: 1rem; }
  .case-subtitle { font-size: 0.8125rem; }
  .philosophy-text { font-size: 0.9375rem; }
  .background-narrative { font-size: 0.875rem; }
}

/* ── 17. Reduced motion ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
