/* ============================================
   ANNIVERSARY WEBSITE STYLES
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Nanum+Myeongjo:wght@400;700;800&family=Noto+Sans+KR:wght@400;500;700&family=Space+Mono:wght@400;700&family=Jua&family=Gowun+Dodum&family=Do+Hyeon&family=Nanum+Gothic:wght@400;700&family=Black+Han+Sans&family=Nanum+Pen+Script&family=Gaegu:wght@400;700&family=Song+Myung&family=Gowun+Batang:wght@400;700&display=swap');

/* ============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */

:root {
  /* Default: 레트로 블루 */
  --bg: #CDD7D2;
  --card: #E7EEE8;
  --ink: #23302E;
  --rust: #C56A3A;
  --blue: #35637A;
  --muted: #7B8987;
  --fill: #D7DFDA;
  --text: #2B3836;
  --text2: #47544F;
  --letterbox: #14110C;

  /* Default fonts: 클래식 */
  --head-font: 'Nanum Myeongjo', serif;
  --body-font: 'Noto Sans KR', sans-serif;
  --eng: 'Space Mono', monospace;

  /* Shadows */
  --shadow-card: 6px 7px 0 rgba(44, 40, 34, 0.12);
  --shadow-card-heavy: 6px 7px 0 rgba(44, 40, 34, 0.14);
  --shadow-frame: 10px 12px 0 rgba(44, 40, 34, 0.16);
  --shadow-stack: 5px 6px 0 rgba(44, 40, 34, 0.1);
}

/* ============================================
   COLOR SCHEMES
   ============================================ */

[data-color-scheme="필름 세피아"] {
  --bg: #D9D0C3;
  --card: #EDE6DA;
  --ink: #3D3428;
  --rust: #B85C3A;
  --blue: #6B7B6A;
  --muted: #8A8278;
  --fill: #E0D9CD;
  --text: #3D3428;
  --text2: #5C5347;
}

[data-color-scheme="빈티지 올리브"] {
  --bg: #C9CCBF;
  --card: #E2E5D8;
  --ink: #2E3325;
  --rust: #A67C52;
  --blue: #5C6B5C;
  --muted: #7A8072;
  --fill: #D4D7CA;
  --text: #353A2D;
  --text2: #4F5446;
}

[data-color-scheme="체리 코크"] {
  --bg: #D4CBCB;
  --card: #EBE4E4;
  --ink: #2E2323;
  --rust: #A63D3D;
  --blue: #6B5A5A;
  --muted: #8A7D7D;
  --fill: #DDD6D6;
  --text: #3A2E2E;
  --text2: #5C4F4F;
}

[data-color-scheme="머스타드"] {
  --bg: #D9D4C3;
  --card: #EDE9DA;
  --ink: #33301F;
  --rust: #C49B2A;
  --blue: #6B6850;
  --muted: #8A8672;
  --fill: #E2DDCE;
  --text: #3A371F;
  --text2: #5C5942;
}

[data-color-scheme="미드나잇 필름"] {
  --bg: #1E2328;
  --card: #2A3038;
  --ink: #ECE2CD;
  --rust: #D4845A;
  --blue: #5A8AAA;
  --muted: #6B7580;
  --fill: #343A42;
  --text: #E0D6C2;
  --text2: #B8AEA0;
}

/* ============================================
   FONT THEMES
   ============================================ */

[data-font-theme="귀여운"] {
  --head-font: 'Jua', sans-serif;
  --body-font: 'Gowun Dodum', sans-serif;
}

[data-font-theme="모던"] {
  --head-font: 'Do Hyeon', sans-serif;
  --body-font: 'Nanum Gothic', sans-serif;
}

[data-font-theme="강렬한"] {
  --head-font: 'Black Han Sans', sans-serif;
  --body-font: 'Nanum Gothic', sans-serif;
}

[data-font-theme="손글씨"] {
  --head-font: 'Nanum Pen Script', cursive;
  --body-font: 'Gaegu', cursive;
}

[data-font-theme="우아한"] {
  --head-font: 'Song Myung', serif;
  --body-font: 'Gowun Batang', serif;
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html {
  overflow-x: hidden;
}

body {
  font-family: var(--body-font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   FILM GRAIN OVERLAY
   ============================================ */

.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.06;
  mix-blend-mode: multiply;
}

.grain-overlay svg {
  width: 100%;
  height: 100%;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.rise-in {
  animation: riseIn 1s ease forwards;
}

.soft-in {
  animation: softIn 0.5s ease forwards;
}

/* ============================================
   LAYOUT
   ============================================ */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.section {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  padding: 14px 32px 40px;
}

.section.active {
  display: flex;
}

/* ============================================
   LOGIN GATE
   ============================================ */

.login-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-section.hidden {
  display: none;
}

.login-box {
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.login-eyebrow {
  font-family: var(--eng);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--rust);
  margin-bottom: 16px;
}

.login-title {
  font-family: var(--head-font);
  font-size: 56px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 12px;
}

.login-subtitle {
  font-family: var(--eng);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 40px;
}

.password-frame {
  border: 1px solid var(--ink);
  padding: 7px;
  margin-bottom: 20px;
}

.password-inner {
  border: 1px solid var(--ink);
  padding: 4px;
}

.password-input {
  width: 100%;
  padding: 14px 18px;
  font-family: var(--eng);
  font-size: 14px;
  letter-spacing: 0.1em;
  background: var(--card);
  border: none;
  outline: none;
  text-align: center;
  color: var(--ink);
}

.password-input::placeholder {
  color: var(--muted);
}

.login-button {
  font-family: var(--eng);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 14px 32px;
  background: var(--ink);
  color: var(--card);
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: all 0.2s;
}

.login-button:hover {
  background: var(--rust);
  border-color: var(--rust);
}

.login-error {
  font-family: var(--eng);
  font-size: 12px;
  color: var(--rust);
  margin-top: 16px;
  opacity: 0;
  transition: opacity 0.2s;
}

.login-error.visible {
  opacity: 1;
}

/* ============================================
   SECTION HEADERS
   ============================================ */

.section-header {
  text-align: center;
  padding: 40px 0 30px;
}

.couple-names {
  font-family: var(--head-font);
  font-size: clamp(42px, 7vw, 76px);
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 20px;
}

.section-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.section-rule::before,
.section-rule::after {
  content: '';
  width: 60px;
  height: 1px;
  background: var(--ink);
}

.section-label {
  font-family: var(--eng);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.section-title {
  font-family: var(--head-font);
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 800;
  color: var(--ink);
  margin-top: 24px;
}

/* ============================================
   FILM SECTION
   ============================================ */

.film-section {
  align-items: center;
  gap: 22px;
}

.film-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  width: 100%;
}

.film-frame {
  background: var(--card);
  border: 1px solid var(--ink);
  padding: 12px 12px 40px;
  box-shadow: var(--shadow-frame);
  max-width: 900px;
  width: 100%;
  position: relative;
}

.video-letterbox {
  background: var(--letterbox);
  aspect-ratio: 16 / 9;
  width: 100%;
}

.video-letterbox video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.film-stamps {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.film-stamp {
  font-family: var(--eng);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.film-stamp.rec {
  color: var(--rust);
}

.film-caption {
  font-family: var(--eng);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-align: center;
}

/* ============================================
   NAVIGATION
   ============================================ */

.nav-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px 0 60px;
  margin-top: auto;
}

.nav-button {
  width: 52px;
  height: 52px;
  background: var(--card);
  border: 1px solid var(--ink);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-button:hover {
  background: var(--ink);
  color: var(--card);
}

.nav-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-label {
  font-family: var(--eng);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--muted);
}

/* ============================================
   NOTES SECTION
   ============================================ */

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  padding: 20px 0;
  flex: 1;
}

.note-card {
  background: var(--card);
  border: 1px solid var(--ink);
  padding: 30px 30px 26px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.note-number {
  font-family: var(--eng);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--rust);
}

.note-quote {
  font-family: var(--head-font);
  font-size: 40px;
  color: var(--blue);
  line-height: 1;
}

.note-message {
  font-size: 16px;
  line-height: 1.95;
  color: var(--text);
  flex: 1;
  margin-bottom: 20px;
}

.note-divider {
  height: 1px;
  background: var(--ink);
  margin-bottom: 16px;
}

.note-name {
  font-family: var(--head-font);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.note-role {
  font-family: var(--eng);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ============================================
   TIMELINE SECTION
   ============================================ */

.timeline-section {
  padding-bottom: 0;
}

.timeline-track {
  display: flex;
  gap: 30px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  padding: 20px 0;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) var(--fill);
}

.timeline-track::-webkit-scrollbar {
  height: 8px;
}

.timeline-track::-webkit-scrollbar-track {
  background: var(--fill);
}

.timeline-track::-webkit-scrollbar-thumb {
  background: var(--muted);
}

.timeline-card {
  flex: 0 0 330px;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
}

.tl-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.tl-year-badge {
  font-family: var(--eng);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: var(--blue);
  color: var(--card);
  padding: 6px 12px;
}

.tl-connector {
  flex: 1;
  height: 1px;
  background: var(--ink);
}

.tl-end-square {
  width: 10px;
  height: 10px;
  background: var(--rust);
}

/* Photo Pile */
.photo-pile {
  position: relative;
  height: 320px;
  cursor: pointer;
  margin-bottom: 20px;
}

.photo-pile.expanded {
  height: auto;
  cursor: default;
}

.photo-frame {
  background: var(--card);
  border: 1px solid var(--ink);
  padding: 10px 10px 34px;
  box-shadow: var(--shadow-card);
  position: relative;
}

.photo-pile:not(.expanded) .photo-frame.main {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  z-index: 3;
}

.photo-pile:not(.expanded) .photo-backing {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-stack);
}

.photo-pile:not(.expanded) .photo-backing.back-1 {
  transform: rotate(3deg);
  z-index: 1;
}

.photo-pile:not(.expanded) .photo-backing.back-2 {
  transform: rotate(-2.5deg);
  z-index: 2;
}

.photo-slot {
  width: 100%;
  height: 100%;
  background: var(--fill);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 180px;
}

.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-slot.empty {
  color: var(--muted);
  font-family: var(--eng);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.photo-stamps {
  position: absolute;
  bottom: 8px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.photo-stamp {
  font-family: var(--eng);
  font-size: 11px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.photo-stamp.year {
  color: var(--rust);
  font-size: 13px;
}

.photo-stamp.count {
  color: var(--muted);
}

/* Expanded pile */
.photo-pile.expanded .expanded-photos {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: softIn 0.3s ease;
  margin-top: 20px;
}

.photo-pile:not(.expanded) .expanded-photos {
  display: none;
}

.photo-pile.expanded .photo-frame.main .photo-slot {
  min-height: 230px;
}

.photo-pile.expanded .photo-frame.extra .photo-slot {
  min-height: 190px;
}

.photo-collapse-btn {
  display: none;
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-family: var(--eng);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s;
  padding: 0;
}

.photo-pile.expanded .photo-collapse-btn {
  display: block;
}

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

.close-pile-btn {
  font-family: var(--eng);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  background: var(--fill);
  border: 1px solid var(--ink);
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 12px;
}

.close-pile-btn:hover {
  background: var(--ink);
  color: var(--card);
}

/* Timeline body */
.tl-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tl-year-label {
  font-family: var(--eng);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--blue);
}

.tl-title {
  font-family: var(--head-font);
  font-size: 25px;
  font-weight: 700;
  color: var(--ink);
}

.tl-caption {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text2);
}

/* ============================================
   LETTER SECTION
   ============================================ */

.letter-section {
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.letter-frame {
  background: var(--card);
  border: 1px solid var(--ink);
  padding: clamp(38px, 6vw, 68px);
  box-shadow: var(--shadow-frame);
  max-width: 660px;
  width: 100%;
}

.letter-header {
  text-align: center;
  margin-bottom: 30px;
}

.letter-eyebrow {
  font-family: var(--eng);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--rust);
  margin-bottom: 12px;
}

.letter-divider {
  width: 52px;
  height: 2px;
  background: var(--ink);
  margin: 0 auto;
}

.letter-greeting {
  font-family: var(--head-font);
  font-size: clamp(27px, 4.5vw, 38px);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 30px;
}

.letter-body {
  font-size: 17px;
  line-height: 2.05;
  color: var(--text);
  white-space: pre-line;
  margin-bottom: 40px;
}

.letter-body p {
  margin-bottom: 22px;
}

.letter-body p:last-child {
  margin-bottom: 0;
}

.letter-signature {
  font-family: var(--head-font);
  font-size: 20px;
  color: var(--blue);
  text-align: right;
}

/* ============================================
   RESPONSIVE (Mobile: <= 760px)
   ============================================ */

/* ============================================
   LIGHTBOX
   ============================================ */

.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox-img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--eng);
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.lightbox-close:hover {
  opacity: 1;
}

.photo-slot img {
  cursor: pointer;
  transition: opacity 0.2s;
}

.photo-slot img:hover {
  opacity: 0.85;
}

/* ============================================
   RESPONSIVE (Mobile: <= 760px)
   ============================================ */

@media (max-width: 760px) {
  .section {
    padding: 14px 20px 30px;
  }

  .login-title {
    font-size: 42px;
  }

  .notes-grid {
    gap: 18px;
  }

  .note-card {
    padding: 24px 24px 20px;
  }

  /* Timeline: vertical stack on mobile */
  .timeline-track {
    flex-direction: column;
    overflow-x: visible;
    overflow-y: visible;
    gap: 36px;
  }

  .timeline-card {
    flex: none;
    width: 100%;
  }

  .photo-pile {
    height: 230px;
  }

  .photo-pile.expanded .photo-frame.main .photo-slot,
  .photo-pile.expanded .photo-frame.extra .photo-slot {
    min-height: 180px;
  }

  .nav-row {
    padding: 20px 0 40px;
  }

  .letter-frame {
    padding: 30px 24px;
  }
}
