/* ==========================================================================
   바탕 — 초기화, 본문 기본, 브랜드, 최상단 버튼
   ========================================================================== */

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

/* display 를 지정한 클래스가 [hidden] 을 덮어쓰지 못하게 합니다 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

/* 한국어는 어절 단위로 끊고, 긴 URL·영문은 강제로 접습니다.
   언어를 바꿔도 글자가 상자 밖으로 나가지 않게 하려는 것입니다. */
body, h1, h2, h3, p, span, a, button, li, td, th {
  word-break: keep-all;
  overflow-wrap: break-word;
}

h1, h2, h3 { margin: 0; font-weight: var(--fw-mid); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, select, input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-s);
}

.sr-only {
  position: absolute; 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: var(--sp-4); top: -48px; z-index: 100;
  padding: var(--sp-4) var(--sp-6); background: var(--accent); color: #fff;
  border-radius: var(--radius); transition: top .12s;
}
.skip-link:focus { top: var(--sp-4); }

/* ---------------------------------------------------------------- 브랜드
   CI 가 흑백이라 브랜드 영역은 무채색으로 두고,
   파랑은 누를 수 있는 것에만 씁니다. 로고를 누르면 첫 화면으로 갑니다. */
.brand {
  display: flex; align-items: center; gap: var(--sp-4);
  flex: 0 0 auto; min-width: 0;
  height: var(--ctl-h); padding: 0 var(--sp-4) 0 var(--sp-2);
  margin-left: calc(var(--sp-2) * -1);
  background: none; border: 0; border-radius: var(--radius);
  color: inherit; text-decoration: none; cursor: pointer;
}
.brand:hover { background: var(--surface-2); }
.brand__logo { height: 15px; width: auto; flex: 0 0 auto; display: block; object-fit: contain; }
.brand__mark {
  display: inline-flex; align-items: center; justify-content: center;
  height: 20px; padding: 0 var(--sp-3); flex: 0 0 auto;
  border-radius: var(--radius-s);
  background: var(--text); color: var(--surface);
  font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .06em;
}
.brand__div { width: 1px; height: var(--sp-6); flex: 0 0 1px; background: var(--border); }
.brand__name {
  font-size: var(--fs-lg); font-weight: var(--fw-mid); white-space: nowrap;
  letter-spacing: -.01em;
}

/* ------------------------------------------------------------ 최상단 버튼
   화면 어디에 있든 오른쪽 아래 같은 자리에 있습니다. */
.to-top {
  position: fixed; right: var(--sp-7); bottom: var(--sp-7); z-index: var(--z-topbar);
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-h);
  color: var(--text-2); cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(var(--sp-3));
  transition: opacity .15s, transform .15s, visibility .15s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }
.to-top svg { width: 17px; height: 17px; }

@media (max-width: 720px) {
  .to-top { right: var(--sp-5); bottom: var(--sp-5); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .side, .rail, .to-top, .card__fav { display: none !important; }
  .app { display: block; }
  .card { break-inside: avoid; box-shadow: none; }
}
