/* Shneevault — calm light surface with moody navy/plum accents + Fredoka playfulness.
   Palette and tokens are declared once in :root and used everywhere.
   Two visual modes:
     - .login-page: dark navy+plum photo-backed card (auth pages only)
     - default:     light grey page with white cards, navy topbar, blue CTAs
*/

:root {
  --bg: #e5e5ea;
  --bg-card: #ffffff;
  --bg-elev: #f7f7fb;
  --ink: #1a1d36;
  --ink-muted: #6b6e82;
  --rule: #dcdce6;

  --navy: #1a1d36;
  --navy-2: #2a2e52;
  --plum: #5c2a7c;
  --blue: #4a6bff;
  --blue-ink: #3852d9;
  --rose: #d96a7a;
  --rose-ink: #b84b5d;
  --danger: #a4392d;

  /* back-compat aliases */
  --accent: var(--blue);
  --accent-ink: var(--blue-ink);
  --warm: var(--rose);
  --warm-ink: var(--rose-ink);

  --shadow-sm: 0 1px 2px rgba(14, 18, 40, 0.08);
  --shadow-md: 0 8px 20px rgba(14, 18, 40, 0.12), 0 2px 4px rgba(14, 18, 40, 0.06);
  --shadow-lg: 0 30px 70px rgba(14, 18, 40, 0.22), 0 8px 24px rgba(14, 18, 40, 0.12);

  --radius-card: 14px;
  --radius-input: 10px;
  --radius-pill: 999px;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-fun:     'Fredoka', system-ui, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif:   var(--font-display);
  --font-sans:    var(--font-body);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* grain was part of the old aesthetic — hidden in the new design */
.grain { display: none; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.015em;
}
h1 { font-size: 2.2rem; margin: 0 0 6px; }
h2 { font-size: 1.35rem; margin: 1.6em 0 0.6em; }
h3 { font-size: 1.05rem; margin: 0 0 4px; }
p { margin: 0 0 10px; }
a { color: var(--blue-ink); text-decoration: none; transition: color .15s; }
a:hover { color: var(--blue); }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em; background: var(--bg-elev);
  padding: 2px 6px; border-radius: 4px; border: 1px solid var(--rule);
}
.muted { color: var(--ink-muted); font-size: 0.92em; }

/* ----- top bar (dark navy, pill nav) ----- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: var(--navy);
  color: #fff;
}
.brand {
  font-family: var(--font-fun);
  font-weight: 600;
  font-size: 1.45rem;
  color: #fff;
  border: none;
  letter-spacing: 0.005em;
  display: inline-flex;
  align-items: center;
}
.brand:hover { color: #fff; }
.brand-mark { display: none; }
.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topnav a {
  color: rgba(255, 255, 255, 0.82);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  transition: background .15s, color .15s;
}
.topnav a:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.user-chip {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  margin-left: 8px;
}
.topnav form.inline { display: inline; }
.topnav .linkbtn {
  color: rgba(255, 255, 255, 0.75);
  background: none; border: none;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer; font: inherit;
}
.topnav .linkbtn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; text-decoration: none; }

/* ----- layout ----- */
main { max-width: 1200px; margin: 0 auto; padding: 32px 28px; }

.page-head {
  display: flex; align-items: end; justify-content: space-between; gap: 20px;
  margin-bottom: 26px; padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.crumbs { margin: 0 0 6px; color: var(--ink-muted); font-size: 0.88rem; }
.crumbs a { color: var(--ink-muted); }
.crumbs a:hover { color: var(--ink); }
.subnav { display: flex; gap: 18px; flex-wrap: wrap; }
.subnav a { color: var(--ink-muted); font-weight: 500; }
.subnav a:hover { color: var(--navy); }

/* logged-in footer — mirrors the auth-page footer */
.footer {
  max-width: 1200px; margin: 60px auto 24px; padding: 24px 28px 0;
  text-align: center;
  border-top: 1px solid var(--rule);
}
.footer .footer-line {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--ink-muted);
}
.footer .footer-line a {
  color: #4a5068;
  border-bottom: 1px solid transparent;
}
.footer .footer-line a:hover { color: var(--navy); border-bottom-color: var(--navy); }
.footer .footer-line .heart { color: var(--rose); font-size: 0.95em; margin: 0 1px; }
.footer .footer-line .dot { margin: 0 6px; opacity: 0.6; }
.footer .footer-copy {
  margin: 0;
  font-size: 0.74rem;
  color: #9a9aa5;
  letter-spacing: 0.02em;
}

/* ----- flashes ----- */
.flashes { max-width: 1200px; margin: 14px auto 0; padding: 0 28px; }
.flash {
  padding: 10px 14px; border-radius: var(--radius-input);
  margin-bottom: 8px; border: 1px solid; font-size: 0.95rem;
}
.flash-success { background: #e6ecff; border-color: #c0cbff; color: var(--blue-ink); }
.flash-error   { background: #fbe5e3; border-color: #e6b6b0; color: #7c2f1c; }

/* ----- buttons ----- */
.btn {
  display: inline-block; padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: #fff; color: var(--ink);
  border: 1px solid var(--rule);
  font: inherit; font-weight: 500; font-size: 0.9rem;
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s, color .15s;
}
.btn:hover { background: var(--bg-elev); border-color: var(--ink-muted); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; border-color: transparent; }
.btn-primary:hover { background: var(--blue-ink); color: #fff; border-color: transparent; }
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger:hover { background: #c14c3a; color: #fff; border-color: transparent; }

.admin-danger {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.linkbtn {
  background: none; border: none;
  color: var(--blue-ink); padding: 0;
  cursor: pointer; font: inherit; text-decoration: underline;
}
.linkbtn:hover { color: var(--blue); }
.linkbtn.danger { color: var(--danger); }
.linkbtn.danger:hover { color: #d14a3c; }
.inline { display: inline; }

/* ----- login page — self-contained card with tinted photo bg ----- */
.login-page { background: #e5e5ea; }
.login-page main { max-width: none; margin: 0; padding: 0; }
.login-page .grain { opacity: 0; }

.login-centered {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  padding: 40px 20px 24px;
}
.login-centered .login-card { align-self: center; }

.login-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  min-height: 520px;
  border-radius: 14px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  box-shadow:
    0 30px 70px rgba(14, 18, 40, 0.35),
    0 8px 24px rgba(14, 18, 40, 0.2);
}
.login-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(140deg,
    rgba(22, 32, 72, 0.68) 0%,
    rgba(58, 34, 98, 0.64) 55%,
    rgba(92, 32, 92, 0.68) 100%);
  z-index: 0;
}

.login-inner {
  position: relative;
  z-index: 1;
  padding: 34px 32px 28px;
  color: #fff;
}
.login-sub {
  text-align: center;
  color: rgba(255, 255, 255, 0.95);
  font-family: 'Fredoka', system-ui, sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 1.45rem;
  letter-spacing: 0;
  margin: 0 0 24px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.35);
}
.login-body {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 20px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.back-btn {
  display: block;
  text-align: center;
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-weight: 500;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background .15s;
}
.back-btn:hover { background: rgba(255, 255, 255, 0.25); color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.login-inner .flash { margin-bottom: 16px; }

.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.field input {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 100%;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.field input::placeholder { color: rgba(255, 255, 255, 0.5); }
.field input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.signin-btn {
  display: block;
  width: 100%;
  padding: 13px 20px;
  border: none;
  border-radius: 999px;
  background: #4a6bff;
  color: #fff;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.88rem;
  cursor: pointer;
  margin-top: 6px;
  transition: background .15s, transform .05s;
}
.signin-btn:hover { background: #3852d9; }
.signin-btn:active { transform: translateY(1px); }

.login-rule {
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 22px 0 14px;
}
.forgot-link {
  display: block;
  text-align: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  border: none;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.forgot-link:hover { color: #fff; }

.login-footer { width: 100%; max-width: 420px; align-self: end; padding-top: 28px; }
.login-footnote {
  margin: 0 0 14px;
  font-size: 0.82rem;
  color: #6a6a75;
  text-align: center;
}
.login-footnote a {
  color: #4a5068;
  border: none;
  border-bottom: 1px solid transparent;
}
.login-footnote a:hover { color: #1a1d36; border-bottom-color: #1a1d36; }
.login-footnote .heart { color: #d96a7a; font-size: 0.95em; margin: 0 1px; }
.login-footnote .dot { margin: 0 6px; opacity: 0.6; }
.login-copyright {
  margin: 0;
  font-size: 0.74rem;
  color: #9a9aa5;
  text-align: center;
  letter-spacing: 0.02em;
}

@media (max-width: 480px) {
  .login-inner { padding: 28px 24px 24px; }
}

/* ----- album grid ----- */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.album-card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transition: transform .15s, box-shadow .15s;
}
.album-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: var(--ink); border: none;
}
.album-cover { aspect-ratio: 4/3; position: relative; overflow: hidden; }
.album-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 2.6rem;
  color: rgba(26, 29, 54, 0.28);
  background: linear-gradient(135deg, #dcdce6 0%, #cbcbd7 100%);
}
.album-cover img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.album-meta { padding: 10px 12px 12px; }
.album-meta h3 { margin: 0 0 2px; font-size: 0.95rem; font-family: var(--font-display); }
.album-meta p { margin: 0; color: var(--ink-muted); font-size: 0.76rem; }

/* ----- photo grid ----- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tile {
  position: relative; aspect-ratio: 1;
  background: var(--rule);
  border-radius: 8px; overflow: hidden; border: none;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .12s;
}
.tile:hover { transform: scale(1.02); box-shadow: var(--shadow-md); border: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play-badge {
  position: absolute; inset: auto auto 8px 8px;
  background: rgba(26, 29, 54, 0.78); color: #fff;
  padding: 3px 9px; border-radius: 4px; font-size: 0.75rem;
}

/* ----- photo page ----- */
.photo-stage {
  display: grid; grid-template-columns: 34px 1fr 34px;
  align-items: center; gap: 10px; margin: 14px 0 16px;
}
.stage-nav {
  display: grid; place-items: center; height: 34px;
  border-radius: 50%;
  color: var(--ink-muted); background: #fff;
  border: 1px solid var(--rule);
  font-size: 1.1rem; text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.stage-nav:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.stage-nav.disabled { opacity: 0.3; pointer-events: none; }
.frame {
  margin: 0; padding: 14px;
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
  display: grid; place-items: center;
}
.frame img, .frame video { max-width: 100%; max-height: 72vh; border-radius: 6px; display: block; }
.photo-meta { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 8px 4px 4px; }
.photo-meta .muted { font-size: 0.82rem; }
.caption { font-size: 1rem; margin-bottom: 2px; font-family: var(--font-display); }
.tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block; padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: #fff; border: 1px solid var(--rule); color: var(--ink);
  font-size: 0.85rem; transition: background .15s, color .15s, border-color .15s;
}
.tag:hover { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ----- admin inline editor on photo page ----- */
.admin-edit {
  margin-top: 32px; padding: 22px;
  background: #fff;
  border: 1px dashed var(--rule);
  border-radius: var(--radius-card);
  max-width: 720px;
}
.admin-edit h2 { margin-top: 0; font-family: var(--font-display); }
.admin-edit .stack { display: grid; gap: 10px; margin-bottom: 18px; }
.admin-edit .stack label { display: grid; gap: 4px; }
.admin-edit .stack label span { font-size: 0.78rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.admin-edit input {
  font: inherit; padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-input);
  background: var(--bg-elev);
}
.admin-edit input:focus {
  outline: none; border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(74, 107, 255, 0.15);
}
.admin-edit .btn { justify-self: start; }
.tag-editor { margin-top: 10px; }
.chip-check { cursor: pointer; user-select: none; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check:has(input:checked) { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ----- comments ----- */
.comments { margin-top: 32px; max-width: 720px; }
.comments h2 { font-family: var(--font-display); }
.comment-list { list-style: none; padding: 0; margin: 0 0 18px; }
.comment {
  padding: 14px 16px; border: 1px solid var(--rule);
  border-radius: var(--radius-card); margin-bottom: 10px;
  background: #fff;
}
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 0.9rem; }
.comment-head strong { font-weight: 600; }
.comment-form { display: grid; gap: 10px; }
.comment-form textarea {
  font: inherit; padding: 12px 14px;
  border-radius: var(--radius-input);
  border: 1px solid var(--rule);
  background: var(--bg-elev); resize: vertical;
}
.comment-form textarea:focus {
  outline: none; border-color: var(--blue); background: #fff;
  box-shadow: 0 0 0 3px rgba(74, 107, 255, 0.15);
}
.comment-form .btn { justify-self: start; }

/* ----- search ----- */
.search-bar { display: flex; gap: 10px; margin-bottom: 22px; }
.search-bar input {
  flex: 1; padding: 12px 16px;
  border: 1px solid var(--rule); border-radius: var(--radius-pill);
  background: #fff; font: inherit;
}
.search-bar input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74, 107, 255, 0.15);
}
.people-strip { margin: 0 0 24px; }
.people-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px; border: 1px solid var(--rule);
  border-radius: var(--radius-pill); color: var(--ink);
  background: #fff; font-size: 0.9rem;
  transition: background .15s, color .15s, border-color .15s;
}
.chip.active, .chip:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ----- admin ----- */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.stat {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  padding: 16px 20px; min-width: 130px;
  box-shadow: var(--shadow-sm);
}
.stat .num {
  display: block;
  font-family: var(--font-fun);
  font-size: 2.1rem; font-weight: 600;
  line-height: 1; color: var(--navy);
  margin-bottom: 4px;
}
.stat span:not(.num) { font-size: 0.85rem; color: var(--ink-muted); }

.admin-table {
  width: 100%; border-collapse: collapse; margin: 14px 0 24px;
  background: #fff;
  border-radius: var(--radius-card); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.admin-table th, .admin-table td {
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--rule);
}
.admin-table th {
  background: var(--bg-elev);
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-muted); font-weight: 600;
}
.admin-table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 14px; align-items: center; }
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem; border: 1px solid; font-weight: 500;
}
.badge.admin { background: #e6ecff; color: var(--blue-ink); border-color: #c0cbff; }
.badge.warn  { background: #fbe5e3; color: var(--rose-ink); border-color: #e6b6b0; }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }
.inline-form input[type="text"],
.inline-form input:not([type]),
.inline-form input[type="date"] {
  padding: 10px 14px; border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: #fff; font: inherit;
}
.inline-form input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74, 107, 255, 0.15);
}
.checkbox { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-muted); font-size: 0.9rem; }

.edit-form {
  display: grid; gap: 14px;
  max-width: 520px;
  background: #fff;
  padding: 24px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}
.edit-form label { display: grid; gap: 6px; }
.edit-form label span { font-size: 0.78rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.edit-form input, .edit-form textarea {
  font: inherit; padding: 10px 14px;
  border: 1px solid var(--rule); border-radius: var(--radius-input);
  background: var(--bg-elev); color: var(--ink);
}
.edit-form input:focus, .edit-form textarea:focus {
  outline: none; border-color: var(--blue); background: #fff;
  box-shadow: 0 0 0 3px rgba(74, 107, 255, 0.15);
}
.edit-form textarea { resize: vertical; }
.edit-form .muted { margin: 4px 0 0; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

.empty {
  padding: 48px; text-align: center;
  color: var(--ink-muted);
  background: #fff;
  border-radius: var(--radius-card);
  border: 1px dashed var(--rule);
  font-family: var(--font-fun);
  font-size: 1.05rem;
}
.empty a { color: var(--blue-ink); }
.help-list { line-height: 1.8; }

/* ----- responsive ----- */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .topnav { gap: 4px; font-size: 0.92rem; }
  .topnav a, .topnav .linkbtn { padding: 6px 10px; }
  .user-chip { display: none; }
  main { padding: 18px 14px; }
  h1 { font-size: 1.7rem; }
  .album-grid { gap: 10px; }
  .album-meta { padding: 8px 10px 10px; }
  .album-meta h3 { font-size: 0.88rem; }
  .album-meta p { font-size: 0.72rem; }
  .photo-stage { grid-template-columns: 28px 1fr 28px; gap: 8px; }
  .stage-nav { height: 28px; font-size: 1rem; }
  .frame { padding: 10px; }
}
