/* ══════════════════════════════════════════════════════════════
   age-gate.css — 연령 확인 창 (js/age-gate.js, 2026-11-08)

   · 화면 가운데 <dialog> showModal — 최상위 층이라 뒤 화면 레이아웃을 밀지 않는다. 뒤는 --scrim 막 + inert.
   · 열려 있는 동안 뒤 화면 스크롤을 잠근다(html :has — scrollbar-gutter: stable 이 전역이라 폭이 흔들리지 않음).
   · [아니요] 뒤 막힌 화면(--blocked)은 버튼·설명 없이 안내 두 줄만.
   싣는 곳: 앱 페이지(index·label·login·onboarding·profile·my-wines·my-interests·wine-list·drink-order).
   색은 theme 토큰만(theme.css / index-page.css :root, 일반 모드 값 포함 — 나의 와인 기록 plum 도 같은 토큰).
   예외 리터럴: 채운 버튼 흰 글자(다른 확인 창 [확인]과 같은 관행).
   · 창 아래 "이용약관 · 개인정보처리방침"(.age-gate__legal, 2026-11-08 ag2) — 묻는 창·막힌 화면 모두. 링크 높이 44px(터치),
     처리방침은 굵게(--privacy — 다른 고지와 구별, 홈·로그인·프로필과 같은 관례).
   BEM-lite: .age-gate(--blocked) · __box · __mark · __title · __en · __desc · __btns · __btn(--primary·--ghost) · __btn-en ·
             __legal · __legal-link(--privacy) · __legal-sep
   ══════════════════════════════════════════════════════════════ */

.age-gate {
  --ag-w:          400px;
  --ag-edge:       16px;                 /* 좁은 화면 좌우 여백 */
  --ag-pad:        28px 22px 8px;         /* 아래는 약관 링크 줄(44px 누름 영역)이 여백을 대신한다 */
  --ag-mark:       48px;
  --ag-btn-h:      48px;                 /* 터치 44px 이상 */
  --ag-btn-radius: 12px;
  --ag-sub:        rgba(var(--text-rgb), .72);   /* 보조 문구 — --muted 는 카드 바탕에서 4.5:1 미만이라 본문색을 옅게 */
  --ag-shadow:     0 18px 48px rgba(var(--shadow-rgb), calc(.5 * var(--shadow-k)));
  --ag-ease:       cubic-bezier(.16, 1, .3, 1);

  /* 가운데 배치 — :modal 기본값(inset 0 + margin auto)을 페이지 전역 리셋(* { margin: 0 })이 지우므로 직접 적는다 */
  position: fixed;
  inset: 0;
  width: min(var(--ag-w), calc(100% - 2 * var(--ag-edge)));
  height: fit-content;
  max-width: none;
  max-height: calc(100dvh - 2 * var(--ag-edge));
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--ag-shadow);
  font-family: var(--font-base);
  overflow: hidden;
}
.age-gate::backdrop { background: var(--scrim); }
.age-gate[open] { animation: age-gate-in .28s var(--ag-ease); }
.age-gate[open]::backdrop { animation: age-gate-fade .28s var(--ag-ease); }
@keyframes age-gate-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes age-gate-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* 뒤 화면 스크롤 잠금 */
html:has(.age-gate[open]) { overflow: hidden; }

.age-gate__box {
  max-height: inherit;
  padding: var(--ag-pad);
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: center;
}

.age-gate__mark {
  display: block;
  width: var(--ag-mark);
  height: var(--ag-mark);
  margin: 0 auto 14px;
}

.age-gate__title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -.02em;
  color: var(--text);
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.age-gate__title:focus { outline: none; }   /* 막힌 화면 포커스 자리(tabindex=-1) — 누르는 것이 아니라 테두리 없음 */

.age-gate__en {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ag-sub);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.age-gate__desc {
  margin: 14px 0 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ag-sub);
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

/* ── 버튼 ── */
.age-gate__btns {
  display: flex;
  gap: 8px;
  margin-top: 22px;
}
.age-gate__btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--ag-btn-h);
  padding: 6px 12px;
  border-radius: var(--ag-btn-radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  word-break: keep-all;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.age-gate__btn-en { font-weight: 600; }
.age-gate__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.age-gate__btn--primary {
  border: 0;
  background: linear-gradient(135deg, var(--btn-grad-from), var(--btn-grad-to));
  color: #fff;
}
.age-gate__btn--primary:hover { opacity: .92; }
.age-gate__btn--ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}
.age-gate__btn--ghost:hover { background: rgba(var(--ink-rgb), .05); }

/* ── 약관·정책 링크 ── */
.age-gate__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 2px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ag-sub);
}
.age-gate__legal-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;                      /* 터치 영역 */
  padding: 0 8px;
  color: var(--ag-sub);
  text-decoration: underline;
  text-decoration-color: rgba(var(--text-rgb), .3);
  text-underline-offset: .25em;
}
.age-gate__legal-link:hover { color: var(--accent); text-decoration-color: currentColor; }
.age-gate__legal-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: var(--radius-sm); }
.age-gate__legal-link--privacy { font-weight: 700; }   /* 개인정보처리방침은 다른 고지와 구별되게(개인정보보호위원회 작성지침) */

/* ── [아니요] 뒤 막힌 화면 ── */
.age-gate--blocked .age-gate__title { font-size: 18px; }
.age-gate--blocked .age-gate__legal { margin-top: 16px; }

/* 아주 좁은 화면 — 버튼 위아래로 */
@media (max-width: 360px) {
  .age-gate { --ag-pad: 24px 18px 6px; }
  .age-gate__btns { flex-direction: column; }
  .age-gate__btn { flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  .age-gate[open],
  .age-gate[open]::backdrop { animation: none; }
}
@media (forced-colors: active) {
  .age-gate { border-color: CanvasText; }
  .age-gate__btn--primary { border: 1px solid ButtonText; }
}
