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

:root {
  --bg: #0a0a0a;
  --bg-elevated: #0f0f0f;
  --surface: #111111;
  --border: rgba(0, 212, 255, 0.12);
  --border-strong: rgba(0, 212, 255, 0.22);
  --text: #f5f5f5;
  --muted: #9ca3af;
  --dim: #6b7280;
  --cyan: #00d4ff;
  --cyan-dim: rgba(0, 212, 255, 0.14);
  --cyan-glow: rgba(0, 212, 255, 0.45);
  --danger: #ff6b6b;
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --nav-h: 64px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .gradient-border::before,
  .loading-ring::before {
    animation: none !important;
  }
}

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

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main {
  position: relative;
  z-index: 1;
}

/* ——— Nav ——— */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
}

.nav-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan), #0088a3);
  box-shadow: 0 0 24px var(--cyan-glow);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-cta {
  color: var(--bg) !important;
  background: var(--cyan) !important;
  margin-left: 0.35rem;
  font-weight: 600 !important;
  box-shadow: 0 0 20px var(--cyan-glow);
}

.nav-cta:hover {
  filter: brightness(1.08);
  color: var(--bg) !important;
}

@media (max-width: 720px) {
  .nav-links a {
    display: none;
  }
  .nav-links a[href='#home'],
  .nav-links .nav-cta {
    display: inline-flex;
  }
  .nav-links {
    gap: 0.25rem;
  }
}

/* ——— Hero ——— */
.hero {
  padding: 3.5rem 1.5rem 4rem;
  max-width: 920px;
  margin: 0 auto;
}

.hero-inner {
  text-align: center;
}

.eyebrow {
  margin: 0 0 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--cyan);
}

.hero-title {
  margin: 0 0 1.25rem;
  font-size: clamp(2rem, 5.2vw, 3.15rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.hero-sub {
  margin: 0 auto 2.25rem;
  max-width: 52ch;
  font-size: 1.05rem;
  color: var(--muted);
  font-weight: 400;
}

.scan-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: stretch;
  max-width: 720px;
  margin: 0 auto;
}

.scan-row--narrow {
  max-width: 640px;
}

.demo-note {
  margin: 0.85rem auto 0;
  max-width: 720px;
  text-align: left;
  font-size: 0.82rem;
  color: var(--muted);
}

/* Animated gradient border (conic behind inner) */
.gradient-border {
  position: relative;
  flex: 1;
  min-width: 220px;
  border-radius: 16px;
  padding: 2px;
  overflow: hidden;
  background: var(--bg);
}

.gradient-border::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220%;
  height: 220%;
  background: conic-gradient(
    from 0deg,
    var(--cyan),
    rgba(0, 212, 255, 0.15) 18%,
    #005f73 38%,
    rgba(0, 212, 255, 0.2) 58%,
    var(--cyan) 78%,
    rgba(0, 212, 255, 0.35) 100%
  );
  animation: border-rotate 3.5s linear infinite;
  transform: translate(-50%, -50%);
}

@keyframes border-rotate {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.gradient-border--paused::before {
  animation-play-state: paused;
  opacity: 0.35;
}

.gradient-border-inner {
  position: relative;
  z-index: 1;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid rgba(0, 212, 255, 0.08);
}

.scan-input {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
  padding: 1rem 1.15rem;
  outline: none;
}

.scan-input::placeholder {
  color: var(--dim);
}

.scan-input:focus {
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.25);
}

.btn-scan {
  flex-shrink: 0;
  min-width: 148px;
  padding: 0 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--bg);
  background: var(--cyan);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.35), 0 0 32px var(--cyan-glow), 0 8px 32px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s;
}

.btn-scan:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-scan:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ——— Sections ——— */
.section {
  padding: 3.5rem 1.5rem;
  max-width: 1120px;
  margin: 0 auto;
}

.section-title {
  margin: 0 0 0.5rem;
  text-align: center;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.section-title--left {
  text-align: left;
}

.section-lead {
  margin: 0 auto 2rem;
  max-width: 42ch;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.problem .section-title {
  margin-bottom: 2rem;
}

.problem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.info-card {
  padding: 1.5rem 1.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.info-card--problem {
  border-color: rgba(255, 255, 255, 0.08);
}

.info-card--solution {
  border-color: var(--border-strong);
  box-shadow: 0 0 40px -12px var(--cyan-glow);
}

.info-card-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim);
  margin-bottom: 0.75rem;
}

.info-card-tag--accent {
  color: var(--cyan);
}

.info-card-text {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--text);
}

/* How it works */
.how .section-lead {
  margin-bottom: 2.5rem;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.step {
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.step:hover {
  border-color: var(--border-strong);
  box-shadow: 0 0 28px -8px var(--cyan-glow);
}

.step-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  color: var(--cyan);
}

.step-icon svg {
  width: 100%;
  height: 100%;
}

.step-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.step-desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Features */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.feature-card {
  padding: 1.35rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.2s, transform 0.2s ease;
}

.feature-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.feature-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 1rem;
  color: var(--cyan);
}

.feature-icon svg {
  width: 100%;
  height: 100%;
}

.feature-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.feature-card p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

.try-it {
  padding-bottom: 2rem;
}

.try-it .section-title {
  margin-bottom: 1.5rem;
}

/* Loading */
.loading-panel {
  max-width: 720px;
  margin: 0 auto 1.5rem;
  padding: 1.5rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(17, 17, 17, 0.9);
}

.loading-panel.hidden {
  display: none;
}

.loading-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.loading-ring {
  width: 44px;
  height: 44px;
  position: relative;
  flex-shrink: 0;
}

.loading-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(var(--cyan), transparent 55%, var(--cyan));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: ring-spin 0.9s linear infinite;
}

@keyframes ring-spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-title {
  margin: 0 0 0.2rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.loading-step {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.toast-error {
  max-width: 720px;
  margin: 0 auto 1.5rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.06);
  color: #fecaca;
  font-size: 0.88rem;
}

.toast-error.hidden {
  display: none;
}

/* Results */
.results.hidden {
  display: none;
}

.results {
  border-top: 1px solid var(--border);
  padding-top: 2.5rem;
}

.results-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.results-url {
  margin: 0.35rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
  max-width: 100%;
}

.paper-badge {
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  max-width: 340px;
  line-height: 1.4;
}

.paper-badge.ok {
  border: 1px solid rgba(0, 212, 255, 0.35);
  background: var(--cyan-dim);
  color: var(--cyan);
}

.paper-badge.err {
  border: 1px solid rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.08);
  color: #fecaca;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.25rem;
}

.stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.78rem;
}

.stat-chip strong {
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  font-weight: 600;
}

.stat-chip span:last-child {
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
}

.token-block {
  margin-bottom: 2.5rem;
}

.token-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.token-block-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.count-pill {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--cyan);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--cyan-dim);
}

.token-hint {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.78rem;
  color: var(--dim);
}

.grid-colors {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.color-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.color-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 0 24px -10px var(--cyan-glow);
}

.color-swatch {
  height: 84px;
}

.color-body {
  padding: 0.85rem 1rem 1rem;
}

.color-name {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  margin: 0 0 0.3rem;
  word-break: break-all;
}

.color-value {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0 0 0.4rem;
  word-break: break-all;
}

.color-rule {
  font-size: 0.65rem;
  color: var(--dim);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grid-fonts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.font-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 1.1rem;
  transition: border-color 0.2s;
}

.font-card:hover {
  border-color: var(--border-strong);
}

.font-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  margin: 0 0 0.6rem;
}

.font-preview {
  font-size: 1.25rem;
  line-height: 1.35;
  margin: 0 0 0.65rem;
  min-height: 2.5em;
}

.font-preview-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 0.45rem;
}

.font-stack {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--dim);
  margin: 0;
  line-height: 1.45;
  word-break: break-word;
}

.grid-components {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.component-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 1.1rem;
}

.component-selector {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cyan);
  margin: 0 0 0.5rem;
}

.component-meta {
  font-size: 0.72rem;
  color: var(--dim);
  margin: 0 0 0.65rem;
}

.decl-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.decl-row {
  display: flex;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.35;
}

.decl-prop {
  flex-shrink: 0;
  color: var(--cyan);
  max-width: 44%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decl-val {
  color: var(--muted);
  word-break: break-word;
}

.empty-card {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  color: var(--dim);
  font-size: 0.88rem;
}
