:root {
    --bg: #0a0e1a;
    --bg-secondary: #0f172a;

    --surface: rgba(30, 41, 59, 0.6);
    --surface-solid: #161f34;
    --surface-hover: rgba(51, 65, 85, 0.7);

    --border: rgba(148, 163, 184, 0.10);
    --border-hover: rgba(129, 140, 248, 0.4);

    --text: #f1f5f9;
    --text-muted: #8b99b0;

    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --accent: #f5a524;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --font-display: "Space Grotesk", "Segoe UI", sans-serif;
    --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}


/* =========================
   GENERAL
   ========================= */

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: var(--font-body);

    background:
        radial-gradient(circle at 15% 0%, rgba(99, 102, 241, 0.10), transparent 40%),
        radial-gradient(circle at 100% 15%, rgba(245, 165, 36, 0.05), transparent 35%),
        linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px),
        var(--bg);
    background-size: auto, auto, 42px 42px, 42px 42px;

    color: var(--text);

    overflow-x: hidden;
    --keyboard-zindex: 2000;
}

h1, h2, h3, h4, h5, h6,
.navbar-brand,
.btn {
    font-family: var(--font-display);
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* =========================
   NAVBAR
   ========================= */

.navbar {
    background: rgba(9, 13, 24, 0.7) !important;

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    border-bottom: 1px solid var(--border);

    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}

.navbar-brand {
    color: var(--text) !important;
    font-weight: 700;
    letter-spacing: -0.3px;

    transition: color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.navbar-brand:hover {
    color: var(--primary-hover) !important;
    transform: translateY(-1px);
}

.navbar .nav-link {
    position: relative;

    color: var(--text-muted);
    margin: 0 2px;

    transition: color 0.2s var(--ease-out);
}

.navbar .nav-link::after {
    content: "";

    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    bottom: 2px;

    height: 2px;
    border-radius: 2px;
    background: var(--primary-hover);

    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s var(--ease-out);
}

.navbar .nav-link:hover {
    color: var(--text);
}

.navbar .nav-link:hover::after {
    transform: scaleX(1);
}

.navbar .nav-link.active {
    color: var(--text);
}

.navbar .nav-link.active::after {
    transform: scaleX(1);
    background: var(--accent);
}

.navbar .navbar-toggler-icon{
    --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar .navbar-toggler {
    --bs-navbar-color: rgba(23, 28, 80, 0.5);
}


/* =========================
   HERO
   ========================= */

.hero {
    position: relative;
}

.hero h1 {
    letter-spacing: -1.5px;
    text-shadow: 0 0 30px rgba(99, 102, 241, 0.15);

    opacity: 0;
    animation: heroRise 0.6s var(--ease-out) 0.15s forwards;
}

.hero .lead {
    color: var(--text-muted) !important;

    max-width: 620px;
    margin-left: auto;
    margin-right: auto;

    opacity: 0;
    animation: heroRise 0.6s var(--ease-out) 0.3s forwards;
}

.hero .btn {
    opacity: 0;
    animation: heroRise 0.6s var(--ease-out) 0.45s forwards;
}

@keyframes heroRise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .hero h1, .hero .lead, .hero .btn {
        animation: none;
        opacity: 1;
    }
}


/* =========================
   HAMMER
   ========================= */

.logo-hammer {
    height: 1em;
    width: auto;

    margin-right: 8px;
    margin-left: 8px;

    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.25));

    transition: transform 0.35s var(--ease-out), filter 0.35s var(--ease-out);
}

.logo-hammer:hover {
    transform: rotate(-18deg) translateY(-3px);
    filter: drop-shadow(0 10px 20px rgba(99, 102, 241, 0.3));
}


/* =========================
   PRIMARY BUTTON
   ========================= */

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);

    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);

    --bs-btn-active-bg: #4f46e5;
    --bs-btn-active-border-color: #4f46e5;

    position: relative;
    overflow: hidden;

    box-shadow: 0 8px 25px var(--primary-glow);

    transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.btn-primary::after {
    content: "";

    position: absolute;
    top: 0;
    left: -60%;

    width: 40%;
    height: 100%;

    background: linear-gradient(115deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s var(--ease-in-out);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover::after {
    left: 130%;
}


/* =========================
   TOOL CARDS
   ========================= */

.tool-card {
    position: relative;

    background: linear-gradient(145deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.85));
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    overflow: hidden;

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);

    transition:
        transform 0.3s var(--ease-out),
        border-color 0.3s var(--ease-out),
        box-shadow 0.3s var(--ease-out);
}

.tool-card::before {
    content: "";

    position: absolute;
    top: 0;
    left: 0;
    right: 0;

    height: 3px;

    background: linear-gradient(90deg, var(--primary), var(--accent));

    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s var(--ease-out);
}

.tool-card:hover {
    transform: translateY(-6px);

    border-color: var(--border-hover);

    box-shadow:
        0 18px 45px rgba(0, 0, 0, 0.25),
        0 0 25px rgba(99, 102, 241, 0.08);
}

.tool-card:hover::before {
    transform: scaleX(1);
}

/* Scroll-reveal for card grids and section intros */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .tool-card,
    .tool-card::before,
    .logo-hammer,
    .btn-primary,
    .btn-primary::after {
        transition: none;
        animation: none;
    }
}


/* =========================
   CARD CONTENT
   ========================= */

.tool-card h2,
.tool-card h3,
.tool-card h4 {
    position: relative;
    color: var(--text);
    letter-spacing: -0.3px;
}

.tool-card p {
    position: relative;
    color: var(--text-muted);
}

.tool-card hr {
    border: 0;
    border-top: 1px solid var(--border);
    opacity: 1;
    margin: 1.1rem 0;
}


/* =========================
   SECTIONS
   ========================= */

section {
    position: relative;
}

section h2 {
    letter-spacing: -0.5px;
}


/* =========================
   SELECTION
   ========================= */

::selection {
    background: rgba(99, 102, 241, 0.35);
    color: white;
}


/* =========================
   SCROLLBAR
   ========================= */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/*  ========================
    FOOTER
    ======================== */

.site-footer {
    margin-top: 100px;
    padding: 50px 0 25px;

    background: rgba(15, 23, 42, 0.6);
    border-top: 1px solid var(--border);
}

.site-footer h5,
.site-footer h6 {
    color: var(--text);
}

.site-footer p {
    color: var(--text-muted);
}

.site-footer a {
    display: block;
    position: relative;

    width: fit-content;
    margin-bottom: 8px;

    color: var(--text-muted);
    text-decoration: none;

    transition: color 0.2s var(--ease-out);
}

.site-footer a::after {
    content: "";

    position: absolute;
    left: 0;
    bottom: -1px;

    width: 100%;
    height: 1px;

    background: var(--primary-hover);

    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s var(--ease-out);
}

.site-footer a:hover {
    color: var(--primary-hover);
}

.site-footer a:hover::after {
    transform: scaleX(1);
}

.site-footer hr {
    margin: 35px 0 20px;
    border: 0;
    border-top: 1px solid var(--border);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;

    color: var(--text-muted);
    font-size: 0.875rem;
}

/*  ========================
    MODALS
    ======================== */

.modal.fade .modal-dialog {
    transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
    transform: scale(0.96) translateY(10px);
    opacity: 0;
}

.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-content {
    background-color: var(--bg-secondary);
    color: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.45);
}

.btn-close {
    width: 2em;
    height: 2em;
    --bs-btn-close-opacity: 1;

    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.146 2.854a.5.5 0 0 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z' fill='%23fff'/%3E%3C/svg%3E") center / 1.5em auto no-repeat;

    transition: transform 0.2s var(--ease-out);
}

.btn-close:hover {
    transform: rotate(90deg);
}

.modal-header {
    border-bottom: 1px solid var(--border);
}

.modal-footer {
    border-top: 1px solid var(--border);
}

input[type="number"].form-control {
    background-color: var(--bg);
    border: none;
    color: #fff;

    transition: box-shadow 0.2s var(--ease-out);
}

input[type="number"].form-control::placeholder {
    color: #707070;
}

input[type="search"].form-control {
    background-color: #1e293b;
    border: none;
    color: #fff;

    transition: box-shadow 0.2s var(--ease-out);
}

input[type="search"].form-control::placeholder {
    color: #707070;
}

.form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

.math-input {
    width: 100%;
    min-height: 52px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0b1220;
    color: #fff;
    font-size: 1.2rem;

    transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.math-input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.2);
}

/*  ========================
    ANIMATIONS
    ======================== */

/* NAVBAR */
#navbar {
    opacity: 0;
    transform: translateY(-3px);
}

#navbar.components-enter {
    animation: navbarEnter 0.5s var(--ease-out) forwards;
}

@keyframes navbarEnter {
    from { opacity: 0; transform: translateY(-3px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* CONTENT */
#page-content {
    opacity: 0;
    transform: translateX(3%);
}

#page-content.page-enter {
    animation: contentEnter 0.45s var(--ease-out) 0.05s forwards;
}

#page-content.page-exit {
    animation: contentExit 0.35s var(--ease-in-out) both;
}

@keyframes contentEnter {
    from { opacity: 0; transform: translateX(3%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes contentExit {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-3%); }
}


/* FOOTER */
#footer {
    opacity: 0;
    transform: translateY(30px);
}

#footer.components-enter {
    animation: footerEnter 0.5s var(--ease-out) 0.1s forwards;
}

@keyframes footerEnter {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}


@media (prefers-reduced-motion: reduce) {
    #navbar,
    #page-content,
    #footer {
        opacity: 1;
        transform: none;
    }

    #navbar.components-enter,
    #page-content.page-enter,
    #page-content.page-exit,
    #footer.components-enter {
        animation: none;
    }
}