:root {
  color-scheme: light dark;
  --bg: #f8fafc;
  --bg-soft: #eef4fb;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --text: #111827;
  --muted: #5f6b7a;
  --border: rgba(15, 23, 42, 0.11);
  --border-strong: rgba(15, 23, 42, 0.2);
  --accent: #0f172a;
  --accent-2: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.09);
  --code-bg: #101521;
  --code-text: #dbeafe;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  --max: 1120px;
  --radius: 28px;
  --radius-sm: 18px;
}

[data-theme="dark"] {
  --bg: #080b12;
  --bg-soft: #0f172a;
  --surface: rgba(17, 24, 39, 0.72);
  --surface-solid: #111827;
  --text: #f8fafc;
  --muted: #a7b0c2;
  --border: rgba(248, 250, 252, 0.12);
  --border-strong: rgba(248, 250, 252, 0.22);
  --accent: #f8fafc;
  --accent-2: #93c5fd;
  --accent-soft: rgba(147, 197, 253, 0.13);
  --code-bg: #050816;
  --code-text: #e0f2fe;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 32rem),
    radial-gradient(circle at 80% 10%, rgba(14, 165, 233, 0.10), transparent 28rem),
    linear-gradient(180deg, var(--bg), var(--bg-soft));
  min-height: 100vh;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-2); }
img { max-width: 100%; display: block; }
::selection { background: var(--accent-2); color: white; }

.skip-link {
  position: absolute;
  top: 0;
  left: 1rem;
  transform: translateY(-150%);
  background: var(--accent);
  color: var(--bg);
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  z-index: 999;
}
.skip-link:focus { transform: translateY(1rem); }

.shell {
  width: min(calc(100% - 2rem), var(--max));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
}

.navbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 760;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.9rem;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.14);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.nav-links a,
.theme-toggle {
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.93rem;
  cursor: pointer;
}

.nav-links a[aria-current="page"],
.nav-links a:hover,
.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.72fr);
  gap: clamp(2rem, 5vw, 5rem);
  padding: clamp(4rem, 10vw, 7.5rem) 0 3rem;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.94rem;
  margin: 0 0 1.2rem;
}
.eyebrow::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.12);
}

h1, h2, h3 {
  line-height: 1.05;
  letter-spacing: -0.06em;
  margin: 0;
}

h1 {
  font-size: clamp(3.5rem, 10vw, 7.5rem);
  max-width: 10ch;
}

.hero-title span {
  color: var(--muted);
  font-weight: 580;
}

.hero-copy {
  max-width: 720px;
  margin: 1.35rem 0 0;
  color: var(--muted);
  font-size: clamp(1.08rem, 2vw, 1.35rem);
}

.hero-actions,
.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border-radius: 999px;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-weight: 720;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
  color: var(--text);
}
.button.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.button.primary:hover { color: var(--bg); }

.hero-card,
.card,
.page-card,
.post-card,
.callout,
.contact-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 1.2rem;
  transform: rotate(1deg);
}

.hero-card--photo {
  padding: 0.9rem 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 360px;
  margin-inline: auto;
}
.hero-photo {
  width: 100%;
  height: auto;
  aspect-ratio: 672 / 800;
  object-fit: cover;
  border-radius: calc(var(--radius) - 10px);
  display: block;
}
.hero-photo-caption {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0 0.4rem;
  font-size: 0.92rem;
  color: var(--muted);
}
.hero-photo-caption strong {
  color: var(--text);
  font-weight: 720;
  letter-spacing: -0.02em;
  font-size: 1rem;
}

.console {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}
.console-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.35); }
.console-body {
  padding: 1.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.93rem;
  overflow-x: auto;
}
.console-line { display: block; margin: 0.45rem 0; color: #bfdbfe; white-space: nowrap; }
.console-key { color: #7dd3fc; }
.console-value { color: #fef9c3; }
.console-comment { color: #94a3b8; }

.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  padding: 0 0 clamp(3rem, 6vw, 5rem);
}
.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  background: var(--surface);
}
.stat strong {
  display: block;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}
.stat span { color: var(--muted); font-size: 0.95rem; }

.section {
  padding: clamp(3rem, 7vw, 5.5rem) 0;
  border-top: 1px solid var(--border);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 2rem;
  margin-bottom: 1.5rem;
}
.section-kicker {
  color: var(--accent-2);
  font-weight: 780;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin: 0 0 0.7rem;
}
.section h2,
.page-title {
  font-size: clamp(2.25rem, 5vw, 4.5rem);
}
.section-lede,
.page-lede {
  color: var(--muted);
  max-width: 780px;
  font-size: 1.08rem;
}

.grid {
  display: grid;
  gap: 1rem;
}
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card,
.page-card,
.post-card,
.callout,
.contact-panel {
  padding: clamp(1.25rem, 3vw, 1.75rem);
}
.card h3,
.post-card h3,
.page-card h3 { font-size: 1.45rem; margin-bottom: 0.65rem; }
.card p,
.post-card p,
.page-card p { margin: 0; color: var(--muted); }

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}
.tag {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.42rem 0.68rem;
  background: var(--surface-solid);
  color: var(--muted);
  font-size: 0.88rem;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.skill-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  background: var(--surface);
}
.skill-group h3 {
  font-size: 1rem;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.page-hero {
  padding: clamp(3.5rem, 9vw, 6rem) 0 3rem;
}
.page-hero .page-title { max-width: 900px; }
.page-lede { margin-top: 1rem; }

.timeline {
  display: grid;
  gap: 1rem;
}
.timeline-item {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 1.2rem;
}
.timeline-date {
  color: var(--accent-2);
  font-weight: 760;
}
.timeline-item h3 {
  margin: 0 0 0.45rem;
  font-size: 1.3rem;
}
.timeline-item p { margin: 0; color: var(--muted); }

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0.8rem;
}
.post-card h3 a:hover { color: var(--accent-2); }

.article {
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5rem) 0;
}
.article-header { margin-bottom: 2.5rem; }
.article h1 {
  font-size: clamp(2.7rem, 7vw, 5.4rem);
  max-width: none;
}
.article .description {
  color: var(--muted);
  font-size: 1.18rem;
  margin-top: 1rem;
}
.article-content {
  font-size: 1.08rem;
}
.article-content h2 {
  font-size: 2rem;
  margin-top: 2.4rem;
  margin-bottom: 0.7rem;
}
.article-content h3 {
  font-size: 1.45rem;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}
.article-content p,
.article-content ul,
.article-content blockquote { margin: 1rem 0; }
.article-content ul { padding-left: 1.25rem; }
.article-content li { margin: 0.45rem 0; }
.article-content code {
  background: var(--accent-soft);
  padding: 0.1rem 0.35rem;
  border-radius: 0.35rem;
  font-size: 0.9em;
}
.article-content pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--code-text);
}
.article-content blockquote {
  border-left: 4px solid var(--accent-2);
  padding-left: 1rem;
  color: var(--muted);
}

.contact-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }

@media (max-width: 920px) {
  .hero,
  .grid.three,
  .grid.two,
  .skill-grid,
  .posts-grid,
  .quick-stats,
  .contact-panel {
    grid-template-columns: 1fr;
  }
  .hero-card { transform: none; }
  .section-head { align-items: start; flex-direction: column; }
}

@media (max-width: 720px) {
  .shell { width: min(calc(100% - 1.2rem), var(--max)); }
  .navbar { min-height: auto; padding: 0.6rem 0; align-items: center; gap: 0.5rem; flex-wrap: nowrap; }
  .brand { flex: 0 0 auto; gap: 0; }
  /* Hide the full name on mobile — keep only the CS badge to free up space for the nav. */
  .brand > span:not(.brand-mark) { display: none; }
  .nav-links {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    gap: 0.1rem;
    padding: 0.2rem;
  }
  .nav-links a {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    font-size: 0.82rem;
    padding: 0.5rem 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .theme-toggle { flex: 0 0 auto; padding: 0.5rem 0.7rem; font-size: 0.85rem; }
  h1 { font-size: clamp(3rem, 16vw, 4.6rem); }
  .quick-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline-item { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  /* Below ~iPhone Plus widths the 5-item nav crowds out the brand and theme toggle.
     Wrap the navbar so nav-links gets its own full-width row underneath. */
  .navbar { flex-wrap: wrap; row-gap: 0.45rem; }
  .nav-links {
    order: 3;
    flex: 1 0 100%;
    justify-content: stretch;
  }
  .nav-links a { font-size: 0.85rem; padding: 0.55rem 0.4rem; }
  .quick-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
