@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
  --ink: #15183c;        /* MBC-Blue_Super_Dark */
  --ink-2: #262b62;
  --blue: #4664e6;       /* MBC-Blue */
  --blue-dark: #3232c8;  /* MBC-Blue_Dark */
  --purple: #7742cc;     /* MBC-Purple */
  --blue-soft: #e9edfd;
  --muted: #5b6370;
  --line: #e3e6eb;
  --soft: #f3f5f8;
  --bg: #ffffff;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;          /* 한글 단어 중간 줄바꿈 방지 */
  overflow-wrap: break-word;
}
a { color: inherit; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* 상단 바 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  height: 60px; padding: 0 20px;
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand .dot { width: 28px; height: 28px; border-radius: 8px; background: var(--purple); display: grid; place-items: center; font-size: 13px; }
.topbar nav { display: flex; gap: 4px; margin-left: 12px; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a {
  text-decoration: none; padding: 8px 12px; border-radius: 8px;
  color: #c6ccd6; font-size: 14px; white-space: nowrap;
}
.topbar nav a:hover { background: var(--ink-2); color: #fff; }
.topbar nav a[aria-current="page"] { background: var(--ink-2); color: #fff; font-weight: 600; }
.topbar .spacer { flex: 1; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.btn.primary:hover { background: var(--ink); border-color: var(--ink); }
.topbar .btn { background: transparent; color: #fff; border-color: #3a404d; }
.topbar .btn:hover { border-color: #fff; }

/* 허브 */
.hero { background: var(--blue-dark); color: #fff; padding: 56px 20px 72px; }
.hero .wrap, .tiles { max-width: 1120px; margin: 0 auto; }
.hero small { color: #d6dcff; font-weight: 700; letter-spacing: .08em; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); margin: 8px 0 10px; line-height: 1.2; }
.hero p { color: #e1e5ff; margin: 0; }
.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px;
  padding: 0 20px; margin-top: -40px; margin-bottom: 60px;
}
.tile {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 26px 24px; min-height: 210px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; box-shadow: 0 6px 24px rgba(20, 23, 31, .06);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(20, 23, 31, .12); }
.tile .ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--soft); color: var(--ink); }
.tile.live .ico { background: var(--blue); color: #fff; }
.tile h2 { margin: 6px 0 0; font-size: 20px; }
.tile p { margin: 0; color: var(--muted); font-size: 14px; }
.tile .tag {
  position: absolute; top: 18px; right: 18px; font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: 99px; background: var(--soft); color: var(--muted);
}
.tile.live .tag { background: var(--blue-soft); color: var(--blue-dark); }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 0 20px 40px; }

/* 준비중 */
.wip { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 40px 20px; text-align: center; }
.wip .ico { width: 84px; height: 84px; border-radius: 22px; background: var(--soft); display: grid; place-items: center; margin: 0 auto 20px; }
.wip h1 { font-size: 28px; margin: 0 0 8px; }
.wip p { color: var(--muted); margin: 0 0 26px; }
.wip .typing::after { content: ""; animation: dots 1.4s steps(5) infinite; }
@keyframes dots { 0% { content: ""; } 20% { content: "."; } 40% { content: ".."; } 60% { content: "..."; } 80% { content: "...."; } 100% { content: "....."; } }
@media (prefers-reduced-motion: reduce) { .wip .typing::after { animation: none; content: "....."; } html { scroll-behavior: auto; } }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--ink); }
.topbar + .login { min-height: calc(100vh - 60px); }
.login form {
  width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 34px 30px;
}
.login h1 { font-size: 22px; margin: 14px 0 4px; }
.login p { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.login label { font-size: 13px; font-weight: 600; }
.login input {
  width: 100%; margin: 6px 0 14px; padding: 13px 14px; font-size: 18px; letter-spacing: .3em;
  border: 1px solid var(--line); border-radius: 10px;
}
.login .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.login .err { color: #c62828; font-size: 13px; margin: -6px 0 12px; }

/* 매뉴얼 뷰어 */
.viewer { display: grid; grid-template-columns: 300px 1fr; max-width: 1500px; margin: 0 auto; }
.toc {
  position: sticky; top: 124px; height: calc(100vh - 124px); overflow-y: auto;
  padding: 20px 16px 40px; border-right: 1px solid var(--line);
}
.toc h3 { font-size: 13px; margin: 18px 0 6px; display: flex; align-items: center; gap: 8px; }
.toc h3 a { text-decoration: none; }
.toc h3 .code { width: 22px; height: 22px; border-radius: 6px; background: var(--blue-dark); color: #fff; display: grid; place-items: center; font-size: 12px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li a {
  display: block; padding: 6px 10px; border-radius: 8px; text-decoration: none;
  font-size: 13.5px; color: var(--muted);
}
.toc li a:hover { background: var(--soft); color: var(--ink); }
.toc li a.on { background: var(--blue-soft); color: var(--blue-dark); font-weight: 600; }
.toc li a .lb { display: block; font-size: 11px; font-weight: 700; color: #6b7280; }
.toc li a.on .lb { color: var(--blue-dark); }
.toc .empty { color: var(--muted); font-size: 13px; padding: 6px 10px; }
.slides { padding: 24px 28px 80px; display: flex; flex-direction: column; gap: 34px; min-width: 0; }
.slide { margin: 0; scroll-margin-top: 140px; }
.slide.flash .frame { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px var(--blue); } 100% { box-shadow: 0 0 0 4px transparent; } }
.slide header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.slide header .no { font-size: 12px; font-weight: 700; color: var(--blue-dark); }
.slide header h2 { font-size: 16px; margin: 0; }
.slide header .sec-print { margin-left: auto; font-size: 12px; padding: 4px 10px; }
.frame { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); aspect-ratio: 16 / 9; }
.frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.frame .hot { position: absolute; display: block; border-radius: 12px; }
.frame .hot:hover { outline: 3px solid var(--blue); background: rgba(70, 100, 230, .08); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* 매뉴얼 상단 검색 */
.msearch { position: sticky; top: 60px; z-index: 15; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 20px; }
.msearch-in { position: relative; max-width: 1500px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.msearch input {
  flex: 1; min-width: 0; padding: 11px 14px 11px 42px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px;
  background: var(--soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%235b6370' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center;
}
.msearch input:focus { background-color: #fff; border-color: var(--blue); }
.msearch .cnt { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.msearch select { display: none; }
.results {
  position: absolute; top: calc(100% + 6px); left: 0; width: min(760px, 100%); max-height: min(60vh, 520px); overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 36px rgba(20, 23, 31, .16); padding: 6px;
}
.results a { display: block; padding: 9px 12px; border-radius: 9px; text-decoration: none; }
.results a:hover, .results a.sel { background: var(--blue-soft); }
.results .rn { font-size: 12px; font-weight: 700; color: var(--blue-dark); }
.results .rt { font-size: 14px; font-weight: 700; }
.results .rs { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.results mark { background: #ffe27a; color: inherit; border-radius: 3px; padding: 0 1px; }
.results .none { margin: 0; padding: 14px 12px; font-size: 14px; color: var(--muted); }
.zoom { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.frame img, .lbx img { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
/* 슬라이드 크게 보기(워터마크 덮음) */
.lbx { position: fixed; inset: 0; z-index: 100; background: rgba(12, 14, 34, .94); overflow: auto; padding: 56px 16px 24px; }
.lbx[hidden] { display: none; }
.lbx-x { position: fixed; top: 10px; right: 12px; z-index: 2; background: #fff; }
.lbx-in { position: relative; width: min(100%, 1700px); margin: 0 auto; }
.lbx-in img { display: block; width: 100%; height: auto; border-radius: 8px; }
.lbx-in .lbx-wm { position: absolute; inset: 0; height: 100%; opacity: .75; }
@media (max-width: 900px) { .lbx { padding: 52px 0 16px; } .lbx-in { width: 180%; } }
.frame img.wm { display: none; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
@media print { .frame img.wm { display: block; } }
.btn:disabled { opacity: .7; cursor: progress; }
.foot a { color: var(--muted); }

@media (max-width: 640px) {
  .topbar nav.hub-nav { display: none; }
  .brand { font-size: 15px; }
  .hero { padding: 36px 16px 60px; }
  .tiles { padding: 0 16px; gap: 14px; }
  .tile { min-height: 0; padding: 22px 20px; }
}

@media (max-width: 900px) {
  .viewer { grid-template-columns: 1fr; }
  .toc { display: none; }
  .msearch { padding: 8px 12px; }
  .msearch-in { gap: 8px; }
  .msearch input { font-size: 16px; padding: 10px 10px 10px 38px; background-position: 11px center; }
  .msearch .cnt { display: none; }
  .msearch select { display: block; flex: 0 0 34%; min-width: 0; padding: 10px 6px; border-radius: 10px; border: 1px solid var(--line); font-size: 14px; background: #fff; }
  .slide { scroll-margin-top: 130px; }
  .slides { padding: 16px 16px 60px; gap: 24px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .hide-sm { display: none; }
}

@media print {
  /* A4 세로 · 한 쪽에 슬라이드 2장 (190×107mm 두 장 + 간격 = 222mm < 쓸 수 있는 277mm, 세 장은 안 들어가 자동으로 넘어감) */
  @page { size: A4 portrait; margin: 10mm; }
  .topbar, .toc, .msearch, .sec-print, .no-print { display: none !important; }
  .viewer { display: block; }
  .slides { padding: 0; gap: 0; display: block; }
  .slide { break-inside: avoid; page-break-inside: avoid; margin: 0 0 12mm; }
  .slide header { display: none; }
  .frame { border: 0; border-radius: 0; }
  body[data-print-sec] .slide:not([data-sec-print]) { display: none; }
}
