/* HeatSafe demo UI — SnowUI design tokens (rankwizard design_system 2.md §3) */

:root {
  color-scheme: light dark;

  /* base */
  --bg: #ffffff;
  --bg-elevated: #f7f9fb;
  --bg-muted: #f4f4f5;
  --fg: #1c1c1c;
  --fg-muted: #6b7280;
  --fg-subtle: #9ca3af;
  --border: #e1e4ea;
  --border-strong: #c8cbd0;
  --ring: #3b82f6;

  /* brand */
  --brand: #3b82f6;
  --brand-fg: #ffffff;
  --brand-soft: #e8f1ff;
  --brand-hover: #2570eb;

  /* semantic */
  --success: #10b981;
  --success-soft: #dcfbee;
  --warning: #f59e0b;
  --warning-soft: #fdf3d9;
  --danger: #ef4444;
  --danger-soft: #fdeeee;
  --info: #0ea5e9;
  --info-soft: #e3f5fd;

  /* opt-in brand gradient — logo mark only */
  --brand-gradient: linear-gradient(135deg, #059669 0%, #2563eb 50%, #6366f1 100%);

  /* radius / shadow */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --shadow-xs: 0 1px 2px hsl(220 30% 10% / 0.05);
  --shadow-sm: 0 1px 3px hsl(220 30% 10% / 0.08), 0 1px 2px hsl(220 30% 10% / 0.06);
  --shadow-md: 0 4px 12px hsl(220 30% 10% / 0.08);

  --header-h: 56px;
  --content-max-w: 1240px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14151a;
    --bg-elevated: #1c1d22;
    --bg-muted: #25272d;
    --fg: #fafafa;
    --fg-muted: #9ca3af;
    --fg-subtle: #6b7280;
    --border: #2a2c33;
    --border-strong: #3a3d46;
    --brand-soft: #14243d;
    --success-soft: #0e2b21;
    --warning-soft: #2b2210;
    --danger-soft: #331616;
    --info-soft: #10262f;
  }
}

* { box-sizing: border-box; border-color: var(--border); }

button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* hover effects only where a real pointer exists — no sticky hover on touch */
@media (hover: none) {
  button.ghost:hover { background: transparent; }
  .cta:hover { background: var(--brand); }
  .ghost-cta:hover { background: transparent; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 20px;
}

main { max-width: var(--content-max-w); margin: 0 auto; padding: 0 1.5rem 4rem; }

/* ---------- header ---------- */
.top {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 max(1.5rem, env(safe-area-inset-right)) 0 max(1.5rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: .6rem; }
.brand-mark {
  width: 28px; height: 28px; border-radius: var(--radius-md);
  background: var(--brand-gradient);
  display: inline-grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px;
}
.brand-mark::after { content: "H"; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { color: var(--fg-muted); font-size: 13px; }
.deploy-chip {
  font-size: 12px; line-height: 16px; color: var(--fg-muted);
  border: 1px solid var(--border); border-radius: var(--radius-full);
  padding: 4px 12px; background: var(--bg-elevated);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw;
}

/* ---------- hero ---------- */
.hero {
  padding: clamp(2rem, 6vw, 3.5rem) 0 .5rem;
  display: grid; gap: 2rem; align-items: center;
  grid-template-columns: minmax(0, 46rem);
}
@media (min-width: 768px) {
  .hero { grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr); }
}

/* 3D scene card: dark surface with a cursor spotlight */
.hero-visual {
  position: relative; overflow: hidden;
  height: clamp(260px, 34vw, 420px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: #101114;
  box-shadow: var(--shadow-md);
}
.hero-visual spline-viewer { width: 100%; height: 100%; display: block; }
.spotlight {
  pointer-events: none; position: absolute; z-index: 1;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle at center, hsl(0 0% 100% / 0.16), transparent 70%);
  filter: blur(24px);
  opacity: 0; transition: opacity 200ms ease;
  transform: translate(-50%, -50%);
  left: 30%; top: 20%;
}
.hero-visual:hover .spotlight { opacity: 1; }
@media (hover: none) {
  .hero-visual:hover .spotlight { opacity: 0; }
}
@media (max-width: 899px) {
  .hero-visual { height: 300px; }
}
.hero h1 {
  font-size: clamp(24px, 5.5vw, 32px); line-height: 1.25; letter-spacing: -0.01em;
  font-weight: 600; margin: 0 0 .75rem;
}
.hero h1 em { font-style: normal; color: var(--brand); }
.usp { font-size: 15px; line-height: 22px; color: var(--fg-muted); margin: 0 0 1.1rem; }
.creed-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.creed-chips span {
  font-size: 12px; line-height: 16px; font-weight: 600;
  padding: 5px 12px; border-radius: var(--radius-full);
  background: var(--bg-muted); color: var(--fg-muted);
}
.creed-chips .never { background: var(--success-soft); color: var(--success); }
.hero-cta { margin-top: 1.25rem; }
.cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand); color: var(--brand-fg);
  font-size: 14px; font-weight: 500; text-decoration: none;
  border-radius: var(--radius-md); padding: 10px 18px;
  transition: background-color 120ms ease;
}
.cta:hover { background: var(--brand-hover); }
.cta .icon { color: currentColor; }
.ghost-cta {
  background: transparent; color: var(--brand);
  border: 1px solid var(--brand); padding: 8px 16px;
}
.ghost-cta:hover { background: var(--brand-soft); }

/* ---------- icons ---------- */
.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px;
}

/* ---------- cards ---------- */
.grid {
  display: grid; gap: 1rem; margin-top: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  box-shadow: var(--shadow-xs);
}
.card h2 { margin: 0 0 12px; font-size: 15px; line-height: 22px; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

/* ---------- conditions ---------- */
.verdict-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.badge {
  font-weight: 600; font-size: 12px; line-height: 16px; letter-spacing: .04em;
  padding: 4px 10px; border-radius: var(--radius-full);
}
.badge[data-state="loading"], .badge[data-state="unknown"] { background: var(--bg-muted); color: var(--fg-muted); }
.badge[data-state="go"] { background: var(--success-soft); color: var(--success); }
.badge[data-state="restricted"] { background: var(--warning-soft); color: var(--warning); }
.badge[data-state="no-go"] { background: var(--danger-soft); color: var(--danger); }
.verdict-note { color: var(--fg-muted); font-size: 13px; line-height: 18px; flex: 1; min-width: 12rem; }

.readings { display: flex; gap: 2rem; margin: 0 0 14px; flex-wrap: wrap; }
.readings div { min-width: 6.5rem; }
.readings dt { color: var(--fg-subtle); font-size: 12px; line-height: 16px; }
.readings dd { margin: 2px 0 0; font-size: 20px; line-height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }

.reasons { margin: 0 0 12px; padding-left: 18px; font-size: 13px; line-height: 18px; }
.reasons li { margin-bottom: 6px; }
.source-line { color: var(--fg-subtle); font-size: 12px; line-height: 16px; margin: 0; }

/* buttons */
button {
  font: inherit; cursor: pointer; border-radius: var(--radius-md);
  transition: background-color 120ms ease, border-color 120ms ease;
}
button:focus-visible { outline: none; box-shadow: 0 0 0 3px hsl(217 91% 60% / 0.35); }
button.ghost {
  background: transparent; color: var(--fg);
  border: 1px solid var(--border-strong);
  padding: 5px 12px; font-size: 13px; min-height: 36px;
}
button.ghost:hover { background: var(--bg-muted); }

/* ---------- talk card ---------- */
.talk h2 { display: flex; align-items: center; gap: 8px; }
.talk h2 .icon { color: var(--brand); }
.ask-chips { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.ask-chips li {
  font-size: 13px; line-height: 18px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 8px 12px;
}
.tag-refuse, .tag-defer {
  font-size: 11px; font-weight: 600; letter-spacing: .03em;
  border-radius: var(--radius-full); padding: 2px 8px; margin-left: 6px;
  vertical-align: 1px; white-space: nowrap;
}
.tag-refuse { background: var(--danger-soft); color: var(--danger); }
.tag-defer { background: var(--warning-soft); color: var(--warning); }

/* ---------- source authority flow ---------- */
.how, .verticals, .value { margin-top: 3rem; }
.how h2, .verticals h2 { font-size: 18px; line-height: 26px; font-weight: 600; margin: 0 0 1rem; }
.flow {
  display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.flow-step {
  flex: 1 1 160px; display: grid; gap: 2px; align-content: start;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
}
.flow-step .icon { width: 20px; height: 20px; color: var(--brand); margin-bottom: 6px; }
.flow-step b { font-size: 14px; font-weight: 600; }
.flow-step span { color: var(--fg-muted); font-size: 12px; line-height: 16px; }
.flow-step.dim { opacity: .65; }
.flow-step.dim .icon { color: var(--fg-subtle); }
.flow-arrow {
  align-self: center; color: var(--fg-subtle);
  font-size: 20px; font-weight: 600; user-select: none;
}
@media (max-width: 640px) {
  .flow { flex-direction: column; }
  .flow-step { flex-basis: auto; }
  .flow-arrow { transform: rotate(90deg); align-self: center; line-height: 1; }
}
.how-note { color: var(--fg-muted); font-size: 13px; line-height: 18px; max-width: 50rem; }
.how-note em { color: var(--fg); font-style: italic; }

/* ---------- value trio ---------- */
.v3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.v3-card {
  display: grid; gap: 2px; align-content: start;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-elevated); padding: 14px 16px;
}
.v3-card .icon { width: 20px; height: 20px; color: var(--success); margin-bottom: 6px; }
.v3-card b { font-size: 14px; font-weight: 600; }
.v3-card span { color: var(--fg-muted); font-size: 12px; line-height: 16px; }

/* ---------- verticals ---------- */
.v-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  margin-bottom: 12px;
}
.v-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-elevated); padding: 14px 16px;
  display: grid; gap: 4px; justify-items: start;
}
.v-card.live { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.v-card .icon { width: 20px; height: 20px; color: var(--fg-muted); margin-bottom: 4px; }
.v-card.live .icon { color: var(--brand); }
.v-card b { font-size: 14px; font-weight: 600; }
.v-card em {
  font-style: normal; font-size: 11px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--fg-subtle);
}
.v-card.live em { color: var(--brand); }

footer {
  border-top: 1px solid var(--border); margin-top: 3.5rem; text-align: center;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
}
footer p { color: var(--fg-subtle); font-size: 12px; line-height: 16px; max-width: 46rem; margin: 0 auto; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
