:root {
  --bg: #e8e5df;
  --paper: #fffdf8;
  --paper-soft: #f5f1ea;
  --ink: #17242b;
  --muted: #667278;
  --quiet: #8d9899;
  --line: #ddd9d0;
  --accent: #ef6a4f;
  --accent-dark: #c64e39;
  --teal: #1b7774;
  --hero: #172a31;
  --hero-muted: #b5c3c1;
  --radius: 5px;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Geist", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  --bg: #11191d;
  --paper: #1a2529;
  --paper-soft: #202d31;
  --ink: #f2eee6;
  --muted: #b3bfbd;
  --quiet: #879794;
  --line: #354347;
  --hero: #0c171b;
  --hero-muted: #b6c6c2;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55; transition: background-color 180ms ease, color 180ms ease; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.page-shell { width: min(100% - 48px, 1180px); margin: 0 auto; padding: 28px 0 72px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: 100%; margin-bottom: 20px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--ink); border-radius: 50%; color: var(--ink); font-family: var(--mono); font-size: 0.75rem; font-weight: 700; }
.control-group { display: flex; align-items: center; gap: 6px; }
.control-button, .icon-button, .download-button { min-height: 36px; border: 1px solid var(--line); border-radius: 3px; background: transparent; color: var(--ink); cursor: pointer; transition: border-color 160ms ease, background 160ms ease, color 160ms ease; }
.control-button { width: 38px; font-family: var(--mono); font-size: 0.72rem; font-weight: 700; }
.icon-button { width: 38px; font-family: var(--mono); }
.download-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; background: var(--accent); border-color: var(--accent); color: #fffdf8; font-size: 0.82rem; font-weight: 700; }
.icon-button, .download-button, .section-icon, .contact-label { line-height: 0; }
.icon-button .lucide { width: 16px; height: 16px; stroke-width: 2; }
.download-button .lucide { width: 15px; height: 15px; stroke-width: 2.2; }
.control-button:hover, .icon-button:hover { border-color: var(--accent); color: var(--accent-dark); }
.download-button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.control-button.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.resume { overflow: hidden; background: var(--paper); box-shadow: 0 22px 60px rgba(23, 36, 43, 0.12); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 56px; padding: 54px 72px 50px; background: var(--hero); color: #f8f4ec; }
.eyebrow, .section-heading span, .quick-stats dt, .meta, .contact-label { font-family: var(--mono); letter-spacing: 0; }
.eyebrow { margin: 0 0 24px; color: var(--accent); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
h1 { max-width: 940px; margin: 0; font-size: clamp(3rem, 5vw, 4.9rem); line-height: 0.92; letter-spacing: -0.04em; }
.role { margin: 26px 0 0; color: #f6c4b7; font-size: clamp(1.2rem, 2.8vw, 1.65rem); font-weight: 600; }
.summary-lead { max-width: 650px; margin: 24px 0 0; color: var(--hero-muted); font-size: 1rem; }
.hero-panel { align-self: end; display: flex; flex-direction: column; gap: 28px; padding-left: 24px; border-left: 1px solid #4b5b5e; }
.status-badge { width: fit-content; padding: 6px 9px; border-left: 3px solid var(--accent); color: #f8f4ec; font-size: 0.78rem; font-weight: 700; }
.quick-stats { display: grid; gap: 16px; margin: 0; }
.quick-stats div { display: grid; gap: 1px; padding-top: 12px; border-top: 1px solid #3b4b4e; }
.quick-stats dt { color: var(--accent); font-size: 1.25rem; font-weight: 800; }
.quick-stats dd { margin: 0; color: var(--hero-muted); font-size: 0.78rem; }

.contact-strip { display: grid; grid-template-columns: 1fr 1.1fr 1.2fr 1.35fr 1.15fr 1fr; border-bottom: 1px solid var(--line); background: var(--paper-soft); }
.contact-item { min-width: 0; padding: 17px 20px; border-right: 1px solid var(--line); }
.contact-item:last-child { border-right: 0; }
.contact-label { display: flex; align-items: center; gap: 5px; margin-bottom: 7px; color: var(--teal); font-size: 0.63rem; font-weight: 700; text-transform: uppercase; }
.contact-label { line-height: 1.2; }
.contact-label .lucide { width: 12px; height: 12px; stroke-width: 2.2; }
.contact-value { display: block; overflow-wrap: anywhere; color: var(--ink); font-size: 0.78rem; font-weight: 700; }
.contact-item a:hover, .project-card a:hover { color: var(--accent-dark); }

.content-grid { display: grid; grid-template-columns: 275px minmax(0, 1fr); gap: 68px; padding: 56px 72px 72px; }
.section-block { break-inside: avoid; }
.section-block + .section-block { margin-top: 48px; }
.section-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 22px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.section-heading span { color: var(--accent); font-size: 0.72rem; font-weight: 800; }
.section-icon { width: 16px; height: 16px; color: var(--accent); stroke-width: 2.3; }
.section-heading p { margin: 0; color: var(--ink); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }

.skills-stack { display: grid; gap: 24px; }
.skill-group h3, .compact-card h3, .project-card h3, .timeline-item h3 { margin: 0; color: var(--ink); }
.skill-group h3 { margin-bottom: 9px; color: var(--teal); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 5px; min-height: 25px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 3px; background: transparent; color: var(--muted); font-size: 0.72rem; font-weight: 600; }
.pill img { display: block; width: 13px; height: 13px; object-fit: contain; }
.pill .skill-fallback { width: 13px; height: 13px; color: var(--accent); stroke-width: 2; }
.compact-list, .language-list { display: grid; gap: 17px; }
.compact-card, .language-card { padding-bottom: 16px; border-bottom: 1px solid var(--line); break-inside: avoid; }
.compact-card h3 { font-size: 0.88rem; line-height: 1.3; }
.compact-card p, .language-card p { margin: 4px 0 0; color: var(--muted); font-size: 0.78rem; }
.language-card { display: flex; justify-content: space-between; gap: 10px; }
.language-card p { margin: 0; color: var(--teal); font-weight: 700; }

.timeline { display: grid; gap: 36px; }
.timeline-item { position: relative; padding-left: 28px; break-inside: avoid; }
.timeline-item::before { content: ""; position: absolute; top: 7px; left: 0; width: 10px; height: 10px; border: 2px solid var(--accent); border-radius: 50%; background: var(--paper); }
.timeline-item::after { content: ""; position: absolute; top: 24px; bottom: -34px; left: 5px; width: 1px; background: var(--line); }
.timeline-item:last-child::after { display: none; }
.timeline-top { display: flex; justify-content: space-between; gap: 20px; }
.timeline-item h3 { font-size: 1.1rem; line-height: 1.25; }
.company { margin: 4px 0 0; color: var(--teal); font-size: 0.86rem; font-weight: 800; }
.company-identity { display: inline-flex; align-items: center; gap: 8px; }
.company-logo { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 28px; height: 28px; padding: 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--accent); font-family: var(--mono); font-size: 0.58rem; font-weight: 800; }
.company-logo img { display: block; width: 18px; height: 18px; object-fit: contain; }
.company-logo-wide { min-width: 48px; }
.company-logo-wide img { width: 42px; height: 18px; }
.meta { margin: 0; color: var(--quiet); font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.achievement-list { margin: 13px 0 0; padding-left: 18px; color: var(--muted); font-size: 0.88rem; }
.achievement-list li + li { margin-top: 7px; }
.stack-line { margin: 14px 0 0; color: var(--quiet); font-family: var(--mono); font-size: 0.68rem; line-height: 1.6; }

.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.project-card { display: grid; gap: 11px; min-height: 100%; padding: 20px 0 3px; border-top: 3px solid var(--teal); break-inside: avoid; }
.project-card h3 { font-size: 0.98rem; line-height: 1.25; }
.project-card p { margin: 0; color: var(--muted); font-size: 0.84rem; }
.project-card a { color: var(--accent-dark); font-size: 0.76rem; font-weight: 800; }
:focus-visible { outline: 3px solid rgba(239, 106, 79, 0.45); outline-offset: 3px; }

@media (max-width: 900px) {
  .page-shell { width: min(100% - 28px, 720px); padding-top: 14px; }
  .hero, .content-grid { grid-template-columns: 1fr; }
  .hero { gap: 34px; padding: 42px 36px; }
  .hero-panel { align-self: start; padding: 20px 0 0; border-top: 1px solid #4b5b5e; border-left: 0; }
  .quick-stats { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .content-grid { gap: 48px; padding: 42px 36px 56px; }
  .side-column { display: grid; grid-template-columns: 1fr 1fr; gap: 38px; }
  .side-column .section-block + .section-block { margin-top: 0; }
  .side-column .section-block:first-child { grid-column: 1 / -1; }
  .contact-strip { grid-template-columns: repeat(3, 1fr); }
  .contact-item:nth-child(3), .contact-item:nth-child(6) { border-right: 0; }
  .contact-item:nth-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .contact-item:nth-child(n + 4) { border-bottom: 0; }
}

@media (max-width: 600px) {
  .page-shell { width: min(100% - 20px, 520px); }
  .topbar { align-items: flex-start; }
  .control-group { flex-wrap: wrap; justify-content: flex-end; }
  .download-button { width: 100%; }
  .hero { padding: 40px 24px; }
  h1 { font-size: 3.25rem; }
  .quick-stats { grid-template-columns: 1fr; }
  .content-grid { padding: 36px 24px 48px; }
  .side-column { display: block; }
  .side-column .section-block + .section-block { margin-top: 38px; }
  .contact-strip { grid-template-columns: 1fr 1fr; }
  .contact-item { padding: 14px 15px; }
  .contact-item:nth-child(3) { border-right: 1px solid var(--line); }
  .contact-item:nth-child(4), .contact-item:nth-child(6) { border-right: 0; }
  .contact-item:nth-child(-n + 4) { border-bottom: 1px solid var(--line); }
  .contact-item:nth-child(n + 5) { border-bottom: 0; }
  .timeline-top, .language-card { display: grid; gap: 4px; }
  .meta { white-space: normal; }
  .project-grid { grid-template-columns: 1fr; }
}

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

@page { size: A4; margin: 11mm 12mm; }
@media print {
  :root, html[data-theme="dark"] { --bg: #fff; --paper: #fff; --paper-soft: #fff; --ink: #17242b; --muted: #435057; --quiet: #697579; --line: #cfd5d3; --hero: #fff; --hero-muted: #435057; --accent: #c64e39; --teal: #1b7774; }
  html, body { background: #fff !important; color: #17242b !important; font-size: 9.5pt; }
  .no-print { display: none !important; }
  .page-shell { width: 100%; padding: 0; }
  .resume { box-shadow: none; }
  .hero { color: #17242b; border-bottom: 2px solid #17242b; }
  .role { color: #c64e39; }
  .status-badge { color: #17242b; }
  .quick-stats div { border-top-color: #cfd5d3; }
  .hero { grid-template-columns: 1fr 175px; gap: 18px; padding: 0 0 7mm; }
  h1 { font-size: 27pt; line-height: 0.9; }
  .eyebrow { margin-bottom: 12px; font-size: 6.5pt; }
  .role { margin-top: 12px; font-size: 11.5pt; }
  .summary-lead { margin-top: 8px; font-size: 8.3pt; line-height: 1.4; }
  .hero-panel { gap: 14px; padding-left: 14px; }
  .status-badge { font-size: 7pt; }
  .quick-stats { gap: 8px; }
  .quick-stats div { padding-top: 7px; }
  .quick-stats dt { font-size: 10.5pt; }
  .quick-stats dd { font-size: 6.8pt; }
  .contact-strip { grid-template-columns: repeat(6, 1fr); }
  .contact-item { padding: 6px 7px; }
  .contact-label { margin-bottom: 2px; font-size: 5.8pt; }
  .contact-label .lucide { width: 9px; height: 9px; }
  .contact-value { font-size: 6.8pt; }
  .content-grid { grid-template-columns: 27% 1fr; gap: 6mm; padding: 6mm 0 0; }
  .content-grid .section-heading { margin-bottom: 12px; padding-bottom: 6px; }
  .section-heading p { font-size: 7pt; }
  .skills-stack { gap: 13px; }
  .pill { min-height: 19px; padding: 2px 5px; font-size: 6.6pt; }
  .pill img { width: 9px; height: 9px; }
  .pill .skill-fallback { width: 9px; height: 9px; }
  .compact-list, .language-list { gap: 9px; }
  .compact-card, .language-card { padding-bottom: 8px; }
  .compact-card h3 { font-size: 7.6pt; }
  .compact-card p, .language-card p { margin-top: 2px; font-size: 6.8pt; }
  .timeline { gap: 18px; }
  .timeline-item { padding-left: 18px; }
  .timeline-item h3 { font-size: 9pt; }
  .company { margin-top: 2px; font-size: 7.4pt; }
  .company-logo { min-width: 21px; height: 21px; padding: 3px; }
  .company-logo img { width: 13px; height: 13px; }
  .company-logo-wide { min-width: 36px; }
  .company-logo-wide img { width: 30px; height: 13px; }
  .company-identity { gap: 5px; }
  .meta { font-size: 6.4pt; }
  .achievement-list { margin-top: 7px; font-size: 7.5pt; line-height: 1.35; }
  .achievement-list li + li { margin-top: 3px; }
  .stack-line { margin-top: 7px; font-size: 6.2pt; }
  .section-block { break-inside: auto; page-break-inside: auto; }
  .section-heading, .timeline-item, .project-card, .compact-card, .language-card { break-inside: avoid; page-break-inside: avoid; }
  .main-column, .side-column { break-inside: auto; page-break-inside: auto; }
  .timeline-item, .project-card, .compact-card, .language-card { orphans: 3; widows: 3; }
  .section-block + .section-block { margin-top: 5mm; }
  .project-grid { grid-template-columns: 1fr 1fr; }
  a::after { content: ""; }
}
