/* ═══════════════════════════════════════════════════════
   True Math — Design System
   Clean / Minimal / Cabinet-style
   ═══════════════════════════════════════════════════════ */

:root {
    --tm-primary:         #2563eb;
    --tm-primary-hover:   #1d4ed8;
    --tm-primary-light:   #dbeafe;
    --tm-primary-subtle:  #eff6ff;

    --tm-fg:              #0f172a;
    --tm-fg-secondary:    #475569;
    --tm-fg-muted:        #94a3b8;
    --tm-fg-inverse:      #ffffff;

    --tm-bg:              #ffffff;
    --tm-bg-subtle:       #f8fafc;
    --tm-bg-muted:        #f1f5f9;

    --tm-border:          #e2e8f0;
    --tm-border-strong:   #cbd5e1;

    --tm-success:         #16a34a;
    --tm-success-light:   #dcfce7;
    --tm-danger:          #dc2626;
    --tm-danger-light:    #fee2e2;
    --tm-warning:         #d97706;
    --tm-warning-light:   #fef3c7;
}

/* ─── Base reset ─────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overscroll-behavior: none; }

/* Override Tailwind preflight — no border-radius anywhere */
*, *::before, *::after { border-radius: 0 !important; }
.hero-geo-4 { border-radius: 50% !important; }
.hero-dot, .hero-dot-1, .hero-dot-2, .hero-dot-3, .hero-dot-4, .hero-dot-5, .hero-dot-6 { border-radius: 50% !important; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--tm-fg);
    background: var(--tm-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
}

a { color: var(--tm-primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--tm-primary-hover); text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ─── Typography ─────────────────────────────────────── */

h1, h2, h3, h4 { font-weight: 700; color: var(--tm-fg); line-height: 1.2; }
h1 { font-size: 2.5rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

/* Section headings — bigger for SEO + visual weight */
.section-heading {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.75rem; }
    .section-heading { font-size: 1.75rem; }
}

/* ─── Container ──────────────────────────────────────── */

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 680px !important; }
.container-xs { max-width: 480px; }

/* ─── Buttons (cabinet style — sharp, 1px border) ───── */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    border-radius: 0;
    font-family: inherit; font-size: 0.875rem; font-weight: 500;
    text-decoration: none; cursor: pointer;
    border: 1px solid var(--tm-primary);
    background: transparent; color: var(--tm-primary);
    transition: all 0.15s;
}
.btn:hover { background: var(--tm-primary); color: #fff; text-decoration: none; }

.btn-primary { background: var(--tm-primary); color: #fff; }
.btn-primary:hover { background: var(--tm-primary-hover); border-color: var(--tm-primary-hover); color: #fff; }

.btn-secondary { border-color: var(--tm-fg); color: var(--tm-fg); }
.btn-secondary:hover { background: var(--tm-fg); color: #fff; }

.btn-outline { background: transparent; color: var(--tm-primary); }
.btn-outline:hover { background: var(--tm-primary); color: #fff; }

.btn-sm { padding: 0.375rem 1rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 2rem; font-size: 0.9375rem; }

/* ─── Cards (cabinet style — sharp, 1px border) ────── */

.card {
    background: var(--tm-bg);
    border: 1px solid var(--tm-border);
    border-radius: 0;
    overflow: hidden;
    transition: border-color 0.2s;
}
.card:hover { border-color: var(--tm-border-strong); }
.card-body { padding: 1.5rem; }

/* ─── Section spacing ────────────────────────────────── */

.section { padding: 5rem 0; }
.section-alt { background: var(--tm-bg-subtle); border-top: 1px solid var(--tm-border); border-bottom: 1px solid var(--tm-border); }

/* ─── Badges ─────────────────────────────────────────── */

.badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0;
    font-size: 0.75rem; font-weight: 600;
    border: 1px solid;
}
.badge-success { color: var(--tm-success); border-color: var(--tm-success); }
.badge-danger { color: var(--tm-danger); border-color: var(--tm-danger); }
.badge-warning { color: var(--tm-warning); border-color: var(--tm-warning); }
.badge-primary { color: var(--tm-primary); border-color: var(--tm-primary); }

/* ─── Forms ──────────────────────────────────────────── */

.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block;
    font-size: 0.8125rem; font-weight: 500;
    color: var(--tm-fg-secondary);
    margin-bottom: 0.375rem;
}
.form-input {
    width: 100%; padding: 0.625rem 0.75rem;
    border: 1px solid var(--tm-border);
    border-radius: 0;
    font-family: inherit; font-size: 0.9375rem;
    color: var(--tm-fg); background: var(--tm-bg);
    transition: border-color 0.15s;
}
.form-input:focus {
    outline: none;
    border-color: var(--tm-primary);
}
.form-input::placeholder { color: var(--tm-fg-muted); }
.form-error { font-size: 0.8125rem; color: var(--tm-danger); margin-top: 0.25rem; }

/* ─── Auth form (fixed width, centered) ──────────────── */

.auth-section {
    padding: 3rem 1.5rem;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--tm-bg);
    border: 1px solid var(--tm-border);
    padding: 2.5rem;
}

@media (max-width: 480px) {
    .auth-card { padding: 1.5rem; }
}

/* ─── Navigation ─────────────────────────────────────── */

.nav {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--tm-border);
    height: 3.5rem;
}
.nav-inner {
    display: flex; align-items: center; justify-content: space-between;
    height: 3.5rem;
}
.nav-logo {
    font-size: 1.25rem; font-weight: 700; color: var(--tm-fg);
    text-decoration: none;
}
.nav-logo span { color: var(--tm-primary); }

.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a { color: var(--tm-fg-secondary); font-size: 0.875rem; font-weight: 500; text-decoration: none; }
.nav-links a:hover { color: var(--tm-primary); }

.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

.nav-burger { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; }
.nav-burger svg { width: 22px; height: 22px; color: var(--tm-fg); }

@media (max-width: 768px) {
    .nav-links, .nav-actions { display: none; }
    .nav-burger { display: block; }
    .nav-mobile {
        position: fixed; inset: 0; z-index: 200;
        background: var(--tm-bg);
        padding: 5rem 2rem 2rem;
        display: flex; flex-direction: column; gap: 1.5rem;
    }
    .nav-mobile a { font-size: 1.125rem; font-weight: 600; color: var(--tm-fg); }
    .nav-mobile-close {
        position: absolute; top: 1rem; right: 1.5rem;
        background: none; border: none; cursor: pointer; font-size: 1.5rem; color: var(--tm-fg);
    }
}

/* ─── Hero — spatial geometry background ─────────────── */

.hero {
    position: relative;
    padding: 7rem 0 6rem;
    overflow: hidden;
    border-bottom: 1px solid var(--tm-border);
}

.hero-bg {
    position: absolute; inset: 0;
    overflow: hidden;
}

/* Base grid */
.hero-bg::before {
    content: '';
    position: absolute; inset: -60px;
    background-size: 60px 60px;
    background-image:
        linear-gradient(to right, rgba(37,99,235,0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(37,99,235,0.08) 1px, transparent 1px);
    animation: gridDrift 25s linear infinite;
}

/* Radial fade — wider visible area */
.hero-bg::after {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 80% 80% at center, transparent 30%, var(--tm-bg) 75%);
}

/* Floating geometric shapes */
.hero-geo {
    position: absolute;
    border: 1.5px solid rgba(37,99,235,0.18);
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

.hero-geo-1 {
    width: 220px; height: 220px;
    top: -40px; right: 6%;
    transform: rotate(15deg);
    animation: geoFloat1 12s ease-in-out infinite alternate;
}
.hero-geo-2 {
    width: 140px; height: 140px;
    bottom: 8%; left: 4%;
    transform: rotate(-20deg);
    border-style: dashed;
    border-color: rgba(37,99,235,0.14);
    animation: geoFloat2 15s ease-in-out infinite alternate;
}
.hero-geo-3 {
    width: 90px; height: 90px;
    top: 18%; left: 12%;
    transform: rotate(45deg);
    border-color: rgba(37,99,235,0.15);
    border-width: 2px;
    animation: geoFloat3 10s ease-in-out infinite alternate;
}
.hero-geo-4 {
    width: 180px; height: 180px;
    bottom: -30px; right: 15%;
    border-radius: 50%;
    border-color: rgba(37,99,235,0.14);
    animation: geoFloat4 18s ease-in-out infinite alternate;
}
.hero-geo-5 {
    width: 70px; height: 70px;
    top: 30%; right: 20%;
    border-width: 2px;
    border-color: rgba(37,99,235,0.12);
    animation: geoFloat5 14s ease-in-out infinite alternate;
}
/* Triangle — wireframe SVG */
.hero-geo-tri {
    position: absolute;
    width: 110px; height: 95px;
    top: 12%; right: 10%;
    animation: geoFloat3 16s ease-in-out infinite alternate;
}
/* Diagonal lines */
.hero-geo-line {
    position: absolute;
    width: 200px; height: 1.5px;
    background: rgba(37,99,235,0.12);
    bottom: 28%; left: 6%;
    transform: rotate(-30deg);
    animation: geoFloat2 20s ease-in-out infinite alternate;
}
.hero-geo-line-2 {
    position: absolute;
    width: 140px; height: 1.5px;
    background: rgba(37,99,235,0.1);
    top: 22%; right: 3%;
    transform: rotate(40deg);
    animation: geoFloat1 22s ease-in-out infinite alternate;
}
/* Small dots */
.hero-dot {
    position: absolute;
    width: 5px; height: 5px;
    background: rgba(37,99,235,0.25);
    border-radius: 50%;
}
.hero-dot-1 { top: 28%; left: 22%; animation: dotPulse 3s ease-in-out infinite; }
.hero-dot-2 { top: 55%; right: 12%; animation: dotPulse 4s ease-in-out infinite 1s; }
.hero-dot-3 { bottom: 22%; left: 32%; animation: dotPulse 3.5s ease-in-out infinite 0.5s; }
.hero-dot-4 { top: 18%; right: 28%; animation: dotPulse 5s ease-in-out infinite 2s; }
.hero-dot-5 { bottom: 35%; right: 8%; width: 4px; height: 4px; animation: dotPulse 4.5s ease-in-out infinite 1.5s; }
.hero-dot-6 { top: 45%; left: 8%; width: 4px; height: 4px; animation: dotPulse 3.8s ease-in-out infinite 0.8s; }

@keyframes gridDrift {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}
@keyframes geoFloat1 {
    0%   { transform: rotate(15deg) translate(0, 0); }
    100% { transform: rotate(20deg) translate(-15px, 20px); }
}
@keyframes geoFloat2 {
    0%   { transform: rotate(-20deg) translate(0, 0); }
    100% { transform: rotate(-15deg) translate(20px, -15px); }
}
@keyframes geoFloat3 {
    0%   { transform: rotate(45deg) translate(0, 0); }
    100% { transform: rotate(50deg) translate(-10px, 15px); }
}
@keyframes geoFloat4 {
    0%   { transform: translate(0, 0); opacity: 0.8; }
    100% { transform: translate(10px, -20px); opacity: 1; }
}
@keyframes geoFloat5 {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(90deg); }
}
@keyframes dotPulse {
    0%, 100% { opacity: 0.25; transform: scale(1); }
    50%      { opacity: 0.6; transform: scale(1.8); }
}

.hero-inner {
    position: relative; z-index: 1;
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3.25rem;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}
.hero h1 span { color: var(--tm-primary); }

.hero-sub {
    font-size: 1.0625rem;
    color: var(--tm-fg-secondary);
    line-height: 1.7;
    margin-bottom: 2.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex; gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .hero { padding: 4rem 0 3.5rem; }
    .hero h1 { font-size: 2rem; }
    .hero-sub { font-size: 0.9375rem; }
    .hero-geo, .hero-geo-tri, .hero-geo-line, .hero-geo-line-2 { display: none; }
    .hero-dot { display: none; }
}

/* ─── Decorative canvas (matrix lines) ─────────────── */

.section-deco {
    position: relative;
    overflow: hidden;
}

.deco-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .deco-canvas { display: none; }
}

/* ─── About grid (seamless 3-col → 1-col on mobile) ─── */

.about-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
}
.about-grid > div { border: 1px solid var(--tm-border); flex: 0 0 33.333%; margin-top: -1px; margin-left: -1px; }

@media (max-width: 768px) {
    .about-grid > div { flex: 0 0 100%; }
}


/* ─── Courses grid (fixed card width, centered) ──────── */

.courses-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    text-align: left;
    max-width: 1100px;
    margin: 0 auto;
}

/* Course card link & footer */
.course-card-link { display: block; text-decoration: none; color: inherit; }
.course-card-link:hover { text-decoration: none; }
.course-card-link:hover .course-card-title { text-decoration: underline; }
.course-card-footer {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 1px solid var(--tm-border); margin: 0 1.5rem; padding: 0.75rem 0 1.5rem;
}

/* Fixed card width — same as 3-col grid card */
.courses-grid > .card {
    width: 340px;
    max-width: 100%;
}

/* 1 course — horizontal card */
.courses-grid[data-count="1"] > .card {
    width: 100%; max-width: 700px;
    display: grid; grid-template-columns: 280px 1fr; grid-template-rows: 1fr auto;
}
.courses-grid[data-count="1"] > .card > a {
    display: contents !important;
}
.courses-grid[data-count="1"] > .card > a > div:first-child {
    grid-row: 1 / -1; grid-column: 1; height: auto !important; min-height: 220px;
}
.courses-grid[data-count="1"] > .card > a > .card-body {
    grid-column: 2; grid-row: 1;
    display: flex; flex-direction: column; justify-content: center; padding: 2rem 2rem 1rem;
}
.courses-grid[data-count="1"] > .card > .course-card-footer {
    grid-column: 2; grid-row: 2;
    margin: 0 !important; padding: 1.25rem 2rem !important; border-top: 1px solid var(--tm-border) !important;
}


@media (max-width: 600px) {
    .courses-grid[data-count="1"] > .card { grid-template-columns: 1fr; }
    .courses-grid[data-count="1"] > .card > a > div:first-child { min-height: 180px; }
}

/* 4 courses — limit container so only 2 fit per row → 2+2 */
.courses-grid[data-count="4"] {
    max-width: 700px;
}

@media (max-width: 540px) {
    .courses-grid > .card { width: 100%; }
}

/* ─── Course page responsive ─────────────────────────── */

@media (max-width: 768px) {
    .course-hero-grid { grid-template-columns: 1fr !important; }
}

/* ─── Footer ─────────────────────────────────────────── */

.footer {
    position: relative;
    background: var(--tm-fg);
    color: var(--tm-fg-inverse);
    padding: 3rem 0 2rem;
    overflow: hidden;
}
/* Footer grid background */
.footer-bg {
    position: absolute; inset: 0;
    background-size: 60px 60px;
    background-image:
        linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px);
    animation: gridDrift 30s linear infinite;
}
.footer-bg::after {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at center bottom, transparent 0%, var(--tm-fg) 80%);
}

.footer-inner { position: relative; z-index: 1; }

.footer a { color: rgba(255,255,255,0.6); }
.footer a:hover { color: #fff; }
.footer-grid {
    display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3rem;
}
.footer-title {
    font-size: 0.6875rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.08em; color: rgba(255,255,255,0.4); margin-bottom: 0.75rem;
}
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.875rem; }
.footer-bottom {
    margin-top: 2rem; padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.75rem; color: rgba(255,255,255,0.35);
    display: flex; justify-content: space-between; align-items: center;
}

@media (max-width: 768px) {
    .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
    .footer-bottom { flex-direction: column; gap: 0.5rem; text-align: center; }
}
