/*
 * 공용 기반 — 공개 화면·심사위원 화면이 함께 쓴다 (tokens.css 다음에 불러온다)
 * 리셋, 래퍼(안전 영역 포함), 픽셀 외곽선(.px)·버튼·칩·배지, 표 처리 공용 클래스, 폼 기본값, 접근성 도우미.
 * 2벌: 모바일(기본) / 데스크톱 @media (min-width: 960px) 하나 — tokens.css 상단 주석 참고 (오더 014).
 */

/* 픽셀 서체 — 이 서버에서 직접 내려준다 (외부 CDN 금지). 라이선스: public/fonts/Galmuri-OFL.txt */
@font-face {
	font-family: "Galmuri11";
	src: url("/public/fonts/Galmuri11-Bold.woff2") format("woff2");
	font-weight: 100 900;      /* 굵기를 바꿔도 가짜 굵게(합성)를 만들지 않는다 */
	font-style: normal;
	font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	font-family: var(--font-sans);
	font-size: var(--fs-body);
	line-height: var(--lh-body);
	color: var(--c-text);
	background: var(--c-bg);
	word-break: keep-all;
	overflow-wrap: anywhere;   /* 긴 URL·영문도 줄바꿈 */
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
img, video, iframe { max-width: 100%; }
img { height: auto; }
button { font: inherit; }

/* 래퍼 — 노치·홈 바 영역을 피한다 (viewport-fit=cover 와 함께)
 * 모바일 벌은 태블릿 세로(~959px)에서도 본문이 늘어지지 않게 --wrap-mobile 로 묶고 가운데 둔다 (배경 띠는 바깥 요소가 끝까지 채운다) */
.wrap {
	width: 100%;
	max-width: var(--wrap-mobile);
	margin: 0 auto;
	padding-left: max(var(--gutter), env(safe-area-inset-left));
	padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.pre-line { white-space: pre-line; }
.center { text-align: center; }
.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; }
.display { font-family: var(--font-display); font-weight: var(--fw-bold); }

/* ---- 픽셀 외곽선 (계단식 모서리) — 방식은 이것 하나 ----
 * 네 방향으로 외곽선 두께(--bw)만큼 민 그림자 4겹 = 모서리 한 칸이 비는 외곽선,
 * 오른쪽 아래로 민 2겹 = 계단진 딱딱한 그림자. 외곽선이 레이아웃 밖에 그려지므로 이웃과 간격을 둔다.
 * 색은 --px-line(외곽선)·--px-drop(그림자 거리)로 바꾼다. clip-path 와 달리 포커스 링을 가리지 않는다.
 */
/* 기본값은 우선순위 0 으로 둔다 — 초점·변형 규칙이 쉽게 덮어쓰게 */
:where(.px, .btn, .chip, .badge, input, textarea, select) { --px-line: var(--c-ink); --px-drop: 0px; }
:where(.px, .btn) { --px-drop: var(--shadow-off); }
:where(.px.flat) { --px-drop: 0px; }
.px, .btn, .chip, .badge,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]),
textarea, select {
	border: 0;
	border-radius: 0;
	box-shadow:
		0 calc(var(--bw) * -1) 0 0 var(--px-line),
		0 var(--bw) 0 0 var(--px-line),
		calc(var(--bw) * -1) 0 0 0 var(--px-line),
		var(--bw) 0 0 0 var(--px-line),
		calc(var(--bw) + var(--px-drop)) var(--px-drop) 0 0 var(--c-shadow),
		var(--px-drop) calc(var(--bw) + var(--px-drop)) 0 0 var(--c-shadow);
}
/* 고대비 모드에서는 그림자가 지워지므로 실제 테두리로 대신한다 */
@media (forced-colors: active) {
	.px, input, textarea, select { border: var(--bw-thin) solid CanvasText; }
}

/* ---- 버튼 — 주(로열 블루) / 보조(흰). 누르면 그림자만큼 내려앉는다. 높이 44px 이상 ---- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
	min-height: var(--touch); padding: var(--sp-2) var(--sp-5);
	margin: var(--bw) calc(var(--bw) + var(--shadow-off)) calc(var(--bw) + var(--shadow-off)) var(--bw);
	font-family: var(--font-display); font-size: var(--fs-btn); font-weight: var(--fw-bold); line-height: var(--lh-tight);
	text-decoration: none; text-align: center; cursor: pointer;
	background: var(--c-bg); color: var(--c-ink);
	transition: transform var(--motion-fast);
}
/* 올리면 살짝 떠오르고(마우스 기기만), 누르면 그림자만큼 내려앉는다 (오더 017) */
@media (hover: hover) {
	.btn:hover:not(.btn-disabled) { transform: translateY(calc(var(--motion-lift) * -1)); }
}
.btn:active:not(.btn-disabled) { transform: translate(var(--shadow-off), var(--shadow-off)); --px-drop: 0px; }
.btn-primary { background: var(--c-main); color: var(--c-on-main); }
.btn-outline, .btn-outline-main { background: var(--c-bg); color: var(--c-ink); }
.btn-disabled { background: var(--c-disabled); color: var(--c-ink); cursor: not-allowed; --px-drop: 0px; }
.btn-small { padding: var(--sp-1) var(--sp-4); font-size: var(--fs-body); }
.btn-block { display: flex; width: calc(100% - var(--bw) * 2 - var(--shadow-off)); }

/* ---- 칩 (해시태그 모양) 노랑·분홍·흰 / 배지 (남색) ---- */
.chip {
	display: inline-flex; align-items: center; padding: var(--sp-1) var(--sp-3);
	margin: var(--bw);
	font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--fs-small); line-height: var(--lh-tight);
	background: var(--c-bg); color: var(--c-ink);
}
.chip-yellow { background: var(--c-point); }
.chip-pink { background: var(--c-pink); }
.chip-white { background: var(--c-bg); }
.badge {
	display: inline-flex; align-items: center; padding: var(--sp-1) var(--sp-4); margin: var(--bw);
	font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--fs-small); line-height: var(--lh-tight);
	background: var(--c-main-dark); color: var(--c-on-main);
}

/* ---- 표 처리 공용 클래스 ----
 * .table-wrap  : 표만 가로 스크롤 (페이지는 밀리지 않는다)
 * .table-cards : 모바일 벌에서 행을 카드로 (각 td 에 data-label 을 단다), 데스크톱 벌에서 표
 */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-cards { width: 100%; border-collapse: collapse; }
.table-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.table-cards tr { display: block; padding: var(--sp-3) 0; border-bottom: var(--bw-thin) solid var(--c-line); }
.table-cards td { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); padding: var(--sp-1) 0; min-width: 0; }
.table-cards td::before { content: attr(data-label); flex: 0 0 auto; font-size: var(--fs-caption); font-weight: var(--fw-bold); color: var(--c-sub); }
.table-cards td > * { min-width: 0; text-align: right; }

/* ---- 폼 기본 — 입력은 흰 바탕 + 잉크 외곽선, 초점이 가면 로열 블루 외곽선 ---- */
input, select, textarea { font: inherit; font-size: var(--fs-body); }   /* 16px 미만이면 iOS 가 확대한다 */
input, textarea, select { background: var(--c-bg); color: var(--c-text); }
input:focus, textarea:focus, select:focus { --px-line: var(--c-focus); }
input[type="checkbox"], input[type="radio"] { width: var(--sp-5); height: var(--sp-5); accent-color: var(--c-main); }
:focus-visible { outline: var(--bw) solid var(--c-focus); outline-offset: var(--focus-gap); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 0; }   /* 입력은 외곽선 색으로 초점을 보인다 */
[id] { scroll-margin-top: var(--sp-7); }

@media (min-width: 960px) {
	.wrap { max-width: var(--wrap); }
	.wrap.narrow { max-width: var(--wrap-narrow); }
	.wrap.wide { max-width: var(--wrap-wide); }
	.table-cards thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
	.table-cards tr { display: table-row; padding: 0; }
	.table-cards td { display: table-cell; padding: var(--sp-3) var(--sp-2); border-bottom: var(--bw-thin) solid var(--c-line); }
	.table-cards td::before { content: none; }
	.table-cards td > * { text-align: inherit; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
