/* ==========================================================================
   Carl Halal Studio — Editorial Minimalist Design System
   Dark mode default (#0A0A0A) · Optional Light mode (#FAFAFA)
   ========================================================================== */

:root {
  --bg: #0a0a0a;
  --bg-elevated: #121212;
  --bg-subtle: #181818;
  --fg: #f5f5f3;
  --fg-muted: #9a9a95;
  --fg-faint: #5e5e5a;
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.24);
  --accent: #ffffff;
  --accent-fg: #0a0a0a;
  --danger: #e05252;
  --success: #52c27d;
  --warning: #d4a017;
  --radius: 2px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --max-width: 1360px;
}

body.theme-light {
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-subtle: #f1f1ef;
  --fg: #101010;
  --fg-muted: #666662;
  --fg-faint: #9e9e99;
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.24);
  --accent: #0a0a0a;
  --accent-fg: #fafafa;
  --warning: #a67c00;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

img, video {
  display: block;
  max-width: 100%;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

/* Header / Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
}

.brand-sep {
  width: 1px;
  height: 14px;
  background: var(--border-strong);
}

.brand-sub {
  color: var(--fg-muted);
  font-weight: 400;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.nav-links a:hover,
.nav-links button:hover {
  color: var(--fg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--fg);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, opacity 150ms ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  border-color: var(--fg);
  background: var(--bg-subtle);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, var(--bg));
  color: var(--accent-fg);
  border-color: var(--accent);
}

.btn-ghost {
  border-color: transparent;
  padding: 8px 12px;
}

.btn-ghost:hover:not(:disabled) {
  border-color: transparent;
  background: var(--bg-subtle);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 11px;
}

.btn-danger {
  border-color: rgba(224, 82, 82, 0.4);
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  border-color: var(--danger);
  background: rgba(224, 82, 82, 0.12);
}

/* Container & Layout */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.muted {
  color: var(--fg-muted);
}

/* Hero (Showcase & Transfer Cover) */
.hero {
  position: relative;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.hero-cover-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.24;
  filter: saturate(0.85);
  transform: scale(1.02);
}

body.theme-light .hero-cover-bg {
  opacity: 0.14;
}

.hero-cover-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 100%);
}

.hero-inner {
  position: relative;
  z-index: 2;
  padding-top: 72px;
  padding-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.hero-title {
  margin: 0;
  font-size: clamp(28px, 4.4vw, 52px);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.08;
  max-width: 820px;
}

.hero-message {
  margin: 0;
  max-width: 640px;
  color: var(--fg-muted);
  font-size: 16px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.hero-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 12px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
}

.meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--fg-faint);
}

/* Toolbar / View Switcher */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.tabs {
  display: inline-flex;
  gap: 4px;
}

.tab {
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  cursor: pointer;
  border-radius: var(--radius);
}

.tab.active {
  color: var(--fg);
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

/* Editorial Gallery Grid (CSS Columns Masonry) */
.gallery-grid {
  padding: 28px 0 64px;
  column-count: 3;
  column-gap: 16px;
}

@media (max-width: 1024px) {
  .gallery-grid {
    column-count: 2;
  }
}

@media (max-width: 620px) {
  .gallery-grid {
    column-count: 1;
  }
}

.gallery-card {
  position: relative;
  break-inside: avoid;
  margin-bottom: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  group: true;
}

.gallery-card img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1), opacity 250ms ease;
}

.gallery-card:hover img {
  transform: scale(1.018);
}

.gallery-card-raw {
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  background: var(--bg-subtle);
}

.raw-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.16em;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  text-transform: uppercase;
}

.gallery-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.36) 0%, transparent 32%, transparent 65%, rgba(0, 0, 0, 0.58) 100%);
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.gallery-card:hover .gallery-card-overlay,
.gallery-card.is-selected .gallery-card-overlay {
  opacity: 1;
}

@media (hover: none) {
  .gallery-card-overlay {
    opacity: 1;
  }
}

.overlay-top {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  pointer-events: auto;
}

.overlay-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 11px;
  pointer-events: auto;
}

.overlay-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(10, 10, 10, 0.62);
  color: #ffffff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.icon-btn:hover {
  transform: scale(1.06);
  background: rgba(10, 10, 10, 0.9);
  border-color: #ffffff;
}

.icon-btn.hearted {
  background: #ffffff;
  color: #0a0a0a;
  border-color: #ffffff;
}

/* Files List View */
.file-list {
  padding: 16px 0 64px;
}

.file-row {
  display: grid;
  grid-template-columns: 48px 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  transition: background 140ms ease;
}

.file-row:hover {
  background: var(--bg-elevated);
}

.file-thumb-mini {
  width: 48px;
  height: 48px;
  object-fit: cover;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-muted);
  text-transform: uppercase;
  cursor: pointer;
}

.file-name {
  font-size: 14px;
  word-break: break-word;
  cursor: pointer;
}

.file-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 6, 6, 0.96);
  color: #f5f5f3;
  display: flex;
  flex-direction: column;
}

.lightbox-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.lightbox-stage img,
.lightbox-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.14);
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-family: var(--font-mono);
  font-size: 12px;
  color: #a8a8a3;
}

/* Floating Selects Bar */
.selects-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 20px;
  background: var(--fg);
  color: var(--bg);
  border-radius: 999px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.selects-bar .btn {
  border-color: color-mix(in srgb, var(--bg) 25%, transparent);
  color: var(--bg);
  border-radius: 999px;
}

.selects-bar .btn-primary {
  background: var(--bg);
  color: var(--fg);
  border-color: var(--bg);
}

/* Portfolio Strip at Bottom of Client Page */
.portfolio-strip {
  border-top: 1px solid var(--border);
  padding: 56px 0 80px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.section-title {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--fg-muted);
}

.portfolio-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 900px) {
  .portfolio-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.portfolio-tile {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
}

.portfolio-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.portfolio-tile:hover img {
  transform: scale(1.03);
}

/* Auth Gate & Modals */
.center-card {
  max-width: 420px;
  margin: 12vh auto;
  padding: 36px 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.center-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  padding: 28px;
}

/* Forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.field label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.input, .textarea, .select {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--fg);
  outline: none;
  transition: border-color 150ms ease;
}

.input:focus, .textarea:focus, .select:focus {
  border-color: var(--fg);
}

.textarea {
  min-height: 86px;
  resize: vertical;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 680px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .site-header {
    padding: 14px 18px;
  }
  .container {
    padding: 0 18px;
  }
  .lightbox-stage {
    padding: 16px;
  }
  .selects-bar {
    width: calc(100% - 24px);
    justify-content: space-between;
    flex-wrap: wrap;
    border-radius: 12px;
  }
}

/* Admin Specific */
.dropzone {
  border: 1px dashed var(--border-strong);
  background: var(--bg-elevated);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.dropzone.dragover {
  border-color: var(--fg);
  background: var(--bg-subtle);
}

.progress-track {
  width: 100%;
  height: 4px;
  background: var(--bg-subtle);
  overflow: hidden;
  margin: 12px 0;
}

.progress-fill {
  height: 100%;
  background: var(--fg);
  width: 0%;
  transition: width 150ms linear;
}

.transfer-item {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 20px;
  margin-bottom: 14px;
}

.transfer-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  padding: 12px 18px;
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin: 8px 0 0;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Dynamic Showcase Hero & Editorial Layout Modes
   ========================================================================== */

.showcase-hero-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.showcase-hero-slide {
  position: absolute;
  inset: -4%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1600ms ease, transform 7500ms ease-out;
  filter: saturate(0.82) contrast(1.04);
}

.showcase-hero-slide.active {
  opacity: 0.28;
  transform: scale(1.1);
}

.showcase-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.showcase-dot {
  width: 18px;
  height: 2px;
  background: var(--border-strong);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: background 250ms ease, width 250ms ease;
}

.showcase-dot.active {
  width: 32px;
  background: var(--fg);
}

/* Contact Sheet View (tight 4-column 4:5 archive) */
.grid-sheet {
  padding: 28px 0 64px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 1024px) {
  .grid-sheet { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 620px) {
  .grid-sheet { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

.grid-sheet .gallery-card {
  margin-bottom: 0;
  aspect-ratio: 4 / 5;
}

.grid-sheet .gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Lookbook View (dramatic 2-up editorial stream with full-bleed hero every 3rd) */
.grid-lookbook {
  padding: 32px 0 64px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-lookbook .gallery-card {
  margin-bottom: 0;
}

.grid-lookbook .gallery-card:nth-child(3n + 1) {
  grid-column: 1 / -1;
}

.grid-lookbook .gallery-card:nth-child(3n + 1) img {
  max-height: 78vh;
  width: 100%;
  object-fit: cover;
}

@media (max-width: 720px) {
  .grid-lookbook {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Smooth Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 550ms cubic-bezier(0.22, 1, 0.36, 1), transform 550ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.showcase-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 14px 12px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.72) 100%);
  color: #f5f5f3;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.gallery-card:hover .showcase-caption {
  opacity: 1;
}

.load-sentinel {
  text-align: center;
  padding: 24px 0 72px;
}



/* Admin storage tracker */
.storage-card {
  margin-top: 22px;
  padding: 22px 22px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.storage-card[data-status="warning"] {
  border-color: color-mix(in srgb, var(--warning) 55%, var(--border));
}

.storage-card[data-status="critical"] {
  border-color: color-mix(in srgb, var(--danger) 70%, var(--border));
}

.storage-card-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.storage-status {
  font-size: 16px;
  font-weight: 500;
}

.storage-card[data-status="warning"] .storage-status {
  color: var(--warning);
}

.storage-card[data-status="critical"] .storage-status {
  color: var(--danger);
}

.storage-bar {
  position: relative;
  height: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 18px;
}

.storage-bar-used {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--fg);
}

.storage-bar-reserve {
  position: absolute;
  inset: 0 0 0 auto;
  background: color-mix(in srgb, var(--fg-faint) 45%, transparent);
  border-left: 1px solid var(--border-strong);
}

.storage-card[data-status="critical"] .storage-bar-used {
  background: var(--danger);
}

.storage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 18px;
}

.storage-stat-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 4px;
}

.storage-stat-value {
  font-size: 15px;
}

.storage-note {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--fg-muted);
}

@media (max-width: 680px) {
  .storage-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
