/* ==========================================================================
   ali.so — design system
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --secondary: #7c3aed;
  --accent: #06b6d4;

  --surface: #f8fafc;
  --surface-alt: #ffffff;
  --surface-raised: #ffffff;
  --border: #e2e8f0;

  --text: #1e293b;
  --text-strong: #0f172a;
  --text-muted: #64748b;

  --gradient-primary: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #2563eb 100%);

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, .1), 0 4px 6px -4px rgba(15, 23, 42, .05);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, .1), 0 8px 10px -6px rgba(15, 23, 42, .05);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;

  --font-main: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', Menlo, Monaco, 'Courier New', monospace;

  --nav-height: 70px;
  --transition: .25s ease;

  --nav-bg: rgba(248, 250, 252, .85);
  --tag-bg: #eef2ff;
  --tag-text: #4338ca;
  --code-bg: #f1f5f9;
}

[data-theme='dark'] {
  --primary: #60a5fa;
  --primary-strong: #3b82f6;
  --secondary: #a78bfa;
  --accent: #22d3ee;

  --surface: #0f172a;
  --surface-alt: #131f38;
  --surface-raised: #1e293b;
  --border: #334155;

  --text: #cbd5e1;
  --text-strong: #f1f5f9;
  --text-muted: #94a3b8;

  --gradient-primary: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
  --gradient-accent: linear-gradient(135deg, #22d3ee 0%, #60a5fa 100%);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .4), 0 2px 4px -2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .45), 0 4px 6px -4px rgba(0, 0, 0, .3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .5), 0 8px 10px -6px rgba(0, 0, 0, .35);

  --nav-bg: rgba(15, 23, 42, .85);
  --tag-bg: #1e293b;
  --tag-text: #a5b4fc;
  --code-bg: #131f38;
}

/* ===== Reset ===== */

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

* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--surface);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select { font: inherit; }

h1, h2, h3, h4, h5, h6 {
  color: var(--text-strong);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: break-word;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover { color: var(--secondary); }

ul, ol { padding: 0; }

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

/* ===== Layout primitives ===== */

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow { max-width: 760px; }

.section { padding: 96px 0; }

.section:nth-of-type(even) { background: var(--surface-alt); }

.section-header {
  max-width: 720px;
  margin: 0 auto 56px;
  text-align: center;
}

.section-eyebrow {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: 12px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--primary);
}

.section-title {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -.02em;
}

.section-lead {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.section-footer {
  margin-top: 44px;
  text-align: center;
}

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-link {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.text-link i { transition: transform var(--transition); }
.text-link:hover i { transform: translateX(4px); }

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition),
              background-color var(--transition), color var(--transition),
              border-color var(--transition);
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--surface-raised);
  color: var(--text-strong);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: var(--primary);
  background: var(--tag-bg);
}

/* ===== Tags ===== */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin-top: 16px;
}

.tag {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: .78rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ===== Navbar ===== */

.navbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.navbar.scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.01em;
}

.nav-logo span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-logo i { color: var(--primary); }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 6px 0;
  color: var(--text);
  font-weight: 500;
  font-size: .95rem;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient-primary);
  transition: width var(--transition);
}

.nav-link:hover,
.nav-link.active { color: var(--primary); }

.nav-link:hover::after,
.nav-link.active::after { width: 100%; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle,
.hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}

.theme-toggle:hover,
.hamburger:hover {
  background: var(--tag-bg);
  color: var(--primary);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
}

.bar {
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform var(--transition), opacity var(--transition);
}

.hamburger.is-open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-open .bar:nth-child(2) { opacity: 0; }
.hamburger.is-open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

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

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: calc(var(--nav-height) + 72px) 0 88px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(60% 55% at 78% 18%, rgba(124, 58, 237, .16), transparent 70%),
    radial-gradient(55% 50% at 12% 12%, rgba(37, 99, 235, .16), transparent 70%),
    radial-gradient(45% 45% at 50% 100%, rgba(6, 182, 212, .12), transparent 70%);
}

.hero-container {
  position: relative;
  z-index: 1;
}

.hero-content {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 56px;
  align-items: start;
}

.hero-subtitle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--primary);
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.hero-subtitle::before {
  content: '';
  width: 32px;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient-primary);
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: 14px;
}

.hero-role {
  color: var(--text-strong);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 18px;
}

.hero-description {
  max-width: 56ch;
  color: var(--text-muted);
  font-size: 1.12rem;
  line-height: 1.7;
  margin-bottom: 32px;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* Sits outside .hero-content so the row and its rule span the full hero
   width. auto-fit rather than a fixed count, so adding or removing a stat
   does not need a matching CSS change. */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 24px 20px;
  list-style: none;
  margin-top: 64px;
  padding-top: 36px;
  border-top: 1px solid var(--border);
}

.stat-number {
  display: block;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  line-height: 1.1;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: .85rem;
}

/* ===== Hero portrait ===== */

.hero-aside {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.hero-portrait {
  position: relative;
  width: min(320px, 78%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

/* Soft glow behind the portrait. */
.hero-orb {
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: var(--gradient-primary);
  opacity: .18;
  filter: blur(28px);
}

/* Padding on the ring is what makes the gradient border visible. */
.hero-portrait-ring {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 5px;
  border-radius: 50%;
  background: var(--gradient-primary);
  box-shadow: var(--shadow-xl);
}

.hero-portrait-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: var(--surface-alt);
}

/* ===== About ===== */

.about-content {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 56px;
  align-items: start;
}

.about-text p + p { margin-top: 18px; }

.about-text p { color: var(--text-muted); }

.about-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin-top: 26px;
}

.about-features {
  display: grid;
  gap: 16px;
  list-style: none;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.feature-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 12px;
  background: var(--gradient-primary);
  color: #fff;
}

.feature-text strong {
  display: block;
  color: var(--text-strong);
  margin-bottom: 4px;
}

.feature-text span {
  color: var(--text-muted);
  font-size: .92rem;
}

/* ===== Experience timeline ===== */

.timeline {
  position: relative;
  list-style: none;
  max-width: 860px;
  margin: 0 auto;
  padding-left: 34px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 7px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), var(--secondary), transparent);
}

.timeline-item { position: relative; }
.timeline-item + .timeline-item { margin-top: 24px; }

.timeline-marker {
  position: absolute;
  top: 26px;
  left: -34px;
  width: 16px;
  height: 16px;
  border: 3px solid var(--surface-alt);
  border-radius: 50%;
  background: var(--primary);
}

.timeline-item.is-current .timeline-marker {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, .2);
}

.timeline-card {
  padding: 26px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.timeline-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.timeline-role {
  font-size: 1.15rem;
  font-weight: 700;
}

.timeline-company {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin-top: 6px;
}

.timeline-company .company {
  color: var(--primary);
  font-weight: 600;
}

.timeline-company .location,
.timeline-period {
  color: var(--text-muted);
  font-size: .87rem;
}

.timeline-period { margin-top: 4px; }

.timeline-bullets {
  margin-top: 16px;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--text-muted);
  font-size: .95rem;
}

.timeline-bullets li::marker { color: var(--primary); }

/* ===== Skills ===== */

/* One row, however many groups _data/skills.yml holds — grid-auto-flow keeps
   it a single track without hardcoding the column count. */
.skills-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 18px;
}

.skill-card {
  padding: 22px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.skill-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.skill-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 1.05rem;
}

.skill-name { font-size: 1rem; }

.skill-card .tags { gap: 6px; margin-top: 12px; }

.skill-card .tag {
  padding: 4px 10px;
  font-size: .74rem;
  white-space: normal;
}

/* Below this the five tracks get too narrow to read; wrap instead. */
@media (max-width: 1080px) {
  .skills-grid {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
  }
}

/* ===== Post cards ===== */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.post-card {
  display: flex;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.post-card-date {
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.post-card-title {
  margin-top: 10px;
  font-size: 1.15rem;
  line-height: 1.35;
}

.post-card-title a { color: var(--text-strong); }
.post-card-title a:hover { color: var(--primary); }

.post-card-excerpt {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: .93rem;
}

.post-card .tags { margin-top: auto; padding-top: 18px; }

/* ===== Page head (blog index) ===== */

.page-head { padding-top: calc(var(--nav-height) + 64px); }

/* ===== Post ===== */

.post { padding-top: calc(var(--nav-height) + 64px); }

.post-header {
  padding-bottom: 28px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--border);
}

.post-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: .9rem;
  font-weight: 600;
}

.post-title {
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -.02em;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: .88rem;
}

.post-meta .tags { margin-top: 0; }

.post-body {
  font-size: 1.05rem;
  /* Old posts paste bare URLs; without this they push the page wider than
     the viewport on mobile instead of wrapping. */
  overflow-wrap: anywhere;
}

.post-body > * + * { margin-top: 20px; }

.post-body h2,
.post-body h3,
.post-body h4 { margin-top: 40px; }

.post-body h2 { font-size: 1.6rem; }
.post-body h3 { font-size: 1.3rem; }

.post-body ul,
.post-body ol { padding-left: 24px; }

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

.post-body blockquote {
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--primary);
  color: var(--text-muted);
  font-style: italic;
}

.post-body img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.post-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: .88em;
}

.post-body pre {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow-x: auto;
}

.post-body pre code {
  padding: 0;
  background: none;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: .94rem;
}

.post-body th,
.post-body td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
}

.post-body th {
  background: var(--code-bg);
  color: var(--text-strong);
}

.post-body hr {
  border: 0;
  border-top: 1px solid var(--border);
}

/* ===== Contact ===== */

/* 190px lets all five cards sit on one row at full width; they reflow to
   3 then 2 as the viewport narrows. */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 20px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 32px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.contact-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.contact-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 1.2rem;
}

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

.contact-card span:not(.contact-icon) {
  color: var(--text-muted);
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.contact-card-accent .contact-icon { background: var(--gradient-accent); }

/* ===== Open source page ===== */

.os-stats {
  max-width: 860px;
  margin: 8px auto 0;
  padding-top: 32px;
  text-align: center;
}

.os-stats + .os-list { margin-top: 44px; }

.os-list {
  max-width: 860px;
  margin: 0 auto;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.os-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 20px 24px;
  transition: background-color var(--transition);
}

.os-item + .os-item { border-top: 1px solid var(--border); }

.os-item:hover { background: var(--tag-bg); }

.os-item-main { flex: 1 1 320px; min-width: 0; }

.os-item-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  font-size: 1.02rem;
  font-weight: 700;
}

.os-item-title a { color: var(--text-strong); }
.os-item-title a:hover { color: var(--primary); }

.os-version {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 500;
}

.os-item-desc {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: .92rem;
  overflow-wrap: anywhere;
}

.os-item-metrics {
  display: flex;
  gap: 18px;
  flex: 0 0 auto;
}

.os-metric {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.os-metric i { color: var(--primary); font-size: .8rem; }

.os-note,
.os-generated {
  max-width: 860px;
  margin: 24px auto 0;
  color: var(--text-muted);
  font-size: .85rem;
}

.os-generated {
  padding: 0 24px 64px;
  text-align: center;
}

@media (max-width: 560px) {
  .os-item { padding: 18px 20px; }
  .os-item-metrics { width: 100%; gap: 16px; }
}

/* ===== Resume page ===== */

.resume { padding-top: calc(var(--nav-height) + 64px); }

.resume .section-header { text-align: left; margin-left: 0; }

.resume-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: .92rem;
}

.resume-contact i { color: var(--primary); }

.resume .hero-buttons { margin-top: 24px; margin-bottom: 0; }

.resume-block + .resume-block { margin-top: 48px; }

.resume-heading {
  padding-bottom: 10px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--border);
  font-size: 1.35rem;
}

.resume-job + .resume-job {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.resume-role { font-size: 1.08rem; font-weight: 700; }

.resume-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: .88rem;
}

.resume-meta .company { color: var(--primary); font-weight: 600; }

.resume-bullets {
  margin-top: 14px;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--text-muted);
  font-size: .95rem;
}

.resume-bullets li::marker { color: var(--primary); }

/* The resume column is far too narrow for a single row; keep it wrapping. */
.skills-grid-compact {
  grid-auto-flow: row;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.skills-grid-compact .skill-card { padding: 20px; }

.resume-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  list-style: none;
}

.resume-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

/* ===== 404 ===== */

.error-page {
  padding-top: calc(var(--nav-height) + 96px);
  text-align: center;
}

.error-code {
  font-size: clamp(4rem, 14vw, 8rem);
  font-weight: 800;
  line-height: 1;
}

.error-page .hero-buttons {
  justify-content: center;
  margin-top: 32px;
  margin-bottom: 0;
}

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

.site-footer {
  padding: 48px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.footer-brand {
  font-weight: 800;
  font-size: 1.1rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.footer-social {
  display: flex;
  gap: 12px;
  list-style: none;
}

.footer-social a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  transition: transform var(--transition), color var(--transition),
              border-color var(--transition), background-color var(--transition);
}

.footer-social a:hover {
  transform: translateY(-3px);
  border-color: transparent;
  background: var(--gradient-primary);
  color: #fff;
}

.footer-meta {
  color: var(--text-muted);
  font-size: .87rem;
}

/* ===== Back to top ===== */

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 900;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ===== Scroll reveal ===== */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s ease, transform .6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

@media (max-width: 960px) {
  .hero-content,
  .about-content {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hero { min-height: auto; }

  /* Lead with the portrait once the columns stack. */
  .hero-aside {
    order: -1;
    min-height: 0;
  }

  .hero-portrait { width: min(200px, 52%); }

  /* Let the five stats reflow to 3 then 2 per row rather than jumping
     straight to 2 the moment the columns stack. */
  .hero-stats {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-top: 48px;
  }
}

@media (max-width: 768px) {
  .section { padding: 72px 0; }

  .hamburger { display: inline-flex; }

  .nav-menu {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 24px 24px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-140%);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--transition), opacity var(--transition), visibility var(--transition);
  }

  .nav-menu.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

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

  .nav-link {
    display: block;
    padding: 14px 0;
    font-size: 1rem;
  }

  .nav-link::after { display: none; }

  .section-header { margin-bottom: 40px; }

  .timeline { padding-left: 26px; }
  .timeline-marker { left: -26px; width: 14px; height: 14px; }
  .timeline-card { padding: 22px 20px; }

  .hero-buttons .btn { flex: 1 1 auto; }
}

@media (max-width: 480px) {
  .container { padding: 0 18px; }
  .nav-container { padding: 0 18px; }

  .hero-stats {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 22px 16px;
  }

  .hero-description { font-size: 1rem; }

  .post-body { font-size: 1rem; }

  .back-to-top { right: 16px; bottom: 16px; }
}

/* ===== Motion preferences ===== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
