/* Global Styles */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', sans-serif;
}

img {
    image-rendering: -webkit-optimize-contrast;
}

header {
    backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    header {
        background-color: rgb(255, 255, 255) !important;
    }

    .dark header {
        background-color: rgb(24, 24, 27) !important;
    }
}

.acc-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.acc-body.open {
    max-height: 500px;
}

/* Mobile Menu */
#mobileMenu {
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

#mobileMenu.menu-hidden {
    opacity: 0;
    transform: translateY(-8px);
    visibility: hidden;
    pointer-events: none;
}

#mobileMenu.menu-visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

/* Skill section — grayscale sa light, colored sa dark */
.skill-icon {
    filter: grayscale(100%);
    opacity: 0.7;
    transition: filter 0.2s, opacity 0.2s;
}

.skill-icon:hover {
    filter: grayscale(0%);
    opacity: 1;
}

.dark .skill-icon {
    filter: grayscale(0%);
    opacity: 1;
}

/* Marquee gradient fade */
.marquee-icon {
    filter: grayscale(100%);
    opacity: 0.7;
    transition: filter 0.2s, opacity 0.2s;
}

.dark .marquee-icon {
    filter: grayscale(100%) invert(1);
    opacity: 0.6;
}

.marquee-icon:hover {
    filter: grayscale(0%);
    opacity: 1;
}

/* Project tech stack — colored palagi */
.tech-icon {
    filter: grayscale(0%);
    opacity: 1;
    transition: filter 0.2s, opacity 0.2s;
}

#heroIcon {
    filter: invert(1);
    /* light mode — magiging dark */
    transition: filter 0.3s ease;
}

.dark #heroIcon {
    filter: none;
    /* dark mode — white na siya */
}

/* Container para hindi gumalaw ang layout habang nagta-type */
#cyclingTitle {
    display: inline-block;
    border-right: 2px solid;
    /* Ang cursor */
    white-space: nowrap;
    overflow: hidden;
    width: fit-content;
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {

    from,
    to {
        border-color: transparent
    }

    50% {
        border-color: #71717a;
    }

    /* zinc-500 color */
}

/* Project card — redesigned */
.project-card {
    transition: opacity 0.3s, transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.project-card:hover {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04),
        0 8px 32px -4px rgba(0, 0, 0, 0.10),
        0 0 24px 2px var(--card-glow, rgba(0, 0, 0, 0.06));
}

.dark .project-card:hover {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04),
        0 8px 32px -4px rgba(0, 0, 0, 0.4),
        0 0 28px 4px var(--card-glow, rgba(0, 0, 0, 0.12));
}

/* shimmer on hover */
.project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.project-card:hover::after {
    opacity: 1;
}

.project-card.hidden-card {
    display: none;
}

.animate-marquee {
    will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@supports (transform: translateZ(0)) {
    .animate-marquee {
        transform: translateZ(0);
        backface-visibility: hidden;
        perspective: 1000px;
    }
}

/* Ripple theme transition */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 1;
}

::view-transition-new(root) {
    z-index: 9999;
    animation: ripple-in 0.6s ease-in-out;
}

@keyframes ripple-in {
    from {
        clip-path: circle(0% at var(--ripple-x, 50%) var(--ripple-y, 50%));
    }

    to {
        clip-path: circle(150% at var(--ripple-x, 50%) var(--ripple-y, 50%));
    }
}

/* ── Page Loader ── */
#pageLoader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    transition: opacity 0.4s ease;
}

.dark #pageLoader {
    background: #18181b;
}

#pageLoader.fade-out {
    opacity: 0;
    pointer-events: none;
}

#loaderText {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a1a1aa;
    font-weight: 500;
}

/* ── Case Study Modal ── */
.cs-modal-overlay {
    position: fixed; inset: 0; z-index: 9998;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0;
    opacity: 0; pointer-events: none;
    transition: opacity 0.16s ease;
}
@media (min-width: 640px) {
    .cs-modal-overlay { align-items: center; padding: 1.5rem; }
}
.cs-modal-overlay.cs-open {
    opacity: 1; pointer-events: auto;
}
.cs-modal-panel {
    position: relative;
    width: 100%; max-width: 580px;
    max-height: 90vh; overflow-y: auto;
    background: #fff;
    border-radius: 24px 24px 0 0;
    padding: 16px 20px 32px;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.05);
    transform: translateY(32px);
    transition: transform 0.3s cubic-bezier(0.34,1.3,0.64,1);
    scrollbar-width: thin; scrollbar-color: #e4e4e7 transparent;
}
@media (min-width: 640px) {
    .cs-modal-panel {
        border-radius: 20px;
        transform: translateY(24px) scale(0.97);
        transition: transform 0.3s cubic-bezier(0.34,1.2,0.64,1);
        padding: 32px;
    }
}
.dark .cs-modal-panel {
    background: #18181b;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
}
.cs-modal-panel.cs-panel-open {
    transform: translateY(0) scale(1);
}
/* fast snap-away on close */
.cs-modal-panel.cs-panel-closing {
    transition: transform 0.15s ease-in !important;
}
.cs-close-btn {
    position: absolute; top: 12px; right: 16px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #f4f4f5;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #71717a;
    transition: background 0.2s, color 0.2s;
}
@media (min-width: 640px) {
    .cs-close-btn { top: 24px; right: 24px; }
}
.cs-close-btn:hover { background: #e4e4e7; color: #18181b; }
.dark .cs-close-btn { background: #27272a; color: #a1a1aa; }
.dark .cs-close-btn:hover { background: #3f3f46; color: #fff; }

/* STAR step cards inside modal */
.cs-step {
    border-radius: 14px;
    padding: 14px 16px;
    border: 1px solid transparent;
    display: flex; flex-direction: column; gap: 8px;
    transition: transform 0.18s ease;
}
.cs-step:hover { transform: translateY(-2px); }
.cs-step-header {
    display: flex; align-items: center; gap: 8px;
}
.cs-step-dot {
    width: 8px; height: 8px;
    border-radius: 50%; flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.9);
}
.dark .cs-step-dot { box-shadow: 0 0 0 2px rgba(24,24,27,0.9); }
.cs-step-label {
    font-size: 10px; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase;
}
.cs-step-body {
    font-size: 12.5px; line-height: 1.65;
    color: #52525b;
}
.dark .cs-step-body { color: #d4d4d8; }
.cs-result-text { color: #3f3f46; font-weight: 500; }
.dark .cs-result-text { color: #d4d4d8; }

/* per-step tints — neutral black & white */
.cs-s-style,
.cs-t-style,
.cs-a-style,
.cs-r-style { background: rgba(0,0,0,0.03);  border-color: rgba(0,0,0,0.08); }
.dark .cs-s-style,
.dark .cs-t-style,
.dark .cs-a-style,
.dark .cs-r-style { background: rgba(255,255,255,0.04);  border-color: rgba(255,255,255,0.08); }

/* ── RB Spinner ── */
.rb-spinner {
    position: relative;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rb-track {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid #e5e5e5;
}

.dark .rb-track {
    border-color: #3f3f46;
}

.rb-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #111111;
    border-right-color: #111111;
    animation: rbspin 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.dark .rb-ring {
    border-top-color: #ffffff;
    border-right-color: #ffffff;
}

.rb-logo {
    font-size: 18px;
    font-weight: 700;
    color: #111111;
    animation: rbpulse 0.9s ease-in-out infinite;
    z-index: 1;
}

.dark .rb-logo {
    color: #ffffff;
    filter: invert(1);
}

@keyframes rbspin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes rbpulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@media (max-width: 400px) {
    .cs-step {
        padding: 12px;
    }
    .cs-step-body {
        font-size: 11.5px;
    }
}