/* ===========================================
   PenileBoost Common CSS (2025)
   - Font: Google Nanum Gothic
   - Global fixes: no horizontal scroll, safe drawers
   =========================================== */

@font-face {
  font-family: 'Nanum Gothic';
  src: url('/font/NanumGothic-Regular.woff2') format('woff2'),
       url('/font/NanumGothic-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nanum Gothic';
  src: url('/font/NanumGothic-Bold.woff2') format('woff2'),
       url('/font/NanumGothic-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nanum Gothic';
  src: url('/font/NanumGothic-ExtraBold.woff2') format('woff2'),
       url('/font/NanumGothic-ExtraBold.woff') format('woff');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ----- Root & Base ----- */
:root{
  /* Colors */
  --navy: #0f1f3b;
  --navy-2: #142850;
  --accent: #d4af37;
  --accent-2: #ffc94a;
  --text-dark: #111;
  --text-light: #fff;
  --text-muted: #667085;
  --border: #e5e7eb;
  --muted: #f8fafc;
  --bg: #ffffff;

  /* Typography & Rhythm */
  --font: "Nanum Gothic", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --lh: 1.7;
  --ls: 0.1px;
  --header-h: 60px;

  /* Card shadow */
  --shadow: 0 10px 24px rgba(0,0,0,.08);
}

*,*::before,*::after{ box-sizing: border-box; }

html, body{
  margin:0; padding:0;
  background: var(--bg);
  color: var(--text-dark);
  font-family: var(--font);
  line-height: var(--lh);
  letter-spacing: var(--ls);
  scroll-behavior: smooth;

  /* 모바일 네이비 막대(오프캔버스 잔여 폭) 방지 */
  width:100%;
  max-width:100%;
  overflow-x:hidden;
}

/* Links */
a{ color: var(--accent); text-decoration: none; }
a:hover{ opacity:.9; text-decoration: none; }
a:focus-visible{ outline: 3px solid var(--accent); outline-offset: 2px; }

/* Headings */
h1,h2,h3,h4{
  margin: 0 0 .6rem;
  font-weight: 800;
  line-height: 1.35;
  color: #0f1f3b;
}
h1{ font-size: clamp(1.6rem, 2.2vw + 1.1rem, 2.1rem); }
h2{ font-size: clamp(1.3rem, 1.2vw + 1rem, 1.6rem); }
h3{ font-size: 1.12rem; font-weight: 800; }

/* Text blocks */
p{ margin: .65rem 0 1rem; color: #1a1a1a; }
.subtitle{ color: var(--text-muted); margin-top:.25rem; margin-bottom:1.25rem; }
strong{ font-weight: 800; color:#0a4aa6; }

ul,ol{ margin:.4rem 0 1rem 0; padding-left:1.1rem; }
li{ margin:.35rem 0; }
small, .small{ font-size:.92rem; color: var(--text-muted); }

/* Code, KBD */
code, .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:.95em; background: #fbfbfd; border:1px solid var(--border); padding:2px 6px; border-radius:6px;
}
.kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background:#fbfbfd; border:1px solid var(--border); padding:2px 6px; border-radius:6px;
}

/* ===========================================
   TopBar (Fixed, auto-hide)
   =========================================== */
header#siteHeader, header#topBar{
  position: fixed; inset: 0 0 auto 0; height: var(--header-h);
  background: var(--navy);
  color: var(--text-light);
  display:flex; align-items:center; justify-content:space-between;
  padding: 0 14px;
  z-index:1000;
  border-bottom: 1px solid rgba(255,255,255,.06);

  /* 부드러운 등장/숨김 */
  transform: translateY(0);
  transition: transform .25s ease;
  will-change: transform;
}
header#siteHeader.hide, header#topBar.hide{
  transform: translateY(-100%);
}

header .logo{
  color:#fff; font-weight:800; font-size:1.12rem; text-decoration:none;
  display:flex; align-items:center; gap:8px;
}
header#siteHeader a, header#topBar a{ color:#fff; }

/* Desktop main nav (보이는 건 PC 전용) */
nav.main-nav{ display:flex; }
nav.main-nav ul, header nav ul{
  list-style:none; margin:0; padding:0; display:flex; gap:22px; align-items:center;
}
nav.main-nav a, header nav a{
  color:#fff; font-weight:700; opacity:.95; text-decoration:none;
}
nav.main-nav a:hover, nav.main-nav a.active,
header nav a:hover, header nav a.active{
  color: var(--accent); opacity:1;
}

/* PC 드롭다운 */
.main-nav li{ position:relative; }
.main-nav .has-submenu > a::after{
  content:"▾"; font-size:.7em; margin-left:6px; opacity:.7;
}
.main-nav .submenu{
  position:absolute; top:100%; left:0;
  background:#fff; color:#111;
  min-width:220px; display:none; flex-direction:column;
  border-radius:8px; box-shadow:0 10px 24px rgba(0,0,0,.12);
  padding:6px 0; margin-top:8px; z-index:1200;
}
.main-nav .submenu a{
  padding:10px 14px; color:inherit; display:block; font-weight:700;
}
.main-nav .submenu a:hover{ background:#f3f4f6; color:var(--navy-2); }
.main-nav li.has-submenu:hover > .submenu{ display:flex; }

/* ===========================================
   Hamburger (Right) & Drawer (Left)
   =========================================== */

/* 우측 상단 햄버거 버튼 */
#hamburger{
  appearance:none; background:transparent; border:0; cursor:pointer;
  width:36px; height:36px; display:none; /* PC 기본 숨김, 모바일에서 보임 */
  place-items:center; color:#fff;
}
#hamburger .bar{
  width:22px; height:2px; background: currentColor;
  margin:3px 0; border-radius:2px; transition: all .25s ease;
}
/* 열림 시 X로 */
.menu-open #hamburger .bar:nth-child(1){ transform: translateY(5px) rotate(45deg); }
.menu-open #hamburger .bar:nth-child(2){ opacity:0; }
.menu-open #hamburger .bar:nth-child(3){ transform: translateY(-5px) rotate(-45deg); }

/* 드로워 오버레이 */
.side-scrim{
  position:fixed; inset:0; background:rgba(0,0,0,.35);
  opacity:0; pointer-events:none; transition:opacity .2s ease; z-index:999;
}
.menu-open .side-scrim{ opacity:1; pointer-events:auto; }

/* 좌측 슬라이드 패널 */
.side-panel{
  position:fixed; top:0; left:0; height:100dvh; width:288px; max-width:86%;
  background:#fff; color:#111; z-index:1001;
  transform:translateX(-100%); transition:transform .25s ease;
  box-shadow:2px 0 16px rgba(0,0,0,.18);
  overflow:auto; -webkit-overflow-scrolling:touch;
  padding-bottom:16px;
}
.menu-open .side-panel{ transform:none; }
html.dark .side-panel{ background:#161616; color:#eee; }

/* 드로워 메뉴 리스트 */
.side-panel .menu{ list-style:none; padding:10px 0; margin:0; }
.side-panel .menu>li{ border-bottom:1px solid rgba(0,0,0,.06); }
html.dark .side-panel .menu>li{ border-bottom-color:rgba(255,255,255,.08); }

/* 드로워 상위 링크/아코디언 */
.menu-link, .acc-toggle{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; width:100%; padding:12px 14px;
  font-size:16px; color:inherit; background:none;
  border:0; text-align:left; text-decoration:none; cursor:pointer;
}
.menu-link:hover, .acc-toggle:hover{ background:rgba(0,0,0,.04); }
html.dark .menu-link:hover, html.dark .acc-toggle:hover{ background:rgba(255,255,255,.06); }
.acc-caret{ transition:transform .2s ease; }
.acc.open .acc-caret{ transform:rotate(90deg); }

/* 드로워 하위 메뉴 */
.submenu{
  list-style:none; margin:0; padding:0 0 8px 0;
  max-height:0; overflow:hidden; transition:max-height .25s ease;
  border-top:1px dashed transparent;
}
.acc.open .submenu{
  border-top-color:rgba(0,0,0,.05);
  max-height:800px;
}
html.dark .acc.open .submenu{ border-top-color:rgba(255,255,255,.08); }
.submenu li a{
  display:block; padding:10px 18px 10px 28px;
  font-size:15px; color:inherit; text-decoration:none;
}
.submenu li a:hover{ text-decoration:underline; }

/* 상태별 노출 제어 */
@media (max-width: 900px){
  nav.main-nav{ display:none; }
  #hamburger{ display:grid; }
}
@media (min-width: 901px){
  .side-panel, .side-scrim{ display:none; }
}

/* 메뉴 열릴 때 상단바는 항상 노출 */
.menu-open #topBar{ transform:none !important; }

/* ===========================================
   Layout containers
   =========================================== */
main, .content-wrapper{
  margin-top: var(--header-h);
  max-width: 1100px;
  padding: 20px 16px;
  margin-inline: auto;
}


/* Hero */
.hero{
  box-sizing:border-box;
  max-width: var(--container, 1100px);
  /* ⬇⬇⬇ 이 줄이 포인트: 좌우 바깥 여백을 줘야 화면과 떨어집니다 */
  margin: 0 var(--pad, 16px);

  padding: 3.2rem 16px 2.2rem;
  text-align:center;
  background: #5cbce1;
  color: var(--text-light);
  border-radius: 14px;
  overflow: hidden; /* 모서리 라운드 깔끔하게 */
}

@media (min-width: 768px){
  .hero{
    /* ✅ 태블릿 이상에서 좌우 패딩 조금 더 */
    padding-left: 24px;
    padding-right: 24px;
    margin: 20px auto;               /* 상하 여백 약간 넓힘 */
  }
}

.hero h1, .hero h2, .hero h3{ color: var(--text-light); }
.hero p{ opacity:.94; margin:0; color:#f0f0f0; }
.hero .cta-btn{
  display:inline-block; margin-top:1rem; background: var(--accent);
  color:#111; font-weight:800; text-decoration:none;
  padding:.7rem 1.2rem; border-radius:999px;
}



/* Section title */
.section-title{
  border-left:4px solid var(--accent);
  padding-left:.6rem; margin:2rem 0 1rem;
  font-weight:800; font-size:1.55rem; color: var(--text-dark);
}

/* ===========================================
   Cards
   =========================================== */
.cards-grid{
  display:grid; gap:18px; grid-template-columns: repeat(3, 1fr);
}
@media (max-width:1100px){ .cards-grid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:720px){ .cards-grid{ grid-template-columns:1fr; } }

.card{
  background: var(--muted);
  border:1px solid var(--border);
  border-radius:12px; overflow:hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover{ transform: translateY(-4px); box-shadow: var(--shadow); }
.card img{ width:100%; height:160px; object-fit:cover; display:block; }
.card-body{ padding:14px; }
.card h3{ margin:0 0 .4rem; font-size:1.02rem; color:var(--text-dark); font-weight:800; }
.card p{ margin:.1rem 0 .8rem; color:#444; font-size:.95rem; }
.btn{
  display:inline-block; padding:.55rem .9rem; border-radius:999px; font-weight:700; text-decoration:none;
  background:#fff; color:#111; border:1px solid var(--border);
}
.btn:hover{ border-color:#d5d8dd; }

/* ===========================================
   Post body, callouts, tables
   =========================================== */
.post-body{ display:grid; gap:1rem; }
.callout{
  border:1px solid var(--border); background: var(--muted);
  padding:12px 14px; border-radius:10px; font-size:.95rem;
}
.callout.info strong, .callout.tip strong{ color: var(--accent); }
.callout.warn{ border-color:#cc4444; }
.callout.warn strong{ color:#cc4444; }

.toc{
  border:1px solid var(--border); background: var(--muted);
  border-radius:12px; padding:12px 14px; margin:1.2rem 0;
}
.toc h3{ margin:0 0 8px; }

table{
  width:100%; border-collapse:collapse; font-size:.95rem; margin:10px 0 16px;
}
th, td{ border:1px solid var(--border); padding:10px; text-align:left; vertical-align:top; }
th{ background:#fbfbfd; font-weight:800; }

/* ===========================================
   Images – scale down, never upscale
   =========================================== */
img{
  display:block;
  width:auto;
  max-width:100%;
  height:auto;
  object-fit: contain;
  margin:0;
}

/* Featured images */
.featured-img{
  display:block;
  width:auto; max-width:100%; height:auto;
  margin:.5rem auto 1.5rem;
  border:1px solid var(--border);
  border-radius:12px;
  object-fit: contain;
}

/* OG banners */
.og-banner{
  width:auto; max-width:100%; height:auto;
  border-radius:10px; border:1px solid var(--border);
}

/* ===========================================
   Footer
   =========================================== */
footer{
  background: var(--navy);
  color: var(--text-light);
  text-align:center;
  padding: 18px 12px;
  margin-top: 40px;
  font-size:.92rem;
  border-top:1px solid rgba(255,255,255,.06);
}

/* ===========================================
   Utilities
   =========================================== */
.mt-0{ margin-top:0 !important; }
.mb-0{ margin-bottom:0 !important; }
.center{ text-align:center; }
.hidden{ display:none !important; }

/* SVG 로고 크기 고정 */
.logo-icon {
  width: 28px;
  height: 28px;
  display: inline-block;
  flex-shrink: 0;
  object-fit: contain;
  vertical-align: middle;
}
/* ===== Z-INDEX 강화 (드롭다운이 이미지 뒤로 가지 않게) ===== */
#topBar{ z-index: 5000; }
.dropdown{ z-index: 5001; position: absolute; }

/* ===== PC 드롭다운 개선 (2025) ===== */
.has-sub {
  position: relative;
}

/* 호버 브리지: 하위 메뉴로 이동 시 hover가 끊기지 않게 */
.has-sub > a {
  position: relative;
}
.has-sub > a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  bottom: -10px;
}

/* 드롭다운 기본 스타일 */
.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  display: none;
  min-width: 240px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
  z-index: 5001;
  backdrop-filter: saturate(120%) blur(2px);
  white-space: nowrap;
  transform-origin: top left;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* 드롭다운 내부 링크 */
.dropdown a {
  display: block;
  padding: 10px 14px;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
}
.dropdown a:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* PC에서만 호버/포커스로 표시 */
@media (min-width: 901px) {
  .has-sub:hover > .dropdown,
  .has-sub:focus-within > .dropdown {
    display: block;
    opacity: 1;
  }
}

/* 오른쪽 여백이 부족할 때 왼쪽으로 열리도록 (JS가 flip-left 토글) */
.dropdown.flip-left {
  left: auto;
  right: 0;
  transform-origin: top right;
}

/* 다크모드에서도 동일 룩 유지 */
html.dark .dropdown {
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}

/* ===== z-index 보정 (드롭다운이 콘텐츠 뒤로 안 가게) ===== */
#topBar { z-index: 5000; }
.dropdown { z-index: 5001; }
.side-scrim { z-index: 4999; }
.side-panel { z-index: 5002; }

/* ===== 햄버거 버튼 색 대비 유지 ===== */
#hamburger .bar { background: currentColor; }
header#topBar { color: #fff; }
header#topBar .logo,
header#topBar .logo * { color: #fff !important; }

/* 카드 내부 여백 보정 */
.card {
  padding: 16px 20px; /* 상하 16px, 좌우 20px */
  box-sizing: border-box;
}

/* 카드 안의 h3, p 간격 */
.card h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.card p {
  margin: 0 0 10px;
}

/* 📱 Diary 페이지 모바일 미세조정 */
@media (max-width:520px){
  .content-wrapper{ padding: 0 14px; }        /* 좌우 여백 확보 */
  .diary-hero{ padding:16px 14px; }
  .notepaper{ margin:16px 0; padding:18px 14px 20px; border-radius:12px; }
  .entry-title{ font-size:1.05rem; }
  .polaroids{ grid-template-columns:1fr; }     /* 폴라로이드 1열 스택 */
  .polaroid img{ height:200px; object-fit:cover; }
  .pager a{ padding:.56rem .9rem; font-size:.95rem; }
  .tape{ left:56px; width:96px; height:22px; } /* 테이프가 화면 밖으로 나가는 것 방지 */
}


/* ✅ 상단바/하단바 높이 통일 + 세로 가운데 정렬 (오버플로우/이중 스크롤 방지) */
header#topBar {
  min-height: var(--header-h);   /* 고정 height 대신 min-height */
  height: auto;                  /* 혹시 이전 height 지정이 있으면 무력화 */
  display: flex;
  align-items: center;           /* 세로 중앙 */
  padding: 0 14px;               /* 좌우 패딩만 */
  box-sizing: border-box;        /* 보더/패딩 포함해 넘침 방지 */
  line-height: normal;           /* line-height 강제 사용 금지 */
}

footer {
  min-height: var(--header-h);   /* 상단바와 동일한 세로 폭 */
  height: auto;                  /* 고정 높이 금지 */
  display: flex;
  align-items: center;           /* 세로 중앙 */
  justify-content: center;       /* 가로 중앙 */
  padding: 0 14px;               /* 좌우 패딩만 */
  box-sizing: border-box;
  line-height: normal;           /* 텍스트 자연 줄높이 */
  overflow: visible;             /* 내부 스크롤바 방지 */
}

/* ───────── 상단바 내 프로모션 링크 ───────── */
.promo-links {
  display: flex;
  align-items: center;
  gap: 14px;
}

.promo-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  transition: opacity 0.2s ease;
}

.promo-item img,
.promo-item svg {
  width: 20px !important;
  height: 20px !important;
  flex: 0 0 20px;
  display: block;
}

.promo-item:hover {
  opacity: 0.8;
}

/* 좌측 금더미 로고 SVG 크기 고정 */
header#topbar > .inner > svg {
  width: 28px !important;
  height: 28px !important;
  flex: 0 0 28px;
}

/* 반응형 (모바일) */
@media (max-width: 520px) {
  .promo-links {
    gap: 10px;
  }
  .promo-item span {
    font-size: 12px;
  }
  .promo-item img,
  .promo-item svg {
    width: 18px !important;
    height: 18px !important;
  }
  header#topbar > .inner > svg {
    width: 24px !important;
    height: 24px !important;
  }
}

/* ===== Topbar 아이콘/텍스트 수직 중앙 보정 ===== */
header#topbar .inner {
  display:flex;
  align-items:center;
  gap:10px;
}

header#topbar .promo-links {
  display:flex;
  align-items:center;
  gap:14px;
  height: var(--header-h);
  margin-left:auto;
}

header#topbar .promo-item {
  display:flex;
  align-items:center;
  gap:6px;
  height:100%;
  line-height:1;
  font-weight:700;
  color:#fff;
  text-decoration:none;
  padding:0 6px;
}

/* 아이콘 여백 제거 */
header#topbar .promo-item img,
header#topbar .promo-item svg {
  display:block;
  width:20px;
  height:20px;
  margin:0; /* ✅ */
}

/* 로고 아이콘도 동일하게 적용 */
header#topbar > .inner > svg {
  width:28px;
  height:28px;
  margin:0;
  flex:0 0 28px;
}

@media (max-width:520px) {
  header#topbar .promo-links { gap:10px; }
  header#topbar .promo-item img,
  header#topbar .promo-item svg { width:18px; height:18px; }
  header#topbar > .inner > svg { width:24px; height:24px; }
}
