/* Fonts (self-hosted) */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/archivo-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo Narrow';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/archivo-narrow-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-mono-500.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-mono-600.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-mono-700.woff2') format('woff2');
}

/* Design tokens */
:root {
  --bg: oklch(0.97 0.012 120);
  --fg: oklch(0.22 0.02 145);
  --muted: oklch(0.50 0.02 145);
  --line: oklch(0.88 0.015 135);
  --card: oklch(0.995 0.004 120);
  --accent: oklch(0.72 0.17 145);
  --accent-ink: oklch(0.20 0.06 145);
  --on-accent: oklch(0.18 0.05 145);

  --font-body: Archivo, Helvetica, Arial, sans-serif;
  --font-label: 'Archivo Narrow', Archivo, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme='dark'] {
  --bg: oklch(0.19 0.018 145);
  --fg: oklch(0.94 0.012 120);
  --muted: oklch(0.68 0.018 140);
  --line: oklch(0.30 0.02 145);
  --card: oklch(0.23 0.02 145);
  --accent-ink: oklch(0.84 0.13 145);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background 220ms ease, color 220ms ease;
}
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }

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

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

@keyframes caretBlink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes waveIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Page shell */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 120px;
  animation: waveIn 500ms ease both;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--font-label);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 13px;
  text-decoration: none;
  color: var(--fg);
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-family: var(--font-label);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.site-nav a {
  text-decoration: none;
  color: var(--muted);
}
.site-nav a:hover { color: var(--fg); }

.pill {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: var(--font-label);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color 160ms ease, color 160ms ease;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}

/* Sections */
section { padding: clamp(72px, 10vw, 140px) 0 0; }

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 16px;
  border-top: 2px solid var(--fg);
  padding-top: 16px;
}
.section-heading--split { justify-content: space-between; }
.section-heading h2 {
  font-family: var(--font-mono);
  font-size: clamp(28px, 3.2vw, 44px);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.section-meta {
  font-family: var(--font-label);
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.section-heading .pill {
  color: var(--muted);
  padding: 8px 16px;
  white-space: nowrap;
}

/* Hero terminal */
.hero { padding-top: clamp(40px, 6vw, 84px); }
.terminal {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
  box-shadow: 0 24px 60px -40px oklch(0.2 0.03 145 / 0.55);
  font-family: var(--font-mono);
}
.terminal-titlebar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.terminal-lights { display: flex; gap: 7px; }
.terminal-light {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
}
.terminal-light--red { background: oklch(0.70 0.16 25); }
.terminal-light--amber { background: oklch(0.80 0.14 85); }
.terminal-light--green { background: var(--accent); }
.terminal-title {
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
.terminal-body {
  padding: clamp(26px, 4vw, 54px) clamp(20px, 3.4vw, 48px) clamp(34px, 5vw, 60px);
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.terminal-prompt {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: clamp(13px, 1.3vw, 16px);
  color: var(--muted);
}
.terminal-prompt-arrow { color: var(--accent); }
.hero h1 {
  font-size: clamp(60px, 14vw, 190px);
  line-height: 0.86;
  font-weight: 700;
  letter-spacing: -0.055em;
  font-family: inherit;
}
.hero-tagline {
  font-size: clamp(22px, 3vw, 40px);
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.03em;
  max-width: 30ch;
  min-height: 2.5em; /* load-bearing: keeps terminal height stable as the role text changes length */
}
.hero-role {
  background: var(--accent);
  color: var(--on-accent);
  padding: 0 0.12em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.hero-caret {
  display: inline-block;
  width: 0.075em;
  height: 0.86em;
  background: var(--on-accent);
  margin-left: 0.06em;
  animation: caretBlink 1s steps(1, end) infinite;
}

/* Writing cards */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 28px;
}
.post-card {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
  text-decoration: none;
  color: var(--fg);
  transition: transform 160ms ease, border-color 160ms ease;
}
.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}
.post-card-thumb {
  position: relative;
  min-height: 170px;
  background: oklch(0.5 0.02 145 / 0.06);
}
.post-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  padding: 28px 30px;
}
.post-card-title {
  font-size: clamp(20px, 2.1vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--fg);
}
.post-card-desc {
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 64ch;
}

@media (max-width: 640px) {
  .post-card { grid-template-columns: 1fr; }
  .post-card-thumb { min-height: 200px; }
}

@media (max-width: 540px) {
  .site-header { flex-wrap: wrap; row-gap: 12px; padding: 18px 0; }
  .wordmark { flex-basis: 100%; }
  .site-nav { width: 100%; justify-content: space-between; gap: 14px; }
}

/* About me */
.about-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 30px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--fg);
}
.about-lead {
  font-size: clamp(21px, 2.2vw, 28px);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.about-body p { text-wrap: pretty; }

/* Experience / education */
.entries { display: flex; flex-direction: column; margin-top: 8px; }

.entry {
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 8px 24px;
  padding: 24px 0;
}
.entry-date {
  font-family: var(--font-label);
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-top: 4px;
}
.entry-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.entry-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.entry-title {
  font-size: clamp(19px, 2vw, 25px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.entry-at { color: var(--muted); font-weight: 500; }
.entry-subtitle { font-size: 17px; font-weight: 600; color: var(--muted); }

.entry-details { /* wraps the native <details> disclosure */ }
.entry-details > summary {
  list-style: none;
  cursor: pointer;
  align-self: flex-start;
  color: var(--accent);
  font-family: var(--font-label);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.entry-details > summary::-webkit-details-marker,
.entry-details > summary::marker { display: none; content: ''; }
.entry-details > summary:hover { color: var(--fg); }
.entry-toggle-marker { display: inline-block; width: 16px; }
.entry-details:not([open]) .when-open { display: none; }
.entry-details[open] .when-closed { display: none; }

.entry-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 22px;
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  max-width: 78ch;
}
.entry-panel p { font-size: 16px; line-height: 1.65; color: var(--fg); text-wrap: pretty; }
.entry-panel h4 {
  margin-top: 6px;
  font-family: var(--font-label);
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.entry-panel p.about-para { color: var(--muted); }

/* Footer */
.site-footer {
  padding-top: clamp(72px, 10vw, 130px);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}
.footer-say {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.footer-headline {
  font-family: var(--font-mono);
  font-size: clamp(30px, 4vw, 56px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}
.footer-icons { display: flex; flex-wrap: wrap; gap: 12px; }
.footer-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg);
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.footer-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}
.footer-icon svg { width: 22px; height: 22px; fill: currentColor; }
.footer-copyright {
  font-family: var(--font-label);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
