/* ===== CSS Variables & Reset ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-page: #f7f3ec;
    --bg-card: #faf6ef;
    --bg-sidebar: #ede5d8;
    --text-primary: #4a4a5a;
    --text-heading: #5b4a6b;
    --accent-teal: #7fdbca;
    --accent-violet: #c4a7e7;
    --accent-coral: #f5c6aa;
    --accent-sky: #a8d8ea;
    --proto-name: #d4726a;
    --margin-note: #8a7a9a;
    --tech-text: #6a9a8a;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.4vw, 1.1rem);
    line-height: 1.7;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Aurora Background ===== */
.aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse at 30% 50%, rgba(127,219,202,0.13), transparent 70%),
        radial-gradient(ellipse at 70% 30%, rgba(196,167,231,0.13), transparent 60%);
    animation: auroraShift 30s linear infinite;
}

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

/* ===== Star Field ===== */
.star-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(1px 1px at 10% 15%, var(--accent-teal) 50%, transparent 100%),
        radial-gradient(1px 1px at 25% 45%, var(--accent-violet) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 40% 75%, var(--accent-coral) 50%, transparent 100%),
        radial-gradient(1px 1px at 55% 20%, var(--accent-sky) 50%, transparent 100%),
        radial-gradient(1px 1px at 70% 60%, var(--accent-teal) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 85% 35%, var(--accent-violet) 50%, transparent 100%),
        radial-gradient(1px 1px at 15% 80%, var(--accent-coral) 50%, transparent 100%),
        radial-gradient(1px 1px at 60% 90%, var(--accent-sky) 50%, transparent 100%),
        radial-gradient(1px 1px at 90% 85%, var(--accent-teal) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 35% 10%, var(--accent-violet) 50%, transparent 100%);
    animation: starTwinkle 6s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
    0% { opacity: 0.15; }
    100% { opacity: 0.4; }
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: var(--bg-sidebar);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    border-right: 1px solid rgba(196,167,231,0.2);
    transform: translateX(-100%);
    animation: sidebarSlideIn 600ms ease-out forwards;
    overflow-y: auto;
}

@keyframes sidebarSlideIn {
    to { transform: translateX(0); }
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: -6px;
    width: 6px;
    height: 100%;
    background: linear-gradient(180deg,
        transparent 0%,
        var(--bg-sidebar) 5%,
        transparent 8%,
        var(--bg-sidebar) 12%,
        transparent 15%,
        var(--bg-sidebar) 20%,
        transparent 22%,
        var(--bg-sidebar) 30%,
        transparent 33%,
        var(--bg-sidebar) 40%,
        transparent 100%
    );
    opacity: 0.6;
}

.sidebar-header {
    margin-bottom: 32px;
    padding-bottom: 12px;
    border-bottom: 2px solid transparent;
    background-image: linear-gradient(var(--bg-sidebar), var(--bg-sidebar)),
                      linear-gradient(90deg, var(--accent-teal), var(--accent-violet), var(--accent-coral), var(--accent-sky));
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.sidebar-title {
    font-family: 'Kalam', cursive;
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-heading);
    letter-spacing: 0.05em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar-link {
    display: block;
    padding: 10px 12px;
    text-decoration: none;
    font-family: 'Kalam', cursive;
    font-size: 0.95rem;
    font-weight: 300;
    color: var(--text-primary);
    border-radius: 8px;
    position: relative;
    transition: all 300ms ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: rgba(127,219,202,0.1);
    color: var(--text-heading);
}

.sidebar-link.active {
    color: var(--text-heading);
    font-weight: 400;
    border-left: 3px solid transparent;
    border-image: linear-gradient(135deg, var(--accent-teal), var(--accent-violet)) 1;
    background: rgba(127,219,202,0.08);
    animation: activeGlow 8s ease-in-out infinite;
}

@keyframes activeGlow {
    0%, 100% { background: rgba(127,219,202,0.08); }
    50% { background: rgba(196,167,231,0.12); }
}

.sidebar-label {
    display: block;
}

.sidebar-decor {
    margin-top: auto;
    padding-top: 20px;
    display: flex;
    justify-content: center;
}

.botanical-sidebar {
    width: 60px;
    height: 120px;
    animation: botanicalSway 12s ease-in-out infinite;
}

@keyframes botanicalSway {
    0%, 100% { transform: rotate(-0.5deg); }
    50% { transform: rotate(0.5deg); }
}

/* ===== Main Content ===== */
.content {
    margin-left: 240px;
    width: calc(100% - 240px);
    position: relative;
    z-index: 1;
    padding: 0 24px 60px;
}

/* ===== Site Header ===== */
.site-header {
    padding: 24px 0 20px;
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.site-title {
    font-family: 'Baloo 2', cursive;
    font-weight: 800;
    font-size: clamp(1.5rem, 3.5vw, 2.8rem);
    color: var(--text-heading);
    letter-spacing: 0.01em;
    line-height: 1.25;
}

.aurora-ribbon {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent-teal), var(--accent-violet), var(--accent-coral), var(--accent-sky));
    background-size: 200% 100%;
    animation: ribbonFlow 20s linear infinite, ribbonDraw 1200ms ease-in-out forwards;
    margin: 8px auto;
    max-width: 300px;
    transform-origin: left;
}

@keyframes ribbonFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes ribbonDraw {
    from { width: 0; }
    to { width: 100%; }
}

.site-subtitle {
    font-family: 'Kalam', cursive;
    font-weight: 300;
    font-size: 1rem;
    color: var(--margin-note);
    margin-top: 8px;
}

/* ===== Prototype Cards ===== */
.prototype-card {
    max-width: 720px;
    margin: 0 auto 0;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow:
        0 2px 8px rgba(90,74,107,0.06),
        0 8px 24px rgba(90,74,107,0.04),
        0 16px 48px rgba(90,74,107,0.03);
    position: relative;
    overflow: hidden;
    transition: transform 250ms ease-out, box-shadow 250ms ease-out;
}

.prototype-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0.03;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    border-radius: 16px;
}

.prototype-card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 4px 12px rgba(90,74,107,0.08),
        0 12px 32px rgba(90,74,107,0.06),
        0 20px 56px rgba(90,74,107,0.04);
}

.card-inner {
    padding: 24px;
    position: relative;
}

/* Collapsed state */
.card-collapsed {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.card-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
}

.vintage-photo {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-grain {
    position: absolute;
    inset: 0;
    opacity: 0.15;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

.aurora-wash {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(127,219,202,0.3), rgba(196,167,231,0.3));
    mix-blend-mode: soft-light;
}

.photo-icon {
    width: 40px;
    height: 40px;
    position: relative;
    z-index: 1;
    opacity: 0.8;
}

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

.card-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.card-title {
    font-family: 'Baloo 2', cursive;
    font-weight: 600;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    color: var(--proto-name);
    line-height: 1.25;
    letter-spacing: 0.01em;
}

.card-summary {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
    background-image: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.4), transparent 60%);
}

.status-badge:hover {
    transform: rotate(5deg);
}

.status-badge.concept {
    background-color: var(--accent-teal);
    color: #2a4a42;
}
.status-badge.testing {
    background-color: var(--accent-coral);
    color: #5a3a2a;
}
.status-badge.complete {
    background-color: var(--proto-name);
    color: #fff;
}
.status-badge.archived {
    background-color: var(--margin-note);
    color: #fff;
}

/* Expanded state */
.card-expanded {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 500ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 300ms ease;
}

.prototype-card.expanded .card-expanded {
    max-height: 2000px;
    opacity: 1;
}

.card-columns {
    display: flex;
    gap: 24px;
    margin-top: 20px;
}

.card-text-col {
    flex: 0 0 65%;
}

.card-margin-col {
    flex: 0 0 calc(35% - 24px);
}

.aurora-ribbon-sm {
    height: 3px;
    border-radius: 1.5px;
    background: linear-gradient(90deg, var(--accent-teal), var(--accent-violet), var(--accent-coral), var(--accent-sky));
    background-size: 200% 100%;
    animation: ribbonFlow 20s linear infinite;
    margin-bottom: 16px;
}

.card-section-title {
    font-family: 'Baloo 2', cursive;
    font-weight: 600;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: var(--text-heading);
    margin-top: 16px;
    margin-bottom: 6px;
    line-height: 1.25;
}

.card-section-title:first-of-type {
    margin-top: 0;
}

.card-body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 1.2em;
}

/* Margin column */
.full-photo {
    width: 100%;
    height: 140px;
    margin-bottom: 16px;
}

.full-photo .photo-icon {
    width: 60px;
    height: 45px;
}

.margin-note {
    font-family: 'Kalam', cursive;
    font-weight: 300;
    font-size: 0.88rem;
    color: var(--margin-note);
    line-height: 1.4;
    margin-bottom: 12px;
    padding: 4px 0;
}

.tech-detail {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    border-bottom: 1px dotted rgba(106,154,138,0.3);
    margin-bottom: 4px;
}

.tech-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    color: var(--tech-text);
    letter-spacing: 0.05em;
    text-transform: lowercase;
}

.tech-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    color: var(--tech-text);
    letter-spacing: 0.05em;
}

/* Read More Button */
.read-more-btn {
    display: block;
    margin: 12px auto 0;
    background: none;
    border: none;
    font-family: 'Kalam', cursive;
    font-size: 0.9rem;
    color: var(--margin-note);
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 12px;
    transition: all 250ms ease;
}

.read-more-btn:hover {
    background: rgba(196,167,231,0.12);
    color: var(--text-heading);
}

.prototype-card.expanded .read-more-btn {
    display: none;
}

/* ===== Aurora Interstitials ===== */
.aurora-interstitial {
    position: relative;
    height: 100px;
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.constellation-line {
    width: 100%;
    height: 80px;
    position: absolute;
}

.constellation-line path {
    transition: stroke-dashoffset 800ms ease-in-out;
}

.floating-star {
    position: absolute;
    font-size: 0.7rem;
    animation: starPulse 4s ease-in-out infinite;
    pointer-events: none;
}

.floating-star:nth-child(2) { animation-delay: -1.3s; color: var(--accent-teal); }
.floating-star:nth-child(3) { animation-delay: -2.6s; color: var(--accent-violet); }
.floating-star:nth-child(4) { animation-delay: -0.8s; color: var(--accent-coral); }

@keyframes starPulse {
    0%, 100% { opacity: 0.15; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* ===== Footer ===== */
.site-footer {
    max-width: 720px;
    margin: 60px auto 0;
    text-align: center;
    padding: 32px 0;
}

.footer-text {
    font-family: 'Kalam', cursive;
    font-size: 0.95rem;
    color: var(--margin-note);
    margin-top: 12px;
}

.footer-note {
    font-family: 'Kalam', cursive;
    font-size: 0.85rem;
    color: rgba(138,122,154,0.6);
    margin-top: 4px;
}

/* ===== Mobile Navigation ===== */
.mobile-nav-pill {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 40px;
    border-radius: 20px;
    border: none;
    background: linear-gradient(135deg, var(--accent-teal), var(--accent-violet));
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(91,74,107,0.25);
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-nav-pill:active {
    transform: translateX(-50%) scale(0.95);
}

.mobile-menu {
    display: none;
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 199;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 200ms ease;
}

.mobile-menu.open {
    pointer-events: auto;
    opacity: 1;
}

.mobile-menu-item {
    display: block;
    padding: 8px 20px;
    background: var(--bg-card);
    border-radius: 20px;
    font-family: 'Kalam', cursive;
    font-size: 0.9rem;
    color: var(--text-heading);
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(91,74,107,0.15);
    transform: scale(0);
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
    transition-delay: calc(var(--i) * 50ms);
}

.mobile-menu.open .mobile-menu-item {
    transform: scale(1);
}

/* ===== Card load animation ===== */
.prototype-card {
    opacity: 0;
    transform: scale(0.97);
    transition: opacity 800ms cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 800ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 250ms ease-out;
}

.prototype-card.visible {
    opacity: 1;
    transform: scale(1);
}

.prototype-card:hover.visible {
    transform: translateY(-3px);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .content {
        margin-left: 0;
        width: 100%;
        padding: 0 16px 80px;
    }

    .mobile-nav-pill {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-menu {
        display: flex;
    }

    .card-columns {
        flex-direction: column;
    }

    .card-text-col,
    .card-margin-col {
        flex: 1 1 100%;
    }

    .prototype-card {
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .card-collapsed {
        flex-direction: column;
    }

    .card-thumb {
        width: 100%;
        height: 120px;
    }
}
