/* ============================================
   FashionSearch — KAN Deep Labs
   Aesthetic: Luxury Editorial / High Fashion
   ============================================ */

:root {
  --cream: #f7f3ee;
  --warm-white: #fdfaf7;
  --charcoal: #1a1714;
  --mid: #4a4540;
  --light-mid: #9e9590;
  --accent: #c9a96e;
  --accent-dark: #a8843e;
  --blush: #e8cfc0;
  --sage: #a8b5a0;
  --border: rgba(26,23,20,0.12);
  --shadow: 0 4px 32px rgba(26,23,20,0.08);
  --shadow-lg: 0 16px 64px rgba(26,23,20,0.14);
  --radius: 4px;
  --radius-lg: 12px;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--warm-white);
  color: var(--charcoal);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ---- UTILITY ---- */
.hidden { display: none !important; }

.btn-primary {
  display: inline-block;
  background: var(--charcoal);
  color: var(--cream);
  padding: 14px 32px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.btn-primary:hover { background: var(--mid); transform: translateY(-1px); }

.btn-ghost {
  display: inline-block;
  color: var(--charcoal);
  padding: 14px 32px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--charcoal);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost:hover { background: var(--charcoal); color: var(--cream); }

/* ---- HEADER ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253,250,247,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.logo-icon { color: var(--accent); font-size: 18px; }
.logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.logo-sub {
  font-size: 11px;
  color: var(--light-mid);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.header-nav { display: flex; gap: 32px; }
.header-nav a {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--mid);
  transition: color 0.2s;
}
.header-nav a:hover { color: var(--charcoal); }

/* ---- HERO ---- */
.hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  padding: 80px 32px;
  overflow: hidden;
  background: var(--cream);
}
.hero-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.5;
}
.hero-content {
  position: relative;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  z-index: 2;
  animation: fadeUp 0.8s ease both;
}
.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(56px, 8vw, 96px);
  font-weight: 300;
  line-height: 1.0;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}
.hero-title em { font-style: italic; color: var(--accent); }
.hero-sub {
  font-size: 17px;
  color: var(--mid);
  max-width: 420px;
  line-height: 1.7;
  margin-bottom: 40px;
}
.hero-cta { display: flex; gap: 16px; flex-wrap: wrap; }
.hero-visual {
  position: absolute;
  right: 5%;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 2;
}
.hero-card {
  background: white;
  border: 1px solid var(--border);
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mid);
  box-shadow: var(--shadow);
  animation: slideIn 0.6s ease both;
}
.hero-card.card-1 { animation-delay: 0.2s; transform: rotate(-2deg); }
.hero-card.card-2 { animation-delay: 0.35s; }
.hero-card.card-3 { animation-delay: 0.5s; transform: rotate(1.5deg); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px) rotate(var(--r, 0deg)); }
  to   { opacity: 1; }
}

/* ---- SECTIONS ---- */
.search-section, .tryon-section, .about-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 32px;
}
.section-header {
  text-align: center;
  margin-bottom: 48px;
}
.section-header h2, .section-header h3 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 300;
  letter-spacing: 0.01em;
  margin-bottom: 12px;
}
.section-header p { color: var(--mid); font-size: 16px; }

/* ---- SEARCH BAR ---- */
.search-container { margin-bottom: 40px; }
.search-bar-wrapper {
  display: flex;
  gap: 0;
  max-width: 720px;
  margin: 0 auto 16px;
  border: 1.5px solid var(--charcoal);
}
.search-input {
  flex: 1;
  padding: 16px 20px;
  font-family: var(--font-body);
  font-size: 15px;
  border: none;
  background: white;
  outline: none;
  color: var(--charcoal);
}
.search-input::placeholder { color: var(--light-mid); }
.search-btn {
  padding: 16px 28px;
  background: var(--charcoal);
  color: var(--cream);
  border: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}
.search-btn:hover { background: var(--mid); }
.btn-arrow { transition: transform 0.2s; }
.search-btn:hover .btn-arrow { transform: translateX(4px); }
.search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: var(--mid);
  background: white;
  transition: all 0.2s;
  border-radius: 20px;
}
.chip:hover { border-color: var(--charcoal); color: var(--charcoal); background: var(--cream); }

/* ---- UPLOAD ZONE ---- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  background: var(--cream);
  transition: border-color 0.2s, background 0.2s;
  cursor: default;
  margin-bottom: 32px;
}
.upload-zone.dragover { border-color: var(--accent); background: #fdf5e8; }
.upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-title { font-family: var(--font-display); font-size: 22px; font-weight: 400; margin-bottom: 6px; }
.upload-sub { font-size: 14px; color: var(--mid); margin-bottom: 20px; }
.btn-upload {
  padding: 12px 28px;
  background: white;
  border: 1.5px solid var(--charcoal);
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-upload:hover { background: var(--charcoal); color: white; }

/* ---- ANALYSIS RESULT ---- */
.analysis-result {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
  background: white;
  box-shadow: var(--shadow);
}
.analysis-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
}
.analysis-preview img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
}
.analysis-info {
  padding: 32px;
}
.analysis-info h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.analysis-content { font-size: 14px; color: var(--mid); line-height: 1.8; }

.dress-tag {
  display: inline-block;
  background: var(--cream);
  border: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 2px;
  border-radius: 2px;
  color: var(--mid);
}
.dress-tag.highlight { background: var(--accent); border-color: var(--accent); color: white; }

.analysis-row { margin-bottom: 12px; }
.analysis-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--light-mid);
  margin-bottom: 4px;
}
.analysis-value { font-size: 14px; color: var(--charcoal); }

/* ---- RESULTS GRID ---- */
.results-section { margin-bottom: 48px; }
.results-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.results-header h3 { font-family: var(--font-display); font-size: 28px; font-weight: 300; }
.results-count { font-size: 13px; color: var(--light-mid); }
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.result-card {
  border: 1px solid var(--border);
  background: white;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
}
.result-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.result-img-wrap {
  position: relative;
  padding-top: 125%;
  overflow: hidden;
  background: var(--cream);
}
.result-img-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.result-card:hover .result-img-wrap img { transform: scale(1.05); }
.result-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(26,23,20,0.7) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  gap: 8px;
}
.result-card:hover .result-overlay { opacity: 1; }
.overlay-btn {
  padding: 7px 14px;
  font-size: 11px;
  font-family: var(--font-body);
  letter-spacing: 0.05em;
  cursor: pointer;
  border: none;
  font-weight: 500;
}
.overlay-btn.primary { background: white; color: var(--charcoal); }
.overlay-btn.secondary { background: var(--accent); color: white; }
.result-info { padding: 12px; }
.result-title { font-size: 13px; font-weight: 500; color: var(--charcoal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-source { font-size: 11px; color: var(--light-mid); margin-top: 2px; }

/* ---- RECOMMENDATIONS ---- */
.recommendations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}
.rec-card {
  background: white;
  border: 1px solid var(--border);
  padding: 20px;
  text-align: center;
  transition: box-shadow 0.2s;
}
.rec-card:hover { box-shadow: var(--shadow); }
.rec-icon { font-size: 32px; margin-bottom: 10px; }
.rec-category {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.rec-name { font-family: var(--font-display); font-size: 18px; font-weight: 400; margin-bottom: 6px; }
.rec-desc { font-size: 12px; color: var(--mid); line-height: 1.6; }

/* ---- TRY-ON SECTION ---- */
.tryon-section { background: var(--cream); border-radius: var(--radius-lg); margin: 0 auto 80px; }
.tryon-container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  align-items: start;
}
.tryon-input h3, .tryon-dress h3, .tryon-result h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tryon-input h3::before { content: "①"; font-family: var(--font-body); font-size: 14px; background: var(--charcoal); color: white; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.tryon-dress h3::before { content: "②"; font-family: var(--font-body); font-size: 14px; background: var(--charcoal); color: white; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.tryon-result h3::before { content: "③"; font-family: var(--font-body); font-size: 14px; background: var(--charcoal); color: white; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }

.photo-options { display: flex; gap: 8px; margin-bottom: 16px; }
.photo-option {
  flex: 1;
  padding: 10px 8px;
  background: white;
  border: 1.5px solid var(--border);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.03em;
}
.photo-option.active { background: var(--charcoal); color: white; border-color: var(--charcoal); }
.photo-option:not(.active):hover { border-color: var(--charcoal); }

.photo-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: white;
  transition: all 0.2s;
  overflow: hidden;
  position: relative;
}
.photo-drop-zone:hover { border-color: var(--accent); }
.dz-content { text-align: center; padding: 20px; }
.dz-icon { font-size: 36px; display: block; margin-bottom: 8px; }
.dz-title { font-family: var(--font-display); font-size: 18px; font-weight: 400; margin-bottom: 4px; }
.dz-sub { font-size: 12px; color: var(--light-mid); }
.portrait-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Webcam */
.webcam-area { position: relative; }
.webcam-area video {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: #000;
  display: block;
}
.webcam-controls {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.btn-capture, .btn-stop-cam {
  flex: 1;
  padding: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  border: none;
  font-weight: 500;
}
.btn-capture { background: var(--charcoal); color: white; }
.btn-stop-cam { background: white; border: 1px solid var(--border); color: var(--mid); }

/* Dress Selector */
.dress-selector {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: white;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-bottom: 20px;
}
.selector-hint { font-size: 13px; color: var(--light-mid); line-height: 1.7; }
.selected-dress-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  margin-bottom: 8px;
}
.selected-dress-preview p { font-size: 13px; color: var(--mid); margin-bottom: 8px; }
.btn-clear-dress {
  background: none;
  border: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--mid);
}
.tryon-generate { text-align: center; }
.btn-generate {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--charcoal) 0%, var(--mid) 100%);
  color: white;
  border: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-generate:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.gen-icon { font-size: 18px; }
.tryon-note { font-size: 11px; color: var(--light-mid); margin-top: 8px; letter-spacing: 0.04em; }

/* Try-On Result */
.result-display {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 12px;
}
.result-placeholder { text-align: center; padding: 32px; }
.rp-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.result-placeholder p { font-size: 13px; color: var(--light-mid); }
.result-display img { width: 100%; height: auto; object-fit: contain; display: block; }
.result-actions { display: flex; gap: 8px; }
.btn-download, .btn-share {
  flex: 1;
  padding: 10px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  border: 1.5px solid var(--charcoal);
  background: white;
  transition: all 0.2s;
}
.btn-download:hover, .btn-share:hover { background: var(--charcoal); color: white; }

/* ---- ABOUT ---- */
.about-section {
  background: var(--charcoal);
  color: var(--cream);
  max-width: 100%;
  padding: 80px 32px;
}
.about-inner { max-width: 1100px; margin: 0 auto; }
.about-badge {
  display: inline-block;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 4px 14px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.about-section h2 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 300;
  margin-bottom: 48px;
}
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 32px;
}
.how-card { border-top: 1px solid rgba(253,250,247,0.15); padding-top: 24px; }
.how-num {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 16px;
}
.how-card h4 { font-size: 16px; font-weight: 500; margin-bottom: 10px; }
.how-card p { font-size: 14px; color: rgba(247,243,238,0.65); line-height: 1.7; }

/* ---- FOOTER ---- */
.site-footer {
  background: #0f0d0b;
  color: var(--cream);
  padding: 40px 32px 24px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(253,250,247,0.08);
  margin-bottom: 20px;
}
.footer-brand {
  font-family: var(--font-display);
  font-size: 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer-brand p { font-family: var(--font-body); font-size: 12px; color: rgba(247,243,238,0.4); margin-top: 4px; }
.footer-links { display: flex; gap: 24px; align-items: center; }
.footer-links a { font-size: 12px; color: rgba(247,243,238,0.5); text-decoration: none; letter-spacing: 0.04em; transition: color 0.2s; }
.footer-links a:hover { color: var(--cream); }
.footer-bottom { max-width: 1200px; margin: 0 auto; }
.footer-bottom p { font-size: 11px; color: rgba(247,243,238,0.3); }

/* ---- LOADING ---- */
.loading-shimmer {
  height: 16px;
  background: linear-gradient(90deg, var(--cream) 25%, #e8e2da 50%, var(--cream) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
  margin-bottom: 12px;
}
.loading-shimmer::after {
  content: '';
  display: block;
  height: 16px;
  background: linear-gradient(90deg, var(--cream) 25%, #e8e2da 50%, var(--cream) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite 0.2s;
  border-radius: 4px;
  margin-top: 8px;
  width: 70%;
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,23,20,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.loading-card {
  background: white;
  padding: 48px 64px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 2.5px solid var(--border);
  border-top-color: var(--charcoal);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loadingText { font-size: 14px; color: var(--mid); letter-spacing: 0.04em; }

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--charcoal);
  color: white;
  padding: 14px 24px;
  font-size: 13px;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 320px;
}
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .hero-visual { display: none; }
  .tryon-container { grid-template-columns: 1fr; }
  .analysis-grid { grid-template-columns: 1fr; }
  .analysis-preview img { height: 200px; }
  .header-nav { display: none; }
}
@media (max-width: 640px) {
  .hero { padding: 60px 20px; }
  .search-section, .tryon-section { padding: 48px 20px; }
  .search-bar-wrapper { flex-direction: column; border: none; gap: 8px; }
  .search-input { border: 1.5px solid var(--charcoal); padding: 14px 16px; }
  .footer-inner { flex-direction: column; gap: 24px; }
}

/* ============================================
   SMART SEARCH RESULT STYLES (v2)
   ============================================ */

/* Recommendation card — Find & Try On button */
.btn-smart-search {
  width: 100%;
  margin-top: 14px;
  padding: 10px 16px;
  background: var(--charcoal);
  color: white;
  border: none;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.btn-smart-search:hover { background: var(--accent); }
.btn-smart-search:disabled { opacity: 0.6; cursor: not-allowed; }

/* Smart result container inside rec card */
.smart-result {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

/* Loading state inside card */
.sr-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 0;
  text-align: center;
}
.sr-loading p { font-size: 12px; color: var(--mid); line-height: 1.6; }

/* Try-on image inside card */
.sr-tryon-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 500;
}
.sr-tryon-img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}
.btn-dl-small {
  padding: 6px 14px;
  font-size: 11px;
  font-family: var(--font-body);
  background: white;
  border: 1px solid var(--border);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.2s;
}
.btn-dl-small:hover { background: var(--charcoal); color: white; border-color: var(--charcoal); }

.sr-note { font-size: 12px; color: var(--light-mid); font-style: italic; padding: 12px 0; text-align: center; }
.sr-error { font-size: 12px; color: #c0392b; padding: 12px 0; text-align: center; }

/* Products section */
.sr-products-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--charcoal);
  margin: 16px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sr-products-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sr-product-card {
  border: 1px solid var(--border);
  background: white;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.15s;
  display: block;
  overflow: hidden;
}
.sr-product-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.sr-product-img-wrap {
  width: 100%;
  padding-top: 100%;
  position: relative;
  background: var(--cream);
  overflow: hidden;
}
.sr-product-img-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.sr-product-card:hover .sr-product-img-wrap img { transform: scale(1.05); }

.sr-product-info { padding: 8px; }
.sr-product-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--charcoal);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
  line-height: 1.4;
}
.sr-product-site { font-size: 10px; color: var(--light-mid); margin-bottom: 5px; }
.sr-buy-btn {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.05em;
  background: var(--charcoal);
  color: white;
  padding: 3px 8px;
  font-weight: 500;
}

/* Wider rec grid to accommodate smart results */
@media (min-width: 900px) {
  .recommendations-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* ============================================
   V3 ADDITIONS — Category toggles, progress,
   two-col analysis, source tags, color dots
   ============================================ */

/* Category config panel */
.category-config {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 28px;
}
.cc-header { margin-bottom: 14px; }
.cc-title { font-family: var(--font-display); font-size: 17px; font-weight: 400; }
.cc-sub { display: block; font-size: 12px; color: var(--light-mid); margin-top: 3px; letter-spacing: 0.03em; }
.cat-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-loading { font-size: 12px; color: var(--light-mid); }
.cat-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: white;
  font-size: 13px;
  font-weight: 400;
  color: var(--mid);
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}
.cat-toggle:hover { border-color: var(--charcoal); color: var(--charcoal); }
.cat-toggle.active { background: var(--charcoal); color: white; border-color: var(--charcoal); }
.cat-toggle.active .cat-icon { filter: none; }
.cat-icon { font-size: 15px; line-height: 1; }
.cat-label { font-size: 12px; font-weight: 500; letter-spacing: 0.03em; }

/* Analysis progress bar */
.analysis-progress {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  padding: 16px 20px;
}
.progress-steps { display: flex; flex-direction: column; gap: 10px; }
.progress-step {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--mid);
}
.progress-step.active { color: var(--charcoal); font-weight: 500; }
.progress-step.done   { color: var(--sage); }
.progress-step.waiting{ color: var(--light-mid); }
.ps-icon { font-size: 16px; width: 20px; text-align: center; }
.ps-label { flex: 1; }

/* Two-column analysis layout */
.analysis-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin-bottom: 16px; }
@media (max-width: 640px) { .analysis-two-col { grid-template-columns: 1fr; } }

/* Style narrative */
.style-narrative {
  background: var(--cream);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  font-family: var(--font-display);
  font-size: 16px;
  font-style: italic;
  color: var(--mid);
  line-height: 1.6;
  margin: 12px 0;
}

/* Badges */
.analysis-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.badge {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mid);
}
.badge-ethnic  { background: #fdf0e0; border-color: var(--accent); color: var(--accent-dark); }
.badge-western { background: #f0f4f0; border-color: var(--sage); color: #5a7055; }

/* Source attribution tags */
.analysis-source-tags { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.source-tag {
  font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 2px; font-weight: 500;
}
.gemini-tag { background: #e8f0fe; color: #1a73e8; border: 1px solid #c5d8fd; }
.claude-tag { background: #fdf5e8; color: #a8843e; border: 1px solid #f0ddb0; }

/* Preview badges overlay */
.analysis-preview { position: relative; }
.analysis-preview-badges {
  position: absolute; bottom: 8px; left: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.apb {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 2px;
}
.apb.gemini { background: rgba(26,115,232,0.9); color: white; }
.apb.claude { background: rgba(168,132,62,0.9);  color: white; }

/* Color dot */
.color-dot {
  display: inline-block; width: 14px; height: 14px;
  border-radius: 50%; border: 1px solid rgba(0,0,0,0.12);
  vertical-align: middle; margin-right: 4px;
}
.color-row { display: flex; align-items: center; }

/* Rec card color line */
.rec-color {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--mid); margin: 4px 0 6px;
  letter-spacing: 0.04em;
}

/* ============================================
   GOOGLE ATTRIBUTION (mandatory per Google ToS)
   https://developers.google.com/custom-search/docs/ui_elements
   ============================================ */

/* Header attribution — sits in results-header row */
.google-attribution {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  margin-left: auto;
  flex-shrink: 0;
}
.ga-text {
  font-size: 11px;
  color: var(--light-mid);
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.ga-logo {
  display: block;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.google-attribution:hover .ga-logo { opacity: 1; }

/* Footer attribution — below the results grid */
.google-attribution-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}
.google-attribution-footer span {
  font-size: 11px;
  color: var(--light-mid);
  letter-spacing: 0.03em;
}
.google-attribution-footer img { opacity: 0.7; }

/* Inline attribution inside smart-search product label */
.google-attribution-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  margin-left: 8px;
  vertical-align: middle;
}
.google-attribution-inline span {
  font-size: 10px;
  color: var(--light-mid);
  letter-spacing: 0.03em;
}
.google-attribution-inline img { opacity: 0.75; }

/* ============================================
   COMPLIANCE FOOTER STYLES
   ============================================ */

.footer-ai-disclosure {
  max-width: 1200px;
  margin: 0 auto 16px;
  padding: 12px 0;
  border-top: 1px solid rgba(253,250,247,0.08);
}
.fai-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(247,243,238,0.35);
  margin-bottom: 8px;
}
.fai-providers { display: flex; flex-wrap: wrap; gap: 16px; }
.fai-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: rgba(247,243,238,0.5);
}
.fai-item strong { color: rgba(247,243,238,0.7); font-weight: 500; }
.fai-item a {
  color: rgba(247,243,238,0.35);
  text-decoration: none;
  font-size: 10px;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(247,243,238,0.15);
  transition: color 0.2s;
}
.fai-item a:hover { color: var(--accent); }

.footer-compliance-note {
  font-size: 10px;
  color: rgba(247,243,238,0.25);
  margin-top: 6px;
  line-height: 1.7;
}
.footer-compliance-note span { color: rgba(247,243,238,0.4); }

/* OpenAI brand mention banner (shown only when OpenAI is enabled) */
.openai-brand-notice {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(16,163,127,0.95);  /* OpenAI green */
  color: white;
  text-align: center;
  padding: 8px 20px;
  font-size: 12px;
  font-family: var(--font-body);
  z-index: 50;
  letter-spacing: 0.03em;
  backdrop-filter: blur(4px);
}

/* ============================================
   SESSION BUDGET INDICATOR
   ============================================ */
.session-budget {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--mid);
  transition: all 0.3s;
}
.session-budget.sb-low {
  border-color: #e67e22;
  color: #e67e22;
  background: #fef9f0;
}
.sb-label {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--light-mid);
}
.sb-bar {
  width: 48px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.sb-fill {
  height: 100%;
  background: var(--sage);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.sb-low .sb-fill { background: #e67e22; }
.sb-count { font-size: 11px; white-space: nowrap; }

/* ============================================
   SESSION LIMIT MODAL
   ============================================ */
.session-limit-modal {
  position: fixed;
  inset: 0;
  background: rgba(26,23,20,0.6);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.slm-card {
  background: white;
  max-width: 420px;
  width: 100%;
  padding: 40px 36px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.slm-icon  { font-size: 40px; margin-bottom: 12px; }
.slm-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 12px;
}
.slm-message {
  font-size: 14px;
  color: var(--mid);
  line-height: 1.7;
  margin-bottom: 12px;
}
.slm-search-note {
  font-size: 12px;
  color: var(--sage);
  background: #f0f5f0;
  border: 1px solid #c8dcc8;
  padding: 10px 14px;
  margin-bottom: 24px;
  line-height: 1.6;
}
.slm-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.slm-actions .btn-primary,
.slm-actions .btn-ghost {
  width: 100%;
  text-align: center;
  cursor: pointer;
}
.slm-dismiss { font-size: 13px; padding: 10px; }

/* ============================================
   AD SLOTS
   Identical container dimensions whether ads
   are enabled or fallback content is showing.
   ============================================ */

/* ---- Base slot ---- */
.ad-slot {
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

/* Ad label — tiny, muted, only shown for real ads */
.ad-label {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--light-mid);
  margin: 0 0 4px;
  opacity: 0.5;
}

/* ---- Banner Top ---- */
.ad-slot--banner-top {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 40px 0;
  min-height: 90px;
}

/* ---- Banner Bottom ---- */
.ad-slot--banner-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px 32px;
  min-height: 90px;
}

/* ---- Inline (between results) ---- */
.ad-slot--inline {
  grid-column: 1 / -1;   /* spans full results grid width */
  min-height: 100px;
  padding: 8px 0;
}

/* ---- Sidebar beside recommendations ---- */
.recommendations-with-sidebar {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.recommendations-with-sidebar .recommendations-grid {
  flex: 1;
  min-width: 0;
}
.ad-slot--sidebar-recs {
  width: 300px;
  flex-shrink: 0;
  min-height: 250px;
  position: sticky;
  top: 100px;
}
@media (max-width: 900px) {
  .recommendations-with-sidebar { flex-direction: column; }
  .ad-slot--sidebar-recs { width: 100%; position: static; }
}

/* ============================================
   FALLBACK CONTENT (ads disabled)
   Looks like editorial content, not a gap.
   ============================================ */

/* Style Tip fallback */
.ad-slot--fallback { background: transparent; }

.fallback-style-tip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 24px;
  background: linear-gradient(135deg, #fdf9f5 0%, #f5ede3 100%);
  border-left: 3px solid var(--sage);
  border-radius: 2px;
}
.fst-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage);
  font-weight: 500;
}
.fst-text {
  font-family: var(--font-display);
  font-size: 15px;
  font-style: italic;
  color: var(--mid);
  line-height: 1.7;
  margin: 0;
}

/* Featured Brands fallback */
.fallback-featured-brands {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 24px;
  background: var(--cream);
  border: 1px solid var(--border);
}
.ffb-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--light-mid);
  font-weight: 500;
}
.ffb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.fb-chip {
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
  background: white;
  border: 1px solid var(--border);
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  min-width: 100px;
}
.fb-chip:hover {
  border-color: var(--sage);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.fb-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--dark);
  letter-spacing: 0.02em;
}
.fb-tag {
  font-size: 10px;
  color: var(--light-mid);
  margin-top: 2px;
  letter-spacing: 0.03em;
}

/* ============================================
   AD SLOTS — BASE
   All ad slots share these base styles.
   Layout never collapses whether ads are on or off.
   ============================================ */

.ad-slot {
  width: 100%;
  overflow: hidden;
  transition: opacity 0.3s;
}
/* Hide empty slots before JS populates them */
.ad-slot:empty { display: none; }

/* ---- Banner slots (leaderboard) ---- */
.ad-slot--banner-top,
.ad-slot--banner-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 0;
  min-height: 90px;
}
.ad-slot--banner-top    { margin-bottom: 8px; }
.ad-slot--banner-bottom { margin-top: 32px; }

/* ---- Inline slot (between results and recs) ---- */
.ad-slot--results-inline {
  max-width: 800px;
  margin: 24px auto;
  min-height: 100px;
}

/* ---- Sidebar slot (beside recs grid) ---- */
.ad-slot--sidebar-recs {
  width: 300px;
  flex-shrink: 0;
  min-height: 250px;
  align-self: flex-start;
  position: sticky;
  top: 80px;
}

/* ============================================
   HOUSE ADS — shown when AdSense is off or unfilled
   Matches the luxury editorial aesthetic of the site.
   ============================================ */

.house-ad {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 28px;
  text-decoration: none;
  width: 100%;
  box-sizing: border-box;
  transition: opacity 0.2s;
}
.house-ad:hover { opacity: 0.85; }

/* Dark theme — for banner top */
.ad-slot--theme-dark .house-ad {
  background: var(--charcoal);
  color: var(--cream);
}
.ad-slot--theme-dark .ha-eyebrow { color: var(--accent); }
.ad-slot--theme-dark .ha-heading  { color: var(--cream); }
.ad-slot--theme-dark .ha-body     { color: rgba(247,243,238,0.65); }
.ad-slot--theme-dark .ha-cta      {
  background: var(--accent);
  color: var(--charcoal);
  padding: 10px 20px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Light theme — for inline */
.ad-slot--theme-light .house-ad {
  background: var(--cream);
  border: 1px solid var(--border);
  color: var(--charcoal);
}
.ad-slot--theme-light .ha-heading { color: var(--charcoal); }
.ad-slot--theme-light .ha-body    { color: var(--mid); }
.ad-slot--theme-light .ha-cta     {
  background: var(--charcoal);
  color: var(--cream);
  padding: 10px 20px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Sage theme — for sidebar */
.ad-slot--theme-sage .house-ad {
  background: #f0f5f0;
  border: 1px solid #c8dcc8;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  color: var(--charcoal);
}
.ad-slot--theme-sage .ha-heading { color: var(--charcoal); font-size: 16px; }
.ad-slot--theme-sage .ha-body    { color: var(--mid); font-size: 13px; line-height: 1.5; }
.ad-slot--theme-sage .ha-cta     {
  color: var(--sage);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: underline;
}

/* Minimal theme — for banner bottom */
.ad-slot--theme-minimal .house-ad {
  background: transparent;
  border-top: 1px solid var(--border);
  justify-content: center;
  gap: 12px;
  padding: 16px;
  flex-wrap: wrap;
}
.ad-slot--theme-minimal .ha-heading { font-family: var(--font-display); font-size: 18px; color: var(--charcoal); }
.ad-slot--theme-minimal .ha-divider { color: var(--light-mid); }
.ad-slot--theme-minimal .ha-body    { font-size: 13px; color: var(--mid); }
.ad-slot--theme-minimal .ha-cta     { font-size: 12px; color: var(--accent); font-weight: 600; text-decoration: none; }

/* Shared house ad typography */
.ha-eyebrow {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 500;
}
.ha-content { flex: 1; min-width: 0; }
.ha-heading {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 4px;
  line-height: 1.3;
}
.ha-body {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}
.ha-feature-icon { font-size: 28px; flex-shrink: 0; }
.ha-brand-logo   { font-size: 32px; color: var(--accent); flex-shrink: 0; }

/* Feature house ad variant */
.house-ad--feature {
  background: linear-gradient(135deg, #fdf8f2 0%, #f5ede0 100%);
  border: 1px solid rgba(196,161,120,0.3);
}

/* Unlock house ad variant */
.house-ad--unlock {
  background: linear-gradient(135deg, #f0f7f0 0%, #e8f2e8 100%);
  border: 1px solid #c8dcc8;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  /* Sidebar ad stacks below recommendations on mobile */
  .recommendations-with-sidebar { flex-direction: column; }
  .ad-slot--sidebar-recs {
    width: 100%;
    position: static;
    min-height: 120px;
  }
  /* Banner ads shrink gracefully */
  .ad-slot--banner-top,
  .ad-slot--banner-bottom { min-height: 60px; }
  .ha-heading { font-size: 16px; }
}
@media (max-width: 600px) {
  /* On mobile, collapse banner ads and show as strip */
  .ad-slot--banner-top .house-ad,
  .ad-slot--banner-bottom .house-ad {
    flex-direction: column;
    text-align: center;
    padding: 14px 16px;
    gap: 10px;
  }
}

/* ============================================
   HAMBURGER MENU — mobile nav
   ============================================ */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
  z-index: 200;
}
.hamburger span {
  display: block;
  width: 24px; height: 2px;
  background: var(--charcoal);
  transition: all 0.25s ease;
  transform-origin: center;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  .hamburger { display: flex; }
  .header-nav {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: rgba(253,250,247,0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 0;
    z-index: 150;
    box-shadow: 0 8px 24px rgba(26,23,20,0.08);
  }
  .header-nav.mobile-open { display: flex; }
  .header-nav a {
    padding: 14px 32px;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
  }
  .header-nav a:last-child { border-bottom: none; }
  /* Move session budget before hamburger on mobile */
  .session-budget { order: -1; font-size: 10px; }
  .sb-bar { width: 32px; }
}

/* Mobile menu fix — ensure header is positioning context */
.site-header { position: sticky; top: 0; z-index: 100; }
.header-inner { position: relative; }

/* ============================================
   MOBILE HEADER FIXES
   ============================================ */
@media (max-width: 900px) {

  /* Fix header height and layout */
  .site-header { height: auto; min-height: 56px; padding: 0 16px; }
  .header-inner {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
  }

  /* Shrink logo so it fits on one line */
  .logo { flex-shrink: 1; min-width: 0; gap: 4px; }
  .logo-text { font-size: 16px; white-space: nowrap; }
  .logo-sub {
    display: none;  /* hide "by KAN DEEP LABS" on mobile */
  }
  .logo-icon { font-size: 14px; }

  /* Session budget — compact on mobile */
  .session-budget {
    flex-shrink: 0;
    padding: 4px 8px;
    font-size: 10px;
    gap: 4px;
    white-space: nowrap;
  }
  .sb-label { display: none; }
  .sb-bar { width: 28px; }

  /* Hamburger — always visible, properly placed */
  .hamburger {
    display: flex !important;
    flex-shrink: 0;
    margin-left: auto;
    padding: 8px;
  }

  /* Dropdown nav */
  .header-nav {
    position: fixed !important;
    top: 56px;
    left: 0; right: 0;
    background: rgba(253,250,247,0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-direction: column !important;
    padding: 8px 0;
    z-index: 999;
    box-shadow: 0 8px 24px rgba(26,23,20,0.12);
  }
  .header-nav a {
    padding: 16px 24px;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.06em;
  }
  .header-nav a:last-child { border-bottom: none; }

  /* Remove the large hero top padding causing empty space */
  .hero { padding-top: 40px !important; }
  .hero-content { padding-top: 0 !important; }
}

@media (max-width: 480px) {
  .logo-text { font-size: 15px; }
  .session-budget { padding: 3px 6px; }
}

/* Ensure mobile nav shows when toggled */
@media (max-width: 900px) {
  #headerNav { display: none !important; z-index: 9999; }
  #headerNav.mobile-open { display: flex !important; }
}

/* ============================================
   SESSION BUDGET MOBILE — final fix
   Overrides all conflicting rules above
   ============================================ */
@media (max-width: 900px) {
  .session-budget {
    display: flex !important;
    order: 2 !important;
    flex-shrink: 0 !important;
    padding: 4px 8px !important;
    font-size: 10px !important;
    gap: 4px !important;
    white-space: nowrap !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  .session-budget.hidden {
    display: none !important;
  }
  .sb-label { display: none !important; }
  .sb-bar   { width: 28px !important; }
  .sb-count { font-size: 10px !important; white-space: nowrap !important; }
}
