/* ============== THEME TOKENS ============== */
:root[data-theme="dark"] {
    --bg: #0b0d10;
    --bg-2: #11141a;
    --surface: #161a21;
    --surface-2: #1c2129;
    --border: #252a34;
    --border-strong: #353c49;
    --text: #e6e9ef;
    --text-dim: #99a1ae;
    --text-faint: #6b7280;
    --accent: #d64545;
    --accent-2: #f5a524;
    --accent-3: #4ea4d8;
    --grid: rgba(255, 255, 255, 0.022);
    --grid-strong: rgba(255, 255, 255, 0.045);
    --header-bg: rgba(11, 13, 16, 0.78);
    --shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] {
    --bg: #f7f8fa;
    --bg-2: #ffffff;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --border: #e4e7ec;
    --border-strong: #cdd2db;
    --text: #16181d;
    --text-dim: #5b6371;
    --text-faint: #8a93a3;
    --accent: #c23838;
    --accent-2: #d97706;
    --accent-3: #2563eb;
    --grid: rgba(0, 0, 0, 0.025);
    --grid-strong: rgba(0, 0, 0, 0.045);
    --header-bg: rgba(247, 248, 250, 0.82);
    --shadow: 0 8px 24px -12px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Topographic grid backdrop */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px),
        linear-gradient(var(--grid-strong) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px);
    background-size: 32px 32px, 32px 32px, 160px 160px, 160px 160px;
    pointer-events: none;
    z-index: 0;
}

/* ============== HEADER ============== */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.top-bar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 14px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}

.brand-logo {
    height: 38px;
    width: auto;
    display: block;
    transition: opacity 0.2s ease;
}
.brand:hover .brand-logo { opacity: 0.85; }

/* In dark theme, if the logo is dark on transparent it would disappear — invert it.
   This safely keeps brand legible against both backgrounds. */
:root[data-theme="dark"] .brand-logo {
    filter: brightness(0) invert(1);
}

.brand-divider {
    width: 1px;
    height: 22px;
    background: var(--border-strong);
    display: inline-block;
}

.brand-sub {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    white-space: nowrap;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.theme-toggle:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-2);
}
.theme-toggle svg { width: 16px; height: 16px; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.support-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}
.support-btn:hover {
    background: #b03333;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(214, 69, 69, 0.3);
}
.support-btn svg { width: 14px; height: 14px; }
.support-btn-text { display: inline; }

/* ============== COMPACT HERO ============== */
.hero {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 32px 24px;
}

.hero-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 32px;
    flex-wrap: wrap;
}

.hero h1 {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(28px, 4vw, 40px);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 8px;
}
.hero p {
    font-size: 15px;
    color: var(--text-dim);
    max-width: 620px;
    line-height: 1.55;
}

.hero-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    white-space: nowrap;
}
.hero-status .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ============== APP GRID ============== */
.grid-section {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 32px 80px;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-dim);
}
.section-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 14px;
}

.app-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
                border-color 0.25s ease,
                background-color 0.25s ease,
                box-shadow 0.3s ease;
}

.app-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-color, var(--accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 3;
}

.app-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    background: var(--surface-2);
    box-shadow: var(--shadow);
}
.app-card:hover::before { transform: scaleX(1); }

/* HERO ICON BLOCK — full-width visual at top of card */
.app-card-header {
    position: relative;
    height: 190px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    transition: background-color 0.35s ease, border-color 0.35s ease;
}
:root[data-theme="light"] .app-card-header { background: #f3f5f8; }

/* Subtle grid pattern inside the icon block — hints at the geospatial domain */
.app-card-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--grid-strong) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.6;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

/* Soft accent wash that intensifies on hover */
.app-card-header::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 60%, var(--accent-color, var(--accent)) 0%, transparent 65%);
    opacity: 0.05;
    transition: opacity 0.4s ease;
    pointer-events: none;
}
.app-card:hover .app-card-header::after { opacity: 0.18; }
.app-card:hover .app-card-header { border-bottom-color: var(--border-strong); }

.app-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color, var(--accent));
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 2;
}
.app-card:hover .app-icon { transform: scale(1.06); }

.app-icon svg {
    width: 220px;
    height: 130px;
    overflow: visible;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.15));
}
:root[data-theme="light"] .app-icon svg {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.06));
}

/* Lucide placeholder icon for coming-soon cards */
.app-icon .placeholder-icon {
    width: 80px;
    height: 80px;
    color: var(--accent-color, var(--accent));
    stroke-width: 1.2;
    opacity: 0.7;
}
.app-icon .placeholder-icon svg { width: 100%; height: 100%; }

/* Tag pill floats in the top-right corner of the icon block */
.app-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    backdrop-filter: blur(4px);
}
.app-tag.soon {
    color: var(--accent-2);
    border-color: rgba(245, 165, 36, 0.3);
    background: rgba(245, 165, 36, 0.12);
}

.app-card-body { position: relative; z-index: 1; padding: 22px; }

.app-title {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin-bottom: 8px;
}

.app-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.55;
    margin-bottom: 16px;
}

.app-arrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    transition: all 0.3s ease;
}
.app-card:hover .app-arrow {
    color: var(--accent-color, var(--accent));
    gap: 10px;
}
.app-arrow svg { width: 13px; height: 13px; transition: transform 0.3s ease; }
.app-card:hover .app-arrow svg { transform: translateX(2px); }

.app-card.coming-soon { opacity: 0.65; cursor: not-allowed; }
.app-card.coming-soon:hover {
    transform: none;
    background: var(--surface);
    box-shadow: none;
}
.app-card.coming-soon::before { display: none; }
.app-card.coming-soon .app-arrow { color: var(--accent-2); }

/* card accent color variants */
.c-red    { --accent-color: #d64545; }
.c-amber  { --accent-color: #f5a524; }
.c-blue   { --accent-color: #4ea4d8; }
.c-green  { --accent-color: #5cb85c; }
.c-violet { --accent-color: #a78bfa; }
.c-teal   { --accent-color: #2dd4bf; }
.c-rose   { --accent-color: #f472b6; }
.c-slate  { --accent-color: #94a3b8; }

/* ============== FOOTER ============== */
footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    background: var(--bg-2);
}
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.footer-inner a {
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.2s ease;
}
.footer-inner a:hover { color: var(--accent); }

/* ============== RESPONSIVE ============== */
@media (max-width: 768px) {
    .top-bar-inner { padding: 12px 18px; }
    .hero { padding: 28px 18px 16px; }
    .hero-row { align-items: flex-start; }
    .hero h1 { font-size: 26px; }
    .grid-section { padding: 12px 18px 56px; }
    .app-grid { grid-template-columns: 1fr; }
    .footer-inner { padding: 20px 18px; flex-direction: column; text-align: center; }
    .support-btn-text { display: none; }
    .support-btn { padding: 9px 11px; }
    .brand-sub, .brand-divider { display: none; }
    .brand-logo { height: 32px; }
}

/* fade-in stagger */
.app-card {
    opacity: 0;
    animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
