/* hhtools project page — Apple-inspired, matches Web UI tokens */

:root {
  --bg: #f5f5f7;
  --bg-elevated: rgba(255, 255, 255, 0.72);
  --panel: rgba(255, 255, 255, 0.85);
  --panel-solid: #ffffff;
  --ink: #1d1d1f;
  --ink-secondary: #6e6e73;
  --ink-tertiary: #a1a1a6;
  --hairline: rgba(0, 0, 0, 0.10);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.12);
  --accent-2: #5e5ce6;
  --green: #34c759;
  --code-bg: rgba(0, 0, 0, 0.06);
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.10);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --nav-h: 56px;
  --max-w: 1100px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elevated: rgba(28, 28, 30, 0.88);
    --panel: rgba(44, 44, 46, 0.92);
    --panel-solid: #2c2c2e;
    --ink: #f5f5f7;
    --ink-secondary: #d1d1d6;
    --ink-tertiary: #98989d;
    --hairline: rgba(255, 255, 255, 0.14);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-soft: rgba(10, 132, 255, 0.22);
    --code-bg: rgba(255, 255, 255, 0.12);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
  }
}

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

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

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--code-bg);
}

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-elevated);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--hairline);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
}

.topbar-brand:hover { text-decoration: none; color: var(--ink); }

.logo-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex-shrink: 0;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-nav a {
  color: var(--ink-secondary);
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.topbar-nav a:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  display: flex;
  gap: 2px;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.lang-toggle button {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
}

.lang-toggle button.active {
  background: var(--panel-solid);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 980px;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--hairline);
}

.btn-ghost:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

/* ------------------------------------------------------------------ layout */
.section {
  padding: 72px 24px;
}

.section-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.section-subtitle {
  font-size: 1.05rem;
  color: var(--ink-secondary);
  max-width: 640px;
  margin-bottom: 32px;
}

/* ------------------------------------------------------------------ hero */
.hero {
  padding-top: 48px;
  padding-bottom: 64px;
  text-align: center;
}

.hero-tagline {
  font-size: 0.85rem;
  color: var(--ink-tertiary);
  margin-bottom: 12px;
}

.hero-title {
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: clamp(1.2rem, 2.8vw, 1.75rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink-secondary);
  max-width: min(960px, 96vw);
  margin: 0 auto 28px;
  line-height: 1.35;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .hero-subtitle {
    white-space: normal;
    font-size: 1.15rem;
    max-width: 640px;
  }
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.hero-requirements {
  font-size: 0.85rem;
  color: var(--ink-tertiary);
  margin-bottom: 40px;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 820px;
  margin: 0 auto 48px;
}

.hero-grid img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--hairline);
}

.quickstart-block {
  max-width: 560px;
  margin: 0 auto;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.quickstart-block h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.quickstart-block pre {
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
}

.quickstart-block pre code {
  background: none;
  padding: 0;
  white-space: pre;
}

.quickstart-note {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--ink-secondary);
}

/* ------------------------------------------------------------------ highlights */
.highlights-header {
  text-align: center;
  margin-bottom: 48px;
}

.highlight-section {
  padding: 48px 24px;
}

.highlight-section:nth-child(even) {
  background: var(--panel);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.highlight-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  max-width: var(--max-w);
  margin: 0 auto;
}

.highlight-row.reverse .highlight-text { order: 2; }
.highlight-row.reverse .highlight-media { order: 1; }

.highlight-text h3 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.highlight-text p {
  color: var(--ink-secondary);
  margin-bottom: 16px;
}

.highlight-text ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.highlight-text li {
  font-size: 0.92rem;
  color: var(--ink-secondary);
  padding-left: 18px;
  position: relative;
}

.highlight-text li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ------------------------------------------------------------------ video slot */
.video-slot {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 10;
}

.video-slot video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #111;
}

.video-slot.is-missing video { display: none; }

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent-soft), rgba(94, 92, 230, 0.15));
  padding: 24px;
  text-align: center;
}

.video-slot:not(.is-missing) .video-placeholder { display: none; }

.video-grid {
  display: grid;
  gap: 14px;
  width: 100%;
}

.video-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.video-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 860px) {
  .video-grid-2,
  .video-grid-3 {
    grid-template-columns: 1fr;
  }
}

.video-placeholder-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--panel-solid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-sm);
}

.video-placeholder p {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}

.video-placeholder small {
  font-size: 0.75rem;
  color: var(--ink-tertiary);
  max-width: 280px;
  word-break: break-all;
}

/* ------------------------------------------------------------------ workflow */
.workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.workflow-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.workflow-card .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.workflow-card h4 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.workflow-card p {
  font-size: 0.88rem;
  color: var(--ink-secondary);
}

/* ------------------------------------------------------------------ method */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.method-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.method-card h4 {
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--accent);
}

.method-card p {
  font-size: 0.92rem;
  color: var(--ink-secondary);
}

/* ------------------------------------------------------------------ datasets table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--panel);
}

table.datasets {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

table.datasets th,
table.datasets td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
}

table.datasets th {
  background: var(--code-bg);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-secondary);
}

table.datasets tr:last-child td { border-bottom: none; }

table.datasets .mode-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ------------------------------------------------------------------ citation */
.citation-block {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.citation-block h4 {
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--ink-secondary);
}

.citation-block pre {
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  font-size: 0.78rem;
  line-height: 1.5;
}

.citation-block pre code {
  background: none;
  padding: 0;
  white-space: pre;
}

.citation-links {
  font-size: 0.9rem;
  color: var(--ink-secondary);
}

/* ------------------------------------------------------------------ footer */
.site-footer {
  padding: 32px 24px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-tertiary);
  border-top: 1px solid var(--hairline);
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 768px) {
  .topbar-nav { display: none; }

  .highlight-row,
  .highlight-row.reverse {
    grid-template-columns: 1fr;
  }

  .highlight-row.reverse .highlight-text,
  .highlight-row.reverse .highlight-media {
    order: unset;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }
}
