/* 1. Import Manrope from Google Fonts (Weights 400, 600, 700) */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700&display=swap');

/* 2. Define the Certo Brand Identity */
:root {
    --cloud: #EDEFF7;
    --smoke: #D3D6E0;
    --steel: #BCBFCC;
    --space: #9DA2B3;
    --graphite: #6E7180;
    --arsenic: #40424D;
    --phantom: #1E1E24;

    --black: #000000;
    --white: #ffffff;
    --certo-purple: #5869fe;

    --certo-bg: var(--cloud);
    --certo-sidebar: var(--steel);
    --certo-text: var(--phantom);
    --certo-accent: var(--certo-purple);
    --certo-border: #333333;
    
    /* Set Manrope as the primary font, with system fallbacks */
    --certo-font: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* =========================================
   3. mdBook Overrides
   ========================================= */
.certo {
    --bg: var(--certo-bg);
    --fg: var(--certo-text);
    --sidebar-bg: var(--certo-sidebar);
    
    /* 1. Base sidebar text color */
    --sidebar-fg: var(--certo-text); 
    
    /* 2. Selected/Active sidebar item */
    --sidebar-active: var(--certo-accent); 
    
    --theme-popup-bg: var(--certo-sidebar);
    --theme-popup-border: var(--certo-border);
    
    /* 3. Base color for links in the main text */
    --links: var(--certo-text); 

    --table-border-color: var(--steel); 
    --table-header-bg: var(--smoke);
    --table-alternate-bg: var(--white);
    --table-header-bg: var(--certo-accent);
}

/* Apply the font to mdBook */
body {
    font-family: var(--certo-font) !important;
}

/* 4. mdBook explicit hover states */
.certo a:hover,
.certo .sidebar a:hover {
    color: var(--certo-accent) !important;
}

.certo table th {
    color: var(--white) !important;
}

/* =========================================
   mdBook Top Menu Bar Override
   ========================================= */

/* 1. Change the menu bar background to Certo Purple */
.certo .menu-bar {
    background-color: var(--certo-accent) !important;
    border-bottom: none !important; /* Removes the default gray line */
}

/* 2. Make the main title text white */
.certo .menu-bar .menu-title {
    color: var(--white) !important;
}

/* 3. Make all the icons (hamburger, search, theme, print) white */
.certo .menu-bar .icon-button {
    color: var(--white) !important;
}

/* 4. Add a subtle hover effect for the icons so users know they are clickable */
.certo .menu-bar .icon-button:hover {
    color: var(--cloud) !important;
    opacity: 0.8;
}

/* =========================================
   4. rustdoc Overrides
   ========================================= */
body.rustdoc {
    background-color: var(--certo-bg) !important;
    color: var(--certo-text) !important;
    font-family: var(--certo-font) !important;
}

.rustdoc .sidebar {
    background-color: var(--certo-sidebar) !important;
}

.rustdoc .example-wrap {
    background-color: var(--certo-sidebar) !important;
    border: 1px solid var(--certo-border) !important;
}

/* 1. Set headings to standard text color (matches mdBook style) */
.rustdoc h1, .rustdoc h2, .rustdoc h3 {
    color: var(--certo-text) !important;
    font-family: var(--certo-font) !important;
}

/* 2. Set base links to standard text color */
.rustdoc a {
    color: var(--certo-text) !important;
    font-family: var(--certo-font) !important;
}

/* 3. Set Hover AND Active/Selected states to Purple */
.rustdoc a:hover,
.rustdoc .sidebar a.current {
    color: var(--certo-accent) !important;
}

/* =========================================
   5. Rustdoc Global Top Banner
   ========================================= */

/* Pin the banner to the top of the screen */
#certo-global-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 36px;
    background-color: var(--certo-purple);
    z-index: 999999;
    display: flex;
    align-items: center;
    padding: 0 24px;
    box-sizing: border-box;
}

/* Style the banner text */
#certo-global-banner a {
    color: var(--white) !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    font-family: var(--certo-font);
}

#certo-global-banner a:hover {
    text-decoration: underline;
}

/* Push the rest of the Rust documentation down by 36px */
body.rustdoc {
    padding-top: 36px !important; 
}

/* Adjust the sticky sidebar so it doesn't slide under the banner */
.rustdoc .sidebar {
    top: 36px !important;
    height: calc(100vh - 36px) !important;
}

/* =========================================
   6. Version Dropdown Selector Override
   ========================================= */
.version-select {
    background-color: rgba(255, 255, 255, 0.12);
    color: var(--white) !important;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 2px 24px 2px 8px;
    font-family: var(--certo-font);
    font-size: 13px;
    font-weight: 600;
    margin-left: 12px;
    outline: none;
    cursor: pointer;
    vertical-align: middle;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23ffffff" height="14" viewBox="0 0 24 24" width="14" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 6px center;
    transition: all 0.2s ease;
}

.version-select option {
    background-color: var(--certo-sidebar);
    color: var(--certo-text);
}

.version-select:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
}

.version-select:focus {
    border-color: var(--white);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}
