/* ============================================================
   Bloom — Design System
   Aesthetic: boho editorial, sun-warmed, linen-textured
   Color layering: linen → cream → paper (no shadows)
   ============================================================ */

/* --- Fonts --- */
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/fonts/CormorantGaramond-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/fonts/CormorantGaramond-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/fonts/CormorantGaramond-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/fonts/CormorantGaramond-MediumItalic.woff2') format('woff2');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Sans';
  src: url('/fonts/GeistVF.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens --- */
:root {
  --linen:        #F4ECDD;
  --cream:        #FAF6EC;
  --paper:        #FFFDF6;
  --cocoa:        #3B2E26;
  --cocoa-soft:   #5C4A3D;
  --mushroom:     #8B7355;
  --beige-edge:   #E0D3B8;
  --terracotta:   #C77B5C;
  --sage:         #8B9D7E;
  --brass:        #B89968;
  --rose:         #D4A5A0;

  --font-serif:   'Cormorant Garamond', 'Georgia', serif;
  --font-sans:    'Geist Sans', 'Inter', system-ui, sans-serif;

  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    16px;
  --radius-pill:  999px;

  --border:       0.5px solid var(--beige-edge);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--cocoa);
  background: var(--linen);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-sans); }
input, textarea, select { font-family: var(--font-sans); }

/* --- Utilities --- */
.bg-linen { background: var(--linen); }
.text-mushroom { color: var(--mushroom); }
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--mushroom);
  font-family: var(--font-sans);
}
.body-text { font-size: 14px; color: var(--cocoa-soft); line-height: 1.6; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  transition: transform 80ms ease, background 120ms ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary { background: var(--cocoa); color: var(--cream); }
.btn--primary:hover { background: var(--cocoa-soft); }

.btn--accent { background: var(--terracotta); color: var(--cream); }
.btn--accent:hover { background: #b36a4d; }

.btn--outline {
  background: var(--paper);
  color: var(--cocoa-soft);
  border: var(--border);
}
.btn--outline:hover { background: var(--cream); }

.btn--ghost {
  background: transparent;
  color: var(--mushroom);
  border: none;
}
.btn--ghost:hover { color: var(--cocoa); }

.btn--danger-outline {
  background: transparent;
  color: #c0392b;
  border: 0.5px solid #c0392b;
}

.btn--sm { padding: 7px 13px; font-size: 10px; }
.btn--full { width: 100%; justify-content: center; border-radius: var(--radius-sm); }

/* --- Alerts --- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert--error { background: #fdf0ed; border: 0.5px solid #e8b4a8; color: #8b3a2c; }
.alert--success { background: #f0f5ed; border: 0.5px solid #b4c9a8; color: #3a6b2c; }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: var(--font-sans);
}
.badge--live   { background: #e8f0e4; color: #3a6b2c; }
.badge--draft  { background: #ede8df; color: var(--cocoa-soft); }
.badge--archived { background: var(--beige-edge); color: var(--mushroom); }

/* --- Form fields --- */
.field { margin-bottom: 16px; }
.field__label {
  display: block;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mushroom);
  margin-bottom: 6px;
  font-family: var(--font-sans);
}
.field__input {
  display: block;
  width: 100%;
  background: var(--paper);
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  color: var(--cocoa);
  outline: none;
  transition: border-color 120ms;
}
.field__input:focus { border-color: var(--terracotta); box-shadow: inset 0 0 0 1px var(--terracotta); }
.field__textarea { resize: vertical; min-height: 80px; }
.field__select { appearance: none; cursor: pointer; }
.field__hint { font-size: 11px; color: var(--mushroom); margin-top: 5px; line-height: 1.4; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Toggle switch */
.toggle-row { margin-bottom: 12px; }
.toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--cocoa-soft); }
.toggle-input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch {
  position: relative;
  width: 36px; height: 20px;
  background: var(--beige-edge);
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  transition: background 120ms;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 120ms;
}
.toggle-input:checked + .toggle-switch { background: var(--terracotta); }
.toggle-input:checked + .toggle-switch::after { transform: translateX(16px); }

/* --- Login page --- */
.login-page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom));
}
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand__logo {
  font-family: var(--font-serif);
  font-size: 32px;
  font-style: italic;
  color: var(--cocoa);
  letter-spacing: 0.5px;
}
.login-card {
  background: var(--cream);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.75rem;
  width: 100%;
  max-width: 380px;
}
.login-card__icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--terracotta);
  margin: 0 auto 1.25rem;
  display: flex; align-items: center; justify-content: center;
}
.login-card__heading {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 500;
  color: var(--cocoa);
  text-align: center;
  margin-bottom: 4px;
}
.login-card__sub {
  font-size: 13px;
  color: var(--mushroom);
  font-style: italic;
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-card__footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 11px;
  color: var(--mushroom);
  font-style: italic;
}
.login-card__footer a { text-decoration: underline; }

/* --- Admin nav --- */
.admin-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--linen);
  border-bottom: var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-nav__brand { display: flex; align-items: center; gap: 10px; }
.admin-nav__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--terracotta);
  color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}
.admin-nav__title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-style: italic;
  color: var(--cocoa);
  line-height: 1.2;
}
.admin-nav__actions { display: flex; align-items: center; gap: 8px; }
.admin-nav__back {
  display: flex; align-items: center;
  color: var(--mushroom);
  margin-right: 4px;
  padding: 4px;
}
.admin-nav__back:hover { color: var(--cocoa); }
.admin-main { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }

/* --- Stats grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--paper);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.stat-card__value {
  font-family: var(--font-serif);
  font-size: 28px;
  color: var(--cocoa);
  margin-top: 4px;
  line-height: 1;
}
.stat-card__unit { font-size: 13px; color: var(--mushroom); }

/* --- Section card (admin card container) --- */
.section-card {
  background: var(--cream);
  border: var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.section-card__header {
  padding: 14px 18px;
  border-bottom: var(--border);
}

/* --- Collection row --- */
.collection-row {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: var(--border);
  transition: background 100ms;
  text-decoration: none;
  color: inherit;
}
.collection-row:last-child { border-bottom: none; }
.collection-row:hover { background: var(--paper); }
.collection-row__thumb {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--linen);
  flex-shrink: 0;
}
.collection-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.collection-row__thumb-placeholder { width: 100%; height: 100%; background: var(--linen); }
.collection-row__title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-style: italic;
  color: var(--cocoa);
}
.collection-row__meta { font-size: 11px; color: var(--mushroom); margin-top: 2px; }
.collection-row__chevron { color: var(--beige-edge); flex-shrink: 0; }

/* --- Gallery header --- */
.gallery-header {
  padding: 1.5rem 1.75rem;
  border-bottom: var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--cream);
}
.gallery-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-style: italic;
  color: var(--cocoa);
  font-weight: 500;
  line-height: 1.1;
  margin: 4px 0 6px;
}
.gallery-count { font-size: 12px; color: var(--mushroom); }
.gallery-header__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- Section filters --- */
.section-filters {
  padding: 0 1.75rem;
  border-bottom: var(--border);
  display: flex;
  gap: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--cream);
}
.section-filter {
  padding: 12px 0 10px;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mushroom);
  background: none;
  border: none;
  border-bottom: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 100ms, border-color 100ms;
}
.section-filter--active { color: var(--cocoa); border-bottom-color: var(--terracotta); font-weight: 500; }

/* --- Photo grid --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
}
@media (min-width: 600px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .gallery-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .gallery-grid { grid-template-columns: repeat(5, 1fr); } }

.gallery-tile {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--linen);
  aspect-ratio: 2 / 3;
  cursor: pointer;
}
.gallery-tile__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 200ms;
}
.gallery-tile__heart {
  position: absolute;
  top: 8px; right: 8px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--cocoa-soft);
  opacity: 0;
  transition: opacity 150ms, color 150ms, background 150ms;
}
.gallery-tile:hover .gallery-tile__heart { opacity: 1; }
.gallery-tile__heart--active { opacity: 1 !important; color: var(--terracotta); background: rgba(255,255,255,0.95); }
.gallery-tile__dl {
  position: absolute;
  bottom: 8px; right: 8px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  display: flex; align-items: center; justify-content: center;
  color: var(--cocoa-soft);
  opacity: 0;
  transition: opacity 150ms;
}
.gallery-tile:hover .gallery-tile__dl { opacity: 1; }
.gallery-tile--hidden { display: none; }
.gallery-tile--fav-inactive { opacity: 0.3; }

/* --- Lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.lightbox[hidden] { display: none; }
.lightbox__backdrop {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(30, 22, 16, 0.92);
}
.lightbox__backdrop[hidden] { display: none; }
.lightbox__img-wrap {
  position: relative;
  z-index: 201;
  max-width: calc(100vw - 80px);
  max-height: calc(100svh - 100px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox__img {
  max-width: 100%;
  max-height: calc(100svh - 120px);
  border-radius: 4px;
  object-fit: contain;
  user-select: none;
}
.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: fixed;
  z-index: 202;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  transition: background 120ms;
}
.lightbox__close { top: 16px; right: 16px; }
.lightbox__prev  { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox__next  { right: 12px; top: 50%; transform: translateY(-50%); }
.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover { background: rgba(255,255,255,0.2); }
.lightbox__footer {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 202;
  padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.lightbox__filename { font-size: 11px; color: rgba(255,255,255,0.5); letter-spacing: 0.5px; }
.lightbox__heart {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  transition: color 120ms, background 120ms;
}
.lightbox__heart:hover { background: rgba(255,255,255,0.1); color: white; }
.lightbox__heart--active { color: var(--terracotta) !important; }

/* --- Admin photo grid --- */
.admin-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  padding: 16px;
}
.admin-photo-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--linen);
  border: var(--border);
}
.admin-photo-tile__img { width: 100%; height: 100%; object-fit: cover; }
.admin-photo-tile__placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.admin-photo-tile__actions {
  position: absolute;
  top: 4px; right: 4px;
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity 150ms;
}
.admin-photo-tile:hover .admin-photo-tile__actions { opacity: 1; }
.admin-photo-tile__btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--cocoa-soft);
}
.admin-photo-tile__btn--danger { color: #c0392b; }

/* --- Upload zone --- */
.upload-zone {
  border: 1.5px dashed var(--beige-edge);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.upload-zone:hover, .upload-zone--active {
  border-color: var(--terracotta);
  background: rgba(199,123,92,0.04);
}
.upload-zone__label { font-size: 14px; color: var(--cocoa-soft); }
.upload-zone__browse { color: var(--terracotta); text-decoration: underline; cursor: pointer; }
.upload-zone__hint { font-size: 11px; color: var(--mushroom); }

/* --- Upload queue --- */
.upload-queue { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.upload-item {
  background: var(--paper);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
}
.upload-item__name { flex: 1; font-size: 12px; color: var(--cocoa-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item__status { font-size: 11px; color: var(--mushroom); }
.upload-item__progress {
  height: 2px; background: var(--beige-edge); border-radius: 1px;
  margin-top: 6px; overflow: hidden;
}
.upload-item__progress-bar { height: 100%; background: var(--terracotta); transition: width 200ms; }

/* --- Tab bar --- */
.tab-bar {
  display: flex;
  border-bottom: var(--border);
  padding: 0 20px;
  background: var(--cream);
  overflow-x: auto;
}
.tab-bar__item {
  padding: 12px 16px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--mushroom);
  border-bottom: 1.5px solid transparent;
  white-space: nowrap;
  transition: color 100ms, border-color 100ms;
}
.tab-bar__item--active { color: var(--cocoa); border-bottom-color: var(--terracotta); }

/* --- Form card --- */
.form-card {
  background: var(--cream);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 640px;
}
.form-section {
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: var(--border);
}
.form-section:last-of-type { border-bottom: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 1rem; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; padding: 14px 18px; border-bottom: var(--border); }

/* --- Recipients --- */
.recipient-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: var(--border);
}
.recipient-row:last-child { border-bottom: none; }
.recipient-row__name { font-size: 14px; color: var(--cocoa); }
.recipient-row__email { font-size: 11px; color: var(--mushroom); margin-top: 1px; }
.recipient-row__meta { font-size: 11px; color: var(--mushroom); margin-top: 2px; }
.recipient-row__actions { display: flex; gap: 6px; flex-shrink: 0; }

/* --- Activity feed --- */
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: var(--border);
}
.activity-row:last-child { border-bottom: none; }
.activity-row__icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--linen);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--mushroom);
}
.activity-row__event { font-size: 13px; color: var(--cocoa-soft); }
.activity-row__who { font-size: 11px; color: var(--mushroom); margin-top: 2px; }
.activity-row__time { font-size: 11px; color: var(--mushroom); margin-left: auto; white-space: nowrap; padding-top: 2px; }

/* --- Section manager --- */
.section-manager { padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.section-manager__header { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.section-tag {
  background: var(--paper);
  border: var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 10px 4px 12px;
  font-size: 11px;
  color: var(--cocoa-soft);
  display: flex; align-items: center; gap: 6px;
}
.section-tag__delete { background: none; border: none; color: var(--mushroom); font-size: 14px; line-height: 1; }

/* --- Modal --- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  background: rgba(30,22,16,0.6);
}
.modal[hidden] { display: none; }
.modal__card {
  background: var(--cream);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}
.modal__title { font-family: var(--font-serif); font-size: 20px; font-style: italic; color: var(--cocoa); margin-bottom: 12px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 1.5rem; }

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--mushroom);
  font-size: 14px;
  font-style: italic;
}

/* --- Spinner --- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--beige-edge);
  border-top-color: var(--mushroom);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Responsive --- */
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .field-row { grid-template-columns: 1fr; }
  .form-card { padding: 1.25rem; }
  .admin-main { padding: 16px 12px; }
  .tab-bar { padding: 0 12px; }
  .admin-nav { padding: 10px 12px; }
}
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
