/* KIWI Flight Systems — custom overrides */

/* ── Typography ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

:root {
    --content-max-width: 900px;
    --mono-font: 'JetBrains Mono', 'Source Code Pro', Consolas, monospace;
    --kiwi-accent: #0b6b63;
    --kiwi-accent-light: #0d9488;
    --kiwi-accent-dark: #095e56;
    --sidebar-target-width: 280px;
    --menu-bar-height: 56px;
}

/* ── Light theme accent ── */
.light, html:not(.js) {
    --sidebar-active: var(--kiwi-accent);
    --links: var(--kiwi-accent-dark);
    --fg: #4B4646;
}

.navy {
    --sidebar-active: var(--kiwi-accent-light);
    --links: var(--kiwi-accent-light);
}

.coal {
    --sidebar-active: var(--kiwi-accent-light);
    --links: var(--kiwi-accent-light);
}

.ayu {
    --sidebar-active: var(--kiwi-accent-light);
    --links: var(--kiwi-accent-light);
}

/* ── Dark teal header bar ── */
#mdbook-menu-bar {
    background-color: var(--kiwi-accent-dark) !important;
    border-block-end: none !important;
}

#mdbook-menu-bar,
#mdbook-menu-bar .icon-button,
#mdbook-menu-bar a,
#mdbook-menu-bar .fa-svg,
#mdbook-menu-bar .menu-title {
    color: #fff !important;
}

#mdbook-menu-bar .fa-svg:hover,
#mdbook-menu-bar .icon-button:hover,
#mdbook-menu-bar a:hover {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Theme popup needs its own colors (not white-on-white) */
#mdbook-menu-bar .theme-popup {
    color: var(--fg) !important;
}
#mdbook-menu-bar .theme-popup .theme {
    color: inherit !important;
}

/* Header nav links */
.header-nav-link {
    color: #fff !important;
    text-decoration: none !important;
    font-size: 0.9em;
    font-weight: 500;
    padding: 0 12px;
    line-height: var(--menu-bar-height);
    opacity: 0.9;
    transition: opacity 0.2s;
}
.header-nav-link:hover {
    opacity: 1;
    color: #fff !important;
}

/* ── Menu bar title + logo ── */
.menu-title {
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 1.6rem;
}

.header-logo {
    height: 28px;
    vertical-align: middle;
    image-rendering: pixelated;
}
.header-logo-short {
    display: none;
}
@media only screen and (max-width: 540px) {
    .header-logo-full {
        display: none;
    }
    .header-logo-short {
        display: inline;
        height: 24px;
    }
}

/* ── Heading hierarchy ── */
.content main > h1:first-child {
    font-weight: 700;
    font-size: 2.0em;
    letter-spacing: -0.02em;
    padding-bottom: 0;
    border-bottom: none;
    margin-bottom: 0.8em;
}

h2 {
    font-weight: 600;
    font-size: 1.6em;
    letter-spacing: -0.01em;
}

h3 {
    font-weight: 600;
    font-size: 1.28em;
}

h4 {
    font-weight: 600;
    font-size: 1.02em;
}

/* ── Tables — tighter, more technical ── */
table {
    width: 100%;
    font-size: 0.92em;
    border-radius: 4px;
    overflow: hidden;
}

table thead th {
    text-align: left;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 16px;
}

table td {
    padding: 6px 16px;
}

/* 5-row grouping border per MIL-STD 5.17.20.3.14 */
tbody tr:nth-child(5n) {
    border-bottom: 2px solid var(--table-border-color);
}

/* ── Code blocks ── */
code {
    font-size: 0.85em !important;
}

pre {
    border-radius: 6px;
    padding: 1em !important;
}

/* Inline code */
:not(pre) > code {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em !important;
}

/* ── Firmware download links ── */
.content a[href$=".zip"] {
    display: inline-block;
    font-family: var(--mono-font);
    font-size: 0.88em;
    font-weight: 500;
}

/* ── Sidebar tweaks ── */
.sidebar .chapter li a {
    font-size: 0.95em;
    min-height: 36px;
    display: flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 4px;
    transition: background-color 0.15s;
}

.sidebar .chapter li a:hover {
    background-color: rgba(11, 107, 99, 0.08);
}

.sidebar .chapter li a.active {
    background-color: rgba(11, 107, 99, 0.12);
    font-weight: 600;
}

.navy .sidebar .chapter li a:hover,
.coal .sidebar .chapter li a:hover {
    background-color: rgba(13, 148, 136, 0.1);
}
.navy .sidebar .chapter li a.active,
.coal .sidebar .chapter li a.active {
    background-color: rgba(13, 148, 136, 0.15);
}
.ayu .sidebar .chapter li a:hover {
    background-color: rgba(13, 148, 136, 0.1);
}
.ayu .sidebar .chapter li a.active {
    background-color: rgba(13, 148, 136, 0.15);
}

.sidebar .chapter li.part-title {
    text-transform: uppercase;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.1em;
    margin-top: 1.4em;
    padding: 0 10px;
    opacity: 0.55;
}

/* ── HR dividers — subtler ── */
hr {
    border: none;
    border-top: 1px solid var(--table-border-color);
    margin: 2em 0;
}

/* ── Images — subtle shadow ── */
.content img {
    border-radius: 4px;
}

/* ── Lists — slightly tighter ── */
.content ul, .content ol {
    padding-left: 1.5em;
}

.content li {
    margin-bottom: 0.2em;
}

/* ── Hide side navigation arrows (GitBook doesn't have them) ── */
.nav-wide-wrapper {
    display: none !important;
}

/* ── Card-style prev/next navigation (always visible) ── */
.nav-wrapper {
    display: flex !important;
    gap: 16px;
    margin-block-start: 48px;
    padding-bottom: 24px;
}

.mobile-nav-chapters {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border: 1px solid var(--table-border-color);
    border-radius: 6px;
    background-color: var(--bg);
    font-size: 1em;
    text-decoration: none !important;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: auto;
}

.mobile-nav-chapters:hover {
    border-color: var(--kiwi-accent);
    box-shadow: 0 2px 8px rgba(11, 107, 99, 0.1);
}

.mobile-nav-chapters.previous {
    justify-content: flex-start;
}

.mobile-nav-chapters.next {
    justify-content: flex-end;
    float: none;
    right: auto;
}

.mobile-nav-chapters .fa-svg {
    font-size: 0.8em;
}

/* ── Buy Online button (inline) ── */
.buy-online::before, .buy-online-sticky::before {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: 0.4em;
    vertical-align: -0.12em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

.buy-online {
    display: inline-block;
    padding: 0.55em 1.4em;
    margin: 0.6em 0 1em;
    background-color: var(--kiwi-accent);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95em;
    letter-spacing: 0.02em;
    transition: background-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.25);
}
.buy-online:hover {
    background-color: var(--kiwi-accent-dark);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}
.navy .buy-online, .coal .buy-online, .ayu .buy-online {
    background-color: var(--kiwi-accent-light);
    box-shadow: 0 2px 6px rgba(20, 184, 166, 0.3);
}
.navy .buy-online:hover, .coal .buy-online:hover, .ayu .buy-online:hover {
    background-color: var(--kiwi-accent);
}

/* ── Buy Online button (sticky) ── */
.buy-online-sticky {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    padding: 0.5em 1.2em;
    background-color: var(--kiwi-accent);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.88em;
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.4);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.3s, transform 0.3s;
}
.buy-online-sticky.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.buy-online-sticky:hover {
    background-color: var(--kiwi-accent-dark);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.5);
}
.navy .buy-online-sticky, .coal .buy-online-sticky, .ayu .buy-online-sticky {
    background-color: var(--kiwi-accent-light);
    box-shadow: 0 4px 16px rgba(20, 184, 166, 0.35);
}
.navy .buy-online-sticky:hover, .coal .buy-online-sticky:hover, .ayu .buy-online-sticky:hover {
    background-color: var(--kiwi-accent);
}
