@import url('https://fonts.googleapis.com/css2?family=Anton&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0a0a0d;
  --surface: #14161c;
  --surface-2: #1b1e26;
  --border: #262a33;
  --text: #f2f2f0;
  --text-muted: #8b8f99;
  --accent: #f0a83c;
  --accent-dim: rgba(240, 168, 60, 0.12);
  --success: #4ade80;
  --danger: #f87171;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,0.4);
  --font-display: 'Anton', 'Arial Narrow', sans-serif;
  color-scheme: dark;
}

/* Light mode is intentionally unsupported: this design commits to the dark,
   high-contrast "tracked in public" aesthetic in both system states. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.app-shell { max-width: 1080px; margin: 0 auto; padding: 0 20px 80px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 10, 13, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 20px; letter-spacing: 0.02em; }
.brand-mark { color: var(--accent); }

.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); padding: 4px; border-radius: 10px; }
.tab-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.tab-btn.active { background: var(--accent); color: #14161c; }

.tab-panel { display: none; flex-direction: column; }
.tab-panel.active { display: flex; }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 40px; border-bottom: 1px solid var(--border); }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; margin: 0 0 14px; }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1.05;
  letter-spacing: 0.01em;
  margin: 0 0 16px;
  text-transform: uppercase;
}
.hero p { color: var(--text-muted); font-size: 16px; max-width: 60ch; margin: 0; line-height: 1.6; }

/* ---------- Stat card row ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 32px 0; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-card-label { color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 14px; }

.arrow-stat { display: flex; align-items: center; gap: 14px; }
.arrow-stat .from, .arrow-stat .to { display: flex; flex-direction: column; gap: 2px; }
.arrow-stat .value { font-family: var(--font-display); font-size: 28px; }
.arrow-stat .from .value { color: var(--text-muted); }
.arrow-stat .to .value { color: var(--accent); }
.arrow-stat .caption { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.arrow-stat .arrow-glyph { color: var(--accent); font-size: 20px; }
.stat-delta { margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.stat-delta.positive { color: var(--success); }
.stat-delta.negative { color: var(--danger); }

.mini-metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-metric { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.mini-metric .mm-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.mini-metric .mm-value { font-family: var(--font-display); font-size: 20px; margin-top: 2px; }

.thumb-compare { display: flex; gap: 10px; }
.thumb-compare .thumb-wrap { flex: 1; text-align: center; }
.thumb-compare img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.thumb-compare .thumb-label { font-size: 10px; color: var(--text-muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.thumb-empty { display:flex; align-items:center; justify-content:center; aspect-ratio:3/4; border:1px dashed var(--border); border-radius:8px; color: var(--text-muted); font-size:12px; text-align:center; padding: 8px;}

.gauge-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.gauge-value { font-family: var(--font-display); font-size: 30px; }
.gauge-track { width: 100%; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.gauge-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--success)); border-radius: 999px; transition: width .4s ease; }

/* ---------- Sub-stat trio ---------- */
.trio-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; text-align: center; padding: 28px 0; border-bottom: 1px solid var(--border); }
.trio-item .trio-value { font-family: var(--font-display); font-size: 32px; color: var(--accent); }
.trio-item .trio-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }

/* ---------- Numbered sections ---------- */
.numbered-section { padding: 48px 0; border-bottom: 1px solid var(--border); }
.numbered-section:last-of-type { border-bottom: none; }
.section-heading { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.section-num { font-family: var(--font-display); color: var(--accent); font-size: 15px; }
.section-heading h2 { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: clamp(20px, 3vw, 28px); margin: 0; letter-spacing: 0.01em; }
.section-desc { color: var(--text-muted); font-size: 14px; margin: 0 0 24px; max-width: 65ch; }

/* ---------- Photo compare ---------- */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-col { display: flex; flex-direction: column; gap: 10px; }
.compare-col-header { display: flex; align-items: center; justify-content: space-between; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.pill.gold { background: var(--accent-dim); color: var(--accent); border-color: transparent; }
.compare-photo { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.angle-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.angle-tab-btn { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.angle-tab-btn.active { background: var(--accent); color: #14161c; border-color: var(--accent); }
.compare-date { color: var(--text-muted); font-size: 12px; }

/* ---------- Numbers table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
tbody tr:hover { background: var(--surface-2); }
.delta-cell { color: var(--text-muted); font-weight: 600; }
.delta-cell.positive { color: var(--success); }
.delta-cell.negative { color: var(--danger); }
.numbers-table-card, .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }

/* ---------- Sparkline grid ---------- */
.sparkline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.sparkline-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.sparkline-card-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.sparkline-card-top .sl-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.sparkline-card-top .sl-delta { font-size: 12px; font-weight: 700; }
.sparkline-card canvas { width: 100%; height: 60px; display: block; }
.sparkline-card-bottom { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Gallery (weekly timeline) ---------- */
.photo-gallery { display: flex; flex-direction: column; gap: 18px; }
.gallery-week { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.gallery-week-title { font-weight: 700; font-size: 14px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.gallery-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 600px) { .gallery-photos { grid-template-columns: repeat(2, 1fr); } }
.gallery-photo { position: relative; }
.gallery-photo img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
.gallery-photo .angle-label { position: absolute; bottom: 6px; left: 6px; background: rgba(0,0,0,0.7); color: white; font-size: 10px; padding: 2px 7px; border-radius: 5px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Owner panel ---------- */
.owner-panel {
  border: 1px solid var(--accent);
  background: linear-gradient(180deg, var(--accent-dim), transparent 60%);
  border-radius: var(--radius);
  padding: 20px;
  margin: 28px 0;
}
.owner-panel-title { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 16px; }
.owner-panel-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.owner-panel .card { background: var(--surface-2); }

.owner-only { display: none; }
body.is-owner .owner-only { display: revert; }

.viewer-banner {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- Forms ---------- */
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row label, .stack-form > label { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }

input, select, textarea {
  font: inherit;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn-primary, .btn-secondary {
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #14161c; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { filter: brightness(1.15); }
.btn-danger-text { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12px; }

.hint { color: var(--text-muted); font-size: 13px; margin: 0 0 12px; }
.empty-hint { color: var(--text-muted); font-size: 13px; text-align: center; padding: 20px 0; }

.photo-drop-zone { display: flex; align-items: center; gap: 16px; }
.initial-photo-display { display: flex; align-items: center; gap: 16px; }
.initial-photo-display img { width: 120px; height: 150px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

.angle-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.angle-upload {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.angle-upload input { padding: 4px; font-size: 12px; }

.saved-msg { color: var(--success); font-size: 13px; align-self: center; }

.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 30px;
}
.lightbox-overlay img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* ---------- Auth ---------- */
.auth-area { display: flex; align-items: center; gap: 10px; }
.auth-label { font-size: 12px; color: var(--text-muted); }

.signin-popover {
  display: none;
  position: absolute;
  right: 20px;
  top: 62px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  padding: 16px;
  gap: 10px;
  flex-direction: column;
  width: 220px;
  z-index: 50;
}
.signin-popover.open { display: flex; }
.signin-popover label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.signin-error { color: var(--danger); font-size: 12px; }

footer.site-footer { text-align: center; color: var(--text-muted); font-size: 12px; padding: 40px 0 0; }
