/* ==========================================================================
   modern.css — modern styling layer on top of the Freelancer theme
   Adds: design tokens, dark mode, refined cards, hero, tech strip,
   scroll-reveal animations. Loaded after styles.css / index.css so it wins.
   ========================================================================== */

:root {
    --m-accent: #1abc9c;
    --m-accent-2: #16a085;
    --m-accent-rgb: 26, 188, 156;

    --m-bg: #ffffff;
    --m-bg-alt: #f6f8f9;
    --m-surface: #ffffff;
    --m-surface-2: #f2f5f6;
    --m-ink: #1c1f22;
    --m-ink-soft: #4c555c;
    --m-border: rgba(20, 30, 35, 0.10);
    --m-shadow: 0 10px 30px rgba(18, 38, 34, 0.10);
    --m-shadow-lg: 0 18px 50px rgba(18, 38, 34, 0.18);
    --m-radius: 16px;

    /* dark-section (the teal/dark panels) tokens */
    --m-dark-bg: #22282b;
    --m-dark-surface: #2b3236;
    --m-dark-ink: #eef2f3;
}

html[data-theme="dark"] {
    --m-bg: #14181a;
    --m-bg-alt: #181d20;
    --m-surface: #1e2427;
    --m-surface-2: #232a2e;
    --m-ink: #e8edee;
    --m-ink-soft: #a7b2b7;
    --m-border: rgba(255, 255, 255, 0.10);
    --m-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --m-shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);

    --m-dark-bg: #0f1315;
    --m-dark-surface: #181e21;
    --m-dark-ink: #eef2f3;
}

/* ---------- Typography ---------- */
body {
    font-family: "Inter", "Lato", -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--m-bg);
    color: var(--m-ink);
    transition: background-color .35s ease, color .35s ease;
}

h1, h2, h3, h4, h5, h6,
.masthead-heading, .page-section-heading, .portfolio-modal-title {
    font-family: "Space Grotesk", "Montserrat", sans-serif;
    letter-spacing: -0.01em;
}

/* ---------- Light / dark section backgrounds ---------- */
.page-section {
    background-color: var(--m-bg);
    color: var(--m-ink);
    transition: background-color .35s ease, color .35s ease;
}

/* alternate section shading for rhythm */
#about, #education { background-color: var(--m-bg); }
#certs { background-color: var(--m-bg-alt); }

/* the theme's dark/teal panels */
.page-section.bg-primary {
    background: linear-gradient(160deg, var(--m-dark-bg) 0%, #1a2a27 100%) !important;
    color: var(--m-dark-ink) !important;
}
html[data-theme="dark"] .page-section.bg-primary {
    background: linear-gradient(160deg, #0d1113 0%, #10201d 100%) !important;
}

.page-section-heading { color: var(--m-ink); }
.page-section.bg-primary .page-section-heading { color: #fff; }

/* The theme's .text-secondary is a dark ink used for sub-headings (job titles,
   degrees). It's dark-on-dark on the dark panels AND in dark mode — remap every
   section sub-heading to the accent so it stays readable in both themes. */
.page-section .text-secondary { color: var(--m-accent) !important; }
.page-section.bg-primary .lead { color: rgba(238, 242, 243, 0.9); }

/* section headings get an accent underline instead of just the icon divider */
.page-section-heading {
    position: relative;
    font-weight: 700;
}

/* Divider icons/lines default to a dark ink (invisible on dark sections and in
   dark mode). Tint icons accent and give the lines an accent gradient. */
.divider-custom .divider-custom-icon { color: var(--m-accent) !important; }
.divider-custom .divider-custom-line {
    background-color: transparent !important;
    background-image: linear-gradient(to right, transparent, rgba(var(--m-accent-rgb), 0.65)) !important;
}
.divider-custom .divider-custom-line:last-child {
    background-image: linear-gradient(to left, transparent, rgba(var(--m-accent-rgb), 0.65)) !important;
}

/* ---------- Navbar ---------- */
#mainNav {
    background-color: rgba(20, 24, 26, 0.85) !important;
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: background-color .3s ease, padding .3s ease;
}
#mainNav .navbar-brand { font-family: "Space Grotesk", sans-serif; font-weight: 700; }
#mainNav .nav-link { transition: color .2s ease, background-color .2s ease; }
#mainNav .nav-link:hover { color: var(--m-accent) !important; }
/* Active link: the theme paints a green pill; make it clean accent text
   with a transparent background + underline so the label stays readable. */
#mainNav .navbar-nav .nav-link.active,
#mainNav .navbar-nav > li.nav-item > a.nav-link.active {
    color: var(--m-accent) !important;
    background: transparent !important;
    box-shadow: inset 0 -2px 0 var(--m-accent);
}

/* Theme toggle button */
.theme-toggle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .25s ease, border-color .25s ease, background-color .25s ease;
    flex: 0 0 auto;
}
.theme-toggle:hover {
    transform: rotate(20deg) scale(1.05);
    border-color: var(--m-accent);
    background: rgba(var(--m-accent-rgb), 0.15);
}
.theme-toggle .fa-sun { display: none; }
html[data-theme="dark"] .theme-toggle .fa-sun { display: inline; }
html[data-theme="dark"] .theme-toggle .fa-moon { display: none; }

/* ---------- Hero ---------- */
.masthead {
    background: radial-gradient(1200px 600px at 50% -10%, #1c3a34 0%, #16211f 55%, #10191a 100%) !important;
    position: relative;
    overflow: hidden;
}
.masthead::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(var(--m-accent-rgb), 0.20), transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(var(--m-accent-rgb), 0.14), transparent 35%);
    pointer-events: none;
}
.masthead .container { position: relative; z-index: 1; }
.masthead-avatar {
    width: 15rem;
    height: 15rem;
    object-fit: cover;
    object-position: center 20%;
    border-radius: 50%;
    border: 4px solid rgba(var(--m-accent-rgb), 0.55);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    transition: transform .4s ease;
}
.masthead-avatar:hover { transform: translateY(-6px) scale(1.02); }
.masthead-heading { font-weight: 700; }
.masthead-subheading { color: var(--m-accent) !important; font-weight: 500; letter-spacing: .03em; }

.hero-tagline {
    max-width: 640px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.82);
    font-size: 1.1rem;
    line-height: 1.6;
}
.hero-ctas { margin-top: 1.75rem; display: flex; gap: .9rem; flex-wrap: wrap; justify-content: center; }
.btn-hero {
    border-radius: 999px;
    padding: .7rem 1.6rem;
    font-weight: 600;
    letter-spacing: .02em;
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.btn-hero-primary {
    background: var(--m-accent);
    border: none;
    color: #08201b;
}
.btn-hero-primary:hover {
    background: #23d3b0;
    color: #08201b;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(var(--m-accent-rgb), 0.4);
}
.btn-hero-ghost {
    background: transparent;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    color: #fff;
}
.btn-hero-ghost:hover {
    border-color: var(--m-accent);
    color: var(--m-accent);
    transform: translateY(-3px);
}

/* ---------- Tech stack strip ---------- */
.tech-strip {
    background: var(--m-surface);
    border-top: 1px solid var(--m-border);
    border-bottom: 1px solid var(--m-border);
    padding: 1.6rem 0;
    transition: background-color .35s ease;
}
.tech-strip .tech-track {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: .7rem 1rem;
}
.tech-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1rem;
    border: 1px solid var(--m-border);
    border-radius: 999px;
    background: var(--m-surface-2);
    color: var(--m-ink-soft);
    font-weight: 600;
    font-size: .95rem;
    transition: transform .2s ease, color .2s ease, border-color .2s ease;
}
.tech-chip i { color: var(--m-accent); }
.tech-chip:hover {
    transform: translateY(-3px);
    color: var(--m-ink);
    border-color: rgba(var(--m-accent-rgb), 0.5);
}

/* ---------- Cards: projects, certs ---------- */
.portfolio .portfolio-item {
    border-radius: var(--m-radius);
    overflow: hidden;
    background: var(--m-dark-surface);
    box-shadow: var(--m-shadow);
    transition: transform .3s ease, box-shadow .3s ease;
    padding-bottom: .5rem;
}
.portfolio .portfolio-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--m-shadow-lg);
}
.portfolio .portfolio-item h5 { margin-top: .9rem; margin-bottom: .35rem; font-weight: 700; color: #fff; }
.portfolio .portfolio-item p.lead { color: rgba(238, 242, 243, 0.72); font-size: 1rem; padding: 0 1rem 1rem; }
.portfolio .portfolio-item .portfolio-item-caption {
    background-color: rgba(var(--m-accent-rgb), 0.82) !important;
    border-radius: var(--m-radius);
}
/* Light tile behind every thumbnail so logos, transparent SVGs and
   screenshots all read consistently on the dark cards. */
.portfolio .portfolio-item > .d-flex {
    background: #ffffff;
    border-radius: 12px;
    margin: .85rem .85rem 0;
    padding: 1.1rem;
    align-items: center;
    justify-content: center;
}
.portfolio .portfolio-item .img-project {
    margin-bottom: 0;
    height: 150px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

/* certifications cards */
#certs .shadow-hover {
    border-radius: var(--m-radius);
    background: var(--m-surface);
    border: 1px solid var(--m-border);
    padding-bottom: 1rem;
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
#certs .shadow-hover:hover {
    transform: translateY(-8px);
    box-shadow: var(--m-shadow-lg) !important;
    border-color: rgba(var(--m-accent-rgb), 0.5);
    border-radius: var(--m-radius);
}
#certs h4 { color: var(--m-ink); }

/* ---------- Accordions (skills, coursework) ---------- */
.accordion-item {
    background: var(--m-surface);
    border: 1px solid var(--m-border) !important;
    border-radius: 12px !important;
    overflow: hidden;
    margin-bottom: .6rem;
}
.accordion-button {
    background: var(--m-surface) !important;
    color: var(--m-ink) !important;
    font-weight: 600;
}
.accordion-button:not(.collapsed) {
    color: var(--m-accent) !important;
    background: var(--m-surface-2) !important;
    box-shadow: none;
}
.accordion-button:focus { box-shadow: 0 0 0 .2rem rgba(var(--m-accent-rgb), 0.25); }
.accordion-body { background: var(--m-surface); color: var(--m-ink); }
.list-group-item { background: transparent; color: var(--m-ink); border-color: var(--m-border); }
.course-desc { color: var(--m-ink-soft); }

/* coursework sits on a dark section — keep those accordions readable */
#courses .accordion-item,
#courses .accordion-button,
#courses .accordion-body { background: var(--m-dark-surface) !important; color: var(--m-dark-ink) !important; }
#courses .accordion-button:not(.collapsed) { color: var(--m-accent) !important; }
#courses .course-desc { color: rgba(238, 242, 243, 0.7); }

/* ---------- Buttons (project modals / CV) ---------- */
.btn-primary {
    background-color: var(--m-accent);
    border-color: var(--m-accent);
    border-radius: 999px;
    transition: transform .2s ease, box-shadow .2s ease;
}
.btn-primary:hover {
    background-color: var(--m-accent-2);
    border-color: var(--m-accent-2);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(var(--m-accent-rgb), 0.35);
}
.btn-outline-dark {
    border-radius: 999px;
    border-width: 2px;
    transition: transform .2s ease, background-color .2s ease, color .2s ease;
}
.btn-outline-dark:hover { transform: translateY(-2px); }
/* In dark mode the theme's dark outline button is invisible — lighten it. */
html[data-theme="dark"] .btn-outline-dark {
    color: var(--m-ink);
    border-color: var(--m-ink-soft);
}
html[data-theme="dark"] .btn-outline-dark:hover {
    background-color: var(--m-accent);
    border-color: var(--m-accent);
    color: #08201b;
}

/* modal surfaces adapt to dark mode */
html[data-theme="dark"] .modal-content { background: var(--m-surface); color: var(--m-ink); }
html[data-theme="dark"] .modal-content .btn-close { filter: invert(1) grayscale(1); }

/* Modal title uses the theme's dark .text-secondary — invisible on the dark
   modal. Remap to accent (reads well on white and dark). */
.portfolio-modal .portfolio-modal-title { color: var(--m-accent) !important; }
.portfolio-modal .modal-body p { color: var(--m-ink); }

/* Put modal project images on a white tile so line-art / transparent SVGs and
   dark logos stay visible in dark mode. */
.portfolio-modal img.img-project {
    background: #ffffff;
    padding: 1.25rem;
    border-radius: 14px;
    max-height: 320px;
    width: auto;
    object-fit: contain;
}

/* ---------- Footer ---------- */
.footer { background: var(--m-dark-bg); color: var(--m-dark-ink); }
.footer a { color: var(--m-accent); text-decoration: none; }
.footer a:hover { color: #23d3b0; }
.btn-social { transition: transform .2s ease, background-color .2s ease; }
.btn-social:hover { transform: translateY(-3px); background: var(--m-accent); border-color: var(--m-accent); }

/* ---------- Scroll-reveal animations ---------- */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1);
    will-change: opacity, transform;
}
.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* Project cards animate with OPACITY ONLY — a positional transform on grid
   items fights the Bootstrap column layout and scatters the grid. Opacity
   can't affect geometry, so the grid stays intact while cards fade in. */
.portfolio-item.reveal {
    transform: none !important;
    transition: opacity .6s ease;
}

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
    .masthead-avatar, .portfolio-item, .tech-chip, .btn-hero, .btn-primary { transition: none !important; }
}
