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

:root {
  --font-size: 16px;
  --foreground: oklch(0.145 0 0);
  --font-weight-medium: 500;
  --font-weight-normal: 400;
  --radius: 0.625rem;

  --color-white: #fff;
  --color-blue-50: oklch(97% 0.014 254.604);
  --color-blue-600: oklch(54.6% 0.245 262.881);
  --color-purple-50: oklch(97.7% 0.014 308.299);
  --color-purple-200: oklch(90.2% 0.063 306.703);
  --color-purple-600: oklch(55.8% 0.288 302.321);
  --color-pink-600: oklch(59.2% 0.249 0.584);
  --color-gray-400: oklch(70.7% 0.022 261.325);

  --text-sm: 0.875rem;
  --accent: #7c3aed;
  --accent-2: #2563eb;
  --muted: #4b5563;
  --border: rgba(0, 0, 0, 0.06);
  --bg-alt: #f9fafb;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
}

html {
  font-size: var(--font-size);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--foreground);
  background: var(--color-white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Nav ── */

nav {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  padding: 0 24px;
}

nav .nav-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

nav .nav-inner::-webkit-scrollbar {
  display: none;
}

nav a {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  padding: 12px 0;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

nav a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-home {
  font-weight: 600;
  color: var(--accent);
}

/* ── Hero (Technical Case Study style) ── */

.hero {
  position: relative;
  overflow: hidden;
  padding: 80px 0 56px;
  background-image: linear-gradient(
    to bottom right in oklab,
    var(--color-purple-50),
    var(--color-white),
    var(--color-blue-50)
  );
}

.hero-bg {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.45;
  pointer-events: none;
}

.hero-bg-right {
  width: 360px;
  height: 360px;
  top: -120px;
  right: -100px;
  background: #c4b5fd;
}

.hero-bg-left {
  width: 280px;
  height: 280px;
  bottom: -80px;
  left: -80px;
  background: #93c5fd;
}

.hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.12;
  margin-bottom: 16px;
  background: linear-gradient(90deg, var(--color-purple-600), var(--color-pink-600), var(--color-blue-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--muted);
  max-width: 620px;
  line-height: 1.7;
}

.meta {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.meta a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.meta a:hover {
  text-decoration: underline;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-purple-200);
  background: rgba(255, 255, 255, 0.88);
  color: var(--color-purple-600);
}

/* ── Stat pills ── */

.stat-row {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.stat-pill {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 18px;
  backdrop-filter: blur(4px);
}

.stat-num {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Hero diagram ── */

.hero-diagram {
  margin-top: 28px;
}

.arch-diagram-hero {
  padding: 20px 24px;
  max-width: 100%;
}

.arch-diagram-hero .arch-group {
  min-width: 140px;
}

.arch-diagram-hero .arch-item {
  font-size: 0.72rem;
  padding: 4px 10px;
}

/* ── Infographics ── */

.infographic-placeholder {
  background: var(--color-white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.infographic-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 16px;
}

.infographic-flowchart .flowchart-nodes {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.flowchart-node {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.flowchart-node-highlight {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: var(--accent);
  font-weight: 600;
}

.flowchart-node-outcome {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.flowchart-arrow {
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: 12px;
}

.infographic-dataflow .dataflow-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dataflow-node {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.dataflow-node-out {
  background: #ede9fe;
  border-color: #c4b5fd;
  font-weight: 600;
}

.dataflow-arrow {
  color: var(--accent);
  font-size: 1rem;
}

/* ── Sections ── */

section {
  padding: 64px 0;
  border-bottom: 1px solid var(--border);
}

section:last-of-type {
  border-bottom: none;
}

.section-alt {
  background: var(--bg-alt);
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 12px;
}

section h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 8px;
  color: #111827;
}

.section-lead {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 1.02rem;
  line-height: 1.65;
}

section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 24px 0 8px;
  color: #111827;
}

section p {
  margin-bottom: 14px;
  color: var(--muted);
  line-height: 1.7;
}

section code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ── Cards ── */

.card {
  background: var(--color-white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 14px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.card h3 {
  margin-top: 0;
  color: #111827;
}

.card p:last-child {
  margin-bottom: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Timeline ── */

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-2));
}

.timeline-item {
  position: relative;
  margin-bottom: 28px;
  cursor: pointer;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--color-white);
  box-shadow: 0 0 0 2px var(--accent);
}

.timeline-date {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-label {
  font-weight: 600;
  margin: 3px 0;
  color: #111827;
}

.timeline-detail {
  font-size: 0.9rem;
  color: var(--muted);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.timeline-item.expanded .timeline-detail {
  max-height: 200px;
  opacity: 1;
}

.timeline-hint {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 8px;
}

/* ── Commits ── */

.commit-list {
  list-style: none;
}

.commit-item {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.commit-item:last-child {
  border-bottom: none;
}

.commit-hash {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  background: #ede9fe;
  padding: 3px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.commit-msg {
  color: var(--muted);
  flex: 1;
}

.commit-date {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.filter-bar {
  margin-bottom: 16px;
}

.filter-bar input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}

.filter-bar input:focus {
  border-color: var(--accent);
}

/* ── Gallery ── */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.gallery-item {
  cursor: pointer;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: box-shadow 0.2s, transform 0.2s;
}

.gallery-item:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.gallery-item img {
  width: 100%;
  display: block;
}

.gallery-caption {
  padding: 12px 14px;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--color-white);
}

/* ── Architecture diagram ── */

.arch-diagram {
  background: var(--color-white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  overflow-x: auto;
}

.arch-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.arch-node {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
  white-space: nowrap;
}

.arch-user {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
}

.arch-group {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  flex: 1;
  min-width: 200px;
}

.arch-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.arch-item {
  background: #ede9fe;
  border: 1px solid #c4b5fd;
  color: #111827;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  margin-bottom: 6px;
  font-family: var(--mono);
}

.arch-data-group {
  border-color: #10b981;
}

.arch-data-item {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.arch-arrow {
  text-align: center;
  color: var(--accent);
  font-size: 1.2rem;
  margin: 4px 0;
}

/* ── Lightbox ── */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

/* ── Footer ── */

footer {
  background: #111827;
  color: #d1d5db;
  padding: 48px 0 32px;
  margin-top: 48px;
}

.footer-brand {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.footer-brand a {
  color: var(--accent);
  text-decoration: none;
}

.footer-brand a:hover {
  text-decoration: underline;
}

.footer-tagline {
  font-size: 0.85rem;
  color: #9ca3af;
  margin: 6px 0 16px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.footer-links a {
  font-size: 0.78rem;
  color: #d1d5db;
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}

.footer-links a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.footer-free {
  font-size: 0.75rem;
  color: #6b7280;
}

.footer-free a {
  color: #d1d5db;
  text-decoration: none;
}

.footer-free a:hover {
  color: #fff;
}

/* ── Responsive ── */

@media (max-width: 1024px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 56px 0 40px;
  }

  .hero h1 {
    font-size: 1.9rem;
  }

  .meta {
    flex-direction: column;
    gap: 8px;
  }

  .hero-diagram {
    margin-top: 20px;
  }

  .arch-diagram-hero .arch-row {
    flex-direction: column;
    align-items: stretch;
  }

  .arch-diagram-hero .arch-group {
    min-width: auto;
  }

  .infographic-dataflow .dataflow-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .dataflow-arrow {
    transform: rotate(90deg);
    margin-left: 12px;
  }

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

  section {
    padding: 48px 0;
  }
}
