:root {
    --lime: #d9f9a5;
    --ivory: #f4fec1;
    --olive: #6ccbbb;
    --light-lime: #fff9d1;
    --black: #000;
    --border: 3px solid var(--black);
    --shadow: 6px 6px 0 var(--black);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--lime);
    color: var(--black);
    font-family: "Noto Sans KR", "Helvetica Neue", Helvetica, Arial, sans-serif;
    line-height: 1.55;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    color: inherit;
}

button {
    cursor: pointer;
}

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

.site-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 16px;
}

.box {
    background: var(--ivory);
    border: var(--border);
    box-shadow: var(--shadow);
}

.site-header {
    margin-bottom: 24px;
    padding: 22px;
    text-align: center;
}

.title-button {
    width: 100%;
    border: 0;
    background: transparent;
}

.site-header h1 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 7vw, 4rem);
    font-weight: 950;
    letter-spacing: 0;
    line-height: 1;
    text-transform: uppercase;
}

.field-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.badge {
    border: 2px solid var(--black);
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.badge-olive {
    background: var(--olive);
    color: var(--ivory);
}

.badge-black {
    background: var(--black);
    color: var(--lime);
}

.badge-separator {
    font-weight: 900;
}

.main-nav {
    margin-bottom: 28px;
    position: sticky;
    top: 12px;
    z-index: 20;
}

.nav-list,
.mobile-nav {
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-list {
    display: flex;
    flex-wrap: wrap;
}

.nav-list > li {
    position: relative;
    border-right: var(--border);
}

.nav-list > li:last-child {
    border-right: 0;
}

.nav-link,
.dropdown-menu button,
.mobile-nav button,
.quick-links button,
.site-footer button {
    border: 0;
    background: transparent;
    font-weight: 800;
}

.nav-link {
    display: block;
    padding: 14px 20px;
}

.nav-link:hover,
.nav-link.active,
.dropdown-menu button:hover,
.mobile-nav button:hover,
.quick-links button:hover,
.site-footer button:hover {
    background: var(--black);
    color: var(--lime);
}

.dropdown-menu {
    display: none;
    min-width: 220px;
    position: absolute;
    left: -3px;
    top: 100%;
    background: var(--ivory);
    border: var(--border);
    box-shadow: var(--shadow);
    z-index: 30;
}

.nav-item:hover .dropdown-menu {
    display: block;
}

.dropdown-menu button,
.mobile-nav button {
    display: block;
    width: 100%;
    padding: 12px 15px;
    border-bottom: 2px solid var(--black);
    text-align: left;
}

.dropdown-menu button:last-child,
.mobile-nav button:last-child {
    border-bottom: 0;
}

.mobile-nav-head {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    font-weight: 900;
}

.icon-button {
    border: var(--border);
    background: var(--lime);
    padding: 8px 10px;
    font-weight: 900;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 32px;
    align-items: start;
}

.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

.window-box {
    margin-bottom: 28px;
}

.window-title {
    border-bottom: var(--border);
    background: var(--lime);
    padding: 11px 16px;
    font-weight: 950;
    letter-spacing: 0;
    text-transform: uppercase;
}

.olive-title {
    background: var(--olive);
    color: var(--ivory);
}

.light-title {
    background: var(--light-lime);
}

.window-content {
    padding: 20px;
}

.welcome-layout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

.welcome-copy {
    flex: 1;
}

.welcome-copy p {
    margin: 0 0 16px;
}

.mark-olive,
.mark-black {
    padding: 0 4px;
}

.mark-olive {
    background: var(--olive);
    color: var(--ivory);
}

.mark-black {
    background: var(--black);
    color: var(--lime);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.action-button,
.wide-button,
.back-button,
.github-strip a,
.sitemap-button,
.contact-form button {
    border: var(--border);
    box-shadow: 4px 4px 0 var(--black);
    padding: 12px 18px;
    font-weight: 900;
    text-decoration: none;
}

.action-button:hover,
.wide-button:hover,
.back-button:hover,
.github-strip a:hover,
.sitemap-button:hover,
.contact-form button:hover {
    background: var(--black);
    color: var(--lime);
}

.action-button:active,
.wide-button:active,
.back-button:active,
.github-strip a:active,
.sitemap-button:active,
.contact-form button:active {
    box-shadow: none;
    transform: translate(4px, 4px);
}

.olive {
    background: var(--olive);
    color: var(--ivory);
}

.lime,
.wide-button {
    background: var(--lime);
    color: var(--black);
}

.profile-frame {
    width: 210px;
    height: 260px;
    flex: 0 0 auto;
    overflow: hidden;
    border: var(--border);
    box-shadow: var(--shadow);
    background: var(--olive);
}

.profile-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    padding: 18px 10px;
    text-align: center;
}

.stat-card strong {
    display: block;
    font-size: 1.7rem;
    font-weight: 950;
}

.stat-card span {
    display: block;
    font-size: 0.8rem;
    font-weight: 800;
}

.tag-row,
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-row span,
.tag-cloud span {
    border: 2px solid var(--black);
    background: var(--black);
    color: var(--lime);
    padding: 5px 9px;
    font-size: 0.8rem;
    font-weight: 850;
}

.tag-cloud span {
    background: var(--lime);
    color: var(--black);
}

.tag-cloud span:hover {
    background: var(--black);
    color: var(--lime);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 28px;
}

.project-card {
    display: flex;
    min-height: 100%;
    flex-direction: column;
    overflow: hidden;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 8px 8px 0 var(--black);
}

.project-media {
    position: relative;
    border-bottom: var(--border);
}

.project-media img {
    width: 100%;
    height: 170px;
    object-fit: cover;
}

.project-chip {
    position: absolute;
    left: 12px;
    top: 12px;
    border: 2px solid var(--black);
    background: var(--lime);
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 950;
}

.project-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 16px;
}

.project-body h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    line-height: 1.3;
}

.project-body small {
    color: var(--olive);
    font-weight: 850;
}

.project-body p {
    flex: 1;
    margin: 12px 0 14px;
    color: #333;
    font-size: 0.85rem;
}

.mini-tags,
.project-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mini-tags span,
.project-stats span,
.blog-tags span {
    border: 2px solid var(--black);
    background: var(--lime);
    padding: 3px 7px;
    font-size: 0.72rem;
    font-weight: 850;
}

.project-stats span {
    background: var(--light-lime);
}

.github-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    padding: 20px;
}

.github-strip strong,
.github-strip span {
    display: block;
}

.github-strip a {
    background: var(--black);
    color: var(--lime);
    white-space: nowrap;
}

.filter-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 28px;
    border: var(--border);
    box-shadow: 4px 4px 0 var(--black);
}

.filter-tabs button {
    border: 0;
    border-right: var(--border);
    background: var(--ivory);
    padding: 12px 8px;
    font-size: 0.9rem;
    font-weight: 950;
}

.filter-tabs button:last-child {
    border-right: 0;
}

.filter-tabs button:hover,
.filter-tabs button.active {
    background: var(--black);
    color: var(--lime);
}

.post-stack,
.blog-list {
    display: grid;
    gap: 16px;
}

.post-preview,
.blog-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 16px;
    border: 2px solid var(--black);
    background: var(--light-lime);
    padding: 14px;
    text-align: left;
}

.post-preview:hover,
.blog-card:hover {
    background: var(--black);
    color: var(--lime);
}

.post-preview img,
.blog-card img {
    width: 112px;
    height: 112px;
    border: 2px solid var(--black);
    object-fit: cover;
}

.blog-card {
    grid-template-columns: 160px minmax(0, 1fr);
    background: var(--ivory);
    border: var(--border);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.blog-card img {
    width: 160px;
    height: 140px;
}

.post-copy h3,
.blog-copy h3 {
    margin: 5px 0 6px;
    line-height: 1.35;
}

.post-meta,
.blog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 0.76rem;
    font-weight: 850;
}

.category-chip {
    border: 2px solid var(--black);
    background: var(--lime);
    padding: 2px 7px;
    color: var(--black);
}

.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.wide-button {
    width: 100%;
    margin-top: 18px;
}

.markdown-body {
    padding: 26px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin-top: 1.6em;
    line-height: 1.25;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
    margin-top: 0;
}

.markdown-body pre {
    overflow: auto;
    border: var(--border);
    padding: 14px;
    background: #111;
}

.back-button {
    margin-bottom: 18px;
    background: var(--ivory);
}

.reader-toc {
    margin-top: 18px;
    padding: 16px;
}

.reader-toc a {
    display: block;
    margin-top: 8px;
    font-weight: 800;
}

.reader-toc a:hover {
    color: var(--olive);
}

.contact-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.contact-card {
    padding: 18px;
    text-decoration: none;
}

.contact-card:hover {
    background: var(--black);
    color: var(--lime);
}

.contact-card strong,
.contact-card span {
    display: block;
}

.contact-card span {
    margin-top: 6px;
    font-size: 0.8rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.contact-form {
    margin-bottom: 28px;
}

.form-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 20px;
}

.form-body label {
    display: grid;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 950;
    letter-spacing: 0;
    text-transform: uppercase;
}

.form-body .full {
    grid-column: 1 / -1;
}

.form-body input,
.form-body select,
.form-body textarea {
    width: 100%;
    border: var(--border);
    background: var(--light-lime);
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 750;
}

.form-body input:focus,
.form-body select:focus,
.form-body textarea:focus {
    outline: 0;
    background: var(--lime);
}

#view-programs .window-title {
    color: var(--theme-olive);
}
#programs-grid {
    grid-column: 1 / -1;
}

.form-result {
    grid-column: 1 / -1;
    min-height: 1.3em;
    margin: 0;
    font-weight: 900;
}

.side-column {
    position: sticky;
    top: 104px;
}

.sitemap-button {
    width: 100%;
    margin-bottom: 28px;
    background: var(--ivory);
    font-size: 1.15rem;
    text-transform: uppercase;
}

.quick-links {
    display: grid;
}

.quick-links button {
    border-bottom: 2px solid var(--black);
    padding: 13px 16px;
    text-align: left;
}

.quick-links button:last-child {
    border-bottom: 0;
}

.author-card {
    margin-bottom: 28px;
}

.author-body {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 16px;
}

.author-body img {
    width: 54px;
    height: 54px;
    border: var(--border);
    object-fit: cover;
}

.author-body strong,
.author-body span {
    display: block;
}

.author-body span {
    color: #555;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1.35;
}

.related-links {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.related-links a {
    border: var(--border);
    background: var(--black);
    color: var(--lime);
    padding: 12px;
    font-weight: 950;
    text-decoration: none;
}

.related-links a:nth-child(2) {
    background: var(--lime);
    color: var(--black);
}

.related-links a:nth-child(3) {
    background: var(--olive);
    color: var(--ivory);
}

.site-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: var(--border);
}

.site-footer div {
    display: flex;
    border: var(--border);
    box-shadow: 4px 4px 0 var(--black);
}

.site-footer button {
    border-right: var(--border);
    background: var(--ivory);
    padding: 9px 12px;
}

.site-footer button:last-child {
    border-right: 0;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.72);
}

.modal {
    width: min(680px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: var(--ivory);
    border: var(--border);
    box-shadow: 10px 10px 0 var(--black);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: var(--border);
    background: var(--lime);
    padding: 12px 18px;
    font-weight: 950;
}

.modal-head button {
    width: 34px;
    height: 34px;
    border: 2px solid var(--black);
    background: var(--ivory);
    font-weight: 950;
}

.modal-head button:hover {
    background: var(--black);
    color: var(--lime);
}

.modal-body {
    padding: 20px;
}

.modal-body img {
    width: 100%;
    height: 230px;
    margin-bottom: 18px;
    border: var(--border);
    object-fit: cover;
}

.modal-body h2 {
    margin: 0 0 4px;
}

.modal-subtitle {
    margin: 0 0 16px;
    color: var(--olive);
    font-weight: 850;
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.modal-stats div {
    border: var(--border);
    background: var(--lime);
    padding: 12px;
}

.modal-stats strong,
.modal-stats span {
    display: block;
}

@media (max-width: 980px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .side-column {
        position: static;
    }
}

@media (max-width: 760px) {
    .site-shell {
        padding: 12px;
    }

    .main-nav {
        position: static;
    }

    .mobile-nav-head {
        display: flex;
    }

    .nav-list {
        display: none;
    }

    .mobile-nav[hidden] {
        display: none;
    }

    .mobile-nav {
        display: block;
        border-top: var(--border);
    }

    .welcome-layout,
    .github-strip {
        flex-direction: column;
    }

    .profile-frame {
        width: min(100%, 260px);
        margin: 0 auto;
    }

    .stats-row,
    .project-grid,
    .contact-cards,
    .form-body {
        grid-template-columns: 1fr;
    }

    .post-preview,
    .blog-card {
        grid-template-columns: 1fr;
    }

    .post-preview img,
    .blog-card img {
        width: 100%;
        height: 180px;
    }

    .filter-tabs {
        grid-template-columns: 1fr;
    }

    .filter-tabs button {
        border-right: 0;
        border-bottom: var(--border);
    }

    .filter-tabs button:last-child {
        border-bottom: 0;
    }
}

/* Sidebar Layout (TIL & Series) */
.sidebar-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: start;
    margin-top: 20px;
}
.inner-sidebar {
    padding: 0;
    overflow: hidden;
}
.inner-sidebar .window-title {
    background: var(--ivory);
    border-bottom: var(--border);
    padding: 10px 15px;
    font-weight: bold;
}
.category-tree {
    display: flex;
    flex-direction: column;
}
.category-item {
    text-align: left;
    background: var(--ivory);
    border: none;
    border-bottom: var(--border);
    padding: 12px 15px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.2s, font-weight 0.2s;
}
.category-item:last-child {
    border-bottom: none;
}
.category-item:hover {
    background: var(--light-lime);
}
.category-item.active {
    font-weight: bold;
    background: var(--lime);
}
.category-item.sub-cat {
    padding-left: 35px;
    background: #fff;
    border-bottom: 1px solid #ddd;
}
.category-item.sub-cat:last-child {
    border-bottom: var(--border);
}
.category-item.sub-cat.active {
    background: var(--light-lime);
    font-weight: bold;
}
.sub-category-list {
    display: flex;
    flex-direction: column;
}
.inner-content {
    min-height: 500px;
}
@media (max-width: 900px) {
    .sidebar-layout {
        grid-template-columns: 1fr;
    }
}
