/* ============================================================
   TryMeFun Design System v2
   Vanilla Pastel / Warm Tones
   ============================================================ */

:root {
    /* Base */
    --bg: #faf6f0;
    --surface: #ffffff;
    --surface-2: #f5f0e8;
    --surface-hover: #f0ebe0;

    /* Accent */
    --primary: #c49360;
    --primary-hover: #b08050;
    --primary-soft: rgba(196, 147, 96, 0.12);

    /* Text */
    --text: #2c1810;
    --text-light: #7a6b5a;
    --text-muted: #a89b8c;

    /* Border & Shadow */
    --border: #e8ddd0;
    --border-strong: #d5c8b8;
    --shadow-sm: 0 1px 3px rgba(44, 24, 16, 0.04);
    --shadow: 0 4px 24px rgba(44, 24, 16, 0.06);
    --shadow-lg: 0 12px 40px rgba(44, 24, 16, 0.10);
    --shadow-xl: 0 24px 60px rgba(44, 24, 16, 0.14);

    /* Radius */
    --radius-sm: 8px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    /* Typography */
    --font: 'Nunito', system-ui, -apple-system, sans-serif;
    --font-mono: 'SF Mono', ui-monospace, monospace;

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* Transitions */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 0.15s;
    --duration: 0.3s;
    --duration-slow: 0.5s;
}

[data-theme="dark"] {
    --bg: #161210;
    --surface: #1e1914;
    --surface-2: #28241e;
    --surface-hover: #322c24;
    --primary: #e8b87d;
    --primary-hover: #f0c28f;
    --primary-soft: rgba(232, 184, 125, 0.12);
    --text: #f0e6d8;
    --text-light: #a89b8c;
    --text-muted: #7a6b5a;
    --border: #3a3228;
    --border-strong: #4a4238;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.15);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.45);
}

/* ============================================================
   Reset & Base
   ============================================================ */

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: clamp(0.9375rem, 0.9rem + 0.15vw, 1rem);
}

::selection {
    background: var(--primary-soft);
    color: var(--text);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Focus visible */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ============================================================
   Navigation
   ============================================================ */

.main-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid var(--border);
    transition: box-shadow var(--duration) var(--ease-out);
}

.main-nav.is-scrolled {
    box-shadow: var(--shadow-sm);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nav-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 900;
    font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
    letter-spacing: -0.02em;
    transition: opacity var(--duration-fast);
}

.nav-brand-link:hover {
    opacity: 0.8;
}

.nav-brand-icon {
    color: var(--primary);
    font-size: 1.3em;
    line-height: 1;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    position: relative;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    color: var(--text-light);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    transition: color var(--duration-fast), background var(--duration-fast);
}

.nav-link:hover {
    color: var(--text);
    background: var(--surface-2);
}

.nav-link.active {
    color: var(--primary);
    background: var(--primary-soft);
}

.nav-divider {
    width: 1px;
    height: 1.25rem;
    background: var(--border);
    margin: 0 0.25rem;
}

.nav-register {
    background: var(--primary-soft);
    color: var(--primary) !important;
}

.nav-register:hover {
    background: var(--primary);
    color: var(--bg) !important;
}

/* Burger */
.nav-burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
}

.burger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform var(--duration) var(--ease-out), opacity var(--duration);
}

.nav-open .burger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-open .burger-line:nth-child(2) {
    opacity: 0;
}
.nav-open .burger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Theme Toggle */
.theme-toggle {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-light);
    transition: all var(--duration-fast);
    margin-left: 0.25rem;
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: rotate(15deg);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="light"] .theme-toggle .sun { display: block; }
[data-theme="light"] .theme-toggle .moon { display: none; }

/* ============================================================
   Main & Container
   ============================================================ */

main {
    flex: 1;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 0.5rem + 2vw, 2rem);
}

.container-wide {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 0.5rem + 2vw, 2rem);
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
    position: relative;
    padding: clamp(4rem, 8vw, 7rem) 1.5rem;
    text-align: center;
    overflow: hidden;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, color-mix(in srgb, var(--primary) 8%, transparent) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 90%, color-mix(in srgb, var(--primary) 5%, transparent) 0%, transparent 50%),
        var(--surface);
    border-bottom: 1px solid var(--border);
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c49360' fill-opacity='0.035'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.6;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 620px;
    margin: 0 auto;
}

.hero h1 {
    font-size: clamp(2.2rem, 1.5rem + 3vw, 3.5rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
}

.accent {
    color: var(--primary);
    position: relative;
}

.hero-subtitle {
    font-size: clamp(1rem, 0.9rem + 0.4vw, 1.25rem);
    color: var(--text-light);
    margin-bottom: 2rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    min-height: 2.5em;
}

/* --- Typewriter cursor --------------------------------------
   Blinking pipe character that follows the typed text.
   Animation is step-end so it snaps on/off (no fade).
   ------------------------------------------------------------ */
.typewriter-cursor {
    color: var(--primary);
    animation: blink 1s step-end infinite;
    font-weight: 300;
}

@keyframes blink {
    50% { opacity: 0; }
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.6rem;
    border-radius: var(--radius);
    font-weight: 800;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--duration) var(--ease-out);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 45%, transparent);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

/* ============================================================
   Sections
   ============================================================ */

.section {
    padding: clamp(3rem, 5vw, 5rem) 0;
}

.section-title {
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
    font-weight: 900;
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: -0.02em;
}

.page-title {
    font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem);
    font-weight: 900;
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: -0.02em;
}

/* ============================================================
   Cards (default)
   ============================================================ */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform var(--duration) var(--ease-spring), box-shadow var(--duration) var(--ease-out);
    transform-style: preserve-3d;
}

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

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.card-text {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 800;
    font-size: 0.9rem;
    transition: gap var(--duration) var(--ease-out);
}

.link-arrow:hover {
    gap: 0.6rem;
    color: var(--primary-hover);
}

/* ============================================================
   About
   ============================================================ */

.about-content {
    max-width: 640px;
    margin: 0 auto;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-light);
}

.about-content p {
    margin-bottom: 1.25rem;
}

.about-content strong {
    color: var(--text);
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 3rem 1.5rem 2rem;
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 900;
    font-size: 1.25rem;
    color: var(--text);
    margin-bottom: 1.5rem;
}

.footer-brand-icon {
    color: var(--primary);
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1.5rem;
}

.footer-nav a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    transition: color var(--duration-fast);
}

.footer-nav a:hover {
    color: var(--primary);
}

.footer-copy {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================================
   Forms
   ============================================================ */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1.125rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

/* ============================================================
   Alerts
   ============================================================ */

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 0.95rem;
    border: 1.5px solid transparent;
}

.alert-success {
    background: rgba(74, 222, 128, 0.08);
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.2);
}

.alert-error {
    background: rgba(248, 113, 113, 0.08);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.2);
}

[data-theme="dark"] .alert-success {
    color: #86efac;
}

[data-theme="dark"] .alert-error {
    color: #fca5a5;
}

/* ============================================================
   Badge
   ============================================================ */

.badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 9999px;
    background: var(--surface-2);
    color: var(--text-light);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
}

/* ============================================================
   Back to Top Button
   ============================================================
   Fixed-position button that appears after scrolling 400px down.
   Starts hidden (opacity:0, scaled down) and animates in when
   .is-visible class is added by JS in base.html.
   ============================================================ */

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    pointer-events: none;
    transition: all var(--duration) var(--ease-out);
    box-shadow: var(--shadow);
    z-index: 90;
}

.back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.back-to-top:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.back-to-top:active {
    transform: scale(0.95);
}

/* ============================================================
   PORTFOLIO — Projects
   ============================================================ */

.portfolio-header {
    text-align: center;
    margin-bottom: 3rem;
}

.portfolio-subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.75rem;
}

/* --- Card with 3D tilt --------------------------------------
   perspective on parent enables 3D depth for children.
   transform-style: preserve-3d on the inner card keeps
   child layers (icon, text) in the same 3D space.
   Tilt angles are applied via JS in base.html.
   ------------------------------------------------------------ */
.project-card {
    perspective: 1000px;
}

.project-card-inner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform var(--duration) var(--ease-spring), box-shadow var(--duration) var(--ease-out);
    height: 100%;
    display: flex;
    flex-direction: column;
    transform-style: preserve-3d;   /* keep children in 3D space */
}

.project-card-inner:hover {
    box-shadow: var(--shadow-xl);
}

.project-card-top {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transform: translateZ(20px);
}

.project-card-top::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, transparent 60%);
    pointer-events: none;
}

.project-icon {
    font-size: 3rem;
    line-height: 1;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    transition: transform var(--duration) var(--ease-spring);
}

.project-card-inner:hover .project-icon {
    transform: scale(1.15) rotate(-4deg);
}

.project-card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    transform: translateZ(10px);
}

.project-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.project-year {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.project-status {
    font-size: 0.7rem;
    font-weight: 900;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.project-card-title {
    font-size: 1.25rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.project-card-desc {
    color: var(--text-light);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
}

.project-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.project-tag {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    letter-spacing: 0.02em;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary);
    font-weight: 800;
    text-decoration: none;
    font-size: 0.9rem;
    transition: gap var(--duration) var(--ease-out);
    margin-top: auto;
}

.project-link:hover {
    gap: 0.7rem;
    color: var(--primary-hover);
}

.project-link svg {
    transition: transform var(--duration) var(--ease-out);
}

.project-link:hover svg {
    transform: translateX(3px);
}

/* ============================================================
   PROJECT DETAIL
   ============================================================ */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-weight: 800;
    text-decoration: none;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    transition: color var(--duration-fast);
}

.back-link:hover {
    color: var(--primary);
}

.back-link svg {
    transition: transform var(--duration) var(--ease-out);
}

.back-link:hover svg {
    transform: translateX(-3px);
}

.project-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.project-detail-header {
    background: linear-gradient(135deg, var(--detail-accent, #e8d5c4) 0%, color-mix(in srgb, var(--detail-accent, #e8d5c4) 60%, transparent) 100%);
    padding: 2.5rem;
    position: relative;
}

.project-detail-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, transparent 60%);
    pointer-events: none;
}

.project-detail-hero {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.project-detail-icon {
    font-size: 4rem;
    line-height: 1;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.1));
}

.project-detail-title {
    font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.2rem);
    font-weight: 900;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.project-detail-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.project-detail-year {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-light);
    opacity: 0.8;
}

.project-detail-status {
    font-size: 0.75rem;
    font-weight: 900;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.project-detail-tag {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-light);
    background: rgba(255,255,255,0.35);
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
}

.project-detail-body {
    padding: clamp(1.5rem, 3vw, 2.5rem);
}

.project-detail-content {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.project-detail-content p {
    margin-bottom: 1rem;
}

.project-detail-content ul {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.project-detail-content li {
    margin-bottom: 0.4rem;
}

.project-detail-section-title {
    font-size: 1.1rem;
    font-weight: 900;
    margin-bottom: 1rem;
    margin-top: 2rem;
    color: var(--text);
    letter-spacing: -0.01em;
}

.project-detail-table-wrap {
    margin-bottom: 2rem;
}

.project-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
}

.project-table th,
.project-table td {
    padding: 0.875rem 1.125rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.project-table th {
    font-weight: 800;
    color: var(--text);
    background: var(--surface-2);
    width: 35%;
}

.project-table tr:first-child th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}
.project-table tr:first-child td:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}
.project-table tr:last-child th:first-child {
    border-radius: 0 0 0 var(--radius-sm);
    border-bottom: none;
}
.project-table tr:last-child td:last-child {
    border-radius: 0 0 var(--radius-sm) 0;
    border-bottom: none;
}

.project-table td {
    color: var(--text-light);
}

.project-detail-links {
    margin-top: 2rem;
}

.project-links-grid {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.project-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    background: var(--surface-2);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
    font-size: 0.92rem;
    transition: all var(--duration) var(--ease-out);
}

.project-link-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   404 Error Page
   ============================================================
   Friendly "page not found" screen with a floating emoji,
   large muted code, and clear navigation back to safety.
   ============================================================ */

.error-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding-top: 2rem;
}

.error-card {
    text-align: center;
    max-width: 480px;
    padding: 2rem;
}

.error-icon {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 1rem;
    display: inline-block;
    animation: float 4s ease-in-out infinite;
}

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

.error-title {
    font-size: clamp(4rem, 8vw, 6rem);
    font-weight: 900;
    color: var(--border-strong);
    line-height: 1;
    margin-bottom: 1rem;
    letter-spacing: -0.04em;
}

.error-text {
    color: var(--text-light);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================================
   Animations & Micro-interactions
   ============================================================
   Reusable animation utilities:
   - fade-in-up   : scroll-triggered reveal (used with IntersectionObserver)
   - stagger-*    : incremental delays for staggered lists
   - blink        : typewriter cursor blink
   - float        : gentle hover animation for 404 emoji
   ============================================================ */

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.fade-in-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.stagger-1 { transition-delay: 0.08s; }
.stagger-2 { transition-delay: 0.16s; }
.stagger-3 { transition-delay: 0.24s; }
.stagger-4 { transition-delay: 0.32s; }
.stagger-5 { transition-delay: 0.40s; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .nav-inner {
        padding: 0.75rem 1rem;
    }

    .nav-burger {
        display: flex;
        order: 3;
    }

    .nav-links {
        position: fixed;
        inset: 64px 0 auto 0;
        background: color-mix(in srgb, var(--surface) 95%, transparent);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.25rem;
        transform: translateY(-120%);
        opacity: 0;
        pointer-events: none;
        transition: transform var(--duration) var(--ease-out), opacity var(--duration);
    }

    .nav-open .nav-links {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        border-radius: var(--radius-sm);
    }

    .nav-divider {
        display: none;
    }

    .theme-toggle {
        margin: 0.5rem auto 0;
    }

    .nav-user {
        font-weight: 900;
        color: var(--primary);
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 280px;
    }

    .project-detail-hero {
        flex-direction: column;
        text-align: center;
    }

    .project-detail-header {
        padding: 1.5rem;
    }

    .project-detail-body {
        padding: 1.5rem;
    }

    .footer-nav {
        gap: 0.5rem 1rem;
    }

    .back-to-top {
        bottom: 1.25rem;
        right: 1.25rem;
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.9rem;
    }

    .page-title {
        font-size: 1.6rem;
    }

    .project-detail-icon {
        font-size: 3rem;
    }

    .project-detail-title {
        font-size: 1.35rem;
    }
}


/* ============================================================
   Toast Notifications
   ============================================================
   Fixed-position stack in top-right corner. Auto-dismiss after
   4 seconds with a slide-in + fade animation.
   ============================================================ */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 360px;
    width: calc(100% - 2rem);
}

.toast {
    pointer-events: auto;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: var(--shadow-lg);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastIn 0.35s var(--ease-out) forwards;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.toast.is-hiding {
    animation: toastOut 0.3s var(--ease-out) forwards;
}

.toast--success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.25);
    color: #22c55e;
}

.toast--error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

.toast--warning {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.25);
    color: #f59e0b;
}

.toast--info {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(40px) scale(0.96);
    }
}


/* ============================================================
   Page Transitions
   ============================================================
   Subtle fade-in for <main> content on every page load.
   Gives the site a softer, SPA-like feel without actual
   client-side routing complexity.
   ============================================================ */

main {
    animation: pageFadeIn 0.4s var(--ease-out) both;
}

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

@media (prefers-reduced-motion: reduce) {
    main {
        animation: none;
    }
}

/* ============================================================
   Admin Panel Styles
   ============================================================ */

.admin-layout {
    display: flex;
    min-height: calc(100vh - 200px);
    gap: 2rem;
}

.admin-sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    align-self: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text);
}

.admin-sidebar-brand i {
    font-size: 1.5rem;
    color: var(--primary);
}

.admin-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.admin-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.875rem;
    border-radius: 8px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.admin-sidebar-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.admin-sidebar-link.active {
    background: var(--primary);
    color: #fff;
}

.admin-sidebar-link i {
    font-size: 1.1rem;
}

.admin-sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.admin-main {
    flex: 1;
    min-width: 0;
}

.admin-header {
    margin-bottom: 1.5rem;
}

.admin-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.admin-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.admin-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.admin-breadcrumb a:hover {
    color: var(--primary);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table thead th {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.admin-table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tbody tr:hover td {
    background: var(--primary-soft);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.stat-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--primary-soft);
    color: var(--primary);
    flex-shrink: 0;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.stat-card .label {
    font-size: 0.85rem;
    color: var(--text-light);
}

.stat-card .meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Admin mobile sidebar toggle */
.admin-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

@media (max-width: 900px) {
    .admin-layout {
        flex-direction: column;
    }
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 99;
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .admin-sidebar.is-open {
        transform: translateX(0);
    }
    .admin-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 98;
    }
    .admin-sidebar-overlay.is-open {
        display: block;
    }
    .admin-sidebar-toggle {
        display: flex;
    }
}

/* Quill editor theming */
.ql-editor {
    min-height: 300px;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.7;
}
.ql-toolbar {
    border-radius: 8px 8px 0 0;
    border-color: var(--border) !important;
    background: var(--bg);
}
.ql-container {
    border-radius: 0 0 8px 8px;
    border-color: var(--border) !important;
    background: var(--bg);
    color: var(--text);
}
.ql-toolbar button:hover,
.ql-toolbar button.ql-active {
    color: var(--primary) !important;
}
.ql-toolbar .ql-stroke {
    stroke: var(--text-light) !important;
}
.ql-toolbar .ql-fill {
    fill: var(--text-light) !important;
}
.ql-toolbar button:hover .ql-stroke,
.ql-toolbar button.ql-active .ql-stroke {
    stroke: var(--primary) !important;
}
