/* TokenHub — design per tokenhub网站设计方案.md */
:root {
  /* Light, minimal style to match openrouter */
  --th-bg: #ffffff;
  --th-surface: #f8fafc;
  --th-surface-2: #ffffff;
  --th-border: rgba(15, 23, 42, 0.12);
  --th-primary: #2563eb;
  --th-primary-hover: #1d4ed8;
  --th-accent: #38bdf8;
  --th-text: #0f172a;
  --th-muted: #475569;
  --th-success: #22c55e;
  --th-radius: 12px;
  --th-radius-sm: 8px;
  /* Use standard fonts to avoid weird stretched bold look */
  --th-font-display: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --th-font-body: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --th-max: 1120px;
  --th-header-h: 64px;
}

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

html {
  scroll-behavior: smooth;
}

body.th-site {
  margin: 0;
  min-height: 100vh;
  font-family: var(--th-font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--th-text);
  background: var(--th-bg);
  -webkit-font-smoothing: antialiased;
}

/* Typography: prevent descenders (g/y) being visually clipped */
h1, h2, h3 {
  line-height: 1.2;
  letter-spacing: -0.01em;
}

a {
  color: var(--th-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.th-wrap {
  max-width: var(--th-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.th-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--th-header-h);
  border-bottom: 1px solid var(--th-border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.th-header-inner {
  max-width: var(--th-max);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.th-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--th-font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--th-text);
  text-decoration: none;
}
.th-logo:hover {
  text-decoration: none;
  color: var(--th-accent);
}

.th-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: transparent;
  display: grid;
  place-items: center;
  padding: 0;
}

.th-logo-mark svg {
  display: block;
}

.th-nav {
  display: none;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
}

@media (min-width: 960px) {
  .th-nav {
    display: flex;
  }
}

.th-nav a {
  color: var(--th-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
}
.th-nav a:hover,
.th-nav a.is-active {
  color: var(--th-text);
  background: rgba(37, 99, 235, 0.08);
  text-decoration: none;
}

.th-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.th-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--th-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.th-btn:hover {
  text-decoration: none;
}

.th-btn-ghost {
  background: transparent;
  color: var(--th-muted);
  border-color: var(--th-border);
}
.th-btn-ghost:hover {
  color: var(--th-text);
  border-color: var(--th-muted);
}

.th-btn-primary {
  background: var(--th-primary);
  color: #fff;
}
.th-btn-primary:hover {
  background: var(--th-primary-hover);
  color: #fff;
}

.th-btn-outline {
  background: transparent;
  color: var(--th-text);
  border-color: var(--th-border);
}
.th-btn-outline:hover {
  border-color: var(--th-primary);
  color: var(--th-accent);
}

.th-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius-sm);
  background: var(--th-surface);
  color: var(--th-text);
  cursor: pointer;
}

@media (min-width: 960px) {
  .th-menu-toggle {
    display: none;
  }
}

.th-mobile-nav {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1.25rem 1rem;
  border-bottom: 1px solid var(--th-border);
  background: var(--th-bg);
}
.th-mobile-nav.is-open {
  display: flex;
}
.th-mobile-nav a {
  color: var(--th-muted);
  padding: 0.5rem 0;
  font-weight: 500;
}
.th-mobile-nav a.is-active {
  color: var(--th-accent);
}

/* Hero */
.th-hero {
  position: relative;
  padding: 4rem 0 3.5rem;
  overflow: hidden;
  background: #ffffff;
}
.th-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(37, 99, 235, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(124, 58, 237, 0.08), transparent);
  pointer-events: none;
}

.th-hero-inner {
  position: relative;
  max-width: var(--th-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.th-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--th-accent);
  margin-bottom: 1rem;
}

.th-hero h1 {
  font-family: var(--th-font-display);
  font-size: clamp(2rem, 4.5vw, 2.85rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  max-width: 18ch;
}

.th-lead {
  font-size: 1.125rem;
  color: var(--th-muted);
  max-width: 52ch;
  margin: 0 0 1.75rem;
}

.th-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.th-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  padding-top: 0;
  border-top: 0;
  margin-top: 2rem;
}

.th-meta-item strong {
  display: block;
  font-family: var(--th-font-display);
  font-size: 1.85rem;
  color: var(--th-text);
  line-height: 1.1;
}
.th-meta-item span {
  font-size: 0.95rem;
  color: var(--th-muted);
  line-height: 1.25;
}

/* Sections */
.th-section {
  padding: 3.5rem 0;
}
.th-section-alt {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.04), transparent);
  border-top: 1px solid var(--th-border);
  border-bottom: 1px solid var(--th-border);
}

.th-section-head {
  max-width: var(--th-max);
  margin: 0 auto 2rem;
  padding: 0 1.25rem;
}
.th-section-head h2 {
  font-family: var(--th-font-display);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}
.th-section-head p {
  margin: 0;
  color: var(--th-muted);
  /* Let subtitles use more horizontal space; wrap only when truly needed */
  max-width: 86ch;
  white-space: normal;
  overflow-wrap: break-word;
}

/* Why TokenHub 2x2 illustrations */
.th-why-card .th-why-img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  display: block;
  margin: 0 0 1rem 0;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.04);
  border: 1px solid var(--th-border);
}

.th-why-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

/* Cards grid */
.th-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

/* Horizontal scroll row */
.th-scroll-row {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.25rem 0 1rem;
  /* Auto-scroll animation should not be affected by snap. */
  scroll-snap-type: none;
  scrollbar-width: none;
}
.th-scroll-row::-webkit-scrollbar {
  height: 0;
  width: 0;
  display: none;
}
.th-review-card {
  flex: 0 0 320px;
  scroll-snap-align: start;
}
@media (min-width: 640px) {
  .th-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 900px) {
  .th-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .th-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.th-card {
  background: var(--th-surface-2);
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius);
  padding: 1.35rem;
  transition: border-color 0.15s, transform 0.15s;
}
.th-card:hover {
  border-color: rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.th-card h3 {
  font-family: var(--th-font-display);
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}
.th-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--th-muted);
}

.th-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--th-primary);
  display: grid;
  place-items: center;
  margin-bottom: 0.85rem;
  font-size: 1.1rem;
}

/* Model cards */
.th-model-card .th-tagline {
  font-size: 0.8rem;
  color: var(--th-muted);
  margin-bottom: 0.35rem;
}
.th-model-card .th-id {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--th-accent);
}
.th-price {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--th-muted);
}
.th-price strong {
  color: var(--th-text);
}

/* Steps */
.th-steps {
  display: grid;
  gap: 1rem;
  counter-reset: step;
}
@media (min-width: 768px) {
  .th-steps {
    grid-template-columns: repeat(4, 1fr);
  }
}
.th-step {
  position: relative;
  padding: 1.25rem;
  background: var(--th-surface);
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius);
}
.th-step::before {
  counter-increment: step;
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--th-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}
.th-step h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}
.th-step p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--th-muted);
}

/* Page hero small */
.th-page-hero {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--th-border);
}
.th-page-hero h1 {
  font-family: var(--th-font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  margin: 0 0 0.5rem;
  line-height: 1.15;
  font-weight: 800;
}
.th-page-hero p {
  margin: 0;
  color: var(--th-muted);
  max-width: 60ch;
}

/* Tables */
.th-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius);
}
.th-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.th-table th,
.th-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--th-border);
}
.th-table th {
  background: var(--th-surface);
  color: var(--th-muted);
  font-weight: 600;
}
.th-table tr:last-child td {
  border-bottom: none;
}

/* Forms */
.th-form {
  max-width: 480px;
}
.th-field {
  margin-bottom: 1rem;
}
.th-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--th-muted);
  margin-bottom: 0.35rem;
}
.th-field input,
.th-field select,
.th-field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--th-radius-sm);
  border: 1px solid var(--th-border);
  background: var(--th-surface);
  color: var(--th-text);
  font-family: inherit;
  font-size: 0.95rem;
}
.th-field textarea {
  min-height: 120px;
  resize: vertical;
}

/* Tabs */
.th-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--th-border);
  padding-bottom: 0.5rem;
}
.th-tabs a {
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--th-muted);
  text-decoration: none;
}
.th-tabs a:hover,
.th-tabs a.is-active {
  color: var(--th-text);
  background: rgba(37, 99, 235, 0.15);
}

/* Code */
.th-code {
  background: #0b1220;
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius-sm);
  padding: 1rem;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #e2e8f0;
}

/* Footer */
.th-footer {
  margin-top: 4rem;
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--th-border);
  background: #f8fafc;
}

.th-footer-grid {
  max-width: var(--th-max);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .th-footer-grid {
    grid-template-columns: 2fr repeat(3, 1fr);
  }
}

.th-footer-brand p {
  color: var(--th-muted);
  font-size: 0.9rem;
  max-width: 36ch;
  margin: 0.75rem 0 0;
}

.th-footer-col h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--th-muted);
  margin: 0 0 0.75rem;
}
.th-footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.th-footer-col li {
  margin-bottom: 0.45rem;
}
.th-footer-col a {
  color: var(--th-muted);
  font-size: 0.875rem;
  text-decoration: none;
}
.th-footer-col a:hover {
  color: var(--th-accent);
}

.th-footer-bottom {
  max-width: var(--th-max);
  margin: 2rem auto 0;
  padding: 1.5rem 1.25rem 0;
  border-top: 1px solid var(--th-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--th-muted);
}

/* Filters bar */
.th-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}
.th-toolbar select {
  padding: 0.45rem 0.65rem;
  border-radius: var(--th-radius-sm);
  border: 1px solid var(--th-border);
  background: var(--th-surface);
  color: var(--th-text);
  font-family: inherit;
}

/* Chat mock */
.th-chat-layout {
  display: grid;
  gap: 1rem;
}
@media (min-width: 900px) {
  .th-chat-layout {
    grid-template-columns: 260px 1fr;
    min-height: 420px;
  }
}
.th-chat-sidebar {
  background: var(--th-surface);
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius);
  padding: 1rem;
}
.th-chat-main {
  background: var(--th-surface);
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius);
  display: flex;
  flex-direction: column;
  min-height: 360px;
}
.th-chat-placeholder {
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--th-muted);
  font-size: 0.9rem;
  padding: 2rem;
  text-align: center;
}

/* Dashboard */
.th-stat-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 2rem;
}
.th-stat {
  background: var(--th-surface);
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius);
  padding: 1rem;
}
.th-stat span {
  font-size: 0.75rem;
  color: var(--th-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.th-stat strong {
  display: block;
  font-size: 1.35rem;
  margin-top: 0.25rem;
  font-family: var(--th-font-display);
}

/* Utilities */
.th-mt-0 {
  margin-top: 0;
}
.th-mb-1 {
  margin-bottom: 0.5rem;
}
.th-muted {
  color: var(--th-muted);
}
.th-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: rgba(34, 197, 94, 0.15);
  color: var(--th-success);
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--th-primary);
  outline-offset: 2px;
}
