/* ============================================
   ENHANCEMENTS CSS
   Understated cool features
   ============================================ */

/* ============================================
   PAGE TRANSITIONS
   ============================================ */
body {
    animation: pageEnter 0.25s ease-out;
}

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

/* ============================================
   INK WASH TRANSITION
   ============================================ */
.ink-wash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--ink);
    opacity: 0;
    pointer-events: none;
    z-index: 99999;
    transition: opacity 0.15s ease-in-out;
}

.ink-wash.active {
    opacity: 0.15;
}

/* ============================================
   SINGLE THEME TOGGLE
   ============================================ */
.theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    cursor: pointer;
    z-index: 9997;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s, background 0.2s;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
    opacity: 1;
    transform: scale(1.1);
}

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

.theme-icon {
    width: 20px;
    height: 20px;
    position: absolute;
    transition: opacity 0.15s, transform 0.15s;
    stroke: #2b2b2b;
}

.theme-icon.sun {
    opacity: 1;
    transform: rotate(0deg);
}

.theme-icon.moon {
    opacity: 0;
    transform: rotate(-90deg);
}

.theme-toggle.is-dark .theme-icon.sun {
    opacity: 0;
    transform: rotate(90deg);
}

.theme-toggle.is-dark .theme-icon.moon {
    opacity: 1;
    transform: rotate(0deg);
}

/* ============================================
   THEME VARIATIONS
   ============================================ */

/* Light Theme (default) */
body.theme-light {
    /* Uses default CSS variables */
}

/* Dark Theme */
body.theme-dark {
    --paper: #2b2520;
    --paper-alt: #322b25;
    --ink: #d4c5b0;
    --ink-secondary: #a89880;
    --ribbon-red: #c45a3a;
    --highlight: #3d352e;
    --background-dark: #1c1814;
    --background-pattern: #2a2420;
}

body.theme-dark {
    background-color: var(--background-dark);
    background-image: radial-gradient(var(--background-pattern) 1px, transparent 1px);
}

body.theme-dark .paper-container,
body.theme-dark .paper-sheet {
    background-color: var(--paper);
    color: var(--ink);
}

body.theme-dark .paper-container::before,
body.theme-dark .paper-sheet::before {
    opacity: 0.03;
}

body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3 {
    color: #f0e6d6;
    border-color: var(--ink);
}

body.theme-dark a {
    color: var(--ink);
}

body.theme-dark a:hover {
    color: var(--ribbon-red);
}

body.theme-dark .nav-link,
body.theme-dark .skill-badge {
    background: rgba(242, 235, 220, 0.08);
    border-color: #5a4d3f;
    color: var(--ink);
}

body.theme-dark .nav-link:hover,
body.theme-dark .skill-badge:hover {
    background: var(--ribbon-red);
    color: #fff;
    border-color: var(--ribbon-red);
}

body.theme-dark .theme-toggle {
    background: rgba(50, 45, 40, 0.9);
}

body.theme-dark .theme-icon {
    stroke: #d4c5b0;
}

body.theme-dark .game-section {
    background: rgba(255, 255, 255, 0.05);
    border-color: #5a4d3f;
}

body.theme-dark .game-btn,
body.theme-dark .swipe-btn,
body.theme-dark .emoji-option-btn {
    background: var(--paper);
    color: var(--ink);
    border-color: #5a4d3f;
}

body.theme-dark #sprint-card {
    background: var(--paper);
    border-color: #5a4d3f;
}

body.theme-dark .stack-card-front {
    background: var(--ribbon-red);
}

body.theme-dark .stack-card-back {
    background: var(--paper);
}

/* Dark theme footer */
body.theme-dark footer {
    background: rgba(20, 18, 15, 0.95) !important;
    border-color: #5a4d3f !important;
}

body.theme-dark footer a {
    color: rgba(212, 197, 176, 0.8) !important;
}

body.theme-dark footer a:hover {
    color: #fff !important;
}

body.theme-dark #copy-email-btn {
    border-color: rgba(212, 197, 176, 0.3) !important;
    color: rgba(212, 197, 176, 0.6) !important;
}

body.theme-dark #copy-email-btn:hover {
    border-color: #d4c5b0 !important;
    color: #d4c5b0 !important;
}

/* ============================================
   LINK HOVER ANIMATION (underline draw)
   ============================================ */
a {
    position: relative;
    text-decoration: none;
}

a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--ribbon-red);
    transition: width 0.2s ease-out;
}

a:hover::after {
    width: 100%;
}

/* Exclude nav-links and buttons from underline animation */
.nav-link::after,
.nav-link-cv::after,
.game-btn::after,
button a::after,
a.nav-link::after {
    display: none;
}

/* ============================================
   SCROLL TO TOP - TYPEWRITER KEY
   ============================================ */
.typewriter-key-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    background: linear-gradient(180deg, #e8e8e8 0%, #d0d0d0 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.1s;
    z-index: 1000;
    padding: 0;

    /* 3D typewriter key effect */
    box-shadow:
        0 4px 0 #888,
        0 6px 4px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

.typewriter-key-btn.visible {
    opacity: 1;
    visibility: visible;
}

.typewriter-key-btn:hover {
    transform: translateY(1px);
    box-shadow:
        0 3px 0 #888,
        0 5px 3px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

.typewriter-key-btn:active {
    transform: translateY(4px);
    box-shadow:
        0 0 0 #888,
        0 1px 2px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.5);
}

.typewriter-key-btn .key-top {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-family: 'Special Elite', cursive;
    font-size: 1.25rem;
    color: #333;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

/* Dark theme typewriter key */
body.theme-dark .typewriter-key-btn {
    background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%);
    box-shadow:
        0 4px 0 #222,
        0 6px 4px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

body.theme-dark .typewriter-key-btn:hover {
    box-shadow:
        0 3px 0 #222,
        0 5px 3px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

body.theme-dark .typewriter-key-btn:active {
    box-shadow:
        0 0 0 #222,
        0 1px 2px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.05);
}

body.theme-dark .typewriter-key-btn .key-top {
    color: #d4c5b0;
    text-shadow: none;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 32px;
        height: 32px;
    }

    .theme-icon {
        width: 18px;
        height: 18px;
    }

    .typewriter-key-btn {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 40px;
        height: 40px;
    }

    .typewriter-key-btn .key-top {
        font-size: 1.1rem;
    }
}

/* ============================================
   PRINT - HIDE ENHANCEMENTS
   ============================================ */
@media print {
    .theme-toggle,
    .typewriter-key-btn,
    .ink-wash {
        display: none !important;
    }
}
