/* ═══════════════════════════════════════════
   Our Little World — stylesheet
   Light + dark, follows system preference
   ═══════════════════════════════════════════ */

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

/* ── Light theme (default) ── */
:root {
  --bg:          #fdf8f3;
  --bg-alt:      #f7ede6;
  --card:        #fffcf8;
  --card-hover:  #fff8f0;
  --border:      rgba(212, 160, 160, 0.28);
  --blush:       #f2d4c8;
  --rose:        #d4a0a0;
  --deep-rose:   #a06060;
  --gold:        #c9a96e;
  --gold-soft:   #f0e0c0;
  --text:        #3a2e2e;
  --text-soft:   #7a6565;
  --text-muted:  #b0a0a0;
  --shadow:      rgba(160, 96, 96, 0.12);
  --shadow-lg:   rgba(160, 96, 96, 0.22);
  --admin-bar:   #3a2e2e;

  --radius:      16px;
  --radius-sm:   10px;
  --font-display:'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  color-scheme: light;
}

/* ── Dark theme — follows the device setting ── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #191316;
    --bg-alt:     #221a1d;
    --card:       #241c1f;
    --card-hover: #2c2226;
    --border:     rgba(212, 160, 160, 0.16);
    --blush:      #4a3336;
    --rose:       #d9a3a3;
    --deep-rose:  #e8bcbc;
    --gold:       #d9bc84;
    --gold-soft:  #3d3225;
    --text:       #f0e6e4;
    --text-soft:  #c2adaa;
    --text-muted: #8a7573;
    --shadow:     rgba(0, 0, 0, 0.4);
    --shadow-lg:  rgba(0, 0, 0, 0.6);
    --admin-bar:  #14100f;

    color-scheme: dark;
  }
}

/* ── Manual override — set by the toggle, wins over system ── */
:root[data-theme="light"] {
  --bg:#fdf8f3; --bg-alt:#f7ede6; --card:#fffcf8; --card-hover:#fff8f0;
  --border:rgba(212,160,160,0.28); --blush:#f2d4c8; --rose:#d4a0a0;
  --deep-rose:#a06060; --gold:#c9a96e; --gold-soft:#f0e0c0;
  --text:#3a2e2e; --text-soft:#7a6565; --text-muted:#b0a0a0;
  --shadow:rgba(160,96,96,0.12); --shadow-lg:rgba(160,96,96,0.22);
  --admin-bar:#3a2e2e;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg:#191316; --bg-alt:#221a1d; --card:#241c1f; --card-hover:#2c2226;
  --border:rgba(212,160,160,0.16); --blush:#4a3336; --rose:#d9a3a3;
  --deep-rose:#e8bcbc; --gold:#d9bc84; --gold-soft:#3d3225;
  --text:#f0e6e4; --text-soft:#c2adaa; --text-muted:#8a7573;
  --shadow:rgba(0,0,0,0.4); --shadow-lg:rgba(0,0,0,0.6);
  --admin-bar:#14100f;
  color-scheme: dark;
}

/* ── Base ── */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.2; }
h1 { font-size: clamp(1.9rem, 6vw, 3.2rem); }
h2 { font-size: clamp(1.3rem, 4vw, 1.9rem); }
p  { color: var(--text-soft); }

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

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

/* ── Layout ── */
.container { max-width: 940px; margin: 0 auto; padding: 0 20px; }

.page-center {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

/* ── Nav ── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.site-nav .inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  color: var(--deep-rose);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-links {
  display: flex;
  gap: clamp(12px, 3vw, 22px);
  align-items: center;
  flex-shrink: 0;
}

.nav-links a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: clamp(0.8rem, 2.5vw, 0.9rem);
  font-weight: 500;
  transition: color 0.2s;
  padding: 4px 0;
}
.nav-links a:hover, .nav-links a.active { color: var(--deep-rose); }

/* Theme toggle */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg-alt); transform: rotate(-15deg); }
.theme-toggle:active { transform: scale(0.92); }

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: clamp(26px, 6vw, 40px);
  box-shadow: 0 4px 24px var(--shadow);
  border: 1px solid var(--border);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  min-height: 44px;              /* touch target */
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: none;
  font-family: var(--font-body);
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--rose), var(--deep-rose));
  color: #fff;
  box-shadow: 0 4px 16px var(--shadow);
}
@media (prefers-color-scheme: dark) { .btn-primary { color: #241c1f; } }
:root[data-theme="dark"] .btn-primary { color: #241c1f; }
:root[data-theme="light"] .btn-primary { color: #fff; }

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 22px var(--shadow-lg); }

.btn-gold { background: linear-gradient(135deg, var(--gold), #a07840); color: #fff; }
.btn-gold:hover { transform: translateY(-2px); }

.btn-outline { background: transparent; color: var(--deep-rose); border: 1.5px solid var(--rose); }
.btn-outline:hover { background: var(--bg-alt); }

.btn-danger { background: #c26060; color: #fff; }
.btn-danger:hover { background: #a94a4a; }

.btn-sm { padding: 8px 16px; min-height: 38px; font-size: 0.82rem; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

input[type="password"], input[type="text"], textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;               /* 16px stops iOS zoom-on-focus */
  font-family: var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rose) 22%, transparent);
}
textarea { resize: vertical; min-height: 92px; line-height: 1.6; }

/* ── Alerts ── */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 20px;
  border: 1px solid;
}
.alert-error   { background: color-mix(in srgb, #c26060 12%, var(--card)); color: #d08080; border-color: color-mix(in srgb, #c26060 35%, transparent); }
.alert-success { background: color-mix(in srgb, #5a9a5a 12%, var(--card)); color: #7ab87a; border-color: color-mix(in srgb, #5a9a5a 35%, transparent); }

/* ── Bits ── */
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--blush), transparent); margin: 28px 0; }

.tag {
  display: inline-block;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 13px;
  border-radius: 50px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Login ── */
.login-wrap { width: 100%; max-width: 400px; }
.login-heart { font-size: 2.4rem; text-align: center; margin-bottom: 10px; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.login-title { text-align: center; margin-bottom: 6px; color: var(--deep-rose); }
.login-sub { text-align: center; font-size: 0.88rem; color: var(--text-muted); margin-bottom: 28px; }

/* ── Home ── */
.home-hero { padding: clamp(36px, 9vw, 64px) 0 32px; text-align: center; }
.home-greeting { color: var(--deep-rose); margin-top: 14px; }

.home-note {
  max-width: 560px;
  margin: 0 auto;
  font-size: clamp(0.98rem, 2.6vw, 1.08rem);
  line-height: 1.85;
  color: var(--text-soft);
  font-style: italic;
  font-family: var(--font-display);
}

.home-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 34px; }

.daily-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(26px, 6vw, 34px) clamp(22px, 5vw, 40px);
  text-align: center;
  margin: 40px 0 60px;
  margin-bottom: calc(60px + env(safe-area-inset-bottom));
  position: relative;
  overflow: hidden;
}
.daily-card::before {
  content: '"';
  font-family: var(--font-display);
  font-size: 7rem;
  color: var(--blush);
  position: absolute;
  top: -14px; left: 16px;
  line-height: 1;
  opacity: 0.55;
  pointer-events: none;
}
.daily-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold); font-weight: 700; margin-bottom: 12px; }
.daily-message {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 3.5vw, 1.32rem);
  color: var(--text);
  font-style: italic;
  line-height: 1.65;
  position: relative;
  z-index: 1;
}

/* ═══ GALLERY — full-bleed collage ═══ */
.gallery-header {
  padding: clamp(30px, 7vw, 52px) 20px clamp(22px, 5vw, 34px);
  text-align: center;
}
.gallery-header h1 { margin-top: 12px; color: var(--deep-rose); }
.gallery-count { margin-top: 8px; font-size: 0.9rem; color: var(--text-muted); }

/* Edge-to-edge masonry — no container, no max-width */
.gallery-grid {
  column-count: 5;
  column-gap: 6px;
  padding: 0 6px calc(60px + env(safe-area-inset-bottom));
  width: 100%;
}

@media (max-width: 1600px) { .gallery-grid { column-count: 5; } }
@media (max-width: 1300px) { .gallery-grid { column-count: 4; } }
@media (max-width: 1000px) { .gallery-grid { column-count: 3; } }
@media (max-width: 680px)  { .gallery-grid { column-count: 2; column-gap: 5px; padding-left: 5px; padding-right: 5px; } }
@media (max-width: 380px)  { .gallery-grid { column-count: 2; column-gap: 4px; } }

.gallery-item {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 6px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--card);
  transition: transform 0.28s cubic-bezier(.2,.8,.3,1), box-shadow 0.28s;
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 680px) { .gallery-item { margin-bottom: 5px; border-radius: 5px; } }

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.45s cubic-bezier(.2,.8,.3,1);
}

/* Hover lift — pointer devices only, so phones don't get stuck states */
@media (hover: hover) and (pointer: fine) {
  .gallery-item:hover { transform: translateY(-3px); box-shadow: 0 10px 30px var(--shadow-lg); z-index: 2; }
  .gallery-item:hover img { transform: scale(1.05); }
  .gallery-item:hover .gallery-caption { opacity: 1; transform: translateY(0); }
}

/* Caption as an overlay so the collage stays unbroken */
.gallery-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 12px 11px;
  background: linear-gradient(to top, rgba(0,0,0,0.78), rgba(0,0,0,0.35) 55%, transparent);
  color: #fff;
  font-size: 0.8rem;
  font-style: italic;
  font-family: var(--font-display);
  line-height: 1.4;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.28s, transform 0.28s;
  pointer-events: none;
}

/* On touch screens there's no hover — keep captions gently visible */
@media (hover: none) {
  .gallery-caption { opacity: 1; transform: none; font-size: 0.72rem; padding: 20px 9px 8px; }
}

.gallery-empty { text-align: center; padding: 80px 24px; color: var(--text-muted); }
.gallery-empty .emoji { font-size: 3rem; margin-bottom: 14px; }

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12, 8, 10, 0.94);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) 12px calc(12px + env(safe-area-inset-bottom));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overscroll-behavior: contain;
  touch-action: none;
}
.lightbox.open { display: flex; animation: fadeIn 0.22s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 100%;
  width: 100%;
}

.lightbox-inner img {
  max-width: 100%;
  max-height: 74vh;
  max-height: 74dvh;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-caption {
  color: rgba(255,255,255,0.82);
  font-style: italic;
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 3vw, 1.05rem);
  text-align: center;
  max-width: 640px;
  padding: 0 14px;
}

.lightbox-counter { color: rgba(255,255,255,0.4); font-size: 0.78rem; letter-spacing: 0.08em; }

.lightbox-close {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 14px;
  background: rgba(255,255,255,0.14);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  width: 46px; height: 46px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  z-index: 2;
}
.lightbox-close:hover { background: rgba(255,255,255,0.26); }

.lightbox-nav { display: flex; gap: 10px; }
.lightbox-nav button {
  background: rgba(255,255,255,0.14);
  border: none;
  color: #fff;
  min-width: 54px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.lightbox-nav button:hover { background: rgba(255,255,255,0.26); }
.lightbox-nav button:active { transform: scale(0.94); }

/* Big side arrows on wide screens */
.lb-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 52px; height: 52px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
  transition: background 0.2s;
}
.lb-arrow:hover { background: rgba(255,255,255,0.24); }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
@media (min-width: 900px) {
  .lb-arrow { display: flex; }
  .lightbox-nav { display: none; }
}

/* ── Admin ── */
.admin-nav {
  background: var(--admin-bar);
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-nav .brand { color: var(--gold); font-family: var(--font-display); font-size: 1.05rem; }
.admin-nav a { color: rgba(255,255,255,0.62); text-decoration: none; font-size: 0.84rem; }
.admin-nav a:hover { color: #fff; }

.admin-body {
  padding: 26px 18px calc(60px + env(safe-area-inset-bottom));
  max-width: 900px;
  margin: 0 auto;
}

.admin-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: clamp(20px, 5vw, 32px);
  margin-bottom: 24px;
  box-shadow: 0 2px 16px var(--shadow);
  border: 1px solid var(--border);
}
.admin-section h2 { font-size: 1.25rem; margin-bottom: 18px; color: var(--text); }

.admin-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
@media (max-width: 480px) { .admin-photos { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

.admin-photo-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}
.admin-photo-card img { width: 100%; height: 115px; object-fit: cover; }
.admin-photo-info { padding: 10px; }
.admin-photo-info input { font-size: 14px; padding: 7px 10px; margin-bottom: 8px; }
.admin-photo-actions { display: flex; gap: 6px; }
.admin-photo-actions .btn { flex: 1; }

.upload-zone {
  border: 2px dashed var(--rose);
  border-radius: var(--radius-sm);
  padding: clamp(22px, 6vw, 34px);
  text-align: center;
  background: color-mix(in srgb, var(--rose) 7%, transparent);
  transition: background 0.2s;
  cursor: pointer;
  color: var(--text);
}
.upload-zone:hover { background: color-mix(in srgb, var(--rose) 14%, transparent); }
.upload-zone .icon { font-size: 2.2rem; margin-bottom: 8px; }
.upload-zone p { font-size: 0.85rem; color: var(--text-muted); margin-top: 6px; }
