/* ============================================================
   Uriarte Portfolio — Deep Midnight Purple + Vivid Fuchsia
   ============================================================ */

/* 1 — Design Tokens */
:root {
    --bg:            #fdf6ff;
    --card-bg:       #ffffff;
    --nav-bg:        #130224;
    --nav-border:    rgba(217, 70, 239, 0.14);
    --nav-hover:     rgba(255, 255, 255, 0.05);
    --accent:        #d946ef;
    --accent-hover:  #b91fc7;
    --accent-light:  #fae8ff;
    --accent-glow:   rgba(217, 70, 239, 0.28);
    --text:          #1e0a3c;
    --text-muted:    #6b7280;
    --border:        #f0d6fe;
    --shadow-sm:     0 1px 3px rgba(30, 10, 60, 0.07), 0 1px 2px rgba(30, 10, 60, 0.05);
    --shadow:        0 4px 20px rgba(30, 10, 60, 0.11);
    --shadow-lg:     0 10px 40px rgba(30, 10, 60, 0.15);
    --success-bg:    #d1fae5;
    --success-text:  #065f46;
    --error-bg:      #fee2e2;
    --error-text:    #991b1b;
    --code-bg:       #0f0620;
    --radius:        12px;
    --radius-sm:     8px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 3 — Topnav (unified sticky bar) */
.topnav {
    background: var(--nav-bg);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 28px;
    height: 66px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Brand */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 20px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #d946ef, #a855f7);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(217, 70, 239, 0.45);
    letter-spacing: -1px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    color: #ffffff;
    font-weight: 700;
    font-size: 0.925rem;
    letter-spacing: -0.01em;
}

.brand-sub {
    color: rgba(255, 255, 255, 0.38);
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.01em;
}

/* Nav Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.nav-link {
    color: rgba(255, 255, 255, 0.62);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: background 0.18s, color 0.18s;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--nav-hover);
    color: #ffffff;
}

.nav-link.active {
    background: rgba(217, 70, 239, 0.14);
    color: #e879f9;
    font-weight: 600;
}

/* Activities button */
.activities-btn .btn-arrow {
    transition: transform 0.22s ease;
    opacity: 0.55;
    flex-shrink: 0;
}

.activities-btn.open {
    background: rgba(217, 70, 239, 0.14);
    color: #e879f9;
}

.activities-btn.open .btn-arrow {
    transform: rotate(180deg);
    opacity: 0.9;
}

/* Nav Auth */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.auth-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.8rem;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    white-space: nowrap;
}

.auth-dot {
    width: 7px;
    height: 7px;
    background: #a855f7;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 7px rgba(168, 85, 247, 0.7);
}

.auth-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 7px 18px;
    border: 1.5px solid var(--accent);
    border-radius: 20px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.auth-link:hover {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--accent-glow);
}

/* Mobile toggle */
.mobile-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.75);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-left: auto;
    flex-shrink: 0;
}

.mobile-toggle:hover {
    border-color: rgba(255, 255, 255, 0.35);
    color: white;
}

/* 4 — Activities Panel */
.activities-panel {
    background: #0c0120;
    border-top: 1px solid var(--nav-border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
}

.activities-panel.open {
    max-height: 440px;
    border-bottom: 1px solid var(--nav-border);
}

.activities-grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 28px 22px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.activity-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 13px;
    color: rgba(255, 255, 255, 0.58);
    text-decoration: none;
    font-size: 0.83rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.18s ease;
    border: 1px solid transparent;
}

.activity-link:hover {
    background: rgba(217, 70, 239, 0.12);
    color: #e879f9;
    border-color: rgba(217, 70, 239, 0.22);
}

.activity-link.active {
    background: rgba(217, 70, 239, 0.16);
    color: #e879f9;
    border-color: rgba(217, 70, 239, 0.32);
    font-weight: 600;
}

.activity-num {
    min-width: 26px;
    height: 26px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.38);
    flex-shrink: 0;
}

.activity-link:hover .activity-num,
.activity-link.active .activity-num {
    background: rgba(217, 70, 239, 0.22);
    color: #e879f9;
}

/* 5 — Page Hero Banner */
.page-hero {
    background: linear-gradient(135deg, #130224 0%, #2d0a54 50%, #130224 100%);
    padding: 52px 28px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 25% 60%, rgba(217, 70, 239, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 75% 40%, rgba(168, 85, 247, 0.12) 0%, transparent 55%);
    pointer-events: none;
}

.page-hero h1 {
    position: relative;
    font-size: clamp(1.7rem, 3.5vw, 2.6rem);
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.accent-text {
    background: linear-gradient(90deg, #d946ef, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-hero p {
    position: relative;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.9rem;
    letter-spacing: 0.06em;
    font-weight: 400;
}

/* 6 — Layout */
.container {
    width: 92%;
    max-width: 1100px;
    margin: 32px auto;
    flex: 1;
}

/* 7 — Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 28px 32px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.card h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, #d946ef, #a855f7);
    border-radius: 2px;
    flex-shrink: 0;
}

.card p { color: var(--text-muted); margin-bottom: 10px; }
.card ul, .card ol { padding-left: 22px; color: var(--text-muted); }
.card li { margin-bottom: 5px; }

/* 8 — Demo Area */
.demo-area {
    background: #fdf4ff;
    border: 1px dashed #e9a7fe;
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    margin: 16px 0;
}

/* 9 — Buttons */
.source-btn,
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px var(--accent-glow);
    margin: 4px 4px 4px 0;
}

.source-btn:hover,
.btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.source-btn {
    background: var(--code-bg);
    box-shadow: none;
    color: #94a3b8;
}

.source-btn:hover {
    background: #1e293b;
    box-shadow: none;
    transform: none;
    color: #cbd5e1;
}

/* 10 — Source Code Block */
.source-code {
    background: var(--code-bg);
    color: #94a3b8;
    padding: 20px 22px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin-top: 10px;
    font-size: 0.82rem;
    line-height: 1.65;
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* 11 — Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

thead tr {
    background: linear-gradient(90deg, var(--nav-bg), #3b0764);
    color: #ffffff;
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

tbody tr:hover td { background: var(--accent-light); }

tbody tr:nth-child(even) td {
    background: rgba(16, 185, 129, 0.03);
}

tbody td {
    padding: 11px 16px;
    color: var(--text-muted);
    border: none;
}

/* 12 — Forms */
input,
select,
textarea {
    width: 100%;
    padding: 11px 14px;
    margin-top: 5px;
    margin-bottom: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: #fef9ff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.12);
    background: #ffffff;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* 13 — Alerts */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 4px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-left-color: #22c55e;
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    border-left-color: #ef4444;
}

/* 14 — Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.gallery-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: box-shadow 0.2s, transform 0.2s;
    box-shadow: var(--shadow-sm);
}

.gallery-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

/* 15 — Footer */
.footer {
    background: linear-gradient(135deg, #130224, #2d0a54);
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    padding: 24px;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    margin-top: auto;
    border-top: 1px solid rgba(217, 70, 239, 0.12);
}

/* 16 — Responsive */
@media (max-width: 900px) {
    .activities-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-inner { padding: 0 18px; }

    .brand-sub { display: none; }

    .nav-links {
        display: none;
        position: absolute;
        top: 67px;
        left: 0;
        right: 0;
        background: var(--nav-bg);
        flex-direction: column;
        align-items: stretch;
        padding: 10px 12px 14px;
        gap: 2px;
        border-bottom: 1px solid var(--nav-border);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
        z-index: 190;
    }

    .nav-links.mobile-open {
        display: flex;
    }

    .nav-link {
        justify-content: flex-start;
        padding: 10px 14px;
    }

    .nav-auth { display: none; }

    .mobile-toggle { display: flex; }

    .activities-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 14px 18px 18px;
    }

    .page-hero { padding: 38px 20px; }

    .container { width: 95%; margin: 22px auto; }

    .card { padding: 20px 18px; }

    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .activities-grid { grid-template-columns: 1fr; }
    .brand-text { display: none; }
    .brand-logo { width: 34px; height: 34px; font-size: 1rem; }
}
