/* ==========================================================================
   techwithhassan.cloud
   Plain CSS, no framework, no third-party requests.
   Light and dark themes follow the visitor's OS setting.
   Type: Red Hat Display / Text / Mono (SIL Open Font License, self-hosted).
   ========================================================================== */

@font-face {
  font-family: "Red Hat Display";
  src: url("/assets/fonts/red-hat-display.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Red Hat Text";
  src: url("/assets/fonts/red-hat-text.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Red Hat Mono";
  src: url("/assets/fonts/red-hat-mono.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  --paper: #f6f7f9;
  --surface: #ffffff;
  --sunken: #eef0f3;
  --ink: #0b0d12;
  --ink-2: #3b4250;
  --ink-3: #5b6372;
  --line: #e1e4ea;
  --line-strong: #b9c0cc;
  --accent: #047857;
  --accent-hover: #065f46;
  --accent-2: #0369a1;
  --accent-tint: #d9f2e8;
  --on-accent: #ffffff;
  --ok: #059669;
  --amber: #8a5300;
  --amber-tint: #f8ead2;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.06), 0 8px 24px -12px rgb(15 23 42 / 0.18);
  --shadow-lg: 0 30px 60px -30px rgb(15 23 42 / 0.35);

  --c-teal: #047857;
  --c-teal-tint: #dcf3ea;
  --c-blue: #1d5fc8;
  --c-blue-tint: #e3ecfb;
  --c-violet: #6d3fd0;
  --c-violet-tint: #eee7fc;
  --c-amber: #8f5300;
  --c-amber-tint: #f8ead2;
  --c-coral: #b83c12;
  --c-coral-tint: #fce7dd;

  --code-bg: #0b0f14;
  --code-line: #1f2733;
  --code-ink: #d6e2ea;
  --code-dim: #8697a8;
  --code-add: #4ade80;
  --code-str: #f5d38b;

  --font-display: "Red Hat Display", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-text: "Red Hat Text", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Red Hat Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: clamp(1.75rem, 1.35rem + 1.5vw, 2.375rem);
  --step-4: clamp(2.5rem, 1.55rem + 3.9vw, 4.375rem);
  --gutter: clamp(1rem, 0.55rem + 1.9vw, 2rem);
  --wrap: 72rem;
  --measure: 66ch;
  --section: clamp(4rem, 2.8rem + 4.5vw, 7rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #09090b;
    --surface: #121216;
    --sunken: #0e0e12;
    --ink: #f4f4f6;
    --ink-2: #b6b8c3;
    --ink-3: #8b8e9b;
    --line: #24242c;
    --line-strong: #3a3a46;
    --accent: #34d399;
    --accent-hover: #6ee7b7;
    --accent-2: #38bdf8;
    --accent-tint: #0f2a21;
    --on-accent: #03140d;
    --ok: #34d399;
    --amber: #f2b862;
    --amber-tint: #2c2213;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px -14px rgb(0 0 0 / 0.7);
    --shadow-lg: 0 30px 70px -30px rgb(0 0 0 / 0.85);
  
    --c-teal: #34d399;
    --c-teal-tint: #0f241c;
    --c-blue: #7cb4ff;
    --c-blue-tint: #121c2e;
    --c-violet: #b9a2ff;
    --c-violet-tint: #1c1630;
    --c-amber: #f5b95c;
    --c-amber-tint: #261d10;
    --c-coral: #ff9b78;
    --c-coral-tint: #2a160f;
  
    --code-bg: #0b0b0f;
    --code-line: #23232b;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #09090b;
  --surface: #121216;
  --sunken: #0e0e12;
  --ink: #f4f4f6;
  --ink-2: #b6b8c3;
  --ink-3: #8b8e9b;
  --line: #24242c;
  --line-strong: #3a3a46;
  --accent: #34d399;
  --accent-hover: #6ee7b7;
  --accent-2: #38bdf8;
  --accent-tint: #0f2a21;
  --on-accent: #03140d;
  --ok: #34d399;
  --amber: #f2b862;
  --amber-tint: #2c2213;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px -14px rgb(0 0 0 / 0.7);
  --shadow-lg: 0 30px 70px -30px rgb(0 0 0 / 0.85);

  --c-teal: #34d399;
  --c-teal-tint: #0f241c;
  --c-blue: #7cb4ff;
  --c-blue-tint: #121c2e;
  --c-violet: #b9a2ff;
  --c-violet-tint: #1c1630;
  --c-amber: #f5b95c;
  --c-amber-tint: #261d10;
  --c-coral: #ff9b78;
  --c-coral-tint: #2a160f;

  --code-bg: #0b0b0f;
  --code-line: #23232b;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.65;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--accent-tint);
  color: var(--ink);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

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

ul,
ol {
  margin: 0;
  padding: 0;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
}

:not(pre) > code {
  padding: 0.08em 0.35em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--sunken);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.icon {
  flex: none;
  width: 1.15em;
  height: 1.15em;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--gutter);
  z-index: 10;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
  color: var(--paper);
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --------------------------------------------------------------------------
   Header and footer
   -------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  width: 1.75rem;
  height: 1.75rem;
}

.brand-mark rect {
  fill: var(--accent);
}

.brand-mark path {
  stroke: var(--on-accent);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.35rem;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding-block: 0.4rem;
  color: var(--ink-2);
  font-size: 0.975rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

.site-footer {
  padding-block: 2.25rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: var(--step--1);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.site-footer p {
  margin: 0;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
}

.site-footer a {
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   Buttons and link rows
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.875rem;
  padding: 0.7rem 1.2rem;
  border: 1.5px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.btn-secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  list-style: none;
}

.link-row a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
}

.link-row a:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  padding-block: clamp(3rem, 1.8rem + 4.5vw, 6rem) clamp(3rem, 2rem + 3.5vw, 5rem);
}

.hero-grid {
  display: grid;
  gap: clamp(2.5rem, 1.8rem + 2.5vw, 4.5rem);
  align-items: center;
}

@media (min-width: 62rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  }
}

.hero h1 {
  font-size: var(--step-4);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.hero .lede {
  max-width: 34em;
  margin-top: 1.5rem;
  color: var(--ink-2);
  font-size: clamp(1.15rem, 1.03rem + 0.5vw, 1.375rem);
  line-height: 1.55;
}

.availability {
  display: flex;
  gap: 0.7rem;
  max-width: 34em;
  margin-top: 1.5rem;
  font-weight: 500;
}

.availability::before {
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  margin-top: 0.55em;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent);
}

.hero .actions {
  margin-top: 2rem;
}

.hero .link-row {
  margin-top: 1rem;
}

/* The plan card: the one bold element on the page */

.plan {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--code-line);
  border-radius: 14px;
  background: var(--code-bg);
  color: var(--code-ink);
  box-shadow: 0 30px 60px -30px rgb(6 30 20 / 0.45);
}

.plan-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.15rem;
  border-bottom: 1px solid var(--code-line);
  color: var(--code-dim);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.plan-bar .prompt {
  color: var(--code-add);
}

.plan pre {
  margin: 0;
  padding: 1.15rem clamp(0.9rem, 0.6rem + 1.2vw, 1.4rem) 1.35rem;
  font-size: clamp(0.7rem, 0.5rem + 0.85vw, 0.875rem);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.plan .c {
  color: var(--code-dim);
}

.plan .a {
  color: var(--code-add);
}

.plan .s {
  color: var(--code-str);
}

.plan .sum {
  font-weight: 600;
}

@media (prefers-reduced-motion: no-preference) {
  .plan.is-revealing .ln {
    animation: line-in 380ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: calc(var(--i, 0) * 55ms + 150ms);
  }
}

@keyframes line-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Credentials band */

.creds {
  border-block: 1px solid var(--line);
  background: var(--surface);
}

.creds-grid {
  display: grid;
  gap: 1.5rem 2.5rem;
  padding-block: 1.75rem;
  list-style: none;
}

@media (min-width: 40rem) {
  .creds-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 70rem) {
  .creds-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.cred-name {
  display: block;
  font-weight: 600;
  line-height: 1.35;
}

.cred-by {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink-3);
  font-size: var(--step--1);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section {
  padding-block: var(--section);
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section-head {
  max-width: var(--measure);
  margin-bottom: clamp(2.25rem, 1.6rem + 2.4vw, 3.75rem);
}

.section-head h2 {
  font-size: var(--step-3);
  letter-spacing: -0.022em;
}

.section-head p {
  margin-top: 0.85rem;
  color: var(--ink-2);
  font-size: 1.125rem;
}

/* Two-column rows used by projects and roles */

.row {
  display: grid;
  gap: 1.25rem 3rem;
}

@media (min-width: 58rem) {
  .row {
    grid-template-columns: minmax(0, 14.5rem) minmax(0, 1fr);
  }
}

.meta {
  display: grid;
  align-content: start;
  gap: 0.85rem;
  margin: 0;
  font-size: var(--step--1);
}

.meta dt {
  color: var(--ink-3);
}

.meta dd {
  margin: 0.05rem 0 0;
  font-weight: 500;
}

@media (max-width: 57.99rem) {
  /* On narrow screens the title comes first, then the details. */
  .row {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .row > div {
    display: contents;
  }

  .project h3 {
    order: -1;
  }

  .project .meta {
    margin-block: 1rem 0.25rem;
  }

  .role h3 {
    order: -2;
  }

  .role .org {
    order: -1;
  }

  .role-when {
    margin: 0.35rem 0 0;
    padding-top: 0;
  }

  .role-when {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
  }

  .meta {
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  }
}

/* Projects */

.projects {
  display: grid;
  gap: clamp(3.5rem, 2.5rem + 3vw, 5.5rem);
}

.project h3 {
  font-size: clamp(1.45rem, 1.25rem + 0.8vw, 1.875rem);
  letter-spacing: -0.018em;
}

.project .summary {
  max-width: var(--measure);
  margin: 0.85rem 0 0;
  color: var(--ink-2);
  font-size: 1.125rem;
}

.project-featured {
  padding: clamp(1.25rem, 0.8rem + 2.4vw, 2.75rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--amber-tint);
  color: var(--amber);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
}

.tag::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}

.bullets {
  display: grid;
  gap: 0.6rem;
  max-width: var(--measure);
  margin-top: 1.35rem;
  list-style: none;
}

.bullets li {
  position: relative;
  padding-left: 1.3rem;
}

.bullets li::before {
  content: "";
  position: absolute;
  top: 0.78em;
  left: 0;
  width: 0.55rem;
  height: 2px;
  background: var(--accent);
}

.stack {
  max-width: var(--measure);
  margin-top: 1.35rem;
  color: var(--ink-3);
  font-size: var(--step--1);
}

.stack strong {
  color: var(--ink-2);
  font-weight: 600;
}

.project .links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-top: 1.25rem;
  list-style: none;
  font-weight: 600;
}

.project .links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
}

/* Architecture layers (OpenEdX) */

.layers {
  max-width: 46rem;
  margin-top: 1.75rem;
}

.layers-title {
  margin-bottom: 0.6rem;
  color: var(--ink-3);
  font-size: var(--step--1);
}

.summary + .layers-title {
  margin-top: 1.6rem;
}

.layers-title + .steps {
  margin-top: 0.85rem;
}

.layers ol {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  list-style: none;
}

.layers li {
  display: grid;
  gap: 0.2rem 1.5rem;
  padding: 0.85rem 1.1rem;
}

.layers li + li {
  border-top: 1px solid var(--line);
}

@media (min-width: 40rem) {
  .layers li {
    grid-template-columns: 8.5rem minmax(0, 1fr);
  }
}

.layers .layer {
  font-weight: 600;
}

.layers .parts {
  color: var(--ink-2);
}

/* Release steps (OMS) */

.steps {
  display: grid;
  gap: 0.75rem;
  max-width: var(--measure);
  margin-top: 1.5rem;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  min-height: 1.8rem;
  padding-left: 2.75rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
}

.more-work {
  margin-top: clamp(3.5rem, 2.5rem + 3vw, 5rem);
  padding-top: 2.25rem;
  border-top: 1px solid var(--line);
}

.more-work h3 {
  font-size: var(--step-1);
}

.more-work > p {
  max-width: var(--measure);
  margin-top: 0.5rem;
  color: var(--ink-2);
}

.repo-list {
  display: grid;
  gap: 1.5rem 2.5rem;
  margin-top: 1.5rem;
  list-style: none;
}

@media (min-width: 46rem) {
  .repo-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 70rem) {
  .repo-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.repo-list a {
  font-weight: 600;
}

.repo-list p {
  margin-top: 0.2rem;
  color: var(--ink-3);
  font-size: var(--step--1);
}

/* Experience */

.roles {
  display: grid;
  gap: 1.25rem;
  list-style: none;
}

.role {
  padding: clamp(1.25rem, 0.9rem + 1.5vw, 2rem);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  background: var(--surface);
}

.role-when {
  margin: 0;
  padding-top: 0.15rem;
  color: var(--ink-3);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}

.when-date {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

@media (min-width: 58rem) {
  .when-place {
    display: block;
    margin-top: 0.55rem;
    padding-left: 0.7rem;
  }
}

.role h3 {
  font-size: var(--step-1);
}

.role .org {
  margin: 0.2rem 0 0;
  color: var(--accent);
  font-weight: 600;
}

.role .bullets {
  margin-top: 1rem;
}

/* Skills */

.skills {
  display: grid;
  gap: 2rem 3rem;
  margin: 0;
}

@media (min-width: 44rem) {
  .skills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 70rem) {
  .skills {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.skills dt {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
}

.skills dd {
  margin: 0.4rem 0 0;
  color: var(--ink-2);
}

/* Writing and teaching */

.writing {
  display: grid;
  gap: 2.5rem 3.5rem;
}

@media (min-width: 58rem) {
  .writing {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }
}

.post-card {
  display: block;
  padding: clamp(1.25rem, 1rem + 1.4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.post-card:hover {
  border-color: var(--accent);
  color: inherit;
}

.post-card .kicker {
  color: var(--ink-3);
  font-size: var(--step--1);
}

.post-card h2,
.post-card h3 {
  margin-top: 0.5rem;
  color: var(--ink);
  font-size: var(--step-2);
  letter-spacing: -0.015em;
}

.post-card .kicker {
  display: block;
}

.post-card p {
  margin-top: 0.75rem;
  color: var(--ink-2);
}

.post-card .read {
  display: inline-block;
  margin-top: 1rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.teach h3 {
  font-size: var(--step-1);
}

.teach > p {
  margin-top: 0.5rem;
  color: var(--ink-2);
}

.teach .link-row {
  margin-top: 0.5rem;
}

/* Contact */

.contact-grid {
  display: grid;
  gap: 2.5rem 4rem;
}

@media (min-width: 58rem) {
  .contact-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  }
}

.contact-email {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1.75rem;
}

.contact-email a {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 0.42rem + 3.1vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.8rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.copy-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.copy-btn[hidden] {
  display: none;
}

.contact .actions {
  margin-top: 1.75rem;
}

.facts {
  display: grid;
  gap: 1.35rem;
  margin: 0;
  padding: clamp(1.25rem, 1rem + 1.2vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.facts dt {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
}

.facts dt .icon {
  color: var(--accent);
}

.facts dd {
  margin: 0.2rem 0 0 calc(1.15em + 0.65rem);
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   Article pages
   -------------------------------------------------------------------------- */

.page-head {
  padding-block: clamp(2.5rem, 1.8rem + 3vw, 4.5rem) clamp(2rem, 1.6rem + 1.5vw, 3rem);
  border-bottom: 1px solid var(--line);
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  color: var(--ink-3);
  font-size: var(--step--1);
  list-style: none;
}

.crumbs li + li::before {
  content: "/";
  margin-right: 0.4rem;
  color: var(--line-strong);
}

.crumbs a {
  color: var(--ink-2);
}

.page-head h1 {
  max-width: 24ch;
  margin-top: 1rem;
  font-size: clamp(2rem, 1.45rem + 2.7vw, 3.375rem);
  letter-spacing: -0.024em;
}

.page-head .intro {
  max-width: var(--measure);
  margin-top: 1rem;
  color: var(--ink-2);
  font-size: 1.125rem;
}

.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-top: 1.25rem;
  color: var(--ink-3);
  font-size: var(--step--1);
}

.article-layout {
  display: grid;
  gap: 3rem;
  padding-block: clamp(2.5rem, 2rem + 2vw, 3.5rem) clamp(4rem, 3rem + 3vw, 6rem);
}

@media (min-width: 70rem) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr) 15rem;
    gap: 4rem;
  }

  .toc {
    position: sticky;
    top: 2rem;
    align-self: start;
    order: 2;
  }
}

.toc h2 {
  margin-bottom: 0.75rem;
  font-family: var(--font-text);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0;
}

.toc ol {
  display: grid;
  gap: 0.4rem;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
  font-size: var(--step--1);
  list-style: none;
}

.toc a {
  color: var(--ink-2);
  text-decoration: none;
}

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

.toc a[aria-current="true"] {
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 69.99rem) {
  .toc {
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
  }

  .toc ol {
    border-left: 0;
    padding-left: 0;
  }
}

.prose {
  min-width: 0;
  max-width: var(--measure);
}

.prose > section > h2,
.prose > h2 {
  margin: 3rem 0 1rem;
  font-size: var(--step-2);
  letter-spacing: -0.015em;
  scroll-margin-top: 1.5rem;
}

.prose > section:first-child > h2 {
  margin-top: 0;
}

.prose h3 {
  margin: 2rem 0 0.75rem;
  font-size: var(--step-1);
}

.prose ul,
.prose ol {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 1.25em;
  padding-left: 1.4rem;
}

.prose li::marker {
  color: var(--ink-3);
}

.callout {
  margin: 0 0 2rem;
  padding: 1.1rem 1.35rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--surface);
}

.callout h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-text);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
}

.callout-update {
  border-left-color: var(--amber);
}

.code {
  margin: 1.5rem 0;
  overflow: hidden;
  border: 1px solid var(--code-line);
  border-radius: 12px;
  background: var(--code-bg);
  color: var(--code-ink);
}

.code figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.75rem;
  padding: 0.35rem 0.5rem 0.35rem 1rem;
  border-bottom: 1px solid var(--code-line);
  color: var(--code-dim);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.code pre {
  margin: 0;
  padding: 1rem 1.1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 2;
}

.code .copy-btn {
  min-height: 2rem;
  padding: 0.3rem 0.65rem;
  border-color: var(--code-line);
  color: var(--code-ink);
  font-family: var(--font-text);
  font-size: 0.8125rem;
}

.code .copy-btn:hover {
  border-color: var(--code-dim);
  color: #ffffff;
}

.table-wrap {
  margin: 1.5rem 0;
  overflow-x: auto;
}

.prose table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.prose caption {
  padding-bottom: 0.6rem;
  color: var(--ink-3);
  font-size: var(--step--1);
  text-align: left;
}

.prose th,
.prose td {
  padding: 0.7rem 0.8rem 0.7rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose thead th {
  border-bottom: 2px solid var(--line-strong);
  font-weight: 600;
}

.faq details {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.faq details:first-of-type {
  border-top: 1px solid var(--line);
}

.faq summary {
  font-weight: 600;
  cursor: pointer;
}

.faq details p {
  margin-top: 0.6rem;
  color: var(--ink-2);
}

.author-box {
  display: grid;
  gap: 0.75rem;
  margin-top: 3.5rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.author-box h2 {
  font-size: var(--step-1);
}

.author-box p {
  margin: 0;
  color: var(--ink-2);
}

/* Writing index */

.post-list {
  display: grid;
  gap: 1.5rem;
  max-width: 50rem;
  list-style: none;
}

.more-videos {
  max-width: 50rem;
  margin-top: 2rem;
  color: var(--ink-2);
}

/* 404 */

.notfound {
  padding-block: clamp(4rem, 3rem + 6vw, 9rem);
}

.notfound h1 {
  font-size: var(--step-4);
  letter-spacing: -0.03em;
}

.notfound p {
  max-width: 40ch;
  margin-top: 1rem;
  color: var(--ink-2);
  font-size: 1.125rem;
}

.notfound .actions {
  margin-top: 2rem;
}

/* --------------------------------------------------------------------------
   Color tones: each card or item picks one, so sections read differently
   -------------------------------------------------------------------------- */

.tone-teal { --tone: var(--c-teal); --tone-tint: var(--c-teal-tint); }
.tone-blue { --tone: var(--c-blue); --tone-tint: var(--c-blue-tint); }
.tone-violet { --tone: var(--c-violet); --tone-tint: var(--c-violet-tint); }
.tone-amber { --tone: var(--c-amber); --tone-tint: var(--c-amber-tint); }
.tone-coral { --tone: var(--c-coral); --tone-tint: var(--c-coral-tint); }

/* Hero glow */
.hero {
  background:
    radial-gradient(42rem 26rem at 88% 8%, color-mix(in srgb, var(--c-blue) 14%, transparent), transparent 70%),
    radial-gradient(36rem 24rem at 4% 96%, color-mix(in srgb, var(--c-teal) 14%, transparent), transparent 70%);
}

.plan {
  position: relative;
  border-color: color-mix(in srgb, var(--c-teal) 45%, var(--code-line));
}

.plan::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--c-teal), var(--c-blue), var(--c-violet), var(--c-amber));
}

/* Section titles get a short multi-color bar */
.section-head h2::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 4px;
  margin-top: 0.7rem;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--c-teal), var(--c-blue), var(--c-violet));
}

/* Certifications band */
.creds {
  background: var(--paper);
}

.creds-grid {
  gap: 0.85rem;
  padding-block: 1.5rem;
}

.creds-grid li {
  padding: 0.95rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--tone) 30%, var(--line));
  border-top: 4px solid var(--tone);
  border-radius: 12px;
  background: var(--tone-tint);
}

.creds-grid .cred-name {
  color: var(--ink);
}

/* Projects */
.project-featured,
.project-card {
  padding: clamp(1.25rem, 0.8rem + 2.4vw, 2.75rem);
  border: 1px solid var(--line);
  border-top: 5px solid var(--tone);
  border-radius: 16px;
  background:
    linear-gradient(180deg, var(--tone-tint), transparent 9rem),
    var(--surface);
}

.project .meta dt {
  color: var(--tone);
  font-weight: 600;
}

.project .links a,
.project .meta a {
  color: var(--tone);
}

.project .bullets li::before {
  background: var(--tone);
}

.project .layers ol {
  border-color: color-mix(in srgb, var(--tone) 30%, var(--line));
}

.project .layers .layer {
  color: var(--tone);
}

.project .steps li::before {
  border-color: var(--tone);
  background: var(--tone-tint);
  color: var(--tone);
}

/* Labs */
.repo-list li {
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--tone);
  border-radius: 0 12px 12px 0;
  background: var(--tone-tint);
}

.repo-list a {
  color: var(--tone);
}

.repo-list p {
  color: var(--ink-2);
}

/* Experience */
.role.row {
  border-left-color: var(--tone);
  background:
    linear-gradient(90deg, var(--tone-tint), transparent 14rem),
    var(--surface);
}

.role .org {
  color: var(--tone);
}

.role .when-date {
  background: var(--tone-tint);
  color: var(--tone);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 35%, transparent);
}

.role .bullets li::before {
  background: var(--tone);
}

/* Skills */
.skills > div {
  padding: 1.1rem 1.2rem;
  border: 1px solid color-mix(in srgb, var(--tone) 28%, var(--line));
  border-radius: 14px;
  background: var(--tone-tint);
}

.skills dt {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--tone);
}

.skills dt::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 3px;
  background: var(--tone);
}

.skills dd {
  color: var(--ink);
}

.skills {
  gap: 1rem;
}

/* Writing card and contact facts */
.post-card {
  border-top: 4px solid var(--c-blue);
}

.facts {
  border-top: 4px solid var(--c-violet);
}

.facts dt .icon {
  color: var(--c-violet);
}

/* --------------------------------------------------------------------------
   Phones
   -------------------------------------------------------------------------- */

@media (max-width: 40rem) {
  .site-header .wrap {
    padding-block: 0.75rem;
  }

  .site-nav {
    width: 100%;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav ul {
    flex-wrap: nowrap;
    gap: 0 1.1rem;
    white-space: nowrap;
  }

  .site-nav a {
    font-size: 0.95rem;
    padding-block: 0.55rem;
  }

  .hero {
    padding-block: 2.25rem 2.5rem;
  }

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

  .hero .actions .btn {
    flex: 1 1 9rem;
  }

  .plan pre {
    font-size: 0.8rem;
    line-height: 1.6;
  }

  .plan .ln.ln-opt {
    display: none;
  }

  .section {
    padding-block: 3.25rem;
  }

  .section-head {
    margin-bottom: 1.75rem;
  }

  .projects {
    gap: 1.5rem;
  }

  .more-work {
    margin-top: 2.5rem;
  }

  .repo-list {
    gap: 0.75rem;
  }
}

.plan .ln {
  display: block;
  min-height: 1lh;
}

/* ==========================================================================
   Portfolio v2: dark-first, card-based layout
   ========================================================================== */

/* Sticky header */
.site-header[data-header] {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.site-header[data-header].is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 8px 24px -18px rgb(0 0 0 / 0.6);
}

.site-header[data-header] .wrap {
  flex-wrap: nowrap;
  gap: 1rem;
  padding-block: 0.8rem;
}

.site-header[data-header] .site-nav {
  margin-inline: auto;
}

.site-nav a[aria-current="true"] {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-small {
  min-height: 2.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.theme-toggle,
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.theme-toggle:hover,
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle[hidden] {
  display: none;
}

:root[data-theme="light"] .theme-icon-sun,
:root:not([data-theme="light"]) .theme-icon-moon {
  display: none;
}

.btn {
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
}

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

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 2rem + 5vw, 6.5rem) clamp(2.5rem, 2rem + 2vw, 4rem);
  background:
    radial-gradient(46rem 30rem at 85% 0%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 70%),
    radial-gradient(40rem 28rem at 0% 100%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  opacity: 0.45;
  pointer-events: none;
}

.hero > .wrap {
  position: relative;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.5rem;
  padding: 0.35rem 0.85rem 0.35rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 500;
}

.pulse {
  position: relative;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--ok);
}

@media (prefers-reduced-motion: no-preference) {
  .pulse::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--ok);
    animation: pulse 2s ease-out infinite;
  }
}

@keyframes pulse {
  from { transform: scale(1); opacity: 0.7; }
  to { transform: scale(3); opacity: 0; }
}

.hero h1 {
  font-size: clamp(2.4rem, 1.4rem + 4.2vw, 4.5rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.grad-text {
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 60%, var(--c-violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-role {
  margin: 1rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.6rem);
  font-weight: 600;
  color: var(--ink);
}

.hero .lede {
  margin-top: 1rem;
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.75rem;
  list-style: none;
}

.social-row.small .icon-btn {
  width: 2.3rem;
  height: 2.3rem;
}

.hero-visual {
  position: relative;
  padding-bottom: 1.5rem;
}

.plan-bar {
  justify-content: space-between;
}

.plan-bar .dots {
  display: inline-flex;
  gap: 0.4rem;
}

.plan-bar .dots i {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: #ff5f57;
}

.plan-bar .dots i:nth-child(2) { background: #febc2e; }
.plan-bar .dots i:nth-child(3) { background: #28c840; }

.plan {
  box-shadow: var(--shadow-lg);
}

.hero-visual .plan pre {
  padding-bottom: 3.5rem;
}

.float-badge {
  position: absolute;
  right: -0.5rem;
  bottom: 0;
  display: grid;
  margin: 0;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #f8c46a, #ff9b78);
  color: #1a0d03;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: var(--shadow-lg);
}

.float-badge-top {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.8;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: clamp(2.5rem, 2rem + 2vw, 4rem) 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--line);
}

@media (min-width: 52rem) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.stats > div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 0.25rem;
  padding: 1.25rem 1.4rem;
  background: var(--surface);
}

.stats dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 1.4rem + 1.5vw, 2.5rem);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stats dt {
  color: var(--ink-3);
  font-size: var(--step--1);
}

/* Sections */
.section-alt {
  background: var(--sunken);
}

.section + .section {
  border-top-color: var(--line);
}

.section-head.center {
  margin-inline: auto;
  text-align: center;
}

.section-head.center h2::after {
  margin-inline: auto;
}

.section-head.split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  max-width: none;
}

.section-head.split > div {
  max-width: var(--measure);
}

.sub-head {
  margin: clamp(3rem, 2.5rem + 2vw, 4rem) 0 1.25rem;
  font-size: var(--step-1);
}

/* Shared card look */
.expertise > li,
.pcard,
.tl-card,
.ccard,
.bcard {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

@media (hover: hover) {
  .expertise > li:hover,
  .pcard:hover,
  .ccard:hover,
  .bcard:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--tone, var(--accent)) 55%, var(--line));
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.chips > li,
.chips > span {
  padding: 0.2rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 30%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone, var(--accent)) 10%, transparent);
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 500;
}

/* Expertise */
.expertise {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 44rem) { .expertise { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 68rem) { .expertise { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.expertise > li {
  position: relative;
  padding: 1.5rem;
  border-left: 3px solid var(--tone);
}

.exp-icon,
.ccard-icon {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 1rem;
  border-radius: 12px;
  background: var(--tone-tint);
  color: var(--tone);
}

.exp-icon .icon,
.ccard-icon .icon {
  width: 1.4rem;
  height: 1.4rem;
}

.expertise h3 {
  font-size: 1.125rem;
}

/* Project cards */
.project-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 48rem) { .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 72rem) { .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.pcard {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pcard-cover {
  position: relative;
  display: grid;
  place-items: center;
  height: 9.5rem;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--tone) 45%, transparent), transparent 60%),
    radial-gradient(circle at 85% 90%, color-mix(in srgb, var(--accent-2) 30%, transparent), transparent 55%),
    var(--tone-tint);
  color: var(--tone);
}

.pcard-cover .icon {
  width: 3rem;
  height: 3rem;
  stroke-width: 1.5;
}

.cover-label {
  position: absolute;
  left: 0.9rem;
  bottom: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--paper) 75%, transparent);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.pcard-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.35rem 1.4rem 1.4rem;
}

.pcard-kind {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.6rem;
  color: var(--tone);
  font-size: 0.8125rem;
  font-weight: 600;
}

.pcard h3 {
  font-size: 1.3rem;
}

.pcard-body > p:not(.pcard-kind) {
  margin: 0.6rem 0 0;
  color: var(--ink-2);
  font-size: 0.975rem;
}

.more {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
  font-size: 0.925rem;
}

.more summary {
  color: var(--tone);
  font-weight: 600;
  cursor: pointer;
}

.more .bullets,
.more .steps {
  margin-top: 0.75rem;
}

.more .bullets li::before {
  background: var(--tone);
}

.more .steps li::before {
  border-color: var(--tone);
  background: var(--tone-tint);
  color: var(--tone);
}

.layers-dl {
  display: grid;
  gap: 0.6rem;
  margin: 0.75rem 0 0;
}

.layers-dl dt {
  color: var(--tone);
  font-weight: 600;
}

.layers-dl dd {
  margin: 0;
  color: var(--ink-2);
}

.pcard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1.25rem;
}

/* Timeline */
.timeline {
  position: relative;
  display: grid;
  gap: 1.25rem;
  max-width: 54rem;
  margin: 0 auto;
  padding: 0 0 0 2rem;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: 0.55rem;
  width: 2px;
  background: linear-gradient(var(--c-coral), var(--c-teal), var(--c-blue), var(--c-violet));
  opacity: 0.6;
}

.tl-item {
  position: relative;
}

.tl-item::before {
  content: "";
  position: absolute;
  top: 1.6rem;
  left: -1.95rem;
  width: 1rem;
  height: 1rem;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 35%, transparent);
}

.tl-card {
  padding: clamp(1.15rem, 0.9rem + 1vw, 1.6rem);
  border-left: 3px solid var(--tone);
}

.tl-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.tl-head h3 {
  font-size: var(--step-1);
}

.tl-head .org {
  margin: 0.2rem 0 0;
  color: var(--tone);
  font-weight: 600;
}

.tl-when {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--ink-3);
  font-size: var(--step--1);
}

.tl-when .when-date {
  background: var(--tone-tint);
  color: var(--tone);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 35%, transparent);
}

.tl-card .bullets {
  margin-top: 1rem;
}

.tl-card .bullets li::before {
  background: var(--tone);
}

/* Certifications */
.cert-grid {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 40rem) { .cert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 72rem) { .cert-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.ccard {
  padding: 1.4rem;
  border-top: 3px solid var(--tone);
}

.ccard-cat {
  margin: 0 0 0.35rem;
  color: var(--tone);
  font-size: 0.8125rem;
  font-weight: 600;
}

.ccard h3 {
  font-size: 1.05rem;
  line-height: 1.3;
}

.ccard-by {
  margin: 0.5rem 0 0;
  color: var(--ink-3);
  font-size: var(--step--1);
}

/* Writing */
.write-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 52rem) { .write-grid { grid-template-columns: 1.4fr 1fr; } }

.bcard {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  --tone: var(--c-blue);
}

.bcard.yt {
  --tone: var(--c-coral);
}

.bcard:hover {
  color: inherit;
}

.bcard-cover {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.2rem;
  height: 9rem;
  padding: 1.1rem 1.3rem;
  background:
    radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--tone) 45%, transparent), transparent 55%),
    linear-gradient(135deg, var(--code-bg), color-mix(in srgb, var(--tone) 25%, var(--code-bg)));
  color: #fff;
}

.bcard.yt .bcard-cover {
  align-items: center;
  justify-content: center;
}

.bcard.yt .bcard-cover .icon {
  width: 3.5rem;
  height: 3.5rem;
  color: #ff4e45;
}

.bcard-cover-k {
  color: var(--code-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.bcard-cover-v {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
}

.bcard-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.35rem 1.4rem 1.4rem;
}

.bcard-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-3);
  font-size: var(--step--1);
}

.bcard-title {
  margin-top: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.bcard-text {
  margin-top: 0.6rem;
  color: var(--ink-2);
}

.bcard-read {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 1rem;
  color: var(--tone);
  font-weight: 600;
}

/* Call to action */
.cta {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3.5rem, 2.5rem + 4vw, 6rem);
  background:
    radial-gradient(40rem 20rem at 90% 0%, rgb(255 255 255 / 0.16), transparent 70%),
    linear-gradient(120deg, #065f46, #0e7490 55%, #4c1d95);
  color: #ffffff;
}

.cta-inner {
  text-align: center;
}

.cta h2 {
  max-width: 22ch;
  margin-inline: auto;
  font-size: var(--step-3);
}

.cta-inner > p {
  max-width: 56ch;
  margin: 1rem auto 0;
  color: rgb(255 255 255 / 0.85);
  font-size: 1.1rem;
}

.cta .contact-email {
  justify-content: center;
}

.cta .contact-email a {
  color: #ffffff;
}

.cta .copy-btn {
  border-color: rgb(255 255 255 / 0.45);
  color: #ffffff;
}

.cta .actions {
  justify-content: center;
}

.btn-light {
  background: #ffffff;
  color: #06281d;
}

.btn-light:hover {
  background: #e6fff5;
  color: #06281d;
  transform: translateY(-1px);
}

.btn-ghost-light {
  border-color: rgb(255 255 255 / 0.6);
  color: #ffffff;
}

.btn-ghost-light:hover {
  border-color: #ffffff;
  background: rgb(255 255 255 / 0.1);
  color: #ffffff;
}

.cta-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 2.5rem;
  max-width: 50rem;
  margin: 2.25rem auto 0;
  text-align: left;
}

.cta-facts > div {
  max-width: 24rem;
}

.cta-facts dt {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
}

.cta-facts dd {
  margin: 0.2rem 0 0;
  color: rgb(255 255 255 / 0.8);
  font-size: 0.95rem;
}

.cta a:focus-visible,
.cta button:focus-visible {
  outline-color: #ffffff;
}

/* Rich footer */
.site-footer.rich {
  padding-block: 3.5rem 2rem;
  background: var(--sunken);
}

.site-footer.rich .footer-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 48rem) {
  .site-footer.rich .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
}

.site-footer.rich h2 {
  margin-bottom: 0.85rem;
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
}

.site-footer.rich ul:not(.social-row) {
  display: grid;
  gap: 0.55rem;
}

.site-footer.rich a,
.foot-text {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-2);
  text-decoration: none;
}

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

.footer-brand .brand {
  color: var(--ink);
}

.footer-brand p {
  max-width: 34ch;
  margin-top: 0.85rem;
}

.footer-brand .social-row {
  margin-top: 1.1rem;
}

.site-footer.rich .footer-bottom {
  display: block;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

/* Phones */
@media (max-width: 40rem) {
  .site-header[data-header] .wrap {
    flex-wrap: wrap;
  }

  .site-header[data-header] .site-nav {
    order: 3;
    margin-inline: calc(var(--gutter) * -1);
  }

  .header-tools {
    margin-left: auto;
  }

  .float-badge {
    right: 0.25rem;
    font-size: 0.9rem;
  }

  .timeline {
    padding-left: 1.5rem;
  }

  .timeline::before {
    left: 0.3rem;
  }

  .tl-item::before {
    left: -1.55rem;
    width: 0.9rem;
    height: 0.9rem;
  }

  .section-head.split .btn {
    display: none;
  }
}

/* ==========================================================================
   Motion. Everything here is switched off for "reduce motion" users.
   ========================================================================== */

.site-header[data-header]::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 2px;
  transform: scaleX(var(--p, 0));
  transform-origin: left;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--c-violet));
}

.caret {
  display: inline-block;
  width: 0.5em;
  height: 1em;
  margin-left: 0.15em;
  vertical-align: -0.12em;
  background: var(--code-add);
  opacity: 0;
}

.btn .icon {
  transition: transform 200ms ease;
}

.btn:hover .icon:last-child:not(:first-child) {
  transform: translateX(3px);
}

.spot {
  isolation: isolate;
}

.spot::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--tone, var(--accent)) 18%, transparent), transparent 45%);
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
}

.spot:hover::after {
  opacity: 1;
}

.pcard,
.bcard,
.tl-card,
.ccard,
.expertise > li {
  position: relative;
}

@media (prefers-reduced-motion: no-preference) {
  /* Hero entrance, once on load */
  .js .hero-copy > * {
    animation: rise 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .js .hero-copy > :nth-child(2) { animation-delay: 80ms; }
  .js .hero-copy > :nth-child(3) { animation-delay: 160ms; }
  .js .hero-copy > :nth-child(4) { animation-delay: 220ms; }
  .js .hero-copy > :nth-child(5) { animation-delay: 280ms; }
  .js .hero-copy > :nth-child(6) { animation-delay: 340ms; }

  .js .hero-visual {
    animation: rise-in 900ms cubic-bezier(0.2, 0.7, 0.2, 1) 150ms both;
  }

  .js .stats {
    animation: rise 800ms cubic-bezier(0.2, 0.7, 0.2, 1) 420ms both;
  }

  /* Terminal: typed command, blinking caret, streamed output */
  .plan.is-typing .ln {
    opacity: 0;
  }

  .plan.is-typing .caret,
  .plan.is-revealing .caret {
    opacity: 1;
    animation: blink 1s steps(1) infinite;
  }

  .plan.is-revealing .ln {
    animation: line-in 320ms ease-out both;
    animation-delay: calc(var(--i, 0) * 65ms);
  }

  /* Living details */
  .grad-text {
    background-size: 200% 100%;
    animation: shimmer 9s ease-in-out infinite alternate;
  }

  .float-badge {
    animation: float 6s ease-in-out infinite;
  }

  .hero::before {
    animation: grid-drift 24s linear infinite;
  }

  .timeline::before {
    transform: scaleY(var(--tl, 1));
    transform-origin: top;
    transition: transform 120ms linear;
  }

  /* Scroll reveal (only for elements below the first screen) */
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(22px);
    transition:
      opacity 650ms cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0ms),
      transform 650ms cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0ms);
  }

  .js [data-reveal].is-in {
    opacity: 1;
    transform: none;
  }

  .pcard-cover .icon {
    transition: transform 400ms cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .pcard:hover .pcard-cover .icon {
    transform: scale(1.12) rotate(-6deg);
  }

  .exp-icon,
  .ccard-icon {
    transition: transform 300ms ease;
  }

  .expertise > li:hover .exp-icon,
  .ccard:hover .ccard-icon {
    transform: translateY(-3px) scale(1.06);
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes shimmer {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 56px 56px, 56px 56px; }
}

/* --------------------------------------------------------------------------
   CV page (screen and print)
   -------------------------------------------------------------------------- */

.cv-page {
  padding-block: clamp(2rem, 1.5rem + 2vw, 3.5rem) clamp(3rem, 2rem + 3vw, 5rem);
}

.cv-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 52rem;
  margin: 0 auto 1.5rem;
}

.cv-actions p {
  margin: 0;
  color: var(--ink-3);
  font-size: var(--step--1);
}

.cv {
  max-width: 52rem;
  margin-inline: auto;
  padding: clamp(1.5rem, 0.8rem + 3vw, 3.25rem);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.975rem;
  line-height: 1.55;
}

.cv h1 {
  font-size: clamp(1.9rem, 1.6rem + 1.4vw, 2.5rem);
  letter-spacing: -0.02em;
}

.cv .cv-title {
  margin-top: 0.25rem;
  color: var(--ink-2);
  font-size: 1.125rem;
  font-weight: 500;
}

.cv .cv-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.25rem;
  margin-top: 0.9rem;
  padding-left: 0;
  color: var(--ink-2);
  font-size: 0.9rem;
  list-style: none;
}

.cv .cv-contact li + li {
  margin-top: 0;
}

.cv-contact a {
  color: inherit;
}

.cv h2 {
  margin: 1.9rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1.5px solid var(--line-strong);
  font-size: 1.05rem;
  letter-spacing: 0;
}

.cv h3 {
  font-family: var(--font-text);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
}

.cv-item + .cv-item {
  margin-top: 1rem;
}

.cv-item-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 1rem;
}

.cv-item-head .when {
  color: var(--ink-3);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cv-item .where {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.925rem;
}

.cv ul {
  margin: 0.4rem 0 0;
  padding-left: 1.15rem;
}

.cv li + li {
  margin-top: 0.15rem;
}

.cv-skills {
  display: grid;
  gap: 0.3rem;
  margin: 0;
}

.cv-skills div {
  display: grid;
  gap: 0 1rem;
}

@media (min-width: 40rem) {
  .cv-skills div {
    grid-template-columns: 11rem minmax(0, 1fr);
  }
}

.cv-skills dt {
  font-weight: 600;
}

.cv-skills dd {
  margin: 0;
  color: var(--ink-2);
}

@page {
  size: A4;
  margin: 13mm 14mm 14mm;
}

@media print {
  :root,
  :root[data-theme] {
    color-scheme: light;
    --paper: #ffffff;
    --surface: #ffffff;
    --ink: #111111;
    --ink-2: #2b2b2b;
    --ink-3: #555555;
    --line: #cccccc;
    --line-strong: #888888;
    --accent: #0a6a44;
  }

  html,
  body {
    background: #ffffff;
  }

  body {
    font-size: 10pt;
  }

  .skip-link,
  .site-header,
  .site-footer,
  .cv-actions {
    display: none !important;
  }

  .cv-page {
    padding: 0;
  }

  .cv {
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    font-size: 9.6pt;
    line-height: 1.42;
  }

  .cv h1 {
    font-size: 21pt;
  }

  .cv .cv-title {
    font-size: 11pt;
  }

  .cv .cv-contact,
  .cv-item .where,
  .cv-item-head .when {
    font-size: 8.8pt;
  }

  .cv h2 {
    margin: 12pt 0 6pt;
    font-size: 10.5pt;
    break-after: avoid;
  }

  .cv h3 {
    font-size: 9.8pt;
  }

  .cv-item {
    break-inside: avoid;
  }

  .cv-item + .cv-item {
    margin-top: 7pt;
  }

  .cv-skills div {
    grid-template-columns: 40mm minmax(0, 1fr);
  }

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

/* Reserve the typed command's width so nothing shifts while it types */
[data-type] {
  display: inline-block;
  min-width: 14ch;
  text-align: left;
}

/* --------------------------------------------------------------------------
   Hero fits one screen on short viewports (laptops, browser zoom)
   -------------------------------------------------------------------------- */

@media (min-width: 62rem) {
  .hero {
    padding-block: clamp(1.25rem, 6vh, 6.5rem) clamp(1.5rem, 5vh, 4rem);
  }

  .hero h1 {
    font-size: min(clamp(2.4rem, 1.4rem + 4.2vw, 4.5rem), 10.5vh);
  }

  .pill {
    margin-bottom: clamp(0.6rem, 2.6vh, 1.5rem);
    font-size: min(0.9rem, 2.4vh);
  }

  .hero-role {
    margin-top: clamp(0.4rem, 1.6vh, 1rem);
    font-size: min(clamp(1.2rem, 1rem + 0.9vw, 1.6rem), 4.2vh);
  }

  .hero .lede {
    margin-top: clamp(0.4rem, 1.6vh, 1rem);
    font-size: min(clamp(1.05rem, 1rem + 0.3vw, 1.2rem), 3vh);
  }

  .hero .actions {
    margin-top: clamp(0.9rem, 3.2vh, 2rem);
  }

  .social-row {
    margin-top: clamp(0.75rem, 2.6vh, 1.75rem);
  }

  .hero-visual .plan pre {
    padding-block: clamp(0.6rem, 2vh, 1.15rem) clamp(2.25rem, 6vh, 3.5rem);
    font-size: min(clamp(0.7rem, 0.5rem + 0.85vw, 0.875rem), 2.15vh);
    line-height: 1.6;
  }

  .plan-bar {
    padding-block: min(0.75rem, 1.6vh);
  }
}

/* Short screens: drop the certificates block from the terminal
   (the certification cards below still list them) */
@media (min-width: 62rem) and (max-height: 760px) {
  .plan .ln.ln-opt {
    display: none;
  }
}

/* Very short screens: hide the optional icon row; the same links are in
   the header CV button, the contact band and the footer */
@media (min-width: 62rem) and (max-height: 560px) {
  .hero .social-row {
    display: none;
  }
}
