:root {
    --bg: #0c1118;
    --panel: #121a24;
    --line: #1e293b;
    --text: #e5edf7;
    --muted: #9fb0c4;
    --green: #48d597;
    --yellow: #ffcf5a;
    --blue: #67b3ff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "IBM Plex Sans KR", sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: radial-gradient(circle at 15% -10%, #1f2a3c 0%, transparent 35%), var(--bg);
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 18px;
}

section {
    padding: 48px 0;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: 72px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: transparent;
    backdrop-filter: none;
    border-bottom: 1px solid transparent;
    transition: background 0.18s ease, backdrop-filter 0.18s ease, border-color 0.18s ease;
}

.site-header.scrolled,
.site-header.menu-open {
    background: rgba(12, 17, 24, 0.88);
    backdrop-filter: blur(10px);
    border-bottom-color: var(--line);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 64px;
    position: relative;
}

.logo {
    font-family: "IBM Plex Mono", monospace;
    font-size: 1rem;
    color: var(--green);
    letter-spacing: 0.4px;
}

.nav-links {
    display: flex;
    gap: 20px;
    color: var(--muted);
}

.nav-links a:hover {
    color: var(--blue);
    transition: 0.2s;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    padding: 5px;
}

.menu-toggle .bar {
    width: 25px;
    height: 3px;
    background-color: #95acc4;
    transition: 0.3s;
    border-radius: 2px;
}

#home {
    min-height: 62vh;
    display: flex;
    align-items: center;
}

#home .container {
    width: 100%;
}

.terminal-shell {
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(18, 26, 36, 0.96), rgba(11, 16, 24, 0.96));
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.terminal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.9rem;
    color: var(--muted);
}

.lights { display: flex; gap: 6px; }
.light { width: 10px; height: 10px; border-radius: 50%; }
.l1 { background: #ff5f57; }
.l2 { background: #febc2e; }
.l3 { background: #28c840; }

.hero-content {
    padding: 28px;
}

.hero-content p {
    font-size: clamp(0.92rem, 0.85rem + 0.4vw, 1.05rem);
    line-height: 1.75;
}

.command-line {
    font-family: "IBM Plex Mono", monospace;
    color: var(--green);
    font-size: clamp(0.84rem, 0.78rem + 0.35vw, 1rem);
    margin-bottom: 10px;
    opacity: 0;
    transform: translateY(8px);
    animation: reveal 0.55s forwards;
}

.command-line:nth-child(2) { animation-delay: 0.15s; }
.command-line:nth-child(3) { animation-delay: 0.3s; }

@keyframes reveal {
    to { opacity: 1; transform: translateY(0); }
}

.hero-content h1 {
    margin-top: 14px;
    font-size: clamp(1.75rem, 1.15rem + 2.9vw, 3.2rem);
    line-height: 1.34;
    margin-bottom: 12px;
    white-space: pre-line;
    word-break: keep-all;
}

.hero-content h1.is-typing {
    border-right: 2px solid var(--green);
    padding-right: 6px;
    animation: caret-blink 0.85s step-end infinite;
}

@keyframes caret-blink {
    0%,
    45% {
        border-right-color: var(--green);
    }

    46%,
    100% {
        border-right-color: transparent;
    }
}

.hero-subtitle {
    color: var(--muted);
    font-size: clamp(1rem, 0.92rem + 0.75vw, 1.28rem);
    line-height: 1.75;
    white-space: pre-line;
}

.hero-tag {
    display: inline-block;
    margin-top: 14px;
    font-family: "IBM Plex Mono", monospace;
    color: var(--blue);
    border: 1px dashed var(--blue);
    padding: 7px 12px;
    border-radius: 999px;
    font-size: clamp(0.74rem, 0.69rem + 0.33vw, 0.9rem);
}

.section-title {
    text-align: left;
    margin-bottom: 16px;
    font-size: 1.8rem;
    font-family: "IBM Plex Mono", monospace;
    color: var(--yellow);
}

.terminal-card {
    border: 1px solid var(--line);
    background: rgba(19, 29, 42, 0.7);
    border-radius: 10px;
    padding: 16px;
}

.terminal-card h3 {
    font-family: "IBM Plex Mono", monospace;
    color: var(--yellow);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.terminal-card p,
.terminal-card li { color: #c8d6e5; }

.timeline > li {
    border-left: 2px solid #2c3f56;
    padding-left: 10px;
    margin-bottom: 12px;
}

.timeline h4 {
    margin-bottom: 6px;
    color: #dce8f4;
}

.timeline > li > ul,
.license-list {
    margin-left: 14px;
    list-style: disc;
}

.license-list li { margin-bottom: 6px; }

.license-list a {
    color: var(--blue);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 600;
}

.license-list a:hover,
.license-list a:focus-visible {
    color: #9cd0ff;
}

#projects > .project-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0 20px;
}

#projects > .project-nav > div {
    border: 1px solid var(--line);
    background: rgba(19, 29, 42, 0.7);
    border-radius: 8px;
    padding: 12px;
    width: 100%;
    text-align: center;
    cursor: pointer;
    color: #bdd0e4;
    transition: 0.2s;
}

#projects > .project-nav > div:hover {
    border-color: #325070;
    color: #e5edf7;
}

#projects > .project-nav .active {
    color: var(--blue);
    border-color: var(--blue);
    font-weight: 700;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.project-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(19, 29, 42, 0.7);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
    border-color: #3a5c80;
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.project-card:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.project-info { padding: 16px; }
.project-info h3 { margin-bottom: 8px; }
.project-info p { color: #c8d6e5; }

.project-tags { margin-top: 12px; }

.tag {
    display: inline-block;
    border: 1px solid #38577a;
    color: #b8d7f8;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    margin-right: 6px;
}

.modal-open {
    overflow: hidden;
}

.project-modal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.project-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.project-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 18, 0.72);
    backdrop-filter: blur(3px);
}

.project-modal__dialog {
    position: relative;
    width: min(760px, calc(100% - 32px));
    max-height: min(88vh, 760px);
    margin: 6vh auto;
    overflow-y: auto;
    border: 1px solid #2f435b;
    border-radius: 14px;
    background: linear-gradient(180deg, #101823 0%, #0d1420 100%);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.45);
    padding: 22px 22px 20px;
}

.project-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #344c69;
    background: #142134;
    color: #c9dcf1;
    font-size: 1.2rem;
    cursor: pointer;
}

.project-modal__label {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.78rem;
    color: var(--blue);
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.project-modal__title {
    font-size: clamp(1.3rem, 1.12rem + 0.75vw, 1.8rem);
    line-height: 1.45;
    color: #e7eff8;
    margin-bottom: 8px;
    padding-right: 42px;
}

.project-modal__summary {
    color: #afc4db;
    margin-bottom: 14px;
    line-height: 1.7;
}

.project-modal__details {
    list-style: disc;
    margin-left: 20px;
    margin-bottom: 18px;
    color: #d0deed;
    line-height: 1.7;
}

.project-modal__details li {
    margin-bottom: 5px;
}

.project-modal__stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-modal__stack .tag {
    margin-right: 0;
}

.project-modal__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid #3f6387;
    background: linear-gradient(180deg, #1a2f46, #15273a);
    color: #d7e7f7;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.84rem;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.project-modal__link:hover {
    border-color: #67b3ff;
    transform: translateY(-1px);
}

.project-modal__link.is-hidden {
    display: none;
}

footer {
    text-align: center;
    padding: 22px;
    color: #90a7be;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .menu-toggle { display: flex; }

    .nav-links {
        position: absolute;
        top: 64px;
        left: 50%;
        transform: translateX(-50%);
        width: 100vw;
        background: #111927;
        border: 1px solid var(--line);
        border-left: 0;
        border-right: 0;
        border-radius: 0;
        flex-direction: column;
        gap: 0;
        text-align: center;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: all 0.3s ease-in-out;
    }

    .nav-links.active {
        max-height: 360px;
        opacity: 1;
        padding: 10px 0;
    }

    .nav-links li {
        padding: 0;
        width: 100%;
    }

    .nav-links a {
        display: block;
        width: 100%;
        padding: 12px 0;
    }

    .menu-toggle.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .menu-toggle.active .bar:nth-child(2) { opacity: 0; }
    .menu-toggle.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    #projects > .project-nav {
        flex-direction: column;
    }

    .hero-content h1 {
        font-size: clamp(1.95rem, 1.36rem + 2.95vw, 2.9rem);
        line-height: 1.44;
        margin-top: 16px;
        margin-bottom: 14px;
    }

    .hero-content p {
        font-size: clamp(0.86rem, 0.81rem + 0.35vw, 0.98rem);
        line-height: 1.7;
    }

    .hero-tag {
        font-size: clamp(0.72rem, 0.68rem + 0.28vw, 0.84rem);
    }

    .terminal-url {
        font-size: 0.75rem;
        max-width: 52%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: right;
    }
}

@media (max-width: 520px) {
    .hero-content {
        padding: 20px 16px;
    }

    .hero-content h1 {
        font-size: clamp(1.8rem, 1.28rem + 2.65vw, 2.35rem);
        line-height: 1.5;
        margin-top: 18px;
        margin-bottom: 16px;
    }

    .hero-content p {
        font-size: clamp(0.7rem, 0.67rem + 0.38vw, 0.82rem);
        line-height: 1.6;
    }

    .hero-tag {
        padding: 6px 10px;
        font-size: clamp(0.7rem, 0.67rem + 0.45vw, 0.8rem);
    }

    .section-title {
        font-size: 1.35rem;
    }

    .project-modal__dialog {
        width: calc(100% - 20px);
        margin: 4vh auto;
        max-height: 92vh;
        padding: 16px 14px 14px;
        border-radius: 12px;
    }

    .project-modal__title {
        font-size: clamp(1.16rem, 1rem + 1.2vw, 1.45rem);
        line-height: 1.5;
        padding-right: 36px;
    }

    .project-modal__summary,
    .project-modal__details {
        font-size: 0.9rem;
    }

    .project-modal__link {
        width: 100%;
        margin-top: 14px;
    }

    .project-modal__close {
        top: 8px;
        right: 8px;
        width: 34px;
        height: 34px;
    }
}