/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ===== LAYOUT ===== */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { height: 100%; display: flex; align-items: center; gap: 1.5rem; }
.header-back {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  transition: color 0.15s;
}
.header-back:hover { color: var(--text-muted); }
.header-divider { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }
.header-brand {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.header-brand span { color: var(--text-dim); }
.header-nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
}
.header-nav a {
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.15s;
}
.header-nav a:hover { color: var(--text); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.15s;
  border: none;
  min-height: 36px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.85; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

/* ===== EYEBROW ===== */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.eyebrow::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 2px;
  background: var(--accent);
  flex-shrink: 0;
}

/* ===== SECTION LABEL ===== */
.section-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== HERO ===== */
.hero { padding: 4rem 0 3.5rem; }
.hero-inner {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 3rem;
  align-items: center;
}
.hero h1 {
  font-family: var(--mono);
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}
.hero-lede {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 52ch;
  margin-bottom: 2rem;
  line-height: 1.6;
}
.hero-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

/* ===== IBC SVG DIAGRAM ===== */
.ibc-svg-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.ibc-svg .relay-line {
  stroke: #ff5f1f;
  stroke-width: 2;
  stroke-dasharray: 7 4;
  stroke-opacity: 0.75;
  animation: dash-flow 2.5s linear infinite;
}
.ibc-svg .validator-line {
  stroke: var(--border-strong);
  stroke-width: 1.5;
  stroke-opacity: 0.9;
}
.ibc-svg .hub-bg {
  fill: var(--bg);
}
.ibc-svg .hub-ring {
  fill: rgba(255, 95, 31, 0.15);
  stroke: rgba(255, 95, 31, 0.7);
  stroke-width: 1.5;
}
.ibc-svg .hub-text {
  fill: var(--accent);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  dominant-baseline: middle;
  text-anchor: middle;
}
.ibc-svg .node-dot {
  fill: var(--bg-elev);
  stroke: var(--border-strong);
  stroke-width: 1.5;
}
.ibc-svg .relay-node {
  fill: var(--bg-elev);
  stroke: #ff5f1f;
  stroke-opacity: 0.7;
  stroke-width: 1.5;
}
.ibc-svg .node-label {
  fill: var(--text-muted);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  paint-order: stroke fill;
  stroke: var(--bg);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.ibc-svg .relay-only-line {
  stroke: #ff5f1f;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  stroke-opacity: 0.4;
  animation: dash-flow 2.5s linear infinite;
}
.ibc-svg .relay-only-dot {
  fill: var(--bg);
  stroke: #ff5f1f;
  stroke-opacity: 0.45;
  stroke-width: 1.5;
  stroke-dasharray: 3 2;
}
.ibc-svg .relay-only-label {
  fill: var(--text-muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-style: italic;
  paint-order: stroke fill;
  stroke: var(--bg);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.ibc-svg a { cursor: pointer; }
.ibc-svg a circle,
.ibc-svg a .node-dot,
.ibc-svg a .relay-node,
.ibc-svg a .relay-only-dot { transition: opacity 0.15s, stroke-opacity 0.15s; }
.ibc-svg a:hover circle { opacity: 0.65; }
.ibc-svg a text { transition: fill 0.15s; }
.ibc-svg a:hover text { fill: var(--accent); }
@keyframes dash-flow {
  to { stroke-dashoffset: -55; }
}

.ibc-legend {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ibc-legend .pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* ===== IBC RELAY SECTION ===== */
.ibc-section { padding: 3.5rem 0; border-top: 1px solid var(--border); }
.relay-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}
.relay-title {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.relay-ref {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}
.relay-ref a { color: var(--accent); }
.relay-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.relay-pill {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  background: rgba(255, 95, 31, 0.08);
  border: 1px solid rgba(255, 95, 31, 0.3);
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
}
.ref-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.ref-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color 0.12s;
}
.ref-card:hover { border-color: var(--border-strong); }
.ref-card-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 0.2rem;
}
.ref-card-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}
.ref-arrow {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ===== CHAINS GRID ===== */
.chains-section { padding: 3.5rem 0; border-top: 1px solid var(--border); }
.chains-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.chain-card {
  background: var(--bg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: background 0.12s;
}
.chain-card:hover { background: var(--bg-elev); }
.chain-mono {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.chain-info { flex: 1; min-width: 0; }
.chain-name { font-size: 13px; font-weight: 500; margin-bottom: 0.3rem; }
.chain-nets { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.net-badge {
  font-family: var(--mono);
  font-size: 10px;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
}
.net-badge.live {
  color: var(--live);
  border-color: rgba(94, 230, 160, 0.3);
  background: rgba(94, 230, 160, 0.07);
}
.net-badge.test {
  color: var(--text-dim);
}

/* ===== REFERENCE CARDS ===== */
.reference-section { padding: 3.5rem 0; border-top: 1px solid var(--border); }
.reference-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ===== TOOLS ===== */
.tools-section { padding: 3.5rem 0; border-top: 1px solid var(--border); }
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.tool-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.12s;
}
.tool-card:hover { border-color: var(--border-strong); }
.tool-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 0.4rem;
}
.tool-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.tool-link {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}

/* ===== FOOTER ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  margin-top: 2rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-copy {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a {
  font-size: 12px;
  color: var(--text-dim);
  transition: color 0.12s;
}
.footer-links a:hover { color: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .ibc-svg-wrap { display: none; }
  .ref-cards { grid-template-columns: 1fr; }
  .reference-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr 1fr; }
  .header-nav { display: none; }
  .header-back { display: none; }
  .header-divider { display: none; }
}
@media (max-width: 520px) {
  .chains-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
}
