/* style.css */

@font-face {
  font-family: 'Geist';
  src: url('/fonts/Geist-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: 'GeistMono';
  src: url('/fonts/GeistMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: block;
}

/* ─── Variables ─────────────────────────────────────────── */
:root {
  --fs:      clamp(24px, 6vw, 38px);
  --fs-info: calc(var(--fs) / 3);

  --white:       #ffffff;
  --black:       #000000;
  --overlay-bg:  rgba(0, 0, 0, 0.10);   /* 10% darkening for archive overlay */

  --font-main: 'Geist', sans-serif;
  --font-mono: 'GeistMono', monospace;

  --pad: clamp(16px, 3vw, 32px);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;             /* Scroll handled in JS per collage */
  background: var(--black);
  font-family: var(--font-main);
  font-weight: 500;
  color: var(--white);
  -webkit-font-smoothing: antialiased;
}

/* ─── Collage Container ──────────────────────────────────── */
#collage-stack {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* Each collage occupies the full viewport */
.collage {
  position: absolute;
  inset: 0;
  display: grid;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.76, 0, 0.24, 1);
  will-change: transform, opacity;
}

/* Landscape: two vertical halves */
@media (orientation: landscape) {
  .collage { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
}

/* Portrait: two horizontal halves */
@media (orientation: portrait) {
  .collage { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
}

/* Blur & dim collage when archive is open */
.collage-blurred {
  filter: blur(6px) brightness(0.9);
  pointer-events: none;
  user-select: none;
}

/* ─── Individual image frame ─────────────────────────────── */
.frame {
  position: relative;
  overflow: hidden;
}

.frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* zoom and position set via inline style from JS */
}

/* ─── Info text per frame ────────────────────────────────── */
.frame-info {
  position: absolute;
  z-index: 2;
  line-height: 1.35;
  pointer-events: none;
}

/* Landscape: frame 1 → bottom-left; frame 2 → bottom-right */
@media (orientation: landscape) {
  .frame:first-child  .frame-info { bottom: var(--pad); left: var(--pad);  text-align: left; }
  .frame:last-child   .frame-info { bottom: var(--pad); right: var(--pad); text-align: right; }
}

/* Portrait: both frames → left-aligned, vertically centred */
@media (orientation: portrait) {
  .frame-info { left: var(--pad); top: 50%; transform: translateY(-50%); text-align: left; }
}

.frame-info p {
  font-size: var(--fs-info);
  font-family: var(--font-main);
  font-weight: 500;
  color: var(--white);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
  margin: 0;
  line-height: 1.5;
}

.frame-info p:not(:last-child) { margin-bottom: 0.25em; }

/* ─── DR0NE — centre label ───────────────────────────────── */
#drone-label {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  font-size: var(--fs);
  color: var(--white);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
  line-height: 1;
}

#drone-label .mono {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ─── Archive Overlay ────────────────────────────────────── */
#archive-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  display: none;
  padding: var(--pad);
  padding-top: calc(var(--pad) + var(--fs) + 24px);  /* below DR0NE */
}

#archive-overlay.open { display: block; }

/* Archive table */
#archive-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-info);
  color: var(--white);
}

#archive-table th {
  font-family: var(--font-main);
  font-weight: 500;
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  white-space: nowrap;
  letter-spacing: 0.03em;
  cursor: default;
}

#archive-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  vertical-align: top;
  cursor: pointer;
  transition: opacity 0.15s;
}

#archive-table td:hover { opacity: 0.65; }

#archive-table td.thumb { width: 48px; cursor: pointer; }

#archive-table td.thumb img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  display: block;
}

#archive-table tr.filtered-out { display: none; }

/* Active filter badge */
#filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-badge {
  font-size: var(--fs-info);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 2px 10px;
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
}

.filter-badge:hover { opacity: 0.7; }

/* Admin controls */
.admin-controls { margin-bottom: 16px; }

.btn {
  font-family: var(--font-main);
  font-weight: 500;
  font-size: var(--fs-info);
  color: var(--white);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 4px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.65; }
.btn + .btn { margin-left: 8px; }

/* ─── Upload / Login overlay ─────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
}

#modal-overlay.open { display: flex; }

.modal {
  width: min(480px, 90vw);
  padding: 32px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.6);
}

.modal h2 {
  font-size: var(--fs);
  font-weight: 500;
  margin-bottom: 24px;
}

.modal label {
  display: block;
  font-size: var(--fs-info);
  margin-bottom: 4px;
  opacity: 0.6;
}

.modal input,
.modal select,
.modal textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  color: var(--white);
  font-family: var(--font-main);
  font-weight: 500;
  font-size: var(--fs-info);
  padding: 6px 0;
  outline: none;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  border-color: rgba(255,255,255,0.8);
}

.modal select option { background: #111; }
.modal textarea { resize: vertical; min-height: 60px; }

.modal-error {
  font-size: var(--fs-info);
  color: rgba(255, 100, 100, 0.9);
  margin-bottom: 12px;
  min-height: 1.4em;
}

/* ─── Upload image preview ───────────────────────────────── */
#upload-preview-wrap {
  border: 1px solid rgba(255,255,255,0.15);
  margin-bottom: 20px;
  display: none;
}

#upload-preview-wrap.has-image { display: block; }

#upload-preview {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
}

/* ─── Utilities ──────────────────────────────────────────── */
.hidden { display: none !important; }
