/* ═══════════════════════════════════════════════════════════════════════════
   Valo — Minimalist Monochrome Design System
   Editorial black & white — no accent colors, no rounded corners, no shadows
═══════════════════════════════════════════════════════════════════════════ */

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

/* ── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Core — strictly monochrome */
  --bg:           #FFFFFF;
  --fg:           #000000;
  --muted:        #F5F5F5;
  --muted-fg:     #525252;
  --border:       #000000;
  --border-light: #E5E5E5;

  /* Legacy aliases — keep any var() in inline HTML working */
  --clr-bg:       #FFFFFF;
  --clr-surface:  #F5F5F5;
  --clr-surface2: #E5E5E5;
  --clr-accent:   #000000;
  --clr-accent2:  #000000;
  --clr-danger:   #000000;
  --clr-success:  #000000;
  --clr-text:     #000000;
  --clr-muted:    #525252;
  --radius:       0px;
  --radius-sm:    0px;
  --shadow:       none;
  --transition:   0.1s linear;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Source Serif 4', Georgia, serif;
  --font-mono:    'JetBrains Mono', monospace;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  min-height: 100svh;
  line-height: 1.625;
  /* Subtle paper texture */
  background-image:
    repeating-linear-gradient(
      0deg, transparent, transparent 1px, #000 1px, #000 2px
    );
  background-size: 100% 4px;
  background-attachment: fixed;
  /* Make texture extremely subtle */
  position: relative;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0.985;
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

a { color: var(--fg); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 900px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--fg);
  display: flex;
  align-items: center;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

/* ── Horizontal rules ───────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 4px solid var(--fg);
  margin: 2.5rem 0;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg);
  border: 1px solid var(--fg);
  padding: 1.5rem;
  border-radius: 0;
  box-shadow: none;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  background: var(--fg);
  color: var(--bg);
  border: 2px solid var(--fg);
  border-radius: 0;
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  box-shadow: none;
  min-height: 44px;
}
.btn:hover:not(:disabled) {
  background: var(--bg);
  color: var(--fg);
  text-decoration: none;
}
.btn:active { opacity: .8; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 3px;
}

/* Primary — solid black default */
.btn-primary {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.btn-primary:hover:not(:disabled) {
  background: var(--bg);
  color: var(--fg);
}

/* Secondary — outline */
.btn-secondary {
  background: var(--bg);
  color: var(--fg);
  border: 2px solid var(--fg);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--fg);
  color: var(--bg);
}

/* Danger — monochrome, still black */
.btn-danger {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.btn-danger:hover:not(:disabled) {
  background: var(--bg);
  color: var(--fg);
}

/* Ghost — understated text-link style */
.btn-ghost {
  background: transparent;
  color: var(--muted-fg);
  border-color: transparent;
  letter-spacing: 0;
  text-transform: none;
  font-size: .9rem;
}
.btn-ghost:hover:not(:disabled) {
  color: var(--fg);
  text-decoration: underline;
  background: transparent;
}

.btn-lg { padding: 1rem 2rem; font-size: .8rem; }
.btn-sm { padding: .4rem .9rem; font-size: .72rem; }
.btn-full { width: 100%; }

/* ── Form elements ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.5rem; }

label {
  display: block;
  margin-bottom: .5rem;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-fg);
  font-weight: 500;
}

input[type="text"] {
  width: 100%;
  padding: .6rem 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--fg);
  border-radius: 0;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.1rem;
  outline: none;
  transition: border-bottom-width var(--transition);
}
input[type="text"]::placeholder {
  color: var(--muted-fg);
  font-style: italic;
}
input[type="text"]:focus {
  border-bottom-width: 4px;
}
input[type="text"]:focus-visible {
  outline: none;
}
input[type="file"] { display: none; }

/* ── Hero (home page) ───────────────────────────────────────────────────── */
.hero {
  padding: 3.5rem 0 2.5rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 900;
  line-height: 1.0;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
  color: var(--fg);
}

.hero p {
  font-size: 1.05rem;
  color: var(--muted-fg);
  max-width: 480px;
  line-height: 1.7;
}

/* ── Create box ─────────────────────────────────────────────────────────── */
.create-box {
  max-width: 480px;
  padding-bottom: 1rem;
}

/* ── Feature grid ───────────────────────────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--fg);
  margin-top: 3rem;
  margin-bottom: 3rem;
}

.feature-card {
  padding: 1.25rem 1.1rem;
  cursor: default;
  transition: background var(--transition), color var(--transition);
}
/* Internal dividers — no double borders */
.feature-card:nth-child(odd)   { border-right: 1px solid var(--fg); }
.feature-card:nth-child(-n+2)  { border-bottom: 1px solid var(--fg); }

.feature-card:hover {
  background: var(--fg);
  color: var(--bg);
}
.feature-card:hover .feature-label,
.feature-card:hover p { color: rgba(255,255,255,.65); }

.feature-label {
  display: block;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-fg);
  margin-bottom: .4rem;
  transition: color var(--transition);
}

.feature-card p {
  font-size: .88rem;
  color: var(--fg);
  line-height: 1.45;
  transition: color var(--transition);
}

/* ── Event header (gallery page) ────────────────────────────────────────── */
.event-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 4px solid var(--fg);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.event-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.event-meta {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: .6rem;
}

.header-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  border: 1px solid var(--fg);
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg);
  background: transparent;
}

.badge-active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.badge-closed {
  background: transparent;
  color: var(--muted-fg);
  border-color: var(--border-light);
}

.badge-count {
  background: transparent;
  color: var(--muted-fg);
  border-color: var(--border-light);
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 0;
  background: currentColor;
  flex-shrink: 0;
}

/* ── Admin bar ──────────────────────────────────────────────────────────── */
.admin-bar {
  background: var(--fg);
  color: var(--bg);
  border: none;
  border-radius: 0;
  padding: .8rem 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}

.admin-bar > span {
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.75);
  font-weight: 500;
}

.admin-actions { display: flex; gap: .5rem; }

/* Buttons inside the inverted admin bar */
.admin-bar .btn {
  background: transparent;
  color: var(--bg);
  border: 1px solid rgba(255,255,255,.35);
  font-size: .7rem;
}
.admin-bar .btn:hover:not(:disabled) {
  background: var(--bg);
  color: var(--fg);
  border-color: var(--bg);
}

/* ── Upload area (sticky bottom) ────────────────────────────────────────── */
.upload-area {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: .9rem 0 calc(1.1rem + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  border-top: 2px solid var(--fg);
  pointer-events: none;
}
.upload-area > * { pointer-events: auto; }

.upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}

/* Button pair container */
.capture-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: 100%;
  max-width: 420px;
}
.capture-actions > * {
  width: 100%;
  min-width: 0;
}

/* The primary capture CTA — bold black rectangle */
.capture-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: .85rem 2.5rem;
  background: var(--fg);
  border: 2px solid var(--fg);
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  color: var(--bg);
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: none;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-height: 52px;
}
.capture-btn:hover:not(.closed) {
  background: var(--bg);
  color: var(--fg);
}
.capture-btn:active { opacity: .8; }
.capture-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 1.5;
}
.capture-btn.closed {
  background: transparent;
  color: var(--muted-fg);
  border-color: var(--border-light);
  cursor: not-allowed;
}
.capture-btn:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 3px;
}

/* Gallery variant — <label> styled as outlined button */
.capture-btn--gallery {
  background: var(--bg);
  color: var(--fg);
  margin: 0 0 0 -2px;        /* remove label margins and overlap the shared border */
  padding-inline: 1.4rem;
  /* Override label defaults */
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.capture-btn--gallery:hover:not(.closed) {
  background: var(--fg);
  color: var(--bg);
}
.capture-btn--gallery.closed {
  cursor: not-allowed;
}

/* Upload preview panel */
.upload-preview {
  display: none;
  background: var(--bg);
  border: 1px solid var(--fg);
  border-radius: 0;
  padding: 1rem;
  width: 100%;
  max-width: 480px;
  box-shadow: none;
}
.upload-preview.visible { display: block; }

.preview-img-wrap {
  border-radius: 0;
  overflow: hidden;
  max-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fg);
  margin-bottom: .75rem;
}
.preview-img-wrap img {
  max-width: 100%;
  max-height: 220px;
  display: block;
  object-fit: contain;
}

.preview-form { display: flex; flex-direction: column; gap: .5rem; }
.preview-actions { display: flex; gap: .5rem; }
.preview-actions .btn { flex: 1; }

/* Progress bar */
.upload-progress {
  display: none;
  height: 2px;
  background: var(--border-light);
  border-radius: 0;
  overflow: hidden;
  margin-top: .5rem;
}
.upload-progress.visible { display: block; }
.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--fg);
  transition: width .15s linear;
}

/* ── Photo gallery ──────────────────────────────────────────────────────── */
.gallery-empty {
  text-align: center;
  padding: 5rem 1rem;
  color: var(--muted-fg);
  border: 1px solid var(--border-light);
  margin-bottom: 1rem;
}
.gallery-empty svg { opacity: .2; margin-bottom: 1.25rem; }
.gallery-empty p { font-size: 1rem; }

/* Contact-sheet grid — light gaps between photos */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  background: var(--border-light);
  padding-bottom: 100px;
}
@media (min-width: 480px) {
  .photo-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 700px) {
  .photo-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 900px) {
  .photo-grid { grid-template-columns: repeat(5, 1fr); }
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: var(--muted);
  border-radius: 0;
  animation: fadeIn .2s linear;
}
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .15s linear;
}
.photo-item:hover img,
.photo-item:focus img { transform: scale(1.04); }

.photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  opacity: 0;
  transition: opacity var(--transition);
  display: flex;
  align-items: flex-end;
  padding: .45rem .55rem;
}
.photo-item:hover .photo-overlay,
.photo-item:focus .photo-overlay { opacity: 1; }

.photo-name {
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--fg);
  border: none;
  border-radius: 0;
  color: var(--bg);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .95rem;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 2;
}
.photo-item:hover .delete-btn { opacity: 1; }
.delete-btn:hover { background: #222; }

/* ── Lightbox ────────────────────────────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.lightbox.open {
  display: flex;
  animation: fadeIn .1s linear;
}

.lightbox-img {
  max-width: 100%;
  max-height: 90svh;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  border: 1px solid #333;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 0;
  color: #fff;
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), background var(--transition);
}
.lightbox-close:hover { border-color: #fff; background: rgba(255,255,255,.08); }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 0;
  color: #fff;
  width: 48px;
  height: 48px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), background var(--transition);
}
.lightbox-nav:hover { border-color: #fff; background: rgba(255,255,255,.08); }
.lightbox-prev { left: .75rem; }
.lightbox-next { right: .75rem; }

.lightbox-info {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
}

.lightbox-counter {
  font-family: var(--font-mono);
  color: rgba(255,255,255,.45);
  font-size: .7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lightbox-uploader {
  color: rgba(255,255,255,.75);
  font-family: var(--font-body);
  font-size: .85rem;
  font-style: italic;
}

.lightbox-download {
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 0;
  color: rgba(255,255,255,.7);
  padding: .35rem 1rem;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.lightbox-download:hover { border-color: #fff; color: #fff; }

/* ── Toast notifications ─────────────────────────────────────────────────── */
.toasts {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: .4rem;
  z-index: 200;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 2rem);
}

.toast {
  padding: .55rem 1.1rem;
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: toastIn .1s linear;
  pointer-events: auto;
}
/* All states are monochrome — copy status symbol communicates the type */
.toast-success,
.toast-error,
.toast-info { background: var(--fg); border-color: var(--fg); }

/* ── Result box (after event creation) ──────────────────────────────────── */
.result-box { display: none; margin-top: 1.5rem; }
.result-box.visible { display: block; }

.result-field {
  display: flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid var(--fg);
  border-radius: 0;
  background: var(--bg);
  padding: .6rem 1rem;
  margin-bottom: .75rem;
  word-break: break-all;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--fg);
}
.result-field span { flex: 1; }

.copy-btn {
  background: none;
  border: none;
  color: var(--muted-fg);
  cursor: pointer;
  padding: .2rem;
  flex-shrink: 0;
  transition: color var(--transition);
}
.copy-btn:hover { color: var(--fg); }

.result-label {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-fg);
  margin-bottom: .4rem;
}

.result-warning {
  border-left: 4px solid var(--fg);
  padding: .65rem .9rem;
  font-size: .88rem;
  font-style: italic;
  color: var(--fg);
  background: var(--muted);
  margin-top: .5rem;
  line-height: 1.5;
}

/* ── Spinner ────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile overrides ───────────────────────────────────────────────────── */
@media (max-width: 479px) {
  /* Header action buttons — icon-only so they stay on the same row as the title */
  .header-actions .btn-text { display: none; }
  .header-actions .btn-sm   { padding: .4rem .65rem; }

  /* Lightbox — swipe already works, arrows just crowd the image */
  .lightbox-nav { display: none; }
}

/* ── Utility classes ────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}
.hidden { display: none !important; }
.mt-1 { margin-top: .75rem; }
.mt-2 { margin-top: 1.5rem; }
.text-muted { color: var(--muted-fg); font-size: .9rem; }
