/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #F4F1EC;
  --bg-hover: #ECE7E1;
  --text-primary: #1F1F1F;
  --text-secondary: #777777;
  --text-muted: #AAAAAA;
  --border: #D8D3CC;
  --circle: #D8D3CC;
  --circle-hover: #C8C3BC;
  --font-en: Arial, sans-serif;
  --font-kr: "Noto Sans KR", sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --fade-duration: 0.8s;
  --radius: 4px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-en);
  font-weight: 400;
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Header & Footer ── */
.site-header,
.site-footer {
  position: relative;
  z-index: 10;
  text-align: center;
}

.site-header {
  padding: 3rem 2rem 2rem;
}

.site-footer {
  padding: 3rem 2rem 3.5rem;
}

.brand {
  display: block;
  background: transparent;
  border: none;
  line-height: 0;
  text-decoration: none;
  transition: opacity 0.5s var(--ease);
}

.brand:hover {
  opacity: 0.55;
}

.brand-logo {
  display: block;
  margin: 0 auto;
  width: min(520px, 88vw);
  height: auto;
  background: transparent;
  border: none;
  object-fit: contain;
}

.archive-subtitle {
  margin: 1.75rem auto 0;
  max-width: 360px;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.7;
  color: #777777;
  letter-spacing: 0.01em;
}

.footer-line {
  display: block;
  font-size: 0.625rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.footer-kr {
  font-family: var(--font-kr);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
  margin-top: 0.35rem;
  font-size: 0.6875rem;
}

/* ── Main App Container ── */
.app {
  position: relative;
  z-index: 5;
  max-width: 440px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
  min-height: calc(100dvh - 200px);
}

/* ── View Transitions ── */
.view {
  opacity: 0;
  transform: translateY(8px);
  animation: fadeIn var(--fade-duration) var(--ease) forwards;
}

.view.exiting {
  animation: fadeOut 0.45s var(--ease) forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* ── Typography ── */
.section-title {
  font-size: 0.625rem;
  font-weight: 400;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 3rem;
}

.section-subtitle {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-subtitle-en {
  display: block;
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.section-subtitle .kr {
  margin-bottom: 0;
}

.text-block {
  text-align: center;
  margin-bottom: 3.5rem;
}

.text-block p {
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.85;
  color: var(--text-primary);
  margin-bottom: 0.1rem;
}

.kr {
  display: block;
  font-family: var(--font-kr);
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
  line-height: 1.75;
}

.text-block .kr:last-child {
  margin-bottom: 0;
}

/* ── Home Intro Blocks ── */
.intro-blocks {
  margin-bottom: 3.5rem;
}

.intro-block {
  text-align: center;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  animation: introReveal 1s var(--ease) forwards;
}

.intro-block:nth-child(1) {
  animation-delay: 0.4s;
}

.intro-block:nth-child(2) {
  animation-delay: 1.8s;
}

.intro-block:nth-child(3) {
  animation-delay: 4.6s;
}

.intro-block p {
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.85;
  color: var(--text-primary);
  margin-bottom: 0.1rem;
}

.intro-block .kr {
  margin-bottom: 2rem;
}

.intro-block:last-child .kr {
  margin-bottom: 0;
}

@keyframes introReveal {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    max-height: 220px;
    transform: translateY(0);
  }
}

/* ── Rabbit Image (Home) ── */
.rabbit-image {
  display: block;
  margin: 0 auto;
  width: min(260px, 68vw);
  height: auto;
  object-fit: contain;
  background: transparent;
  border: none;
}

/* ── Rabbit Silhouette ── */
.rabbit-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 3rem 0 3.5rem;
}

.rabbit-silhouette {
  position: relative;
  width: 160px;
  height: 200px;
}

.rabbit-body {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 88px;
  height: 78px;
  background: transparent;
  border-radius: 50% 50% 45% 45%;
  border: 1px solid var(--border);
}

.rabbit-head {
  position: absolute;
  bottom: 62px;
  left: 50%;
  transform: translateX(-50%);
  width: 62px;
  height: 58px;
  background: transparent;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.rabbit-ear {
  position: absolute;
  width: 24px;
  height: 72px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50% 50% 40% 40%;
  bottom: 104px;
}

.rabbit-ear.left {
  left: 36px;
  transform: rotate(-6deg);
}

.rabbit-ear.right {
  right: 36px;
  transform: rotate(6deg);
}

/* ── Placeholder Circles ── */
.circle {
  display: block;
  border-radius: 50%;
  background: var(--circle);
  border: none;
  transition: background 0.5s var(--ease), opacity 0.5s var(--ease);
}

.circle-sm {
  width: 14px;
  height: 14px;
}

.circle-md {
  width: 44px;
  height: 44px;
}

.circle-lg {
  width: 112px;
  height: 112px;
}

.circle-xl {
  width: 140px;
  height: 140px;
}

.circle-centered {
  margin: 0 auto 2.5rem;
}

button.circle,
a.circle {
  cursor: pointer;
  padding: 0;
  appearance: none;
}

button.circle:hover,
a.circle:hover,
.circle.interactive:hover {
  background: var(--circle-hover);
}

/* Ear button positions */
.ear-button {
  position: absolute;
  z-index: 2;
}

.ear-button.bl {
  bottom: 152px;
  left: 40px;
}

.ear-button.tl {
  bottom: 170px;
  left: 44px;
}

.ear-button.br {
  bottom: 152px;
  right: 40px;
}

.ear-button.tr {
  bottom: 170px;
  right: 44px;
}

/* ── Buttons Grid (Browse) ── */
.buttons-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.75rem;
  max-width: 300px;
  margin: 3rem auto;
}

.buttons-grid .circle {
  width: 48px;
  height: 48px;
  margin: 0 auto;
}

/* ── Personality Buttons Row ── */
.personality-buttons {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 3rem 0;
}

.personality-buttons .circle {
  width: 56px;
  height: 56px;
}

/* ── Action Buttons ── */
.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 3rem;
}

.btn {
  display: block;
  width: 100%;
  max-width: 300px;
  padding: 1.05rem 1.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-en);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-align: center;
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease);
}

.btn:hover {
  background: var(--bg-hover);
}

.btn .kr {
  margin-top: 0.4rem;
  margin-bottom: 0;
  font-size: 0.8125rem;
}

.btn-primary {
  /* Same as default — no emphasis needed in archive style */
}

.btn-back {
  margin-top: 4rem;
  max-width: 180px;
  padding: 0.85rem 1.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-back:hover {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-back .kr {
  font-size: 0.75rem;
  letter-spacing: 0;
}

/* ── Form ── */
.form-group {
  margin: 3rem 0;
  text-align: center;
}

.form-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.form-label .kr {
  margin-top: 0.35rem;
  margin-bottom: 0;
  font-size: 0.8125rem;
  letter-spacing: 0;
  text-transform: none;
}

.form-input {
  width: 100%;
  max-width: 260px;
  padding: 0.9rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  color: var(--text-primary);
  font-family: var(--font-en);
  font-size: 1rem;
  font-weight: 400;
  text-align: center;
  outline: none;
  transition: border-color 0.5s var(--ease);
}

.form-input:focus {
  border-bottom-color: var(--text-secondary);
}

.form-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Rabbit Profile ── */
.rabbit-name {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  margin-bottom: 2rem;
  animation: fadeIn var(--fade-duration) var(--ease) forwards;
}

/* ── Adopted Rabbit Result ── */
.rabbit-result {
  margin-top: 2.5rem;
}

.rabbit-result .rabbit-display {
  margin: 0 0 2rem;
}

.rabbit-result-name {
  text-align: center;
  margin-bottom: 2rem;
}

.rabbit-name-en {
  display: block;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.rabbit-name-kr {
  display: block;
  font-family: var(--font-kr);
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.greeting-note {
  max-width: 420px;
  margin: 0 auto 2.5rem;
  padding: 2rem 1.75rem;
  border: 1px solid #D8D3CC;
  background: rgba(255, 255, 255, 0.18);
  text-align: center;
  opacity: 0;
  animation: greetingFadeIn 1s var(--ease) 0.3s forwards;
}

.greeting-en {
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.85;
  color: var(--text-primary);
  white-space: pre-line;
  margin-bottom: 1.75rem;
}

.greeting-kr {
  font-family: var(--font-kr);
  font-weight: 400;
  font-size: 0.8125rem;
  line-height: 1.85;
  color: var(--text-secondary);
  white-space: pre-line;
  margin-bottom: 0;
}

.rabbit-result .actions {
  margin-top: 0;
}

@keyframes greetingFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Trait Detail ── */
.trait-detail {
  text-align: center;
  padding: 1.5rem 0;
}

.trait-name {
  font-size: 1.125rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  margin-bottom: 0.15rem;
}

.trait-name-kr {
  font-family: var(--font-kr);
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
}

.trait-description {
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.85;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

.trait-description-kr {
  font-family: var(--font-kr);
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.75;
}

.divider {
  width: 24px;
  height: 1px;
  background: var(--border);
  margin: 0 auto 2.5rem;
}

.self-intro-label {
  font-size: 0.625rem;
  font-weight: 400;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.self-intro {
  font-size: 0.875rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.9;
  color: var(--text-primary);
  max-width: 360px;
  margin: 0 auto 0.15rem;
}

.self-intro-kr {
  font-family: var(--font-kr);
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ── Error / Not Found ── */
.notice {
  text-align: center;
  padding: 2rem 1.5rem;
  margin: 2rem 0;
}

.notice p {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.notice .kr {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.notice-hint {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* ── Staggered Animation ── */
.stagger > * {
  opacity: 0;
  animation: fadeIn 0.7s var(--ease) forwards;
}

.stagger > *:nth-child(1) { animation-delay: 0.08s; }
.stagger > *:nth-child(2) { animation-delay: 0.16s; }
.stagger > *:nth-child(3) { animation-delay: 0.24s; }
.stagger > *:nth-child(4) { animation-delay: 0.32s; }
.stagger > *:nth-child(5) { animation-delay: 0.4s; }
.stagger > *:nth-child(6) { animation-delay: 0.48s; }
.stagger > *:nth-child(7) { animation-delay: 0.56s; }
.stagger > *:nth-child(8) { animation-delay: 0.64s; }

/* ── Gallery View ── */
.app.app--gallery {
  max-width: none;
  width: 100%;
  padding: 0 1.5rem 2rem;
}

.gallery-view {
  width: 100%;
}

.rabbit-gallery {
  position: relative;
  width: 100%;
  height: clamp(420px, calc(100dvh - 280px), 720px);
  margin: 0 auto 1.5rem;
  overflow: hidden;
}

.gallery-rabbit {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  will-change: transform;
  transition: opacity 0.5s var(--ease);
}

.gallery-rabbit:hover {
  opacity: 0.82;
}

.gallery-rabbit img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.gallery-back {
  text-align: center;
  position: relative;
  z-index: 2;
}

.gallery-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  z-index: 2;
  margin-bottom: 1.25rem;
}

.gallery-controls .btn-back {
  margin-top: 0;
}

.btn-neighborhood {
  max-width: 280px;
}

.gallery-grass {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 0.25rem;
  color: #C8C3BC;
  pointer-events: none;
  user-select: none;
}

.gallery-grass-svg {
  width: min(280px, 72vw);
  height: auto;
  opacity: 0.85;
}

.gallery-back .btn-back {
  margin-top: 0;
}

/* ── Rabbit Popup ── */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(244, 241, 236, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s var(--ease), visibility 0.45s var(--ease);
}

.popup-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.popup-overlay.is-closing {
  opacity: 0;
  visibility: hidden;
}

.rabbit-popup {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - 3rem);
  overflow-y: auto;
  padding: 2.25rem 1.75rem 2rem;
  border: 1px solid #D8D3CC;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 8px 32px rgba(31, 31, 31, 0.06);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}

.popup-overlay.is-open .rabbit-popup {
  opacity: 1;
  transform: translateY(0);
}

.popup-overlay.is-closing .rabbit-popup {
  opacity: 0;
  transform: translateY(6px);
}

.popup-close {
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-en);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.4s var(--ease), opacity 0.4s var(--ease);
}

.popup-close:hover {
  color: var(--text-primary);
  opacity: 0.7;
}

.popup-rabbit-image {
  margin-bottom: 1.5rem;
}

.popup-rabbit-image .rabbit-image {
  width: min(160px, 42vw);
}

.popup-names {
  margin-bottom: 1.5rem;
}

.popup-greeting {
  margin-bottom: 0;
  animation: none;
  opacity: 1;
  padding: 1.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.15);
}

/* ── Responsive ── */
@media (max-width: 400px) {
  .site-header {
    padding-top: 2.5rem;
  }

  .app:not(.app--gallery) {
    padding: 0 1.5rem 3rem;
  }

  .app.app--gallery {
    padding: 0 1rem 2rem;
  }

  .rabbit-silhouette {
    width: 140px;
    height: 175px;
  }

  .rabbit-ear.left { left: 28px; }
  .rabbit-ear.right { right: 28px; }

  .ear-button.bl { left: 32px; bottom: 132px; }
  .ear-button.tl { left: 36px; bottom: 150px; }
  .ear-button.br { right: 32px; bottom: 132px; }
  .ear-button.tr { right: 36px; bottom: 150px; }

  .buttons-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}
