/* =====================================================================
   AeroCalculator -- web edition
   Brand palette:  navy #2A2D8E   violet #6B3FA8   panel #F4F0FA
   Layout breakpoint: 760px (below = stacked single column)
   ===================================================================== */

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    color: #1F2033;
    background: #F8F7FC;
    line-height: 1.55;
    font-size: 16px;
}

a { color: #2A2D8E; text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }

#app { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; max-width: 1180px; margin: 0 auto; padding: 28px 24px 40px; width: 100%; }

/* --- Header ---------------------------------------------------- */
.ac-header {
    background: linear-gradient(135deg, #2A2D8E 0%, #3A2D9E 60%, #6B3FA8 100%);
    color: #FFFFFF;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: 0 2px 12px rgba(20, 22, 60, 0.12);
}
.ac-brand {
    display: flex; align-items: center; gap: 14px;
    color: #FFFFFF; text-decoration: none;
}
.ac-brand:hover { text-decoration: none; }
.ac-brand img { height: 44px; width: 44px; }
.ac-brand-name { font-size: 22px; font-weight: 700; letter-spacing: 0.2px; }
.ac-brand-sub  { font-size: 12px; color: #C5CAE9; margin-top: 2px; }

.ac-header-right    { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.ac-publisher       {
    display: flex; align-items: center;
    padding: 6px 12px; border-radius: 8px;
    background: #FFFFFF;     /* white tile around the colored logo */
}
.ac-publisher img   { height: 28px; display: block; }
.ac-lang            { display: flex; align-items: center; gap: 8px; color: #C5CAE9; font-size: 13px; }
.ac-lang select  {
    background: rgba(255,255,255,0.1); color: #FFFFFF; border: 1px solid rgba(255,255,255,0.25);
    padding: 5px 8px; border-radius: 6px; font-size: 14px;
}
.ac-lang select option { background: #2A2D8E; color: #FFF; }

/* --- Breadcrumb ------------------------------------------------ */
.ac-breadcrumb {
    display: flex; align-items: center; gap: 14px;
    font-size: 14px; color: #6A6A78; margin-bottom: 10px;
}
.ac-breadcrumb a { color: #2A2D8E; font-weight: 600; }
.ac-bc-group { color: #8E94B8; }

/* --- Home page ------------------------------------------------- */
.ac-hero {
    text-align: center; padding: 32px 16px 28px;
    background: #FFFFFF; border-radius: 14px; margin-bottom: 26px;
    box-shadow: 0 2px 10px rgba(42, 45, 142, 0.06);
}
.ac-hero h1 {
    font-size: 34px; color: #2A2D8E; margin: 0 0 6px;
    letter-spacing: -0.5px;
}
.ac-hero-sub  { font-size: 17px; color: #6B3FA8; margin: 0 0 14px; font-weight: 600; }
.ac-hero-blurb {
    max-width: 720px; margin: 0 auto 20px; color: #46485E; font-size: 15px;
}
.ac-hero-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* Group cards on home page */
.ac-groups { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) {
    .ac-groups { grid-template-columns: 1fr 1fr; }
}
.ac-group {
    background: #FFFFFF; border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(42, 45, 142, 0.06);
}
.ac-group-header {
    background: linear-gradient(135deg, #2A2D8E, #6B3FA8);
    color: #FFFFFF; padding: 14px 20px; font-weight: 700;
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    user-select: none; font-size: 14px; letter-spacing: 0.5px;
    text-transform: uppercase;
}
.ac-group-header:hover { filter: brightness(1.08); }
.ac-chevron { font-size: 10px; opacity: 0.9; width: 14px; }
.ac-group-body { padding: 4px 0; }
.ac-mod-item {
    display: block; padding: 13px 22px; color: #2A2D8E;
    border-top: 1px solid #EEEDF5; font-weight: 500;
}
.ac-mod-item:first-child { border-top: none; }
.ac-mod-item:hover { background: #F4F0FA; text-decoration: none; }

/* --- Module page ----------------------------------------------- */
.ac-module-title {
    color: #2A2D8E; font-size: 28px; margin: 6px 0 22px;
    border-bottom: 2px solid #6B3FA8; padding-bottom: 8px;
    display: inline-block;
}
.ac-panels {
    display: grid; gap: 18px;
    grid-template-columns: 1fr;
}
@media (min-width: 920px) {
    .ac-panels { grid-template-columns: 1fr 1fr; }
}
.ac-panel {
    background: #FFFFFF; border: 1px solid #DDD9EC; border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(42, 45, 142, 0.04);
}
.ac-panel-title {
    text-align: center; padding: 12px 20px;
    color: #6B3FA8; font-weight: 700; font-size: 16px;
    background: #FAF8FE; border-bottom: 1px solid #EEEDF5;
}
.ac-rows { padding: 8px 18px 14px; }
.ac-row {
    display: grid;
    grid-template-columns: 1fr 150px 96px;
    align-items: center; gap: 10px;
    padding: 9px 0;
    border-bottom: 1px dashed #F0EDF8;
}
.ac-row:last-child { border-bottom: none; }
.ac-row-label { color: #1F2033; font-size: 14px; padding-right: 8px; }
.ac-input {
    border: 1px solid #C5C5D5; border-radius: 6px; padding: 7px 10px;
    font-family: "SF Mono", Menlo, monospace; font-size: 14px;
    background: #FFFFFF; color: #1F2033;
    text-align: right;
    min-height: 34px;
}
.ac-input.ac-picker { font-family: inherit; text-align: left; padding: 6px 10px; }
.ac-input.ac-output {
    display: inline-block; background: #F6F4FB; color: #2A2D8E;
    font-weight: 600;
}
.ac-unit {
    border: 1px solid #C5C5D5; border-radius: 6px; padding: 6px 8px;
    background: #F4F0FA; color: #2A2D8E; font-weight: 500;
    font-size: 13px;
    min-height: 34px;
}
.ac-unit-placeholder { visibility: hidden; }

/* --- Buttons --------------------------------------------------- */
.ac-actions {
    display: flex; justify-content: center; gap: 12px;
    margin: 22px 0 4px; flex-wrap: wrap;
}
.ac-btn {
    padding: 10px 22px; border-radius: 8px; border: none;
    font-size: 14px; font-weight: 600; cursor: pointer;
    color: #FFFFFF; background: #6B3FA8;
    transition: filter 0.12s ease, transform 0.12s ease;
}
.ac-btn:hover  { filter: brightness(1.08); }
.ac-btn:active { transform: translateY(1px); }
.ac-btn-primary   { background: #2A2D8E; }
.ac-btn-secondary { background: #6B3FA8; }

/* --- Error box ------------------------------------------------- */
.ac-err {
    margin: 16px 0; padding: 12px 16px; border-radius: 8px;
    background: #FDECEC; color: #B00020; border-left: 4px solid #B00020;
}

/* --- Toast notification ---------------------------------------- */
.ac-toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
    background: #2A2D8E; color: #FFFFFF; padding: 12px 22px; border-radius: 8px;
    box-shadow: 0 6px 18px rgba(20, 22, 60, 0.3);
    opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 200; font-size: 14px;
}
.ac-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- Formula modal --------------------------------------------- */
.ac-modal-mask {
    position: fixed; inset: 0; background: rgba(20, 22, 60, 0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 150; padding: 20px;
}
.ac-modal {
    background: #FFFFFF; border-radius: 12px; overflow: hidden;
    max-width: 720px; width: 100%; max-height: 86vh;
    display: flex; flex-direction: column;
    box-shadow: 0 12px 36px rgba(20, 22, 60, 0.35);
}
.ac-modal-header {
    background: #2A2D8E; color: #FFFFFF; padding: 14px 22px;
    display: flex; align-items: center;
    font-weight: 700;
}
.ac-modal-header span { flex: 1; }
.ac-modal-close {
    background: transparent; border: none; color: #FFFFFF; font-size: 28px;
    line-height: 1; cursor: pointer; padding: 0 4px;
}
.ac-modal-body { padding: 14px 22px 22px; overflow-y: auto; }
.ac-fp-block { margin: 10px 0; }
.ac-fp-empty { color: #6A6A78; font-style: italic; text-align: center; }

/* --- About page ------------------------------------------------ */
.ac-about-hero {
    display: flex; align-items: center; gap: 22px;
    background: #FFFFFF; padding: 26px 28px; border-radius: 12px;
    margin-bottom: 18px;
    box-shadow: 0 2px 8px rgba(42, 45, 142, 0.06);
}
.ac-about-logo { width: 80px; height: 80px; flex-shrink: 0; }
.ac-about-hero h2 { margin: 0 0 4px; color: #2A2D8E; }
.ac-about-sub    { color: #6A6A78; font-size: 14px; }
.ac-about-section {
    background: #FFFFFF; padding: 22px 28px; border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(42, 45, 142, 0.04);
}
.ac-about-section h3 {
    margin: 0 0 8px; color: #6B3FA8; font-size: 18px;
    border-bottom: 1px solid #EEEDF5; padding-bottom: 6px;
}
.ac-editions { padding-left: 22px; margin: 0; }
.ac-editions li { margin: 6px 0; }

.ac-citation {
    background: #F4F0FA; border-left: 4px solid #6B3FA8;
    margin: 8px 0; padding: 14px 18px; font-family: Georgia, serif;
    border-radius: 0 6px 6px 0;
}
.ac-citation code {
    background: rgba(42, 45, 142, 0.08); padding: 2px 6px;
    border-radius: 4px; font-size: 13px;
}

/* --- Equations page -------------------------------------------- */
.ac-page-title {
    color: #2A2D8E; font-size: 28px; margin: 6px 0 6px;
    border-bottom: 2px solid #6B3FA8; padding-bottom: 8px;
    display: inline-block;
}
.ac-eq-intro { color: #6A6A78; font-size: 15px; margin: 0 0 22px; }
.ac-eq-section { margin-bottom: 22px; }
.ac-eq-header {
    background: linear-gradient(135deg, #2A2D8E, #6B3FA8);
    color: #FFFFFF; padding: 12px 20px; font-weight: 700;
    font-size: 15px; letter-spacing: 0.5px;
    border-top-left-radius: 10px; border-top-right-radius: 10px;
}
.ac-eq-card {
    background: #FFFFFF; padding: 8px 0 14px;
    border-bottom-left-radius: 10px; border-bottom-right-radius: 10px;
    box-shadow: 0 1px 6px rgba(42, 45, 142, 0.06);
}
.ac-eq-block { margin: 12px 18px 6px; }

/* --- Footer ---------------------------------------------------- */
.ac-footer {
    background: #1F2033; color: #C5CAE9; padding: 28px 24px 18px;
    margin-top: 40px;
    font-size: 13px;
}
.ac-footer a { color: #C5CAE9; text-decoration: underline; }
.ac-footer a:hover { color: #FFFFFF; }
.ac-cite {
    max-width: 980px; margin: 0 auto 12px; line-height: 1.6;
    text-align: center;
}
.ac-cite code {
    background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 4px;
}
.ac-footer-links {
    display: flex; justify-content: center; gap: 22px;
    margin: 14px 0 10px; flex-wrap: wrap;
}
.ac-footer-links a { margin: 0 11px; }
.ac-copyright { text-align: center; color: #8E94B8; font-size: 12px; }

/* --- Persistent sidebar (Module / About / Equations pages) ----- */
.ac-with-sidebar {
    display: flex;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    align-items: flex-start;
}
.ac-with-sidebar > main {
    flex: 1;
    min-width: 0;     /* allow main content to shrink as needed */
    max-width: none;
}
.ac-sidebar {
    flex: 0 0 240px;
    width: 240px;
    background: #FFFFFF;
    border-right: 1px solid #E7E5F0;
    min-height: calc(100vh - 80px);
    padding: 18px 0 18px 0;
    position: sticky;
    top: 0;
    align-self: stretch;
    overflow-y: auto;
    max-height: 100vh;
}
.ac-sb-heading {
    padding: 4px 20px 10px;
    color: #6B3FA8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-bottom: 1px solid #EDECF5;
    margin-bottom: 6px;
}
.ac-sb-scroll { padding: 6px 0 0; }
.ac-sb-group { margin: 6px 0 12px; }
.ac-sb-group-title {
    padding: 8px 20px 4px;
    color: #2A2D8E;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: #F8F7FC;
    border-top: 1px solid #EFEDF6;
    border-bottom: 1px solid #EFEDF6;
}
.ac-sb-item {
    display: block;
    padding: 9px 20px 9px 28px;
    color: #1F2033;
    font-size: 14px;
    border-left: 3px solid transparent;
    line-height: 1.3;
}
.ac-sb-item:hover {
    background: #F4F0FA;
    color: #2A2D8E;
    text-decoration: none;
}
.ac-sb-item-active {
    background: #F4F0FA;
    color: #2A2D8E;
    font-weight: 600;
    border-left-color: #6B3FA8;
}
.ac-sb-pinned {
    border-top: 1px solid #EDECF5;
    margin-top: 12px;
    padding-top: 6px;
}
.ac-sb-pinned .ac-sb-item {
    font-weight: 500;
    color: #6B3FA8;
}

/* On narrow screens, fold the sidebar above the main content */
@media (max-width: 880px) {
    .ac-with-sidebar { flex-direction: column; }
    .ac-sidebar {
        flex: none;
        width: 100%;
        position: relative;
        min-height: 0;
        max-height: 220px;
        border-right: none;
        border-bottom: 1px solid #E7E5F0;
        padding-bottom: 6px;
    }
    .ac-sb-heading {
        padding: 8px 18px 8px;
        font-size: 11px;
    }
}

/* --- Developer / ORCID IDs section on About ------------------- */
.ac-dev-name { font-size: 17px; margin: 0; }
.ac-dev-role { color: #6A6A78; margin: 2px 0 14px; font-style: italic; }
.ac-dev-ids { list-style: none; padding: 0; margin: 0; }
.ac-dev-ids li {
    padding: 6px 0;
    border-bottom: 1px dashed #EEEDF5;
    font-size: 14px;
}
.ac-dev-ids li:last-child { border-bottom: none; }
.ac-id-label {
    display: inline-block;
    min-width: 140px;
    color: #6A6A78;
    font-weight: 600;
}

/* --- MathJax-rendered equation containers --------------------- */
/* Override the old "preformatted" look — MathJax injects SVG that
   centres on its own; we just style the surrounding card. */
.ac-eq-formula {
    background: #F4F0FA;
    border-left: 5px solid #6B3FA8;
    padding: 16px 18px;
    margin: 8px 0 4px;
    color: #1F2033;
    border-radius: 0 6px 6px 0;
    overflow-x: auto;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ac-eq-formula mjx-container { margin: 0 !important; }
.ac-eq-note { color: #6A6A78; font-style: italic; font-size: 13px;
              margin: 4px 0 0 18px; }
.ac-eq-note mjx-container { display: inline-block !important; vertical-align: baseline; }

/* Same for the formula-popup modal */
.ac-fp-formula {
    background: #F4F0FA;
    border-left: 5px solid #6B3FA8;
    padding: 14px 16px;
    margin: 10px 0 4px;
    color: #1F2033;
    border-radius: 0 6px 6px 0;
    overflow-x: auto;
    text-align: center;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ac-fp-formula mjx-container { margin: 0 !important; }
.ac-fp-note mjx-container { display: inline-block !important; vertical-align: baseline; }
@media (max-width: 760px) {
    .ac-header { flex-direction: column; gap: 10px; padding: 14px; }
    .ac-header-right { margin-left: 0; }
    .ac-brand-name { font-size: 19px; }
    main { padding: 18px 14px 30px; }
    .ac-row { grid-template-columns: 1fr 110px 70px; gap: 6px; }
    .ac-input { font-size: 13px; padding: 7px 8px; }
    .ac-unit  { font-size: 12px; padding: 6px; }
    .ac-row-label { font-size: 13px; }
    .ac-hero h1 { font-size: 26px; }
}
