/* ============================================================
   Shortform Studio — 리소 워크숍 (잉크 온 페이퍼)
   랜딩(pluver.site)과 동일 팔레트·서체
   ============================================================ */

@font-face {
  font-family: 'Paperlogy';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-8ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

:root {
  /* 잉크 온 페이퍼 (랜딩과 동일 팔레트) */
  --bg: #f4f1ea;
  --bg-soft: #efece4;
  --panel: #efece4;
  --panel-2: #e9e5da;
  --line: rgba(22, 21, 15, .16);
  --line-soft: rgba(22, 21, 15, .10);
  --text: #16150f;
  --text-dim: rgba(22, 21, 15, .70);
  --text-faint: rgba(22, 21, 15, .60);

  /* 포인트 — 리소 형광 마젠타 */
  --accent: #c4008f;
  --accent-deep: #a30077;
  --accent-ink: #f4f1ea;
  --accent-2: #00594f;
  /* rgba() 안에서 알파만 바꿔 쓰기 위한 트리플 */
  --accent-rgb: 196, 0, 143;
  --accent-2-rgb: 0, 89, 79;

  --danger: #b3241a;
  --danger-soft: rgba(179, 36, 26, .10);

  /* 리소 인쇄물은 각지다 */
  --radius: 5px;
  --radius-sm: 3px;
  --shadow: none;

  --font: 'Pretendard Variable', -apple-system, "Apple SD Gothic Neo",
    "Noto Sans KR", "Malgun Gothic", sans-serif;
  --display: 'Paperlogy', 'Pretendard Variable', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --grain-op: .30;
  --grain-blend: multiply;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130d;
    --bg-soft: #1a1912;
    --panel: #1c1b13;
    --panel-2: #23211a;
    --line: rgba(242, 238, 227, .18);
    --line-soft: rgba(242, 238, 227, .10);
    --text: #f2eee3;
    --text-dim: rgba(242, 238, 227, .68);
    --text-faint: rgba(242, 238, 227, .55);

    --accent: #ff5ecb;
    --accent-deep: #ff85d8;
    --accent-ink: #14130d;
    --accent-2: #3fb8ab;
    --accent-rgb: 255, 94, 203;
    --accent-2-rgb: 63, 184, 171;

    --danger: #ff7a6e;
    --danger-soft: rgba(255, 122, 110, .14);

    --grain-op: .22;
    --grain-blend: screen;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  /* 한글은 어절 단위로 줄바꿈 (단어 중간에서 끊기지 않게) */
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 헤드라인·설명문 줄 길이 균형 */
h1, h2, .lede, .drop-title, .drop-sub, .err-text {
  text-wrap: balance;
}

/* 은은한 배경 광원 */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 45% at 78% 8%, rgba(var(--accent-rgb), 0.10), transparent 60%),
    radial-gradient(55% 40% at 12% 90%, rgba(var(--accent-2-rgb), 0.08), transparent 60%);
}

.topbar,
.stage,
.footer { position: relative; z-index: 1; }

/* ---------- 상단바 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(18px, 4vw, 44px);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(150deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  color: var(--accent);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; letter-spacing: -0.01em; }
.brand-text span { font-size: 12px; color: var(--text-faint); }

.health {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
.health-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.5);
}
.health.ok .health-dot {
  background: var(--accent);
  animation: healthPulse 2.4s ease-out infinite;
}
.health.bad .health-dot { background: var(--danger); }
@keyframes healthPulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(var(--accent-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0); }
}

/* ---------- 무대(중앙 영역) ---------- */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 40px);
  width: 100%;
}

.view { width: 100%; max-width: 720px; animation: viewIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.view-done { max-width: 940px; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ============================================================
   상태 1: 업로드
   ============================================================ */
.upload-head { text-align: center; margin-bottom: 28px; }
.upload-head h1 {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
  font-weight: 750;
}
.accent { color: var(--accent); }
.lede { color: var(--text-dim); font-size: clamp(14px, 2.2vw, 16px); margin: 0; }

.dropzone {
  position: relative;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background:
    var(--panel);
  padding: clamp(34px, 6vw, 56px) 24px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
  overflow: hidden;
  outline: none;
}
.dropzone:hover,
.dropzone:focus-visible { border-color: var(--accent-deep); transform: translateY(-2px); }
.dropzone.dragover {
  border-color: var(--accent);
  border-style: solid;
  background: rgba(var(--accent-rgb), 0.08);
}
.dropzone.dragover .drop-glow { opacity: 1; transform: scale(1); }

.drop-glow {
  position: absolute;
  inset: -40%;
  background: radial-gradient(closest-side, rgba(var(--accent-rgb), 0.18), transparent 70%);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.dropzone-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.drop-icon {
  display: grid;
  place-items: center;
  width: 84px; height: 84px;
  border-radius: 22px;
  background: radial-gradient(120% 120% at 50% 0%, rgba(var(--accent-rgb), 0.14), var(--panel-2));
  border: 1px solid var(--line);
  color: var(--accent);
  margin-bottom: 6px;
}
.drop-title { font-size: clamp(17px, 2.6vw, 20px); font-weight: 600; margin: 0; }
.drop-sub { font-size: 13px; color: var(--text-faint); margin: 0 0 6px; }

.upload-controls {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}
.voice-field {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 8px 8px 16px;
}
.voice-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}
.voice-field select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 34px 8px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8578' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.voice-field select:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 1px; }

.dropzone-error {
  margin: 16px auto 0;
  max-width: 520px;
  text-align: center;
  color: #ffd0d0;
  background: var(--danger-soft);
  border: 1px solid rgba(255, 107, 107, 0.35);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  animation: shake 0.4s;
}
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  30%, 70% { transform: translateX(3px); }
  50% { transform: translateX(-4px); }
}

/* ============================================================
   상태 2: 진행
   ============================================================ */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 34px);
  box-shadow: var(--shadow);
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 70%;
  color: var(--text-dim);
  font-size: 14px;
}
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip svg { flex: none; color: var(--text-faint); }
.progress-pct {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.5);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}
.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-100%);
  animation: sheen 1.6s ease-in-out infinite;
}
@keyframes sheen { to { transform: translateX(100%); } }

.step-label {
  margin: 16px 0 24px;
  font-size: 15px;
  color: var(--text);
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  position: relative;
}
/* 스텝 연결선 */
.steps::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 12.5%;
  right: 12.5%;
  height: 2px;
  background: var(--line);
  z-index: 0;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.step-ring {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  border: 2px solid var(--line);
  color: var(--text-faint);
  transition: all 0.3s;
}
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.step-check { display: none; color: var(--accent-ink); }
.step-name { font-size: 12.5px; color: var(--text-faint); transition: color 0.3s; }

/* 진행 중 단계 */
.step.active .step-ring {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12);
  animation: stepPulse 1.4s ease-in-out infinite;
}
.step.active .step-name { color: var(--text); font-weight: 600; }
@keyframes stepPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12); }
  50% { box-shadow: 0 0 0 8px rgba(var(--accent-rgb), 0.04); }
}

/* 완료된 단계 */
.step.done .step-ring {
  border-color: var(--accent-deep);
  background: var(--accent);
  color: var(--accent-ink);
}
.step.done .step-dot { display: none; }
.step.done .step-check { display: block; }
.step.done .step-name { color: var(--text-dim); }

/* 진행 중 에러 패널 */
.panel-error {
  margin-top: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  border-color: rgba(255, 107, 107, 0.3);
  background: linear-gradient(180deg, var(--danger-soft), var(--panel));
}
.err-icon { color: var(--danger); }
.err-text { margin: 0; font-size: 15px; color: #ffd7d7; max-width: 460px; }

/* ============================================================
   상태 3: 완료
   ============================================================ */
.done-grid {
  display: grid;
  grid-template-columns: minmax(0, 300px) 1fr;
  gap: clamp(24px, 4vw, 44px);
  align-items: center;
}

.phone-wrap { display: flex; justify-content: center; }
.phone {
  position: relative;
  width: 100%;
  max-width: 288px;
  aspect-ratio: 9 / 19.5;
  background: #000;
  border-radius: 34px;
  border: 1px solid var(--line);
  padding: 10px;
  box-shadow: var(--shadow), 0 0 0 6px #05060a;
}
.phone-notch {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 92px;
  height: 22px;
  background: #05060a;
  border-radius: 999px;
  z-index: 2;
}
.phone-video {
  width: 100%;
  height: 100%;
  border-radius: 26px;
  background: #05060a;
  object-fit: cover;
  display: block;
}

.done-side { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.done-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.10);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  padding: 6px 12px;
  border-radius: 999px;
}
.done-title {
  margin: 0;
  font-size: clamp(22px, 3.4vw, 30px);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.narration {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
}
.narration-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.narration-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}
.narration-src {
  font-size: 11px;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
}
.narration-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  /* 한글은 어절 유지, 긴 URL 등만 강제로 끊음 */
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.done-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 12px;
  padding: 12px 20px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px -10px rgba(var(--accent-rgb), 0.6);
}
.btn-primary:hover { background: var(--accent-deep); }
.btn-ghost {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--text-faint); background: var(--panel); }

/* ---------- 푸터 ---------- */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-faint);
}

/* ---------- 반응형 ---------- */
@media (max-width: 720px) {
  .done-grid { grid-template-columns: 1fr; }
  .phone { max-width: 240px; }
  .done-side { align-items: center; text-align: center; }
  .narration-text { text-align: left; }
  .done-actions { justify-content: center; }
  .done-actions .btn { flex: 1 1 auto; }
  .steps::before { left: 12.5%; right: 12.5%; }
}

@media (max-width: 420px) {
  .step-name { font-size: 11px; }
  .voice-field { flex-direction: row; }
}

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

/* ============ 사이트 바로가기 독 (우측 고정) ============ */
.site-dock {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.site-dock-item {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-dim);
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.8);
  text-decoration: none;
  transition: transform .18s ease, color .18s ease, border-color .18s ease;
}
.site-dock-item:hover,
.site-dock-item:focus-visible { transform: translateX(-3px); }
.site-dock-item[data-site="cheonmyeong"]:hover,
.site-dock-item[data-site="cheonmyeong"]:focus-visible { color: var(--accent-2); border-color: var(--accent-2); }
.site-dock-item[data-site="simte"]:hover,
.site-dock-item[data-site="simte"]:focus-visible { color: var(--accent); border-color: var(--accent); }

.site-dock-label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(4px);
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.site-dock-item:hover .site-dock-label,
.site-dock-item:focus-visible .site-dock-label { opacity: 1; transform: translateY(-50%) translateX(0); }

@media (max-width: 640px) {
  .site-dock { right: 8px; gap: 8px; }
  .site-dock-item { width: 40px; height: 40px; }
  .site-dock-label { display: none; }
}

/* ============================================================
   리소 워크숍 마감 — 랜딩(pluver.site)과 톤 통일
   ============================================================ */

/* 인쇄 그레인 */
body::after {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: 999;
  pointer-events: none;
  opacity: var(--grain-op);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 헤드라인은 디스플레이 서체로 */
.upload-head h1,
.done-title,
.brand-text strong {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -.035em;
}
.brand-text strong { font-size: 17px; }

/* 남은 그라데이션 걷어내기 — 리소는 평면 인쇄다 */
.brand-mark {
  background: var(--panel-2);
  border-radius: var(--radius-sm);
}
.drop-icon {
  background: var(--panel-2);
  border-radius: var(--radius);
}
.progress-fill { background: var(--accent); box-shadow: none; }

/* 알약 모양 → 각지게 */
.health,
.voice-field,
.voice-field select,
.file-chip,
.done-badge { border-radius: var(--radius-sm); }
.btn { border-radius: var(--radius-sm); }

/* 영문·숫자 라벨은 모노 (한글엔 쓰지 말 것 — 글리프 없음) */
.progress-pct { font-family: var(--mono); font-weight: 700; letter-spacing: .04em; }

/* 배경 광원 제거 — 리소는 평면 인쇄다. 질감은 그레인이 담당한다 */
.aurora { display: none; }

/* 영문 제품명 옆 한글 이름 — 디스플레이 서체는 영문에만 */
.brand-ko {
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -.01em;
  color: var(--text-faint);
  margin-left: .2em;
  white-space: nowrap;
}

/* 사이트 독 — 우하단 고정, 아이콘은 각 사이트 고유색을 유지한다 */
.site-dock {
  right: 18px;
  bottom: 18px;
  top: auto;
  transform: none;
}
.site-dock-item {
  border-radius: 10px;
  transition: transform .28s cubic-bezier(.16,1,.3,1), border-color .28s cubic-bezier(.16,1,.3,1);
}
.site-dock-item:hover,
.site-dock-item:focus-visible {
  transform: translateY(-3px);
  border-color: currentColor;
}
.site-dock-item svg { display: block; }
.site-dock-label {
  font-family: var(--font);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: -.005em;
  border-radius: 6px;
  text-transform: none;
}
@media (max-width: 620px) {
  .site-dock { right: 12px; bottom: 12px; }
  .site-dock-item { width: 42px; height: 42px; }
}

/* 우하단 독이 푸터 문구를 가리지 않도록 */
@media (max-width: 620px) {
  .footer { padding-right: 58px; padding-left: 58px; }
}

/* 상단바 계정 표시 — health 배지 왼쪽에 놓인다 */
.topbar .app-account { margin-left: auto; margin-right: 12px; }
