/* =========================================================
   Portfolio — HyungJoo Yoon, Backend Developer
   Identity: an operations console. The subject keeps systems
   running, so the page reads like a calm monitoring surface —
   monospace data, status dots, before/after deltas.
   ========================================================= */

:root {
    --bg: #F5F7F9;
    --surface: #FFFFFF;
    --ink: #0F1828;          /* cool deep slate */
    --ink-2: #4A5568;
    --ink-3: #8893A4;
    --line: #E2E7ED;
    --line-2: #EDF0F4;
    --up: #0C6E57;           /* "healthy / improved" green signal */
    --up-soft: #E2F0EB;
    --warn: #B0631F;         /* "before / incident" warm signal */
    --warn-soft: #F5ECE0;

    --font-display: "Space Grotesk", "Pretendard Variable", Pretendard, sans-serif;
    --font-body: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
        "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", "Pretendard Variable", ui-monospace, SFMono-Regular,
        Menlo, monospace;

    --max: 1000px;
    --gap: clamp(60px, 8vw, 112px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scrollbar-gutter: stable; }
section[id], span#top { scroll-margin-top: 88px; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16.5px;
    line-height: 1.72;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; }
img { max-width: 100%; display: block; }

/* language visibility */
body.lang-ko [data-lang="en"] { display: none !important; }
body.lang-en [data-lang="ko"] { display: none !important; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 30px; }

/* shared mono utility text */
.mono {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.02em;
    font-weight: 500;
}

/* ---------- section frame ---------- */
.block { padding: var(--gap) 0; border-top: 1px solid var(--line); }

.eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--up);
    margin: 0 0 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.eyebrow::before {
    content: "//";
    color: var(--ink-3);
    font-weight: 500;
}

.headline {
    font-family: var(--font-display);
    font-size: clamp(28px, 4.2vw, 44px);
    font-weight: 600;
    line-height: 1.14;
    letter-spacing: -0.03em;
    margin: 0 0 16px;
}
.lead {
    font-size: clamp(16.5px, 1.9vw, 19px);
    color: var(--ink-2);
    max-width: 64ch;
    margin: 0;
}

/* =========================================================
   Nav
   ========================================================= */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(245, 247, 249, 0.85);
    backdrop-filter: saturate(150%) blur(12px);
    -webkit-backdrop-filter: saturate(150%) blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
    /* promote to its own compositor layer to stop sticky + backdrop-filter
       repaint flicker while images scroll underneath (Chrome/Safari) */
    will-change: transform;
    transform: translateZ(0);
}
.nav.scrolled { border-color: var(--line); }
.nav-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 14px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.nav-name {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.01em;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.nav-name .dotpulse {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--up);
    box-shadow: 0 0 0 0 rgba(12, 110, 87, 0.5);
    animation: pulse 2.6s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(12, 110, 87, 0.45); }
    70% { box-shadow: 0 0 0 7px rgba(12, 110, 87, 0); }
    100% { box-shadow: 0 0 0 0 rgba(12, 110, 87, 0); }
}
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-menu { display: flex; gap: 24px; }
.nav-menu a {
    text-decoration: none;
    color: var(--ink-2);
    font-family: var(--font-mono);
    font-size: 13px;
    transition: color 0.2s ease;
}
.nav-menu a:hover { color: var(--up); }

.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 5px 10px;
    background: var(--surface);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-3);
}
.lang-toggle b { color: var(--ink-3); font-weight: 600; transition: color 0.2s; }
body.lang-ko .lang-toggle .l-ko,
body.lang-en .lang-toggle .l-en { color: var(--ink); }
.lang-toggle .sep { color: var(--line); }

.pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    border: 1px solid var(--ink);
    border-radius: 7px;
    padding: 6px 13px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
}
.pdf-link:hover { background: var(--ink); color: var(--bg); }

/* =========================================================
   Hero
   ========================================================= */
.hero {
    padding-top: clamp(56px, 10vw, 104px);
    padding-bottom: clamp(44px, 7vw, 84px);
}
.hero-status {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink-2);
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 30px;
    padding: 6px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}
.hero-status .dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--up);
}
.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(36px, 7vw, 76px);
    line-height: 1.04;
    letter-spacing: -0.04em;
    font-weight: 600;
    margin: 0;
    max-width: 16ch;
}
.hero h1 em { font-style: normal; color: var(--up); }
.hero-sub {
    margin: 30px 0 0;
    font-size: clamp(17px, 2vw, 20px);
    color: var(--ink-2);
    max-width: 54ch;
}
/* mono "status line" — the signature hero artifact */
.hero-trace {
    margin-top: 34px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink-3);
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 4px;
}
.hero-trace b { color: var(--ink-2); font-weight: 600; }
.hero-trace .k { color: var(--up); }
.hero-meta {
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 22px;
    align-items: center;
    font-size: 14.5px;
    color: var(--ink-2);
}
.hero-meta a {
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 2px;
    transition: border-color 0.2s ease;
}
.hero-meta a:hover { border-color: var(--up); }

/* =========================================================
   About
   ========================================================= */
.about-grid { display: grid; grid-template-columns: 1fr; gap: 28px; }
.about-lead {
    font-family: var(--font-display);
    font-size: clamp(20px, 2.5vw, 26px);
    line-height: 1.46;
    letter-spacing: -0.02em;
    font-weight: 500;
    margin: 0;
    max-width: 28ch;
}
.about-body p { margin: 0 0 18px; color: var(--ink-2); max-width: 64ch; }
.about-body p:last-child { margin-bottom: 0; }
.about-body strong { color: var(--ink); font-weight: 600; }
@media (min-width: 840px) {
    .about-grid { grid-template-columns: 0.8fr 1.2fr; gap: 56px; }
}

/* =========================================================
   Skills
   ========================================================= */
.skills-grid { display: grid; grid-template-columns: 1fr; gap: 26px; margin-top: 40px; }
@media (min-width: 780px) { .skills-grid { grid-template-columns: repeat(3, 1fr); gap: 22px; } }
.skill-col {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px 22px;
    background: var(--surface);
}
.skill-col .skill-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--up);
    text-transform: uppercase;
}
.skill-col h3 { font-size: 17px; font-weight: 600; margin: 8px 0 4px; letter-spacing: -0.01em; }
.skill-col .skill-note { font-size: 13.5px; color: var(--ink-3); margin: 0 0 16px; line-height: 1.5; }
.skill-list { list-style: none; margin: 0; padding: 0; }
.skill-list li {
    padding: 8px 0;
    border-top: 1px solid var(--line-2);
    font-size: 14.5px;
    color: var(--ink);
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}

/* =========================================================
   Flow legend — the two problem-solving tracks, stated once
   ========================================================= */
.legend {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    padding: 28px 28px;
    margin-top: 36px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}
.legend-intro { margin: 0; color: var(--ink-2); font-size: 15px; max-width: 70ch; }
.legend-intro b { color: var(--ink); font-weight: 600; }
.legend-tracks { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 760px) { .legend-tracks { grid-template-columns: 1fr 1fr; gap: 20px; } }
.track {
    border-left: 2px solid var(--up);
    padding: 4px 0 4px 16px;
}
.track .track-id {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--up);
    letter-spacing: 0.04em;
}
.track .track-steps {
    margin: 6px 0 0;
    font-family: var(--font-mono);
    font-size: 13.5px;
    color: var(--ink);
    line-height: 1.7;
    letter-spacing: -0.01em;
}
.track .track-steps .arr { color: var(--ink-3); margin: 0 4px; }

/* =========================================================
   Case study — shared by Experience and Projects
   ========================================================= */
.experience-wrap, .work-wrap { margin-top: 18px; }

.case {
    border-top: 1px solid var(--line);
    padding: clamp(40px, 6vw, 68px) 0;
}
.case:first-of-type { border-top: none; }

.case-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.status {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; }
.status.live { color: var(--up); background: var(--up-soft); }
.status.live .dot { background: var(--up); }
.status.study { color: var(--warn); background: var(--warn-soft); }
.status.study .dot { background: var(--warn); }
.status.ship { color: var(--ink-2); background: var(--line-2); }
.status.ship .dot { background: var(--ink-3); }
.flow-tag {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink-3);
    letter-spacing: 0.03em;
    padding: 4px 0;
}
.flow-tag b { color: var(--ink-2); font-weight: 600; }

.case-head { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.case-title {
    font-family: var(--font-display);
    font-size: clamp(25px, 3.6vw, 36px);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0;
}
.case-title .ko-sub { font-family: var(--font-body); font-weight: 500; color: var(--ink-3); font-size: 0.6em; margin-left: 8px; letter-spacing: -0.01em; }
.case-meta {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink-3);
    text-align: right;
    white-space: nowrap;
    line-height: 1.5;
}
.case-essence {
    font-size: clamp(17px, 2.1vw, 20px);
    color: var(--ink-2);
    line-height: 1.55;
    margin: 16px 0 0;
    max-width: 62ch;
    letter-spacing: -0.015em;
}

/* reference links */
.refs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.refs a {
    font-family: var(--font-mono);
    font-size: 12.5px;
    text-decoration: none;
    color: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 5px 11px;
    background: var(--surface);
    transition: border-color 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.refs a:hover { border-color: var(--up); color: var(--up); }
.refs a::before { content: "↗"; color: var(--ink-3); }
.refs a.muted { color: var(--ink-3); border-style: dashed; cursor: default; }
.refs a.muted::before { content: "•"; }
.refs a.muted:hover { border-color: var(--line); color: var(--ink-3); }

/* narrative beats */
.beats { margin-top: 32px; border-top: 1px solid var(--line-2); }
.beat {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 20px 0;
    border-bottom: 1px solid var(--line-2);
}
.beat-k {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    color: var(--up);
    text-transform: uppercase;
    padding-top: 3px;
}
.beat-k .n { color: var(--ink-3); margin-right: 8px; }
.beat-b { margin: 0; color: var(--ink); }
.beat-b.dim { color: var(--ink-2); }
.beat-b strong { font-weight: 600; }
ul.beat-b { padding-left: 17px; }
ul.beat-b li { margin: 0 0 5px; }
ul.beat-b li:last-child { margin-bottom: 0; }
@media (min-width: 780px) {
    .beat { grid-template-columns: 172px 1fr; gap: 28px; padding: 24px 0; }
}

/* architecture-study aside (Garabu) */
.aside {
    margin-top: 24px;
    padding: 22px 24px;
    border: 1px dashed var(--line);
    border-left: 2px solid var(--warn);
    border-radius: 0 12px 12px 0;
    background: var(--surface);
}
.aside .aside-k {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--warn);
    text-transform: uppercase;
    margin: 0 0 9px;
}
.aside p { margin: 0; color: var(--ink-2); font-size: 15px; }
.aside strong { color: var(--ink); font-weight: 600; }

/* metric / delta readouts — the signature */
.readout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    margin-top: 30px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}
@media (min-width: 640px) {
    .readout { grid-template-columns: repeat(4, 1fr); }
    .readout.three { grid-template-columns: repeat(3, 1fr); }
    .readout.two { grid-template-columns: repeat(2, 1fr); }
}
.cell { background: var(--surface); padding: 18px 18px; }
.cell .delta {
    font-family: var(--font-mono);
    font-size: clamp(15px, 1.8vw, 17px);
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: baseline;
    gap: 7px;
    flex-wrap: wrap;
}
.cell .delta .before { color: var(--warn); text-decoration: line-through; text-decoration-thickness: 1px; opacity: 0.85; }
.cell .delta .arr { color: var(--ink-3); }
.cell .delta .after { color: var(--up); }
.cell .single {
    font-family: var(--font-display);
    font-size: clamp(26px, 3.2vw, 34px);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1;
}
.cell .single em { font-style: normal; color: var(--up); }
.cell .cap { margin-top: 9px; font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }
.cell .cap .pct { color: var(--up); font-family: var(--font-mono); font-weight: 600; }

/* tech tags */
.stack { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 26px; }
.stack span {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 4px 9px;
    background: var(--surface);
}

/* experience company header */
.exp-company-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 36px 0 4px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--ink);
}
.exp-company {
    font-family: var(--font-display);
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 600;
    letter-spacing: -0.025em;
    margin: 0;
}
.exp-company-meta { font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); }
.exp-company-role { color: var(--ink-2); margin: 12px 0 0; max-width: 70ch; }

/* =========================================================
   More
   ========================================================= */
.more-grid { margin-top: 18px; border-top: 1px solid var(--line-2); }
.more-item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 22px 0;
    border-bottom: 1px solid var(--line-2);
}
.more-item .mi-period { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); }
.more-item h4 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.more-item .mi-place { color: var(--ink-3); font-size: 14px; font-weight: 400; }
.more-item p { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; max-width: 72ch; }
.more-item a { color: var(--up); text-decoration: none; border-bottom: 1px solid var(--up-soft); }
@media (min-width: 780px) { .more-item { grid-template-columns: 190px 1fr; gap: 28px; } }

/* =========================================================
   Contact
   ========================================================= */
.contact h2 {
    font-family: var(--font-display);
    font-size: clamp(28px, 4.6vw, 50px);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.12;
    margin: 0 0 24px;
    max-width: 22ch;
}
.contact h2 a {
    color: var(--up);
    text-decoration: none;
    border-bottom: 2px solid var(--up-soft);
    transition: border-color 0.2s ease;
}
.contact h2 a:hover { border-color: var(--up); }
.contact-links { display: flex; gap: 10px 22px; flex-wrap: wrap; margin-top: 8px; font-family: var(--font-mono); font-size: 14px; }
.contact-links a {
    text-decoration: none;
    color: var(--ink-2);
    border-bottom: 1px solid var(--line);
    padding-bottom: 2px;
    transition: color 0.2s, border-color 0.2s;
}
.contact-links a:hover { color: var(--ink); border-color: var(--ink); }

.foot {
    border-top: 1px solid var(--line);
    padding: 28px 0 56px;
    color: var(--ink-3);
    font-family: var(--font-mono);
    font-size: 12.5px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

/* =========================================================
   Reveal-on-scroll
   ========================================================= */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto; }
    .nav-name .dotpulse { animation: none; }
}

/* =========================================================
   Project screenshots — justified gallery + lightbox
   ========================================================= */
.shots { margin-top: 32px; }
.shots-k {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    color: var(--up);
    text-transform: uppercase;
    margin: 0 0 14px;
}
.shots-k::before { content: "// "; color: var(--ink-3); font-weight: 500; }
.shots-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    align-items: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 12px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--ink-3) var(--line-2);
}
.shots-row::-webkit-scrollbar { height: 8px; }
.shots-row::-webkit-scrollbar-track { background: var(--line-2); border-radius: 4px; }
.shots-row::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 4px; }
.shots-row::-webkit-scrollbar-thumb:hover { background: var(--ink-2); }
.shot {
    margin: 0;
    flex: 0 0 auto;
    scroll-snap-align: start;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
    cursor: zoom-in;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.shot:hover { border-color: var(--up); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15, 24, 40, 0.09); }
.shot:focus-visible { outline: 2px solid var(--up); outline-offset: 2px; }
.shot img { height: 360px; width: auto; display: block; background: var(--line-2); }
.shots-row.landscape .shot img { height: 300px; }
.shot figcaption {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink-2);
    line-height: 1.4;
    padding: 9px 12px;
    border-top: 1px solid var(--line-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(15, 24, 40, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
    cursor: zoom-out;
    backdrop-filter: blur(5px);
}
.lightbox.open { display: flex; }
.lightbox img {
    max-width: 100%;
    max-height: 92vh;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
.lightbox-close {
    position: absolute;
    top: 18px;
    right: 22px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: #fff;
    opacity: 0.85;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 7px;
    padding: 6px 12px;
    cursor: pointer;
}
.lightbox-close:hover { opacity: 1; border-color: #fff; }

/* =========================================================
   Mobile
   ========================================================= */
@media (max-width: 700px) {
    .nav-menu { display: none; }
    body { font-size: 16px; }
    .nav-inner { padding: 12px 20px; }
    .wrap { padding: 0 20px; }
    .case-meta { text-align: left; }
    .shot img { height: 300px; }
    .shots-row.landscape .shot img { height: 200px; }
}
