:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-soft: #f2f5f8;

  --text: #17202a;
  --text-soft: #3f4b57;
  --muted: #687582;
  --muted-2: #87929d;

  --line: #e1e6eb;
  --line-strong: #ccd4dc;

  --accent: #1769aa;
  --accent-soft: #eaf3fb;
  --accent-hover: #0f578f;

  --code-bg: #f5f7f9;

  --max: 1120px;
  --article-width: 800px;

  --radius: 12px;
  --radius-small: 8px;

  --shadow: 0 8px 28px rgba(25, 42, 58, 0.07);
}


/* =========================================================
   Base
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: #d8eafa;
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

img {
  max-width: 100%;
  height: auto;
}

.wrap {
  width: min(var(--max), calc(100% - 48px));
  margin: 0 auto;
}


/* =========================================================
   Navigation
   ========================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;

  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  border-bottom: 1px solid var(--line);
}

.nav {
  min-height: 70px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 34px;
  height: 34px;

  display: grid;
  place-items: center;

  border-radius: 8px;

  background: var(--text);
  color: white;

  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
}

nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

nav a {
  position: relative;

  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 550;

  padding: 6px 0;
}

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

nav a::after {
  content: "";

  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;

  height: 1px;
  background: var(--accent);

  transition: right 180ms ease;
}

nav a:hover::after {
  right: 0;
}


/* =========================================================
   Homepage / Hero
   ========================================================= */

.hero {
  padding: 88px 0 76px;

  display: grid;
  grid-template-columns: 1.15fr 0.85fr;

  gap: 64px;
  align-items: center;
}

.eyebrow,
.card-label {
  color: var(--accent);

  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 12px 0 22px;

  font-size: clamp(2.9rem, 6vw, 5rem);
  line-height: 1.02;

  letter-spacing: -0.055em;
}

.hero h1 span {
  color: var(--text-soft);
}

.hero-text {
  max-width: 680px;

  font-size: 1.1rem;
  color: var(--text-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;

  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 11px 17px;

  border-radius: 8px;

  background: var(--text);
  color: white;

  border: 1px solid var(--text);

  font-weight: 700;
  font-size: 0.92rem;
}

.button:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.button.secondary {
  background: white;
  color: var(--text);

  border-color: var(--line-strong);
}

.button.secondary:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}


/* =========================================================
   Cards
   ========================================================= */

.hero-card,
.project-card,
.callout,
.article-row {
  background: var(--surface);

  border: 1px solid var(--line);

  box-shadow: var(--shadow);
}

.hero-card {
  border-radius: var(--radius);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;

  gap: 7px;
  padding: 13px 16px;

  border-bottom: 1px solid var(--line);

  color: var(--muted);
  font-size: 0.78rem;

  background: var(--surface-soft);
}

.terminal-bar i {
  width: 8px;
  height: 8px;

  border-radius: 50%;

  background: #aab4bd;
}

.terminal-bar span {
  margin-left: 8px;
}

pre {
  margin: 0;
  padding: 26px;

  overflow: auto;

  font-size: 0.95rem;
}


/* =========================================================
   Sections
   ========================================================= */

.section {
  padding: 42px 0;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;

  gap: 20px;
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 0.25rem 0 0;

  font-size: 2rem;
  line-height: 1.2;

  letter-spacing: -0.03em;
}

.section-heading > a {
  color: var(--accent);
  font-weight: 700;
}

.section-heading > a:hover {
  color: var(--accent-hover);
}


/* =========================================================
   Project cards
   ========================================================= */

.project-grid {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 24px;
}

.project-card {
  display: block;

  padding: 0;

  border-radius: var(--radius);

  overflow: hidden;

  position: relative;
}

.project-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 12px 34px rgba(25, 42, 58, 0.10);
}

.project-card h3 {
  font-size: 1.45rem;
  line-height: 1.25;

  margin: 8px 0 10px;
}

.project-card p {
  color: var(--text-soft);

  margin: 0 0 18px;
}

.project-card .card-content {
  padding: 24px;
}

.project-card .project-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 8.5;

  object-fit: cover;

  display: block;

  border-bottom: 1px solid var(--line);

  background: var(--surface-soft);
}

.project-card.muted {
  opacity: 0.78;
}

.tags {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.tags span {
  font-size: 0.76rem;
  color: var(--text-soft);

  border: 1px solid var(--line);

  padding: 4px 8px;

  border-radius: 999px;

  background: var(--surface-soft);
}

.card-arrow,
.coming {
  display: inline-block;

  margin-top: 20px;

  color: var(--accent);
  font-weight: 750;
}

.card-arrow:hover {
  color: var(--accent-hover);
}


/* =========================================================
   Article list
   ========================================================= */

.article-list {
  display: flex;
  flex-direction: column;

  gap: 12px;
}

.article-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 25px;

  padding: 20px 22px;

  border-radius: var(--radius-small);
}

.article-row:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.article-row h3 {
  margin: 4px 0;

  font-size: 1.15rem;
  line-height: 1.35;
}

.article-row p {
  margin: 0;

  color: var(--muted);
}

.article-date {
  font-size: 0.76rem;

  color: var(--muted-2);

  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.row-arrow {
  color: var(--accent);
  font-size: 1.2rem;
}


/* =========================================================
   Generic pages
   ========================================================= */

.callout {
  margin: 60px auto 80px;

  padding: 30px;

  border-radius: var(--radius);

  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 28px;
}

.callout h2 {
  margin: 6px 0 8px;

  font-size: 1.75rem;
  line-height: 1.25;
}

.callout p {
  color: var(--muted);

  margin: 0;

  max-width: 760px;
}

.page-head {
  padding: 70px 0 28px;
}

.page-head h1 {
  margin: 8px 0 14px;

  font-size: clamp(2.6rem, 6vw, 4.5rem);
  line-height: 1.04;

  letter-spacing: -0.05em;
}

.lead {
  max-width: 780px;

  font-size: 1.12rem;

  color: var(--text-soft);
}

.page-content {
  padding-bottom: 90px;
}


/* =========================================================
   Reading / article content
   ========================================================= */

.prose {
  max-width: var(--article-width);
}

.prose h2 {
  position: relative;

  margin: 56px 0 18px;
  padding-top: 18px;

  font-size: 1.75rem;
  line-height: 1.25;

  letter-spacing: -0.025em;

  border-top: 1px solid var(--line);
}

.prose h2::before {
  content: "";

  position: absolute;

  top: -1px;
  left: 0;

  width: 48px;
  height: 1px;

  background: var(--accent);
}

.prose h3 {
  margin: 34px 0 12px;

  font-size: 1.2rem;
  line-height: 1.3;
}

.prose h4 {
  margin: 26px 0 10px;

  font-size: 1.04rem;
}

.prose p,
.prose li {
  color: var(--text-soft);
}

.prose p {
  margin: 0 0 18px;
}

.prose li + li {
  margin-top: 6px;
}

.prose strong {
  color: var(--text);
}

.prose a {
  color: var(--accent);

  text-decoration: underline;
  text-decoration-color: #b7d5ed;

  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--accent-hover);
  text-decoration-color: var(--accent-hover);
}

.prose blockquote {
  margin: 28px 0;

  border-left: 3px solid var(--accent);

  padding: 14px 18px;

  color: var(--text-soft);

  background: var(--accent-soft);

  border-radius: 0 8px 8px 0;
}

.prose hr {
  border: 0;

  border-top: 1px solid var(--line);

  margin: 44px 0;
}


/* =========================================================
   Tables
   ========================================================= */

.prose table {
  width: 100%;

  border-collapse: separate;
  border-spacing: 0;

  margin: 28px 0;

  overflow: hidden;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: var(--surface);
}

.prose th,
.prose td {
  border-bottom: 1px solid var(--line);

  padding: 12px 13px;

  text-align: left;
}

.prose th {
  color: var(--text);

  background: var(--surface-soft);

  font-weight: 750;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose tbody tr:hover td {
  background: #fafbfd;
}


/* =========================================================
   Inline code
   ========================================================= */

.prose code:not(pre code) {
  padding: 0.16em 0.38em;

  border: 1px solid var(--line);

  border-radius: 5px;

  background: var(--code-bg);

  color: #174f7d;

  font-size: 0.9em;
}


/* =========================================================
   Code blocks
   ========================================================= */

.prose pre {
  margin: 24px 0;

  padding: 20px 22px;

  overflow: auto;

  border-radius: 10px;

  border: 1px solid var(--line);

  border-left: 2px solid var(--accent);

  background: var(--code-bg);

  color: #263746;

  box-shadow: none;
}

.prose pre code {
  display: block;

  min-width: max-content;

  color: inherit;

  font-size: 0.9rem;
  line-height: 1.7;
}


/* =========================================================
   Figures / images
   ========================================================= */

.prose img {
  display: block;

  width: auto;
  max-width: 100%;
  height: auto;

  margin: 30px auto;

  border: 1px solid var(--line);

  border-radius: 10px;

  background: var(--surface-soft);

  box-shadow: 0 8px 24px rgba(25, 42, 58, 0.06);
}

.prose figure {
  margin: 32px 0;
}

.prose figcaption {
  margin-top: 10px;

  color: var(--muted);

  text-align: center;

  font-size: 0.82rem;
}


/* =========================================================
   Mermaid
   ========================================================= */

.prose .mermaid {
  width: 100%;

  margin: 30px auto;

  padding: 18px;

  overflow: auto;

  border: 1px solid var(--line);

  border-radius: 10px;

  background: var(--surface);

  box-shadow: none;
}

.prose .mermaid svg {
  display: block;

  max-width: 100%;
  height: auto;

  margin: 0 auto;
}


/* =========================================================
   Article page
   ========================================================= */

.article {
  padding: 64px 0 110px;
}

.article > .prose {
  margin-top: 42px;
}

.article h1 {
  max-width: 900px;

  margin: 10px 0 18px;

  font-size: clamp(2.6rem, 5vw, 4.2rem);
  line-height: 1.06;

  letter-spacing: -0.048em;

  text-wrap: balance;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;

  gap: 9px;

  color: var(--muted);

  font-size: 0.77rem;

  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.article-meta::before {
  content: "";

  width: 24px;
  height: 1px;

  background: var(--accent);
}

.article-end {
  margin-top: 50px;

  padding-top: 26px;

  border-top: 1px solid var(--line);
}

.article-end a {
  color: var(--accent);
}


/* =========================================================
   Project page
   ========================================================= */

.project-head {
  padding-bottom: 35px;
}

.project-head .button {
  margin-top: 22px;
}

.project-image {
  margin: 26px 0;
}

.project-image img {
  width: 100%;

  display: block;

  border: 1px solid var(--line);

  border-radius: 12px;

  box-shadow: var(--shadow);
}


/* =========================================================
   Section transition
   ========================================================= */

.section-transition {
  margin: 2.5rem 0 2rem;

  padding: 1rem 1.25rem;

  border-left: 3px solid var(--accent);

  background: var(--accent-soft);

  border-radius: 0 8px 8px 0;

  font-size: 1rem;
  line-height: 1.7;
}

.section-transition strong {
  display: block;

  margin-bottom: 0.25rem;

  font-size: 1.05rem;

  color: var(--text);
}


/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  border-top: 1px solid var(--line);

  padding: 42px 0 26px;

  background: #ffffff;
}

.site-footer strong {
  letter-spacing: -0.01em;
}

.footer-grid {
  display: flex;

  justify-content: space-between;

  gap: 20px;
}

.footer-grid p {
  margin: 0.3rem 0;

  color: var(--muted);
}

.footer-links {
  display: flex;

  gap: 18px;

  color: var(--muted);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-bottom {
  padding-top: 22px;

  margin-top: 24px;

  border-top: 1px solid var(--line);

  color: var(--muted-2);

  font-size: 0.8rem;
}


/* =========================================================
   Scrollbars
   ========================================================= */

* {
  scrollbar-width: thin;
  scrollbar-color: #b7c1ca transparent;
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #b7c1ca;

  border-radius: 999px;

  border: 2px solid transparent;

  background-clip: padding-box;
}


/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 820px) {

  .wrap {
    width: min(var(--max), calc(100% - 32px));
  }

  .nav {
    min-height: auto;

    padding: 14px 0;

    align-items: flex-start;

    flex-direction: column;

    gap: 10px;
  }

  .nav nav {
    gap: 16px;

    flex-wrap: wrap;
  }

  .hero {
    grid-template-columns: 1fr;

    padding-top: 62px;

    gap: 40px;
  }

  .hero h1 {
    font-size: clamp(2.7rem, 11vw, 4rem);
  }

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

  .callout,
  .footer-grid {
    flex-direction: column;

    align-items: flex-start;
  }

  .article {
    padding-top: 48px;
  }

  .article h1 {
    font-size: clamp(2.4rem, 10vw, 3.5rem);
  }

  .prose {
    max-width: 100%;
  }

  .prose table {
    display: block;

    overflow-x: auto;
  }

  .prose pre {
    padding: 17px;
  }
}

@media (max-width: 520px) {

  .wrap {
    width: min(var(--max), calc(100% - 28px));
  }

  nav {
    gap: 13px;
  }

  nav a {
    font-size: 0.86rem;
  }

  .hero {
    padding-top: 48px;
  }

  .section {
    padding: 32px 0;
  }

  .section-heading {
    align-items: flex-start;

    flex-direction: column;

    gap: 8px;
  }

  .article-row {
    align-items: flex-start;
  }

  .row-arrow {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* ---------- Homepage project refinement ---------- */

.project-card.featured {
  padding: 0;
  overflow: hidden;
}

.project-card.featured .project-thumbnail {
  border-bottom: 1px solid var(--line);
}

.project-card-body {
  padding: 28px 30px 30px;
}

.project-card-body h3 {
  margin: 8px 0 12px;
}

.project-card-body p {
  max-width: 820px;
  margin-bottom: 18px;
}

.project-card-body .card-arrow {
  margin-top: 24px;
}


/* ---------- Homepage focus areas ---------- */

.focus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.focus-item {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.focus-item h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
}

.focus-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

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

  .project-card-body {
    padding: 22px;
  }
}