/* ==========================================================================
   RH Prototypes — Landing Page
   "The Foyer" — A refined prototype workshop entrance
   ========================================================================== */

/* --- Theme Tokens --- */
:root,
[data-theme="light"] {
    --bg:             #faf8f5;
    --bg-grid:        rgba(0, 0, 0, 0.04);
    --surface:        #ffffff;
    --surface-hover:  #ffffff;
    --text:           #1a1a2e;
    --text-muted:     #6b6878;
    --accent:         #005876;
    --accent-hover:   #003d54;
    --accent-subtle:  #e8f4f8;
    --border:         #e2ddd7;
    --border-hover:   #ccc5bc;
    --shadow:         0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-hover:   0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --footer-text:    #9e978e;

    --stack-dotnet:   #005876;
    --stack-react:    #0ea5e9;
    --stack-nextjs:   #16a34a;
    --stack-python:   #d97706;
    --stack-static:   #7c3aed;
}

[data-theme="dark"] {
    --bg:             #0e1117;
    --bg-grid:        rgba(255, 255, 255, 0.03);
    --surface:        #161b22;
    --surface-hover:  #1c222b;
    --text:           #e6edf3;
    --text-muted:     #8b949e;
    --accent:         #3db8d9;
    --accent-hover:   #5ccce8;
    --accent-subtle:  #0d2d3a;
    --border:         #30363d;
    --border-hover:   #484f58;
    --shadow:         0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-hover:   0 4px 16px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    --footer-text:    #484f58;

    --stack-dotnet:   #3db8d9;
    --stack-react:    #38bdf8;
    --stack-nextjs:   #4ade80;
    --stack-python:   #fbbf24;
    --stack-static:   #a78bfa;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.35s ease, color 0.35s ease;
    position: relative;
    overflow-x: hidden;
}

/* --- Dot Grid Background --- */
.dot-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, var(--bg-grid) 1px, transparent 1px);
    background-size: 24px 24px;
    transition: background-image 0.35s ease;
}

/* --- Header --- */
.site-header {
    position: relative;
    z-index: 10;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg);
    transition: background-color 0.35s ease, border-color 0.35s ease;
}

.header-inner {
    max-width: 980px;
    margin: 0 auto;
    padding: 32px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-mark {
    color: var(--accent);
    flex-shrink: 0;
    transition: color 0.35s ease;
}

.site-title {
    font-family: 'Fraunces', Georgia, serif;
    font-optical-sizing: auto;
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.2;
    transition: color 0.35s ease;
}

.site-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
    letter-spacing: 0.01em;
    transition: color 0.35s ease;
}

/* --- Theme Toggle --- */
.theme-toggle {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 10px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: background-color 0.35s ease, border-color 0.35s ease,
                color 0.2s ease, transform 0.15s ease;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--border-hover);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

[data-theme="light"] .icon-moon,
[data-theme="dark"] .icon-sun {
    display: none;
}

[data-theme="light"] .icon-sun,
[data-theme="dark"] .icon-moon {
    display: block;
}

/* --- Main Content --- */
.main {
    position: relative;
    z-index: 1;
    flex: 1;
    max-width: 980px;
    width: 100%;
    margin: 0 auto;
    padding: 48px 28px 64px;
}

/* --- Prototype Grid --- */
.prototype-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* --- Card --- */
.card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: background-color 0.35s ease, border-color 0.35s ease,
                box-shadow 0.25s ease, transform 0.25s ease;

    /* Staggered entrance animation */
    opacity: 0;
    animation: cardEnter 0.5s ease forwards;
    animation-delay: calc(0.08s + var(--delay, 0) * 0.06s);
}

.card:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-hover);
    transform: translateX(4px);
}

.card:hover .card-arrow {
    opacity: 1;
    transform: translateX(0);
}

.card:hover .card-accent {
    width: 5px;
}

/* --- Card Accent Stripe --- */
.card-accent {
    width: 3px;
    align-self: stretch;
    flex-shrink: 0;
    background-color: var(--stack-color, var(--accent));
    border-radius: 0;
    transition: width 0.25s ease, background-color 0.35s ease;
}

/* --- Card Body --- */
.card-body {
    flex: 1;
    padding: 20px 16px 20px 20px;
    min-width: 0;
}

/* --- Badge --- */
.badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 7px;
    border-radius: 4px;
    margin-bottom: 8px;
    transition: background-color 0.35s ease, color 0.35s ease;
}

.badge-dotnet {
    background-color: var(--accent-subtle);
    color: var(--accent);
}

.badge-nextjs {
    background-color: rgba(22, 163, 74, 0.1);
    color: var(--stack-nextjs);
}

.badge-react {
    background-color: rgba(14, 165, 233, 0.1);
    color: var(--stack-react);
}

.badge-python {
    background-color: rgba(217, 119, 6, 0.1);
    color: var(--stack-python);
}

/* --- Card Typography --- */
.card-title {
    font-family: 'Fraunces', Georgia, serif;
    font-optical-sizing: auto;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.3;
    transition: color 0.35s ease;
}

.card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    transition: color 0.35s ease;
}

/* --- Card Arrow --- */
.card-arrow {
    flex-shrink: 0;
    margin-right: 20px;
    color: var(--accent);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease, color 0.35s ease;
}

/* --- Entrance Animation --- */
@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Footer --- */
.site-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 24px 28px 32px;
    font-size: 0.78rem;
    color: var(--footer-text);
    letter-spacing: 0.01em;
    transition: color 0.35s ease;
}

/* --- Responsive --- */
@media (max-width: 700px) {
    .header-inner {
        padding: 24px 20px;
    }

    .site-title {
        font-size: 1.25rem;
    }

    .main {
        padding: 32px 20px 48px;
    }

    .prototype-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .card-body {
        padding: 16px 12px 16px 16px;
    }

    .card-arrow {
        margin-right: 16px;
    }
}

@media (max-width: 400px) {
    .brand-mark {
        display: none;
    }
}
