/* ---------------------------------------------------------------------------
   AlbumForge shared styles.

   Palette: cool neutral paper and ink, one cobalt accent used everywhere.
   Radius: panels 14px, media and inputs 10px, buttons full pill.
   Type: Bricolage Grotesque display, Geist body, Geist Mono for codes.
--------------------------------------------------------------------------- */
:root {
  color-scheme: light dark;
  --bg: #e8eaec;
  --surface: #f7f8f9;
  --surface-sunken: #dfe3e5;
  --ink: #14181b;
  --muted: #5a6469;
  --line: #cfd5d8;
  --line-strong: #b6bfc3;
  --accent: #1d3fd1;
  --accent-hover: #172fa8;
  --accent-text: #1d3fd1;
  --on-accent: #ffffff;
  --danger: #a32020;
  --ok: #1c6b40;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 12px 28px -18px rgba(20, 30, 40, .45);
  --r-panel: 14px;
  --r-media: 10px;
  --r-field: 10px;
  --step: .35s cubic-bezier(.16, 1, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101315;
    --surface: #191d20;
    --surface-sunken: #0b0e10;
    --ink: #e9edef;
    --muted: #98a3a8;
    --line: #292f33;
    --line-strong: #3a4247;
    --accent: #3f5cf0;
    --accent-hover: #5470ff;
    --accent-text: #93a8ff;
    --danger: #ff8b7d;
    --ok: #6ddba0;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 34px -20px rgba(0,0,0,.8);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

h1, h2, h3 {
  font-family: "Bricolage Grotesque", "Geist", ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -.025em;
  margin: 0;
}

button, input, select { font: inherit; color: inherit; }
a { color: var(--accent-text); }

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

.mono { font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.shell { max-width: 1180px; margin: 0 auto; padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 32px) 90px; }
.shell--narrow { max-width: 560px; }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: var(--on-accent);
  font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background var(--step), transform var(--step), border-color var(--step);
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--accent); }

.btn--quiet { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn--quiet:hover { background: var(--surface); border-color: var(--ink); }
.btn--quiet[disabled]:hover { background: transparent; border-color: var(--line-strong); }

.btn--danger { background: transparent; border-color: var(--line-strong); color: var(--danger); }
.btn--danger:hover { background: transparent; border-color: var(--danger); }

.btn--small { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn--block { width: 100%; }

/* --- Fields --------------------------------------------------------------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13.5px; font-weight: 500; }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field input, .field select {
  width: 100%; min-height: 46px; padding: 0 14px;
  border-radius: var(--r-field); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent-text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.field input.mono { font-size: 13px; }

.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 6px 0; }
.switch input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }

/* --- Panels --------------------------------------------------------------- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel); padding: 20px; box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.panel h2 { font-size: 20px; }
.panel__meta { color: var(--muted); font-size: 13.5px; }

.notice { border-radius: var(--r-field); padding: 12px 16px; font-size: 14px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--surface); }
.notice--error { border-left: 3px solid var(--danger); }
.notice--ok { border-left: 3px solid var(--ok); }

/* --- Masonry grid --------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 4px;
  row-gap: 0;
  column-gap: 12px;
}
@media (min-width: 760px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 14px; } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.tile {
  position: relative; margin: 0 0 12px;
  border-radius: var(--r-media); overflow: hidden;
  background: var(--surface-sunken); border: 1px solid var(--line);
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile--wide { grid-column: span 2; }
.tile--hidden img { opacity: .38; }

.tile__open { position: absolute; inset: 0; border: 0; background: transparent; cursor: zoom-in; padding: 0; }

.tile__bar { position: absolute; inset: auto 6px 6px 6px; display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.chip {
  min-height: 32px; padding: 0 11px; border: 0; border-radius: 999px;
  background: rgba(12, 15, 18, .78); color: #fff;
  font-size: 12.5px; font-weight: 500; cursor: pointer; backdrop-filter: blur(6px);
}
.chip:hover { background: rgba(12, 15, 18, .94); }
.tile__tag {
  position: absolute; top: 6px; left: 6px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
  background: var(--accent); color: var(--on-accent);
}
.tile__tag--hidden { background: rgba(12, 15, 18, .8); color: #fff; }
.tile__who {
  position: absolute; inset: auto 0 0 0; padding: 22px 10px 8px;
  background: linear-gradient(transparent, rgba(10, 12, 14, .72));
  color: #fff; font-size: 12.5px;
}

.tile--skeleton {
  border-style: dashed;
  background: linear-gradient(100deg, var(--surface-sunken) 30%, var(--surface) 50%, var(--surface-sunken) 70%);
  background-size: 240% 100%;
  animation: sweep 1.3s linear infinite;
}
@keyframes sweep { from { background-position: 140% 0; } to { background-position: -40% 0; } }

/* --- Lightbox ------------------------------------------------------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 60; background: rgba(8, 10, 12, .93);
  display: none; align-items: center; justify-content: center; padding: clamp(12px, 4vw, 48px);
}
.lightbox.is-open { display: flex; }
.lightbox img { max-width: 100%; max-height: 82dvh; border-radius: var(--r-media); object-fit: contain; }
.lightbox__caption { position: absolute; bottom: 20px; left: 0; right: 0; text-align: center; color: #d8dde0; font-size: 13px; }
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25); background: rgba(12,15,18,.6);
  color: #fff; font-size: 21px; line-height: 1; cursor: pointer;
}
.lightbox__nav--prev { left: clamp(8px, 3vw, 26px); }
.lightbox__nav--next { right: clamp(8px, 3vw, 26px); }
.lightbox__close { position: absolute; top: 16px; right: 16px; }

/* --- Toast ---------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 70; transform: translate(-50%, 14px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none;
  transition: opacity var(--step), transform var(--step);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* --- Print card ----------------------------------------------------------- */
.print-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  overflow: hidden; max-width: 340px;
}
.print-card__body { padding: 20px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.print-card__qr { background: #fff; border: 1px solid var(--line); border-radius: var(--r-media); padding: 12px; width: 100%; }
.print-card__qr img { display: block; width: 100%; height: auto; }
.print-card__stub {
  border-top: 1px dashed var(--line-strong); background: var(--surface-sunken);
  padding: 12px 20px; display: flex; justify-content: space-between; gap: 10px;
  font-size: 13px; color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
