*, *::before, *::after { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --bg: #0f0f10;
  --surface: #161618;
  --surface-2: #1d1d20;
  --ink: #f4f4f5;
  --muted: #a5a5ad;
  --line: rgba(255,255,255,0.13);
  --line-strong: rgba(255,255,255,0.24);
  --cyan: #56d7ca;
  --blue: #8eb7ff;
  --amber: #f0bb62;
  --rose: #e48caa;
  --shadow: 0 14px 34px rgba(0,0,0,0.24);
  --shell: 1180px;
}
html { min-height: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; min-height: 100svh; margin: 0; min-width: 320px; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.65; }
body > main { flex: 1 0 auto; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, #000, transparent 72%); }
a { color: inherit; }
img { max-width: 100%; }
button, a { -webkit-tap-highlight-color: transparent; }
.shell { width: min(calc(100% - 40px), var(--shell)); margin-inline: auto; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 999; transform: translateY(-150%); padding: 10px 14px; background: var(--ink); color: var(--bg); }
.skip-link:focus { transform: translateY(0); }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin-top: 0; line-height: 1.12; letter-spacing: 0; }
h1 { font-size: clamp(3.2rem, 9vw, 6.6rem); }
h2 { font-size: clamp(2rem, 4vw, 3.1rem); }
h3 { font-size: 1.1rem; }
p { margin: 0; }
.card-index, .project-number, .timeline-date, .education-date, .case-number, .tag-row span { font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace; }

.hero { max-width: 860px; padding: 94px 0 64px; text-align: left; }
.hero h1 { margin-bottom: 8px; }
.hero-role { color: var(--ink); font-size: clamp(1rem, 2vw, 1.2rem); font-weight: 650; }
.hero-copy { max-width: 720px; margin: 24px 0 0; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.24rem); }
.hero-actions { display: flex; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 11px 18px; margin-top: 30px; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: 6px; padding: 9px 16px; color: var(--ink); font-weight: 750; text-decoration: none; transition: 160ms ease; }
.button.primary { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.button.secondary { background: rgba(255,255,255,0.035); }
.button:hover { transform: translateY(-1px); border-color: var(--cyan); }
.button.small { min-height: 38px; padding: 7px 12px; font-size: 0.82rem; }
.text-link { color: var(--cyan); font-weight: 750; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.tab-nav { position: sticky; top: 0; z-index: 30; display: flex; justify-content: center; gap: 5px; padding: 24px 0 34px; background: rgba(15,15,16,0.92); backdrop-filter: blur(16px); }
.tab-button { min-height: 40px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 18px; background: rgba(255,255,255,0.025); color: var(--muted); font: inherit; font-size: 0.82rem; font-weight: 750; cursor: pointer; }
.tab-button:hover { color: var(--ink); border-color: var(--line-strong); }
.tab-button.active { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.tab-panel { min-height: 480px; padding: 44px 0 92px; }
.tab-panel[hidden] { display: none; }
.section-header { margin-bottom: 34px; }
.section-header > p:last-child { max-width: 700px; color: var(--muted); }
.split-header { display: flex; justify-content: space-between; align-items: end; gap: 24px; }

.card-grid { display: grid; gap: 18px; }
.four-up { grid-template-columns: repeat(4, 1fr); }
.card, .project-card, .education-card, .skill-groups article { border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,0.025); box-shadow: var(--shadow); }
.card { min-height: 225px; border-top: 3px solid var(--cyan); padding: 24px; }
.card.accent-blue { border-top-color: var(--blue); }
.card.accent-amber { border-top-color: var(--amber); }
.card.accent-rose { border-top-color: var(--rose); }
.card-index { color: var(--muted); font-size: 0.72rem; }
.card h3 { margin: 24px 0 10px; }
.card p:last-child, .project-card > p, .timeline article > div > p:last-child, .education-card p, .skill-groups p { color: var(--muted); font-size: 0.9rem; }
.project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.project-card { padding: 27px; }
.project-card header { display: grid; grid-template-columns: 34px 1fr; gap: 10px; }
.project-number { color: var(--cyan); font-size: 0.72rem; }
.project-card h3 { font-size: 1.35rem; }
.project-card ul { padding-left: 20px; color: #d5d5da; font-size: 0.87rem; }
.project-card li + li { margin-top: 7px; }
.project-outbound { margin-top: 20px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.tag-row span { border: 1px solid rgba(142,183,255,0.22); border-radius: 999px; padding: 3px 9px; color: var(--blue); background: rgba(142,183,255,0.06); font-size: 0.65rem; }

.timeline { border-top: 1px solid var(--line); }
.timeline article { display: grid; grid-template-columns: 210px 1fr; gap: 42px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.timeline-date, .education-date { color: var(--cyan); font-size: 0.76rem; }
.timeline-company { margin: -4px 0 10px; color: var(--blue); font-weight: 700; }
.education-card { padding: 30px; }
.education-card h3 { margin: 8px 0; font-size: 1.65rem; }
.education-card .degree { color: var(--ink); font-weight: 700; }
.skill-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.skill-groups article { padding: 25px; }
.skill-groups article:nth-child(1) h3 { color: var(--cyan); }
.skill-groups article:nth-child(2) h3 { color: var(--blue); }
.skill-groups article:nth-child(3) h3 { color: var(--amber); }
.skill-groups article:nth-child(4) h3 { color: var(--rose); }

.site-footer { margin-top: auto; border-top: 1px solid var(--line); background: #0a0a0b; }
.footer-inner { min-height: 130px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.footer-inner p { color: var(--muted); }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-inner nav a { color: var(--muted); font-weight: 700; text-decoration: none; }
.footer-inner nav a:hover { color: var(--cyan); }

/* Portfolio */
.portfolio-header { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--line); background: rgba(15,15,16,0.92); backdrop-filter: blur(16px); }
.header-inner { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.wordmark span { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--cyan); border-radius: 5px; color: var(--cyan); font-family: "JetBrains Mono", Consolas, monospace; font-size: 0.72rem; }
.header-inner nav { display: flex; align-items: center; gap: 18px; }
.header-inner nav > a:not(.button) { color: var(--muted); font-size: 0.82rem; font-weight: 700; text-decoration: none; }
.header-inner nav > a:hover { color: var(--cyan); }
.portfolio-hero { padding: 84px 0 74px; border-bottom: 1px solid var(--line); background: var(--surface); }
.portfolio-hero h1 { max-width: 900px; margin-bottom: 22px; font-size: clamp(3rem, 8vw, 5.5rem); }
.portfolio-hero > .shell > p:last-child { max-width: 760px; color: var(--muted); font-size: 1.14rem; }
.case-study { padding: 92px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 66px; }
.case-grid { display: grid; grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.28fr); gap: 72px; }
.case-grid > header { position: sticky; top: 105px; align-self: start; }
.case-number { color: var(--cyan); font-size: 0.72rem; letter-spacing: 0.1em; }
.case-grid > header h2 { margin-top: 12px; font-size: clamp(1.8rem, 3.5vw, 2.75rem); }
.case-body h3 { margin: 34px 0 9px; color: var(--blue); font-size: 0.77rem; letter-spacing: 0.1em; text-transform: uppercase; }
.case-body h3:first-child { margin-top: 0; }
.case-body > p { color: var(--muted); }
.case-evidence { margin-top: 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.case-evidence div { min-height: 116px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--line); border-radius: 6px; padding: 17px; background: var(--surface); }
.case-evidence strong { color: var(--amber); font-family: "JetBrains Mono", Consolas, monospace; font-size: 1.28rem; }
.case-evidence span { margin-top: 4px; color: var(--muted); font-size: 0.76rem; }
.evidence-figure { margin: 30px 0 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.evidence-figure img { width: 100%; height: auto; display: block; object-fit: contain; }
.evidence-figure figcaption { padding: 11px 15px; color: var(--muted); font-size: 0.78rem; }
.error-page { min-height: calc(100vh - 130px); display: grid; place-items: center; text-align: center; }

@media (max-width: 940px) {
  .four-up { grid-template-columns: repeat(2, 1fr); }
  .case-grid { grid-template-columns: 1fr; gap: 38px; }
  .case-grid > header { position: static; }
  .header-inner nav a:not(.button):not(:first-child) { display: none; }
}
@media (max-width: 680px) {
  .shell { width: min(calc(100% - 28px), var(--shell)); }
  .hero { padding-top: 60px; }
  .hero h1 { font-size: clamp(3rem, 18vw, 4.8rem); }
  .hero-actions .button { width: 100%; }
  .tab-nav { justify-content: center; flex-wrap: wrap; padding: 18px 0 24px; }
  .tab-button { flex: 0 0 auto; padding-inline: 14px; }
  .tab-panel { padding-top: 30px; }
  .four-up, .project-grid, .skill-groups { grid-template-columns: 1fr; }
  .split-header, .timeline article, .footer-inner { grid-template-columns: 1fr; flex-direction: column; align-items: flex-start; }
  .timeline article { gap: 9px; }
  .header-inner nav a:not(.button) { display: none; }
  .portfolio-hero { padding-block: 62px; }
  .portfolio-hero h1 { font-size: clamp(2.7rem, 15vw, 4.5rem); }
  .case-study { padding-block: 64px; }
  .case-evidence { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
@media print {
  body { background: #fff; color: #000; }
  body::before, .tab-nav, .site-footer, .portfolio-header { display: none; }
  .tab-panel[hidden] { display: block; }
  .tab-panel { min-height: 0; padding-block: 20px; }
  .card, .project-card, .education-card, .skill-groups article { box-shadow: none; }
}
