/* ==========================================================================
   common.css - 공용 스타일 (재사용 가능한 변수 + 컴포넌트)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 디자인 토큰 (Design tokens)
   -------------------------------------------------------------------------- */
:root {
  /* 브랜드 컬러 */
  --brand: #ff9900;
  --brand-dark: #f0920e;
  --brand-accent: #ffa723;

  /* 배경 */
  --bg-topbar: #18191e;
  --bg-page: #fffaf2;
  --bg-card: #ffffff;
  --bg-surface: #ece9e1;

  /* 텍스트 */
  --text-strong: #222222;
  --text: #333333;
  --text-muted: #888888;
  --text-on-dark: #cfcfcf;

  /* 라인 */
  --line: #eeeeee;
  --line-soft: #f0f0f0;
  --line-header: #ebebeb;
  --line-footer: #ece7e1;

  /* 레이아웃 */
  --container: 1296px;
  --radius-card: 8px;
  --radius-pill: 999px;
}

/* --------------------------------------------------------------------------
   2. 기본 리셋 (Reset)
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR",
    "돋움", dotum, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: #e8e8e8;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --------------------------------------------------------------------------
   3. 레이아웃 유틸 (Layout)
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
}

/* 가로 정렬 공통 */
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.row-center {
  display: flex;
  align-items: center;
}

/* --------------------------------------------------------------------------
   4. 상단 안내 바 (Top bar)
   -------------------------------------------------------------------------- */
.topbar {
  background: var(--bg-topbar);
  color: var(--text-on-dark);
  font-size: 14px;
}

.topbar__inner {
  height: 45px;
}

.topbar__contact {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__contact .icon {
  width: 24px;
  height: 24px;
  flex: none;
}

.topbar__link {
  color: var(--brand);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   5. 헤더 (Header + 로고 + 검색)
   -------------------------------------------------------------------------- */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--line-header);
}

.header__inner {
  height: 103px;
}

.logo img {
  height: 67px;
}

.search {
  position: relative;
  width: 284px;
  height: 45px;
}

.search__input {
  width: 100%;
  height: 100%;
  padding: 0 56px 0 22px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid #d8d8d8;
  border-radius: var(--radius-pill);
  outline: none;
}

.search__input:focus {
  border-color: var(--brand);
}

.search__submit {
  position: absolute;
  top: 0;
  right: 4px;
  width: 52px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--brand);
}

.search__submit .icon {
  width: 22px;
  height: 22px;
}

/* --------------------------------------------------------------------------
   6. 카테고리 내비게이션 (Nav)
   데스크톱: 가로 메뉴 / 작은 화면: 드롭다운
   -------------------------------------------------------------------------- */
.nav {
  position: relative;
  background: #fafafa;
  border-bottom: 2px solid #18191e;
}

.nav__inner {
  display: flex;
  align-items: center;
  height: 60px;
  background: #fafafa;
}

.nav__menu {
  display: flex;
  align-items: center;
  height: 100%;
}

/* 토글(체크박스 + 버튼)은 데스크톱에서는 숨김 */
.nav__toggle,
.nav__toggle-btn,
.nav__backdrop {
  display: none;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 20px;
  font-size: 17px;
  font-weight: 700;
  color: #555555;
}

.nav__link:first-child {
  padding-left: 15px;
}

.nav__link:hover {
  color: var(--brand-dark);
}

.nav__link.is-active {
  color: #ff8a00;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   7. 광고 영역 (Ad banners - 3 columns)
   -------------------------------------------------------------------------- */
.ads {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 56px;
  gap: 6px;
  margin-bottom: 42px;
}

/* 목록 페이지에서는 광고 아래 간격이 조금 더 넓다 */
.ads--list {
  margin-bottom: 51px;
}

.ad-slot {
  display: block;
  overflow: hidden;
  background: var(--bg-surface);
  border-radius: 2px;
}

.ad-slot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;   /* 原 cover（会裁切） */
}

/* --------------------------------------------------------------------------
   8. 콘텐츠 영역 (Main / Section)
   -------------------------------------------------------------------------- */
.main {
  padding: 18px 0 68px;
}

.section + .section {
  margin-top: 52px;
}

.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section__title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-strong);
}

/* MORE 버튼 */
.btn-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
  background: var(--brand-dark);
  border-radius: 4px;
}

.btn-more .icon {
  width: 15px;
  height: 15px;
}

/* --------------------------------------------------------------------------
   9. 카드 그리드 (Card grid)
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
}

.card {
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.card__thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 337 / 197;
  overflow: hidden;
  background: #000000;
}

.card__thumb img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

.card__body {
  padding: 15px 20px 0;
}

.card__title {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-strong);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--line-soft);
}

.card__meta-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card__meta-count .icon {
  width: 14px;
  height: 14px;
}

/* --------------------------------------------------------------------------
   10. 필터 탭 (Filter tabs)
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 34px;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 42px;
  font-size: 16px;
  color: #555555;
  background: var(--bg-card);
  border: 1px solid #e3e3e3;
  border-radius: 6px;
  cursor: pointer;
}

.tab:hover {
  color: var(--brand-dark);
}

.tab.is-active {
  color: #333333;
  font-weight: 700;
  background: var(--brand);
  border-color: var(--brand);
}

/* --------------------------------------------------------------------------
   11. 페이지네이션 (Pagination)
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 74px;
}

.pagination__list {
  display: inline-flex;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--line-header);
  border-radius: 4px;
}

.pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 46px;
  padding: 0 6px;
  font-size: 16px;
  color: #3981c2;
  border-right: 1px solid var(--line-header);
}

.pagination__item:last-child {
  border-right: 0;
}

.pagination__item--nav {
  font-size: 14px;
  color: #777;
}

.pagination__item:hover {
  background: #f7f7f7;
}

.pagination__item.is-active {
  color: #ffffff;
  font-weight: 700;
  background: var(--brand);
}

/* --------------------------------------------------------------------------
   12. 브레드크럼 (Breadcrumb)
   -------------------------------------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 45px;
  padding: 0 22px;
  margin-bottom: 42px;
  font-size: 16px;
  color: var(--text-strong);
  background: #d7d7d7;
  border-radius: 4px;
}

.breadcrumb__sep {
  color: #9a9a9a;
}

/* --------------------------------------------------------------------------
   13. 동영상 플레이어 (Video player)
   -------------------------------------------------------------------------- */
.player {
  position: relative;
  max-width: 1206px;
  margin: 0 auto 45px;
  aspect-ratio: 16 / 9;
  background: #000000;
}

.player__play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 72px;
  height: 80px;
  margin: -40px 0 0 -36px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.player__play svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* 동영상 정보 박스 */
.video-info {
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.video-info__title {
  padding: 22px 32px 0;
  font-size: 22px;
  font-weight: 400;
  color: var(--text-strong);
}

.video-info__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  margin-top: 18px;
  padding: 0 32px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--line-soft);
}

/* --------------------------------------------------------------------------
   14. 푸터 (Footer)
   -------------------------------------------------------------------------- */
.footer {
  background: #fafafa;
  border-top: 1px solid var(--line-footer);
  color: var(--text-muted);
  font-size: 14px;
}

.footer__inner {
  padding: 22px 0 60px;
}

/* --------------------------------------------------------------------------
   15. 게시판 리스트 (Board list)
   -------------------------------------------------------------------------- */
.board-count {
  margin-bottom: 12px;
  font-size: 15px;
  color: var(--text-strong);
}

.board {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid #e2e2e2;
}

.board th,
.board td {
  height: 48px;
  font-size: 15px;
  text-align: center;
}

.board thead th {
  height: 52px;
  font-weight: 400;
  color: var(--text-strong);
  background: #d7d7d7;
  border-right: 1px solid #dcdcdc;
  border-bottom: 1px solid #dcdcdc;
}

.board thead th:last-child {
  border-right: 0;
}

.board tbody td {
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
}

.board tbody tr:last-child td {
  border-bottom: 0;
}

.board tbody tr:hover {
  background: #fafafa;
}

.board tbody td:nth-child(2) {
  padding: 0 20px;
  color: #666666;
  text-align: left;
}

.board tbody td:nth-child(2) a {
  color: inherit;
}

.board tbody td:nth-child(2) a:hover {
  text-decoration: underline;
}

.board th:first-child,
.board td:first-child {
  width: 12%;
}

.board th:last-child,
.board td:last-child {
  width: 12%;
}

/* --------------------------------------------------------------------------
   16. 반응형 (작은 화면에서만 보정, 데스크톱 비율 유지)
   -------------------------------------------------------------------------- */
@media (max-width: 1480px) {
  .container {
    padding: 0 16px;
  }
}

@media (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 작은 화면: 내비게이션을 드롭다운 메뉴로 전환 + 광고 한 줄에 하나 */
@media (max-width: 900px) {
  .ads {
    grid-template-columns: 1fr;
  }

  .board th,
  .board td {
    height: 42px;
    font-size: 13px;
  }

  .board tbody td:nth-child(2) {
    padding: 0 10px;
  }

  .nav__inner {
    height: 56px;
  }

  .nav__toggle-btn {
    position: relative;
    z-index: 60;
    display: flex;
    flex: 1 1 0;
    align-items: center;
    gap: 10px;
    min-width: 0;
    height: 56px;
    padding: 0 16px;
    font-size: 17px;
    font-weight: 700;
    color: #111111;
    background: var(--bg-card);
    cursor: pointer;
  }

  .nav__toggle-btn .icon-menu {
    width: 22px;
    height: 22px;
  }

  .nav__toggle-btn .icon-caret {
    width: 16px;
    height: 16px;
    margin-left: auto;
    color: #888888;
    transition: transform 0.2s ease;
  }

  .nav__toggle:checked ~ .nav__toggle-btn .icon-caret {
    transform: rotate(180deg);
  }

  .nav__menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 60;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    background: var(--bg-card);
    border: 1px solid var(--line-header);
    border-top: 0;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
  }

  .nav__toggle:checked ~ .nav__menu {
    display: flex;
  }

  .nav__link {
    height: 48px;
    padding: 0 18px;
    font-size: 16px;
    border-bottom: 1px solid var(--line-soft);
  }

  .nav__link:first-child {
    padding-left: 18px;
  }

  .nav__link:last-child {
    border-bottom: 0;
  }

  .nav__toggle:checked ~ .nav__backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.25);
  }
}
