/* ==========================================================================
   Brodie Cantrill — Portfolio
   Shared stylesheet
   ========================================================================== */

:root {
    --primary: #00aaff;
    --primary-rgb: 0, 170, 255;
    --bg: #050608;
    --text: #f5f7fa;
    --muted: rgba(245, 247, 250, 0.62);
    --card: rgba(17, 20, 24, 0.6);
    --accent-glow: rgba(0, 170, 255, 0.4);
    --line-rgb: 0, 170, 255;
    --card-shadow: rgba(0, 170, 255, 0.3);
    --glass-border: rgba(255, 255, 255, 0.1);
    --border: rgba(255, 255, 255, 0.1);
    --font-display: 'Montserrat', sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;
}

[data-theme="light"] {
    --bg: #f3f4f7;
    --text: #0c0e12;
    --muted: rgba(12, 14, 18, 0.62);
    --card: rgba(255, 255, 255, 0.7);
    --accent-glow: rgba(0, 170, 255, 0.16);
    --line-rgb: 0, 0, 0;
    --card-shadow: rgba(0, 170, 255, 0.12);
    --glass-border: rgba(0, 0, 0, 0.1);
    --border: rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-display);
    overflow-x: hidden;
    transition: background 0.5s ease, color 0.5s ease;
    cursor: none;
}

a { color: inherit; }
img { max-width: 100%; display: block; }

::selection {
    background: var(--primary);
    color: #fff;
}

/* Only hide the native cursor / show the custom one when the device actually
   has a precise pointer. Touch devices keep normal behaviour. */
@media (hover: none), (pointer: coarse) {
    body { cursor: auto; }
    .cursor-flashlight, #cursor-dot, #cursor-outline { display: none !important; }
}

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

/* --- Type helpers --- */
.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--muted);
}

/* --- Glow / outline text --- */
@keyframes breathe {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(var(--primary-rgb), 0.3)); }
    50% { filter: drop-shadow(0 0 22px rgba(var(--primary-rgb), 0.6)); }
}

.outline {
    color: transparent;
    -webkit-text-stroke: 1.5px var(--primary);
    animation: breathe 4s ease-in-out infinite;
}

/* --- Glassmorphism cards --- */
.card {
    padding: 40px;
    background: var(--card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--primary);
    transition: transform 0.1s ease-out, box-shadow 0.3s ease, background 0.3s ease;
    transform-style: preserve-3d;
}
.card:hover { box-shadow: 0 20px 60px var(--card-shadow); }
.card h3 { font-size: 1.2rem; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.card p { color: var(--muted); line-height: 1.6; }

.pill {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 4px;
}

/* --- Background canvas / cursor-follow glow --- */
#bg-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 120%;
    z-index: -2;
    background: var(--bg);
    will-change: transform;
}

.cursor-flashlight {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle 350px at var(--x, 50%) var(--y, 50%), var(--accent-glow), transparent 80%);
    z-index: -1;
    pointer-events: none;
}

#cursor-dot {
    width: 8px; height: 8px;
    background: var(--primary);
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    left: -100px; top: -100px;
}

#cursor-outline {
    width: 40px; height: 40px;
    border: 1px solid var(--primary);
    position: fixed;
    pointer-events: none;
    z-index: 999;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s, background 0.3s;
    left: -100px; top: -100px;
}

body.hovering #cursor-outline {
    width: 65px; height: 65px;
    background: rgba(var(--primary-rgb), 0.1);
}

/* --- Glitch transition overlay (used on sub-pages) --- */
.glitch-overlay {
    position: fixed;
    inset: 0;
    background: var(--primary);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
}
@keyframes glitch-anim {
    0% { opacity: 0.5; transform: translateX(-5px) skewX(10deg); }
    20% { opacity: 0.8; transform: translateX(5px) skewX(-10deg); }
    40% { opacity: 0.3; transform: scaleY(0.1); }
    100% { opacity: 0; transform: none; }
}
.glitching .glitch-overlay { animation: glitch-anim 0.4s linear; }

/* --- Nav / menu overlay --- */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-100%);
    transition: transform 0.8s cubic-bezier(0.85, 0, 0.15, 1);
}
.menu-overlay.active { transform: translateY(0); }
.menu-links { list-style: none; text-align: center; }
.menu-links li { margin: 25px 0; }
.menu-links a {
    display: inline-block;
    font-size: clamp(2rem, 8vw, 5rem);
    font-weight: 900;
    text-decoration: none;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: -2px;
}
.menu-links a:hover,
.menu-links a:focus-visible { color: var(--primary); }

.feature-hub {
    position: fixed;
    top: 20px; right: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 200;
}
.f-group { display: flex; align-items: center; justify-content: flex-end; gap: 15px; }
.f-label {
    background: var(--primary);
    color: #fff;
    padding: 5px 15px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0;
    transform: translateX(20px);
    transition: 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}
.f-group:hover .f-label,
.f-group:focus-within .f-label { opacity: 1; transform: translateX(0); }
.f-btn {
    width: 55px; height: 55px;
    border-radius: 50%;
    border: 1px solid var(--primary);
    background: var(--card);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    text-decoration: none;
    cursor: none;
    transition: 0.3s ease;
}
@media (hover: none), (pointer: coarse) { .f-btn { cursor: pointer; } }
.f-btn:focus-visible,
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

/* --- Hero --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 120px 8%;
}
.hero-greeting {
    font-family: var(--font-mono);
    letter-spacing: 4px;
    opacity: 0.55;
    margin-bottom: 14px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    min-height: 1em;
}
.hero h1 {
    font-size: clamp(3rem, 12vw, 8rem);
    font-weight: 900;
    letter-spacing: -5px;
    line-height: 0.82;
    text-transform: uppercase;
}
.hero-role {
    margin-top: 22px;
    letter-spacing: 5px;
    opacity: 0.6;
    font-weight: 300;
    font-size: clamp(0.75rem, 2vw, 0.95rem);
}

/* --- Sections --- */
section { padding: 120px 10%; opacity: 0; transform: translateY(80px); transition: 1s ease-out; }
section.active { opacity: 1; transform: translateY(0); }
section h2 {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 3px;
    color: var(--primary);
    margin-bottom: 34px;
    text-transform: uppercase;
}
.lede {
    font-size: clamp(1.1rem, 2.4vw, 1.4rem);
    max-width: 900px;
    font-weight: 300;
    line-height: 1.65;
    color: var(--text);
}
.lede strong { font-weight: 700; color: var(--primary); }

/* --- Marquee --- */
.marquee {
    background: var(--primary);
    color: #fff;
    padding: 18px 0;
    overflow: hidden;
    white-space: nowrap;
    font-weight: 900;
    text-transform: uppercase;
    transform: rotate(-1deg);
    margin: 10px 0 40px;
}
.marquee-content {
    display: inline-block;
    animation: marquee 25s linear infinite;
    font-size: 0.95rem;
    letter-spacing: 1px;
}
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* --- Card grids --- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 10px;
    perspective: 1000px;
}

#copy-toast {
    position: fixed;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    padding: 12px 25px;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    display: none;
    z-index: 1000;
    border-radius: 4px;
}

/* --- Footer --- */
.site-footer {
    padding: 80px 10%;
    opacity: 0.55;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    border-top: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--primary); }

/* --- Sub-page (projects / inquiry) headers --- */
.page-header { padding: 150px 10% 50px; }
.page-header h1 {
    font-size: clamp(2.6rem, 10vw, 6rem);
    font-weight: 900;
    letter-spacing: -4px;
    text-transform: uppercase;
    line-height: 0.9;
}
.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--primary);
    text-decoration: none;
    font-family: var(--font-mono);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}
.back-link:hover { text-decoration: underline; }

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 30px;
    padding: 0 10% 100px;
}
.project-card {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 46px;
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1), border-color 0.5s ease;
}
.project-card:hover { transform: translateY(-10px); border-color: var(--primary); }
.project-card h2 { font-size: 1.7rem; margin-bottom: 16px; text-transform: uppercase; letter-spacing: -0.5px; }
.project-card p { color: var(--muted); line-height: 1.6; margin-bottom: 26px; }

.tag {
    display: inline-block;
    padding: 5px 12px;
    border: 1px solid var(--primary);
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    margin: 0 10px 10px 0;
}

.project-link {
    color: var(--primary);
    text-decoration: none;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}
.project-link:hover { text-decoration: underline; }

.project-note {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.5px;
}

/* --- Contact / inquiry CTA --- */
.contact-container {
    padding: 20px 10% 120px;
    text-align: center;
}
.contact-container p {
    color: var(--muted);
    max-width: 600px;
    margin: 0 auto 34px;
    line-height: 1.6;
}
.email-btn {
    display: inline-block;
    padding: 20px 45px;
    border: 1px solid var(--primary);
    color: var(--primary);
    text-decoration: none;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}
.email-btn:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 30px var(--accent-glow);
    transform: translateY(-5px);
}

@media (max-width: 640px) {
    .feature-hub { top: 14px; right: 14px; gap: 10px; }
    .f-btn { width: 46px; height: 46px; font-size: 1rem; }
    section, .contact-container { padding-left: 7%; padding-right: 7%; }
    .page-header { padding: 120px 7% 40px; }
    .project-grid { padding: 0 7% 80px; }
}
