/***********************************************************************
 ** sophia.css 0.0.8
 ** Copyright 2026 sophia.host
 ** Copyright 2025-2026 Silvino Silva wiki.sophia.host/profiles/punk
 **
 ***********************************************************************/

/* =====================================================================
1. TOKENS & VARIABLES
===================================================================== */
:root {

    --header-height:    92px;

    --bg-void:          #000;
    --bg-drawer:        #0a0806;
    --bg-header:        #100e0b;
    --bg-base:          #181410;   /* page body background             */
    --bg-alt:           #1e1a15;
    --bg-card:          #252019;
    --bg-charcoal:      #161618;
    --bg-input:         #1a1612;
    --bg-input-focus:   #201c16;

    --text-lighter:     #d4cdbe;
    --text-main:        #e9e0c6;
    --text-muted:       #8a7f6e;
    --text-heading:     #e8c96a;
    --text-nav-top:     #a89880;
    --text-nav-bottom:  #d4b87a;
    --text-on-accent:   #1a1200;


    --amber-deep:       #b87a10;
    --amber-mid:        #e3a024;
    --amber-warm:       #ffb626;
    --amber-pale:       #f2c96b;
    --amber-glow:       #ffe599;
    --gold:             #F2AC27;

    --amber-orange:      #f70;

    --brand-color:      var(--amber-warm);

    --accent-primary:   var(--amber-glow);
    --accent-visited:   var(--amber-pale);
    --accent-hover:     var(--amber-warm);
    --accent-active:    var(--amber-glow);

    --accent-border:    var(--amber-warm);

    --accent-deep:      var(--amber-deep);
    --accent-glow:      var(--amber-glow);

    --border-drop:      var(--amber-deep);
    --border-subtle:    rgba(255, 220, 140, 0.06);
    --border-card:      rgba(80,  60,  30,  0.55);
    --border-charcoal:  #3a3a3a;
    --border-mobile:    rgba(255, 200, 100, 0.08);
    --border-input:     rgba(180, 140,  60, 0.25);
    --border-input-focus: var(--accent-primary);

    --border-header:    var(--amber-warm);
    --border-footer:    var(--amber-deep);
    --nav-hover-bg:     rgba(255, 200, 100, 0.07);

    --search-bg:        rgba(255, 220, 140, 0.06);
    --search-bg-hover:  rgba(255, 220, 140, 0.10);
    --search-bg-focus:  rgba(255, 220, 140, 0.13);
    --search-border:    rgba(255, 200, 100, 0.10);
    --search-border-hover: rgba(255, 200, 100, 0.18);
    --search-border-focus: rgba(255, 200, 100, 0.25);

    --font-mono:    "Lucida Console", Monaco, monospace;
    --font-sans:    Verdana, Helvetica, Arial, sans-serif;
    --font-display: "Trebuchet MS", Arial, Helvetica, sans-serif;
}

/* =====================================================================
2. MAIN LAYOUT
===================================================================== */
*, *::before, *::after { box-sizing: border-box; }

[id] {
    scroll-margin-top: calc(var(--header-height) + 8px);
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 15px;
    text-align: justify;
    line-height: 1.6em;
    letter-spacing: -0.3px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

footer {
    background-color: var(--bg-void);
    color: var(--text-muted);
    text-align: center;
    padding: 20px 0;
    margin-top: auto;
    font-size: 13.5px;
    border-top: 1px solid var(--border-footer);
}

/* =====================================================================
3. BARE HTML ELEMENTS
===================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--text-heading);
    font-weight: normal;
    margin-bottom: 0.5em;
    line-height: 1.25;
}
h1 { font-size: 2.8em; }
h2 { font-size: 1.6em; }
h3 { font-size: 1.25em; }
h4 { font-size: 1.1em; }
h5 { font-size: 1.0em; font-weight: bold; }
h6 { font-size: 0.9em; font-weight: bold; color: var(--text-muted); }

h2::after {
    content: '';
    display: block;
    border-bottom: 1px solid var(--text-heading);
    margin-top: 4px;
}

p {
    margin-top: 0;
    margin-bottom: 1em;
}

a, a:link {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.1s ease-in-out;
}
a:visited {
    color: var(--accent-visited);
}

a:hover {
    color: var(--accent-hover);
    text-decoration: none;
}
a:active {
    color: var(--accent-active);
}

ul { list-style: none; padding-left: 1.4em; margin-top: 0; margin-bottom: 1em; }
ul li { position: relative; padding-left: 1.2em; margin-bottom: 0.4em; }
ul li::before { content: '»'; color: var(--accent-border); position: absolute; left: 0; font-weight: bold; line-height: inherit; }

ol { padding-left: 1.8em; margin-top: 0; margin-bottom: 1em; }
ol li { margin-bottom: 0.4em; }

code { font-family: var(--font-mono); font-size: 0.9em; color: var(--accent-glow); background: var(--bg-card); padding: 0.1em 0.4em; border-radius: 3px; border: 1px solid var(--border-card); }
pre { font-family: var(--font-mono); font-size: 0.875em; color: var(--text-main); background: var(--bg-card); border: 1px solid var(--border-card); border-left: 3px solid var(--accent-deep); border-radius: 4px; padding: 1em 1.2em; overflow-x: auto; margin-bottom: 1.2em; line-height: 1.5; }
pre code { background: none; border: none; padding: 0; font-size: inherit; color: inherit; }

blockquote { margin: 1.2em 0 1.2em 0; padding: 0.8em 1.2em; border-left: 3px solid var(--accent-border); background: var(--bg-card); color: var(--text-muted); font-style: italic; border-radius: 0 4px 4px 0; }
blockquote p:last-child { margin-bottom: 0; }
hr { border: none; border-top: 1px solid var(--border-subtle); margin: 2em 0; }

table { width: 100%; border-collapse: collapse; margin-bottom: 1.2em; font-size: 0.95em; }
thead { background: var(--bg-card); }
thead th { color: var(--text-heading); font-weight: bold; font-family: var(--font-sans); font-size: 0.85em; letter-spacing: 0.04em; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--accent-deep); text-align: left; }
tbody tr { border-bottom: 1px solid var(--border-subtle); }
tbody tr:nth-child(even) { background: var(--bg-alt); }
tbody tr:hover { background: var(--bg-card); }
td { padding: 8px 12px; vertical-align: top; }

strong { font-weight: bold; }
em { color: var(--text-muted); font-style: italic; }

form { display: flex; flex-direction: column; gap: 14px; max-width: 600px; margin: 0 auto; }

/* =====================================================================
4. CONTEXTUAL ELEMENTS (Nested & Scoped)
===================================================================== */

main h1 {
    text-align: center;
    position: relative;
    margin: 60px auto 80px;
    text-shadow: 0 0 20px rgba(232, 170, 48, 0.20);
}

main h1::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--brand-color);
    margin: 10px auto 0;
}

footer p { margin: 5px 0; color: var(--text-muted); }
footer a { color: var(--accent-hover); text-decoration: none; }
footer a:hover { color: var(--accent-primary); }

form label {
    font-weight: bold;
    color: var(--amber-pale);
    margin-bottom: -6px;
}
form input, form textarea, form select { padding: 10px 12px; border-radius: 5px; border: 1px solid var(--border-input); background: var(--bg-input); color: var(--text-main); font-family: var(--font-mono); font-size: 1em; outline: none; transition: border-color 0.2s ease, background 0.2s ease; }
form input:hover, form textarea:hover, form select:hover { border-color: rgba(212, 148, 30, 0.40); background: var(--bg-input-focus); }
form input:focus, form textarea:focus, form select:focus { border-color: var(--border-input-focus); background: var(--bg-input-focus); }
form textarea { resize: vertical; min-height: 120px; }
form button, form input[type="submit"] {
    background-color: var(--accent-primary);
    color: var(--text-on-accent);
    font-family: var(--font-mono);
    font-weight: bold; font-size: 1em;
    cursor: pointer;
    border: 1px solid var(--accent-border);
    border-radius: 5px;
    padding: 12px;
    transition: background-color 0.25s ease;
    display: inline-block;
}
form button:hover, form input[type="submit"]:hover { background-color: var(--accent-hover); color: var(--text-on-accent); }


/* =====================================================================
5. IDS
===================================================================== */

#page-content,
#wikitext {
    margin: 8px 8px 30px 8px;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid var(--bg-card);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: var(--bg-card);
    display: block;
    overflow: hidden; /* contain floats */
}

/* =====================================================================
6. CLASSES
===================================================================== */

/* The whole header block is sticky */
.header-main {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-header);
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: var(--header-height);
}
.header-topbar, .header-bottombar { font-family: var(--font-sans); font-size: 11px; line-height: 1; }
.header-topbar { background-color: var(--bg-void); border-bottom: 1px solid var(--border-subtle); }
.header-bottombar { background-color: var(--bg-drawer); border-top: 1px solid var(--border-subtle); }

.header-topbar-inner, .header-bottombar-inner {
    display: flex; justify-content: space-between; align-items: center; min-height: 20px; padding: 0 5px;
}
.header-topbar-inner { color: var(--text-nav-top); }
.header-bottombar-inner { color: var(--text-nav-bottom); font-weight: bold; }

.header-topbar-left, .header-topbar-right, .header-bottombar-left, .header-bottombar-right { display: flex; align-items: center; flex-wrap: wrap; }
.header-topbar-left, .header-topbar-right { gap: 0 4px; }
.header-bottombar-left, .header-bottombar-right { gap: 0 12px; }
.header-topbar-sep, .header-bottombar-sep { color: rgba(255, 255, 255, 0.15); }

.header-topbar a, .header-bottombar a { text-decoration: none; transition: color 0.15s ease; }
.header-topbar a, .header-topbar a:visited { color: var(--text-nav-top); }
.header-bottombar a, .header-bottombar a:visited { color: var(--text-nav-bottom); display: flex; align-items: center; }
.header-topbar a:hover, .header-bottombar a:hover { color: var(--accent-primary); text-decoration: none; }

.header-bottombar ul { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; gap: 12px; }
.header-bottombar li { display: flex; align-items: center; margin: 0; padding: 0; position: static; }
.header-bottombar li::before { content: none; }
.header-bottombar li + li::before { content: "|"; position: static; left: auto; color: rgba(255, 255, 255, 0.15); margin-right: 12px; font-weight: normal; }
.header-bottombar a::before { content: attr(data-icon); font-size: 15px; line-height: 1; margin-right: 4px; color: var(--text-nav-bottom); }
.header-bottombar a[data-icon]::before { font-size: 14px; color: transparent; text-shadow: 0 0 0 var(--text-nav-bottom); }
.header-bottombar a[data-icon]:hover::before { text-shadow: 0 0 0 var(--accent-hover); }

.topbar-dropdown { position: relative; }
.topbar-dropdown-trigger { display: flex; align-items: center; gap: 0 4px; background: none; border: none; padding: 3px 6px; margin: 0; color: var(--text-nav-top); font-family: var(--font-sans); font-size: 11px; line-height: 1; cursor: pointer; border-radius: 3px; white-space: nowrap; transition: color 0.15s ease, background 0.15s ease; }
.topbar-dropdown-trigger:hover, .topbar-dropdown.is-open .topbar-dropdown-trigger { color: var(--accent-primary); background: var(--nav-hover-bg); }
.topbar-dropdown-icon { font-size: 11px; line-height: 1; flex: 0 0 auto; display: inline-block; width: 1.2em; text-align: center; color: transparent; text-shadow: 0 0 0 var(--text-nav-top); }
.topbar-dropdown-trigger:hover .topbar-dropdown-icon, .topbar-dropdown.is-open .topbar-dropdown-trigger .topbar-dropdown-icon { text-shadow: 0 0 0 var(--accent-primary); }
.topbar-dropdown-label { letter-spacing: 0.04em; }
.topbar-dropdown-caret { font-size: 8px; opacity: 0.6; margin-top: 1px; }

.topbar-dropdown-panel { display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 2000; min-width: 160px; background: var(--bg-void); border: 1px solid var(--border-drop); border-top: 1px solid var(--accent-border); border-radius: 4px; padding: 2px 0; margin: 0; list-style: none; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55); max-width: calc(100vw - 10px); }
.topbar-dropdown-panel--right { left: auto; right: 0; }
.topbar-dropdown.is-open .topbar-dropdown-panel { display: block; }
.topbar-dropdown-panel, .header-mobile-list { list-style: none; padding: 0; margin: 0; }
.topbar-dropdown-panel li, .header-mobile-list li { padding: 0; margin: 0; }
.topbar-dropdown-panel li::before, .header-mobile-list li::before { content: none; }
.topbar-dropdown-panel li a, .topbar-dropdown-panel li .topbar-dropdown-btn, .header-mobile-list li a { display: block; font-family: var(--font-sans); font-weight: normal; text-decoration: none; background: none; border: none; width: 100%; text-align: left; cursor: pointer; transition: color 0.15s ease, background 0.15s ease; line-height: 1.4; }
.topbar-dropdown-panel li a:hover, .topbar-dropdown-panel li .topbar-dropdown-btn:hover, .header-mobile-list li a:hover { color: var(--accent-primary); background: var(--nav-hover-bg); text-decoration: none; }
.topbar-dropdown-panel li a, .topbar-dropdown-panel li .topbar-dropdown-btn { padding: 6px 14px; color: var(--text-nav-top); font-size: 11px; white-space: nowrap; }
.topbar-dropdown-panel li a[aria-current="true"] { color: var(--accent-border); font-weight: bold; }
.topbar-dropdown-sep { height: 1px; background: var(--border-subtle); margin: 4px 0; padding: 0; }

.header-container { display: flex; align-items: center; min-height: 50px; gap: 0 8px; position: relative; padding: 0 5px; }
.header-brand { display: flex; align-items: center; gap: 0 8px; flex: 1 1 auto; min-width: 0; text-decoration: none; }
.header-brand:hover { text-decoration: none; }
.header-logo { flex: 0 0 auto; display: block; line-height: 0; }
.header-logo img { width: 40px; height: 40px; display: block; }
.header-brand-text { min-width: 0; overflow: hidden; }

.header-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: normal;
    /* color: var(--border-header);
    text-shadow: 0 0 18px rgba(232, 170, 48, 0.25); */
    color: var(--brand-color);
    text-shadow: 0 0 18px rgba(255, 205, 107, 0.3);
    white-space: nowrap;
    line-height: 1.1;
}

.header-tagline {
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--text-nav-top);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.header-actions { display: flex; align-items: center; gap: 0 6px; flex: 0 0 auto; }
.header-search { display: flex; align-items: center; gap: 0; }

.header-search-input {
    width: 12em;
}

.searchbox,
.header-search-input {
    background: var(--search-bg);
    border: 1px solid var(--search-border);
    border-radius: 4px 0 0 4px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 13px;
    padding: 6px 8px;
    outline: none;
    height: 28px;
    box-sizing: border-box;
    line-height: 1.5;
}

.searchbox:hover,
.header-search-input:hover {
    background: var(--search-bg-hover);
    border-color: var(--search-border-hover);
}

.searchbox:focus,
.header-search-input:focus {
    background: var(--search-bg-focus);
    border-color: var(--search-border-focus);
    color: var(--text-main);
}

.header-search-input::placeholder { color: var(--text-muted); }
.header-search-input:focus::placeholder { color: transparent; }
.header-search-btn {
    background: var(--search-bg);
    border: 1px solid var(--search-border);
    border-left: none;
    border-radius: 0 4px 4px 0;
    color: var(--text-main);
    cursor: pointer;
    font-size: 0;
    padding: 6px 8px;
    height: 28px;
    width: 32px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.header-search-btn::before {
    content: "⌕";
    line-height: 1;
    font-family: inherit;
    font-size: 22px;
    font-weight: normal;
    color: var(--text-nav-top);
}

.header-search-btn:hover { background: var(--search-bg-focus); }
.header-search-btn:hover::before { color: var(--accent-hover); }
.header-search-btn:focus { border-color: var(--search-border-focus); outline: none; }
.header-search-close { display: none; background: var(--search-bg); border: 1px solid var(--search-border); border-left: none; border-radius: 0 4px 4px 0; color: var(--text-nav-top); cursor: pointer; font-family: var(--font-sans); font-size: 18px; padding: 0; width: 32px; height: 28px; line-height: 1; box-sizing: border-box; align-items: center; justify-content: center; }
.header-search-close:hover { background: var(--search-bg-focus); color: var(--accent-hover); }

.header-nav-toggle,
.header-action-toggle,
.header-search-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-nav-bottom);
    font-size: 24px;
    cursor: pointer;
    flex: 0 0 auto;
    z-index: 10;
    position: relative;
}
.header-nav-toggle:hover { color: var(--accent-hover); }

.header-search-toggle,
.header-action-toggle {
    width: 36px;
    height: 36px;
    padding: 0;
    display: none;
    color: transparent;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-shadow: 0 0 0 var(--text-nav-bottom);

    -webkit-text-size-adjust: none;
       -moz-text-size-adjust: none;
            text-size-adjust: none;
}

/* ⌕ is optically small — needs a larger font-size to match the gear visually */
.header-search-toggle { font-size: 24px; }
.header-action-toggle {
    font-family: "Apple Symbols", "Segoe UI Symbol", "Symbola", sans-serif;
    font-size: 20px;
}

.header-search-toggle:hover,
.header-action-toggle:hover {
    text-shadow: 0 0 0 var(--accent-hover);
}

.header-mobile-menu {
    display: none;
    background: var(--bg-drawer);
    border-top: 1px solid var(--border-mobile);

    /* Remove from sticky container flow — become a fixed overlay */
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 999; /* below header z-index: 1000, so header stays on top */
}

.header-mobile-menu.active { display: block; }
.header-mobile-list li a { padding: 15px 20px; color: var(--text-nav-bottom); font-size: 13px; border-bottom: 1px solid var(--border-mobile); }

/* =====================================================================
7. RESPONSIVE BEHAVIOR
===================================================================== */
@media (max-width: 768px) {

    .header-title { font-size: 19px; }

    .header-topbar-left { font-size: 10px; }
    .topbar-dropdown-caret { display: none; }

    /* Keep panels on-screen: constrain width and prevent right-edge clip */
    .topbar-dropdown-panel { max-width: calc(100vw - 10px); }
    .topbar-dropdown-panel--right { right: 0; left: auto; }

    .header-nav-toggle { display: block; }
    .header-search-toggle, .header-action-toggle { display: inline-flex; }
    .header-search { display: none; }

    .header-container.search-open .header-search { display: flex; position: absolute; left: 0; right: 0; top: 0; bottom: 0; padding: 11px 15px; background-color: var(--bg-void); z-index: 20; gap: 0; }
    .header-container.search-open .header-search .header-search-input { flex: 1 1 auto; min-width: 0; width: auto; }
    .header-container.search-open .header-search .header-search-btn { flex: 0 0 auto; border-radius: 0; }
    .header-container.search-open .header-search-close { display: flex; flex: 0 0 auto; }

    .header-bottombar a { font-size: 0; }
    .header-bottombar a::before { font-size: 18px; margin-right: 0; }
}
