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

:root {
    --bg:            #0c0b09;
    --surface:       #131110;
    --card-bg:       #1a1714;
    --card-border:   #2a2520;
    --card-shadow:   rgba(0, 0, 0, 0.55);
    --text:          #ddd5c0;
    --text-muted:    #7a6f5c;
    --text-dim:      #4a4238;
    --accent:        #c07828;
    --accent-glow:   rgba(192, 120, 40, 0.12);
    --link:          #c07828;

    --live-color:    #4d8a56;
    --live-bg:       rgba(77, 138, 86, 0.1);
    --build-color:   #4a7096;
    --build-bg:      rgba(74, 112, 150, 0.1);
    --concept-color: #6e665a;
    --concept-bg:    rgba(110, 102, 90, 0.1);
    --archive-color: #8a4242;
    --archive-bg:    rgba(138, 66, 66, 0.1);
    --oss-color:     #7060a0;
    --oss-bg:        rgba(112, 96, 160, 0.1);

    --font-mono:  'JetBrains Mono', 'Courier New', monospace;
    --font-body:  'Inter', system-ui, -apple-system, sans-serif;

    --radius:     4px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Warm ambient glow from top */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse 80% 40% at 50% -5%, rgba(192, 120, 40, 0.07) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Film grain overlay */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
    opacity: 0.055;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* ───── HEADER ───── */
.site-header {
    position: relative;
    z-index: 1;
    padding: 4rem 2.5rem 2.5rem;
    max-width: 900px;
}

.site-title {
    font-family: var(--font-mono);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1;
}

.site-tagline {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.01em;
}

/* ───── GRID ───── */
.lab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.75rem;
    padding: 1rem 2rem 4rem;
    position: relative;
    z-index: 1;
    align-items: start;
}

/* ───── CARDS ───── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    position: relative;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    box-shadow:
        0 2px 8px var(--card-shadow),
        0 1px 2px rgba(0,0,0,0.4);
}

/* Subtle pin at top */
.card-pin {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3a3530;
    border: 1px solid #4a4540;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    z-index: 2;
}

/* Rotations — irregular, like pinned notes */
.card:nth-child(5n+1) { transform: rotate(-1.4deg); }
.card:nth-child(5n+2) { transform: rotate(0.8deg); }
.card:nth-child(5n+3) { transform: rotate(-0.6deg); }
.card:nth-child(5n+4) { transform: rotate(1.1deg); }
.card:nth-child(5n+5) { transform: rotate(-0.9deg); }

.card--clickable {
    cursor: pointer;
}

.card--clickable:hover,
.card--clickable:focus-visible {
    transform: rotate(0deg) translateY(-5px) !important;
    box-shadow:
        0 12px 36px rgba(0,0,0,0.6),
        0 2px 8px rgba(0,0,0,0.4),
        0 0 0 1px var(--accent);
    border-color: var(--accent);
    outline: none;
}

.card-inner {
    padding: 1.4rem 1.4rem 1.2rem;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.card-version {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-dim);
    letter-spacing: 0.04em;
}

.card-title {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 0.55rem;
}

.card-desc {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ───── STACK TAGS ───── */
.stack-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
}

.tag {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-dim);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--card-border);
    padding: 0.2em 0.55em;
    border-radius: 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ───── CARD LINKS ───── */
.card-links {
    display: flex;
    gap: 1rem;
    margin-top: auto;
}

.card-links a {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.04em;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.card-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ───── STATUS BADGES ───── */
.status-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.2em 0.55em;
    border-radius: 2px;
    border: 1px solid currentColor;
    line-height: 1.4;
}

.status-live          { color: var(--live-color);    background: var(--live-bg); }
.status-building      { color: var(--build-color);   background: var(--build-bg); }
.status-concept       { color: var(--concept-color); background: var(--concept-bg); }
.status-archived      { color: var(--archive-color); background: var(--archive-bg); }
.status-open-source   { color: var(--oss-color);     background: var(--oss-bg); }

/* ───── EMPTY STATE ───── */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-dim);
}

.empty-icon {
    display: block;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state p {
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.empty-sub {
    margin-top: 0.5rem;
    font-size: 0.8rem !important;
    opacity: 0.6;
}

.empty-sub a {
    color: var(--accent);
    text-decoration: none;
}

/* ───── PROJECT DETAIL PAGE ───── */
body.project-page {
    max-width: 860px;
    margin: 0 auto;
}

.project-header {
    position: relative;
    z-index: 1;
    padding: 3rem 2.5rem 2rem;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 0;
}

.back-link {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    letter-spacing: 0.04em;
    display: inline-block;
    margin-bottom: 1.5rem;
    transition: color 0.15s;
}

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

.project-header-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.project-title {
    font-family: var(--font-mono);
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 0.6rem;
}

.project-desc {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.25rem;
    max-width: 60ch;
}

.project-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.action-link {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.04em;
    padding: 0.4em 0.9em;
    border: 1px solid var(--accent);
    border-radius: 2px;
    transition: background 0.15s, color 0.15s;
}

.action-link:hover {
    background: var(--accent);
    color: var(--bg);
}

.action-link--primary {
    background: var(--accent);
    color: var(--bg);
}

.action-link--primary:hover {
    background: transparent;
    color: var(--accent);
}

/* ───── README BODY ───── */
.project-main {
    position: relative;
    z-index: 1;
    padding: 2.5rem 2.5rem 5rem;
}

.readme-body {
    max-width: 68ch;
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--text);
}

.readme-body h1,
.readme-body h2,
.readme-body h3,
.readme-body h4 {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text);
    margin: 2em 0 0.75em;
    line-height: 1.3;
}

.readme-body h1 { font-size: 1.6rem; }
.readme-body h2 { font-size: 1.25rem; border-bottom: 1px solid var(--card-border); padding-bottom: 0.4em; }
.readme-body h3 { font-size: 1.05rem; }
.readme-body h4 { font-size: 0.95rem; }

.readme-body p { margin-bottom: 1em; }

.readme-body a {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.readme-body a:hover { opacity: 0.8; }

.readme-body code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--card-border);
    border-radius: 3px;
    padding: 0.1em 0.4em;
}

.readme-body pre {
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5em 0;
}

.readme-body pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.6;
}

.readme-body ul,
.readme-body ol {
    margin: 0.75em 0 1em 1.5em;
}

.readme-body li { margin-bottom: 0.3em; }

.readme-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5em 1em;
    margin: 1em 0;
    color: var(--text-muted);
    font-style: italic;
}

.readme-body hr {
    border: none;
    border-top: 1px solid var(--card-border);
    margin: 2em 0;
}

.readme-body img {
    max-width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
}

.readme-body strong { color: var(--text); font-weight: 600; }
.readme-body del    { opacity: 0.5; }

/* ───── RESPONSIVE ───── */
@media (max-width: 600px) {
    .site-header { padding: 2.5rem 1.25rem 1.5rem; }
    .lab-grid    { padding: 0.75rem 1rem 3rem; gap: 1.25rem; }
    .card-inner  { padding: 1.1rem 1.1rem 1rem; }
    .project-header,
    .project-main { padding-left: 1.25rem; padding-right: 1.25rem; }
}
