/* White Editorial + Muted Gold — see DESIGN.md */
:root {
    --bg: #FFFFFF; --bg-subtle: #F8F8F6;
    --text: #1C1C1A; --text-muted: #62625D;
    --border: #E6E5DF; --border-hover: #D6D4CC; --accent: #8A6B20;
    --radius: 10px; --container: 1080px; --reading: 680px;
    --ease: 180ms ease-out;
    --font-sans: "Geist", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 17px/1.65 var(--font-sans);
    -webkit-font-smoothing: antialiased;
}
:lang(th) { line-height: 1.8; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color var(--ease); }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* Type */
h1 { font-size: 60px; font-weight: 600; line-height: 1.05; letter-spacing: -0.03em; max-width: 920px; }
h2 { font-size: 32px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 12px; }
h3 { font-size: 20px; font-weight: 600; line-height: 1.35; }
.label {
    font: 500 12px/1.5 var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.label .dot { color: var(--accent); font-size: 8px; vertical-align: 2px; margin-right: 6px; }
.intro, .lead { color: var(--text-muted); max-width: var(--reading); }

/* Nav */
.nav {
    position: sticky; top: 0; z-index: 10;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(1.2) blur(6px);
    border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.nav-name { color: var(--text); font-weight: 600; font-size: 17px; }
.nav-name:hover { text-decoration: none; }
.nav-name .dot { color: var(--accent); }
.nav-links { display: flex; gap: 28px; }
.nav-links a { color: var(--text-muted); font-size: 15px; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--accent); }
.nav-toggle { display: none; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    height: 40px; padding: 0 16px;
    border-radius: 8px; border: 1px solid var(--text);
    font: 500 15px/1 var(--font-sans);
    transition: background var(--ease), border-color var(--ease);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--text); color: #fff; }
.btn-primary:hover { background: #000; border-color: #000; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-subtle); border-color: var(--border-hover); }

/* Hero */
.hero { padding: 120px 0 96px; }
.hero h1 { margin-bottom: 24px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 24px; }
.meta { font-size: 14px; color: var(--text-muted); }

/* Sections */
.section { padding: 96px 0; border-top: 1px solid var(--border); }
.section h2 + .metrics, .section h2 + .timeline, .section h2 + .expertise { margin-top: 32px; }
.section .intro { margin-bottom: 32px; }

/* Impact */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); }
.metric { padding: 0 24px; border-left: 1px solid var(--border); }
.metric:first-child { padding-left: 0; border-left: 0; }
.metric-num { font-size: 40px; font-weight: 600; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; margin-bottom: 8px; }
.metric-label { font-size: 14px; font-weight: 500; line-height: 1.45; margin-bottom: 8px; }
.metric-context { font-size: 14px; line-height: 1.5; color: var(--text-muted); }

/* Case studies: the one place cards are used */
.case {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    transition: border-color var(--ease), box-shadow var(--ease);
}
.case + .case { margin-top: 16px; }
.case:hover { border-color: var(--border-hover); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.case-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin-bottom: 20px; }
.case-meta { font: 400 13px/1.5 var(--font-mono); color: var(--text-muted); }
.case-body { display: grid; grid-template-columns: 160px 1fr; gap: 12px 24px; max-width: 880px; }
.case-body dt { font: 500 12px/1.9 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding-top: 2px; }
.case-body dd { font-size: 16px; }
.case-body strong { color: var(--accent); font-weight: 600; }
.case-body code { font: 400 14px var(--font-mono); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.tags { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    font: 400 12px/1.5 var(--font-mono);
    color: var(--text-muted);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 8px;
}

/* Open source: plain columns with thin rules, no cards */
.oss { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.oss li { border-top: 1px solid var(--border); padding-top: 16px; }
.oss h3 { font-size: 18px; }
.oss .case-meta { margin: 4px 0 12px; }
.oss li > p:not([class]) { font-size: 16px; }
.oss .tags { margin-top: 16px; }
.oss-more { margin-top: 32px; }

/* Experience */
.job { display: grid; grid-template-columns: 3fr 9fr; gap: 24px; padding: 28px 0; border-top: 1px solid var(--border); }
.job:last-child { border-bottom: 1px solid var(--border); }
.job-date { font: 400 13px/1.9 var(--font-mono); color: var(--text-muted); }
.job-org { color: var(--text-muted); font-size: 15px; margin-bottom: 12px; }
.job ul { max-width: var(--reading); }
.job li { position: relative; padding-left: 18px; font-size: 16px; }
.job li + li { margin-top: 6px; }
.job li::before { content: "–"; position: absolute; left: 0; color: var(--text-muted); }

/* Expertise */
.expertise { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.expertise h3 { font-size: 16px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.expertise li { font-size: 16px; padding: 4px 0; }

/* Contact + footer */
.contact-links { display: flex; flex-wrap: wrap; gap: 12px 32px; font-size: 20px; font-weight: 500; }
.footer { border-top: 1px solid var(--border); padding: 32px 0 48px; font-size: 14px; color: var(--text-muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }

/* Motion */
@media (prefers-reduced-motion: no-preference) {
    .js .section { opacity: 0; transform: translateY(8px); transition: opacity 200ms ease-out, transform 200ms ease-out; }
    .js .section.in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* Print: drop chrome, show everything, keep cards whole */
@media print {
    .nav, .actions { display: none; }
    body { font-size: 12pt; }
    .hero { padding: 0 0 24px; }
    .section { padding: 24px 0; opacity: 1 !important; transform: none !important; }
    .case, .job, .metric, .oss li { break-inside: avoid; }
    .case:hover { box-shadow: none; }
    .contact-links a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 10pt; color: var(--text-muted); }
}

/* Tablet */
@media (max-width: 1023px) {
    h1 { font-size: 48px; }
    .metrics { grid-template-columns: repeat(2, 1fr); row-gap: 32px; }
    .metric:nth-child(odd) { padding-left: 0; border-left: 0; }
    .expertise { grid-template-columns: repeat(2, 1fr); }
    .oss { grid-template-columns: 1fr; }
    .job { grid-template-columns: 1fr; gap: 4px; }
}

/* Mobile */
@media (max-width: 639px) {
    body { font-size: 16px; }
    .container { padding: 0 16px; }
    h1 { font-size: 38px; }
    h2 { font-size: 26px; }
    h3 { font-size: 18px; }
    .hero { padding: 64px 0 56px; }
    .section { padding: 56px 0; }
    .actions { flex-direction: column; }
    .btn { height: 44px; }
    .metric { padding: 0 16px; }
    .metric-num { font-size: 32px; }
    .case { padding: 24px 20px; }
    .case-body { grid-template-columns: 1fr; gap: 4px; }
    .case-body dd + dt { margin-top: 12px; }
    .expertise { grid-template-columns: 1fr; gap: 24px; }
    .contact-links { flex-direction: column; font-size: 18px; }
    .contact-links a { display: inline-block; padding: 6px 0; }

    .js .nav-toggle {
        display: block;
        height: 44px; padding: 0 4px;
        background: none; border: 0;
        font: 500 15px/1 var(--font-sans); color: var(--text);
        cursor: pointer;
    }
    .js .nav-links { display: none; }
    .js .nav-links.open {
        display: flex; flex-direction: column; gap: 0;
        position: absolute; top: 60px; left: 0; right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        padding: 8px 16px 16px;
    }
    .nav-links a { padding: 10px 0; font-size: 17px; }
    .nav-links { gap: 16px; }
}
