/* 리디자인 공통 스타일 — 기획 02 §7(타이포·버튼·탭 바·접근성), 시안 03 디자인 시스템 페이지.
   전부 .rd 범위 안에서만 동작한다(layouts/redesign 의 body.rd). 기존 화면 CSS(app.css)는 로드하지 않는다. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.rd {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.rd a { color: inherit; }
.rd :focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }   /* §7-7 키보드 포커스 */
.rd .num { font-variant-numeric: tabular-nums; }

/* ── 화면 골격 ── 모바일 1열, 큰 화면에선 가운데 480 고정(가로 스크롤 금지 §7-7) */
.rd-app { max-width: 480px; margin: 0 auto; min-height: 100vh; overflow-x: hidden; }
.rd-screen { padding: 16px var(--gutter) 24px; }
.rd-app.has-tabbar .rd-screen { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px); }

/* ── 타이포(§7-2) ── */
.rd-wordmark { font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: .06em; text-decoration: none; }
.rd-title { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.25; margin: 8px 0 14px; word-break: keep-all; }
.rd-title .rd-big { font-size: 36px; }
.rd-big { font-family: var(--font-display); font-weight: 800; font-size: 56px; line-height: 1; font-variant-numeric: tabular-nums; }
.rd-subtitle { font-weight: 700; font-size: 17px; line-height: 1.35; margin: 0; }
.rd-body { font-size: 15px; line-height: 1.55; margin: 0; color: var(--ink); }
.rd-help { font-size: 13px; line-height: 1.5; color: var(--ink2); margin: 0; word-break: keep-all; }
.rd-caption { font-size: 12px; line-height: 1.4; color: var(--ink3); margin: 0; }
.rd-accent { color: var(--marigold-deep); font-weight: 700; }
.rd-warn { color: var(--warn); }

/* ── 헤더(S-00·S-01) ── */
.rd-header { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.rd-header .rd-link { font-size: 14px; }

/* ── 카드 ── */
.rd-card { background: var(--white); border-radius: var(--r-card); padding: var(--pad); margin: 0 0 var(--gap); }
.rd-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rd-row { display: flex; align-items: center; gap: 12px; }
.rd-row--between { justify-content: space-between; }
.rd-stack > * + * { margin-top: 8px; }

/* ── 버튼(§7-4) — 주 버튼은 화면당 하나 ── */
.rd-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 0 16px;
  border: 0; border-radius: var(--r-btn);
  background: var(--ink); color: var(--white);
  font: 700 16px/1 var(--font-body); text-decoration: none; cursor: pointer;
}
.rd-btn--sub { min-height: 48px; background: var(--white); color: var(--ink); border: 1px solid var(--line); font-weight: 500; font-size: 15px; }
.rd-btn[disabled], .rd-btn.is-disabled { background: var(--line); color: var(--ink3); cursor: not-allowed; }
.rd-btn + .rd-btn { margin-top: 10px; }
.rd-reason { margin-top: 8px; text-align: center; }   /* 비활성 사유 캡션(§7-4) */
.rd-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px;   /* 터치 영역 44 이상 */
  color: var(--marigold-deep); font-weight: 500; font-size: 15px; text-decoration: none;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.rd-link--ink { color: var(--ink); }

/* ── 칩 ── */
.rd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rd-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--white); color: var(--ink);
  font: 500 14px/1.2 var(--font-body); text-decoration: none; cursor: pointer;
}
.rd-chip.is-on { background: var(--ink); color: var(--white); border-color: var(--ink); }
.rd-chip.is-disabled { color: var(--ink3); background: var(--paper); cursor: not-allowed; }
.rd-chip__sub { font-weight: 400; opacity: .8; font-size: 13px; }

/* ── 진행 띠(S-02) — role=progressbar + 읽을 수 있는 문구 병기(§7-7) ── */
.rd-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; margin: 4px 0 6px; }
.rd-strip__cell { height: 14px; border-radius: 4px; background: var(--white); border: 1px solid var(--line); }
.rd-strip__cell.is-used { background: var(--ink); border-color: var(--ink); }
.rd-strip__cell.is-today { background: var(--marigold); border-color: var(--marigold); }
.rd-strip-cap { display: flex; justify-content: space-between; gap: 8px; }

/* ── 지점 번호 4칸(S-00) ── */
.rd-code { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 8px 0 6px; }
.rd-code__box {
  width: 100%; height: 64px; border-radius: var(--r-small); border: 1px solid var(--line); background: var(--white);
  font: 700 28px/1 var(--font-body); text-align: center; color: var(--ink); font-variant-numeric: tabular-nums;
}
.rd-code__box:focus { border: 2px solid var(--marigold); outline: none; }
.rd-hint { display: flex; align-items: center; gap: 6px; min-height: 22px; }
.rd-hint.is-ok { color: var(--ok); }
.rd-hint.is-err { color: var(--warn); }

/* ── 지점 카드 ── */
.rd-branch { display: flex; align-items: center; gap: 12px; }
.rd-branch__icon { flex: none; width: 40px; height: 40px; border-radius: var(--r-small); background: var(--tint); display: grid; place-items: center; }
.rd-branch__body { flex: 1; min-width: 0; }
.rd-branch__name { font-weight: 700; font-size: 16px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 4px; vertical-align: middle; }
.rd-dot.is-off { background: var(--warn); }

/* ── 상품 3칸(S-01·S-06) ── */
.rd-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rd-tile { display: block; background: var(--white); border-radius: var(--r-small); padding: 14px 12px; text-decoration: none; min-height: 96px; }
.rd-tile.is-disabled { opacity: .5; cursor: not-allowed; }   /* 클릭은 받는다 — 비활성 탭도 추적(rd.js 가 이동을 막는다) */
.rd-tile__name { font-weight: 700; font-size: 15px; margin: 8px 0 2px; }
.rd-list { background: var(--white); border-radius: var(--r-card); }
.rd-list__item { display: flex; align-items: center; gap: 14px; padding: 16px var(--pad); min-height: 64px; text-decoration: none; }
.rd-list__item + .rd-list__item { border-top: 1px solid var(--line); }
.rd-list__body { flex: 1; min-width: 0; }

/* ── 안내 면 ── */
.rd-notice { display: flex; gap: 8px; padding: 12px 14px; border-radius: var(--r-small); background: var(--tint); }
.rd-notice--warn { border-left: 3px solid var(--warn); }
.rd-band { margin: 0 0 var(--gap); }

/* ── 사진 표현(시안 디자인 시스템): 인화지 형태 ── */
.rd-print { width: 72px; height: 80px; background: var(--white); padding: 5px 5px 15px; border-radius: 3px; box-shadow: 0 1px 4px rgba(26,27,46,.12); transform: rotate(-4deg); }
.rd-print > span { display: block; width: 100%; height: 100%; background: var(--photo); }

/* ── 탭 바(§7-6) ── 하단 고정, 높이 64 + 안전영역. 활성 = 잉크 글자 + 상단 마리골드 표시(시안 03 p6) */
.rd-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--white); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.rd-tabbar__inner { max-width: 480px; margin: 0 auto; display: flex; height: var(--tabbar-h); }
.rd-tab {
  position: relative; flex: 1; min-width: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink3); font-size: 12px; font-weight: 500; text-decoration: none; background: none; border: 0; font-family: inherit; cursor: pointer;
}
.rd-tab.is-on { color: var(--ink); font-weight: 700; }
.rd-tab.is-on::before { content: ''; position: absolute; top: -1px; left: 50%; width: 28px; height: 3px; margin-left: -14px; background: var(--marigold); border-radius: 0 0 3px 3px; }
.rd-tab svg { width: 24px; height: 24px; }
.rd-tab.is-soon { color: var(--ink3); }

/* ── 시트·모달 ── */
.rd-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(26,27,46,.45); }
.rd-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 91; max-width: 480px; margin: 0 auto;
  background: var(--white); border-radius: var(--r-card) var(--r-card) 0 0;
  padding: 22px var(--gutter) calc(20px + env(safe-area-inset-bottom, 0px));
}
.rd-sheet__title { font-weight: 700; font-size: 17px; margin: 0 0 10px; }
.rd-steps { margin: 0 0 16px; padding-left: 20px; }
.rd-steps li + li { margin-top: 8px; }
.rd-modal {
  position: fixed; left: 50%; top: 50%; z-index: 91; width: calc(100% - 48px); max-width: 360px; transform: translate(-50%, -50%);
  background: var(--white); border-radius: var(--r-card); padding: 22px 20px 18px;
}
[hidden] { display: none !important; }

/* ── 여백 유틸(인라인 style 금지 — CSP style-src 'self') ── */
.rd-mt8 { margin-top: 8px; }
.rd-mt16 { margin-top: 16px; }


/* ── 주문내역 ── */
.rd-status { font-size: 13px; font-weight: 700; }
.rd-status.is-done { color: var(--ok); }
.rd-status.is-wait { color: var(--marigold-deep); }
.rd-status.is-late { color: var(--warn); }
.rd-empty { text-align: center; padding: 40px 0; }

/* QR 스캐너 오버레이 — scan.js 가 hidden 토글(기존 화면과 같은 DOM id 를 쓴다) */
.rd-qr { position: fixed; inset: 0; z-index: 100; background: #000; display: flex; align-items: center; justify-content: center; }
.rd-qr video { width: 100%; height: 100%; object-fit: cover; }
.rd-qr__frame { position: absolute; width: 64vw; max-width: 280px; aspect-ratio: 1; border: 3px solid var(--marigold); border-radius: 16px; }
.rd-qr__status { position: absolute; bottom: 72px; left: 0; right: 0; text-align: center; color: var(--white); font-size: 14px; }
.rd-qr__close { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.2); color: var(--white); font-size: 20px; cursor: pointer; }
