/* ============================================================
   smugmug_console.css  —  SmugMug Test Console
   ============================================================ */

:root {
  --bg:           #080a0e;
  --surface:      #0e1117;
  --card:         #13171f;
  --border:       #1e2433;
  --border2:      #2a3147;
  --text:         #c8d0e0;
  --muted:        #4a5568;
  --accent:       #c8a96e;
  --accent2:      #7c9cbf;
  --danger:       #c06060;
  --success:      #6aaa8a;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-mono:    'DM Mono', monospace;
  --radius:       6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background:  var(--bg);
  color:       var(--text);
  font-family: var(--font-mono);
  font-size:   13px;
  font-weight: 300;
  line-height: 1.6;
  min-height:  100vh;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
  opacity: .5;
}

/* ── Layout ── */
.shell { max-width: 1280px; margin: 0 auto; padding: 0 2rem 6rem; position: relative; z-index: 2; }

/* ── Header ── */
header {
  padding: 3.5rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3.5rem;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
}
.header-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  font-weight: 300; letter-spacing: -0.01em;
  color: #e8dfc8; line-height: 1.1;
}
.header-title span { color: var(--accent); font-style: italic; }
.header-meta { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; text-align: right; }

.dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--success);
  margin-right: .4rem; animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

/* ── Sections ── */
.section { margin-bottom: 4rem; }
.section-label { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.section-num   { font-family: var(--font-display); font-size: 3.5rem; font-weight: 300; color: var(--border2); line-height: 1; font-style: italic; }
.section-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 400; color: #d4c9ae; letter-spacing: .01em; }
.section-sub   { font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.section-divider { border: none; border-top: 1px solid var(--border); margin-bottom: 2rem; }

/* ── Inputs ── */
.input-row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.input-field {
  flex: 1; min-width: 280px;
  background: var(--surface); border: 1px solid var(--border2); border-radius: 4px;
  color: var(--text); font-family: var(--font-mono); font-size: 12px;
  padding: .65rem 1rem; transition: border-color .2s; outline: none;
}
.input-field:focus        { border-color: var(--accent); }
.input-field::placeholder { color: var(--muted); }

/* ── Buttons ── */
.btn           { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: .65rem 1.4rem; border-radius: 4px; border: none; cursor: pointer; transition: all .2s; white-space: nowrap; }
.btn-gold      { background: var(--accent); color: #0a0a0a; font-weight: 400; }
.btn-gold:hover    { background: #d9bb80; }
.btn-gold:disabled { opacity: .4; cursor: wait; }
.btn-ghost         { background: transparent; border: 1px solid var(--border2); color: var(--muted); }
.btn-ghost:hover   { border-color: var(--accent); color: var(--accent); }

/* ── Status bar ── */
.status-bar         { font-size: 11px; padding: .5rem .85rem; border-radius: 3px; margin-bottom: 1.5rem; display: none; letter-spacing: .04em; }
.status-bar.loading { display:block; background: #0e1625; border: 1px solid #1e3050; color: var(--accent2); }
.status-bar.error   { display:block; background: #1a0e0e; border: 1px solid #3a1a1a; color: var(--danger); }
.status-bar.ok      { display:block; background: #0e1a14; border: 1px solid #1a3a28; color: var(--success); }

/* ── Gallery grid ── */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }

/* ── Album card ── */
@keyframes fadeUp {
  from { opacity:0; transform: translateY(12px); }
  to   { opacity:1; transform: translateY(0); }
}
.album-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color .2s, transform .2s;
  animation: fadeUp .35s ease both;
}
.album-card:hover { border-color: var(--border2); transform: translateY(-2px); }

.album-thumb { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--surface); }
.album-thumb-placeholder {
  width: 100%; aspect-ratio: 4/3; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--border2); gap: .5rem;
}
.album-thumb-placeholder svg  { opacity: .35; }
.album-thumb-placeholder span { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; opacity: .5; }
.album-body  { padding: 1rem; }
.album-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 400; color: #d4c9ae; margin-bottom: .3rem; line-height: 1.3; }
.album-date  { font-size: 10px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: .5rem; }
.album-desc  { font-size: 11.5px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.album-footer { padding: .75rem 1rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.album-key    { font-size: 10px; color: var(--border2); letter-spacing: .04em; }
.album-link   { font-size: 10px; color: var(--accent2); text-decoration: none; letter-spacing: .06em; text-transform: uppercase; }
.album-link:hover { color: var(--accent); }

.source-badge  { display: inline-block; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 99px; margin-left: .5rem; }
.source-api    { background: #0e2a1e; color: var(--success); border: 1px solid #1a4030; }
.source-oembed { background: #1a2030; color: var(--accent2); border: 1px solid #2a3550; }
.source-og     { background: #2a1a10; color: #c8905a; border: 1px solid #3a2818; }

/* ── Load more ── */
.load-more-row   { text-align: center; margin-top: 2rem; }
.pagination-info { font-size: 11px; color: var(--muted); letter-spacing: .04em; margin-bottom: 1rem; }

/* ── Image grid ── */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.image-card {
  position: relative; background: var(--card); border: 1px solid var(--border);
  border-radius: 4px; overflow: hidden;
  animation: fadeUp .3s ease both; transition: border-color .2s;
  cursor: pointer;
}
.image-card:hover { border-color: var(--border2); }
.image-thumb  { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--surface); }
.image-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  padding: 1.5rem .6rem .6rem; opacity: 0; transition: opacity .2s;
}
.image-card:hover .image-overlay { opacity: 1; }
.image-caption    { font-size: 10px; color: #e0d8c8; line-height: 1.4; margin-bottom: .3rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.image-actions    { display: flex; gap: .5rem; }
.image-action-btn { font-size: 9px; letter-spacing: .06em; text-transform: uppercase; padding: .2rem .5rem; border-radius: 2px; border: 1px solid rgba(200,169,110,.4); color: var(--accent); background: rgba(200,169,110,.08); text-decoration: none; cursor: pointer; }
.image-action-btn:hover { background: rgba(200,169,110,.2); }

/* ── Album result (Section 02) ── */
.album-result-card        { background: var(--card); border: 1px solid var(--border2); border-radius: var(--radius); overflow: hidden; display: flex; animation: fadeUp .3s ease both; max-width: 640px; }
.album-result-thumb       { width: 180px; min-height: 135px; object-fit: cover; flex-shrink: 0; background: var(--surface); }
.album-result-placeholder { width: 180px; min-height: 135px; flex-shrink: 0; background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--border2); opacity: .4; }
.album-result-body        { padding: 1.25rem; flex: 1; }
.album-result-title       { font-family: var(--font-display); font-size: 1.2rem; font-weight: 400; color: #d4c9ae; margin-bottom: .4rem; }
.album-result-meta        { font-size: 10px; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; margin-bottom: .6rem; }
.album-result-desc        { font-size: 12px; color: var(--muted); line-height: 1.5; }
.album-key-pill           { display: inline-block; font-size: 10px; background: var(--surface); border: 1px solid var(--border2); border-radius: 3px; padding: .2rem .6rem; color: var(--accent2); margin-top: .75rem; cursor: pointer; letter-spacing: .03em; }
.album-key-pill:hover     { border-color: var(--accent2); }

/* ── Tabs ── */
.tab-row { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  padding: .6rem 1.2rem; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; border-top: none; border-left: none; border-right: none;
  transition: color .2s;
}
.tab.active             { color: var(--accent); border-bottom-color: var(--accent); }
.tab:hover:not(.active) { color: var(--text); }
.tab-panel              { display: none; }
.tab-panel.active       { display: block; }

/* ── Empty state ── */
.empty-state       { text-align: center; padding: 4rem 2rem; color: var(--border2); }
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p     { font-size: 12px; letter-spacing: .05em; }

/* ── Scrollbar ── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ════════════════════════════════════════════════════════════
   LIGHTBOX — plain div overlay, dead simple, no browser quirks
   ════════════════════════════════════════════════════════════ */

/* Hidden by default */
#lb {
  display:         none;
  position:        fixed;
  inset:           0;
  z-index:         9999;
  align-items:     center;
  justify-content: center;
}

/* Visible when .lb-open is added by JS */
#lb.lb-open {
  display: flex;
}

/* Dark backdrop — clicking it closes the lightbox */
#lb-backdrop {
  position:   absolute;
  inset:      0;
  background: rgba(0, 0, 0, 0.93);
  z-index:    0;
}

/* The image — sits above backdrop */
.lb-img {
  position:      relative;
  z-index:       1;
  display:       block;
  max-width:     92vw;
  max-height:    88vh;
  width:         auto;
  height:        auto;
  object-fit:    contain;
  box-shadow:    0 8px 60px rgba(0,0,0,.9);
  border-radius: 2px;
  user-select:   none;
  transition:    opacity 0.18s ease;
}
.lb-img.fading { opacity: 0; }

/* Close button */
.lb-close {
  position:        fixed;
  top:             1rem;
  right:           1rem;
  z-index:         10000;
  width:           2.5rem;
  height:          2.5rem;
  border-radius:   50%;
  border:          1px solid rgba(255,255,255,.25);
  background:      rgba(255,255,255,.12);
  color:           #fff;
  font-size:       1.1rem;
  cursor:          pointer;
  display:         flex;
  align-items:     center;
  justify-content: center;
  transition:      background .15s;
  line-height:     1;
}
.lb-close:hover { background: rgba(255,255,255,.28); }

/* Prev / Next */
.lb-prev,
.lb-next {
  position:        fixed;
  top:             50%;
  transform:       translateY(-50%);
  z-index:         10000;
  width:           3rem;
  height:          5rem;
  border-radius:   4px;
  border:          1px solid rgba(255,255,255,.15);
  background:      rgba(255,255,255,.1);
  color:           #fff;
  font-size:       2.5rem;
  line-height:     1;
  cursor:          pointer;
  display:         flex;
  align-items:     center;
  justify-content: center;
  transition:      background .15s;
  user-select:     none;
}
.lb-prev { left:  .5rem; }
.lb-next { right: .5rem; }
.lb-prev:hover,
.lb-next:hover { background: rgba(255,255,255,.25); }

/* Caption + counter */
.lb-footer {
  position:       fixed;
  bottom:         1.25rem;
  left:           50%;
  transform:      translateX(-50%);
  z-index:        10000;
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            .3rem;
  pointer-events: none;
  text-align:     center;
}
.lb-caption {
  color:         rgba(255,255,255,.75);
  font-size:     13px;
  max-width:     80vw;
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
}
.lb-counter {
  font-family:    monospace;
  font-size:      11px;
  letter-spacing: .08em;
  color:          rgba(255,255,255,.4);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .album-result-card { flex-direction: column; }
  .album-result-thumb,
  .album-result-placeholder { width: 100%; min-height: 180px; }
  .input-row   { flex-direction: column; }
  .input-field { min-width: 0; width: 100%; }
  .lb-prev,
  .lb-next { width: 2.5rem; font-size: 1.8rem; }
}