/* ===================================================================
   portal.css  —  시끌벅적 야시장 포털 공통 껍데기
   ★ 이 파일은 타로 전용이 아니다. 앱 6개(주식/날씨/꽃/뉴스/타로/MBTI)가
     공유할 레이아웃·헤더·네비·광고슬롯·반응형을 담는다 (원칙 3).
     타로에만 해당하는 것은 tarot.css 로 간다.
   ★ 폰 우선(원칙 4): 기본 스타일이 폰이고, 미디어쿼리로 PC 를 덧붙인다.
   =================================================================== */

:root {
  /* 색 — 앱마다 --app-accent 만 바꿔 끼운다 */
  --bg:        #0b0e1a;
  --bg-soft:   #141830;
  --surface:   #1b2040;
  --line:      #2b3260;
  --text:      #eceafc;
  --text-dim:  #a7abd0;
  --app-accent: #ffd166;

  --radius: 14px;
  --gap: 16px;

  /* 폰 우선: 본문 폭 */
  --content-max: 480px;

  /* 광고 슬롯 높이를 '미리' 못박는다 (원칙 5).
     나중에 광고를 끼워도 레이아웃이 밀리지 않게 하려는 것이다. */
  --ad-h-top: 60px;
  --ad-h-inline: 100px;
  --ad-h-bottom: 100px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic",
               system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.pt-wrap {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ---------- 헤더 ---------- */
.pt-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 14, 26, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.pt-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 52px;
}
.pt-brand {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.pt-brand span { color: var(--app-accent); }

/* ---------- 앱 네비 (가로 스크롤 — 앱 6개가 여기 붙는다) ---------- */
.pt-nav {
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.pt-nav__scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px var(--gap);
  max-width: var(--content-max);
  margin: 0 auto;
}
.pt-nav__scroll::-webkit-scrollbar { display: none; }
.pt-nav a {
  flex: 0 0 auto;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
}
.pt-nav a.is-active {
  color: #0b0e1a;
  background: var(--app-accent);
  border-color: var(--app-accent);
  font-weight: 700;
}
.pt-nav a.is-soon { opacity: 0.42; pointer-events: none; }

/* ---------- 본문 ---------- */
.pt-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 20px var(--gap) 32px;
}

/* ---------- 광고 슬롯 (원칙 5: 지금부터 자리를 비워둔다) ----------
   지금은 빈 상자다. 나중에 애드포스트/애드핏 코드를 .ad-slot 안에
   넣기만 하면 되고, 높이를 미리 잡아뒀으니 레이아웃이 안 깨진다. */
.ad-slot {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ad-slot--top    { min-height: var(--ad-h-top); }
.ad-slot--inline { min-height: var(--ad-h-inline); margin: 22px auto; }
.ad-slot--bottom { min-height: var(--ad-h-bottom); margin: 8px auto 0; }

/* 개발 중에만 자리를 눈에 보이게 한다 (portal.js 가 body 에 클래스를 붙임) */
.dev-slots .ad-slot {
  border: 1px dashed #3d4680;
  border-radius: 10px;
  background: repeating-linear-gradient(45deg,
              rgba(255,255,255,.02) 0 8px, transparent 8px 16px);
}
.dev-slots .ad-slot::after {
  content: attr(data-ad-slot) " 광고 자리 (비어 있음)";
  font-size: 11px;
  color: #59629b;
  letter-spacing: 0.02em;
}

/* ---------- 푸터 ---------- */
.pt-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding: 18px var(--gap) calc(20px + env(safe-area-inset-bottom));
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
}

/* ---------- 공용 부품 ---------- */
.pt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;            /* 폰 터치 영역 */
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--app-accent);
  color: #0b0e1a;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.pt-btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.pt-btn:disabled { opacity: .45; cursor: default; }

.pt-note {
  border: 1px solid var(--line);
  border-left: 3px solid var(--app-accent);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-dim);
}
.pt-note code {
  background: #0b0e1a;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--app-accent);
}

/* ---------- PC 는 부가 (원칙 4) ---------- */
@media (min-width: 760px) {
  :root { --content-max: 620px; }
  .pt-header__inner { height: 60px; }
  .pt-brand { font-size: 17px; }
  .pt-main { padding-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
