:root {
  --bg: #F4F7FB;
  --surface: #FFFFFF;
  --surface-alt: #EBF0F7;
  --stage: #0B1120;
  --stage-card: #162033;
  --ink: #0F172A;
  --muted: #475569;
  --stage-ink: #F8FAFC;
  --stage-muted: #CBD5E1;
  --border: #CBD5E1;
  --stage-border: #334155;
  --accent: #1D4ED8;
  --accent-hover: #1E40AF;
  --signal: #047857;
  --code-accent: #38BDF8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
}

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

[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  overflow-x: clip;
}

img, video, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

code, pre, kbd, .mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--stage);
  color: var(--stage-ink);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  z-index: 100;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  left: 16px;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Frame Ruler Signature Accent */
.frame-ruler-bar {
  background: var(--stage);
  color: var(--stage-muted);
  border-bottom: 1px solid var(--stage-border);
  font-size: 12px;
  padding: 8px 0;
}

.frame-ruler-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ruler-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--stage-ink);
  font-weight: 600;
}

.ruler-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--code-accent);
  display: inline-block;
}

/* Header & Navigation */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 18px;
}

.brand-link:hover {
  color: var(--accent);
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--stage);
  color: var(--code-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid var(--stage-border);
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.site-nav a:hover {
  background: var(--surface-alt);
  color: var(--accent);
}

.nav-toggle {
  display: none;
  background: var(--surface-alt);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
}

/* Golden Ad Slots (Zero height when empty, zero extra hex values) */
.gfs-ad-slot {
  max-width: 1120px;
  margin: 16px auto;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  overflow: hidden;
}

.gfs-ad-slot:empty {
  display: none;
}

/* Main Content Layout */
.site-main {
  padding: 32px 0 64px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--muted);
}

.hero-header {
  margin-bottom: 24px;
}

.eyebrow-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--ink);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}

.badge-signal {
  color: var(--signal);
}

h1 {
  font-size: 36px;
  line-height: 1.2;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.hero-lead {
  font-size: 18px;
  color: var(--muted);
  max-width: 70ch;
  margin: 0;
}

.community-note {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: inline-block;
}

/* Interactive Tool Stage */
.tool-stage {
  background: var(--stage);
  color: var(--stage-ink);
  border-radius: var(--radius);
  border: 1px solid var(--stage-border);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
}

.tool-stage a {
  color: var(--code-accent);
}

.studio-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 24px;
  align-items: start;
}

.studio-panel {
  background: var(--stage-card);
  border: 1px solid var(--stage-border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.studio-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--stage-ink);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.preset-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.preset-btn {
  background: var(--stage-card);
  color: var(--stage-ink);
  border: 1px solid var(--stage-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
}

.preset-btn:hover,
.preset-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--code-accent);
  color: var(--surface);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.field-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--stage-muted);
}

.field-group input,
.field-group select,
.field-group textarea {
  background: var(--stage);
  color: var(--stage-ink);
  border: 1px solid var(--stage-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  min-height: 44px;
  font-family: inherit;
  width: 100%;
}

/* Preview Monitor Canvas */
.monitor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--stage-muted);
  margin-bottom: 12px;
}

.monitor-viewport {
  background: var(--stage);
  border: 1px solid var(--stage-border);
  border-radius: var(--radius-sm);
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.monitor-clip-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--stage-card);
  border: 1px solid var(--stage-border);
  color: var(--code-accent);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.monitor-res-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--stage-muted);
  font-size: 12px;
}

.monitor-headline {
  font-size: 22px;
  font-weight: 700;
  color: var(--stage-ink);
  margin: 0 0 8px;
  transition: transform 0.08s linear, opacity 0.08s linear;
}

.monitor-subline {
  font-size: 14px;
  color: var(--stage-muted);
  margin: 0;
}

.monitor-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: var(--stage-card);
}

.monitor-progress-bar {
  height: 100%;
  width: 30%;
  background: var(--code-accent);
}

.scrubber-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.scrubber-controls input[type="range"] {
  flex: 1;
  min-width: 140px;
  accent-color: var(--code-accent);
  height: 32px;
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.metric-box {
  background: var(--stage);
  border: 1px solid var(--stage-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.metric-label {
  font-size: 12px;
  color: var(--stage-muted);
  display: block;
}

.metric-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--stage-ink);
}

/* Output Code Tabs */
.code-output-wrap {
  margin-top: 24px;
  border-top: 1px solid var(--stage-border);
  padding-top: 16px;
}

.tab-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tab-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--surface);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--surface-alt);
  color: var(--accent);
}

.btn-stage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--stage);
  color: var(--stage-ink);
  border: 1px solid var(--stage-border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-stage:hover {
  border-color: var(--code-accent);
  color: var(--code-accent);
}

.code-pre {
  background: var(--stage);
  color: var(--stage-ink);
  border: 1px solid var(--stage-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 0;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.55;
}

/* Hub Cards & Editorial Layout */
.section-heading {
  font-size: 22px;
  line-height: 1.3;
  margin: 24px 0 12px;
  color: var(--ink);
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 16px 0 32px;
}

.hub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.hub-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.hub-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Featured Visual Artwork */
.feature-figure {
  margin: 24px 0 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.feature-figure img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.feature-figure figcaption {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* Prose & Documentation Content */
.content-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
}

.prose h2 {
  font-size: 28px;
  line-height: 1.25;
  margin: 48px 0 16px;
  padding-top: 16px;
  border-top: 1px solid var(--surface-alt);
  color: var(--ink);
}

.prose h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.prose h3 {
  font-size: 22px;
  line-height: 1.3;
  margin: 24px 0 12px;
  color: var(--ink);
}

.prose p,
.prose li {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 70ch;
}

.prose p {
  margin: 0 0 16px;
}

.prose ul,
.prose ol {
  margin: 0 0 24px;
  padding-left: 24px;
}

.prose li {
  margin-bottom: 8px;
}

.prose code {
  background: var(--surface-alt);
  color: var(--ink);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
}

.prose pre {
  background: var(--stage);
  color: var(--stage-ink);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0 24px;
  font-size: 14px;
  line-height: 1.55;
}

.prose pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.prose th,
.prose td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.prose th {
  background: var(--surface-alt);
  font-weight: 700;
  color: var(--ink);
}

/* Quick Spec Grid on Content Pages */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.spec-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.spec-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

.spec-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

/* FAQ Section */
.faq-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 32px;
}

.faq-section h2 {
  margin: 0 0 24px;
  font-size: 28px;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.faq-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.faq-item summary {
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item p {
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 70ch;
}

/* Engagement & Comments */
.engage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 32px;
}

.engage-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

[data-gf-like][aria-pressed="true"],
[data-gf-liked] {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.comment-form input,
.comment-form textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 16px;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
}

.comment-list[data-gf-empty]::before {
  content: "Have a HyperFrames GSAP snippet, render tip, or CLI question? Share it with fellow builders above.";
  display: block;
  color: var(--muted);
  font-size: 14px;
  padding: 12px 0;
}

.comment-item {
  border-top: 1px solid var(--border);
  padding: 16px 0;
}

.comment-item[data-gf-owner] {
  background: var(--surface-alt);
  padding: 16px;
  border-radius: var(--radius-sm);
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 8px;
}

.comment-replies {
  margin-left: 24px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

/* Footer */
.site-footer {
  background: var(--stage);
  color: var(--stage-muted);
  padding: 48px 0;
  border-top: 1px solid var(--stage-border);
  font-size: 14px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.site-footer h3 {
  color: var(--stage-ink);
  font-size: 16px;
  margin: 0 0 12px;
}

.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer li {
  margin-bottom: 8px;
}

.site-footer a {
  color: var(--stage-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--stage-ink);
  text-decoration: underline;
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--stage-border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* Responsive Mobile Rules */
@media (max-width: 900px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
  .hub-grid {
    grid-template-columns: 1fr 1fr;
  }
  .spec-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }
  h1 {
    font-size: 28px;
  }
  .prose h2,
  .faq-section h2 {
    font-size: 22px;
  }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
  }
  .header-inner {
    flex-wrap: wrap;
    padding: 12px 0;
  }
  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
  .site-nav.is-open {
    display: flex;
  }
  .tool-stage,
  .content-shell,
  .faq-section,
  .engage-card {
    padding: 16px;
  }
  .field-grid,
  .metrics-strip,
  .hub-grid,
  .spec-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}
