/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* ── Brand variables (overridden by JS from brand.json) ── */
:root {
  --bg:        #FAFAF7;
  --text:      #0F0F0F;
  --muted:     #9B9B95;
  --border:    #E5E2DC;
  --accent:    #0F0F0F;
  --accent-fg: #FAFAF7;
  --radius:    4px;
  --sidebar-w: 250px;
  --font-heading: system-ui, -apple-system, sans-serif;
  --font-body:    system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: var(--bg);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 16px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-new-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-family: var(--font-body);
  color: var(--muted);
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.sidebar-new-btn:hover { border-color: var(--text); color: var(--text); }

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-empty {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 16px;
  text-align: center;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  position: relative;
  border-radius: 0;
  transition: background 0.1s;
}
.session-item:hover { background: rgba(15,15,15,0.05); }
.session-item.active { background: rgba(15,15,15,0.07); }

.session-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  background: var(--border);
}

.session-meta { flex: 1; min-width: 0; }

.session-name {
  font-size: 0.8rem;
  font-family: var(--font-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.session-detail {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 1px;
}

.session-delete {
  display: none;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  flex-shrink: 0;
}
.session-item:hover .session-delete { display: block; }
.session-delete:hover { color: #C8261A; }

/* ── Main content ── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 60px 48px 120px;
  max-width: 820px;
}

/* ── Hamburger (mobile) ── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-bottom: 24px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,15,15,0.4);
  z-index: 40;
}

/* ── Header ── */
header { margin-bottom: 48px; }

#logo-wrap { margin-bottom: 18px; }
#logo-wrap img.brand-logo {
  height: auto;
  width: 200px;
  max-width: 100%;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  shape-rendering: geometricPrecision;
}
@media (max-width: 600px) {
  #logo-wrap img.brand-logo { width: 170px; }
}

h1#site-title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.subtitle {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Section label ── */
.section-label {
  font-size: 0.7rem;
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Form ── */
.form-section { display: flex; flex-direction: column; gap: 32px; }

.field { display: flex; flex-direction: column; gap: 8px; }

label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus,
input[type="password"]:focus { border-color: var(--text); }

/* ── Upload slots ── */
.upload-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.upload-slot {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 130px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s;
}
.upload-slot:hover { border-color: var(--text); }

.upload-slot input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.upload-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  pointer-events: none;
  text-align: center;
  padding: 12px;
}
.upload-label em { font-style: normal; color: #C0BDB8; font-size: 0.75rem; }
.upload-icon { font-size: 1.3rem; font-weight: 200; line-height: 1; }

.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

/* ── Weather toggle ── */
.weather-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
}
.weather-btn {
  padding: 9px 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: var(--font-body);
  color: var(--muted);
  letter-spacing: 0.02em;
  border-radius: calc(var(--radius) - 1px);
  transition: background 0.12s, color 0.12s;
}
.weather-btn:first-child { border-right: 1px solid var(--border); }
.weather-btn.active { background: var(--accent); color: var(--accent-fg); }

/* ── Generate button ── */
#generate-btn {
  align-self: flex-start;
  padding: 13px 30px;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: opacity 0.15s;
}
#generate-btn:disabled { opacity: 0.3; cursor: not-allowed; }
#generate-btn:not(:disabled):hover { opacity: 0.82; }

/* ── Error banner ── */
.error-banner {
  padding: 12px 16px;
  border: 1px solid #C8261A;
  border-radius: var(--radius);
  color: #C8261A;
  font-size: 0.88rem;
  background: #FFF5F4;
}

/* ── Generation status ── */
.gen-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 48px 0 40px; }

/* ── Outfits bar ── */
.outfits-bar { margin-bottom: 32px; display: flex; flex-direction: column; gap: 12px; }

.outfits-row { display: flex; gap: 16px; align-items: flex-start; }

.outfit-thumb-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }

.outfit-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.outfit-no-suit {
  width: 72px;
  height: 72px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

.outfit-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ── Results grid ── */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ── Preview card ── */
.card { display: flex; flex-direction: column; gap: 8px; }

.card-images {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 6px;
}

.card-ref-wrap,
.card-preview-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #EDEBE6;
}

.card-ref-wrap { aspect-ratio: 2/3; cursor: zoom-in; }
.card-preview-wrap { aspect-ratio: 2/3; cursor: zoom-in; }

.card-images img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-img-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: rgba(15,15,15,0.55);
  color: #FAFAF7;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
}

/* Spinner overlay on a card */
.card-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(250,250,247,0.75);
  z-index: 2;
}

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg, #EEEDE9 25%, #F5F4F0 50%, #EEEDE9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.card-skeleton .card-ref-wrap,
.card-skeleton .card-preview-wrap {
  background: none;
  border-color: transparent;
}

.skeleton-ref,
.skeleton-preview {
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
}

/* Error card */
.card-error-wrap {
  aspect-ratio: 3/4;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 16px;
  grid-column: 2;
}
.card-error-icon { font-size: 1.4rem; }

.card-actions { display: flex; gap: 8px; }

.btn-secondary {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: var(--font-body);
  color: var(--text);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: border-color 0.12s, background 0.12s;
  text-align: center;
}
.btn-secondary:hover { border-color: var(--text); background: rgba(15,15,15,0.05); }
.btn-secondary:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Spinner ── */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ── */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  justify-content: center;
  align-items: center;
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
#footer-studio { font-family: var(--font-heading); }

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15,15,15,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: transparent;
  border: none;
  color: #FAFAF7;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
}
.lightbox-close:hover { opacity: 1; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: flex; }
  .main-content { padding: 24px 20px 80px; }
  .grid { grid-template-columns: 1fr; }
  .card-images { grid-template-columns: 1fr 1fr; }
}
