/* CSS Custom Properties - Space Theme (Black + Gray) */
:root {
    /* Space colors */
    --space-black: #050508;       /* Deep black */
    --space-dark: #0a0a0f;        /* Dark gray */

    /* Washing machine colors */
    --washer-red: #8B2020;        /* Deep red */
    --washer-dark: #1a1a1a;       /* Black */
    --washer-beige: #d4c4b0;      /* Beige */

    /* UI */
    --text-light: #e8e8e8;        /* Light gray */
    --text-dim: rgba(232, 232, 232, 0.5);  /* Dimmed gray */

    /* Fonts */
    --font-main: 'Space Grotesk', sans-serif;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--space-black);
    color: var(--text-light);
    overflow-x: hidden;
    opacity: 1;  /* Start visible to prevent white flash */
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--space-black);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-in-out;
}

.loader {
    text-align: center;
}

.washing-loader {
    width: 80px;
    height: 80px;
    border: 4px solid rgba(232, 232, 232, 0.2);
    border-radius: 50%;
    border-top-color: var(--washer-red);
    animation: spin 1.5s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader p {
    font-family: var(--font-main);
    font-size: 1.2rem;
    color: var(--text-light);
    letter-spacing: 0.1em;
}

/* UI Overlay */
.ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    overflow-y: auto;  /* Enable scrolling */
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;  /* Smooth scrolling on iOS */
}

/* Enable pointer events for pages with content (portfolio, research, creation, skills) */
body[data-page] .ui-overlay {
    pointer-events: auto;
    touch-action: pan-y;
}

/* Navigation */
nav,
.nav-links a {
    pointer-events: auto;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
}

.nav-logo a {
    font-family: var(--font-main);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-light);
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
}

.nav-logo a:hover {
    color: var(--washer-red);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2.5rem;
}

.nav-links a {
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.3s ease;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--washer-red);
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-light);
}

.nav-links a:hover::after {
    width: 100%;
}

/* WebGL Canvas Container */
#cosmic-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-color: var(--space-black);
}

#cosmic-canvas canvas {
    display: block;
    background-color: var(--space-black);
}

/* Hero Content */
.hero-text {
    position: absolute;
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
    text-align: right;
    pointer-events: none;
}

.hero-text h1 {
    font-family: var(--font-main);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.hero-text .subtitle {
    font-family: var(--font-main);
    font-size: 1.2rem;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

/* About Section */
.about-section {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    margin-top: 100vh;
    padding: 4rem 2rem;
    background: linear-gradient(to bottom, transparent, rgba(5, 5, 8, 0.95));
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem;
    background: rgba(26, 26, 31, 0.6);
    border-radius: 20px;
    border: 1px solid rgba(232, 232, 232, 0.1);
    backdrop-filter: blur(10px);
}

.about-content h2 {
    font-family: var(--font-main);
    font-size: 2.5rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--washer-red);
    padding-bottom: 0.5rem;
}

.about-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.about-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(232, 232, 232, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(232, 232, 232, 0.1);
}

.info-label {
    font-family: var(--font-main);
    font-size: 0.9rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: 1.1rem;
    color: var(--text-light);
}

.info-value a {
    color: var(--washer-red);
    text-decoration: none;
    transition: color 0.3s ease;
}

.info-value a:hover {
    color: var(--text-light);
}

/* ================================================== */
/* Page Content (for other pages: portfolio, etc.)   */
/* ================================================== */

.page-content {
    position: relative;
    z-index: 5;
    padding: 2rem 5%;
    padding-top: 6rem;
    min-height: calc(100vh + 100px);  /* Ensure content is taller than viewport */
    pointer-events: auto;
    touch-action: pan-y;  /* Enable vertical touch scrolling */
}

.page-title {
    font-size: 2.5rem;
    font-weight: 400;
    color: var(--text-dim);
    margin-bottom: 3rem;
    letter-spacing: 0.1em;
}

/* ================================================== */
/* Card Grid (for portfolio, creation pages)         */
/* ================================================== */

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2.25rem;
    max-width: 1400px;
    margin: 0 auto 2rem;
}

.card {
    background: rgba(18, 18, 26, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(22, 22, 32, 0.8);
}

.card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0.9;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: block;
}

.card:hover .card-image img {
    opacity: 1;
    transform: scale(1.03);
}

.card.featured .card-image {
    aspect-ratio: 16 / 9;
}

.card-image > div {
    width: 100%;
    height: 100%;
}

.card-content {
    padding: 1.6rem 1.6rem 1.4rem;
}

.card-content h2 {
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

.card-meta {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-bottom: 0.85rem;
    letter-spacing: 0.02em;
    opacity: 0.85;
}

.card-description {
    font-size: 0.93rem;
    color: rgba(232, 232, 232, 0.78);
    line-height: 1.75;
    margin-bottom: 1rem;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    font-size: 0.7rem;
    padding: 0.22rem 0.65rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-dim);
    letter-spacing: 0.02em;
    transition: background 0.3s ease, color 0.3s ease;
}

.card:hover .tag {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-light);
}

.card-link {
    font-size: 0.9rem;
    color: var(--washer-red);
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-block;
}

.card-link:hover {
    color: var(--text-light);
}

/* ================================================== */
/* Section Blocks (for research, skills pages)       */
/* ================================================== */

.section-block {
    background: rgba(20, 20, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.section-block h2 {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(139, 32, 32, 0.5);
}

.section-block h3 {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-light);
    margin: 1.5rem 0 0.75rem;
}

.section-block p {
    color: var(--text-dim);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.section-block ul {
    color: var(--text-dim);
    line-height: 1.8;
    margin-left: 1.5rem;
}

.section-block li {
    margin-bottom: 0.5rem;
}

/* ================================================== */
/* Skill Bars (for skills page)                      */
/* ================================================== */

.skill-item {
    margin-bottom: 2rem;
}

.skill-name {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    color: var(--text-light);
}

.skill-level {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.skill-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.skill-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(139, 32, 32, 0.9), rgba(139, 32, 32, 0.5));
    border-radius: 4px;
    transition: width 1.2s ease;
}

/* Active state for navigation */
.nav-links a.active {
    color: var(--text-light);
}

.nav-links a.active::after {
    width: 100%;
}

/* ================================================== */
/* Gallery Grid (for creation page illustrations)    */
/* ================================================== */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.gallery-grid a {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.gallery-grid a:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.18);
}

.gallery-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: block;
}

.gallery-grid a:hover img {
    opacity: 1;
    transform: scale(1.04);
}

/* ================================================== */
/* Publication Card (for research page)              */
/* ================================================== */

.publication-card {
    background: rgba(20, 20, 30, 0.75);
    border: 1px solid rgba(139, 32, 32, 0.4);
    border-left: 3px solid var(--washer-red);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
    transition: border-color 0.3s ease;
}

.publication-card:hover {
    border-color: rgba(139, 32, 32, 0.7);
}

.publication-card.featured {
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.8), rgba(30, 18, 18, 0.6));
}

.pub-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pub-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    background: rgba(139, 32, 32, 0.25);
    border: 1px solid rgba(139, 32, 32, 0.5);
    border-radius: 4px;
    color: var(--text-light);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.pub-badge.muted {
    background: rgba(232, 232, 232, 0.08);
    border-color: rgba(232, 232, 232, 0.2);
    color: var(--text-dim);
}

.publication-card h3 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.pub-authors {
    font-size: 0.95rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.pub-authors strong {
    color: var(--text-light);
}

.pub-venue {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.pub-venue em {
    color: var(--text-light);
}

.pub-summary {
    font-size: 0.95rem;
    color: var(--text-dim);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.pub-bridge {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.7;
    padding: 1rem 1.2rem;
    background: rgba(139, 32, 32, 0.08);
    border-left: 2px solid rgba(139, 32, 32, 0.5);
    border-radius: 4px;
    margin-bottom: 1.2rem;
}

.pub-bridge strong {
    color: var(--text-light);
}

.pub-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.pub-links a {
    font-size: 0.9rem;
    color: var(--washer-red);
    text-decoration: none;
    padding: 0.4rem 0.9rem;
    border: 1px solid rgba(139, 32, 32, 0.5);
    border-radius: 4px;
    transition: background 0.3s ease, color 0.3s ease;
}

.pub-links a:hover {
    background: rgba(139, 32, 32, 0.8);
    color: var(--text-light);
}

/* ================================================== */
/* Featured Card (for portfolio, kaerucrape teaser)  */
/* ================================================== */

.card.featured {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.85), rgba(30, 18, 18, 0.55));
    border-color: rgba(139, 32, 32, 0.5);
}

.card-status {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.card-status.in-development {
    background: rgba(139, 32, 32, 0.3);
    border: 1px solid rgba(139, 32, 32, 0.5);
    color: var(--text-light);
}

.card-status.released {
    background: rgba(168, 212, 196, 0.15);
    border: 1px solid rgba(168, 212, 196, 0.35);
    color: var(--text-light);
}

.card-status.tool {
    background: rgba(232, 232, 232, 0.08);
    border: 1px solid rgba(232, 232, 232, 0.2);
    color: var(--text-dim);
}

/* ================================================== */
/* Section heading (within page-content)             */
/* ================================================== */

.section-heading {
    max-width: 1400px;
    margin: 4rem auto 1.75rem;
    padding: 0 0.5rem;
}

.section-heading:first-of-type {
    margin-top: 1.5rem;
}

.section-heading h2 {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-light);
    letter-spacing: 0.1em;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(139, 32, 32, 0.4);
    text-transform: uppercase;
}

.section-heading p {
    font-size: 0.88rem;
    color: var(--text-dim);
    margin-top: 0.85rem;
    line-height: 1.7;
    max-width: 720px;
}

/* ================================================== */
/* Stats Row (engine page numbers)                   */
/* ================================================== */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-cell {
    text-align: center;
    padding: 1.2rem 0.8rem;
    background: rgba(232, 232, 232, 0.04);
    border: 1px solid rgba(232, 232, 232, 0.1);
    border-radius: 8px;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-light);
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ================================================== */
/* Evidence List (skills page replacement for stars) */
/* ================================================== */

.evidence-item {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(232, 232, 232, 0.08);
}

.evidence-item:last-child {
    border-bottom: none;
}

.evidence-tech {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
    padding-top: 0.1rem;
}

.evidence-body {
    color: var(--text-dim);
    font-size: 0.92rem;
    line-height: 1.7;
}

.evidence-body a {
    color: var(--washer-red);
    text-decoration: none;
}

.evidence-body a:hover {
    color: var(--text-light);
    border-bottom: 1px solid var(--washer-red);
}

@media (max-width: 768px) {
    .evidence-item {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
}

/* ================================================== */
/* Progress Tracker (kaerucrape page)                */
/* ================================================== */

.progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.progress-column {
    padding: 1.2rem;
    background: rgba(232, 232, 232, 0.04);
    border: 1px solid rgba(232, 232, 232, 0.1);
    border-radius: 8px;
}

.progress-column.done {
    border-left: 3px solid rgba(168, 212, 196, 0.6);
}

.progress-column.remaining {
    border-left: 3px solid rgba(139, 32, 32, 0.6);
}

.progress-column.next {
    border-left: 3px solid rgba(232, 232, 232, 0.4);
}

.progress-column h4 {
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.progress-column ul {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.7;
}

.progress-column li {
    margin-bottom: 0.4rem;
}

/* ================================================== */
/* Inline Code (engine page, etc.)                   */
/* ================================================== */

code, .inline-code {
    font-family: 'Courier New', monospace;
    font-size: 0.88em;
    padding: 0.15rem 0.4rem;
    background: rgba(232, 232, 232, 0.08);
    border-radius: 3px;
    color: var(--text-light);
}

pre {
    background: rgba(5, 5, 8, 0.7);
    border: 1px solid rgba(232, 232, 232, 0.1);
    border-left: 3px solid var(--washer-red);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-light);
}

pre code {
    background: none;
    padding: 0;
}

/* ================================================== */
/* Contact / CTA buttons (index hero)                */
/* ================================================== */

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.92rem;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.3s ease, border-color 0.3s ease;
    border: 1px solid;
}

.cta-button.primary {
    background: rgba(139, 32, 32, 0.85);
    border-color: rgba(139, 32, 32, 1);
    color: var(--text-light);
}

.cta-button.primary:hover {
    background: rgba(139, 32, 32, 1);
}

.cta-button.ghost {
    background: transparent;
    border-color: rgba(232, 232, 232, 0.25);
    color: var(--text-light);
}

.cta-button.ghost:hover {
    border-color: rgba(232, 232, 232, 0.55);
    background: rgba(232, 232, 232, 0.06);
}

/* ================================================== */
/* Career Timeline (index page)                       */
/* ================================================== */

.timeline-section {
    position: relative;
    z-index: 10;
    padding: 4rem 2rem 6rem;
    background: linear-gradient(to bottom, rgba(5, 5, 8, 0.95), rgba(5, 5, 8, 1));
}

.timeline-content {
    max-width: 880px;
    margin: 0 auto;
}

.timeline-content > h2 {
    font-size: 2rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--washer-red);
    padding-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.timeline-content > p {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 2.5rem;
}

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(139, 32, 32, 0.35);
}

.timeline-row {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-row::before {
    content: '';
    position: absolute;
    left: -1.6rem;
    top: 0.4rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(139, 32, 32, 0.9);
    border: 2px solid var(--space-black);
    box-shadow: 0 0 0 1px rgba(139, 32, 32, 0.5);
}

.timeline-date {
    font-size: 0.82rem;
    color: var(--washer-red);
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.timeline-body {
    color: var(--text-dim);
    line-height: 1.7;
    font-size: 0.95rem;
}

.timeline-body strong {
    color: var(--text-light);
    font-weight: 500;
}

/* ================================================== */
/* Footer / Contact strip                             */
/* ================================================== */

.site-footer {
    position: relative;
    z-index: 10;
    padding: 2.5rem 2rem 3rem;
    background: rgba(5, 5, 8, 1);
    border-top: 1px solid rgba(232, 232, 232, 0.08);
    text-align: center;
}

.site-footer p {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.site-footer a {
    color: var(--washer-red);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--text-light);
}

/* ================================================== */
/* Back to top button                                 */
/* ================================================== */

.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(139, 32, 32, 0.85);
    border: 1px solid rgba(139, 32, 32, 1);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, background 0.3s ease;
    z-index: 100;
    line-height: 1;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    background: rgba(139, 32, 32, 1);
}

/* ================================================== */
/* Responsive Design                                  */
/* ================================================== */

@media (max-width: 1024px) {
    .hero-text {
        right: 5%;
        top: 60%;  /* Move title down on tablets */
    }

    .hero-text h1 {
        font-size: 2.5rem;
    }

    .hero-text .subtitle {
        font-size: 1.1rem;
    }

    .page-content {
        padding: 1.5rem 3%;
        padding-top: 5.5rem;
    }

    .page-title {
        font-size: 2rem;
    }

    /* Enable touch scrolling for tablets */
    .ui-overlay {
        touch-action: pan-y;
    }
}

@media (max-width: 768px) {
    nav {
        padding: 1.5rem 2rem;
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero-text {
        right: 50%;
        top: 65%;  /* Move title further down on mobile */
        transform: translate(50%, -50%);
        text-align: center;
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    .hero-text .subtitle {
        font-size: 1rem;
    }

    .about-content {
        padding: 2rem;
    }

    .about-content h2 {
        font-size: 2rem;
    }

    .about-info {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 1.5rem 2%;
        padding-top: 7rem;
    }

    .page-title {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }

    .cards-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .section-block {
        padding: 1.5rem;
    }

    .section-block h2 {
        font-size: 1.3rem;
    }

    /* Enable touch scrolling for mobile */
    .ui-overlay {
        touch-action: pan-y;
    }
}

@media (max-width: 480px) {
    nav {
        padding: 1rem;
    }

    .nav-logo a {
        font-size: 1.2rem;
    }

    .nav-links {
        font-size: 0.85rem;
        gap: 0.8rem;
    }

    .hero-text h1 {
        font-size: 1.8rem;
    }

    .hero-text .subtitle {
        font-size: 0.9rem;
    }

    .about-content {
        padding: 1.5rem;
    }

    .page-content {
        padding: 1rem;
        padding-top: 6.5rem;
    }

    .page-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .card-content {
        padding: 1.2rem;
    }

    .card-content h2 {
        font-size: 1.1rem;
    }

    .section-block {
        padding: 1.2rem;
    }
}
