/* Attention Forecaster — light theme, black sticky header */
:root {
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-panel: #f7f8fa;
  --bg-tile: #f0f2f5;
  --border: #e2e6ee;
  --border-subtle: #ebeff5;
  --text: #12151c;
  --text-muted: #5a6578;
  --text-dim: #8b95a8;
  --accent: #2563eb;
  --accent-bright: #3b82f6;
  --accent-dim: rgba(37, 99, 235, 0.12);
  --cyan: #0891b2;
  --magenta: #c026d3;
  --amber: #d97706;
  --green: #059669;
  --red: #dc2626;
  --curve: #2563eb;
  --overlay-mark: #d97706;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(16, 24, 40, 0.06);
  --topbar-h: 88px;
  --credit-h: 36px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* —— Connock credit (fixed top-right, above sticky header) —— */
.topbar-credit,
a.topbar-credit {
  flex-shrink: 0;
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #ffffff !important;
  background: #000000 !important;
  text-decoration: none;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 4px;
  line-height: 1.2;
  opacity: 1;
  text-shadow: none;
  font-family: var(--font);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.topbar-credit:hover,
a.topbar-credit:hover {
  color: #ffffff !important;
  background: #111111 !important;
  text-decoration: underline;
}
#alex-connock-credit {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10001;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 8px 12px;
  margin: 0;
  background: transparent !important;
  border: 0 !important;
  pointer-events: none;
}
#alex-connock-credit a,
#alex-connock-credit .topbar-credit {
  pointer-events: auto;
}

/* —— Sticky frozen black header —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10000;
  background: #000000;
  border-bottom: 1px solid #1a1a1a;
  padding: 14px 24px 16px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(240px, 360px) 1fr;
  gap: 20px;
  align-items: center;
  padding-right: 180px; /* clear credit pill on desktop */
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.brand-name {
  font-size: clamp(1.5rem, 2.4vw, 2.1rem); /* ~24–33.6px → bigger wordmark */
  font-weight: 700;
  letter-spacing: -0.035em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.15;
}

.brand-name .pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 12px #22d3ee;
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.brand-tag {
  font-size: 0.72rem;
  color: #9ca3af;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.url-row {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.url-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: #111827;
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.url-input::placeholder {
  color: #9ca3af;
}

.url-input:focus {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.btn-analyse {
  height: 44px;
  padding: 0 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

.btn-analyse:hover:not(:disabled) {
  background: var(--accent-bright);
}

.btn-analyse:active:not(:disabled) {
  transform: scale(0.98);
}

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

/* —— Main layout —— */
.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

/* —— Empty state —— */
.empty-state {
  text-align: center;
  padding: 72px 32px;
  background: var(--bg-panel);
  border: 1px dashed var(--border);
  border-radius: 12px;
  margin-bottom: 28px;
}

.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.empty-state p {
  margin: 0 auto 4px;
  max-width: 480px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.empty-hint {
  margin-top: 18px !important;
  font-size: 0.78rem !important;
  color: var(--text-dim) !important;
  font-family: var(--mono);
  max-width: 560px !important;
}

/* —— Workspace —— */
.workspace {
  display: none;
}

.workspace.visible {
  display: block;
  animation: rise 0.45s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  gap: 10px;
}

.panel-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.65rem;
  background: var(--bg-tile);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.platform-badge.youtube {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.25);
  color: #b91c1c;
}

.platform-badge.x {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.2);
  color: #0f172a;
}

.platform-badge.instagram {
  background: rgba(192, 38, 211, 0.08);
  border-color: rgba(192, 38, 211, 0.25);
  color: #a21caf;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--amber);
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid rgba(217, 119, 6, 0.28);
  padding: 3px 8px;
  border-radius: 4px;
}

.demo-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
}

/* Video embed */
.embed-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0a0a0a;
}

.embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.embed-fallback {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 14px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
}

.embed-fallback a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.embed-fallback a:hover {
  text-decoration: underline;
}

.video-meta {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border-subtle);
}

.video-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  line-height: 1.35;
  color: var(--text);
}

.video-channel {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

/* Deconstruction tiles */
.decon-body {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tile {
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
  min-height: 110px;
}

.tile-full {
  grid-column: 1 / -1;
}

.tile-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tile-value {
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 10px;
  color: var(--text);
}

.tile-value span.unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.spark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 36px;
}

.spark-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  min-width: 3px;
  transition: height 0.3s ease;
}

.spark-bar.cuts { background: linear-gradient(to top, var(--accent), #22d3ee); opacity: 0.9; }
.spark-bar.faces { background: linear-gradient(to top, var(--magenta), #e879f9); opacity: 0.9; }

.marker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.marker-chip {
  font-size: 0.7rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(192, 38, 211, 0.08);
  border: 1px solid rgba(192, 38, 211, 0.22);
  color: #a21caf;
}

.marker-chip.text {
  background: rgba(8, 145, 178, 0.08);
  border-color: rgba(8, 145, 178, 0.25);
  color: #0e7490;
}

.marker-chip.chorus {
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.25);
  color: #047857;
}

/* Attention curve panel */
.curve-panel {
  margin-bottom: 18px;
}

.curve-body {
  padding: 16px 18px 20px;
}

.curve-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.overlay-callout {
  background: rgba(217, 119, 6, 0.07);
  border: 1px solid rgba(217, 119, 6, 0.28);
  border-radius: 8px;
  padding: 12px 14px;
  max-width: 420px;
}

.overlay-callout .oc-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 4px;
}

.overlay-callout .oc-time {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.overlay-callout .oc-rationale {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.curve-stats {
  display: flex;
  gap: 20px;
}

.curve-stat .k {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.curve-stat .v {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  color: var(--text);
}

.chart-wrap {
  position: relative;
  height: 260px;
  width: 100%;
}

.chart-legend {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.chart-legend i {
  display: inline-block;
  width: 12px;
  height: 3px;
  border-radius: 1px;
  vertical-align: middle;
  margin-right: 5px;
}

.chart-legend .lg-curve { background: var(--curve); }
.chart-legend .lg-overlay { background: var(--overlay-mark); height: 10px; width: 3px; }

/* —— Tooltips —— */
.tip {
  position: relative;
  cursor: help;
}

.tip-term {
  border-bottom: 1px dotted var(--text-dim);
  text-decoration: none;
}

.tip:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.tip-bubble {
  position: fixed;
  z-index: 10050;
  max-width: 280px;
  padding: 10px 12px;
  background: #0f172a;
  color: #f1f5f9;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.45;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.tip-bubble.visible {
  opacity: 1;
  transform: none;
}

.tip-bubble[hidden] {
  display: none;
}

/* Loading overlay */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
}

.loading-overlay.active {
  display: flex;
}

.loading-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 36px;
  min-width: 320px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(16, 24, 40, 0.12);
}

.loading-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.loading-card p {
  margin: 0 0 18px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.progress-track {
  height: 4px;
  background: var(--bg-tile);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #22d3ee);
  border-radius: 2px;
  transition: width 0.1s linear;
}

.loading-steps {
  margin-top: 14px;
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--text-dim);
  min-height: 1.2em;
}

/* History */
.history-section {
  margin-top: 36px;
}

.history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.history-head h2 {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.history-clear {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-family: var(--font);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.history-clear:hover {
  color: var(--text-muted);
  background: var(--bg-tile);
}

.history-empty {
  padding: 28px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--bg-panel);
}

.history-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-card {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
  width: 100%;
  color: inherit;
  font-family: inherit;
}

.history-card:hover {
  border-color: var(--accent);
  background: var(--bg-panel);
}

.history-thumb {
  width: 120px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-tile);
}

.history-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: linear-gradient(135deg, #f0f2f5, #e5e7eb);
}

.history-info {
  min-width: 0;
}

.history-info h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.history-info .hi-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.history-platform {
  display: inline-flex;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-tile);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.history-platform.youtube {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.22);
  color: #b91c1c;
}

.history-platform.x {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.18);
  color: #0f172a;
}

.history-platform.instagram {
  background: rgba(192, 38, 211, 0.08);
  border-color: rgba(192, 38, 211, 0.22);
  color: #a21caf;
}

.history-scores {
  text-align: right;
  flex-shrink: 0;
  padding-right: 4px;
}

.history-scores .hs-peak {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  color: var(--cyan);
}

.history-scores .hs-overlay {
  font-size: 0.72rem;
  color: var(--amber);
  font-family: var(--mono);
  margin-top: 2px;
}

.history-scores .hs-lbl {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.error-toast {
  display: none;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.28);
  border-radius: 8px;
  color: #b91c1c;
  font-size: 0.85rem;
}

.error-toast.visible {
  display: block;
}

footer.site-foot {
  max-width: 1280px;
  margin: 40px auto 0;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
}

footer.site-foot a {
  color: var(--text-muted);
}

@media (max-width: 960px) {
  .topbar-inner {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-right: 0;
    padding-top: 4px;
  }
  .brand-name {
    font-size: 1.55rem;
    padding-right: 160px; /* clear credit on stacked layout */
  }
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .history-card {
    grid-template-columns: 96px 1fr;
  }
  .history-scores {
    grid-column: 2;
    text-align: left;
    display: flex;
    gap: 16px;
    align-items: baseline;
  }
}

@media (max-width: 600px) {
  .topbar { padding: 10px 14px 12px; }
  .shell { padding: 16px 14px 48px; }
  .decon-body { grid-template-columns: 1fr; }
  .url-row { flex-direction: column; }
  .btn-analyse { width: 100%; }
  .brand-name {
    font-size: 1.35rem;
    padding-right: 0;
  }
  .history-card {
    grid-template-columns: 1fr;
  }
  .history-thumb { width: 100%; }
}
