/* ==========================================================================
   Balgan — photography portfolio
   A quiet, light gallery: the photographs carry all the colour.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
  --paper:       #ffffff;
  --paper-2:     #fafaf9;
  --paper-3:     #f4f4f2;
  --ink:         #16150f;
  --ink-2:       #55534c;
  --ink-3:       #8b8880;
  --line:        #e6e4df;
  --line-2:      #d5d2cb;
  --accent:      #16150f;
  --danger:      #b4433a;
  --ok:          #4a7c59;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --gap: 4px;
  --page-max: 1180px;
  --radius: 4px;
}

/* The gallery is deliberately light in every environment: photographs are
   graded against white, and a viewer's OS theme shouldn't restage them. */
:root { color-scheme: light; }

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }

/* ============================ layout ============================ */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 20px 80px;
}

.site-header {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 40px 20px 28px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.site-title {
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  gap: 22px;
  font-size: 13px;
  color: var(--ink-2);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a.active { color: var(--ink); font-weight: 500; }

.site-tagline {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 20px 36px;
  font-size: 17px;
  color: var(--ink-2);
  font-weight: 300;
  max-width: 720px;
}

/* ============================ profile header ============================ */

.profile {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 32px 20px 26px;
  display: grid;
  grid-template-columns: 220px 1fr;
  /* Row 1 is the handle and counts, row 2 the name and bio. The avatar spans
     both so its height never opens a gap between them. */
  grid-template-rows: auto auto;
  column-gap: 40px;
  row-gap: 10px;
  align-items: start;
  align-content: start;
}

.profile-avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper-3);
  justify-self: center;
  border: 1px solid var(--line);
  grid-row: 1 / span 2;
}

.profile-avatar-blank {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  font-weight: 300;
  color: var(--ink-3);
}

.profile-body { min-width: 0; padding-top: 6px; }

/* Sits under the handle/stats on desktop, full width under the avatar row on
   mobile — the layout Instagram uses at each size. */
.profile-identity { grid-column: 2; grid-row: 2; min-width: 0; }

.profile-top {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.profile-handle {
  font-size: 21px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.profile-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 16px;
  font-size: 15px;
  color: var(--ink-2);
}
.profile-stats b { color: var(--ink); font-weight: 600; }

.profile-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 3px;
}

.profile-bio {
  font-size: 15px;
  color: var(--ink-2);
  white-space: pre-wrap;
  max-width: 62ch;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 9px;
  font-size: 14px;
  color: var(--ink-3);
  align-items: center;
}

.profile-link {
  color: var(--ink);
  font-weight: 500;
}
.profile-link:hover { text-decoration: underline; }

/* ============================ highlights ============================ */

.highlights {
  display: flex;
  gap: 26px;
  overflow-x: auto;
  padding: 4px 20px 30px;
  max-width: var(--page-max);
  margin: 0 auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.highlights::-webkit-scrollbar { display: none; }

.highlight {
  flex: 0 0 auto;
  width: 92px;
  text-align: center;
  cursor: pointer;
  background: none;
  border: none;
}

.highlight-ring {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  padding: 3px;
  border: 1px solid var(--line-2);
  transition: border-color 0.18s ease, transform 0.18s ease;
  background: var(--paper);
}
.highlight:hover .highlight-ring { border-color: var(--ink); transform: translateY(-2px); }

.highlight-ring img,
.highlight-ring .highlight-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper-3);
}

.highlight-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  font-size: 22px;
  font-weight: 300;
}

.highlight-label {
  margin-top: 9px;
  font-size: 12px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================ photo grid ============================ */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--paper-3);
  cursor: pointer;
  border: none;
  padding: 0;
  display: block;
  width: 100%;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.5s ease;
}
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.03); }

.tile-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 2px;
}

/* ============================ lightbox ============================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(12, 12, 11, 0.97);
  display: flex;
  flex-direction: column;
  animation: fade 0.18s ease;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 64px 12px;
  min-height: 0;
  position: relative;
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  z-index: 2;
}
.lightbox-close:hover,
.lightbox-nav:hover { color: #fff; }

.lightbox-close {
  top: 14px;
  right: 16px;
  width: 40px;
  height: 40px;
  font-size: 26px;
  line-height: 1;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 72px;
  font-size: 30px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 3px;
}
.lightbox-nav.prev { left: 10px; }
.lightbox-nav.next { right: 10px; }

.lightbox-bar {
  flex: 0 0 auto;
  padding: 14px 24px 26px;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  flex-wrap: wrap;
}

.lightbox-meta { min-width: 0; }
.lightbox-title { font-size: 15px; color: #fff; font-weight: 500; margin-bottom: 3px; }
.lightbox-caption { font-size: 13px; color: rgba(255, 255, 255, 0.66); max-width: 620px; }

.lightbox-exif {
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  text-transform: uppercase;
}

.lightbox-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

.btn-full {
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: rgba(255, 255, 255, 0.92);
  padding: 8px 15px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 2px;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-full:hover { background: #fff; color: #111; border-color: #fff; }
.btn-full:disabled { opacity: 0.55; cursor: default; }

.lightbox-loading {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

/* ============================ buttons & forms ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover:not(:disabled) { opacity: 0.86; }
.btn-danger { color: var(--danger); border-color: var(--line-2); }
.btn-danger:hover:not(:disabled) { border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.input, .textarea, select.input {
  width: 100%;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus, .textarea:focus { border-color: var(--ink); }
.textarea { resize: vertical; min-height: 76px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

/* ============================ states ============================ */

.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-3);
}
.empty h3 { font-size: 16px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.empty p { font-size: 14px; }

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line-2);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

/* ============================ toast ============================ */

.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 500;
  pointer-events: none;
  width: min(420px, calc(100vw - 32px));
}

.toast {
  background: var(--ink);
  color: var(--paper);
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  animation: toast-in 0.2s ease;
  pointer-events: auto;
}
.toast-error { background: var(--danger); color: #fff; }
.toast.removing { animation: toast-out 0.18s ease forwards; }

@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* ============================ admin map picker ============================ */

.maplink-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.maplink-status {
  font-size: 12px;
  color: var(--ink-3);
  min-height: 15px;
}
.maplink-status.ok { color: var(--ok); }
.maplink-status.bad { color: var(--danger); }

.mappicker { margin-top: 4px; }

/* The location modal earns extra width: every pixel is precision. */
.modal.modal-wide { max-width: 720px; }

.mappicker-canvas {
  width: 100%;
  display: block;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #0f1620;
}

.mappicker-readout {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.mappicker-coords {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.mappicker-coords .input { width: 130px; }
.mappicker-source {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 8px;
}

/* ============================ explore globe ============================ */

.explore {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 20px 40px;
}

.globe-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0 16px;
}

.explore-chip {
  padding: 7px 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.explore-chip:hover { border-color: var(--ink); color: var(--ink); }
.explore-chip.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* The globe sits on its own dark field — the one place the site goes black,
   so the photographs read as the only light source. */
.globe-stage {
  position: relative;
  width: 100%;
  height: min(72vh, 720px);
  min-height: 380px;
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 40%, #101a26 0%, #080b11 55%, #05070a 100%);
  touch-action: none;
  cursor: grab;
}
.globe-stage canvas { display: block; width: 100% !important; height: 100% !important; }

.globe-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}
.globe-loading .spinner {
  border-color: rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.75);
}

.globe-stage .empty { color: rgba(255, 255, 255, 0.66); }
.globe-stage .empty h3 { color: rgba(255, 255, 255, 0.9); }
.globe-stage .empty p {
  color: rgba(255, 255, 255, 0.55);
  max-width: 460px;
  margin: 0 auto; /* the .empty block centres text, but not a constrained box */
}
.globe-stage .empty .btn {
  margin-top: 20px;
  border-color: rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
}
.globe-stage .empty .btn:hover { border-color: #fff; }

/* Stacks of overlapping photographs ------------------------------------- */

.globe-badges {
  position: absolute;
  inset: 0;
  pointer-events: none; /* only the badges themselves take clicks */
}

.globe-badge {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  border: 1px solid rgba(255, 214, 160, 0.65);
  background: rgba(20, 16, 12, 0.82);
  color: #ffd9a0;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s, transform 0.15s, color 0.15s;
}
.globe-badge:hover {
  background: #ffd9a0;
  color: #14100c;
  transform: translate(-50%, -50%) scale(1.12);
}

.globe-stack {
  position: absolute;
  z-index: 5;
  background: rgba(12, 14, 18, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
  padding: 10px;
  animation: fade 0.14s ease;
}

.globe-stack-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  margin-bottom: 8px;
}
.globe-stack-close {
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
}
.globe-stack-close:hover { color: #fff; }

.globe-stack-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  max-height: 190px;
  overflow-y: auto;
}

.globe-stack-tile {
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  background: #000;
  aspect-ratio: 1;
}
.globe-stack-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.globe-stack-tile:hover { border-color: #ffd9a0; }

.globe-stack-zoom {
  width: 100%;
  margin-top: 8px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11.5px;
  cursor: pointer;
}
.globe-stack-zoom:hover { border-color: #fff; color: #fff; }

.globe-readout {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 12px 2px 0;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-3);
}
.globe-count { color: var(--ink-2); }

/* Hover card, positioned against the cursor in JS. */
.globe-card {
  position: fixed;
  z-index: 60;
  width: 220px;
  background: rgba(12, 14, 18, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
  pointer-events: none;
}
.globe-card.visible { opacity: 1; transform: translateY(0); }
.globe-card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.globe-card-body { padding: 10px 12px 12px; }
.globe-card-title {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 3px;
}
.globe-card-coords {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.globe-card-meta { color: rgba(255, 255, 255, 0.42); font-size: 11px; margin-top: 3px; }

/* Home-page entry point. */
.explore-cta {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 20px 22px;
}
.explore-cta a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--ink);
  transition: all 0.15s;
}
.explore-cta a:hover { border-color: var(--ink); background: var(--paper-2); }
.explore-cta svg { width: 16px; height: 16px; opacity: 0.75; }

@media (max-width: 640px) {
  .explore { padding: 0 0 32px; }
  .globe-filters { padding: 4px 16px 12px; }
  .globe-stage { height: 62vh; border-radius: 0; }
  .globe-readout { padding: 12px 16px 0; }
  .globe-card { width: 180px; }
  .explore-cta { padding: 0 16px 18px; }
}

/* ============================ about ============================ */

.about {
  max-width: 640px;
  padding-top: 8px;
}
.about p { color: var(--ink-2); margin-bottom: 16px; white-space: pre-wrap; }
.about-links { display: flex; gap: 18px; margin-top: 26px; font-size: 13px; }
.about-links a { color: var(--ink-2); border-bottom: 1px solid var(--line-2); padding-bottom: 2px; }
.about-links a:hover { color: var(--ink); border-color: var(--ink); }

/* ============================ footer ============================ */

.site-footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 34px 20px 44px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--ink-3);
  flex-wrap: wrap;
}
.site-footer a:hover { color: var(--ink-2); }

/* ============================ admin ============================ */

.admin-bar {
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  position: sticky;
  top: 0;
  z-index: 40;
}
.admin-bar-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.admin-bar-title { font-weight: 600; font-size: 14px; margin-right: 4px; }
.admin-tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.admin-tab {
  padding: 6px 13px;
  font-size: 13px;
  color: var(--ink-2);
  border-radius: var(--radius);
}
.admin-tab:hover { background: var(--paper-3); color: var(--ink); }
.admin-tab.active { background: var(--ink); color: var(--paper); }

.admin-section { padding-top: 26px; }
.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.admin-section-head h2 { font-size: 18px; font-weight: 500; }
.admin-hint { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }

.dropzone {
  border: 1.5px dashed var(--line-2);
  border-radius: 6px;
  padding: 34px 20px;
  text-align: center;
  color: var(--ink-2);
  transition: all 0.18s;
  cursor: pointer;
  margin-bottom: 24px;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--ink); background: var(--paper-2); }
.dropzone strong { display: block; font-size: 15px; color: var(--ink); margin-bottom: 5px; font-weight: 500; }
.dropzone span { font-size: 12.5px; }

.upload-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--paper-2);
}
.upload-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-status { font-size: 12px; color: var(--ink-3); flex-shrink: 0; }
.upload-status.done { color: var(--ok); }
.upload-status.failed { color: var(--danger); }

.progress-track {
  width: 90px;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.progress-fill { height: 100%; background: var(--ink); transition: width 0.2s; }

/* admin grid: draggable tiles */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.admin-tile {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-2);
  cursor: grab;
  transition: border-color 0.15s, opacity 0.15s;
}
.admin-tile:hover { border-color: var(--line-2); }
.admin-tile.dragging { opacity: 0.35; cursor: grabbing; }
.admin-tile.drop-target { border-color: var(--ink); }
.admin-tile.selected { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.admin-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.admin-tile.unpublished img { opacity: 0.4; }

.admin-tile-actions {
  display: flex;
  gap: 6px;
  padding: 7px 8px;
  border-top: 1px solid var(--line);
  align-items: center;
  font-size: 11.5px;
}
.admin-tile-actions button { color: var(--ink-2); font-size: 11.5px; }
.admin-tile-actions button:hover { color: var(--ink); }
.admin-tile-actions .danger:hover { color: var(--danger); }

.admin-order-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 2px;
}

.admin-flag {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.highlight-editor {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 26px;
  align-items: start;
}

.highlight-list { display: flex; flex-direction: column; gap: 6px; }
.highlight-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s;
  background: var(--paper);
}
.highlight-item:hover { border-color: var(--line-2); }
.highlight-item.active { border-color: var(--ink); background: var(--paper-2); }
.highlight-item.dragging { opacity: 0.4; }
.highlight-item img,
.highlight-item .highlight-item-blank {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper-3);
  flex-shrink: 0;
}
.highlight-item-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.highlight-item-count { font-size: 11px; color: var(--ink-3); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 18, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 300;
  animation: fade 0.15s ease;
}
.modal {
  background: var(--paper);
  border-radius: 6px;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h3 { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 340px; }
.login-card h1 { font-size: 20px; font-weight: 500; margin-bottom: 4px; }
.login-card p.sub { font-size: 13px; color: var(--ink-3); margin-bottom: 24px; }

/* ============================ responsive ============================ */

@media (max-width: 900px) {
  .highlight-editor { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  /* Instagram's mobile profile: small avatar and stats side by side, then
     name and bio full width underneath. */
  .profile {
    grid-template-columns: 88px 1fr;
    gap: 20px;
    padding: 20px 16px;
  }
  .profile-avatar { width: 88px; height: 88px; }
  .profile-avatar-blank { font-size: 32px; }
  .profile-body { padding-top: 0; }
  .profile-top { margin-bottom: 12px; }
  .profile-handle { font-size: 18px; }
  .profile-stats {
    gap: 22px;
    font-size: 13.5px;
    margin-bottom: 0;
  }
  .profile-avatar { grid-row: 1; }
  .profile-identity {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 4px;
  }
  .profile-bio, .profile-name { font-size: 14px; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }

  .site-header { padding: 24px 16px 18px; }
  .site-title { font-size: 24px; }
  .site-nav { gap: 16px; font-size: 12.5px; }
  .site-tagline { padding: 0 16px 26px; font-size: 15px; }
  .page { padding: 0 0 60px; }
  .highlights { gap: 18px; padding: 4px 16px 24px; }
  .highlight { width: 76px; }
  .highlight-ring { width: 70px; height: 70px; }
  .highlight-label { font-size: 11px; }

  .grid { gap: 2px; }

  .lightbox-stage { padding: 48px 8px 8px; }
  .lightbox-nav { width: 42px; height: 60px; font-size: 24px; background: rgba(0,0,0,0.3); }
  .lightbox-bar { padding: 12px 16px 22px; gap: 12px; }
  .lightbox-caption { font-size: 12.5px; }

  .site-footer { padding: 26px 16px 36px; }
  .admin-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .admin-section { padding: 20px 16px 0; }
  .modal { max-width: 100%; }
}

/* Respect users who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
