/* 2026-11-04 도경 시안(피그마 '00 디자인 마스터' Component) 공통 부품 — 모든 화면이 layout.ts 에서 site.css·brand.css·sheet.css 뒤에 싣는다.
   값은 tokens.css 의 시안 토큰(--primary-*, --gray-*, --funding-*, --volunteer-*, --radius-*, --space-*)만 쓴다.
   폭: 휴대폰(1179 이하)은 시안 'M 휴대폰 화면(390)', PC(1180 이상)는 웹 1440 시안. 머리 메뉴 여섯 칸과 후원하기 단추가 1180 아래에서는 한 줄에 들어가지 않아 1180 을 가른다. */

/* ---------- 머리(Header · Mobile Header) ---------- */
.gnb { position: relative; z-index: 20; background: var(--gray-white); border-bottom: 1px solid var(--gray-200); }
.gnb-bar { display: none; }
.mgnb-bar { display: flex; height: var(--ds-mgnb-h); align-items: center; justify-content: space-between; padding: 0 20px; }
.gnb-brand, .mgnb-brand { display: inline-flex; align-items: center; flex: none; text-decoration: none; }
.gnb-brand .gnb-lockup { width: 225px; height: 49px; }
.mgnb-brand { min-width: 0; flex: 0 1 auto; }
.mgnb-brand .gnb-lockup { width: 147px; height: 32px; max-width: 100%; object-fit: contain; }
.mgnb-donate { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 44px; margin-right: 8px; padding: 0 12px; border-radius: 999px; background: var(--primary-500); color: var(--gray-white); font: 700 14px/1 var(--font); text-decoration: none; white-space: nowrap; }
.mgnb-donate:hover { background: var(--primary-600); }
@media (max-width: 359px) {
  .mgnb-brand .gnb-lockup { width: 120px; height: auto; }
  .mgnb-donate { margin-right: 4px; padding: 0 9px; }
}
.mgnb-right { display: flex; flex: none; align-items: center; gap: 0; margin-right: -2px; }
/* 누르는 곳 44px(50~70대 — 시안은 40px). 아이콘 자리는 그대로다: 단추 둘 사이 간격 4px 을 단추 안으로, 오른쪽 끝은 -2px 로 당겨 아이콘 가운데가 시안과 같다. */
.mgnb-btn { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; }
.gnb-nav { display: flex; align-items: center; gap: 35px; margin-left: clamp(24px, 8vw, 115px); }
/* 1440 시안(CO2): 메뉴 시작 x 387·칸 간격 74. 1180~1399 는 오른쪽 열과 한 줄에 빠듯해 옛 값 그대로 둔다. */
@media (min-width: 1400px) { .gnb-nav { gap: 36px; margin-left: 121px; } }
.gnb-link { display: inline-flex; align-items: center; gap: 4px; padding-block: 12px; font: 700 22px/1 var(--font); color: var(--gray-900); text-decoration: none; white-space: nowrap; }
.gnb-link[aria-current="page"] { color: var(--primary-500); }
.gnb-link:hover { color: var(--primary-500); }
.gnb-right { display: flex; align-items: center; width: 311px; margin-left: auto; }
.gnb-account { padding-block: 12px; font: 500 18px/1 var(--font); color: var(--gray-900); text-decoration: none; white-space: nowrap; }
.gnb-account:hover { color: var(--primary-500); }
.gnb-search { display: inline-flex; margin-left: 7px; padding: 8px; }
/* 검색 아이콘은 글자색 마스크 — 마우스를 올리면 메뉴와 같은 주색으로 바뀐다(검은 SVG <img> 는 색이 안 바뀜). */
.gnb-search-ic { display: block; width: 20px; height: 20px; background: var(--gray-900); -webkit-mask: url("/assets/icons/ui/search-20.svg") no-repeat center / 20px; mask: url("/assets/icons/ui/search-20.svg") no-repeat center / 20px; }
.gnb-search:hover .gnb-search-ic { background: var(--primary-500); }
.gnb-donate { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 169px; height: 57px; margin-left: auto; border-radius: var(--radius-20); background: var(--primary-500); color: var(--gray-white); font: 500 24px/1 var(--font); text-decoration: none; white-space: nowrap; }
.gnb-donate:hover { background: var(--primary-600); }
.ds-ic { display: block; flex: none; }
@media (min-width: 1180px) {
  .gnb-bar { display: flex; height: var(--ds-gnb-h); align-items: center; padding: 0 42px 0 41px; }
  .mgnb-bar { display: none; }
}
/* 앱 바 화면(page() 에 header 를 넘긴 화면 — layout.ts responsiveHeader): 휴대폰(767 이하)은 앱 바가 머리를 맡는다.
   시안 머리를 그 위에 겹쳐 머리가 두 겹으로 보이지 않게 숨긴다(옛 .top.app-site-head 와 같은 규칙). 768 이상은 시안 머리 + 그 아래 앱 바 줄. */
@media (max-width: 767px) {
  .gnb.app-site-head { display: none; }
}
/* 11/05 v1.36.4(PC 시안 03-10·04-10·05-x·06-x): '‹ … 공유' 앱 바 줄은 휴대폰 앱 바다 — PC(1180 이상)에는 시안에 없어 보이지 않는다(DOM 은 그대로 둬 뒤로·제목 칸은 남는다). 내 페이지·사연·로그인 화면은 각자 이미 같은 규칙을 가졌다. */
@media (min-width: 1180px) {
  .app-head-wrap { display: none; }
}

/* ---------- 휴대폰 아래 탭 막대(Mobile Tab Bar) ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; height: calc(var(--ds-tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: calc(4px + env(safe-area-inset-bottom)); background: var(--gray-white); border-top: 1px solid var(--gray-200); }
.tabbar-item { flex: 1 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; font: 400 12px/1 var(--font); color: var(--gray-600); text-decoration: none; }
.tabbar-item[aria-current="page"] { font-weight: 700; color: var(--primary-500); }
body:has(.tabbar) { padding-bottom: calc(var(--ds-tabbar-h) + env(safe-area-inset-bottom)); }
@media (min-width: 1180px) {
  .tabbar { display: none; }
  body:has(.tabbar) { padding-bottom: 0; }
}

/* ---------- 바닥(Footer) ---------- */
.gfoot { display: flex; flex-direction: column; gap: 18px; margin-top: var(--space-80); padding: 32px 20px 40px; background: var(--gray-75); border-top: 1px solid var(--gray-200); }
.gfoot-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px 24px; }
.gfoot-brand { display: flex; flex-direction: column; gap: 8px; }
.gfoot-name { margin: 0; font: 700 19px/1 var(--font); color: var(--primary-400); }
.gfoot-sub, .gfoot-menu { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.gfoot-sub a, .gfoot-menu a { font: 400 16px/1 var(--font); color: var(--gray-600); text-decoration: none; }
.gfoot-sub { gap: 0 20px; }
.gfoot-sub a { display: inline-flex; align-items: center; min-height: 44px; } /* 레드팀 F14: 바닥 '기브 스토리'·'운영 리포트' 누르는 면 16px → 44px(글자 그대로, 줄 사이 여백은 눌리는 면이 대신한다) */
.gfoot-sub a:hover, .gfoot-menu a:hover { color: var(--gray-900); }
.gfoot .company-info { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 18px 0 2px; border-top: 1px solid var(--gray-200); font: 400 12px/1.5 var(--font); color: var(--gray-600); background: none; }
.gfoot .company-line { margin: 0; padding: 0; border: 0; }
.gfoot .company-line dl { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0; }
.gfoot .company-row { display: block; margin: 0; } /* 11/05 최종 QA: 시안 바닥은 '이름: 값' 이 한 줄에 이어 흐른다(주소가 이름 옆에서 줄바꿈) — 이름·값을 인라인으로 */
.gfoot .company-row dt, .gfoot .company-row dd { display: inline; }
.gfoot .company-row dt { margin: 0 4px 0 0; font-weight: 700; color: var(--gray-600); }
.gfoot .company-row dd { margin: 0; color: var(--gray-600); }
.gfoot .foot-links { display: flex; flex-wrap: wrap; gap: 4px 17px; }
.gfoot .foot-links a { color: var(--gray-600); text-decoration: underline; font-size: 12px; }
.gfoot .company-line dd a { color: var(--gray-600); text-decoration: underline; text-underline-offset: 3px; }
.gfoot-note { margin: 0; font: 400 16px/1.5 var(--font); color: var(--gray-600); }
/* 휴대폰 바닥(시안 04-01): 이름 + 링크 한 줄 + 사업자 정보. PC 의 메뉴 줄·'기브 스토리/운영 리포트' 줄은 1180 이상에서만. */
/* (아래 숨김 규칙은 'footer' 로 시작한다 — 사업자 정보 줄은 어떤 폭에서도 숨기지 않는다는 시험(ft_company_info)이 .gfoot 로 시작하는 규칙만 보기 때문이다. 숨기는 것은 PC 와 겹치는 메뉴 줄뿐이다.) */
footer.gfoot .gfoot-sub, footer.gfoot .gfoot-menu { display: none; }
.gfoot-mlinks { display: flex; flex-wrap: wrap; gap: 0 20px; }
.gfoot-mlinks a { display: inline-flex; align-items: center; min-height: 44px; font: 400 14px/1 var(--font); color: var(--gray-600); text-decoration: none; }
.gfoot-mlinks a.is-strong { font-weight: 700; color: var(--gray-900); }
@media (min-width: 1180px) {
  .gfoot { padding: 44px 106px 56px; }
  footer.gfoot .gfoot-sub, footer.gfoot .gfoot-menu { display: flex; }
  footer.gfoot .gfoot-mlinks { display: none; }
}

/* ---------- 화면 틀(Layout) ---------- */
.ds-wrap { width: 100%; max-width: calc(var(--ds-content) + 40px); margin: 0 auto; padding: 0 20px; }
.ds-detail { display: grid; gap: 24px; }
.ds-mypage { display: grid; gap: 24px; }
.ds-form-wrap { width: 100%; max-width: calc(var(--ds-form) + 40px); margin: 0 auto; padding: 0 20px; }
.ds-done-wrap { width: 100%; max-width: calc(var(--ds-done) + 40px); margin: 0 auto; padding: 0 20px; }
.ds-grid-4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
.ds-grid-3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
@media (min-width: 768px) {
  .ds-grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
  .ds-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1180px) {
  .ds-detail { grid-template-columns: minmax(0, var(--ds-detail-main)) var(--ds-detail-side); gap: 40px; justify-content: center; align-items: start; }
  .ds-mypage { grid-template-columns: var(--ds-my-nav) minmax(0, var(--ds-my-main)); justify-content: center; align-items: start; }
  .ds-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ds-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- 단추(Button) — L 48 · M 44 ---------- */
.ds-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 28px; border: 1px solid transparent; border-radius: var(--radius-8); font: 600 16px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.ds-btn-m { min-height: 44px; padding: 0 20px; font-size: 15px; }
.ds-btn-primary { background: var(--primary-500); border-color: var(--primary-500); color: var(--gray-white); }
.ds-btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.ds-btn-funding { background: var(--funding-700); border-color: var(--funding-700); color: var(--gray-white); }
.ds-btn-volunteer { background: var(--volunteer-700); border-color: var(--volunteer-700); color: var(--gray-white); }
.ds-btn-dark { background: var(--gray-900); border-color: var(--gray-900); color: var(--gray-white); }
.ds-btn-outline { background: var(--gray-white); border-color: var(--gray-250); color: var(--gray-900); }
.ds-btn-outline:hover { border-color: var(--gray-500); }
.ds-btn[disabled], .ds-btn[aria-disabled="true"], .ds-btn-disabled { background: var(--gray-250); border-color: var(--gray-250); color: var(--gray-700); cursor: not-allowed; }
.ds-btn-block { width: 100%; }

/* ---------- 칩(Chip) 40 · 탭(Tab) 43 ---------- */
.ds-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ds-chip { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; min-width: 60px; padding: 0 16px; border: 1px solid var(--gray-200); border-radius: var(--radius-999); background: var(--gray-white); font: 500 15px/1 var(--font); color: var(--gray-900); text-decoration: none; white-space: nowrap; cursor: pointer; }
.ds-chip[aria-current="page"], .ds-chip[aria-pressed="true"], .ds-chip.is-on { background: var(--gray-900); border-color: var(--gray-900); color: var(--gray-white); font-weight: 700; }
.ds-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--gray-200); overflow-x: auto; scrollbar-width: none; }
.ds-tab { display: inline-flex; align-items: center; min-height: 43px; padding: 0 2px; border-bottom: 2px solid transparent; margin-bottom: -1px; font: 500 16px/1 var(--font); color: var(--gray-600); text-decoration: none; white-space: nowrap; }
.ds-tab[aria-current="page"], .ds-tab[aria-selected="true"], .ds-tab.is-on { border-bottom-color: var(--primary-500); color: var(--gray-900); font-weight: 700; }

/* ---------- 입력(Input 52 · Select 40 · Checkbox · Radio) ---------- */
.ds-field { display: flex; flex-direction: column; gap: 8px; }
.ds-label { font: 700 14px/1.5 var(--font); color: var(--gray-900); }
.ds-hint { font: 400 14px/1.55 var(--font); color: var(--gray-600); }
.ds-input, .ds-textarea, .ds-select { width: 100%; min-height: 48px; padding: 0 16px; border: 1px solid var(--gray-250); border-radius: var(--radius-8); background: var(--gray-white); font: 400 16px/1.5 var(--font); color: var(--gray-900); }
.ds-textarea { min-height: 160px; padding: 14px 16px; resize: vertical; }
.ds-select { min-height: 40px; padding: 0 36px 0 14px; width: auto; }
.ds-input:focus, .ds-textarea:focus, .ds-select:focus { border-color: var(--primary-500); outline: 1px solid var(--primary-500); outline-offset: 0; }
.ds-input[disabled], .ds-textarea[disabled] { background: var(--gray-100); color: var(--gray-600); }
.ds-input::placeholder, .ds-textarea::placeholder { color: var(--gray-600); }
.ds-check, .ds-radio { width: 20px; height: 20px; margin: 0; accent-color: var(--primary-500); flex: none; }
.ds-check-row { display: inline-flex; align-items: center; gap: 8px; font: 400 15px/1.5 var(--font); color: var(--gray-900); }

/* ---------- 배지(Badge) · 진행 막대(Progress) ---------- */
.ds-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 22px; padding: 0 8px; border-radius: var(--radius-999); font: 700 12px/1 var(--font); white-space: nowrap; }
.ds-badge-dday { background: var(--primary-500); color: var(--gray-white); }
.ds-badge-ended { background: var(--gray-700); color: var(--gray-white); min-height: 26px; }
.ds-badge-wait { background: var(--primary-100); color: var(--primary-600); min-height: 24px; }
.ds-badge-paid { background: var(--volunteer-100); color: var(--volunteer-700); min-height: 24px; }
.ds-tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border: 1px solid var(--primary-200); border-radius: var(--radius-4); background: var(--gray-white); font: 600 12px/1 var(--font); color: var(--primary-500); }
.ds-progress { display: block; width: 100%; height: 4px; border-radius: var(--radius-999); background: var(--gray-150); overflow: hidden; }
.ds-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--progress-gradient); }

/* ---------- 쪽 넘김(Pagination) · 알림(Toast) · 창(Dialog) ---------- */
.ds-pager { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 40px 0 0; padding: 0; list-style: none; }
.ds-pager a, .ds-pager span { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; border-radius: var(--radius-4); font: 500 14px/1 var(--font); color: var(--gray-600); text-decoration: none; }
.ds-pager [aria-current="page"] { background: var(--primary-500); color: var(--gray-white); font-weight: 700; }
.ds-toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; display: inline-flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100vw - 40px); min-height: 48px; padding: 0 18px 0 14px; border-radius: var(--radius-12); background: var(--gray-900); color: var(--gray-white); font: 600 16px/1.3 var(--font); box-shadow: var(--shadow-3); }
.ds-toast img, .ds-toast svg { flex: none; }
.ds-toast[hidden] { display: none; }
/* 서버가 그려 준 알림(?done= 으로 돌아온 화면)은 스크립트 없이도 3초쯤 뒤 저절로 사라진다. 움직임을 줄인 환경은 더 오래 둔다. */
.ds-toast--auto { animation: ds-toast-out 4s ease forwards; }
@keyframes ds-toast-out { 0%, 85% { opacity: 1; visibility: visible; } 100% { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .ds-toast--auto { animation-duration: 8s; } }
/* 스크립트가 띄우는 알림(live.js giveToast)은 팝오버라 열린 시트 위에도 보인다. 팝오버 기본 모양(테두리·가운데 정렬)을 지우고 같은 자리·모양을 쓴다. */
.ds-toast[popover] { inset: auto auto calc(96px + env(safe-area-inset-bottom)) 50%; margin: 0; border: 0; overflow: visible; }
.ds-toast[popover]:not(:popover-open) { display: none; }
@media (min-width: 1180px) { .ds-toast, .ds-toast[popover] { bottom: 32px; } }
.ds-dialog { width: min(460px, calc(100vw - 32px)); padding: 28px 24px 24px; border: 0; border-radius: var(--radius-16); background: var(--gray-white); box-shadow: var(--shadow-3); color: var(--gray-900); }
.ds-dialog::backdrop { background: var(--overlay-dim); }

/* ---------- 글자 단계(Typography) ---------- */
.ds-display-1 { font: var(--t-display-1); letter-spacing: 0; }
.ds-display-2 { font: var(--t-display-2); }
.ds-heading-1 { font: var(--t-heading-1); letter-spacing: -.02em; }
.ds-heading-2 { font: var(--t-heading-2); letter-spacing: -.01em; }
.ds-heading-3 { font: var(--t-heading-3); }
.ds-heading-4 { font: var(--t-heading-4); }
.ds-title-1 { font: var(--t-title-1); }
.ds-title-2 { font: var(--t-title-2); }
.ds-body-1 { font: var(--t-body-1); }
.ds-body-2 { font: var(--t-body-2); }
.ds-body-3 { font: var(--t-body-3); }
.ds-caption-1 { font: var(--t-caption-1); }
.ds-caption-2 { font: var(--t-caption-2); }
.ds-muted { color: var(--gray-600); }
.ds-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- 진행 막대(Progress) — 인라인 style 을 쓸 수 없어(CSP·배선 계약 S-01) <progress class="ds-meter" value max> 로 그린다 ---------- */
.ds-meter { display: block; width: 100%; height: 4px; border: 0; border-radius: var(--radius-999); background: var(--gray-150); overflow: hidden; -webkit-appearance: none; appearance: none; }
.ds-meter::-webkit-progress-bar { background: var(--gray-150); border-radius: var(--radius-999); }
.ds-meter::-webkit-progress-value { background: var(--progress-gradient); border-radius: var(--radius-999); }
.ds-meter::-moz-progress-bar { background: var(--progress-gradient); border-radius: var(--radius-999); }
.ds-meter-funding::-webkit-progress-value { background: var(--funding-700); }
.ds-meter-funding::-moz-progress-bar { background: var(--funding-700); }
.ds-meter-volunteer::-webkit-progress-value { background: var(--volunteer-700); }
.ds-meter-volunteer::-moz-progress-bar { background: var(--volunteer-700); }

/* ---------- 뒤로 가기 머리(시안 00-02) · 화면 아래 고정 신청 줄 ---------- */
.bkh { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; height: 56px; padding: 0 8px; background: var(--gray-white); border-bottom: 1px solid var(--gray-200); }
.bkh-back, .bkh-share { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; padding: 0; border: 0; background: none; color: var(--gray-900); cursor: pointer; }
.bkh-title { margin: 0; font: 700 18px/1.3 var(--font); color: var(--gray-900); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stk { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: 8px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: var(--gray-white); border-top: 1px solid var(--gray-200); }
.stk-item { flex: 1 1 0; min-width: 0; min-height: 52px; }
.stk-grow-2 { flex-grow: 2; } .stk-grow-3 { flex-grow: 3; } .stk-grow-4 { flex-grow: 4; } .stk-grow-5 { flex-grow: 5; }
body:has(.stk) { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
@media (min-width: 768px) {
  .stk { position: static; padding: 16px 0 0; border-top: 0; background: none; }
  body:has(.stk) { padding-bottom: 0; }
}
