@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,300..800&family=DM+Mono:wght@400;500&family=Fraunces:ital,opsz,wght@0,9..144,400..900;1,9..144,400..600&display=swap');

:root {
  --bg: #0c0d10;
  --bg-raised: #15171c;
  --bg-line: #22252d;
  --fg: #f3f1ea;
  --fg-dim: #8b8f99;
  --fg-faint: #565a64;
  --signal: #ff4d3d;
  --signal-dim: #c93a2e;
  --good: #5fd08a;
  --warn: #f5c451;
  --fail: #ff4d3d;
  --grade-a: #5fd08a;
  --grade-b: #9ed06b;
  --grade-c: #f5c451;
  --grade-d: #f59451;
  --grade-f: #ff4d3d;
  --mono: 'DM Mono', ui-monospace, monospace;
  --display: 'Bricolage Grotesque', sans-serif;
  --serif: 'Fraunces', serif;
}

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

html { scroll-behavior: smooth; }
html, body { max-width: 100%; overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 15% -10%, rgba(255, 77, 61, 0.08), transparent 45%),
    linear-gradient(var(--bg-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-line) 1px, transparent 1px);
  background-size: 100% 100%, 64px 64px, 64px 64px;
  background-position: 0 0, -1px -1px, -1px -1px;
}

.shell { max-width: 880px; margin: 0 auto; padding: 0 24px; }

/* ── header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
  border-bottom: 1px solid var(--bg-line);
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 0 rgba(255, 77, 61, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 77, 61, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(255, 77, 61, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 61, 0); }
}
.brand .tld { color: var(--signal); }
header .tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ── hero ── */
.hero { padding: 72px 0 40px; }
.hero .kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--signal);
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin-bottom: 22px;
}
.hero h1 em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  color: var(--signal);
}
.hero p.lede {
  font-size: 1.12rem;
  color: var(--fg-dim);
  max-width: 30ch;
  margin-bottom: 38px;
}

/* ── url form ── */
.analyze-form {
  display: flex;
  gap: 0;
  border: 1px solid var(--bg-line);
  border-radius: 14px;
  background: var(--bg-raised);
  padding: 6px;
  max-width: 620px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.analyze-form:focus-within {
  border-color: var(--signal-dim);
  box-shadow: 0 0 0 4px rgba(255, 77, 61, 0.1);
}
.analyze-form input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.95rem;
  padding: 14px 16px;
}
.analyze-form input::placeholder { color: var(--fg-faint); }
.analyze-form .paste-btn {
  background: transparent;
  border: none;
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  padding: 0 10px;
  cursor: pointer;
  transition: color 0.15s;
}
.analyze-form .paste-btn:hover { color: var(--signal); }
.analyze-form button[type="submit"] {
  background: var(--signal);
  color: #160805;
  border: none;
  border-radius: 9px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0 26px;
  cursor: pointer;
  transition: transform 0.12s, background 0.2s;
}
.analyze-form button[type="submit"]:hover { background: #ff6757; }
.analyze-form button[type="submit"]:active { transform: scale(0.97); }
.analyze-form button[type="submit"]:disabled { opacity: 0.5; cursor: wait; }
.analyze-form button[type="submit"] .sm { display: none; }

/* ── video preview ── */
#preview { padding: 8px 0 0; }
#preview[hidden] { display: none; }
.preview-card {
  position: relative;
  display: block;
  max-width: 620px;
  border: 1px solid var(--bg-line);
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--bg-raised);
  text-decoration: none;
}
.preview-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-card .play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.preview-card .play span {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(255,77,61,0.92);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.4rem;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
  transition: transform 0.15s;
}
.preview-card:hover .play span { transform: scale(1.08); }
.preview-card.skeleton { background: linear-gradient(100deg, var(--bg-raised) 30%, var(--bg-line) 50%, var(--bg-raised) 70%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.form-error {
  color: var(--signal);
  font-family: var(--mono);
  font-size: 0.82rem;
  margin-top: 12px;
  min-height: 1.2em;
}

/* ── report ── */
#report { padding: 16px 0 90px; }
#report[hidden] { display: none; }

.report-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: center;
  padding: 28px 0;
  border-top: 1px solid var(--bg-line);
  border-bottom: 1px solid var(--bg-line);
  margin-bottom: 36px;
}
.grade {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 7rem;
  line-height: 0.8;
  letter-spacing: -0.04em;
}
.grade[data-grade="A"] { color: var(--grade-a); }
.grade[data-grade="B"] { color: var(--grade-b); }
.grade[data-grade="C"] { color: var(--grade-c); }
.grade[data-grade="D"] { color: var(--grade-d); }
.grade[data-grade="F"] { color: var(--grade-f); }
.grade-meta .vtitle {
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.grade-meta .vstats {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--fg-dim);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.grade-meta .score-bar {
  margin-top: 16px;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-line);
  overflow: hidden;
}
.grade-meta .score-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--signal-dim), var(--signal));
  width: 0;
  transition: width 0.9s cubic-bezier(0.2, 0.9, 0.2, 1);
}

/* top fixes */
.fixes {
  background: var(--bg-raised);
  border: 1px solid var(--bg-line);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 36px;
}
.fixes h3 {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--signal);
  margin-bottom: 16px;
}
.fixes ol { list-style: none; counter-reset: fix; }
.fixes li {
  counter-increment: fix;
  display: flex;
  gap: 14px;
  padding: 10px 0;
  font-size: 0.98rem;
  color: var(--fg);
  border-top: 1px solid var(--bg-line);
}
.fixes li:first-child { border-top: none; }
.fixes li::before {
  content: counter(fix);
  font-family: var(--mono);
  font-weight: 500;
  color: var(--signal);
  flex-shrink: 0;
}

/* checks grouped */
.group { margin-bottom: 30px; }
.group > h4 {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--fg-faint);
  margin-bottom: 12px;
}
.check {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 14px;
  padding: 13px 0;
  border-top: 1px solid var(--bg-line);
}
.check .led {
  width: 12px; height: 12px; border-radius: 50%;
  margin-top: 5px;
}
.check[data-sev="pass"] .led { background: var(--good); box-shadow: 0 0 8px rgba(95, 208, 138, 0.5); }
.check[data-sev="warn"] .led { background: var(--warn); box-shadow: 0 0 8px rgba(245, 196, 81, 0.5); }
.check[data-sev="fail"] .led { background: var(--fail); box-shadow: 0 0 8px rgba(255, 77, 61, 0.5); }
.check .msg { font-size: 0.96rem; }
.check .fix {
  font-size: 0.85rem;
  color: var(--fg-dim);
  margin-top: 3px;
}

.editor-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  background: transparent;
  border: 1px solid var(--signal-dim);
  color: var(--signal);
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 22px;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.2s, transform 0.12s;
}
.editor-cta:hover { background: rgba(255, 77, 61, 0.1); }
.editor-cta:active { transform: scale(0.98); }

/* skeleton / loading */
.loading {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-dim);
  padding: 40px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.loading .scan {
  width: 32px; height: 2px; background: var(--signal);
  animation: scan 1.1s infinite;
}
@keyframes scan { 0%,100% { opacity: 0.3; transform: scaleX(0.4); } 50% { opacity: 1; transform: scaleX(1); } }

footer {
  border-top: 1px solid var(--bg-line);
  padding: 28px 0 48px;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--fg-faint);
  display: flex;
  justify-content: space-between;
}
footer a { color: var(--fg-dim); text-decoration: none; }
footer a:hover { color: var(--signal); }

.reveal { animation: reveal 0.6s cubic-bezier(0.2, 0.9, 0.2, 1) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ── mobile ── */
@media (max-width: 540px) {
  header .tag { display: none; }
  .hero { padding: 48px 0 32px; }
  /* drop forced line breaks → text wraps naturally, can't overflow */
  .hero h1 { font-size: clamp(2rem, 9vw, 3.2rem); text-wrap: balance; }
  .hero h1 br { display: none; }
  .analyze-form button[type="submit"] { padding: 0 20px; }
  .analyze-form button[type="submit"] .lg { display: none; }
  .analyze-form button[type="submit"] .sm { display: inline; }
  .report-head { grid-template-columns: 1fr; gap: 14px; }
  .grade { font-size: 5rem; }
  .preview-card { max-width: 100%; }
}
