@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Nunito:wght@300;400;500;600;700&family=Dancing+Script:wght@500;600&display=swap');

/* ── Variables ─────────────────────────────────────────── */
:root {
  --bg:             #FFF7EF;
  --surface:        #FFFFFF;
  --surface-warm:   #FFFAF6;
  --primary:        #E8896A;
  --primary-dark:   #D4745A;
  --primary-light:  rgba(232,137,106,.12);
  --blue:           #537FBE;
  --red:            #EA433B;
  --green:          #5FAF8A;
  --text:           #2C1810;
  --text-2:         #7A5C4F;
  --text-3:         #B89080;
  --border:         #F0D9CB;
  --border-2:       #DFC0AA;
  --shadow-sm:      0 2px 8px  rgba(180,100,60,.08);
  --shadow:         0 4px 20px rgba(180,100,60,.13);
  --shadow-lg:      0 8px 40px rgba(180,100,60,.18);
  --r-sm:    8px;
  --r:       16px;
  --r-lg:    24px;
  --r-xl:    32px;
  --ff-display: 'Playfair Display', Georgia, serif;
  --ff-body:    'Nunito', 'Helvetica Neue', sans-serif;
  --ff-script:  'Dancing Script', cursive;
  --nav-h:  62px;
  --ease:   200ms ease;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--ff-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 15% 60%, rgba(232,137,106,.05) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(83,127,190,.04)  0%, transparent 55%);
}
img   { max-width: 100%; height: auto; display: block; }
a     { color: var(--primary); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--primary-dark); }
button { font-family: var(--ff-body); }

/* ── Layout ─────────────────────────────────────────────── */
.page { min-height: 100vh; padding-top: var(--nav-h); }
.container      { width: 100%; max-width: 660px;  margin: 0 auto; padding: 0 20px; }
.container--wide{ width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(255,247,239,.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex; align-items: center; padding: 0 20px;
}
.navbar__inner {
  width: 100%; max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.navbar__brand {
  font-family: var(--ff-display); font-size: 1.625rem; font-weight: 700;
  letter-spacing: -.5px; white-space: nowrap; line-height: 1;
}
.navbar__brand .blue { color: var(--blue); }
.navbar__brand .red  { color: var(--red);  }

.navbar__links { display: flex; align-items: center; gap: 2px; list-style: none; }
.navbar__links a {
  display: block; padding: 6px 11px;
  font-size: .875rem; font-weight: 600; color: var(--text-2);
  border-radius: var(--r-sm); transition: all var(--ease); white-space: nowrap;
}
.navbar__links a:hover         { color: var(--text); background: var(--border); }
.navbar__links a.active        { color: var(--primary); background: var(--primary-light); }
.navbar__links .nav-logout a   { color: var(--text-3) !important; font-size: .8rem !important; }

/* hamburger */
.navbar__burger {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; padding: 8px; border: none; background: none; border-radius: var(--r-sm);
}
.navbar__burger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: all .25s ease; }
.navbar__burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar__burger.open span:nth-child(2) { opacity: 0; }
.navbar__burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* mobile menu */
.navbar__mobile {
  display: none; position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: rgba(255,247,239,.98); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px 24px; z-index: 999;
  animation: slideDown .2s ease;
}
.navbar__mobile.open { display: block; }
.navbar__mobile ul   { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.navbar__mobile a {
  display: block; padding: 10px 16px;
  font-size: 1rem; font-weight: 600; color: var(--text-2);
  border-radius: var(--r-sm); transition: all var(--ease);
}
.navbar__mobile a:hover, .navbar__mobile a.active { color: var(--primary); background: var(--primary-light); }
.navbar__mobile .nav-logout a { color: var(--text-3) !important; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 18px; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden;
}
.card-body { padding: 28px; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; font-size: .9375rem; font-weight: 700;
  border: none; border-radius: var(--r); cursor: pointer;
  transition: all var(--ease); text-decoration: none;
  white-space: nowrap; -webkit-tap-highlight-color: transparent; line-height: 1;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 14px rgba(232,137,106,.36);
}
.btn-primary:hover {
  background: var(--primary-dark); color: #fff;
  box-shadow: 0 6px 18px rgba(232,137,106,.46); transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-warm); color: var(--text-2);
  border: 1.5px solid var(--border-2);
}
.btn-secondary:hover { background: var(--border); color: var(--text); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--text-2); padding: 10px 14px; }
.btn-ghost:hover { background: var(--border); color: var(--text); }

.btn-lg { padding: 15px 36px; font-size: 1.0625rem; border-radius: var(--r-lg); }

.btn-bounce:hover { animation: bounceBtn .4s ease; }
@keyframes bounceBtn {
  0%,100% { transform: scale(1); }
  30%     { transform: scale(1.06); }
  60%     { transform: scale(.97); }
}

.w-full { width: 100%; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-label { font-size: .8125rem; font-weight: 700; color: var(--text-2); letter-spacing: .04em; text-transform: uppercase; }
.form-input, .form-textarea {
  width: 100%; padding: 12px 16px;
  font-family: var(--ff-body); font-size: 1rem; color: var(--text);
  background: var(--surface-warm); border: 1.5px solid var(--border);
  border-radius: var(--r); outline: none; transition: all var(--ease);
  appearance: none; -webkit-appearance: none;
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(232,137,106,.14);
}
.form-textarea { resize: vertical; min-height: 220px; line-height: 1.75; }
.form-error {
  font-size: .875rem; color: var(--red); font-weight: 700;
  animation: shake .3s ease;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-5px); }
  75%     { transform: translateX(5px); }
}

/* ── Photo display ──────────────────────────────────────── */
.hero-photo {
  width: 100%; max-height: 72vh; object-fit: contain;
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); margin: 0 auto;
}

/* ── Photo grid (all.html) ──────────────────────────────── */
.photo-grid { columns: 2; column-gap: 10px; }
.photo-grid__item {
  break-inside: avoid; margin-bottom: 10px;
  border-radius: var(--r-sm); overflow: hidden; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform .2s ease, box-shadow .2s ease;
}
.photo-grid__item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.photo-grid__item img { width: 100%; display: block; }

/* Lightbox */
.lightbox {
  display: none; position: fixed; inset: 0;
  background: rgba(20,10,5,.9); z-index: 2000;
  align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(6px);
}
.lightbox.open { display: flex; animation: fadeIn .2s ease; }
.lightbox__img { max-height: 90vh; max-width: 100%; border-radius: var(--r-sm); box-shadow: 0 20px 80px rgba(0,0,0,.5); }
.lightbox__close {
  position: absolute; top: 20px; right: 20px;
  width: 44px; height: 44px; background: rgba(255,255,255,.15);
  border: none; border-radius: 50%; color: #fff; font-size: 1.375rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--ease); backdrop-filter: blur(4px);
}
.lightbox__close:hover { background: rgba(255,255,255,.28); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Diary ──────────────────────────────────────────────── */
.diary-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.diary-header {
  padding: 24px 28px 18px;
  background: linear-gradient(160deg, var(--surface-warm) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
}
.diary-date {
  font-size: .78rem; font-weight: 800; color: var(--primary);
  text-transform: uppercase; letter-spacing: .09em; margin-bottom: 6px;
}
.diary-title { font-family: var(--ff-display); font-size: 1.5rem; line-height: 1.3; color: var(--text); }
.diary-body  { padding: 20px 28px 8px; }
.diary-content {
  font-size: .9875rem; color: var(--text-2); line-height: 1.85;
  white-space: pre-wrap; word-break: break-word;
}
.diary-photo { padding: 0 28px 20px; text-align: center; }
.diary-photo img {
  border-radius: var(--r); max-width: 100%; max-height: 380px;
  object-fit: cover; box-shadow: var(--shadow); margin: 0 auto;
}
.diary-hashtag {
  text-align: center; font-family: var(--ff-script);
  font-size: 1.5rem; color: var(--text-3); padding: 4px 0 16px;
}
.diary-nav {
  display: flex; gap: 10px; justify-content: center;
  flex-wrap: wrap; padding: 20px 0 8px;
}

/* ── Upload ─────────────────────────────────────────────── */
.upload-zone {
  border: 2.5px dashed var(--border-2); border-radius: var(--r-lg);
  padding: 48px 24px; text-align: center; cursor: pointer;
  transition: all var(--ease); background: var(--surface-warm); user-select: none;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: var(--primary-light); }
.upload-zone__icon { font-size: 3rem; display: block; margin-bottom: 12px; }
.upload-zone__text { font-size: 1rem; font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.upload-zone__sub  { font-size: .875rem; color: var(--text-3); }

.upload-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-top: 18px; }
.upload-previews img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-sm); box-shadow: var(--shadow-sm); }

/* ── Login ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(135deg, #FFF7EF 0%, #FFE9D8 55%, #FFF0E6 100%);
}
.login-wrap { width: 100%; max-width: 380px; }
.login-brand { font-family: var(--ff-display); font-size: 2.625rem; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-brand .blue { color: var(--blue); }
.login-brand .red  { color: var(--red);  }
.login-tagline { font-family: var(--ff-script); font-size: 1.25rem; color: var(--text-3); text-align: center; margin-bottom: 28px; }

/* ── Status messages ────────────────────────────────────── */
.status-ok  { color: #2A7A56; background: #E6F4EE; border: 1px solid #A8D5BC; border-radius: var(--r-sm); padding: 10px 16px; font-size: .9375rem; font-weight: 700; }
.status-err { color: var(--red); background: rgba(234,67,59,.07); border: 1px solid rgba(234,67,59,.2); border-radius: var(--r-sm); padding: 10px 16px; font-size: .9375rem; font-weight: 700; }

/* ── Empty state ────────────────────────────────────────── */
.empty { text-align: center; padding: 64px 20px; color: var(--text-3); }
.empty__icon { font-size: 3rem; margin-bottom: 14px; }
.empty__text { font-size: 1rem; margin-bottom: 20px; }

/* ── Section header ─────────────────────────────────────── */
.section-head { text-align: center; padding: 28px 0 22px; }
.section-head h1 { font-family: var(--ff-display); font-size: 1.75rem; margin-bottom: 4px; }
.section-head .sub { font-size: .9375rem; color: var(--text-3); }

/* ── Animations ─────────────────────────────────────────── */
.fade-in { animation: fadeInUp .4s ease both; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ── Utilities ──────────────────────────────────────────── */
.hidden  { display: none !important; }
.mt-2    { margin-top: 8px;  }
.mt-3    { margin-top: 12px; }
.mt-4    { margin-top: 16px; }
.mt-5    { margin-top: 20px; }
.mt-6    { margin-top: 24px; }
.mt-8    { margin-top: 32px; }
.mb-4    { margin-bottom: 16px; }
.gap-2   { gap: 8px;  }
.gap-3   { gap: 12px; }
.t-center{ text-align: center; }
.flex    { display: flex; }
.flex-col{ flex-direction: column; }
.items-c { align-items: center; }
.just-c  { justify-content: center; }

/* ── Responsive ─────────────────────────────────────────── */
@media (min-width: 600px) {
  .photo-grid { columns: 3; }
}

@media (max-width: 599px) {
  .navbar__links, .navbar__logout { display: none; }
  .navbar__burger { display: flex; }
  .card-body { padding: 20px; }
  .diary-header { padding: 20px 20px 16px; }
  .diary-body   { padding: 16px 20px 8px;  }
  .diary-photo  { padding: 0 20px 16px;    }
  .btn-lg { padding: 14px 28px; }
  .login-brand  { font-size: 2.125rem; }
  .reactions { padding: 10px 20px 4px; gap: 6px; }
}

/* ── Reactions ──────────────────────────────────────────── */
.reactions {
  display: flex; gap: 8px; padding: 12px 28px 4px; flex-wrap: wrap;
}
.reaction-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; font-size: .875rem;
  background: var(--surface-warm); border: 1.5px solid var(--border);
  border-radius: 999px; cursor: pointer; transition: all var(--ease);
  font-family: var(--ff-body);
}
.reaction-btn:hover { border-color: var(--primary); background: var(--primary-light); transform: scale(1.05); }
.reaction-btn:active { transform: scale(.97); }
.reaction-btn .count { font-weight: 700; font-size: .8rem; color: var(--text-2); min-width: 14px; }

/* ── On This Day ────────────────────────────────────────── */
.on-this-day {
  background: linear-gradient(135deg, rgba(83,127,190,.07) 0%, rgba(95,175,138,.05) 100%);
  border: 1px solid rgba(83,127,190,.18);
  border-radius: var(--r-lg); padding: 16px 20px; margin-bottom: 18px;
}
.on-this-day__title {
  font-family: var(--ff-display); font-size: .9375rem; font-weight: 700;
  color: var(--blue); margin-bottom: 8px;
}
.on-this-day__list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.on-this-day__item {
  font-size: .875rem; color: var(--text-2);
  display: flex; align-items: baseline; gap: 8px;
}
.on-this-day__item .year {
  font-weight: 800; font-size: .7rem; color: var(--blue);
  background: rgba(83,127,190,.12); padding: 2px 7px; border-radius: 999px; flex-shrink: 0;
}
.on-this-day__item .title-link { font-weight: 600; color: var(--text); }
.on-this-day__item .title-link:hover { color: var(--primary); }

/* ── Age badge ──────────────────────────────────────────── */
.age-badge {
  display: inline-block; background: var(--primary-light);
  border: 1px solid rgba(232,137,106,.25); border-radius: 999px;
  padding: 6px 18px; font-size: .875rem; color: var(--primary-dark); font-weight: 700;
}

/* ── Video ──────────────────────────────────────────────── */
.photo-grid__item video { width: 100%; display: block; }
.hero-video {
  width: 100%; max-height: 72vh;
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  margin: 0 auto; display: block;
}
.lightbox__video {
  max-height: 90vh; max-width: 100%;
  border-radius: var(--r-sm); box-shadow: 0 20px 80px rgba(0,0,0,.5);
}

/* ── Export / Print ─────────────────────────────────────── */
@media print {
  .navbar, .navbar__mobile, .export-actions { display: none !important; }
  .page { padding-top: 0 !important; }
  .export-entry { break-after: page; }
  .export-entry:last-child { break-after: avoid; }
  body { background: white !important; background-image: none !important; }
  .diary-card { box-shadow: none !important; border: 1px solid #e0e0e0 !important; }
}
