/* 산책 — 공통 스타일 + 방문자 화면 */

:root {
  --bg: #f4efe6;
  --bg-soft: #f9f4ea;
  --card: #fbf8f2;
  --field: #f6f1e7;
  --sand: #ebe3d6;
  --brown: #76573f;
  --brown-deep: #654932;
  --olive: #4e5643;
  --text: #352c25;
  --muted: #81776e;
  --line: #ded5c8;
  --clay: #9b5a45;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(53, 44, 37, 0.04), 0 12px 28px -18px rgba(53, 44, 37, 0.22);

  --serif: 'Noto Serif KR', 'Nanum Myeongjo', 'Apple SD Gothic Neo', 'Malgun Gothic', serif;
  --sans: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

/* 창이 열려 있는 동안 뒤쪽 화면이 움직이지 않게 잡아둡니다 */
html.modal-open,
html.modal-open body {
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  background: radial-gradient(1100px 480px at 50% -8%, var(--bg-soft) 0%, rgba(249, 244, 234, 0) 65%) no-repeat, var(--bg);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 글꼴과 첫 사진이 준비될 때까지 잠깐 숨겼다가 한 번에 보여줘요 (글자가 이리저리 밀리는 것을 막아요) */
body {
  transition: opacity 0.5s ease;
}

html.fonts-wait body {
  opacity: 0;
  animation: reveal-fallback 0.01s 2.8s forwards;
}

@keyframes reveal-fallback {
  to {
    opacity: 1;
  }
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--olive);
  outline-offset: 3px;
  border-radius: 6px;
}

svg.ico {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  transition: color 0.2s, background-color 0.2s;
}

.icon-btn:hover {
  color: var(--brown);
  background: rgba(118, 87, 63, 0.07);
}

.icon-btn:disabled {
  opacity: 0.28;
  cursor: default;
  background: transparent;
  color: var(--muted);
}

/* ---------- 상단 ---------- */

.site-header {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 0;
}

.header-inner {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
}

.brand {
  justify-self: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 27px;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  text-decoration: none;
  color: var(--text);
}

.menu-wrap {
  position: relative;
  justify-self: end;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: 48px;
  z-index: 20;
  min-width: 158px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.menu-panel a {
  display: block;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 10px;
}

.menu-panel a:hover {
  background: var(--sand);
  color: var(--text);
}

.tagline {
  margin: 4px 0 0;
  text-align: center;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
  padding: 0 24px;
}

/* ---------- 본문 ---------- */

.page {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 18px calc(env(safe-area-inset-bottom, 0px) + 64px);
}

.status-msg {
  padding: 96px 12px;
  text-align: center;
  font-family: var(--serif);
  font-weight: 300;
  color: var(--muted);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 14px;
  color: var(--muted);
}

.pager-text {
  min-width: 84px;
  text-align: center;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
}

.stage {
  transition: opacity 0.28s ease;
}

.stage.is-swapping {
  opacity: 0;
}

/* 사진 바꿔 끼울 때의 높이 변화는 .stage 가 흐려진 동안 일어나서 눈에 보이지 않아요 */
.photo-frame {
  position: relative;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 240px;
  background: var(--sand);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  touch-action: pan-y;
}

.photo-frame img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
}

.photo-frame.is-broken::after {
  content: '사진을 불러오지 못했어요.';
  position: absolute;
  font-size: 14px;
  color: var(--muted);
}

.caption {
  margin: 16px 8px 0;
  text-align: center;
}

.caption-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.6;
}

.caption-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.caption-meta span + span {
  position: relative;
}

.caption-meta span + span::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  width: 1px;
  height: 11px;
  transform: translateY(-50%);
  background: var(--line);
}

.story-row {
  display: flex;
  justify-content: center;
  margin: 22px 0 6px;
}

.story-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px 11px 18px;
  font-size: 14.5px;
  color: var(--olive);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.25s, background-color 0.25s, transform 0.25s;
}

.story-btn:hover {
  border-color: var(--olive);
  background: #f7f2e8;
}

.story-btn:active {
  transform: scale(0.985);
}

.story-btn .ico {
  width: 16px;
  height: 16px;
}

/* ---------- 감상 남기기 ---------- */

.write,
.done {
  margin-top: 30px;
  padding: 30px 22px 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.question {
  margin: 0;
  text-align: center;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.6;
}

.helper {
  margin: 12px 0 20px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--muted);
}

.helper span {
  display: block;
}

.field-wrap {
  position: relative;
}

.story-input {
  display: block;
  width: 100%;
  min-height: 190px;
  padding: 18px 18px 34px;
  resize: vertical;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.85;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.story-input::placeholder {
  color: #a59b90;
}

.story-input:focus {
  outline: none;
  border-color: var(--brown);
  box-shadow: 0 0 0 4px rgba(118, 87, 63, 0.12);
}

.counter {
  position: absolute;
  right: 16px;
  bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.form-msg.is-info {
  color: var(--muted);
}

.form-msg {
  min-height: 1.7em;
  line-height: 1.7;
  margin: 10px 4px 0;
  font-size: 13.5px;
  color: var(--clay);
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 18px;
  border: 1px solid transparent;
  transition: background-color 0.25s, border-color 0.25s, opacity 0.25s, transform 0.2s;
}

.btn:active {
  transform: scale(0.99);
}

.btn:disabled,
.btn.is-busy {
  opacity: 0.55;
  cursor: default;
}

.btn.is-busy {
  pointer-events: none;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--brown-deep);
}

.btn-quiet {
  background: transparent;
  color: var(--brown);
  border-color: var(--line);
}

.btn-quiet:hover:not(:disabled) {
  border-color: var(--brown);
  background: rgba(118, 87, 63, 0.05);
}

.btn-block {
  display: flex;
  width: 100%;
  margin-top: 6px;
}

.lock-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 22px 0 0;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--muted);
}

.lock-note .ico {
  width: 17px;
  height: 17px;
  margin-bottom: 2px;
}

.lock-note span {
  display: block;
}

/* ---------- 제출 완료 ---------- */

.done {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 44px 24px 34px;
  animation: settle 1.1s ease both;
}

.done-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.6;
}

.done-text {
  margin: 14px 0 28px;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.95;
  color: var(--muted);
}

.done-text span {
  display: block;
}

@keyframes settle {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- 사진작가의 이야기 (편지) ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(53, 44, 37, 0.42);
  opacity: 0;
  transition: opacity 0.45s ease;
}

.modal.open .modal-backdrop {
  opacity: 1;
}

.letter {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - 36px);
  display: flex;
  flex-direction: column;
  padding: 40px 26px 26px;
  background: linear-gradient(180deg, #fcf9f3 0%, #f8f2e7 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 30px 60px -28px rgba(53, 44, 37, 0.5);
  opacity: 0;
  transform: translateY(28px) scale(0.96) rotate(-0.6deg);
  transform-origin: 50% 100%;
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.75, 0.2, 1);
}

.letter::before {
  content: '';
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(118, 87, 63, 0.14);
  border-radius: 17px;
  pointer-events: none;
}

.modal.open .letter {
  opacity: 1;
  transform: none;
}

.letter:focus {
  outline: none;
}

.letter-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.letter-title {
  margin: 0;
  text-align: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.08em;
}

.letter-meta {
  margin: 6px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.letter-scroll {
  flex: 1 1 auto;
  min-height: 0;
  margin: 22px -8px 0;
  padding: 0 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.letter-body p {
  margin: 0 0 1.5em;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 16px;
  line-height: 2.05;
  white-space: pre-line;
  opacity: 0;
  animation: unfold 0.9s ease forwards;
}

.letter-sign {
  margin: 4px 0 0;
  text-align: right;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--brown);
  opacity: 0;
  animation: unfold 0.9s ease forwards;
}

.letter-foot {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.letter-foot .btn {
  padding: 10px 24px;
  font-size: 14.5px;
  border-radius: 999px;
}

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

/* ---------- 큰 화면 ---------- */

@media (min-width: 720px) {
  .site-header {
    padding-top: 26px;
  }

  .brand {
    font-size: 30px;
  }

  .page {
    padding-top: 26px;
  }

  .write,
  .done {
    padding: 40px 48px 34px;
  }

  .question {
    font-size: 23px;
  }

  .story-input {
    min-height: 210px;
  }

  .btn-block {
    width: auto;
    min-width: 220px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ---------- 메인(표지) 화면 ---------- */

/* 화면을 바꿀 때: 잠깐 흐려졌다가 새 화면이 또렷하게 나타나요 */
html.turning body {
  opacity: 0;
  transition-duration: 0.22s;
}

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  color: var(--card);
  background: linear-gradient(180deg, #f1dfc4 0%, #e4c29b 46%, #b48a66 100%);
}

.hero-img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 55%;
}

.hero.no-photo .hero-img {
  display: none;
}

/* 어떤 사진이 와도 글자가 잘 보이도록, 위는 따뜻하게 밝히고 아래는 살짝 어둡게 덮어요 */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(250, 236, 214, 0.68) 0%,
    rgba(250, 236, 214, 0.36) 30%,
    rgba(53, 44, 37, 0) 52%,
    rgba(53, 44, 37, 0.1) 66%,
    rgba(43, 34, 28, 0.62) 100%
  );
}

.hero-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 22px 0;
}

.hero-nav a {
  font-size: 14px;
  color: #5a4130;
  text-decoration: none;
}

.hero-nav a:hover {
  color: var(--text);
}

.hero-nav .pill {
  padding: 8px 17px;
  border: 1px solid rgba(101, 73, 50, 0.55);
  border-radius: 999px;
  background: rgba(251, 248, 242, 0.2);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.hero-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(18px, 7vh, 72px) 24px 0;
  text-align: center;
}

.hero-leaf {
  width: 34px;
  height: 40px;
  fill: none;
  stroke: #654932;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-title {
  margin: 6px 0 0;
  font-family: 'Nanum Pen Script', var(--serif);
  font-weight: 400;
  font-size: clamp(92px, 27vw, 136px);
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: #5b3f2b;
}

.hero-sub {
  margin: 16px 0 0;
  font-family: var(--serif);
  font-size: clamp(17px, 4.6vw, 20px);
  line-height: 1.85;
  color: #43352b;
}

.hero-rule {
  display: block;
  width: 28px;
  height: 1px;
  margin-top: 22px;
  background: rgba(67, 53, 43, 0.55);
}

.hero-foot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px calc(env(safe-area-inset-bottom, 0px) + 66px);
  text-align: center;
}

.hero-quote {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.9;
  text-shadow: 0 1px 14px rgba(43, 34, 28, 0.5);
}

.enter-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px;
  font-size: 16px;
  color: var(--card);
  background: rgba(118, 87, 63, 0.9);
  border: 1px solid rgba(251, 248, 242, 0.38);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 12px 28px -14px rgba(43, 34, 28, 0.6);
  transition: background-color 0.25s, transform 0.2s;
}

.enter-btn:hover {
  background: rgba(101, 73, 50, 0.96);
}

.enter-btn:active {
  transform: scale(0.985);
}

.enter-btn .ico {
  width: 18px;
  height: 18px;
}

.hero-count {
  position: absolute;
  right: 24px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: rgba(251, 248, 242, 0.92);
  text-shadow: 0 1px 8px rgba(43, 34, 28, 0.5);
}

.hero-count i {
  display: block;
  width: 38px;
  height: 1px;
  background: rgba(251, 248, 242, 0.7);
}

/* 이렇게 이용해요 */

.about {
  max-width: 1040px;
  margin: 0 auto;
  padding: 30px 18px calc(env(safe-area-inset-bottom, 0px) + 60px);
  scroll-margin-top: 8px;
}

.steps {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  background: rgba(251, 248, 242, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.step-ico {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  color: var(--brown);
  background: var(--sand);
  border-radius: 18px;
}

.step-ico .ico {
  width: 28px;
  height: 28px;
  stroke-width: 1.3;
}

.step-no {
  margin: 0;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.3;
  color: var(--muted);
}

.step-title {
  margin: 1px 0 4px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.55;
}

.step-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
  color: var(--muted);
}

.about-more {
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

.about-more .btn {
  padding: 12px 28px;
  font-size: 15px;
  border-radius: 999px;
}

@media (min-width: 900px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }

  .step {
    align-items: flex-start;
  }

  .hero-nav {
    padding-right: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }

  html.fonts-wait body {
    animation-delay: 2.8s !important;
  }
}
