/* =====================================================================
   2026 가상융합 전문교육 포트폴리오 — 공통 스타일
   다크 테마 / 포인트 컬러 1개(청록) / Pretendard
   구간: 360(모바일) · 768(태블릿) · 1200(데스크톱) · 1600(대형 스크린)
   ===================================================================== */

/* ---------- 폰트 (로컬 제공, SIL OFL 1.1 — fonts/LICENSE-Pretendard.txt) ---------- */
@font-face {
    font-family: "Pretendard Variable";
    font-weight: 45 920;
    font-style: normal;
    font-display: swap;
    src: url("../fonts/PretendardVariable.woff2") format("woff2-variations"),
         url("../fonts/PretendardVariable.woff2") format("woff2");
}

/* ---------- 색상·간격 변수 ---------- */
:root {
    /* 배경·표면 */
    --bg:            #0e1117;
    --surface:       #161b22;
    --surface-2:     #1f2630;
    --surface-3:     #28303b;
    --border:        #2d3640;
    --overlay:       rgba(6, 9, 13, 0.97);

    /* 글자 — 배경 대비 WCAG AA 이상 (본문 15.8:1, 보조 7.6:1, 흐림 4.8:1) */
    --text:          #e6edf3;
    --text-muted:    #a3b0bd;
    --text-faint:    #7d8a97;

    /* 포인트 컬러 (청록 1종) */
    --accent:        #4cc2d2;
    --accent-strong: #7ad6e2;
    --accent-soft:   rgba(76, 194, 210, 0.14);
    --on-accent:     #06191d;

    /* 상태 색 (관리자 화면 알림용) */
    --success:       #5ccf8e;
    --warning:       #e3b341;
    --danger:        #f47067;

    /* 타이포·간격 */
    --font: "Pretendard Variable", Pretendard, system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    --radius:        12px;
    --radius-sm:     8px;
    --gap:           clamp(10px, 1.4vw, 20px);
    --gutter:        clamp(16px, 4vw, 48px);
    --content-max:   1600px;
    --header-h:      64px;
    --ease:          cubic-bezier(.2, .7, .2, 1);
}

/* ---------- 리셋·기본 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    word-break: keep-all;
    overflow-wrap: anywhere;
    -webkit-font-smoothing: antialiased;
}
img, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* 포커스 표시는 항상 유지 */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 1000;
    padding: 10px 16px; background: var(--accent); color: var(--on-accent); border-radius: var(--radius-sm); font-weight: 700;
}
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: var(--content-max); margin-inline: auto; padding-inline: var(--gutter); }
main { flex: 1; }

/* 이미지 페이드인 — JS 가 없으면 바로 보인다 */
.js .fade { opacity: 0; transition: opacity .5s var(--ease); }
.js .fade.is-loaded { opacity: 1; }

/* ---------- 버튼 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5em;
    min-height: 44px; padding: 10px 20px;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface-2); color: var(--text); font-weight: 600; line-height: 1.2;
    transition: background-color .2s, border-color .2s, color .2s;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* ---------- 헤더 ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(14, 17, 23, 0.86);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1rem; line-height: 1.25; min-height: 44px; }
.brand:hover { color: var(--text); }
.brand__mark { flex: none; width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #2a6f9e); }
.brand__year { color: var(--accent); }

.nav-toggle {
    display: none; align-items: center; justify-content: center;
    width: 44px; height: 44px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.nav-toggle__bar, .nav-toggle__bar::before, .nav-toggle__bar::after {
    content: ""; display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; position: relative; transition: transform .2s, background-color .2s;
}
.nav-toggle__bar::before { position: absolute; top: -6px; }
.nav-toggle__bar::after { position: absolute; top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar::after { transform: translateY(-6px) rotate(-45deg); }

.site-nav ul { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.site-nav a {
    display: flex; align-items: center; min-height: 44px; padding: 8px 14px;
    border-radius: 999px; color: var(--text-muted); font-weight: 600;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--on-accent); background: var(--accent); }

@media (max-width: 899px) {
    .js .nav-toggle { display: inline-flex; }
    .js .site-nav {
        position: absolute; left: 0; right: 0; top: 100%;
        background: var(--bg); border-bottom: 1px solid var(--border);
        padding: 8px var(--gutter) 16px;
    }
    .js .site-nav:not(.is-open) { display: none; }
    .js .site-nav ul { flex-direction: column; }
    .js .site-nav a { border-radius: var(--radius-sm); padding: 12px 14px; }
    /* JS 가 없으면 메뉴를 가로 스크롤 한 줄로 */
    html:not(.js) .site-header__inner { flex-wrap: wrap; }
    html:not(.js) .site-nav { width: 100%; overflow-x: auto; }
}

/* ---------- 푸터 ---------- */
.site-footer { margin-top: clamp(48px, 8vw, 96px); border-top: 1px solid var(--border); color: var(--text-muted); font-size: .9rem; }
.site-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block: 28px; }
.site-footer p { margin: 0; }
.site-footer strong { color: var(--text); font-weight: 600; }

/* ---------- 페이지 머리 ---------- */
.page-head { padding-block: clamp(32px, 6vw, 72px) clamp(20px, 3vw, 36px); }
.page-head__eyebrow { margin: 0 0 8px; color: var(--accent); font-weight: 700; font-size: .9rem; letter-spacing: .08em; }
.page-head h1 { font-size: clamp(1.75rem, 4vw, 3rem); margin: 0 0 10px; }
.page-head p { color: var(--text-muted); margin: 0; font-size: clamp(1rem, 1.4vw, 1.15rem); }
.page-head__count { color: var(--text-faint); font-size: .95rem; margin-top: 8px !important; }

/* ---------- 히어로 (메인) ---------- */
.hero {
    position: relative; overflow: hidden;
    padding-block: clamp(56px, 10vw, 140px) clamp(40px, 7vw, 96px);
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(60% 80% at 85% 10%, rgba(76, 194, 210, .16), transparent 60%),
        radial-gradient(50% 70% at 0% 100%, rgba(42, 111, 158, .18), transparent 60%);
}
.hero__eyebrow { color: var(--accent); font-weight: 700; letter-spacing: .1em; font-size: clamp(.85rem, 1.2vw, 1rem); margin-bottom: 12px; }
.hero h1 { font-size: clamp(2rem, 6vw, 4.5rem); font-weight: 800; letter-spacing: -0.025em; margin-bottom: 18px; }
.hero__lead { max-width: 44em; color: var(--text-muted); font-size: clamp(1.05rem, 1.8vw, 1.35rem); margin-bottom: 28px; }
.hero__stats { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0; padding: 0; list-style: none; }
.hero__stats li { display: flex; flex-direction: column; }
.hero__stats strong { font-size: clamp(1.75rem, 3.5vw, 2.75rem); font-weight: 800; color: var(--text); line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero__stats span { color: var(--text-muted); font-size: .9rem; }

/* ---------- 섹션 ---------- */
.section { padding-block: clamp(36px, 6vw, 72px) 0; }
.section__head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: clamp(16px, 2vw, 24px); }
.section__head h2 { font-size: clamp(1.35rem, 2.6vw, 2rem); margin: 0; }
.section__head p { margin: 4px 0 0; color: var(--text-muted); }

/* ---------- 갤러리 입구 카드 (메인) ---------- */
.gallery-cards { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 768px) { .gallery-cards { grid-template-columns: repeat(3, 1fr); } }
.gallery-card {
    position: relative; display: flex; flex-direction: column; justify-content: flex-end;
    aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); color: var(--text);
    isolation: isolate;
}
.gallery-card:hover { color: var(--text); border-color: var(--accent); }
.gallery-card picture, .gallery-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.gallery-card img { transition: transform .6s var(--ease), opacity .5s var(--ease); }
.gallery-card:hover img { transform: scale(1.03); }
.gallery-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(14,17,23,0) 30%, rgba(14,17,23,.92) 100%); }
.gallery-card__body { padding: clamp(16px, 2vw, 28px); }
.gallery-card__label { margin: 0 0 4px; color: var(--accent); font-weight: 700; font-size: .85rem; letter-spacing: .06em; }
.gallery-card h3 { font-size: clamp(1.3rem, 2.2vw, 1.85rem); margin: 0 0 4px; }
.gallery-card__meta { margin: 0; color: var(--text-muted); font-size: .95rem; }
.gallery-card__arrow { display: inline-block; margin-left: 6px; transition: transform .2s; }
.gallery-card:hover .gallery-card__arrow { transform: translateX(4px); }

/* ---------- 공통 카드 (대표작·동영상) ---------- */
.card-grid { display: grid; gap: var(--gap); margin: 0; padding: 0; list-style: none; }
.card-grid--featured { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 768px)  { .card-grid--featured { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .card-grid--featured { grid-template-columns: repeat(4, 1fr); } }

.card-grid--video { grid-template-columns: 1fr; }
@media (min-width: 768px)  { .card-grid--video { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .card-grid--video { grid-template-columns: repeat(3, 1fr); } }

.mcard { display: block; color: var(--text); border-radius: var(--radius); }
.mcard:hover { color: var(--text); }
.mcard__media {
    position: relative; overflow: hidden; aspect-ratio: 16 / 9;
    border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border);
}
.mcard__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease), opacity .5s var(--ease); }
.mcard:hover .mcard__media img { transform: scale(1.03); }
.mcard:hover .mcard__media { border-color: var(--accent); }
.mcard__body { padding: 12px 2px 0; }
.mcard__title { margin: 0; font-size: clamp(1rem, 1.2vw, 1.1rem); font-weight: 600; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mcard__student { margin: 2px 0 0; color: var(--text-muted); font-size: .9rem; }
.mcard__tag {
    position: absolute; left: 10px; top: 10px; padding: 3px 10px; border-radius: 999px;
    background: rgba(14,17,23,.78); color: var(--text); font-size: .78rem; font-weight: 600;
}

/* 재생 아이콘·재생시간 배지 */
.play-icon {
    position: absolute; left: 50%; top: 50%; width: clamp(48px, 5vw, 64px); height: clamp(48px, 5vw, 64px);
    transform: translate(-50%, -50%); border-radius: 50%;
    background: rgba(14,17,23,.62); border: 2px solid rgba(255,255,255,.85);
    display: grid; place-items: center; transition: background-color .2s, transform .2s;
    pointer-events: none;
}
.play-icon::before { content: ""; margin-left: 4px; border-style: solid; border-width: 10px 0 10px 16px; border-color: transparent transparent transparent #fff; }
.mcard:hover .play-icon, .mcard:focus-visible .play-icon { background: var(--accent); border-color: var(--accent); transform: translate(-50%, -50%) scale(1.06); }
.mcard:hover .play-icon::before, .mcard:focus-visible .play-icon::before { border-left-color: var(--on-accent); }
.duration {
    position: absolute; right: 10px; bottom: 10px; padding: 2px 8px; border-radius: 6px;
    background: rgba(0,0,0,.78); color: #fff; font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums;
}

/* ---------- 사진 갤러리 — CSS grid 기반 Masonry ----------
   각 항목의 세로 칸 수(--r)는 서버가 이미지 비율로 계산한다 (가로폭 1/20 단위).
   행 높이를 열 너비 기준(cqi)으로 정하므로 열 수가 바뀌어도 비율이 유지된다. */
.masonry-wrap { container-type: inline-size; }
.masonry {
    --cols: 2;
    display: grid; margin: 0; padding: 0; list-style: none;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    column-gap: var(--gap);
    grid-auto-rows: calc((100cqi - (var(--cols) - 1) * var(--gap)) / var(--cols) / 20);
}
@media (min-width: 768px)  { .masonry { --cols: 3; } }
@media (min-width: 1200px) { .masonry { --cols: 4; } }
@media (min-width: 1600px) { .masonry { --cols: 5; } }
.masonry__item { grid-row-end: span var(--r, 15); padding-bottom: var(--gap); min-height: 0; }
.photo-card {
    position: relative; display: block; width: 100%; height: 100%; overflow: hidden;
    border-radius: var(--radius); background: var(--surface-2); color: var(--text);
}
.photo-card:hover { color: var(--text); }
.photo-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease), opacity .5s var(--ease); }
.photo-card:hover img { transform: scale(1.03); }
.photo-card__caption {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 32px 12px 10px;
    background: linear-gradient(180deg, rgba(14,17,23,0), rgba(14,17,23,.88));
}
.photo-card__title { display: block; font-weight: 600; font-size: .95rem; line-height: 1.35;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-card__student { display: block; color: var(--text-muted); font-size: .82rem; }
.photo-card__badge {
    position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 999px;
    background: var(--accent); color: var(--on-accent); font-size: .75rem; font-weight: 700;
}
/* 컨테이너 쿼리 단위를 지원하지 않는 브라우저 — 고정 비율 그리드로 대체 */
@supports not (width: 1cqi) {
    .masonry { grid-auto-rows: auto; }
    .masonry__item { grid-row-end: auto; }
    .photo-card { aspect-ratio: 4 / 3; }
}

/* ---------- 더 보기 / 페이지네이션 ---------- */
.load-more { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: clamp(24px, 4vw, 40px); }
.load-more__status { color: var(--text-faint); font-size: .9rem; margin: 0; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 32px; }
.js .pager--fallback { display: none; }

/* ---------- 빈 상태 ---------- */
.empty {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
    padding: clamp(48px, 10vw, 120px) 16px; border: 1px dashed var(--border); border-radius: var(--radius);
    color: var(--text-muted);
}
.empty__icon { width: 56px; height: 56px; opacity: .6; }
.empty h2 { font-size: 1.25rem; color: var(--text); margin: 8px 0 0; }
.empty p { margin: 0; }

/* ---------- 라이트박스 / 동영상 모달 (공용 뷰어) ---------- */
html.is-locked, html.is-locked body { overflow: hidden; }
.viewer {
    position: fixed; inset: 0; z-index: 200;
    display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
    background: var(--overlay);
    animation: viewer-in .2s var(--ease);
}
@keyframes viewer-in { from { opacity: 0; } to { opacity: 1; } }
.viewer__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px clamp(10px, 2vw, 24px); }
.viewer__counter { color: var(--text-muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.viewer__btn {
    display: inline-grid; place-items: center; width: 48px; height: 48px; flex: none;
    border: 1px solid rgba(255,255,255,.18); border-radius: 50%;
    background: rgba(22,27,34,.75); color: var(--text); font-size: 1.4rem; line-height: 1;
    transition: background-color .2s, border-color .2s;
}
.viewer__btn:hover { background: var(--surface-3); border-color: var(--accent); }
.viewer__btn svg { width: 22px; height: 22px; }
.viewer__main { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 clamp(8px, 6vw, 88px); }
.viewer__nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.viewer__nav--prev { left: clamp(8px, 1.5vw, 24px); }
.viewer__nav--next { right: clamp(8px, 1.5vw, 24px); }
.viewer__stage {
    position: relative; width: 100%; max-width: 1600px; height: 100%; min-height: 0;
    display: flex; align-items: center; justify-content: center;
    container-type: size;
}
.viewer__stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: var(--radius-sm); }
/* 영상은 무대(stage) 안에 들어가는 가장 큰 16:9 — 가로·세로 어느 쪽이 좁아도 비율 유지 */
.viewer__frame {
    position: relative; width: min(100cqw, 100cqh * 16 / 9); aspect-ratio: 16 / 9;
    background: #000; border-radius: var(--radius-sm); overflow: hidden;
}
@supports not (width: 1cqw) { .viewer__frame { width: min(100%, (100vh - 220px) * 16 / 9); } }
.viewer__frame video, .viewer__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.viewer__message { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--text-muted); }
.viewer__caption { padding: 12px clamp(16px, 6vw, 88px) clamp(16px, 2.5vw, 28px); text-align: center; max-height: 30vh; overflow-y: auto; }
.viewer__title { font-size: clamp(1.05rem, 1.6vw, 1.35rem); margin: 0; }
.viewer__student { color: var(--accent); margin: 2px 0 0; font-weight: 600; }
.viewer__desc { color: var(--text-muted); margin: 6px auto 0; max-width: 60em; white-space: pre-line; font-size: .95rem; }
.viewer__loading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.viewer__loading::after {
    content: ""; width: 36px; height: 36px; border-radius: 50%;
    border: 3px solid rgba(255,255,255,.2); border-top-color: var(--accent); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 767px) {
    .viewer__main { padding: 0 4px; }
    .viewer__nav { top: auto; bottom: 8px; transform: none; }
}

/* ---------- 오류 페이지 ---------- */
.error-page { text-align: center; padding-block: clamp(64px, 14vw, 160px); }
.error-page__code { font-size: clamp(4rem, 14vw, 9rem); font-weight: 800; line-height: 1; color: var(--accent); margin: 0 0 12px; letter-spacing: -0.04em; }
.error-page h1 { font-size: clamp(1.4rem, 3vw, 2rem); }
.error-page p { color: var(--text-muted); }
.error-page__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }

/* ---------- 움직임 줄이기 설정 존중 ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
