/* =========================================================
   Greatest Interactive — Global styles
   This is the single source of truth for the site's design
   tokens (color + type). Page-specific stylesheets (e.g. home.css)
   should read these variables rather than redefining their own,
   so every page — including ones not redesigned yet — shares the
   same visual language automatically.
   ========================================================= */

:root {
    /* Brand tokens */
    --brand-red: #da4332;
    --brand-blue: #2d7df6;
    --brand-yellow: #f5c451;
    --brand-red-soft: #fff0ee;
    --brand-blue-soft: #edf4ff;
    --brand-yellow-soft: #fff7db;
    --ink: #1b1330;
    --paper: #faf6f1;
    --surface: #ffffff;
    --violet-900: #3d2470;
    --violet-700: #5b3aa8;
    --violet-500: #7c5cff;
    --amber: var(--brand-yellow);
    --coral: var(--brand-red);
    --sky: var(--brand-blue);
    --mint: #8adcc0;
    --muted: #746f85;
    --line: rgba(27, 19, 48, 0.08);

    /* Legacy aliases — kept so any older page/template still
       referencing these original variable names automatically
       picks up the new palette instead of breaking. */
    --blue: var(--brand-blue);
    --red: var(--brand-red);
    --yellow: var(--brand-yellow);
    --bg: var(--paper);
    --text: var(--ink);

    /* Type */
    --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
    --font-body: "Inter", "Segoe UI", system-ui, sans-serif;

    /* Shared layout tokens */
    --container: 1160px;
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --shadow-soft: 0 20px 45px -25px rgba(27, 19, 48, 0.35);

    /* --- New direction (home page, more pages to follow) ---
       Soft pastel-gradient hero + solid ink pill buttons + muted
       pastel tiles, replacing the vivid violet/chip look going
       forward. Added additively so nothing already shipped (about,
       services, projects, contact, project-detail) changes today. */
    --gradient-start: #f8d9d4;
    --gradient-end: #dfeeff;
    --tile-a: #ffefe9;
    --tile-b: #edf4ff;
    --tile-c: #fff7db;
    --tile-d: #f2f0ff;
    --pill-bg: var(--brand-red);
    --pill-fg: #ffffff;
}

:root[data-theme="dark"] {
    --ink: #f5f1ff;
    --paper: #120d1e;
    --surface: #1c1630;
    --muted: #b6afcf;
    --line: rgba(245, 241, 255, 0.12);

    --gradient-start: #3b2d58;
    --gradient-end: #1f3d51;
    --tile-a: #3a2430;
    --tile-b: #223b5d;
    --tile-c: #3e3520;
    --tile-d: #2b2a45;
    --pill-bg: var(--brand-blue);
    --pill-fg: #ffffff;
}

:root[data-theme="dark"] .eyebrow--red {
    color: #ff8b7f;
    background: rgba(218, 67, 50, 0.18);
    border-color: rgba(255, 139, 127, 0.22);
}

:root[data-theme="dark"] .eyebrow--blue {
    color: #8ab8ff;
    background: rgba(45, 125, 246, 0.18);
    border-color: rgba(138, 184, 255, 0.22);
}

:root[data-theme="dark"] .eyebrow--yellow {
    color: #ffd879;
    background: rgba(245, 196, 81, 0.14);
    border-color: rgba(255, 216, 121, 0.22);
}

:root[data-theme="dark"] .badge-red {
    color: #ff8b7f;
    background: rgba(218, 67, 50, 0.16);
    border-color: rgba(255, 139, 127, 0.2);
}

:root[data-theme="dark"] .badge-blue {
    color: #8ab8ff;
    background: rgba(45, 125, 246, 0.16);
    border-color: rgba(138, 184, 255, 0.2);
}

:root[data-theme="dark"] .badge-yellow {
    color: #ffd879;
    background: rgba(245, 196, 81, 0.12);
    border-color: rgba(255, 216, 121, 0.2);
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    transition: background 0.25s ease, color 0.25s ease;
}

h1, h2, h3 {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}

/* ---------------------------------------------------------
   Header / nav
   --------------------------------------------------------- */

.brand-red { color: var(--brand-red); }
.brand-blue { color: var(--brand-blue); }
.brand-yellow { color: var(--brand-yellow); }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border: 1px solid var(--line);
    background: var(--brand-blue-soft);
    color: var(--brand-blue);
    line-height: 1;
}

.eyebrow--red {
    color: var(--brand-red);
    background: var(--brand-red-soft);
    border-color: rgba(218, 67, 50, 0.18);
}

.eyebrow--blue {
    color: var(--brand-blue);
    background: var(--brand-blue-soft);
    border-color: rgba(45, 125, 246, 0.18);
}

.eyebrow--yellow {
    color: #7d5e00;
    background: var(--brand-yellow-soft);
    border-color: rgba(245, 196, 81, 0.22);
}

.text-accent-red { color: var(--brand-red); }
.text-accent-blue { color: var(--brand-blue); }
.text-accent-yellow { color: var(--brand-yellow); }

.badge-red {
    background: var(--brand-red-soft);
    border-color: rgba(218, 67, 50, 0.18);
    color: var(--brand-red);
}

.badge-blue {
    background: var(--brand-blue-soft);
    border-color: rgba(45, 125, 246, 0.18);
    color: var(--brand-blue);
}

.badge-yellow {
    background: var(--brand-yellow-soft);
    border-color: rgba(245, 196, 81, 0.22);
    color: #7d5e00;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 24px;
    padding: 18px 40px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    transition: background 0.25s ease, border-color 0.25s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-shrink: 0;
    justify-self: start;
}

.logo-wordmark {
    display: block;
    height: 20px;
    width: auto;
    object-fit: contain;
}

.logo-wordmark--dark {
    display: none;
}

:root[data-theme="dark"] .logo-wordmark--light {
    display: none;
}

:root[data-theme="dark"] .logo-wordmark--dark {
    display: block;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 0;
    justify-self: end;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin: 0 auto;
    min-width: 0;
}

.nav a {
    position: relative;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding-bottom: 4px;
    transition: color 0.2s ease;
    --nav-hover-color: var(--brand-blue);
}

.nav a:nth-child(3n + 1) {
    --nav-hover-color: var(--brand-red);
}

.nav a:nth-child(3n + 2) {
    --nav-hover-color: var(--brand-blue);
}

.nav a:nth-child(3n) {
    --nav-hover-color: var(--brand-yellow);
}

.nav a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 100%;
    bottom: 0;
    height: 2px;
    background: var(--nav-hover-color);
    transition: right 0.25s ease, background 0.2s ease;
}

.nav a:hover {
    color: var(--nav-hover-color);
}

.nav a:hover::after {
    right: 0;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text, var(--ink));
    padding: 0;
    cursor: pointer;
    flex: none;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.25s ease;
}

.theme-toggle:hover,
.nav-toggle:hover {
    border-color: var(--brand-blue);
    background: var(--brand-blue-soft);
    transform: translateY(-1px);
}

.theme-toggle:hover {
    color: var(--brand-red);
}

.theme-toggle .icon-moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: block;
}

.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    padding: 0;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.nav-toggle-bar {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 0.25s ease, opacity 0.25s ease, top 0.25s ease;
}

.nav-toggle-bar:nth-child(1) { top: 14px; }
.nav-toggle-bar:nth-child(2) { top: 20px; }
.nav-toggle-bar:nth-child(3) { top: 26px; }

.nav-toggle.is-active .nav-toggle-bar:nth-child(1) {
    top: 20px;
    transform: rotate(45deg);
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(3) {
    top: 20px;
    transform: rotate(-45deg);
}

/* ---------------------------------------------------------
   Main / footer
   --------------------------------------------------------- */

main {
    min-height: 80vh;
}

.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 30;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--brand-blue);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease, background 0.2s ease, color 0.2s ease;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--brand-yellow);
    color: var(--ink);
    transform: translateY(-2px);
}

@media (max-width: 720px) {
    .back-to-top {
        right: 16px;
        bottom: 16px;
        width: 44px;
        height: 44px;
    }
}

.site-footer {
    padding: 32px 20px 42px;
    background: linear-gradient(135deg, rgba(45, 125, 246, 0.04), rgba(218, 67, 50, 0.04), rgba(245, 196, 81, 0.08));
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.footer-brand,
.footer-links,
.footer-socials {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.footer-brand {
    flex-direction: column;
    align-items: flex-start;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
}

.footer-wordmark {
    display: block;
    width: auto;
    height: 22px;
    object-fit: contain;
}

.footer-wordmark--dark {
    display: none;
}

:root[data-theme="dark"] .footer-wordmark--light {
    display: none;
}

:root[data-theme="dark"] .footer-wordmark--dark {
    display: block;
}

.footer-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--ink);
}

.footer-brand p:last-child {
    margin: 0;
}

.footer-links a,
.footer-socials a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.footer-links a:hover,
.footer-socials a:hover {
    color: var(--brand-red);
    transform: translateY(-1px);
}

.footer-socials a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--line);
}

.footer-socials a:nth-child(2):hover { color: var(--brand-blue); }
.footer-socials a:nth-child(3):hover { color: var(--brand-yellow); }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 720px) {
    .site-header {
        position: sticky;
        top: 0;
        z-index: 20;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 14px 20px;
        gap: 12px;
    }

    .header-actions {
        margin-left: auto;
        order: 2;
        gap: 8px;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .nav {
        display: none;
        order: 3;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
        border-top: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        margin: 0;
    }

    .nav.is-open {
        display: flex;
    }

    .nav a {
        display: block;
        width: 100%;
        padding: 12px 10px;
        border-radius: 0;
        background: transparent;
        border-bottom: 1px solid var(--line);
    }

    .nav a:last-child {
        border-bottom: none;
    }

    .nav a::after {
        display: none;
    }
}