/* Neon Theme Design with TWK Lausanne Font */

/* Color Palette from Panic's Neon Theme */
:root {
    --foreground: #ffffff;
    --midforeground: #f5dcec;
    --midground: #5967b3;
    --background: #241734;
    --deepbackground: #20142e;
    --red: #ff4365;
    --orange: #ff6c11;
    --yellow: #f9c80e;
    --lightyellow: #faf4e1;
    --green: #75fb4c;
    --cyan: #b2feff;
    --blue: #5967b3;
    --darkblue: #2e2157;
    --purple: #540d6e;
    --deeppurple: #920075;
    --darkpurple: #2e2157;
    --lightpurple: #5413a8;
    --brightpurple: #f6019d;
    --pink: #f6019d;
    --lightpink: #f593d1;
    --peach: #ffd0b2;
}

/* TWK Lausanne Font Faces - Essential Weights Only */
@font-face {
    font-family: 'TWK Lausanne';
    src: url('../fonts/TWKLausanne-300.woff2') format('woff2'),
         url('../fonts/TWKLausanne-300.woff') format('woff');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Lausanne';
    src: url('../fonts/TWKLausanne-400.woff2') format('woff2'),
         url('../fonts/TWKLausanne-400.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Lausanne';
    src: url('../fonts/TWKLausanne-500.woff2') format('woff2'),
         url('../fonts/TWKLausanne-500.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Lausanne';
    src: url('../fonts/TWKLausanne-700.woff2') format('woff2'),
         url('../fonts/TWKLausanne-700.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Lausanne';
    src: url('../fonts/TWKLausanne-800.woff2') format('woff2'),
         url('../fonts/TWKLausanne-800.woff') format('woff');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Lausanne';
    src: url('../fonts/TWKLausanne-900.woff2') format('woff2'),
         url('../fonts/TWKLausanne-900.woff') format('woff');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Lausanne';
    src: url('../fonts/TWKLausanne-1000.woff2') format('woff2'),
         url('../fonts/TWKLausanne-1000.woff') format('woff');
    font-weight: 1000;
    font-style: normal;
    font-display: swap;
}

/* TWK Everett Mono Font Faces - For Article Text */
@font-face {
    font-family: 'TWK Everett Mono';
    src: url('../fonts/TWKEverettMono-Light.woff2') format('woff2'),
         url('../fonts/TWKEverettMono-Light.woff') format('woff');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Everett Mono';
    src: url('../fonts/TWKEverettMono-LightItalic.woff2') format('woff2'),
         url('../fonts/TWKEverettMono-LightItalic.woff') format('woff');
    font-weight: 300;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Everett Mono';
    src: url('../fonts/TWKEverettMono-Regular.woff2') format('woff2'),
         url('../fonts/TWKEverettMono-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Everett Mono';
    src: url('../fonts/TWKEverettMono-Italic.woff2') format('woff2'),
         url('../fonts/TWKEverettMono-Italic.woff') format('woff');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Everett Mono';
    src: url('../fonts/TWKEverettMono-Bold.woff2') format('woff2'),
         url('../fonts/TWKEverettMono-Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TWK Everett Mono';
    src: url('../fonts/TWKEverettMono-BoldItalic.woff2') format('woff2'),
         url('../fonts/TWKEverettMono-BoldItalic.woff') format('woff');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

/* Global Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    margin: 0;
    padding: 0;
}

body {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    font-family: 'TWK Lausanne', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 400;
    background-color: var(--background);
    color: var(--foreground);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Starfield Canvas */
canvas#starfield {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: linear-gradient(180deg, var(--background) 0%, var(--deepbackground) 100%);
}

/* ============================================
   NAVIGATION BAR (Top sticky menu)
   Controls the header bar with logo and links
   ============================================ */

/* Navigation bar container */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, rgba(101, 13, 137, 0.95) 0%, rgba(84, 19, 136, 0.9) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(246, 1, 157, 0.3);
    padding: 1rem 2rem;
    box-shadow: 0 4px 20px rgba(246, 1, 157, 0.2), 0 0 40px rgba(178, 254, 255, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Navigation logo "david.dev" (top left) - EDIT SIZE HERE */
.nav-logo {
    display: flex;           /* To hide logo: change to "display: none;" */
    align-items: center;
    text-decoration: none;
    color: var(--pink);
    font-size: 2rem;         /* Desktop: 32px - EDIT THIS */
    font-weight: 900;        /* Extra bold for navbar */
    letter-spacing: -0.02em;
    transition: color 200ms ease;
}

.nav-logo:hover {
    color: var(--cyan);
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
    margin-left: auto;
}

.nav-link {
    color: var(--foreground);
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 500;
    transition: color 200ms ease;
    position: relative;
}

.nav-link:hover {
    color: var(--cyan);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--cyan), var(--pink));
    transition: width 200ms ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    position: relative;
    z-index: 1;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 2rem 3rem;
    background: transparent !important;
}

.hero-logo {
    max-width: 240px;
    margin: 0 auto 2rem auto;
    display: block;
    filter: drop-shadow(0 0 40px rgba(255, 3, 74, 0.5)) drop-shadow(0 0 80px rgba(132, 0, 255, 0.3));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.hero-title {
    color: var(--pink);
    font-size: 8.125rem;
    font-weight: 800;       /* Ultra bold for "david.dev" */
    letter-spacing: -0.05em;
    margin: 0 0 1rem;
    text-transform: lowercase;
}

.hero-tagline {
    color: var(--foreground);
    font-size: 5.1875rem;
    font-weight: 900;        /* Extra bold for "Coding with Artificial Intelligence" */
    margin: 0.5rem 0 1rem;
    letter-spacing: -0.02em;
}

.hero-description {
    color: var(--midforeground);
    font-size: 1.375rem;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
}

/* Posts/Pages Grid */
.latest-pages,
.stack {
    margin: 3rem 0;
}

.pages-header h2,
.stack-content h2 {
    color: var(--foreground);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.posts-grid,
.stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Card/Tile Styles */
cds-clickable-tile,
.post-tile,
.stack-tile {
    background-color: var(--deepbackground);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
    cursor: pointer;
    display: block;
    text-decoration: none;
    color: inherit;
}

cds-clickable-tile:hover,
.post-tile:hover,
.stack-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 2rem rgba(132, 0, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.post-content h3,
.stack-name {
    color: var(--pink);
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.post-content p,
.stack-description {
    color: var(--midforeground);
    font-size: 1.5rem;
    line-height: 1.5;
    margin: 0.5rem 0;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    font-size: 1.5rem;
    color: var(--midground);
}

.ai-badge {
    background-color: var(--darkpurple);
    color: var(--cyan);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--midforeground);
    font-size: 1.5rem;
    margin-top: 4rem;
    border-top: 1px solid rgba(84, 13, 110, 0.3);
}

/* Rainbow Divider */
hr {
    border: 0;
    height: 2px;
    margin: 3rem auto;
    background-image: linear-gradient(90deg, transparent, var(--yellow), var(--red), var(--pink), var(--purple), var(--blue), transparent);
}

/* Buttons */
button,
.button {
    font-family: 'TWK Lausanne', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(180deg, rgb(84, 19, 136), rgb(46, 33, 87));
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(84, 13, 110, 0.5);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: transform 150ms ease, background 200ms ease;
    letter-spacing: -0.01em;
}

button:hover,
.button:hover {
    transform: scale(1.02);
    background: linear-gradient(180deg, rgb(246, 1, 157), rgb(212, 0, 120));
    color: white;
}

button:active,
.button:active {
    transform: scale(0.98);
}

/* Links */
a {
    color: var(--cyan);
    transition: color 200ms ease;
}

a:hover {
    color: var(--pink);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--deepbackground);
}

::-webkit-scrollbar-thumb {
    background: var(--midground);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--foreground);
}

/* ============================================
   PAGE/ARTICLE STYLES
   Controls individual article/page layout
   ============================================ */

/* Page container - controls max width and centering of article */
.page-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
    background-color: var(--deepbackground);
    border-radius: 1rem;
    border: 1px solid rgba(84, 13, 110, 0.5);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

/* Logo header at top of article pages */
.page-logo-header {
    text-align: center;
    padding: 2rem 0;
    background: transparent;
}

/* Link wrapper for logo (makes entire logo clickable to go home) */
.page-logo-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Article page logo image (smaller than homepage cow) - EDIT SIZE HERE */
.page-logo-image {
    max-width: 140px;
    filter: drop-shadow(0 0 20px rgba(255, 3, 74, 0.3)) drop-shadow(0 0 40px rgba(132, 0, 255, 0.2));
}

/* Article page logo text under image - EDIT SIZE HERE */
.page-logo-text {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--pink);
}

/* ============================================
   ARTICLE TITLE & HEADER
   Controls the article title and date/badge area
   ============================================ */

/* Article header container */
.page-header {
    text-align: center;
    padding: 2rem 0 1.5rem;
}

/* Article main title (H1) - EDIT SIZE HERE */
.page-header h1 {
    color: var(--pink);
    font-size: 2.5rem;      /* Desktop: 40px - EDIT THIS */
    font-weight: 700;
    margin: 0 0 0.75rem;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

/* Article metadata (date and AI badge) - EDIT SIZE HERE */
.page-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    font-family: 'TWK Everett Mono', 'Courier New', monospace;
    font-size: 1.3rem;      /* Desktop: ~21px - Same as article text */
    color: var(--midground);
}

/* ============================================
   ARTICLE BODY TEXT
   Controls all text inside the article content
   ============================================ */

/* Article body container */
.page-body {
    margin: 2rem 0;
}

/* Main article text (paragraphs) - EDIT SIZE HERE */
.page-body .content {
    color: var(--foreground);
    font-family: 'TWK Everett Mono', 'Courier New', monospace;
    font-size: 1.2rem;      /* Desktop: ~21px - Monospace for article text */
    line-height: 1.8;
}

/* Article headings (H1, H2, H3) color and spacing */
.page-body .content h1,
.page-body .content h2,
.page-body .content h3 {
    color: var(--pink);
    margin: 1.5rem 0 0.75rem;
    font-weight: 700;
}

/* Article H2 heading size - EDIT SIZE HERE */
.page-body .content h2 {
    font-size: 1.75rem;     /* Desktop: 28px - EDIT THIS */
}

/* Article H3 heading size - EDIT SIZE HERE */
.page-body .content h3 {
    font-size: 1.5rem;      /* Desktop: 24px - EDIT THIS */
}

/* Article paragraph spacing */
.page-body .content p {
    margin: 0.75rem 0;
}

.page-body .content a {
    color: var(--cyan);
    text-decoration: underline;
}

.page-body .content a:hover {
    color: var(--pink);
}

.page-body .content code {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.page-body .content pre {
    background-color: rgb(46, 33, 87);
    border: 1px solid rgba(84, 13, 110, 0.5);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.page-body .content pre code {
    background: none;
    padding: 0;
}

.page-body .content ul,
.page-body .content ol {
    padding-left: 1.5rem;
    margin: 0.75rem 0;
}

.page-body .content li {
    margin: 0.375rem 0;
}

.page-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.page-actions {
    text-align: center;
}

/* ============================================
   CLAP SECTION - Article engagement
   Controls the clap button and counter display
   ============================================ */

/* Clap section container - EDIT SPACING HERE */
.clap-section {
    text-align: center;
    margin: 4rem 0;
}

/* Clap emoji inside button - EDIT SIZE HERE */
.clap-emoji {
    font-size: 2.5rem;
    display: inline-block;
    margin-right: 0.5rem;
}

/* Clap counter text - EDIT SIZE & COLOR HERE */
.clap-counter {
    margin-top: 1rem;
    color: var(--cyan);
    font-size: 2rem;
    font-weight: 700;
}

/* Clap button animations */
#clapButton {
    transition: transform 200ms ease;
    font-size: 1.5rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

#clapButton:hover {
    transform: scale(1.1);
}

#clapButton:active {
    transform: scale(0.9);
}

/* Confetti Animation */
@keyframes confetti-burst {
    0% {
        transform: translate(0, 0) rotate(-120deg) scale(1);
        opacity: 1;
    }
    30% {
        transform: translate(calc(var(--tx) * 0.7), calc(var(--ty) * 0.5 - 40px)) rotate(30deg) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), calc(var(--ty) + 200px)) rotate(160deg) scale(0.3);
        opacity: 0;
    }
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .nav-bar {
        padding: 0.75rem 1rem;
        /* Ensure purple gradient is applied on mobile */
        background: linear-gradient(180deg, rgba(101, 13, 137, 0.95) 0%, rgba(84, 19, 136, 0.9) 100%) !important;
        backdrop-filter: blur(10px);
        /* Support iOS safe areas */
        padding-top: max(0.75rem, env(safe-area-inset-top));
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .nav-logo {
        font-size: 1.25rem;
    }

    .nav-links {
        gap: 1.5rem;
    }

    .nav-link {
        font-size: 1rem;
    }

    .hero {
        padding: 3rem 1.5rem 2rem;
    }

    .hero-title {
        font-size: 5rem;
    }

    .hero-tagline {
        font-size: 2rem;
    }

    .hero-description {
        font-size: 1.375rem;
    }

    .posts-grid,
    .stack-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Mobile: Article title - EDIT MOBILE SIZE HERE */
    .page-header h1 {
        font-size: 2rem;        /* Mobile: 32px - EDIT THIS */
    }

    /* Mobile: Article body text - EDIT MOBILE SIZE HERE */
    .page-body .content {
        font-size: 1.1rem;      /* Mobile: ~18px - Monospace for article text */
    }

    /* Mobile: Article H2 headings - EDIT MOBILE SIZE HERE */
    .page-body .content h2 {
        font-size: 1.5rem;      /* Mobile: 24px - EDIT THIS */
    }

    /* Mobile: Article H3 headings - EDIT MOBILE SIZE HERE */
    .page-body .content h3 {
        font-size: 1.25rem;     /* Mobile: 20px - EDIT THIS */
    }

    /* Mobile: Article metadata (date/badge) - EDIT MOBILE SIZE HERE */
    .page-meta {
        font-size: 1.1rem;      /* Mobile: ~18px - Same as article text */
    }

    /* Mobile: Article page logo - EDIT MOBILE SIZES HERE */
    .page-logo-image {
        max-width: 100px;
    }

    .page-logo-text {
        font-size: 2rem;
    }

    /* Mobile: Clap section - EDIT MOBILE SIZES HERE */
    .clap-emoji {
        font-size: 2rem;
    }

    .clap-counter {
        font-size: 1.5rem;
    }

    .clap-section {
        margin: 3rem 0;
    }
}

/* Ensure consistent excerpt styling on homepage */
.post-excerpt {
    color: var(--midforeground);
    font-size: 1.5rem;
    line-height: 1.5;
    margin: 0.5rem 0;
}

.post-excerpt p {
    color: var(--midforeground);
    font-size: 1.5rem;
    line-height: 1.5;
    margin: 0 0 0.5rem 0;
}

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

/* Remove any extra HTML styling from excerpts */
.post-excerpt h1,
.post-excerpt h2,
.post-excerpt h3,
.post-excerpt h4,
.post-excerpt h5,
.post-excerpt h6 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--midforeground);
    margin: 0 0 0.5rem 0;
}

.post-excerpt strong,
.post-excerpt em {
    color: var(--midforeground);
}

.post-excerpt ul,
.post-excerpt ol {
    font-size: 1.5rem;
    color: var(--midforeground);
    margin: 0;
    padding-left: 1.5rem;
}
