/* ==========================================================================
   매트밖 — style.css
   마당 원칙: 종이 질감 · 활자 중심 · 넉넉한 여백 · 포인트 1색(쑥색)
   모바일 우선, max-width 640px 중앙 컬럼
   ========================================================================== */

:root {
  --paper: #faf8f4;        /* 바탕 종이 */
  --paper-raised: #fffdf9; /* 카드·입력 종이 */
  --paper-deep: #f4f1e9;   /* 푸터 종이 */
  --ink: #1f1d1a;          /* 잉크 */
  --ink-soft: #55504a;     /* 옅은 잉크 */
  --ink-faint: #8a8478;    /* 흐린 잉크 */
  --hair: #e4ded1;         /* 실선 */
  --accent: #57624a;       /* 쑥색 — 포인트 1색 */
  --accent-deep: #454f39;
  --accent-wash: rgba(87, 98, 74, 0.07);
  --serif: "Noto Serif KR", "Nanum Myeongjo", "AppleMyungjo", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", Pretendard,
          "Noto Sans KR", "Malgun Gothic", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--paper);
  word-break: keep-all;
  overflow-wrap: break-word;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* 종이의 미묘한 톤 변화 — 질감은 있되 그림자는 없다 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 12% 4%, rgba(87, 98, 74, 0.045), transparent 60%),
    radial-gradient(ellipse 70% 55% at 92% 98%, rgba(31, 29, 26, 0.04), transparent 60%);
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(87, 98, 74, 0.22);
}

main {
  flex: 1 0 auto;
}

.wrap {
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
  padding-inline: 20px;
}

h1, h2, h3 {
  line-height: 1.4;
  font-weight: 600;
}

[tabindex="-1"]:focus {
  outline: none;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- 섹션 전환: fade만 ---- */
.section {
  padding: 48px 0 72px;
}

.fade-in {
  animation: fade 0.4s ease both;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

/* ---- 버튼 공통 ---- */
button {
  font-family: var(--sans);
  font-size: 16px;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.btn {
  display: inline-block;
  border-radius: 8px;
  padding: 13px 26px;
  font-size: 16px;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fbfaf6;
}

.btn-primary:hover {
  background: var(--accent-deep);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-lg {
  padding: 16px 36px;
  font-size: 17px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fbfaf6;
}

.text-btn {
  font-size: 16px;
  color: var(--ink-soft);
  padding: 4px 2px;
}

.text-btn:hover {
  color: var(--ink);
}

.accent-link {
  color: var(--accent);
  font-weight: 600;
}

.accent-link:hover {
  color: var(--accent-deep);
}

.is-invisible {
  visibility: hidden;
}

/* ---- 헤더 ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--hair);
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-block: 16px;
}

.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.nav-link {
  color: var(--ink-soft);
}

/* ---- 1. 히어로 ---- */
.hero {
  text-align: center;
  padding-block: 9vh 24px;
}

.hero-brand {
  font-size: 46px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.hero-rule {
  width: 28px;
  height: 2px;
  background: var(--accent);
  margin: 26px auto 30px;
}

.hero-copy {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.55;
}

.hero-sub {
  margin-top: 18px;
  font-size: 17px;
  color: var(--ink-soft);
}

.hero .btn-lg {
  margin-top: 44px;
}

/* ---- 2. 처방 플로우 ---- */
.flow-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 48px;
}

.progress {
  display: flex;
  gap: 6px;
}

.pbar {
  width: 26px;
  height: 3px;
  border-radius: 2px;
  background: var(--hair);
  transition: background-color 0.2s ease;
}

.pbar.is-on {
  background: var(--accent);
}

.flow-count {
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink-faint);
  min-width: 44px;
  text-align: right;
}

.kicker {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.step-question {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 600;
}

.choices {
  display: grid;
  gap: 12px;
  margin-top: 32px;
}

.choice {
  width: 100%;
  padding: 20px;
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  border-radius: 10px;
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.choice:hover {
  border-color: var(--accent);
}

.choice:active {
  background: var(--paper-deep);
}

/* 메일에서 실려 온 답, 또는 뒤로 눌러 되돌아온 단계에서 이미 고른 답 */
.choice.is-chosen {
  border-color: var(--accent);
  background: var(--accent-wash);
}

@media (min-width: 480px) {
  .choices {
    grid-template-columns: repeat(3, 1fr);
  }
  .choice {
    padding: 26px 12px;
  }
}

/* ---- 3. 처방 카드 ---- */
.rx-card {
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  border-radius: 12px;
  padding: 30px 22px 26px;
}

.rx-title {
  margin-top: 8px;
  font-size: 29px;
  font-weight: 700;
  line-height: 1.35;
}

.rx-note {
  margin-top: 14px;
  color: var(--ink-soft);
}

.rx-block {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--hair);
}

.rx-name {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 600;
}

.rx-duration {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--ink-faint);
  white-space: nowrap;
}

.rx-howto {
  margin-top: 10px;
  color: var(--ink-soft);
}

.rx-steps {
  margin-top: 10px;
  padding-left: 24px;
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
}

.rx-steps li::marker {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink-faint);
}

.rx-video {
  margin-top: 18px;
}

.rx-video a.accent-link {
  text-decoration: none;
}

.video-request-btn {
  font-size: 16px;
  color: var(--ink-faint);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.video-request-btn:hover {
  color: var(--ink-soft);
}

.video-request-done {
  font-size: 16px;
  color: var(--ink-faint);
}

.rx-journal {
  margin-top: 34px;
  padding: 18px 20px;
  background: var(--accent-wash);
  border: 1px solid var(--hair);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}

.rx-journal-q {
  margin-top: 6px;
  font-size: 18px;
  line-height: 1.65;
}

/* 한 줄 기록 */
.record-block {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--hair);
}

.record-label {
  display: block;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-soft);
}

.record-form {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.record-form input {
  flex: 1;
  min-width: 0;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--hair);
  border-radius: 8px;
  padding: 12px 14px;
}

.record-form input::placeholder {
  color: var(--ink-faint);
}

.record-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.hint {
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--accent-deep);
  min-height: 1.4em;
}

.record-done {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--hair);
  text-align: center;
}

.record-done-msg {
  font-size: 18px;
  font-weight: 600;
}

.record-done .text-btn {
  margin-top: 8px;
}

.rx-restart {
  display: block;
  margin: 28px auto 0;
  color: var(--ink-faint);
}

.rx-restart:hover {
  color: var(--ink-soft);
}

/* 처방 실패 안내 */
.rx-error {
  text-align: center;
  padding-block: 24px;
}

.rx-error h2 {
  font-size: 24px;
}

.rx-error p {
  margin-top: 14px;
  color: var(--ink-soft);
}

.rx-error .btn {
  margin-top: 28px;
}

/* ---- 4. 결(기록) 뷰 ---- */
.section-title {
  font-size: 28px;
  font-weight: 700;
}

.section-sub {
  margin-top: 8px;
  color: var(--ink-soft);
}

.streaks {
  display: flex;
  margin-top: 32px;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  padding-block: 22px;
}

.streak {
  flex: 1;
  text-align: center;
}

.streak + .streak {
  border-left: 1px solid var(--hair);
}

.streak-num {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
}

.streak-unit {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--ink-faint);
  margin-left: 3px;
}

.streak-label {
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink-soft);
}

.streak-note {
  margin: 20px auto 0;
  max-width: 34em;
  text-align: center;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-faint);
}

.records-list {
  list-style: none;
  margin-top: 8px;
}

.record-item {
  padding-block: 18px;
  border-bottom: 1px solid var(--hair);
}

.record-date {
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink-faint);
}

.record-line {
  margin-top: 4px;
  font-size: 17px;
}

.records-empty {
  margin-top: 40px;
  text-align: center;
  color: var(--ink-soft);
}

.records-cta {
  display: block;
  margin: 40px auto 0;
}

/* ---- 5. 푸터 ---- */
.site-footer {
  background: var(--paper-deep);
  border-top: 1px solid var(--hair);
  padding-block: 44px 36px;
}

.waitlist-title {
  font-size: 20px;
  font-weight: 700;
}

.waitlist-sub {
  margin-top: 6px;
  font-size: 16px;
  color: var(--ink-soft);
}

.waitlist-sub {
  max-width: 46em;
}

.waitlist-sub + .waitlist-sub {
  margin-top: 10px;
}

.waitlist .btn {
  margin-top: 18px;
  text-decoration: none;
}

.waitlist-form {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 34em;
}

.waitlist-form input {
  flex: 1 1 16em;
  min-width: 0;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 16px; /* iOS 입력 확대 방지 */
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hair);
  border-radius: 8px;
}

.waitlist-form input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.waitlist-form .btn {
  margin-top: 0;
  flex: 0 0 auto;
}

.waitlist .hint {
  margin-top: 10px;
}

.cadence {
  margin-top: 18px;
}

.cadence-q {
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink-soft);
}

.cadence-opts {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cadence-opt {
  padding: 10px 16px;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hair);
  border-radius: 999px;
}

.cadence-opt:hover:not(:disabled) {
  border-color: var(--accent);
}

.cadence-opt.is-chosen {
  border-color: var(--accent);
  background: var(--accent-wash);
  font-weight: 700;
}

.cadence-opt:disabled {
  opacity: 0.75;
}

.maker {
  margin-top: 32px;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink-faint);
}

/* ---- 데스크톱 보정 (모바일 우선) ---- */
@media (min-width: 640px) {
  .section {
    padding: 64px 0 88px;
  }

  .hero-brand {
    font-size: 56px;
  }

  .hero-copy {
    font-size: 28px;
  }

  .step-question {
    font-size: 30px;
  }

  .rx-card {
    padding: 40px 36px 34px;
  }

  .rx-title {
    font-size: 32px;
  }
}
