/* ═══════════════════════════════════════
   RESET
   ═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; }

/* ═══════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════ */
:root {
    /* backgrounds */
    --bg:      #0d1117;
    --bg-alt:  #161b22;
    --surface: #21262d;

    /* borders */
    --border:  #30363d;

    /* accent — polar ice blue */
    --accent:  #2188d0;
    --accent2: #1a72b5;
    --accentDim: rgba(33, 136, 208, 0.15);

    /* text */
    --text:    #e6edf3;
    --text2:   #7d8590;

    /* navigation */
    --nav-bg:  #010409;
    --nav-b:   #21262d;

    /* layout */
    --max:  1200px;
    --pad:  clamp(16px, 4vw, 40px);
    --r:    8px;
    --navH: 60px;
}

:root[data-theme="light"] {
    color-scheme: light;

    --bg:      #ffffff;
    --bg-alt:  #f6f8fa;
    --surface: #f6f8fa;
    --border:  #d0d7de;

    --accent:  #0969da;
    --accent2: #0757ba;
    --accentDim: rgba(9, 105, 218, 0.10);

    --text:    #1f2328;
    --text2:   #59636e;

    --nav-bg:  #ffffff;
    --nav-b:   #d0d7de;
}

/* ═══════════════════════════════════════
   BASE
   ═══════════════════════════════════════ */
html {
    color-scheme: dark;
    height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    font-family: "Red Hat Text", system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

h1, h2, h3, h4, h5, h6 {
    font-family: "Red Hat Display", system-ui, sans-serif;
    line-height: 1.15;
    color: var(--text);
}

p { color: var(--text2); }

a { text-decoration: none; color: inherit; }

/* ═══════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════ */
.container {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 var(--pad);
}

/* ═══════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 999;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-b);
}

.topbarInner {
    max-width: var(--max);
    height: var(--navH);
    margin: 0 auto;
    padding: 0 var(--pad);
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Brand */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    font-family: "Red Hat Display", sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}

.brandLogo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.brandTitle { letter-spacing: -0.01em; }

@media (max-width: 380px) { .brandTitle { display: none; } }

/* Desktop nav links */
.topLinks {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.topLinksInner {
    display: flex;
    align-items: center;
    gap: 2px;
}

.topLink {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text2);
    padding: 6px 12px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.topLink:hover { color: var(--text); background: rgba(127,127,127,.08); }

.topLink[aria-current="page"] {
    color: var(--accent);
    background: var(--accentDim);
}

/* Right actions */
.topRight {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Theme toggle */
.themeToggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text2);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.themeToggle:hover { background: rgba(127,127,127,.08); color: var(--text); }

/* Sun / moon swap */
.themeToggle .iconMoon { display: none; }
.themeToggle .iconSun  { display: block; }
[data-theme="light"] .themeToggle .iconSun  { display: none; }
[data-theme="light"] .themeToggle .iconMoon { display: block; }

/* Burger */
.burger {
    display: none;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text2);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.burger:hover { background: rgba(127,127,127,.08); color: var(--text); }

@media (max-width: 840px) {
    .burger { display: inline-flex; }
    .topLinksInner { display: none; }
}
@media (min-width: 841px) {
    .burger { display: none !important; }
}

[data-mobile-open="true"] .burger { display: none !important; }

/* ═══════════════════════════════════════
   MOBILE DRAWER
   ═══════════════════════════════════════ */
.mobileMenu {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
}

[data-mobile-open="true"] .mobileMenu { display: block; }

/* backdrop */
.mobileMenu::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
}

:root[data-theme="light"] .mobileMenu::before { background: rgba(0,0,0,.3); }

.mobileMenuInner {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(320px, 90vw);
    overflow-y: auto;
    background: var(--bg-alt);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.mobileHeader {
    height: var(--navH);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mobileHeaderTitle {
    font-family: "Red Hat Display", sans-serif;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text);
}

.mobileClose {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    border-radius: 6px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.15s, color 0.15s;
}

.mobileClose:hover { background: var(--bg); color: var(--text); }

/* Quick grid */
.mobileQuick {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.mobileQuick a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text);
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}

.mobileQuick a:hover { background: var(--bg); border-color: var(--accent); }

.mobileQuick .ico {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--accentDim);
    display: grid;
    place-items: center;
    color: var(--accent);
    flex-shrink: 0;
}

/* Nav list */
.mobileList {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px 24px;
}

.mobileLink {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text2);
    transition: background 0.15s, color 0.15s;
}

.mobileLink:hover { background: var(--surface); color: var(--text); }
.mobileLink[aria-current="page"] { color: var(--accent); }

.mobileLink .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}

.mobileLink[aria-current="page"] .dot { background: var(--accent); }

[data-mobile-open="true"] body { overflow: hidden; }

@media (min-width: 841px) { .mobileMenu { display: none !important; } }

/* ═══════════════════════════════════════
   HERO
   ═══════════════════════════════════════ */
.hero {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: clamp(72px, 11vw, 136px) 0 clamp(56px, 8vw, 104px);
}

.heroInner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 var(--pad);
}

.heroLabel {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 20px;
}

.heroTitle {
    font-size: clamp(2.25rem, 5.5vw, 4.25rem);
    font-weight: 900;
    letter-spacing: -0.025em;
    line-height: 1.06;
    color: var(--text);
    max-width: 15ch;
    margin-bottom: 20px;
}

.heroSubtitle {
    font-size: clamp(1rem, 2vw, 1.125rem);
    color: var(--text2);
    max-width: 52ch;
    line-height: 1.7;
    margin-bottom: 36px;
}

.heroActions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--r);
    font-family: "Red Hat Text", sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }

.btnPrimary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btnPrimary:hover {
    background: var(--accent2);
    border-color: var(--accent2);
    color: #fff;
}

/* ═══════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════ */
.section {
    padding: clamp(48px, 7vw, 88px) 0;
    background: var(--bg);
}

.section + .section { border-top: 1px solid var(--border); }

.sectionAlt { background: var(--bg-alt); }

.sectionHeader { margin-bottom: 40px; }

.sectionTitle {
    font-size: clamp(1.375rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--text);
    margin-bottom: 8px;
}

.sectionLead {
    font-size: 1rem;
    color: var(--text2);
    max-width: 58ch;
}

/* ═══════════════════════════════════════
   GRIDS
   ═══════════════════════════════════════ */
.grid3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}

.grid2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 880px) { .grid3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid3, .grid2 { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════
   CARDS
   ═══════════════════════════════════════ */
.card {
    background: var(--bg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: background 0.15s;
}

/* standalone cards (not in .grid3 background-gap grid) */
.cardSet {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 880px) { .cardSet { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .cardSet { grid-template-columns: 1fr; } }

.cardBordered {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.2s;
}

.cardBordered:hover { border-color: var(--accent); }

.cardIcon {
    width: 36px;
    height: 36px;
    color: var(--accent);
    margin-bottom: 4px;
}

.cardIcon svg {
    width: 100%;
    height: 100%;
}

.cardTitle {
    font-family: "Red Hat Display", sans-serif;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text);
}

.cardText {
    font-size: 0.875rem;
    color: var(--text2);
    line-height: 1.65;
    flex: 1;
}

.cardActions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.cardLink {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent);
    transition: color 0.15s;
}

.cardLink:hover { color: var(--accent2); }

/* ═══════════════════════════════════════
   FEATURE COLUMNS (Why PolarSystems etc.)
   ═══════════════════════════════════════ */
.featureCols {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}

.featureCols > div {
    padding: 28px 28px 32px;
    border-right: 1px solid var(--border);
}

.featureCols > div:last-child { border-right: none; }

.featureCols h3 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.featureCols p {
    font-size: 0.875rem;
    color: var(--text2);
    line-height: 1.65;
}

@media (max-width: 900px) {
    .featureCols { grid-template-columns: repeat(2, 1fr); }
    .featureCols > div:nth-child(2) { border-right: none; }
    .featureCols > div:nth-child(1),
    .featureCols > div:nth-child(2) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 500px) {
    .featureCols { grid-template-columns: 1fr; }
    .featureCols > div { border-right: none; border-bottom: 1px solid var(--border); }
    .featureCols > div:last-child { border-bottom: none; }
}

/* ═══════════════════════════════════════
   RESOURCE LIST (support channels, docs etc.)
   ═══════════════════════════════════════ */
.resourceList {
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}

.resourceItem {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 24px 28px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    text-decoration: none;
    transition: background 0.15s;
}

.resourceItem:first-child { border-top: none; }
.resourceItem:hover { background: var(--bg-alt); }

.resourceIcon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    color: var(--accent);
    background: var(--accentDim);
    border-radius: 8px;
    display: grid;
    place-items: center;
}

.resourceIcon svg { width: 20px; height: 20px; }

.resourceBody { flex: 1; }

.resourceBody strong {
    display: block;
    font-family: "Red Hat Display", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.resourceBody p {
    font-size: 0.875rem;
    color: var(--text2);
    line-height: 1.55;
    margin: 0;
}

.resourceArrow {
    align-self: center;
    color: var(--text2);
    flex-shrink: 0;
    transition: color 0.15s, transform 0.15s;
}

.resourceItem:hover .resourceArrow {
    color: var(--accent);
    transform: translateX(3px);
}

/* grid variant */
.resourceGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 840px) { .resourceGrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .resourceGrid { grid-template-columns: 1fr; } }

.resourceGrid .resourceItem {
    border-radius: var(--r);
    border: 1px solid var(--border);
    border-top: 1px solid var(--border);
    flex-direction: column;
    gap: 16px;
}

.resourceGrid .resourceItem:hover { border-color: var(--accent); }
.resourceGrid .resourceArrow { align-self: flex-start; margin-top: 4px; }

/* ═══════════════════════════════════════
   FORMS
   ═══════════════════════════════════════ */
.formGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 560px) { .formGrid { grid-template-columns: 1fr; } }

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}

input, textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--r);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: "Red Hat Text", sans-serif;
    font-size: 0.9375rem;
    outline: none;
    transition: border-color 0.15s;
}

input:focus, textarea:focus { border-color: var(--accent); }

textarea { min-height: 140px; resize: vertical; }

.formActions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.notice {
    font-size: 0.8125rem;
    color: var(--text2);
    margin-top: 8px;
}

.notice.error { color: #f85149; }

/* ═══════════════════════════════════════
   DOWNLOAD GRID (JS-generated)
   ═══════════════════════════════════════ */
.downloadGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 880px) { .downloadGrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .downloadGrid { grid-template-columns: 1fr; } }

/* JS-generated card versions */
.downloadGrid .card {
    border: 1px solid var(--border);
    border-radius: var(--r);
    transition: border-color 0.2s;
}

.downloadGrid .card:hover { border-color: var(--accent); }

.version {
    font-size: 0.875em;
    font-weight: 500;
    opacity: 0.6;
}

.smallNote {
    font-size: 0.75rem;
    color: var(--text2);
}

.btnRow {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 8px;
}

/* ═══════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════ */
.siteFooter {
    margin-top: auto;
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
}

.footerInner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 48px var(--pad) 36px;
    display: grid;
    grid-template-columns: 1.5fr repeat(3, 1fr);
    gap: 40px;
}

.footerBrand { max-width: 260px; }

.footerLogo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: "Red Hat Display", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.footerLogo img { border-radius: 6px; }

.footerText {
    font-size: 0.8125rem;
    color: var(--text2);
    line-height: 1.6;
    margin-bottom: 16px;
}

.footerBrand a {
    font-size: 0.8125rem;
    color: var(--text2);
    transition: color 0.15s;
}

.footerBrand a:hover { color: var(--text); }

.footerCol {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footerTitle {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text2);
    margin-bottom: 4px;
}

.footerCol a {
    font-size: 0.875rem;
    color: var(--text2);
    transition: color 0.15s;
}

.footerCol a:hover { color: var(--text); }

.footerBottom {
    border-top: 1px solid var(--border);
    padding: 16px var(--pad);
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text2);
}

.footerSep { opacity: 0.4; }

.footerBottom a {
    color: var(--text2);
    transition: color 0.15s;
}

.footerBottom a:hover { color: var(--text); }

@media (max-width: 860px) {
    .footerInner { grid-template-columns: 1fr 1fr; }
    .footerBrand { grid-column: span 2; max-width: 100%; }
}

@media (max-width: 500px) {
    .footerInner { grid-template-columns: 1fr; gap: 28px; }
    .footerBrand { grid-column: span 1; }
    .footerBottom { flex-direction: column; gap: 4px; }
}

/* ═══════════════════════════════════════
   LEGACY ALIASES (legal / privacy / terms / report pages)
   ═══════════════════════════════════════ */
.sectionHeader { margin-bottom: 40px; }

.featureGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}
.featureItem {
    padding: 24px 28px 28px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.featureItem:nth-child(even) { border-right: none; }
.featureItem:nth-last-child(-n+2) { border-bottom: none; }
.featureItem h3 { font-family: "Red Hat Display", sans-serif; font-size: 0.9375rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.featureItem p  { font-size: 0.875rem; color: var(--text2); line-height: 1.65; margin: 0 0 12px; }
.featureItem a  { font-size: 0.8125rem; color: var(--accent); font-weight: 500; }
@media (max-width: 560px) {
    .featureGrid { grid-template-columns: 1fr; }
    .featureItem { border-right: none; }
    .featureItem:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }
    .featureItem:last-child { border-bottom: none; }
}

.channelGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.channelCard {
    text-align: center;
    padding: 32px 24px;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
}
.channelCard .cardIcon { margin: 0 auto; }
.cardAccent { border-left: 3px solid var(--accent); }
@media (max-width: 840px) { .channelGrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .channelGrid { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════ */
.mtAuto    { margin-top: auto; }
.textMuted { color: var(--text2); }
.textAccent { color: var(--accent); }
