:root {
    --paper: #eef0ec;
    --surface: #f8f9f6;
    --ink: #16201c;
    --stone: #5f6863;
    --rule: #d3d8d2;
    --cobalt: #2442e0;
    --moss: #4e7a3a;
    --moss-soft: #dfe8d7;
    --logo-filter: none;

    --serif: "Hahmlet", "Nanum Myeongjo", serif;
    --sans: "Pretendard Variable", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
    --max: 1180px;
    --gutter: 32px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #111815;
        --surface: #18211d;
        --ink: #e6eae5;
        --stone: #9aa49e;
        --rule: #2b3631;
        --cobalt: #8a9dff;
        --moss: #98c27f;
        --moss-soft: #22301f;
        --logo-filter: invert(1);
    }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.75;
    background: var(--paper);
    color: var(--ink);
    word-break: keep-all;
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
    outline: 2px solid var(--cobalt);
    outline-offset: 3px;
    border-radius: 4px;
}

.wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.serif { font-family: var(--serif); }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--rule);
}

.site-header .wrap {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: var(--serif);
    font-weight: 700;
    font-size: 21px;
    letter-spacing: -0.01em;
}

.brand img {
    width: 34px;
    height: 34px;
    filter: var(--logo-filter);
}

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 32px;
}

.site-nav a {
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--stone);
}

.site-nav a:hover { color: var(--ink); }

.site-nav .nav-cta {
    color: var(--paper);
    background: var(--ink);
    padding: 8px 16px;
    border-radius: 6px;
}

.site-nav .nav-cta:hover { color: var(--paper); }

/* ---------- Hero ---------- */
.hero {
    padding: 96px 0 72px;
}

.hero-copy {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 56px;
    align-items: end;
    margin-bottom: 72px;
}

.hero h1 {
    font-family: var(--serif);
    font-size: clamp(44px, 6.6vw, 80px);
    line-height: 1.12;
    letter-spacing: -0.035em;
    font-weight: 300;
}

.hero h1 strong {
    display: block;
    font-weight: 700;
}

.hero-lead {
    font-size: 18px;
    color: var(--stone);
    max-width: 32em;
    margin-bottom: 32px;
}

.hero-lead b { color: var(--ink); font-weight: 600; }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    display: inline-block;
    padding: 13px 22px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--ink);
}

.btn-solid {
    background: var(--ink);
    color: var(--paper);
}

.btn-solid:hover { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }

.btn-line:hover { background: var(--surface); }

/* Pipeline diagram */
.pipeline {
    border-top: 1px solid var(--rule);
    padding-top: 28px;
}

.pipeline figcaption {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    font-size: 14px;
    color: var(--stone);
    margin-top: 20px;
}

.pipeline svg { display: block; width: 100%; height: auto; }

.pipeline .dg-v { display: none; }

.dg-stage { font: 600 13px var(--sans); fill: var(--stone); }
.dg-node { fill: var(--surface); stroke: var(--rule); stroke-width: 1; }
.dg-node-key { fill: var(--ink); stroke: var(--ink); }
.dg-t { font: 600 14px var(--sans); fill: var(--ink); }
.dg-s { font: 400 12px var(--sans); fill: var(--stone); }
.dg-node-key + .dg-t, .dg-key-t { fill: var(--paper); }
.dg-key-s { fill: color-mix(in srgb, var(--paper) 70%, transparent); }

.dg-line { fill: none; stroke-width: 1.6; }
.dg-root { stroke: var(--moss); }
.dg-trunk { stroke: var(--ink); stroke-width: 2.4; }
.dg-branch { stroke: var(--cobalt); }

@media (prefers-reduced-motion: no-preference) {
    .dg-line {
        stroke-dasharray: 1;
        stroke-dashoffset: 1;
        animation: draw 0.7s cubic-bezier(.6,0,.3,1) forwards;
        animation-delay: var(--d, 0s);
    }
    .dg-root { --d: 0.2s; }
    .dg-trunk { --d: 0.8s; }
    .dg-branch { --d: 1.2s; }
}

@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Sections ---------- */
.sec {
    padding: 112px 0;
    border-top: 1px solid var(--rule);
}

.sec-head {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 56px;
    margin-bottom: 64px;
}

.sec-head h2 {
    font-family: var(--serif);
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1.2;
    letter-spacing: -0.025em;
    font-weight: 700;
}

.sec-head p {
    color: var(--stone);
    max-width: 34em;
    align-self: end;
}

/* Capabilities */
.caps { list-style: none; }

.cap {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 56px;
    padding: 40px 0;
    border-top: 1px solid var(--rule);
}

.cap:last-child { border-bottom: 1px solid var(--rule); }

.cap h3 {
    font-family: var(--serif);
    font-size: 28px;
    line-height: 1.3;
    letter-spacing: -0.015em;
    font-weight: 500;
    margin-bottom: 14px;
}

.cap .proof {
    font-size: 14px;
    color: var(--stone);
}

.cap .proof span { color: var(--ink); }

.cap-body > p { margin-bottom: 18px; }

.cap-body ul:not(.stack) {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 32px;
    margin-bottom: 22px;
    font-size: 15px;
}

.cap-body ul:not(.stack) li {
    padding-left: 16px;
    position: relative;
}

.cap-body ul:not(.stack) li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.75em;
    width: 7px;
    height: 1.6px;
    background: var(--moss);
}

.stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
}

.stack li, .stack span {
    font-size: 13px;
    line-height: 1.4;
    padding: 4px 9px;
    border: 1px solid var(--rule);
    border-radius: 4px;
    color: var(--stone);
    background: var(--surface);
}

/* AX PoC */
.ax {
    background: var(--ink);
    color: var(--paper);
    border-top: none;
}

.ax .sec-head p { color: color-mix(in srgb, var(--paper) 68%, transparent); }

.steps {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 28px;
    counter-reset: step;
    position: relative;
}

.steps::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 15px;
    height: 1px;
    background: color-mix(in srgb, var(--paper) 25%, transparent);
}

.step {
    counter-increment: step;
    position: relative;
}

.step::before {
    content: counter(step);
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ink);
    border: 1px solid color-mix(in srgb, var(--paper) 45%, transparent);
    font: 600 14px var(--sans);
    margin-bottom: 24px;
    position: relative;
}

.step h3 {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 500;
    line-height: 1.35;
    margin-bottom: 10px;
}

.step p {
    font-size: 15px;
    color: color-mix(in srgb, var(--paper) 72%, transparent);
    margin-bottom: 16px;
}

.step .case {
    font-size: 14px;
    padding-top: 12px;
    border-top: 1px solid color-mix(in srgb, var(--paper) 18%, transparent);
}

.step .case b {
    display: block;
    font-weight: 600;
    color: var(--moss);
    font-size: 13px;
}

.ax-note {
    margin-top: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    padding: 28px 32px;
    border: 1px solid color-mix(in srgb, var(--paper) 22%, transparent);
    border-radius: 8px;
}

.ax-note p { font-family: var(--serif); font-size: 21px; }

.ax .btn { border-color: var(--paper); }
.ax .btn-solid { background: var(--paper); color: var(--ink); }
.ax .btn-solid:hover { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }

/* Data analysis cases */
.cases {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0 40px;
}

.case-item {
    padding: 28px 0 36px;
    border-top: 2px solid var(--ink);
}

.case-item h3 {
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.case-item p {
    font-size: 15px;
    color: var(--stone);
    margin-bottom: 16px;
}

/* Projects */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}

.filters button {
    font: 500 14px var(--sans);
    color: var(--stone);
    background: none;
    border: 1px solid var(--rule);
    border-radius: 999px;
    padding: 7px 16px;
    cursor: pointer;
}

.filters button:hover { color: var(--ink); border-color: var(--stone); }

.filters button[aria-pressed="true"] {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.filters .count { opacity: 0.6; margin-left: 4px; font-variant-numeric: tabular-nums; }

.projects { border-top: 1px solid var(--ink); }

.project { border-bottom: 1px solid var(--rule); }

.project[hidden] { display: none; }

.project summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    grid-template-columns: 260px 1fr 150px 24px;
    gap: 24px;
    align-items: baseline;
    padding: 22px 0;
}

.project summary::-webkit-details-marker { display: none; }

.project summary:hover h3 { color: var(--cobalt); }

.project h3 {
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 500;
    line-height: 1.35;
}

.project .status {
    display: inline-block;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--moss);
    background: var(--moss-soft);
    border-radius: 4px;
    padding: 2px 7px;
    margin-left: 8px;
    vertical-align: 3px;
    white-space: nowrap;
}

.project .one {
    font-size: 15px;
    color: var(--stone);
}

.project .when {
    font-size: 14px;
    color: var(--stone);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.project .toggle {
    width: 14px;
    height: 14px;
    position: relative;
    align-self: center;
    justify-self: end;
}

.project .toggle::before,
.project .toggle::after {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    width: 14px;
    height: 1.6px;
    background: var(--ink);
    transition: transform 0.2s;
}

.project .toggle::after { transform: rotate(90deg); }
.project[open] .toggle::after { transform: rotate(0deg); }

.project-body {
    display: grid;
    grid-template-columns: 260px 1fr 174px;
    gap: 24px;
    padding: 0 0 28px;
}

.project-body ul:not(.stack) {
    grid-column: 2;
    list-style: none;
    font-size: 15px;
    margin-bottom: 16px;
}

.project-body ul:not(.stack) li {
    padding-left: 16px;
    position: relative;
    margin-bottom: 4px;
}

.project-body ul:not(.stack) li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.8em;
    width: 7px;
    height: 1.6px;
    background: var(--cobalt);
}

.project-body .stack { grid-column: 2; }

/* R&D */
.rnd {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.rnd th, .rnd td {
    text-align: left;
    vertical-align: top;
    padding: 16px 16px 16px 0;
    border-bottom: 1px solid var(--rule);
}

.rnd thead th {
    font-size: 13px;
    font-weight: 600;
    color: var(--stone);
    border-bottom: 1px solid var(--ink);
}

.rnd tbody th {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 17px;
    white-space: nowrap;
}

.rnd td:last-child { color: var(--stone); font-size: 14px; }

/* Contact */
.contact { padding: 128px 0 112px; border-top: 1px solid var(--rule); }

.contact h2 {
    font-family: var(--serif);
    font-size: clamp(32px, 4vw, 48px);
    font-weight: 300;
    letter-spacing: -0.025em;
    line-height: 1.25;
    margin-bottom: 40px;
    max-width: 18em;
}

.contact-mail {
    display: inline-block;
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(30px, 6.4vw, 76px);
    letter-spacing: -0.03em;
    line-height: 1.1;
    text-decoration: none;
    border-bottom: 3px solid var(--cobalt);
    padding-bottom: 6px;
    word-break: break-all;
}

.contact-mail:hover { color: var(--cobalt); }

.contact-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 40px;
    margin-top: 40px;
    font-size: 16px;
}

.contact-sub a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 500;
}

.contact-sub a:hover { color: var(--cobalt); }

.contact-sub svg { width: 20px; height: 20px; }

/* Footer */
.site-footer {
    border-top: 1px solid var(--rule);
    padding: 28px 0;
    font-size: 14px;
    color: var(--stone);
}

.site-footer .wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.site-footer .brand { font-size: 17px; color: var(--ink); }
.site-footer .brand img { width: 26px; height: 26px; }

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
    .steps { grid-template-columns: 1fr 1fr; gap: 40px 32px; }
    .steps::before { display: none; }
    .project summary { grid-template-columns: 220px 1fr 130px 24px; }
    .project-body { grid-template-columns: 220px 1fr 154px; }
}

@media (max-width: 860px) {
    :root { --gutter: 20px; }
    body { font-size: 16px; }
    .site-nav li:not(:last-child) { display: none; }
    .hero { padding: 64px 0 48px; }
    .hero-copy, .sec-head, .cap { grid-template-columns: 1fr; gap: 24px; }
    .hero-copy { margin-bottom: 48px; }
    .sec { padding: 80px 0; }
    .sec-head { margin-bottom: 40px; }
    .cap-body ul:not(.stack) { grid-template-columns: 1fr; }
    .cases { grid-template-columns: 1fr 1fr; }
    .pipeline .dg-h { display: none; }
    .pipeline .dg-v { display: block; max-width: 420px; margin: 0 auto; }
    .pipeline figcaption { flex-direction: column; gap: 4px; }
    .project summary { grid-template-columns: 1fr 24px; gap: 4px 16px; }
    .project summary h3 { grid-column: 1; }
    .project .toggle { grid-column: 2; grid-row: 1; }
    .project .one, .project .when { grid-column: 1 / -1; text-align: left; }
    .project .when { order: -1; font-size: 13px; }
    .project-body { display: block; }
}

@media (max-width: 560px) {
    :root { --gutter: 16px; }
    .steps, .cases { grid-template-columns: 1fr; }
    .cap h3 { font-size: 24px; }
    .ax-note { padding: 24px 20px; }
    .rnd thead { display: none; }
    .rnd tr { display: block; padding: 14px 0; border-bottom: 1px solid var(--rule); }
    .rnd th, .rnd td { display: block; border: none; padding: 2px 0; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .project .toggle::before, .project .toggle::after { transition: none; }
}

/* ---------- Language switch ---------- */
.site-nav {
    display: flex;
    align-items: center;
    gap: 28px;
}

.site-nav .lang {
    font-size: 14px;
    font-weight: 600;
    color: var(--stone);
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 7px 11px;
    line-height: 1;
}

.site-nav .lang:hover { color: var(--ink); border-color: var(--stone); }

@media (max-width: 860px) {
    .site-nav { gap: 10px; }
}

/* ---------- Parallax background ---------- */
#bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* English headline runs longer than Korean */
html[lang="en"] .hero h1 { font-size: clamp(40px, 4.8vw, 62px); }

.pipeline figcaption span:last-child { white-space: nowrap; }

#mesh {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 8%, transparent 26%, transparent 74%, #000 92%, #000 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 8%, transparent 26%, transparent 74%, #000 92%, #000 100%);
}
