/* 이 파일을 고치면 모든 페이지(와 HGHMC 의 tool/build_site_legal.py)의 style.css?v=숫자 를 올린다.
   브라우저가 이 파일을 4시간 동안 저장해 두어서, 숫자를 올리지 않으면 새 화면에 예전 모양이 입혀진다 */
/* memory.day 공통 모양. 색·글자·모서리는 하루기억, 하기 앱(HGHMC doc/design.md)을 따른다.
   그림자·그라데이션은 쓰지 않고, 높이는 바탕색과 선으로 나타낸다 */
:root {
  --bg: #ffffff;
  --surface: #f5f5f5;
  --line: #dddddd;
  --strong: #030303;
  --body: #292929;
  --sub: #737373;
  --primary: #030303;
  --on-primary: #ffffff;
  --accent: #1a8048;
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10;
    --surface: #2a2a2e;
    --line: #303035;
    --strong: #f2f2f3;
    --body: #d1d1d6;
    --sub: #9a9aa0;
    --primary: #ededef;
    --on-primary: #0e0e10;
    --accent: #3fd07f;
  }

  /* 마크는 검정 그림이라 어두운 바탕에서는 뒤집는다 */
  .mark {
    filter: invert(1);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

/* display 를 정한 요소(.btn 등)도 hidden 이면 숨긴다 */
[hidden] {
  display: none !important;
}

/* ── 버튼 ─────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--strong);
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
}

.btn.primary {
  background: var(--primary);
  color: var(--on-primary);
}

/* 글자 버튼. 한 화면에서 가장 약한 동작에 쓴다(앱의 텍스트 버튼과 같다: 채움 없이 초록 글자 15) */
.btn.text {
  min-height: 44px;
  background: none;
  color: var(--accent);
  font-size: 15px;
}

.btn:active {
  opacity: 0.7;
}

.btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.stack {
  display: grid;
  gap: 8px;
}

/* ── 링크 모음(첫 화면), 안내 한 장 ───── */
.page {
  display: flex;
  flex-direction: column;
  gap: 40px;
  max-width: 420px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(96px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px))
    calc(40px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
}

.hero {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.hero .mark {
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
}

.hero h1 {
  margin: 0;
  color: var(--strong);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.35;
}

.hero p {
  margin: 0;
  color: var(--sub);
  font-size: 15px;
  line-height: 1.6;
}

/* ── 맨 위 줄(문서 화면) ──────────────── */
.bar {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--strong);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.brand .mark {
  width: 24px;
  height: 24px;
}

/* ── 문서(약관·정책·안내) ─────────────── */
.doc {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 64px;
}

.doc h1 {
  margin: 0 0 24px;
  color: var(--strong);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.35;
}

.doc h2 {
  margin: 48px 0 12px;
  color: var(--strong);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}

.doc h3 {
  margin: 28px 0 8px;
  color: var(--strong);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
}

.doc p {
  margin: 0 0 12px;
}

.doc ul,
.doc ol {
  margin: 0 0 12px;
  padding-left: 22px;
}

.doc li {
  margin: 4px 0;
}

.doc li > ul,
.doc li > ol {
  margin: 4px 0 0;
}

.doc strong {
  color: var(--strong);
  font-weight: 600;
}

/* 초록은 본문 안의 링크와 글자 버튼(.btn.text)에만 쓴다. 바탕이나 강조에는 쓰지 않는다 */
.doc a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.doc .lead {
  color: var(--sub);
}

.doc .stack {
  max-width: 420px;
  margin-top: 32px;
}

/* 칸이 많은 표는 옆으로 넘긴다 */
.table {
  margin: 0 0 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.6;
}

.table th,
.table td {
  min-width: 112px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table th {
  background: var(--surface);
  color: var(--strong);
  font-weight: 600;
  white-space: nowrap;
}

.table tr > :last-child {
  border-right: 0;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

/* ── 맨 아래 ──────────────────────────── */
.foot {
  margin-top: auto;
  color: var(--sub);
  font-size: 13px;
  line-height: 1.8;
  text-align: center;
}

.foot p {
  margin: 0;
}

.foot nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  margin-bottom: 12px;
}

.foot a {
  text-decoration: none;
}

.foot nav a {
  color: var(--body);
}

/* 문서 화면에서는 선으로 본문과 나눈다 */
.foot.wide {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px calc(40px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
}

/* ── 잠깐 뜨는 안내("준비 중이에요") ──── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100vw - 40px);
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}
