/* ==========================================================================
   Bruton Gallery — theme layer on top of Bootstrap 6
   Style: soft & rounded · Font: Nunito · Light + dark via data-bs-theme
   All colours live here as CSS variables. See DESIGN.md for the rules.

   Ported from the Bootstrap 5 samples in temp/design/. Bootstrap 6 builds its components from
   --bs-bg-*, --bs-fg-* and --bs-primary-* variables, so the brand is applied by re-pointing those
   variables rather than restyling each component. Use `btn-solid theme-primary` (not btn-primary).
   ========================================================================== */

/* ---------- Brand palette (never changes between themes) ---------- */
:root {
  --bg-navy:   #0e0f3b;
  --bg-blue:   #07407b;
  --bg-sky:    #7fcdee;
  --bg-orange: #f7931e;
  --bg-white:  #ffffff;

  --bg-radius-control: 12px;
  --bg-radius-card:    18px;
  --bg-radius-panel:   24px;
  --bg-radius-pill:    999px;
}

/* ---------- Light theme (default) ---------- */
:root,
[data-bs-theme="light"] {
  --bg-primary: #07407b;
  --bg-primary-subtle: #e6f4fb;
  --bg-primary-muted: #c7e7f6;
  --bg-primary-ring: rgba(7, 64, 123, .35);
  --bg-on-primary: #ffffff;

  --bs-body-font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-bg-body: #f4f7fb;
  --bs-bg-1: #eef3f9;
  --bs-bg-2: #e6f4fb;
  --bs-bg-3: #dde4ee;
  --bs-fg-body: #0e0f3b;
  --bs-fg-2: #4f5677;
  --bs-fg-3: #5d6485;
  --bs-border-color: #dde4ee;
  --bs-link-color: #07407b;
  --bs-link-hover-color: #0e0f3b;

  --bg-surface: #ffffff;
  --bg-input-border: #c3cddd;
  --bg-chip-bg: #e6f4fb;
  --bg-chip-text: #07407b;
  --bg-chip-border: #c7e7f6;
  --bg-photo-bg: #eef3f9;
  --bg-shadow: 0 6px 20px rgba(14, 15, 59, .08);
  --bg-footer-bg: #0e0f3b;
  --bg-footer-text: #c9d3ea;
}

/* ---------- Dark theme ---------- */
[data-bs-theme="dark"] {
  --bg-primary: #7fcdee;
  --bg-primary-subtle: #1c1f4d;
  --bg-primary-muted: #2f3470;
  --bg-primary-ring: rgba(127, 205, 238, .4);
  --bg-on-primary: #0e0f3b;

  --bs-bg-body: #0b0c2a;
  --bs-bg-1: #15173f;
  --bs-bg-2: #1c1f4d;
  --bs-bg-3: #2a2e5e;
  --bs-fg-body: #eef2fa;
  --bs-fg-2: #a9b0cf;
  --bs-fg-3: #8e96b8;
  --bs-border-color: #2a2e5e;
  --bs-link-color: #7fcdee;
  --bs-link-hover-color: #ffffff;

  --bg-surface: #15173f;
  --bg-input-border: #3a3f78;
  --bg-chip-bg: #1c1f4d;
  --bg-chip-text: #cfeaf7;
  --bg-chip-border: #2f3470;
  --bg-photo-bg: #070820;
  --bg-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  --bg-footer-bg: #070820;
  --bg-footer-text: #a9b0cf;
}

/* Point Bootstrap's primary theme at the brand colour (both themes) */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-primary-base: var(--bg-primary);
  --bs-primary-fg: var(--bg-primary);
  --bs-primary-fg-emphasis: var(--bg-primary);
  --bs-primary-bg: var(--bg-primary);
  --bs-primary-bg-subtle: var(--bg-primary-subtle);
  --bs-primary-bg-muted: var(--bg-primary-muted);
  --bs-primary-border: var(--bg-input-border);
  --bs-primary-focus-ring: var(--bg-primary-ring);
  --bs-primary-contrast: var(--bg-on-primary);

  --bs-radius-5: var(--bg-radius-control);
  --bs-btn-input-min-height: 44px;
  --bs-btn-input-font-weight: 700;
}

body { font-weight: 400; line-height: 1.5; }
h1, h2, h3, .fw-heavy { font-weight: 800; letter-spacing: -0.01em; }

/* ---------- Buttons ---------- */
.btn-outline.theme-primary { --bs-btn-bg: var(--bg-surface); --bs-btn-border-color: var(--bg-input-border); }
.btn-icon {
  --bs-btn-bg: var(--bs-bg-body);
  --bs-btn-color: var(--bs-fg-body);
  --bs-btn-border-color: var(--bs-border-color);
  --bs-btn-border-radius: var(--bg-radius-pill);
  width: 44px; height: 44px;
}

/* ---------- Forms ---------- */
.form-control {
  --bs-control-min-height: 48px;
  --bs-control-bg: var(--bg-surface);
  --bs-control-border-color: var(--bg-input-border);
  --bs-control-border-radius: var(--bg-radius-control);
  --bs-control-font-size: 1rem;
}
.form-label { font-weight: 700; font-size: .875rem; }

/* ---------- Surfaces ---------- */
.surface { background: var(--bg-surface); border: 1px solid var(--bs-border-color); border-radius: 20px; box-shadow: var(--bg-shadow); }

/* ---------- Public header / footer ---------- */
.site-header { background: var(--bg-surface); border-bottom: 1px solid var(--bs-border-color); }
.brand { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--bs-fg-body); font-size: 1.375rem; font-weight: 800; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--bg-blue); color: var(--bg-sky); display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.brand span.accent { color: var(--bg-primary); }
.site-footer { background: var(--bg-footer-bg); color: var(--bg-footer-text); }
.site-footer a { color: var(--bg-sky); font-weight: 700; text-decoration: none; }

/* ---------- Tags ---------- */
.tag-pill {
  display: inline-flex; align-items: center; gap: .375rem;
  min-height: 36px; padding: 0 14px; border-radius: var(--bg-radius-pill);
  background: var(--bg-chip-bg); color: var(--bg-chip-text); border: 1px solid var(--bg-chip-border);
  font-size: .875rem; font-weight: 700; text-decoration: none;
}
.tag-pill:hover { border-color: var(--bg-primary); color: var(--bg-chip-text); }
.tag-pill .count { opacity: .75; font-weight: 600; }
.tag-pill.active, .tag-pill[aria-current="page"] { background: var(--bg-orange); border-color: var(--bg-orange); color: var(--bg-navy); }
.section-label { color: var(--bs-fg-2); font-size: .875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Photo cards (home grid) ---------- */
.photo-card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--bg-surface); border: 1px solid var(--bs-border-color);
  border-radius: var(--bg-radius-card); overflow: hidden; box-shadow: var(--bg-shadow);
  text-decoration: none; color: var(--bs-fg-body);
  transition: transform .15s ease, box-shadow .15s ease;
}
.photo-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(14, 15, 59, .14); color: var(--bs-fg-body); }
.photo-card .photo-frame { position: relative; aspect-ratio: 4 / 3; overflow: hidden; }
.photo-card .photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-card .photo-desc { margin: 0; padding: 12px 16px 14px; font-size: .9375rem; color: var(--bs-fg-2); }
.photo-tags { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-overlay { background: rgba(14, 15, 59, .78); color: #ffffff; font-size: .75rem; font-weight: 700; padding: 4px 10px; border-radius: var(--bg-radius-pill); }

/* ---------- Single photo page ---------- */
.page-narrow { max-width: 1000px; }
.photo-detail { border-radius: var(--bg-radius-panel); overflow: hidden; }
.photo-detail img { display: block; width: 100%; max-height: 680px; object-fit: contain; background: var(--bg-photo-bg); }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5rem; padding: 4rem 1rem; }
.auth-card { width: 100%; max-width: 420px; padding: 2rem; border-radius: var(--bg-radius-panel); }
.brand-mark-lg { width: 48px; height: 48px; border-radius: 14px; }
.icon-chip { width: 52px; height: 52px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; background: var(--bg-chip-bg); color: var(--bg-chip-text); }

/* ---------- Admin ---------- */
.admin-bar { background: var(--bg-navy); color: #ffffff; }
.admin-bar .nav-link { color: #c9d3ea; font-weight: 700; border-radius: 10px; padding: .5rem .875rem; }
.admin-bar .nav-link:hover { color: #ffffff; }
.admin-bar .nav-link.active { background: rgba(127, 205, 238, .16); color: var(--bg-sky); }
.badge-admin { background: var(--bg-orange); color: var(--bg-navy); font-weight: 800; border-radius: var(--bg-radius-pill); }
.admin-bar .brand { color: #ffffff; font-size: 1.125rem; }
.admin-bar .brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 1.125rem; }
.admin-bar .btn-icon,
.admin-bar .btn-signout {
  --bs-btn-color: #ffffff; --bs-btn-hover-color: #ffffff;
  --bs-btn-bg: rgba(255, 255, 255, .08); --bs-btn-hover-bg: rgba(255, 255, 255, .16);
  --bs-btn-border-color: #3a3f78; --bs-btn-hover-border-color: #3a3f78;
}
.admin-user { display: inline-flex; align-items: center; gap: .5rem; color: #c9d3ea; font-size: .875rem; font-weight: 700; }
.admin-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-sky); color: var(--bg-navy); display: inline-flex; align-items: center; justify-content: center; font-size: .8125rem; font-weight: 800; }
.thumb-card { display: flex; flex-direction: column; background: var(--bg-surface); border: 1px solid var(--bs-border-color); border-radius: 16px; overflow: hidden; text-decoration: none; color: var(--bs-fg-body); box-shadow: var(--bg-shadow); }
.thumb-card:hover { border-color: var(--bg-primary); color: var(--bs-fg-body); }
.thumb-card .thumb { position: relative; aspect-ratio: 1 / 1; }
.thumb-card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-card .thumb .edit-dot { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.92); color: var(--bg-blue); display: flex; align-items: center; justify-content: center; }
.thumb-card .thumb .flag { position: absolute; left: 8px; bottom: 8px; background: var(--bg-orange); color: var(--bg-navy); font-size: .6875rem; font-weight: 800; padding: 3px 8px; border-radius: var(--bg-radius-pill); }
.admin-search { width: 280px; max-width: 100%; }
.admin-filter { width: auto; }
.thumb-card .thumb .flags { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.thumb-card .thumb .flags .flag { position: static; }
.thumb-card .thumb .flags .flag.flag-muted { background: rgba(14, 15, 59, .78); color: #ffffff; }
.badge-unsaved { background: #fff1e0; color: #8a4a00; border: 1px solid var(--bg-orange); font-weight: 800; border-radius: var(--bg-radius-pill); }
.rotate-stage { aspect-ratio: 1 / 1; max-height: 620px; border-radius: 14px; background: var(--bg-photo-bg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.rotate-stage img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .25s ease; }
.tag-input { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border: 1px solid var(--bg-input-border); border-radius: var(--bg-radius-control); background: var(--bg-surface); }
.tag-input input { flex: 1 1 160px; min-width: 0; border: 0; background: transparent; color: inherit; height: 34px; }
.tag-input input:focus { outline: none; }
.tag-input:focus-within { border-color: var(--bg-primary); box-shadow: 0 0 0 3px var(--bg-primary-ring); }
.tag-pill .remove { border: 0; background: transparent; color: inherit; width: 26px; height: 26px; border-radius: 50%; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
