/* xity.dev — a cathedral of code
   glassmorphism dreamscape, jewel-toned void, pastoral-romantic */

:root {
    --deep-void: #0e0e1a;
    --amethyst: #8b5cf6;
    --emerald: #10b981;
    --sapphire: #3b82f6;
    --ruby: #ef4444;
    --pearl: #e8e4f0;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-bg-faint: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-border-bright: rgba(255, 255, 255, 0.30);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.30);

    --wind-x: 0px;
    --wind-y: 0px;

    --font-serif: 'Libre Baskerville', Georgia, serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'Fira Code', 'SF Mono', Menlo, monospace;
}

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

html, body {
    min-height: 100%;
    background: var(--deep-void);
    color: var(--pearl);
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.7;
    overflow-x: hidden;
}

body {
    position: relative;
    min-height: 100vh;
    padding-bottom: 4rem;
}

/* ----- Generative backdrop ----- */
.generative-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(139, 92, 246, 0.18), transparent 55%),
        radial-gradient(ellipse at 80% 80%, rgba(16, 185, 129, 0.15), transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(59, 130, 246, 0.12), transparent 60%),
        var(--deep-void);
}

.gradient-layer {
    position: absolute;
    inset: -30%;
    border-radius: 50%;
    filter: blur(80px);
    mix-blend-mode: screen;
    opacity: 0.5;
    will-change: transform;
}

.gradient-a {
    background: conic-gradient(from 0deg,
        rgba(139, 92, 246, 0.22),
        rgba(59, 130, 246, 0.18),
        rgba(16, 185, 129, 0.22),
        rgba(139, 92, 246, 0.22));
    animation: spin-slow 45s linear infinite;
}

.gradient-b {
    background: radial-gradient(circle at 30% 30%,
        rgba(16, 185, 129, 0.22), transparent 50%),
        radial-gradient(circle at 70% 60%,
        rgba(139, 92, 246, 0.22), transparent 50%);
    animation: spin-slow 60s linear infinite reverse;
}

.gradient-c {
    background: conic-gradient(from 120deg,
        rgba(59, 130, 246, 0.20),
        rgba(239, 68, 68, 0.10),
        rgba(139, 92, 246, 0.20),
        rgba(59, 130, 246, 0.20));
    animation: spin-slow 30s linear infinite;
    opacity: 0.35;
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ----- Particle layer ----- */
.particle-layer {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    filter: blur(0.4px);
    will-change: transform, opacity;
}

.particle.size-large  { width: 6px; height: 6px; opacity: 0.55; }
.particle.size-medium { width: 4px; height: 4px; opacity: 0.45; }
.particle.size-small  { width: 2px; height: 2px; opacity: 0.35; }

.particle.hue-amethyst { background: var(--amethyst); box-shadow: 0 0 8px rgba(139, 92, 246, 0.8); }
.particle.hue-emerald  { background: var(--emerald);  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8); }
.particle.hue-sapphire { background: var(--sapphire); box-shadow: 0 0 8px rgba(59, 130, 246, 0.8); }

.connection-lines {
    position: fixed;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ----- Header ----- */
.site-header {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
    font-family: var(--font-sans);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: 0.02em;
}

.brand-mark {
    color: var(--amethyst);
    font-size: 1.1rem;
    transform: translateY(-1px);
}

.brand-dot { color: var(--emerald); }

.site-nav {
    display: flex;
    gap: 1.8rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.site-nav a {
    color: var(--pearl);
    text-decoration: none;
    opacity: 0.75;
    transition: color 250ms ease, opacity 250ms ease;
}

.site-nav a:hover {
    color: var(--emerald);
    opacity: 1;
}

/* ----- Masonry ----- */
.masonry {
    position: relative;
    z-index: 5;
    column-count: 3;
    column-gap: 16px;
    padding: 1rem 48px 3rem;
}

@media (max-width: 960px) {
    .masonry { column-count: 2; }
}

@media (max-width: 640px) {
    .masonry {
        column-count: 1;
        padding: 1rem 16px 3rem;
    }
    .site-header { padding: 1.5rem 1.25rem; }
    .site-nav { gap: 1rem; }
}

/* ----- Glass cards ----- */
.card {
    display: block;
    width: 100%;
    margin: 0 0 16px;
    padding: 1.75rem 1.6rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    box-shadow: var(--glass-shadow);
    color: var(--pearl);
    break-inside: avoid;
    min-height: 200px;

    opacity: 0;
    transform: scale(0.95);
    transition:
        transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
        opacity 300ms ease,
        backdrop-filter 300ms ease,
        border-color 300ms ease,
        box-shadow 300ms ease;
}

.card.revealed {
    opacity: 1;
    transform: scale(1);
}

.card:hover {
    transform: scale(1.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-color: var(--glass-border-bright);
    box-shadow: 0 14px 42px rgba(0, 0, 0, 0.38),
                0 0 0 1px rgba(139, 92, 246, 0.25);
    z-index: 6;
}

/* depth-of-field: other cards recede when one is hovered */
.masonry.has-hover .card:not(:hover) {
    transform: scale(0.98);
    opacity: 0.9;
}

.card-hero {
    column-span: all;
    min-height: 400px;
    background: var(--glass-bg-faint);
    padding: 3rem 2.4rem;
}

.card-tall   { min-height: 340px; }
.card-medium { min-height: 280px; }
.card-short  { min-height: 180px; }

/* ----- Typography inside cards ----- */
.card h1 {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 2.8rem;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--pearl);
    margin-bottom: 1.25rem;
}

.card h2 {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.75rem;
    line-height: 1.2;
    color: var(--amethyst);
    margin-bottom: 0.8rem;
}

.card h3 {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 1.3rem;
    line-height: 1.3;
    color: var(--pearl);
    margin-bottom: 0.6rem;
}

.card h4 {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--pearl);
    margin-bottom: 0.5rem;
}

.card p {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--pearl);
    margin-bottom: 0.85rem;
}

.card p.lede {
    font-size: 1.1rem;
    line-height: 1.6;
    color: rgba(232, 228, 240, 0.92);
    max-width: 42rem;
}

.card p.byline,
.card p.caption {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: rgba(232, 228, 240, 0.55);
    margin-top: 0.4rem;
    letter-spacing: 0.02em;
}

.hero-meta {
    margin-top: 2rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: rgba(232, 228, 240, 0.6);
}

.meta-label { color: var(--emerald); }
.meta-dot   { color: rgba(232, 228, 240, 0.4); margin: 0 0.4rem; }

/* ----- Content staging micro-animation ----- */
.card.revealed h1,
.card.revealed h2,
.card.revealed h3,
.card.revealed h4 {
    animation: content-fade 420ms ease both;
}
.card.revealed p,
.card.revealed ul,
.card.revealed .tool-list,
.card.revealed .subscribe,
.card.revealed .atlas-pins {
    animation: content-fade 520ms ease 100ms both;
}
.card.revealed pre,
.card.revealed code {
    animation: content-fade 520ms ease 200ms both;
}

@keyframes content-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ----- Code ----- */
pre, code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.card pre {
    background: rgba(14, 14, 26, 0.55);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    overflow-x: auto;
    color: var(--emerald);
    margin: 0.4rem 0 0.7rem;
    line-height: 1.55;
}

.card pre code { color: var(--emerald); }

.kw  { color: var(--amethyst); }
.fn  { color: var(--sapphire); }
.num { color: var(--ruby); }
.str { color: var(--pearl); }
.com { color: rgba(232, 228, 240, 0.5); font-style: italic; }
.ok  { color: var(--emerald); }

/* ----- Lists ----- */
.tool-list {
    list-style: none;
    margin-top: 0.6rem;
}

.tool-list li {
    display: flex;
    flex-direction: column;
    padding: 0.65rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tool-list li:last-child { border-bottom: none; }

.tool-name {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--emerald);
    font-weight: 500;
}

.tool-desc {
    font-family: var(--font-sans);
    font-size: 0.88rem;
    color: rgba(232, 228, 240, 0.75);
    margin-top: 2px;
}

.changelog {
    list-style: none;
    margin-top: 0.6rem;
}

.changelog li {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    padding: 0.4rem 0;
    color: rgba(232, 228, 240, 0.88);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.changelog li:last-child { border: none; }

.change-date {
    display: inline-block;
    width: 4.4rem;
    color: var(--sapphire);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.atlas-pins {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.pin {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
}

.pin-amethyst { color: var(--amethyst); border-color: rgba(139, 92, 246, 0.45); }
.pin-emerald  { color: var(--emerald);  border-color: rgba(16, 185, 129, 0.45); }
.pin-sapphire { color: var(--sapphire); border-color: rgba(59, 130, 246, 0.45); }

/* ----- Subscribe form ----- */
.subscribe {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.subscribe-input {
    flex: 1 1 14rem;
    background: rgba(14, 14, 26, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    color: var(--pearl);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 200ms ease;
}

.subscribe-input::placeholder { color: rgba(232, 228, 240, 0.4); }
.subscribe-input:focus { border-color: var(--amethyst); }

.subscribe-btn {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(16, 185, 129, 0.25));
    border: 1px solid rgba(139, 92, 246, 0.5);
    color: var(--pearl);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 200ms ease, border-color 200ms ease, background 200ms ease;
}

.subscribe-btn:hover {
    transform: translateY(-1px);
    border-color: var(--emerald);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(16, 185, 129, 0.35));
}

.subscribe-btn.lit {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.45), rgba(59, 130, 246, 0.45));
    border-color: var(--emerald);
}

/* ----- Footer ----- */
.site-footer {
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 1rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: rgba(232, 228, 240, 0.5);
}

.footer-sep { color: var(--amethyst); }

/* ----- Firefly-like particle float animations (fallback presets) ----- */
@keyframes drift-a {
    0%   { transform: translate(calc(0px + var(--wind-x)), calc(0px + var(--wind-y))); }
    50%  { transform: translate(calc(40px + var(--wind-x)), calc(-30px + var(--wind-y))); }
    100% { transform: translate(calc(0px + var(--wind-x)), calc(0px + var(--wind-y))); }
}

@keyframes drift-b {
    0%   { transform: translate(calc(0px + var(--wind-x)), calc(0px + var(--wind-y))); }
    50%  { transform: translate(calc(-50px + var(--wind-x)), calc(-20px + var(--wind-y))); }
    100% { transform: translate(calc(0px + var(--wind-x)), calc(0px + var(--wind-y))); }
}

@keyframes drift-c {
    0%   { transform: translate(calc(0px + var(--wind-x)), calc(0px + var(--wind-y))); }
    50%  { transform: translate(calc(25px + var(--wind-x)), calc(45px + var(--wind-y))); }
    100% { transform: translate(calc(0px + var(--wind-x)), calc(0px + var(--wind-y))); }
}
