:root {
    --ink: #171717;
    --muted: #5f6368;
    --paper: #f6f7f9;
    --panel: #ffffff;
    --line: #d9dee7;
    --teal: #0f9d8a;
    --coral: #df604f;
    --amber: #d99518;
    --violet: #7257d6;
    --blue: #2f6fb3;
    --green: #4e9f3d;
    --dark: #202124;
    --shadow: 0 18px 45px rgba(23, 23, 23, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(rgba(23, 23, 23, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23, 23, 23, 0.045) 1px, transparent 1px),
        var(--paper);
    background-size: 36px 36px;
    font-family: "Pretendard", "Apple SD Gothic Neo", "Segoe UI", Arial, sans-serif;
    line-height: 1.65;
    word-break: keep-all;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

code {
    padding: 0.12rem 0.34rem;
    border: 1px solid rgba(47, 111, 179, 0.22);
    border-radius: 6px;
    background: rgba(47, 111, 179, 0.08);
    color: #174d82;
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
    font-size: 0.92em;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    min-height: 70px;
    padding: 0.9rem 5vw;
    border-bottom: 1px solid rgba(23, 23, 23, 0.08);
    background: rgba(246, 247, 249, 0.92);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 800;
    min-width: 0;
}

.brand span:last-child {
    overflow-wrap: anywhere;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--dark);
    color: #fff;
    font-weight: 900;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 0.2rem;
    max-width: 100%;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 700;
}

.site-nav a.is-active,
.site-nav a:hover {
    background: var(--dark);
    color: #fff;
}

.intro-section {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
    gap: 3rem;
    align-items: center;
    padding: 4.5rem 5vw 5rem;
}

.intro-section > * {
    min-width: 0;
}

.intro-copy h1,
.section-heading h2 {
    margin: 0;
    line-height: 1.16;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.intro-copy h1 {
    max-width: 820px;
    font-size: 3.35rem;
}

.lead {
    max-width: 740px;
    margin: 1.35rem 0 0;
    color: var(--muted);
    font-size: 1.16rem;
}

.eyebrow {
    margin: 0 0 0.7rem;
    color: var(--coral);
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

.problem-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    margin-top: 2rem;
}

.problem-strip div,
.phase-card,
.structure-card,
.algorithm-row,
.function-column,
.compression-step {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.problem-strip div {
    min-height: 150px;
    padding: 1rem;
}

.metric {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin-bottom: 0.75rem;
    border-radius: 8px;
    background: rgba(15, 157, 138, 0.12);
    color: var(--teal);
    font-weight: 900;
}

.problem-strip strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 1rem;
}

.problem-strip p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.architecture-board {
    position: relative;
    overflow: hidden;
    max-width: 100%;
    padding: 1.25rem;
    border: 1px solid #222;
    border-radius: 8px;
    background: #202124;
    color: #fff;
    box-shadow: var(--shadow);
}

.architecture-board::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

.board-label,
.flow-source,
.phase-lane,
.flow-result {
    position: relative;
}

.board-label {
    margin-bottom: 1rem;
    color: #b8c0cc;
    font-size: 0.8rem;
    font-weight: 900;
    text-transform: uppercase;
}

.flow-source,
.flow-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 74px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.flow-source span,
.flow-result span {
    color: #b8c0cc;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.flow-source strong,
.flow-result strong {
    overflow-wrap: anywhere;
}

.phase-lane {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin: 0.9rem 0;
}

.mini-phase {
    min-height: 150px;
    padding: 1rem;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

.mini-phase span {
    display: inline-flex;
    margin-bottom: 0.75rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.mini-phase strong {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
}

.mini-phase p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.phase-a { border-top: 5px solid var(--teal); }
.phase-b { border-top: 5px solid var(--amber); }
.phase-c { border-top: 5px solid var(--violet); }
.phase-d { border-top: 5px solid var(--coral); }

.section-block,
.wide-band {
    padding: 5.5rem 5vw;
}

.section-block.alt {
    background: rgba(255, 255, 255, 0.52);
}

.wide-band {
    background: #202124;
    color: #fff;
}

.section-heading {
    max-width: 980px;
    margin: 0 auto 2.8rem;
    text-align: center;
}

.section-heading.compact {
    margin-bottom: 2rem;
}

.section-heading h2 {
    font-size: 2.45rem;
}

.section-heading p:not(.eyebrow) {
    max-width: 720px;
    margin: 1rem auto 0;
    color: var(--muted);
    font-size: 1.06rem;
}

.wide-band .section-heading p:not(.eyebrow) {
    color: #c5cad3;
}

.pipeline-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.phase-card,
.structure-card,
.function-column {
    padding: 1.25rem;
}

.phase-card {
    display: flex;
    flex-direction: column;
    min-height: 510px;
    box-shadow: var(--shadow);
}

.phase-index,
.structure-phase {
    display: inline-flex;
    align-self: flex-start;
    margin-bottom: 1rem;
    padding: 0.32rem 0.58rem;
    border-radius: 6px;
    background: rgba(47, 111, 179, 0.08);
    color: var(--blue);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.phase-card h3,
.structure-card h3,
.algorithm-copy h3,
.function-column h3 {
    margin: 0;
    line-height: 1.25;
}

.phase-card h3 {
    min-height: 62px;
    font-size: 1.35rem;
}

.phase-card p {
    color: var(--muted);
}

.phase-visual {
    display: grid;
    place-items: center;
    min-height: 210px;
    margin-top: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9fafb;
}

.bits-visual {
    align-content: center;
    gap: 0.35rem;
    padding: 1rem;
    font-family: "Cascadia Code", Consolas, monospace;
}

.bits-visual div {
    display: grid;
    grid-template-columns: 48px repeat(4, 28px);
    gap: 0.35rem;
    align-items: center;
}

.bits-visual span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.bits-visual b {
    display: grid;
    place-items: center;
    height: 28px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--line);
}

.bits-visual .xor-row b:nth-child(4) {
    border-color: var(--coral);
    background: rgba(223, 96, 79, 0.12);
    color: var(--coral);
}

.bits-visual p {
    margin: 0.7rem 0 0;
    color: var(--teal);
    font-weight: 900;
}

.chart-visual {
    padding: 1rem;
}

.chart-visual table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 8px;
    font-size: 0.86rem;
}

.chart-visual th,
.chart-visual td {
    height: 38px;
    border: 1px solid var(--line);
    text-align: center;
}

.chart-visual th {
    background: #eef1f6;
}

.chart-visual .hit::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--blue);
}

.chart-visual .epi::after { background: var(--teal); }
.chart-visual .core::after { background: var(--coral); }

.dfs-visual {
    gap: 0.85rem;
    padding: 1rem;
}

.target-node {
    width: 150px;
    padding: 0.9rem;
    border-radius: 8px;
    background: var(--violet);
    color: #fff;
    text-align: center;
    font-weight: 900;
}

.target-node small {
    font-weight: 700;
    opacity: 0.86;
}

.branch-row,
.state-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.branch-row span,
.state-row span {
    padding: 0.42rem 0.58rem;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: 0.86rem;
    font-weight: 800;
}

.state-row span {
    color: var(--muted);
    font-size: 0.76rem;
}

.cost-visual {
    gap: 0.65rem;
    padding: 1rem;
}

.cost-visual div {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--line);
    font-weight: 900;
}

.cost-visual span {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: #fff;
    background: var(--coral);
}

.compression-map {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    max-width: 1180px;
    margin: 0 auto;
}

.compression-step {
    padding: 1.1rem;
    background: #2b2c30;
    border-color: rgba(255, 255, 255, 0.12);
}

.compression-step strong {
    display: block;
    margin-bottom: 1.1rem;
    font-size: 1.08rem;
}

.compression-step p {
    margin: 0.95rem 0 0;
    color: #c5cad3;
}

.bar {
    display: block;
    height: 18px;
    border-radius: 6px;
    background: var(--teal);
}

.bar.full { width: 100%; background: var(--coral); }
.bar.medium { width: 74%; background: var(--amber); }
.bar.small { width: 46%; background: var(--blue); }
.bar.tiny { width: 24%; background: var(--teal); }

.lifecycle {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.structure-card {
    border-top: 6px solid var(--teal);
    min-height: 340px;
    box-shadow: var(--shadow);
}

.structure-card:nth-child(2) { border-top-color: var(--amber); }
.structure-card:nth-child(3) { border-top-color: var(--violet); }
.structure-card:nth-child(4) { border-top-color: var(--coral); }

.structure-card ul {
    margin: 1.2rem 0 0;
    padding-left: 1.15rem;
    color: var(--muted);
}

.structure-card li + li {
    margin-top: 0.72rem;
}

.algorithm-stack {
    display: grid;
    gap: 1.2rem;
    max-width: 1180px;
    margin: 0 auto;
}

.algorithm-row {
    display: grid;
    grid-template-columns: 0.95fr 1.05fr;
    gap: 1.4rem;
    align-items: center;
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.algorithm-row.reverse {
    grid-template-columns: 1.05fr 0.95fr;
}

.algorithm-row.reverse .algorithm-figure {
    order: 2;
}

.algorithm-figure {
    display: grid;
    place-items: center;
    min-height: 250px;
    border-radius: 8px;
    background: #202124;
    color: #fff;
    overflow: hidden;
}

.algorithm-copy h3 {
    font-size: 1.55rem;
}

.algorithm-copy p {
    margin: 1rem 0 0;
    color: var(--muted);
}

.code-equation {
    display: grid;
    gap: 0.55rem;
    width: min(92%, 430px);
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 0.94rem;
}

.code-equation span {
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.mrv-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.7rem;
    width: min(92%, 430px);
}

.mrv-board div {
    display: grid;
    gap: 0.4rem;
    min-height: 118px;
    padding: 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.mrv-board .mrv-selected {
    background: var(--teal);
}

.mrv-board strong {
    font-size: 1.35rem;
}

.mrv-board span {
    color: rgba(255, 255, 255, 0.76);
    font-weight: 800;
}

.ranking-ladder {
    display: grid;
    gap: 0.65rem;
    width: min(92%, 430px);
    margin: 0;
    padding: 0;
    list-style: none;
}

.ranking-ladder li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 900;
}

.ranking-ladder span {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 28px;
    border-radius: 6px;
    background: var(--coral);
    font-size: 0.8rem;
}

.function-matrix {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.function-column {
    min-height: 420px;
    box-shadow: var(--shadow);
}

.function-column h3 {
    min-height: 56px;
    font-size: 1.22rem;
}

.function-column dl {
    margin: 1rem 0 0;
}

.function-column dt {
    margin-top: 1rem;
    font-weight: 900;
}

.function-column dd {
    margin: 0.38rem 0 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.dfs-sequence {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1.2rem;
}

.dfs-sequence span {
    padding: 0.38rem 0.55rem;
    border-radius: 6px;
    background: rgba(114, 87, 214, 0.1);
    color: var(--violet);
    font-size: 0.8rem;
    font-weight: 900;
}

.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    padding: 2rem 5vw;
    background: #202124;
    color: #fff;
}

.footer span {
    color: #c5cad3;
}

[data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

[data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1180px) {
    .intro-section {
        grid-template-columns: 1fr;
    }

    .pipeline-grid,
    .lifecycle,
    .function-matrix {
        grid-template-columns: repeat(2, 1fr);
    }

    .phase-card {
        min-height: 460px;
    }
}

@media (max-width: 860px) {
    .topbar {
        position: static;
        align-items: flex-start;
        flex-direction: column;
    }

    .site-nav {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
    }

    .intro-section {
        display: block;
        max-width: 100vw;
        overflow: hidden;
    }

    .intro-copy,
    .architecture-board,
    .problem-strip {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .problem-strip {
        display: flex;
        flex-direction: column;
    }

    .problem-strip > div {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .intro-copy h1 {
        display: block;
        font-size: 2.25rem;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: keep-all;
        max-width: 100%;
    }

    .section-heading h2 {
        font-size: 1.85rem;
        word-break: normal;
    }

    .problem-strip,
    .phase-lane,
    .compression-map,
    .pipeline-grid,
    .lifecycle,
    .function-matrix,
    .algorithm-row,
    .algorithm-row.reverse {
        grid-template-columns: 1fr;
    }

    .algorithm-row.reverse .algorithm-figure {
        order: 0;
    }

    .phase-card,
    .structure-card,
    .function-column {
        min-height: auto;
    }
}

@media (max-width: 560px) {
    .intro-section,
    .section-block,
    .wide-band {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .intro-copy h1 {
        font-size: 1.68rem;
        word-break: keep-all;
    }

    .lead {
        font-size: 1rem;
    }

    .flow-source,
    .flow-result {
        align-items: flex-start;
        flex-direction: column;
    }

    .mrv-board {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    [data-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
