/* 공통 스타일: 네 HTML 페이지의 배경, 제목 보조 요소, 내비게이션, 공통 카드에 적용 */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;700&display=swap');

/* 모든 페이지에서 공유하는 색상 토큰 */
:root {
    --bg-1: #0a0a0a;
    --bg-2: #1a1a2e;
    --bg-3: #16213e;
    --accent-green: #00ff41;
    --accent-red: #ff4444;
    --accent-blue: #6ea8ff;
    --accent-blue-text: #a9c7ff; /* 작은 글씨용: 어두운 배경 대비 6:1 이상 */
    --accent-cyan: #5ee7ff;
    --surface-blue: #10182f;
    --surface-violet: #18152d;
    --text-dim: #b4b4b4;
    --text-dimmer: #8f8f8f;
    --border-dim: #333;
}

/* 모든 페이지의 기본 여백과 box sizing */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 모든 페이지 본문 배경, 기본 글꼴, 기본 글자색 */
body {
    font-family: 'JetBrains Mono', monospace;
    background: #000;
    color: var(--accent-green);
    min-height: 100vh;
    cursor: none;
}

/* 모든 페이지가 공유하는 중앙 보드 */
.page-wrap {
    width: 100%;
    max-width: 1100px !important;
    min-height: 100vh;
    margin-left: auto;
    margin-right: auto;
    background:
        radial-gradient(circle at 12% 8%, rgba(0, 255, 65, 0.08), transparent 28%),
        radial-gradient(circle at 88% 10%, rgba(91, 104, 255, 0.12), transparent 30%),
        linear-gradient(135deg, var(--bg-1) 0%, var(--surface-violet) 48%, var(--surface-blue) 100%);
}

@media (max-width: 1100px) {
    .page-wrap {
        max-width: 100% !important;
    }
}

@media (min-width: 601px) {
    .nav-links {
        left: 50%;
        right: auto;
        width: min(1100px, calc(100% - 2.4rem));
        justify-content: flex-end;
        transform: translateX(-50%);
    }

    .debug-toggle {
        left: max(1rem, calc((100vw - 1100px) / 2 + 1rem));
    }
}

/* 공통 링크 기본 색상 */
a {
    color: inherit;
}

/* ===== 커스텀 커서 ===== */
.terminal-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    background: var(--accent-green);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1000;
    transition: transform 0.1s ease;
    box-shadow: 0 0 20px var(--accent-green);
}

/* ===== 배경 매트릭스 효과 ===== */
.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.1;
    pointer-events: none;
}

.matrix-char {
    position: absolute;
    color: var(--accent-green);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    animation: matrixFall linear infinite;
}

@keyframes matrixFall {
    0% {
        transform: translateY(-100vh);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* ===== 네비게이션 ===== */
.nav-links {
    position: fixed;
    top: 0.8rem;
    right: 1.2rem;
    display: flex;
    gap: 0.6rem;
    z-index: 100;
}

.nav-item {
    position: relative;
    align-self: flex-start;
}

.nav-link {
    color: var(--accent-blue-text);
    text-decoration: none;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    display: inline-block;
    background: rgba(10, 10, 10, 0.2);
}

@keyframes c0z0c-nav-shake {
    0%, 100% {
        transform: rotate(0deg) translateX(0);
    }
    20% {
        transform: rotate(-2deg) translateX(-1px);
    }
    40% {
        transform: rotate(2deg) translateX(1px);
    }
    60% {
        transform: rotate(-1.5deg) translateX(-1px);
    }
    80% {
        transform: rotate(1deg) translateX(1px);
    }
}

.nav-link.ai-c0z0c-link.is-shaking {
    animation: c0z0c-nav-shake 0.5s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
    .nav-link.ai-c0z0c-link.is-shaking {
        animation: none;
    }
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-green);
    border-color: var(--accent-green);
    box-shadow: 0 0 18px rgba(0, 255, 65, 0.2);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid var(--accent-green);
    border-radius: 4px;
    min-width: 250px;
    padding: 1rem;
    display: none;
    z-index: 200;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow:
        0 4px 20px rgba(0, 255, 65, 0.2),
        0 0 40px rgba(0, 255, 65, 0.1);
}

.dropdown-menu.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.dropdown-title {
    color: var(--accent-green);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 0.5rem;
}

.project-item {
    display: block;
    color: var(--text-dim);
    text-decoration: none;
    padding: 0.5rem 0;
    border-bottom: 1px solid #222;
    transition: all 0.3s ease;
    font-size: 1.0rem;
}

.project-item:last-child {
    border-bottom: none;
}

.project-item:hover {
    color: var(--accent-green);
    padding-left: 0.5rem;
    background: rgba(0, 255, 65, 0.1);
}

.project-description {
    font-size: 0.95rem;
    color: var(--text-dimmer);
    margin-top: 0.2rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* ===== 디버깅용 가이드 라인 ===== */
.debug-line-vertical,
.debug-line-horizontal,
.debug-line-connection {
    position: fixed;
    background: yellow;
    pointer-events: none;
    z-index: 999;
    opacity: 0.8;
    display: none;
}

.debug-line-vertical {
    width: 2px;
    height: 100vh;
    top: 0;
}

.debug-line-horizontal {
    height: 2px;
    width: 100vw;
    left: 0;
}

.debug-line-connection {
    height: 2px;
    transform-origin: left center;
    background: yellow;
}

body.debug-mode .debug-line-vertical,
body.debug-mode .debug-line-horizontal,
body.debug-mode .debug-line-connection {
    display: block;
}

.debug-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    background: rgba(7, 7, 7, 0.2);
    border: 1px solid #171817;
    color: #240000;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

.debug-toggle:hover {
    background: rgba(0, 255, 65, 0.3);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

@media (max-width: 768px) {
    .debug-toggle {
        top: 0.5rem;
        left: 0.5rem;
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
}

/* ===== 모바일: 햄버거 토글 메뉴 ===== */
.nav-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 300;
    width: 2.6rem;
    height: 2.6rem;
    background: rgba(10, 10, 10, 0.7);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    font-size: 1.2rem;
    border-radius: 4px;
    cursor: pointer;
}

@media (max-width: 600px) {
    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        top: 0;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: rgba(6, 6, 10, 0.97);
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
        padding: 4.6rem 1.2rem 1.5rem;
        max-height: 100vh;
        overflow-y: auto;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        display: block;
        text-align: center;
        font-size: 0.9rem;
        padding: 0.7rem 0.8rem;
    }

    .dropdown-menu {
        position: static;
        width: 100%;
        min-width: 0;
        margin-top: 0.4rem;
    }
}

@media (hover: none) {
    body {
        cursor: auto;
    }

    .terminal-cursor {
        display: none;
    }
}

/* ===== 프로젝트 카드 (portfolio.js가 렌더링) ===== */
.proj-card {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    width: 260px;
    text-decoration: none;
    background: linear-gradient(180deg, rgba(16, 24, 47, 0.84), rgba(8, 10, 20, 0.94));
    border: 1px solid rgba(125, 143, 190, 0.24);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.25s ease;
}

.proj-card:hover {
    border-color: var(--accent-green);
    box-shadow: 0 12px 32px rgba(0, 255, 65, 0.16);
    transform: translateY(-2px);
}

.proj-thumb {
    position: relative;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.proj-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(4, 8, 18, 0.02), rgba(4, 8, 18, 0.7)),
        linear-gradient(90deg, rgba(0, 255, 65, 0.08), transparent 42%, rgba(126, 93, 255, 0.1));
}

.proj-thumb video,
.proj-thumb .proj-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease, filter 0.35s ease;
}

.proj-card:hover .proj-thumb video,
.proj-card:hover .proj-thumb .proj-img {
    transform: scale(1.06);
    filter: saturate(1.15) contrast(1.05);
}

.proj-emoji {
    font-size: 2.5rem;
}

.proj-video-badge {
    position: absolute;
    bottom: 0.4rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
    color: var(--accent-cyan);
    font-size: 0.85rem;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    letter-spacing: 0.05em;
}

.proj-body {
    padding: 0.55rem 0.85rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: rgba(5, 7, 15, 0.54);
}

.proj-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-green);
    line-height: 1.3;
}

.proj-desc {
    font-size: 1.02rem;
    color: var(--text-dim);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.proj-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: auto;
}

.proj-tag {
    font-size: 0.7rem;
    color: var(--accent-blue-text);
    border: 1px solid var(--border-dim);
    border-radius: 3px;
    padding: 0.12rem 0.4rem;
}

/* ===== 대화면(FHD 이상) 보정: rem 기반 글씨/여백을 한 단계 키운다 ===== */
@media (min-width: 1600px) {
    html {
        font-size: 16px;
    }
}
