/* ============================================================================
   GenAI AEO 제품 셸: 모든 공개 화면(랜딩·결과·인증·구독·수신거부·로그인 안내·404)의 공통 머리·꼬리.

   - 젠아이랩스 홈페이지 nav/footer 와 홈페이지 CSS 를 쓰지 않는다(Ruling S1). 이 파일과
     화면별 CSS(랜딩 landing.css, 그 밖 app.css)만으로 동작한다.
   - 색·모서리는 랜딩과 같다: 강조색 인디고(#7c83ff) → 바이올렛(#a78bfa) 하나, 버튼 pill, 패널 20px.
   - 폰트는 홈페이지와 같은 Google Fonts(Noto Sans KR·Poppins, _base.html 의 link). 받지 못하면 시스템 폰트.
   - 데스크톱(1024px 이상)은 메뉴 한 줄, 그보다 좁으면 햄버거 버튼(shell.js)으로 여닫는다.
     JS 가 없으면(html.js 없음) 좁은 화면에서도 메뉴를 펼친 채로 둔다.
   - 로그인하면 계정 버튼(메일)과 드롭다운(shell.js). 관리자 모드면 머리 맨 위 주황 띠와 주황 관리자 메뉴
     (--admin, 어두운 머리 위 명도 대비 AA 이상). 사용자 메뉴는 흰색 그대로. 관리자 화면(admin/_base.html)도 이 머리를 쓴다.
   ============================================================================ */

/* 색·모서리·글자·모션 토큰은 tokens.css 한 곳에 있다. 이 파일은 그 이름만 읽는다. */

* { box-sizing: border-box; }
/* hidden 속성은 .btn-ghost 같은 display 규칙보다 항상 이긴다(JS 없이 PDF 버튼 등이 보이지 않게). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
body > main { flex: 1 0 auto; width: 100%; }
/* 줄 끝에 한두 글자만 남는 과부 줄을 줄인다(text-wrap-style: pretty). 줄바꿈 방식(text-wrap-mode)은 건드리지 않는
   긴 이름만 써서, nowrap 칸 안 문단이 다시 꺾이지 않는다. 모르는 브라우저는 이 줄을 무시하고 예전처럼 꺾는다.
   제목은 각 화면이 text-wrap: balance 를 따로 준다. */
p, li, dd, figcaption, blockquote { text-wrap-style: pretty; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: var(--r-sm); }

.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: 16px; top: -48px; z-index: 30;
  background: var(--panel); color: var(--text); padding: 8px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ── 머리 ────────────────────────────────────────────────────────────── */
/* z-index 층: 머리 20, 건너뛰기 링크 30. 그 밖에는 쓰지 않는다. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 16, 32, 0.82);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
}
@media (prefers-reduced-transparency: reduce) {
  .site-header { background: var(--surface-bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
.site-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-strong);
  text-decoration: none;
  white-space: nowrap;
  flex: none;
}
.site-brand:hover { text-decoration: none; }
.site-logo { width: 30px; height: 30px; display: block; flex: none; }
.site-brand-text { display: inline-flex; align-items: baseline; gap: 10px; }
.site-brand-name { font-weight: 800; font-size: 1.08rem; letter-spacing: -0.01em; }
.site-brand-sub {
  padding-left: 10px;
  border-left: 1px solid var(--line-strong);
  color: var(--surface-accent-text);
  font-weight: 600;
  font-size: 0.82rem;
}

.site-menu {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.site-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}
.site-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  color: var(--surface-ink-2);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, background-color 0.2s;
}
.site-nav a:hover { color: var(--n-0); background: var(--accent-soft); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--n-0); background: var(--accent-soft); }

/* ── 묶음 메뉴 (<details>/<summary>, 자바스크립트 없이 열린다) ───────────────── */
.site-nav-group { position: relative; }
.site-nav-sum {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  color: var(--surface-ink-2);
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  transition: color 0.2s, background-color 0.2s;
}
.site-nav-sum::-webkit-details-marker { display: none; }
.site-nav-sum:hover,
.site-nav-group[open] > .site-nav-sum { color: var(--n-0); background: var(--accent-soft); }
.site-nav-sum:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 지금 보고 있는 화면이 든 묶음. 색만으로 알리지 않게 아래에 밑줄을 함께 둔다. */
.site-nav-sum[aria-current="true"] { color: var(--n-0); box-shadow: inset 0 -2px 0 var(--accent); }
.site-nav-caret {
  width: 7px;
  height: 7px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s var(--ease);
}
.site-nav-group[open] .site-nav-caret { transform: translateY(1px) rotate(-135deg); }
.site-nav-sub {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 2;
  min-width: 200px;
  margin: 0;
  padding: 6px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-inner);
  box-shadow: var(--sh-dark-2);
}
.site-nav-sub a { padding: 9px 12px; border-radius: var(--r-sm); font-size: 0.9rem; }
.site-actions { display: flex; align-items: center; gap: 8px; }
.site-login,
.site-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--btn-min-h);
  padding: 0 var(--btn-pad-x);
  border-radius: var(--btn-radius);
  font-size: var(--btn-fs);
  font-weight: var(--btn-fw);
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), box-shadow 0.3s var(--ease), border-color 0.2s, background-color 0.2s;
}
.site-login { color: var(--text); border: 1px solid var(--line-strong); }
.site-login:hover { text-decoration: none; color: var(--text-strong); border-color: var(--accent); background: var(--accent-soft); }
.site-cta { color: var(--accent-on); background: var(--accent); border: 1px solid var(--accent); box-shadow: var(--sh-dark-1); }
.site-cta:hover { text-decoration: none; color: var(--accent-on); background: var(--accent-2); border-color: var(--accent-2); transform: translateY(-1px); }
.site-login:active, .site-cta:active { transform: translateY(1px) scale(0.98); }

/* ── 계정 버튼과 드롭다운(shell.js 가 aria-expanded·is-open 을 바꾼다) ─────────── */
.site-account { position: relative; display: flex; }
.site-account-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  max-width: 240px;
  padding: 0 14px 0 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.site-account-btn:hover,
.site-account-btn[aria-expanded="true"] { color: var(--n-0); border-color: var(--accent); background: var(--accent-soft); }
.site-account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-account-caret { flex: none; transition: transform 0.2s var(--ease); }
.site-account-btn[aria-expanded="true"] .site-account-caret { transform: rotate(180deg); }
.site-account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1;
  min-width: 220px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-inner);
  box-shadow: var(--sh-dark-2);
}
.js .site-account-menu:not(.is-open) { display: none; }
html:not(.js) .site-account-menu { position: static; box-shadow: none; }
.site-account-form { display: flex; margin: 0; }
/* 누구로, 어떻게 로그인했는지. 계정 표시는 이 메뉴 한 곳뿐이다. */
.site-account-who { margin: 2px 4px 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
                    font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.site-account-form.is-logout { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.site-account-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.site-account-item:hover { color: var(--n-0); background: var(--accent-soft); text-decoration: none; }
.site-account-item.is-admin { color: var(--admin); font-weight: 700; }
.site-account-item.is-admin:hover { color: var(--admin-hover); background: var(--admin-soft); }

.site-header { font-family: var(--font); }

/* 데스크톱: 관리자 메뉴는 사용자 메뉴 바로 아래 둘째 줄(오른쪽 정렬). */

.site-menu-toggle {
  display: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--r-inner);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.site-menu-bars { display: grid; gap: 5px; width: 20px; margin: 0 auto; }
.site-menu-bars i { display: block; height: 2px; border-radius: var(--r-xs); background: currentColor; transition: transform 0.25s var(--ease), opacity 0.2s; }
.site-menu-toggle[aria-expanded="true"] .site-menu-bars i:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-menu-toggle[aria-expanded="true"] .site-menu-bars i:nth-child(2) { opacity: 0; }
.site-menu-toggle[aria-expanded="true"] .site-menu-bars i:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 1180px) {
  .site-brand-sub { display: none; }
  .site-account-btn { max-width: 180px; }
}

@media (max-width: 1023px) {
  .site-header-inner { padding: 0 16px; flex-wrap: wrap; height: auto; min-height: var(--header-h); }
  /* 관리자 모드 띠 바로 아래에서 메뉴를 펼쳤을 때 버튼이 띠에 붙지 않게 위를 조금 띄운다. */
  .site-brand-sub { display: inline; }
  .js .site-menu-toggle { display: block; }
  .site-menu {
    flex-basis: 100%;
    margin: 0;
    padding: 8px 0 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    border-top: 1px solid var(--line);
  }
  .js .site-menu:not(.is-open) { display: none; }
  .site-nav { flex-direction: column; align-items: stretch; gap: 0; }
  .site-nav a { padding: 12px 8px; border-radius: var(--r-inner); font-size: 1rem; }
  /* 좁은 화면에서는 같은 <details> 를 접이식 줄로 편다(따로 만든 모바일 메뉴가 아니라 한 부품이다). */
  .site-nav-sum { padding: 12px 8px; border-radius: var(--r-inner); font-size: 1rem; justify-content: space-between; }
  .site-nav-sum[aria-current="true"] { box-shadow: inset 2px 0 0 var(--accent); }
  .site-nav-sub {
    position: static;
    margin: 2px 0 6px 8px;
    padding: 2px 0 2px 8px;
    border: 0;
    border-left: 1px solid var(--line-strong);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    min-width: 0;
  }
  .site-nav-sub a { font-size: 0.95rem; padding: 11px 8px; }
  .site-actions { gap: 8px; }
  .site-login, .site-cta { flex: 1 1 0; min-height: 48px; font-size: 1rem; }
  /* 로그인하면 계정 버튼을 한 줄 전체로, [무료 진단 시작]을 다음 줄 전체 폭으로 내린다. 드롭다운은 버튼 아래에 펼친다. */
  .site-actions.is-member { flex-wrap: wrap; }
  .site-actions.is-member .site-cta { flex-basis: 100%; }
  .site-account { flex: 1 1 100%; min-width: 0; flex-direction: column; }
  .site-account-btn { width: 100%; max-width: none; min-height: 48px; justify-content: space-between; font-size: 1rem; }
  .site-account-menu { position: static; margin-top: 8px; box-shadow: none; background: var(--panel-2); }
  .site-account-item { min-height: 48px; font-size: 1rem; }
  /* 관리자 메뉴는 햄버거 메뉴 안 "관리자" 묶음(주황)으로. */
}

@media (max-width: 380px) {
  .site-brand-sub { display: none; }
}

/* ── 꼬리 ────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(8, 12, 24, 0.6);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.7;
}
.site-footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 24px 36px;
  display: grid;
  /* 오른쪽 링크 칸은 링크 폭만큼만 차지한다. 1.2fr:1fr 로 나누었더니 1440px 에서 마지막 링크(문의) 하나만
     다음 줄로 떨어졌다. 좁아지면 칸이 줄고 링크가 줄을 바꾼다. */
  grid-template-columns: minmax(0, 1fr) minmax(0, max-content);
  gap: 16px 40px;
}
.site-footer p { margin: 0; }
.site-footer .site-footer-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-strong);
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 6px;
}
.site-footer-name .site-logo { width: 24px; height: 24px; }
.site-footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: flex-start;
  gap: 6px 20px;
}
.site-footer-links a { color: var(--surface-ink-2); text-decoration: none; white-space: nowrap; }
.site-footer-links a:hover { color: var(--n-0); text-decoration: underline; text-underline-offset: 3px; }
.site-footer-biz {
  grid-column: 1 / -1;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--surface-dim);
}
/* 제품 버전(v0.5.0). 저작권 줄 끝에 붙는 운영 확인용 표기라 더 흐리게 둔다. */
.site-footer-version {
  margin-left: 8px;
  color: var(--surface-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .site-footer-inner { grid-template-columns: minmax(0, 1fr); padding: 28px 16px 32px; }
  .site-footer-links { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header *, .site-footer * { transition: none !important; }
}

@media print {
  .site-menu, .site-menu-toggle, .site-footer, .skip-link { display: none; }
  .site-header { position: static; }
}
