/* Enable animating --reveal-size for gradient transition.
   Firefox doesn't support @property; falls back to instant theme switch. */
@property --reveal-size {
    syntax: '<percentage>';
    initial-value: 0%;
    inherits: false;
}

:root {
    /* Colors */
    --void: #0a0a0c;
    --surface: #111118;
    --ghost: #ffaa00;
    --ghost-dim: #cc8800;
    --ghost-glow: rgba(255, 170, 0, 0.5);
    --neon-blue: #05d9e8;
    --neon-blue-fade: rgba(5, 217, 232, 0.1);
    --neon-blue-border: rgba(5, 217, 232, 0.3);
    --guild-gold: #f0a500;
    --guild-gold-fade: rgba(240, 165, 0, 0.1);
    --guild-gold-border: rgba(240, 165, 0, 0.3);
    --chrome: #e0e0e8;
    --steel: #a8a8b8;
    --rust: #5a5a6e;
    --dark-rust: #2a2a32;
    --error: #ff6b6b;

    /* Alternate theme accent (for glitch preview) */
    --ghost-alt: #00c8d7;

    /* Grid overlay */
    --grid-color: rgba(255, 170, 0, 0.04);

    /* Fonts */
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-display: 'Orbitron', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
}

/* Light theme */
[data-theme="light"] {
    --void: #f5f3ef;
    --surface: #ffffff;
    --ghost: #00c8d7;
    --ghost-dim: #00a8b5;
    --ghost-glow: transparent;
    --chrome: #1a1a1f;
    --steel: #3a3a4a;
    --rust: #6a6a7e;
    --dark-rust: #d8d6d0;
    --ghost-alt: #ffaa00;
    --grid-color: rgba(5, 217, 232, 0.06);
}

[data-theme="light"] .logo__text--light {
    text-shadow: none;
    animation: none;
}

/* Theme transition - radial gradient pulse */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-new(root) {
    mask: radial-gradient(
        circle at var(--pulse-x, 50%) var(--pulse-y, 50%),
        black var(--reveal-size, 0%),
        transparent calc(var(--reveal-size, 0%) + 10%)
    );
    animation: gradient-reveal 0.8s ease-out forwards;
}

@keyframes gradient-reveal {
    from { --reveal-size: 0%; }
    to { --reveal-size: 150%; }
}

/* Ghost color transition after landing */
.theme-toggle--animating {
    color: var(--ghost-pre-transition);
}

.theme-toggle {
    transition: color 0.15s ease-out;
}

html {
    scroll-behavior: smooth;
}

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

body {
    font-family: var(--font-body);
    background: var(--void);
    color: var(--chrome);
    min-height: 100vh;
    line-height: 1.7;
    font-size: 16px;
    overflow-x: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Theme transitions */
.card,
.product__status,
.changelog,
footer {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}


/* Grid */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: -1;
}

/* Shared card style */
.card {
    background: var(--surface);
    border: 1px solid var(--dark-rust);
    padding: 32px;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px 80px;
    position: relative;
    z-index: 1;
}

/* Header / Logo */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1080px;
    margin: 0 auto;
    background: color-mix(in srgb, var(--void) 85%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--dark-rust);
}

.header__nav {
    display: flex;
    gap: 24px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.header__nav a {
    color: var(--steel);
    text-decoration: none;
    transition: color 0.2s ease;
}

.header__nav a:hover {
    color: var(--ghost);
}

/* Anchor scroll offset for sticky header */
[id] {
    scroll-margin-top: 80px;
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.65);
    transform-origin: center center;
}

/* Stacked logo layout: ghost over light */
.logo--stacked {
    flex-direction: column;
    align-items: flex-start;
    line-height: 0.9;
}

.logo__line {
    display: block;
}

.logo__line--top {
    /* "ghost" line */
}

.logo__line--bottom {
    /* Offset "light" so L aligns under the ghost (o position) */
    /* "gh" = 2 chars, ghost ≈ 1 char width, so offset by ~2 char widths */
    margin-left: 1.85em;
}

/* Hero */
.hero {
    text-align: center;
    padding: 80px 24px;
    max-width: 720px;
    margin: 0 auto;
}

.hero__title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--chrome);
    margin-bottom: 16px;
}

.hero__subtitle {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--steel);
    letter-spacing: 0.02em;
}

.hero__art {
    background: linear-gradient(90deg, var(--ghost), var(--ghost-alt), var(--ghost));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: artGradient 7s ease-in-out infinite;
}

@keyframes artGradient {
    0%, 100% { background-position: 0% 0; }
    50% { background-position: 100% 0; }
}

/* Theme toggle (ghost "o" in logo) */
.theme-toggle {
    background: none;
    border: none;
    padding: 0;
    margin: 0 -0.02em;
    cursor: pointer;
    color: var(--ghost);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    transition: transform 0.15s ease;
}

.theme-toggle__ghost {
    width: 2.7em;
    height: 2.7em;
    filter:
        drop-shadow(0 0 4px var(--ghost-glow))
        drop-shadow(0 0 8px var(--ghost-glow))
        drop-shadow(0 0 16px var(--ghost-glow));
    transition: filter 0.2s ease, transform 0.15s ease;
}

.theme-toggle:hover .theme-toggle__ghost {
    filter:
        drop-shadow(0 0 6px var(--ghost))
        drop-shadow(0 0 12px var(--ghost))
        drop-shadow(0 0 24px var(--ghost-glow));
    transform: scale(1.1);
}

.theme-toggle:focus {
    outline: none;
}

.theme-toggle:focus .theme-toggle__ghost {
    filter:
        drop-shadow(0 0 6px var(--ghost))
        drop-shadow(0 0 12px var(--ghost))
        drop-shadow(0 0 24px var(--ghost-glow));
}

.theme-toggle__eye {
    fill: var(--void);
    transition: transform 0.15s ease-out;
}

.theme-toggle--peeking .theme-toggle__eye {
    transform: translate(1.5px, 2px);
}

/* Ghost float animation on click */
.theme-toggle--animating .theme-toggle__ghost {
    animation: ghostFloat 0.8s ease-in-out;
}

@keyframes ghostFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-12px) scale(1.1);
    }
}

.logo__text,
.logo__line {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: lowercase;
}

.logo__text--ghost { color: var(--chrome); }

.logo__text--light {
    color: var(--ghost);
    text-shadow: 0 0 10px var(--ghost), 0 0 20px var(--ghost), 0 0 40px var(--ghost-dim);
    animation: pulse 3s ease-in-out infinite;
}

.logo__text--tech {
    color: var(--rust);
    font-size: 0.6em;
    font-weight: 400;
    position: relative;
    /* Glitch moved to .logo__text--light */
}

/* .logo__text--tech.glitch {
    animation: glitch 600ms steps(1);
} */

.logo__text--light.glitch {
    animation: glitch 600ms steps(1);
}

@keyframes glitch {
    0% {
        opacity: 1;
        transform: translate(0);
        text-shadow: none;
    }
    20% {
        opacity: 0.8;
        transform: translate(-2px, 1px);
        text-shadow: 2px 0 var(--ghost-alt), -2px 0 var(--ghost-alt);
    }
    40% {
        opacity: 1;
        transform: translate(1px, -1px);
        text-shadow: -1px 0 var(--ghost-alt);
    }
    60% {
        opacity: 0.9;
        transform: translate(-1px, 0);
        text-shadow: 1px 0 var(--ghost-alt);
    }
    80%, 100% {
        opacity: 1;
        transform: translate(0);
        text-shadow: none;
    }
}

@keyframes pulse {
    0%, 100% { text-shadow: 0 0 10px var(--ghost), 0 0 20px var(--ghost), 0 0 40px var(--ghost-dim); }
    50% { text-shadow: 0 0 15px var(--ghost), 0 0 30px var(--ghost), 0 0 50px var(--ghost-dim); }
}


/* Products */
.products {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 60px;
}

/* Product theming via custom properties */
.product--guild {
    --product-color: var(--guild-gold);
    --product-fade: var(--guild-gold-fade);
    --product-border: var(--guild-gold-border);
    --border-gradient: linear-gradient(90deg, var(--guild-gold), var(--neon-blue), var(--guild-gold));
}

.product--board {
    --product-color: var(--neon-blue);
    --product-fade: var(--neon-blue-fade);
    --product-border: var(--neon-blue-border);
    --border-gradient: linear-gradient(90deg, var(--neon-blue), var(--guild-gold), var(--neon-blue));
}

.product {
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.product:hover {
    border-color: var(--product-color);
    box-shadow:
        0 0 1px var(--product-color),
        0 0 2px var(--product-color);
}

.product::after {
    content: '';
    position: absolute;
    inset: -1px;
    left: 2px;
    border: 1px solid transparent;
    border-left: none;
    pointer-events: none;
    background: var(--border-gradient) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    background-size: 300% 100%;
    background-position: 0% 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.product:hover::after {
    opacity: 1;
    animation: borderTrace 0.6s ease-out;
}

@keyframes borderTrace {
    0% {
        background-position: 0% 0;
    }
    100% {
        background-position: 100% 0;
    }
}

.product::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--product-color);
    box-shadow: 0 0 10px var(--product-color);
    opacity: 0.8;
}

.product__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.product__title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product__logo {
    flex-shrink: 0;
}

.product__title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--product-color);
}

.product__status {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 2px;
    color: var(--product-color);
    background: var(--product-fade);
    border: 1px solid var(--product-border);
}

.product__problem {
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1.6;
    font-style: italic;
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 2px solid var(--rust);
}

.product__features {
    list-style: none;
    margin: 0 0 20px;
    flex-grow: 1;
}

.product__features li {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--steel);
    padding: 6px 0 6px 20px;
    position: relative;
}

.product__features li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--product-color);
}

.product__stack {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--steel);
    margin: 16px 0 20px;
    letter-spacing: 0.02em;
}

.product__link {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--product-color);
    text-decoration: none;
    transition: text-shadow 0.2s ease;
}

.product__link:hover {
    text-shadow: 0 0 10px var(--product-color);
}

/* Changelog */
.changelog {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--dark-rust);
    font-family: var(--font-mono);
}

.changelog__label {
    font-size: 0.7rem;
    color: var(--steel);
    letter-spacing: 0.1em;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.changelog__label::-webkit-details-marker {
    display: none;
}

.changelog__label::before {
    content: '+';
    color: var(--product-color);
    font-size: 0.8rem;
}

.changelog[open] .changelog__label::before {
    content: '−';
}

.changelog__label:hover {
    color: var(--chrome);
}

.changelog__list {
    margin-top: 10px;
    list-style: none;
}

.changelog__list li {
    font-size: 0.75rem;
    color: var(--steel);
    padding: 4px 0;
}

.changelog__summary {
    font-size: 0.7rem;
    color: var(--rust);
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px dashed var(--dark-rust);
}

/* About */
.about {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 60px;
    overflow: visible;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.about::after {
    content: '';
    position: absolute;
    inset: -1px;
    border: 1px solid transparent;
    pointer-events: none;
    background: linear-gradient(90deg, var(--ghost), var(--ghost-dim), var(--ghost)) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    background-size: 300% 100%;
    background-position: 0% 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.about:hover::after {
    opacity: 1;
    animation: borderTrace 0.6s ease-out;
}

.about:hover {
    border-color: var(--ghost);
    box-shadow: 0 0 1px var(--ghost), 0 0 2px var(--ghost);
}


.about__headshot {
    width: 80px;
    height: 100px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--dark-rust);
    display: block;
}

.about__headshot-wrap {
    position: relative;
    flex-shrink: 0;
}

.about__headshot-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4px;
    border: 2px solid transparent;
    pointer-events: none;
    background: linear-gradient(135deg, var(--ghost-alt), var(--ghost), var(--ghost-alt)) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    background-size: 300% 300%;
    background-position: 0% 0%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.about:hover .about__headshot-wrap::after {
    opacity: 1;
    animation: headshotTrace 0.8s ease-out;
}

@keyframes headshotTrace {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

.about__content {
    flex: 1;
    text-align: left;
}

.about__label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.about__name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--ghost);
    margin-bottom: 12px;
    letter-spacing: 0.02em;
    text-shadow: 0 0 10px var(--ghost-glow);
}

.about__bio p {
    color: var(--steel);
    font-weight: 300;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0 0 12px;
}

.about__bio p:last-child { margin-bottom: 0; }

/* Typewriter effect */
.about__bio .typewriter {
    opacity: 0;
    animation: fadeTypeIn 0.5s ease-out forwards;
}

.about__bio .typewriter[data-delay="0"] { animation-delay: 0.3s; }
.about__bio .typewriter[data-delay="1"] { animation-delay: 1.5s; }
.about__bio .typewriter[data-delay="2"] { animation-delay: 3s; }

@keyframes fadeTypeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Contact form */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--dark-rust);
    font-family: var(--font-mono);
}

.contact-form__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--dark-rust);
    background: var(--surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-form__row:hover {
    border-color: var(--rust);
}

.contact-form__row:focus-within {
    border-color: var(--ghost);
    box-shadow: 0 0 1px var(--ghost), 0 0 2px var(--ghost);
}

.contact-form__prompt {
    color: var(--ghost);
}

.contact-form__input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font: inherit;
    font-size: 0.9rem;
    color: var(--chrome);
    caret-color: var(--ghost);
}

.contact-form__input::placeholder { color: var(--rust); }

.contact-form__submit {
    background: transparent;
    border: none;
    color: var(--ghost);
    font: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: text-shadow 0.2s ease, transform 0.15s ease;
}

.contact-form__submit:hover {
    text-shadow: 0 0 10px var(--ghost);
    transform: scale(1.15);
}

.contact-form__status {
    font-size: 0.8rem;
    min-height: 1.2em;
    margin-top: 8px;
    text-align: center;
}

.contact-form__status--success { color: var(--ghost); }
.contact-form__status--error { color: var(--error); }

/* Footer */
footer {
    max-width: 720px;
    margin: 48px auto 0;
    padding: 32px 24px 48px;
    border-top: 1px solid var(--dark-rust);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--rust);
    letter-spacing: 0.1em;
}

.footer__location { margin-bottom: 12px; }

.footer__nav {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.footer__nav a {
    color: var(--steel);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer__nav a:hover { color: var(--ghost); }

.footer__copyright {
    margin-top: 16px;
    font-size: 0.65rem;
    color: var(--steel);
}

/* Focus styles */
.contact-form__submit:focus,
.product__link:focus,
.footer__nav a:focus {
    outline: 1px solid currentColor;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .logo__text--light,
    .about__bio .typewriter,
    .theme-toggle--animating .theme-toggle__ghost { animation: none; }
    .about__bio .typewriter { opacity: 1; }
    .product, .product__link, .contact-form__submit, .footer__nav a,
    body, .card, .product__status, .changelog, footer, .theme-toggle, .theme-toggle__ghost { transition: none; }
}

/* Desktop - 2 column products */
@media (min-width: 1024px) {
    .container {
        max-width: 1080px;
    }

    header {
        max-width: 1080px;
        margin: 0 auto;
    }

    footer {
        max-width: 1080px;
    }

    .products {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .section-label {
        width: 100%;
    }

    .product {
        flex: 1;
    }
}

/* Mobile */
@media (max-width: 540px) {
    header { padding: 12px 16px; }
    .container { padding: 0 20px 60px; }
    .card { padding: 24px; }
    .product__status { position: absolute; top: 24px; right: 24px; }
    .about { flex-direction: column; align-items: center; text-align: center; }
    .about__content { text-align: center; }
}
