/* 시스템 폰트 스택 (인터넷 연결 없이도 동작) */
:root {
  --navy:   #0D2B55;
  --blue:   #1565C0;
  --sky:    #1E88E5;
  --accent: #FFB300;
  --light:  #E3F0FF;
  --white:  #FFFFFF;
  --gray:   #6B7A8D;
  --line:   #D0DCF0;
  --bg:     #F5F8FF;
}

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

body {
  font-family: 'Malgun Gothic', '맑은 고딕', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--white);
  min-height: 100vh;
}

/* ─── HEADER ─── */
header {
  background: #FFFFFF;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(13,43,85,0.18);
  overflow: hidden;
}
#header-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.header-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.header-logo .emblem {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.header-logo span {
  color: var(--white);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.header-logo .sub {
  font-size: 0.72rem;
  font-weight: 400;
  color: rgba(255,255,255,0.6);
  display: block;
}
.header-badge {
  background: var(--accent);
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}

/* ─── HERO ─── */
.hero {
  background: #0D2B55;
  color: var(--white);
  padding: 34px 2rem 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.hero-content {
  position: relative;
  z-index: 1;
}
.hero-eyebrow {
  display: inline-block;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
  position: relative;
}
.hero h1 {
  font-size: clamp(2rem, 6vw, 3.6rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  position: relative;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero p {
  font-size: 1rem;
  color: rgba(255,255,255,0.75);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.65;
  position: relative;
}
/* ─── TABS ─── */
.tabs-wrap {
  background: var(--white);
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: 64px;
  z-index: 90;
}
.tabs {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  padding: 0 1rem;
}
.tab-btn {
  background: none;
  border: none;
  padding: 16px 24px;
  font-family: 'Malgun Gothic', '맑은 고딕', 'Apple SD Gothic Neo', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 700;
}
.tab-btn:hover:not(.active) { color: var(--navy); }
.tab-btn .tab-icon { font-size: 1rem; }

/* ─── MAIN CONTENT ─── */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 36px 1.5rem 80px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Section title */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 4px; height: 18px;
  background: var(--blue);
  border-radius: 2px;
}
.item-count {
  font-size: 0.8rem;
  color: var(--gray);
  background: var(--light);
  padding: 3px 10px;
  border-radius: 20px;
}

/* ─── UPLOAD PANEL ─── */
.upload-panel {
  background: var(--white);
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 32px;
  transition: border-color 0.2s;
}
.upload-panel:hover { border-color: var(--sky); }
.upload-panel h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 6px;
}
.upload-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 600px) { .upload-fields { grid-template-columns: 1fr; } }

.upload-field input[type="text"],
.upload-field input[type="date"],
.upload-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: 'Malgun Gothic', '맑은 고딕', 'Apple SD Gothic Neo', sans-serif;
  font-size: 0.85rem;
  color: var(--navy);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}
.upload-field input:focus,
.upload-field textarea:focus { border-color: var(--sky); background: var(--white); }
.upload-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 5px;
}
.upload-field.full { grid-column: 1 / -1; }
.upload-field textarea { resize: vertical; min-height: 68px; }

.file-drop {
  border: 1.5px dashed var(--sky);
  border-radius: 10px;
  background: var(--light);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 14px;
  transition: background 0.2s;
}
.file-drop:hover { background: #d0e8ff; }
.file-drop input[type="file"] { display: none; }
.file-drop-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.file-drop-label .icon { font-size: 2rem; }
.file-drop-label p { font-size: 0.82rem; color: var(--gray); }
.file-drop-label strong { font-size: 0.9rem; color: var(--blue); }

.btn-upload {
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 11px 28px;
  font-family: 'Malgun Gothic', '맑은 고딕', 'Apple SD Gothic Neo', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-upload:hover { background: var(--navy); }

/* ─── CARDS ─── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

/* 포스터는 세로형 원본이 충분히 크게 보이도록 한 장 폭으로 표시 */
#posts-grid {
  grid-template-columns: minmax(320px, 760px);
  justify-content: start;
}
.poster-card {
  width: 100%;
  cursor: pointer;
}
.poster-thumb {
  width: 100%;
  height: auto;
  max-height: 860px;
  padding: 0;
}

.card {
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(13,43,85,0.07);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(13,43,85,0.13);
}

.card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: var(--light);
}
.card-thumb-contain {
  aspect-ratio: auto;
  max-height: 420px;
  object-fit: contain;
}
.card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--light), #c5dcf7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.card-body { padding: 14px 16px 16px; }
.card-category {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 8px;
  color: var(--navy);
}
.card-desc {
  font-size: 0.8rem;
  color: var(--gray);
  line-height: 1.6;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--gray);
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 2px;
}
.card-delete {
  background: none;
  border: none;
  color: #c0c8d8;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.card-delete:hover { color: #e53935; background: #fff0f0; }

/* Video card play button */
.card-thumb-wrap { position: relative; }
.play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13,43,85,0.22);
  transition: background 0.2s;
}
.card:hover .play-badge { background: rgba(13,43,85,0.38); }
.play-circle {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; line-height: 1.7; }

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: var(--white);
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  z-index: 999;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Admin tab upload panel */
.admin-section {
  background: var(--white);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 2px 12px rgba(13,43,85,0.07);
  margin-bottom: 24px;
}
.admin-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--line);
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}
.type-select {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.type-radio { display: none; }
.type-label {
  flex: 1;
  text-align: center;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray);
  transition: all 0.2s;
}
.type-radio:checked + .type-label {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--light);
}

/* Responsive */
@media (max-width: 500px) {
  header { height: 56px; padding: 0 1rem; }
  .header-logo .sub { display: none; }
  .header-badge { font-size: 0.68rem; padding: 4px 9px; }
  .hero { padding: 26px 1rem 30px; }
  .hero-eyebrow { margin-bottom: 10px; }
  .hero h1 { margin-bottom: 10px; }
  .hero p { font-size: 0.88rem; line-height: 1.6; }
  .tabs-wrap { top: 56px; }
  .tabs { justify-content: center; }
  .tab-btn { flex: 1; justify-content: center; padding: 13px 8px; font-size: 0.8rem; }
  main { padding: 24px 0.5rem 60px; }
  .cards-grid { grid-template-columns: 1fr; }
  #posts-grid { grid-template-columns: 1fr; }
  .poster-card { border-radius: 10px; }
  .poster-thumb {
    width: 100%;
    height: auto;
    max-height: none;
  }
}




/* ─── MODAL ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.modal-box video {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}
.card { cursor: pointer; }
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 32px rgba(13,43,85,0.18); }
