/* =========================================================
   THEME
   ========================================================= */
:root {
  --bg: #f6f1e7;            /* warm cream */
  --bg-alt: #efe8d8;        /* slightly deeper cream for cards */
  --fg: #1a1815;            /* near-black warm */
  --fg-soft: #4a463f;
  --muted: #8a8378;
  --accent: #c8553d;        /* terracotta */
  --accent-deep: #9b3d29;
  --accent-soft: #f3dcd4;
  --rule: #d9cfba;
  --chip-bg: #ebe2cd;
  --chip-fg: #4a463f;
  --shadow: 0 1px 0 rgba(26, 24, 21, 0.04), 0 4px 14px rgba(26, 24, 21, 0.06);

  --font-sans: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --max-width: 980px;
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
}

[data-theme="dark"] {
  --bg: #15130f;
  --bg-alt: #1e1b16;
  --fg: #f3ecdd;
  --fg-soft: #c5bda9;
  --muted: #8a8378;
  --accent: #e57a5a;
  --accent-deep: #ff9776;
  --accent-soft: #3a201a;
  --rule: #2c2820;
  --chip-bg: #25221c;
  --chip-fg: #c5bda9;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.4);
}

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

html, body { margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

::selection { background: var(--accent); color: #fff; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
a:hover { color: var(--accent-deep); border-bottom-color: currentColor; }

p { margin: 0 0 0.8em; }
em { font-style: normal; color: var(--accent); font-weight: 600; }
strong { font-weight: 600; }

h1, h2, h3, h4 { letter-spacing: -0.02em; line-height: 1.1; margin: 0; }

ul { list-style: none; padding: 0; margin: 0; }

/* =========================================================
   PAGE WRAPPER
   ========================================================= */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 1.6rem 4rem;
}

.block {
  margin-top: 4.5rem;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--rule);
}

.block-head h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  font-weight: 700;
}

.block-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

/* =========================================================
   TOOLBAR
   ========================================================= */
.toolbar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  display: flex;
  gap: 0.5rem;
}

.toolbar button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.5rem 0.85rem;
  background: var(--bg-alt);
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.toolbar button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
#theme-toggle { padding: 0.4rem 0.65rem; }
.theme-icon { font-size: 1rem; line-height: 1; }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  padding-top: 1rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-soft);
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin: 0 0 1.6rem;
  letter-spacing: 0.01em;
}
.dot {
  width: 0.55rem;
  height: 0.55rem;
  background: #2ea043;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(46, 160, 67, 0.18);
}

.hero-name {
  font-size: clamp(3rem, 10vw, 6.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0;
}
.hero-name::after {
  content: ".";
  color: var(--accent);
}

.hero-subtitle {
  font-family: var(--font-mono);
  font-size: clamp(0.85rem, 1.2vw, 0.95rem);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 1.1rem 0 0;
  font-weight: 500;
}

.hero-tagline {
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  color: var(--fg-soft);
  max-width: 36ch;
  margin: 1rem 0 2.2rem;
  font-weight: 400;
  line-height: 1.35;
}
.hero-tagline br { display: block; }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 1.4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.7rem 1.1rem;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: #fff5e1 !important;
}
.btn-primary:hover {
  background: var(--accent-deep);
  border-bottom-color: transparent;
  color: #fff !important;
}
.btn-ghost {
  background: transparent;
  color: var(--fg) !important;
  border-color: var(--rule);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
  font-size: 0.88rem;
  font-family: var(--font-mono);
}
.hero-links a {
  color: var(--fg-soft);
}
.hero-links a:hover { color: var(--accent); }

/* =========================================================
   STATS
   ========================================================= */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 4rem;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stat {
  background: var(--bg-alt);
  padding: 1.5rem 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.stat strong {
  font-size: clamp(2.4rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.04em;
  display: inline-flex;
  align-items: baseline;
}
.stat strong sup,
.stat strong sub {
  font-size: 0.45em;
  font-weight: 700;
  color: var(--accent-deep);
  margin-left: 0.1em;
  line-height: 1;
}
.stat span {
  font-size: 0.85rem;
  color: var(--fg-soft);
  line-height: 1.35;
}

/* =========================================================
   ABOUT (lead text)
   ========================================================= */
.about-block .lead {
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--fg-soft);
  max-width: 64ch;
}
.about-block .lead:first-of-type {
  font-size: 1.25rem;
  color: var(--fg);
}

/* =========================================================
   EXPERIENCE
   ========================================================= */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.exp {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1.5rem;
  padding: 1.4rem 1.4rem;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  position: relative;
  transition: transform .15s ease, border-color .15s ease;
}
.exp:hover { border-color: var(--accent); }

.exp-when {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  border-right: 1px solid var(--rule);
  padding-right: 1.2rem;
}
.exp-period { font-weight: 500; color: var(--fg); }
.exp-place { color: var(--muted); }

.exp-body { min-width: 0; }

.exp-role {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}
.exp-role .at {
  color: var(--muted);
  font-weight: 400;
  margin: 0 0.15em;
}
.exp-role .company {
  color: var(--accent);
  font-weight: 700;
}

.exp p {
  color: var(--fg-soft);
  font-size: 0.96rem;
  line-height: 1.55;
}

.exp-highlight {
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg-alt) 60%);
  border-color: var(--accent);
}
.exp-callout {
  font-size: 1.02rem !important;
  color: var(--fg) !important;
  font-weight: 500;
}

.exp-bullets {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.exp-bullets li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--fg-soft);
}
.exp-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 0.45rem;
  height: 0.45rem;
  background: var(--accent);
  border-radius: 50%;
}
.exp-bullets strong {
  color: var(--fg);
  font-weight: 600;
}

/* =========================================================
   CHIPS
   ========================================================= */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.9rem;
  margin-bottom: 0;
}
.chips span {
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  padding: 0.25rem 0.55rem;
  background: var(--chip-bg);
  color: var(--chip-fg);
  border-radius: var(--r-sm);
  letter-spacing: 0.01em;
}
.chips-strong span {
  background: var(--accent);
  color: #fff5e1;
}

/* =========================================================
   FEATURED PROJECT
   ========================================================= */
.feature {
  padding: 1.8rem;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
}
.feature::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
}

.feature-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.8rem;
}
.feature-head h3 {
  font-size: 1.5rem;
  font-weight: 700;
}
.feature-link {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.feature > p {
  color: var(--fg-soft);
  max-width: 64ch;
  margin-bottom: 1.6rem;
}

.games {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}
.game {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.game-status {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.15rem 0.45rem;
  border-radius: var(--r-sm);
  margin-bottom: 0.2rem;
}
.game h4 {
  font-size: 1rem;
  font-weight: 700;
}
.game p {
  font-size: 0.85rem;
  color: var(--fg-soft);
  line-height: 1.45;
  margin: 0;
}

/* =========================================================
   STACK
   ========================================================= */
.stack {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
}
.stack-group {
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 1.1rem 1.2rem;
}
.stack-group h4 {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.7rem;
}
.stack-group .chips { margin-top: 0; }

/* =========================================================
   PRINCIPLES
   ========================================================= */
.principles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.2rem;
}
.principle {
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 1.1rem 1.2rem;
  border-left: 3px solid var(--accent);
}
.principle h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.principle p {
  font-size: 0.92rem;
  color: var(--fg-soft);
  margin: 0;
}

/* =========================================================
   HIRING
   ========================================================= */
.hire-block .hire-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
}
.hire-grid h4 {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}
.hire-grid p {
  font-size: 0.92rem;
  color: var(--fg);
  margin: 0;
}
.hire-cta {
  margin-top: 1.6rem;
  font-size: 1.05rem;
  color: var(--fg-soft);
}

/* =========================================================
   PERSONAL / FOOTER
   ========================================================= */
.personal-block p {
  font-size: 1rem;
  color: var(--fg-soft);
  max-width: 60ch;
}

.footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 820px) {
  .page { padding: 4rem 1.2rem 3rem; }
  .block { margin-top: 3.2rem; }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats .stat:nth-child(odd) { border-right: 1px solid var(--rule); }

  .exp {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 1.2rem;
  }
  .exp-when {
    flex-direction: row;
    gap: 0.6rem;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding-right: 0;
    padding-bottom: 0.7rem;
  }

  .games { grid-template-columns: 1fr; }
  .stack { grid-template-columns: 1fr; }
  .principles { grid-template-columns: 1fr; }
  .hire-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .page { padding: 3.5rem 1rem 3rem; }
  .stats { grid-template-columns: 1fr; }
  .stat { padding: 1.2rem 1rem; }
  .hire-grid { grid-template-columns: 1fr; }
  .feature { padding: 1.3rem; }
}

/* =========================================================
   PRINT — ATS-friendly single column
   ========================================================= */
@media print {
  :root {
    --bg: #fff;
    --bg-alt: #fff;
    --fg: #000;
    --fg-soft: #1a1a1a;
    --muted: #555;
    --accent: #000;
    --accent-deep: #000;
    --accent-soft: transparent;
    --rule: #999;
    --chip-bg: transparent;
    --chip-fg: #333;
    --shadow: none;
  }

  html, body { background: #fff !important; color: #000 !important; }

  .no-print { display: none !important; }

  .page {
    max-width: 100%;
    padding: 0;
    font-size: 10.2pt;
    line-height: 1.4;
  }

  .block { margin-top: 0.9rem; page-break-inside: avoid; }

  .block-head { margin-bottom: 0.4rem; padding-bottom: 0.25rem; border-bottom: 1px solid #bbb; }
  .block-head h2 { font-size: 12.5pt; font-weight: 700; }
  .block-meta { display: none; }

  /* Hero — compact header */
  .hero { padding-top: 0; }
  .status {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    color: #555 !important;
    font-size: 9pt !important;
  }
  .dot { display: none; }
  .hero-name {
    font-size: 20pt;
    line-height: 1;
    margin: 0.3rem 0 0.2rem;
  }
  .hero-name::after { content: ""; }
  .hero-name br { display: none; }
  .hero-name::before { content: ""; }
  .hero-subtitle {
    color: #000 !important;
    font-size: 9pt !important;
    margin: 0.2rem 0 0.2rem !important;
    letter-spacing: 0.08em;
  }
  .hero-tagline {
    font-size: 10.5pt;
    margin: 0.2rem 0 0.5rem;
    color: #000;
    max-width: none;
  }
  .hero-tagline br { display: none; }
  .hero-cta { display: none; }
  .hero-links {
    margin-top: 0.3rem;
    gap: 0.2rem 0.8rem;
    font-family: var(--font-sans);
    font-size: 9.5pt;
  }
  .hero-links a { color: #000 !important; }
  .hero-links a::after {
    content: " (" attr(href) ")";
    color: #555;
    font-size: 0.85em;
  }
  /* hide redundant labels — let the URL itself speak */
  .hero-links li { list-style: none; }

  /* Stats — slim row, no card chrome */
  .stats {
    grid-template-columns: repeat(4, 1fr);
    background: transparent !important;
    border: 1px solid #bbb !important;
    border-radius: 0;
    box-shadow: none !important;
    margin-top: 0.8rem;
  }
  .stat {
    background: transparent !important;
    padding: 0.5rem 0.6rem;
    border-right: 1px solid #ddd;
  }
  .stat:last-child { border-right: none; }
  .stat strong {
    font-size: 14pt;
    color: #000 !important;
  }
  .stat span { font-size: 8.5pt; color: #444; }

  /* About */
  .about-block .lead {
    font-size: 10pt;
    color: #000;
    max-width: none;
  }

  /* Experience — flatten cards into one column */
  .exp {
    grid-template-columns: 6rem 1fr;
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid #ddd !important;
    border-radius: 0;
    padding: 0.45rem 0 0.5rem !important;
    gap: 0.7rem;
    margin-bottom: 0;
  }
  .exp-when {
    border-right: none !important;
    padding-right: 0 !important;
    font-size: 9pt;
  }
  .exp-role { font-size: 10.5pt; margin-bottom: 0.2rem; }
  .exp-role .company { color: #000 !important; }
  .exp p { font-size: 9.8pt; margin-bottom: 0.25rem; }
  .exp-callout { font-size: 10pt !important; }

  .exp-bullets {
    margin: 0.2rem 0 0.25rem;
    gap: 0.2rem;
  }
  .exp-bullets li {
    font-size: 9.5pt;
    color: #000;
    padding-left: 0.7rem;
  }
  .exp-bullets li::before {
    background: #000 !important;
    width: 0.2rem;
    height: 0.2rem;
    top: 0.55em;
  }

  /* Chips — plain comma list in print */
  .chips {
    margin-top: 0.2rem;
    gap: 0.2rem 0.35rem;
    font-size: 8.8pt;
  }
  .chips span {
    background: transparent !important;
    color: #444 !important;
    padding: 0 !important;
    font-family: var(--font-sans);
  }
  .chips span:not(:last-child)::after { content: " ·"; color: #aaa; }

  /* Feature project */
  .feature {
    background: transparent !important;
    border: 1px solid #ccc !important;
    padding: 0.7rem !important;
    box-shadow: none !important;
  }
  .feature::before { display: none; }
  .feature-head h3 { font-size: 11pt; }
  .feature-link::after {
    content: " (" attr(href) ")";
    color: #555;
    font-size: 0.85em;
  }
  .feature-link { color: #000 !important; font-size: 9pt; }
  .feature > p { margin-bottom: 0.5rem; font-size: 9.5pt; }
  .games { grid-template-columns: 1fr 1fr 1fr; gap: 0.4rem; }
  .game {
    background: transparent !important;
    border: 1px solid #ddd !important;
    padding: 0.4rem 0.55rem !important;
  }
  .game h4 { font-size: 9.5pt; }
  .game p { font-size: 8.8pt; }
  .game-status { background: transparent !important; padding: 0 !important; color: #555 !important; font-size: 7.5pt; }

  /* Stack — two columns */
  .stack { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .stack-group {
    background: transparent !important;
    border: none !important;
    border-bottom: 1px dotted #ccc !important;
    padding: 0.25rem 0 0.4rem !important;
    border-radius: 0;
  }
  .stack-group h4 { font-size: 8.8pt; margin-bottom: 0.2rem; }

  /* Principles — two columns, no card chrome */
  .principles { grid-template-columns: 1fr 1fr; gap: 0.4rem 0.7rem; }
  .principle {
    background: transparent !important;
    border: none !important;
    border-left: 2px solid #000 !important;
    padding: 0.15rem 0 0.15rem 0.6rem !important;
    border-radius: 0;
  }
  .principle h4 { font-size: 9.8pt; }
  .principle p { font-size: 9.2pt; }

  /* Hiring */
  .hire-grid { grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
  .hire-grid h4 { font-size: 8.8pt; }
  .hire-grid p { font-size: 9.2pt; }
  .hire-cta { font-size: 9.5pt; margin-top: 0.5rem; }

  a { color: #000 !important; border-bottom: none !important; }
  a[href^="http"]::after, a[href^="mailto:"]::after {
    content: " (" attr(href) ")";
    color: #555;
    font-size: 0.85em;
    word-break: break-all;
  }
  /* Suppress URL expansion where it'd be noisy */
  .hire-cta a::after { content: ""; }
}
