/* StakeSquid Design Language - Engineer's terminal-notebook */
/* Dark-first, near-black bg, squid-ink violet accent, mono numbers */

@font-face {
    font-family: 'Space Grotesk';
    src: url(/assets/fonts/space-grotesk.woff2) format('woff2');
    font-weight: 300 700;
    font-display: swap;
}

:root {
    /* Colors - Dark First */
    --bg: #0b0e16;
    --bg-card: #10141f;
    --border: #2a3140;
    --text: #e5e9f0;
    --text-dim: #8b93a7;
    --accent: #8b7cf6;
    --glow: #22d3ee;
    --text-bright: #ffffff;
    --bg-elevated: #1a1c28;
    --border-bright: #404858;
    --mono: 'SF Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-heading: 'Space Grotesk', var(--font-sans);
    --measure: 65ch;
    --line-height: 1.7;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f7f8fa;
        --bg-card: #ffffff;
        --border: #e2e5ec;
        --text: #171a21;
        --text-dim: #5b6372;
        --accent: #6d5ce6;
        --glow: #0891b2;
        --text-bright: #000000;
        --bg-elevated: #f0f1f3;
        --border-bright: #c0c5ce;
    }
}

/* Explicit theme overrides (opt-in; dark remains the default) */
[data-theme="dark"] {
    --bg: #0b0e16;
    --bg-card: #10141f;
    --border: #2a3140;
    --text: #e5e9f0;
    --text-dim: #8b93a7;
    --accent: #8b7cf6;
    --glow: #22d3ee;
    --text-bright: #ffffff;
    --bg-elevated: #1a1c28;
    --border-bright: #404858;
}

[data-theme="light"] {
    --bg: #f7f8fa;
    --bg-card: #ffffff;
    --border: #e2e5ec;
    --text: #171a21;
    --text-dim: #5b6372;
    --accent: #6d5ce6;
    --glow: #0891b2;
    --text-bright: #000000;
    --bg-elevated: #f0f1f3;
    --border-bright: #c0c5ce;
}

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: var(--line-height);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header - Tight wordmark with squid logo */
header {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

header .header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--text-bright);
    text-decoration: none;
    letter-spacing: -0.02em;
    font-family: var(--font-heading);
}

.logo-icon {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-text .stake {
    font-size: 0.95em;
    line-height: 1;
}

.logo-text .squid {
    font-size: 1.05em;
    line-height: 1;
}

nav {
    font-family: var(--font-heading);
}

nav a {
    color: var(--text-dim);
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

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

/* Main content */
main {
    padding: 2rem 0;
}

footer {
    padding: 3rem 0 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9rem;
}

footer a {
    color: var(--text-dim);
    text-decoration: none;
}

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

/* Typography */
h1, h2, h3 {
    font-family: var(--font-heading);
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 .mono {
    font-family: var(--mono);
    font-weight: 600;
    color: var(--accent);
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
}

/* Blog post body: clear section hierarchy (card title reset must not flatten these) */
article.post {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2rem;
    margin-bottom: 2rem;
    max-width: calc(var(--measure) + 4rem);
}

article.post > header h1 {
    margin-bottom: 0.5rem;
}

article.post h2 {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
    color: var(--text);
    margin: 3rem 0 0.75rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--border);
}

article.post h2:first-of-type {
    /* First section after intro/meme: keep top space, skip the rule so it doesn't
       double-up against the meme figure or meta line */
    border-top: none;
    padding-top: 0.25rem;
    margin-top: 2.25rem;
}

article.post h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: var(--text);
    margin: 2.25rem 0 0.5rem;
    padding-left: 0.7rem;
    border-left: 3px solid var(--accent);
}

article.post p {
    color: var(--text);
}

article.post .post-meme {
    margin: 1.5rem 0 2rem;
    max-width: var(--measure);
}

article.post .post-meme img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    background: var(--bg);
}

p {
    margin-bottom: 1.25rem;
    max-width: var(--measure);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

/* Monospace numbers and metrics */
.mono,
.number,
.stat-number,
.code,
pre,
code {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

/* Hero section */
.hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.hero h1 {
    font-size: 2.75rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-dim);
    max-width: 700px;
    margin: 0 auto;
}

.hero-graphic {
    margin: 2rem 0;
}

.hero-graphic svg {
    max-width: 100%;
    height: auto;
    width: min(880px, 100%);
}

.loop-graphic {
    margin: 2rem 0;
}

.loop-graphic svg {
    max-width: 100%;
    height: auto;
    width: min(880px, 100%);
}

/* Stat tiles - the data IS the hero */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-secondary {
    display: block;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-top: 0.35rem;
}

.stat-provenance {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.25rem;
    opacity: 0.7;
}

/* Cards - no drop shadows, thin rules */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 0;
}

.card h2,
.card h3 {
    margin-top: 0;
}

.card:first-child {
    margin-top: 0;
}

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: var(--text-bright);
    border: none;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.95rem;
}

.btn:hover {
    background: var(--accent-subtle);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border-bright);
}

.btn-secondary:hover {
    background: var(--border-bright);
    color: var(--text-bright);
}

/* Tags */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--accent);
}

/* Code blocks */
.code-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 1.25rem;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.9rem;
    margin: 1.25rem 0;
    line-height: 1.6;
}

.code-block code {
    background: none;
    padding: 0;
    color: var(--text);
    /* bare <code> is inline and collapses newlines — command blocks must be copy-pasteable */
    display: block;
    white-space: pre;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg-card);
    font-weight: 600;
    font-family: var(--mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}

.table tr:hover {
    background: var(--bg-elevated);
}

/* Blockquotes */
blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin-left: 0;
    color: var(--text-dim);
    font-style: italic;
}

/* Utility classes */
.text-muted {
    color: var(--text-dim);
}

.text-mono {
    font-family: var(--mono);
}

.updated {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
}

/* Chains directory */
.chains-page {
    padding-bottom: 4rem;
}

.chains-hero {
    margin: 2rem 0 2.5rem;
    max-width: 40rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.75rem;
}

.chains-eyebrow {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.6rem;
}

.chains-hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 0.85rem;
}

.chains-lede {
    color: var(--text-dim);
    font-size: 1.05rem;
    line-height: 1.65;
    margin-bottom: 0.75rem;
}

.chains-lede strong {
    color: var(--text);
    font-weight: 600;
}

.chains-count {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.chains-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    /* stretch (default): every card in a row is the same height → even rows.
       The old "detached footer" artifact is handled by anchoring the meta
       block (.chain-tags and what follows) to the card bottom instead. */
}

/* ONE article = ONE grid item. Never nest <a> inside a wrapping card <a>. */
.chain-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.1rem 1.15rem 1.15rem;
    color: var(--text);
    min-width: 0; /* prevent grid blowout */
}

.chain-card:hover {
    border-color: var(--accent);
}

.chain-card-top {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    min-width: 0;
}

.chain-card-title {
    min-width: 0;
    flex: 1;
}

.chain-card h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 0.45rem;
    line-height: 1.25;
}

.chain-card h3 a {
    color: var(--text);
    text-decoration: none;
}

.chain-card h3 a:hover {
    color: var(--accent);
}

.chain-monogram {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: color-mix(in srgb, var(--mono-hue, var(--accent)) 18%, var(--bg-elevated));
    border: 1px solid color-mix(in srgb, var(--mono-hue, var(--accent)) 40%, var(--border));
    font-family: var(--mono);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--mono-hue, var(--accent));
}

.chain-logo {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    object-fit: contain;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    padding: 4px;
}

.chain-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.chain-chip {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.45rem;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-dim);
    text-decoration: none;
    line-height: 1.4;
}

.chain-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.chain-chip.chip-mainnet {
    color: var(--text);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.chain-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: auto; /* anchor tags + ids + project link to the card bottom */
}

.chain-tag {
    font-family: var(--mono);
    font-size: 0.68rem;
    padding: 0.12rem 0.4rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-dim);
}

.chain-tag-type {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
}

.chain-ids {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-dim);
}

.chain-ids code {
    font-family: inherit;
    font-size: inherit;
    background: none;
    padding: 0;
    color: var(--text-dim);
}

.chain-project {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    align-self: flex-start;
}

.chain-project:hover {
    text-decoration: underline;
}

.chain-card .meta {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.chain-card .chain-id {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Inline squid for footer etc */
.squid-icon-inline {
    display: inline-block;
    width: 16px;
    height: 16px;
    fill: var(--accent);
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Responsive */
@media (max-width: 1100px) {
    .chains-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    header nav {
        display: block;
        margin-top: 1rem;
    }
    
    header nav a {
        display: block;
        margin: 0.5rem 0;
    }
    
    .chains-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 900px) {
    .chains-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animation for loading states */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 2s ease-in-out infinite;
}

