/* styles.css — NOW Agency Private Gallery
   Palette: near-black background, white text, NOW orange accent.
   Replace --now-orange below with the exact brand hex if it differs. */

:root {
  --now-bg: #050505;
  --now-bg-elevated: #101010;
  --now-bg-card: #141414;
  --now-border: #232323;
  --now-text: #f5f5f5;
  --now-text-muted: #9a9a9a;
  --now-orange: #ff6a00;
  --now-orange-hover: #ff8226;
  --now-danger: #e5484d;
  --now-success: #3ecf8e;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--now-bg);
  color: var(--now-text);
  font-family: 'Helvetica Neue', Arial, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
}

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

.hidden {
  display: none !important;
}

/* Focus visibility for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--now-orange);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- */
/* LOGIN SCREEN                                                      */
/* ---------------------------------------------------------------- */

.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 106, 0, 0.08), transparent 60%),
    var(--now-bg);
  text-align: center;
}

.login-eyebrow {
  letter-spacing: 0.32em;
  font-size: 11px;
  color: var(--now-text-muted);
  text-transform: uppercase;
  margin-bottom: 36px;
  font-weight: 600;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--now-bg-card);
  border: 1px solid var(--now-border);
  border-radius: 14px;
  padding: 40px 32px 32px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.login-logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 28px;
}

.login-logo span {
  color: var(--now-orange);
}

.login-logo-img {
  height: 42px;
  width: auto;
  margin: 0 auto 28px;
  display: block;
}

.login-title {
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 10px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--now-text-muted);
  margin: 0 0 28px;
  line-height: 1.5;
}

.login-field {
  text-align: left;
  margin-bottom: 20px;
}

.login-field label {
  display: block;
  font-size: 12px;
  color: var(--now-text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-field input {
  width: 100%;
  padding: 14px 16px;
  background: #0b0b0b;
  border: 1px solid var(--now-border);
  border-radius: 8px;
  color: var(--now-text);
  font-size: 16px;
  letter-spacing: 0.04em;
  transition: border-color 0.15s ease;
}

.login-field input::placeholder {
  color: #555;
}

.login-field input:focus {
  border-color: var(--now-orange);
  outline: none;
}

.btn-primary {
  width: 100%;
  padding: 15px 16px;
  background: var(--now-orange);
  color: #0a0a0a;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background: var(--now-orange-hover);
}

.btn-primary:active {
  transform: scale(0.99);
}

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

.login-error {
  margin-top: 16px;
  font-size: 13px;
  color: var(--now-danger);
  min-height: 18px;
}

.login-footer {
  margin-top: 32px;
  font-size: 12px;
  color: #666;
  letter-spacing: 0.03em;
}

/* ---------------------------------------------------------------- */
/* GALLERY HEADER                                                    */
/* ---------------------------------------------------------------- */

.gallery-app {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--safe-top);
}

.gallery-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px calc(24px + var(--safe-right)) 18px calc(24px + var(--safe-left));
  background: rgba(5, 5, 5, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--now-border);
}

.header-brand {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.header-brand span {
  color: var(--now-orange);
}

.header-brand-img {
  height: 20px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.header-brand-with-tag {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-brand-tag {
  color: #666;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.header-client {
  font-size: 13px;
  color: var(--now-text-muted);
  text-align: center;
  flex: 1;
  padding: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-ghost {
  background: transparent;
  color: var(--now-text);
  border: 1px solid var(--now-border);
  border-radius: 7px;
  padding: 9px 14px;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
  border-color: var(--now-orange);
  color: var(--now-orange);
}

.btn-accent {
  background: var(--now-orange);
  color: #0a0a0a;
  border: none;
  border-radius: 7px;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
}

.btn-accent:hover {
  background: var(--now-orange-hover);
}

.btn-accent:disabled,
.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--now-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.icon-btn:hover {
  color: var(--now-orange);
}

/* ---------------------------------------------------------------- */
/* GALLERY INTRO                                                     */
/* ---------------------------------------------------------------- */

.gallery-intro {
  padding: 44px calc(24px + var(--safe-right)) 20px calc(24px + var(--safe-left));
}

.gallery-intro-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.gallery-intro-logo {
  max-height: 64px;
  max-width: 320px;
  width: auto;
  height: auto;
  margin: 0 0 10px;
  display: block;
}

.gallery-intro-subtitle {
  font-size: 15px;
  color: var(--now-text-muted);
  margin: 0 0 4px;
}

.gallery-intro-count {
  font-size: 13px;
  color: #6b6b6b;
  margin: 6px 0 22px;
}

/* ---------------------------------------------------------------- */
/* MASONRY GRID                                                      */
/* ---------------------------------------------------------------- */

.gallery-grid {
  padding: 0 calc(24px + var(--safe-right)) 80px calc(24px + var(--safe-left));
  column-count: 1;
  column-gap: 14px;
}

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

@media (min-width: 900px) {
  .gallery-grid {
    column-count: 3;
  }
}

@media (min-width: 1400px) {
  .gallery-grid {
    column-count: 4;
  }
}

.photo-tile {
  break-inside: avoid;
  margin-bottom: 14px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--now-bg-card);
  border: 1px solid var(--now-border);
  cursor: zoom-in;
  position: relative;
}

.photo-tile img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.35s ease, opacity 0.35s ease;
  opacity: 0;
}

.photo-tile img.loaded {
  opacity: 1;
}

.photo-tile:hover img {
  transform: scale(1.015);
}

.photo-tile .tile-skeleton {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: linear-gradient(100deg, #131313 30%, #1c1c1c 50%, #131313 70%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ---------------------------------------------------------------- */
/* EMPTY / ERROR STATES                                              */
/* ---------------------------------------------------------------- */

.state-block {
  padding: 90px 24px;
  text-align: center;
  color: var(--now-text-muted);
}

.state-block .state-title {
  font-size: 18px;
  color: var(--now-text);
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------- */
/* LIGHTBOX                                                          */
/* ---------------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(2, 2, 2, 0.97);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.lightbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  color: #ddd;
  font-size: 13px;
  letter-spacing: 0.04em;
  z-index: 3;
}

.lightbox-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: pan-y;
}

.lightbox-img-wrap {
  max-width: 96%;
  max-height: 92%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox-img-wrap img {
  max-width: 100%;
  max-height: 88vh;
  max-height: 88dvh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.15s ease;
  transform-origin: center center;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(20, 20, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
}

.lightbox-nav:hover {
  background: rgba(255, 106, 0, 0.85);
  border-color: var(--now-orange);
}

.lightbox-nav.prev {
  left: 16px;
}

.lightbox-nav.next {
  right: 16px;
}

.lightbox-bottombar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
}

@media (max-width: 640px) {
  .lightbox-nav {
    width: 40px;
    height: 40px;
  }
  .lightbox-nav.prev {
    left: 8px;
  }
  .lightbox-nav.next {
    right: 8px;
  }
}

/* ---------------------------------------------------------------- */
/* TOAST                                                             */
/* ---------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%) translateY(20px);
  background: #1a1a1a;
  border: 1px solid var(--now-border);
  color: var(--now-text);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: var(--now-danger);
}
