/* 루프톤 제안서 신청 페이지. 흰 종이에 검정 글씨, 색은 리플렛의 포스트잇과 로고가 맡는다. */

/* 포스트잇 손글씨(Gaegu Bold, SIL OFL 1.1). 쓰는 글자만 잘라 직접 내려보낸다(scripts/build-hand-font.ts).
   block: 글꼴이 오기 전 고딕으로 먼저 그렸다가 바뀌는 대신, 잠깐 비워 두었다가 한 번에 그린다. */
@font-face {
  font-family: 'Gaegu Title';
  src: url('/fonts/gaegu-title.woff2') format('woff2');
  font-weight: 700;
  font-display: block;
}
@font-face {
  font-family: 'Gaegu Reviews';
  src: url('/fonts/gaegu-reviews.woff2') format('woff2');
  font-weight: 700;
  font-display: block;
}

:root {
  color-scheme: light;
  /* 색은 Branch UI 토큰(@codetree21/branch-ui-token, https://ui.bandb.ai)에서 가져온다 */
  --paper: #ffffff;
  --desk: #ededed; /* neutral-200 */
  --ink: #171717; /* neutral-950 */
  --ink-soft: #6d6d6d; /* neutral-700 */
  --line: #dfdfdf; /* neutral-300 */
  --line-strong: #c8c8c8; /* neutral-400 */
  --press: #f5f5f5; /* neutral-100 */
  --accent: #33bb66; /* green-500, 로고와 같은 초록 */
  --accent-hover: #23964f; /* green-600 */
  --accent-press: #1f7641; /* green-700 */
  --accent-wash: #e5f7ea; /* green-50 */
  --ok: #23964f; /* green-600 */
  --danger: #ee5945; /* red-500 */
  --danger-text: #cc3622; /* red-600 */
  --danger-wash: #fef3f2; /* red-50 */
  /* 포스트잇은 디자인 시스템이 아니라 리플렛에서 온 것 */
  --note-yellow: #f8de76;
  --note-pink: #f2c2d5;
  --note-blue: #b8ccf0;
  --note-shadow: 0 1px 1px rgba(60, 50, 10, 0.1), 0 16px 18px -13px rgba(60, 50, 10, 0.5);
  --ui: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --hand-title: 'Gaegu Title', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --hand-review: 'Gaegu Reviews', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --gutter: 22px;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
/* manipulation: 버튼을 빠르게 연달아 눌러도 화면이 확대되지 않게 한다(두 손가락 확대는 그대로 된다) */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
/* 다시 들어와 뒤 단계로 이어 갈 때 1단계가 비치지 않게 잠깐 가린다(resume-hint.js). app.js가 못 떠도 2초 뒤엔 보인다. */
[data-resuming] .sheet { visibility: hidden; animation: resume-reveal 0s 2s forwards; }
@keyframes resume-reveal { to { visibility: visible; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, p, figure, blockquote, fieldset, legend, dl, dd { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
a { color: inherit; }

.sheet {
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 18px var(--gutter) max(36px, env(safe-area-inset-bottom));
  background: var(--paper);
  overflow-x: hidden;
  overflow-x: clip;
}

/* 로고 줄 */
.brand { display: flex; align-items: center; gap: 10px; height: 34px; }
.brand img { display: block; width: auto; }
.brand-codetree { height: 15px; }
/* aws 로고는 글자 아래 미소 때문에 무게중심이 위에 있어 조금 내려 맞춘다 */
.brand-aws { height: 21px; margin-top: 5px; }
.brand-nxt { height: 30px; }
.brand-x { color: var(--ink-soft); font-size: 13px; }

/* 제목 */
.title-row { position: relative; margin-top: 30px; }
.title-row h1 { font-size: 37px; line-height: 1.16; font-weight: 800; letter-spacing: -0.04em; }
h1:focus, h2:focus { outline: none; }
.tag-note {
  position: absolute;
  top: -8px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  background: var(--note-yellow);
  box-shadow: var(--note-shadow);
  transform: rotate(5deg);
}
.tag-note svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tag-note span { position: relative; padding-top: 7px; font-family: var(--hand-title); font-size: 24px; font-weight: 700; letter-spacing: -0.05em; }
.lede { margin-top: 14px; color: var(--ink-soft); font-size: 16.5px; line-height: 1.55; }

/* 폼 */
.form { display: grid; gap: 16px; margin-top: 26px; }
.field label, .concerns legend { display: block; margin-bottom: 7px; font-size: 15px; font-weight: 700; }
.field input, .field textarea {
  display: block;
  width: 100%;
  height: 54px;
  margin: 0;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { height: auto; min-height: 96px; padding: 13px 15px; line-height: 1.5; resize: vertical; }
.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  outline: none;
}
.field input[aria-invalid='true'] { border-color: var(--danger); background: var(--danger-wash); }
.field-error { margin-top: 6px; color: var(--danger-text); font-size: 14.5px; font-weight: 600; }
.form-error { padding: 12px 14px; border-radius: var(--radius); background: var(--danger-wash); color: var(--danger-text); font-size: 15.5px; font-weight: 600; }
.form-intro { color: var(--ink-soft); font-size: 16px; line-height: 1.55; }
/* 소속 대학 추천 목록 */
.field { scroll-margin-top: 10px; }
.combo { position: relative; }
.options {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08), 0 8px 16px rgba(0, 0, 0, 0.08); /* Branch UI의 flyout 그림자 */
  list-style: none;
}
.option {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 8px 11px;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1.35;
  cursor: pointer;
}
.option[aria-selected='true'], .option:active { background: var(--press); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* 체크 상자(동의, 고민 고르기 공통) */
.box {
  display: grid;
  flex: none;
  place-content: center;
  width: 26px;
  height: 26px;
  margin: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  /* iOS 15.3까지는 접두어가 붙은 쪽만 알아듣는다 */
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.box::before {
  content: '';
  width: 13px;
  height: 8px;
  border-bottom: 3px solid var(--paper);
  border-left: 3px solid var(--paper);
  transform: translateY(-2px) rotate(-45deg) scale(0);
}
.box:checked { border-color: var(--accent); background: var(--accent); }
.box:checked::before { transform: translateY(-2px) rotate(-45deg) scale(1); }
.box:focus-visible, .primary:focus-visible, .plain:focus-visible, .round:focus-visible, .theme-chip:focus-visible, .link-button:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid rgba(35, 150, 79, 0.45);
  outline-offset: 3px;
}
.box[aria-invalid='true'] { border-color: var(--danger); background: var(--danger-wash); }

.consent { margin-top: 2px; }
.check { display: flex; align-items: flex-start; gap: 11px; font-size: 16px; font-weight: 600; line-height: 1.6; cursor: pointer; }
.consent-detail { margin: 6px 0 0 37px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; }
.consent-detail summary { width: fit-content; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.consent-detail dl { display: grid; gap: 2px; margin-top: 8px; }
.consent-detail dt { margin-top: 8px; color: var(--ink); font-weight: 700; }
.consent-detail p { margin-top: 12px; }
.consent .field-error { margin-left: 37px; }

/* 버튼 */
.primary {
  width: 100%;
  height: 54px;
  margin-top: 4px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
@media (hover: hover) {
  .primary:hover { background: var(--accent-hover); }
}
.primary:active { background: var(--accent-press); }
.primary:disabled { opacity: 0.6; cursor: progress; }
.plain:disabled { opacity: 0.5; cursor: progress; }
.plain {
  justify-self: center;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* 2단계: 신청 확인 쪽지 */
.done-note {
  margin: 28px 4px 0;
  padding: 22px 22px 24px;
  background: var(--note-yellow);
  box-shadow: var(--note-shadow);
  transform: rotate(-1.4deg);
}
.done-note h2 { display: flex; align-items: center; gap: 10px; font-family: var(--hand-title); font-size: 36px; line-height: 1.1; font-weight: 700; letter-spacing: -0.05em; }
.done-note svg { flex: none; width: 32px; height: 32px; }
.done-note p { margin-top: 10px; font-size: 16px; line-height: 1.5; }
.done-note strong { font-weight: 700; }

.pick-list { display: grid; gap: 8px; }
.pick {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
}
.pick .box { width: 24px; height: 24px; }
.pick:has(.box:checked) { border-color: var(--accent); background: var(--accent-wash); }

/* 3단계: 후기 쪽지 더미 */
.thanks { margin-top: 26px; color: var(--ok); font-size: 15.5px; font-weight: 700; }
.reviews-title { margin-top: 30px; font-size: 34px; line-height: 1.18; font-weight: 800; letter-spacing: -0.04em; }
.thanks + .reviews-title { margin-top: 10px; }

/* 분야 칩: 2×2로 한눈에. 고른 칩만 검정으로 채운다(초록으로 티 내지 않는다). */
.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 24px; }
.theme-chip {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}
.theme-chip:active { background: var(--press); }
.theme-chip[aria-pressed='true'] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.theme-title { margin-top: 22px; font-size: 19px; font-weight: 800; line-height: 1.35; letter-spacing: -0.02em; }

.deck { position: relative; margin: 18px 8px 0; touch-action: pan-y; }
.note { border-radius: 2px; box-shadow: var(--note-shadow); }
.note[data-tone='yellow'] { background: var(--note-yellow); }
.note[data-tone='pink'] { background: var(--note-pink); }
.note[data-tone='blue'] { background: var(--note-blue); }
.note-back { position: absolute; inset: 0; }
.note-back-far { transform: rotate(4.5deg) translate(6px, 4px); }
.note-back-near { transform: rotate(-3deg) translate(-4px, 3px); }
.note-current {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  padding: 28px 24px 22px;
  user-select: none;
  -webkit-user-select: none;
}
.note-current[data-tilt='a'] { transform: rotate(-1.2deg); }
.note-current[data-tilt='b'] { transform: rotate(0.9deg); }
.note-current[data-tilt='c'] { transform: rotate(-0.4deg); }
/* Gaegu는 글자 사이가 넓어서 조여 쓴다 */
.note-current blockquote { font-family: var(--hand-review); font-size: 31px; line-height: 1.3; font-weight: 700; letter-spacing: -0.05em; }
.note-current[data-size='long'] blockquote { font-size: 24.5px; line-height: 1.36; }
.note-current figcaption { margin-top: auto; padding-top: 18px; color: rgba(20, 20, 20, 0.72); font-size: 13.5px; font-weight: 600; }

.deck-nav { display: flex; align-items: center; justify-content: center; gap: 24px; margin-top: 26px; }
.round {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.round:active { background: var(--press); }
.round svg { width: 24px; height: 24px; }
.deck-count { min-width: 58px; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }

.after { display: grid; gap: 16px; margin-top: 36px; padding-top: 22px; border-top: 1.5px solid var(--ink); }
.after a { font-weight: 700; text-underline-offset: 4px; }
.contact { color: var(--ink-soft); font-size: 15px; line-height: 1.6; }

/* 3단계 아래: 이 기기에서 한 신청. 같은 휴대폰으로 다른 분이 새로 신청할 수도 있다. */
.mine { display: grid; gap: 4px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.mine p { color: var(--ink-soft); font-size: 15px; line-height: 1.55; }
.mine strong { color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.mine-actions { display: flex; flex-wrap: wrap; column-gap: 18px; }
.link-button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
  .box::before { transition: transform 120ms ease-out; }
  /* 신청 버튼에 답하는 한 번의 움직임: 쪽지가 탁 붙는다 */
  .done-note { animation: stick 340ms cubic-bezier(0.2, 1.5, 0.4, 1) both; }
  /* 다시 들어와 이어 보일 때는 되풀이하지 않는다 */
  [data-restored] .done-note { animation: none; }
}
@keyframes stick {
  from { opacity: 0; transform: rotate(-7deg) scale(1.14) translateY(-10px); }
}

/* 넓은 화면에서는 책상 위에 놓인 종이 한 장처럼 보여 준다 */
@media (min-width: 560px) {
  body { background: var(--desk); }
  .sheet {
    min-height: 0;
    margin: 32px auto;
    padding-top: 26px;
    padding-bottom: 40px;
    border-radius: 16px;
    box-shadow: 0 24px 48px -28px rgba(20, 20, 20, 0.4);
  }
}
