/*
 *  * Refactored theme based on style.css.old
 *   * Aesthetic: Darkroom / Zone System
 *    * Supports both Dark (default) and Light themes via CSS variables.
 *     * Includes a two-column layout for pages with a sidebar.
 *     */

/* 1. THEME VARIABLES DEFINITION */
:root {
  /* Dark Theme (Default) */
  --bg-color: #121212;
  --surface-bg-color: #1e1e1e;
  --text-primary-color: #e0e0e0;
  --text-secondary-color: #b0b0b0;
  --text-tertiary-color: #888;
  --border-color: #333333;
  --accent-primary-color: #a5573e; /* Sepia/Oxide */
  --accent-secondary-color: #d9a441; /* Muted Gold for priority */
  --selection-bg-color: #3a6283;
  --link-hover-color: #e0e0e0;

  /* State Colors */
  --todo-bg-color: #8d4e4e; /* Muted Burgundy */
  --done-bg-color: #556B2F; /* Muted Forest Green */
  --error-color: #cc6666;
  --warning-color: #de935f;

  /* Syntax Highlighting */
  --syntax-comment: #888;
  --syntax-string: #a5573e;
  --syntax-keyword: #81a2be;
  --syntax-function: #b5bd68;
  --syntax-variable: #8abeb7;
  --syntax-constant: #de935f;
  --syntax-type: #b294bb;
  --syntax-builtin: #81a2be;
  --syntax-preprocessor: #b294bb;
}

body.light-theme {
  /* Light Theme Overrides */
  --bg-color: #fcfcfc;
  --surface-bg-color: #f0f0f0;
  --text-primary-color: #1a1a1a;
  --text-secondary-color: #555555;
  --text-tertiary-color: #777;
  --border-color: #cccccc;
  --accent-primary-color: #a5573e; /* Sepia maintains its character */
  --accent-secondary-color: #c78d2c;
  --selection-bg-color: #add8e6; /* Light Blue */
  --link-hover-color: #1a1a1a;

  /* State Colors */
  --todo-bg-color: #d49a9a;
  --done-bg-color: #a3b88b;
  --error-color: #b33e3e;
  --warning-color: #c78d2c;

  /* Syntax Highlighting (adjusted for light background) */
  --syntax-comment: #6a737d;
  --syntax-string: #a5573e;
  --syntax-keyword: #005cc5;
  --syntax-function: #22863a;
  --syntax-variable: #e36209;
  --syntax-constant: #005cc5;
  --syntax-type: #d73a49;
  --syntax-builtin: #6f42c1;
  --syntax-preprocessor: #d73a49;
}


/* 2. BASIC RESET & NORMALIZE */
/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */
html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}progress{vertical-align:baseline}[hidden],template{display:none}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:inherit;font-weight:bolder}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}svg:not(:root){overflow:hidden}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}button,input,optgroup,select,textarea{font:inherit;margin:0}optgroup{font-weight:700}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-input-placeholder{color:inherit;opacity:.54}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}


/* 3. CORE STYLES (using variables) */
body {
    padding: 2% 0; /* Add vertical padding */
    font-size: 14px;
    line-height: 1.4em;
    font-family: Georgia, serif;
    background-color: var(--bg-color);
    color: var(--text-primary-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}


/* 4. LAYOUT (ESTRATÉGIA: SATÉLITE ANCORADO E FLUTUANTE) */

/* A "Âncora": Todos os blocos principais são sempre centralizados. Esta regra é incondicional. */
#header,
#navigation,
#content,
#footer {
    width: 95%;
    max-width: 900px;
    margin: 0 auto;
    box-sizing: border-box;
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5em 0;
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5em auto;
    width: 95%;
    max-width: 900px;
}

/* Regras para telas médias (laptops, tablets) a partir de 601px */
@media screen and (min-width: 601px) {
    /* Padrão para a faixa "laptop" */
    body { font-size: 15px; }

    #header,
    #navigation,
    #content,
    #footer,
    hr { /* HR incluído aqui */
        max-width: 750px;
    }

    /* Regras de tipografia que se aplicam a todas as telas > 600px */
    h1 { font-size: 2em; }
    h2 { font-size: 1.5em; }
    h3 { font-size: 1.3em; }
    h1, h2, h3 { line-height: 1.4em; }
    h4, h5, h6 { font-size: 1.1em; }
    .creator { display: inline; float: right; }
}

/* Sobrescrita APENAS para telas realmente grandes, a partir de 1367px */
@media screen and (min-width: 1367px) {
    body { font-size: 18px; }

    #header,
    #navigation,
    #content,
    #footer,
    hr { /* HR incluído aqui também */
        max-width: 900px;
    }
}

/* Estado 1: Sidebar fixa em telas de médio porte (laptops) */
@media screen and (min-width: 1025px) and (max-width: 1366px) {
    body:has(#sidebar) #sidebar {
        position: fixed;
        top: 150px;
        left: calc(50% + 375px + 2em); /* Alinhado ao miolo de 800px */
        width: 20%;
        max-width: 450px;
        height: calc(100vh - 170px);
        overflow-y: auto;
    }
}

/* Estado 2: Sidebar fixa em telas grandes */
@media screen and (min-width: 1367px) {
    body:has(#sidebar) #sidebar {
        position: fixed;
        top: 150px;
        left: calc(50% + 450px + 2em); /* Alinhado ao miolo de 900px */
        width: 25%;
        max-width: 450px;
        height: calc(100vh - 170px);
        overflow-y: auto;
    }
}

/* Estilo da Sidebar (inalterado) */
/* A NOVA REGRA: Define a família de fontes para a sidebar e seus filhos. */
#sidebar {
    font-family: Helvetica, Arial, sans-serif;
}

#sidebar .outline-2 {
    padding: 1em;
    margin: 0 0 1.5em 0;
    background-color: var(--surface-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 95%;
}

#sidebar h2 {
    font-size: 1.1em;
    margin-top: 0;
    margin-bottom: 0.8em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4em;
}

#sidebar ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
    font-size: 95%;
}

#sidebar li {
    margin-bottom: 0.5em;
    line-height: 1.3;
}

/* Responsividade: Em telas menores, o "satélite" volta ao fluxo normal */
@media screen and (max-width: 1024px) {
    #sidebar {
        position: static;
        width: 95%;
        max-width: 900px;
        margin: 2em auto;
        height: auto;
        overflow-y: visible;
    }
}


/* 5. TYPOGRAPHY AND CONTENT STYLING */

/* Selection */
::-moz-selection { background: var(--selection-bg-color); }
::selection { background: var(--selection-bg-color); }

/* Text Elements */
p { margin: 1em auto; }
dl, ol, ul { margin: 0 auto; }

.title {
    margin: .8em auto;
    color: var(--text-primary-color);
    text-align: center;
}
.subtitle {
    text-align: center;
    font-size: 1.1em;
    line-height: 1.4;
    font-weight: 700;
    margin: 1em auto;
    color: var(--text-secondary-color);
}
.abstract {
    margin: auto;
    width: 80%;
    font-style: italic;
    color: var(--text-secondary-color);
}
.abstract p:last-of-type:before {
    content: "    ";
    white-space: pre;
}
.status {
    font-size: 90%;
    margin: 2em auto;
    color: var(--text-secondary-color);
}

[class^=section-number-] { margin-right:.5em; }
[id^=orgheadline] { clear:both; }

/* Footnotes */
#footnotes {
    font-size: 90%;
    border-top: 1px solid var(--border-color);
    padding-top: 1em;
    margin-top: 2em;
}
.footpara { display: inline; margin:.2em auto; }
.footdef { margin-bottom: 1em; }
.footdef sup { padding-right:.5em; }

/* Links */
a {
    color: var(--accent-primary-color);
    text-decoration: none;
}
a:hover {
    color: var(--link-hover-color);
    border-bottom: 1px dotted var(--link-hover-color);
}

/* Figures and Images */
figure {
    padding: 0;
    margin: 1em auto;
    text-align: center;
}
img {
    max-width: 100%;
    vertical-align: middle;
}
figcaption {
    margin-top: .3em;
    font-size: 90%;
    color: var(--text-secondary-color);
}

/* Headers */
h1, h2, h3, h4, h5, h6 {
    line-height: 1em;
    font-family: Helvetica, sans-serif;
}
h1, h2, h3 { line-height: 1.4em; }
h4, h5, h6 { font-size: 1em; }

h1 { color: var(--accent-primary-color); }
h2, h3, h4, h5, h6 { color: var(--text-secondary-color); }

dt { font-weight: 700; color: var(--text-primary-color); }

/* Tables */
.table-responsive {
    width: 100%;
    margin: 1em auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
div.table-responsive > table {
    margin: 0;
}

table {
    margin: 1em auto;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-collapse: collapse;
    font-size: 90%;
}
table th {
    color: var(--text-primary-color);
    border-bottom: 1px solid var(--border-color);
}
table td+td, table th+th { border-left: 1px solid var(--border-color); }
table tr { border-top: 1px solid var(--border-color); }
td, th { padding:.3em .6em; vertical-align:middle; }
caption.t-above { caption-side:top; }
caption.t-bottom { caption-side:bottom; }
caption { margin-bottom:.3em; color: var(--text-secondary-color); }
th.org-center, th.org-left, th.org-right { text-align:center; }
td.org-right { text-align:right; }
td.org-left { text-align:left; }
td.org-center { text-align:center; }

/* Blockquotes */
blockquote {
    margin: 1em 2em;
    padding-left: 1em;
    border-left: 3px solid var(--border-color);
    color: var(--text-secondary-color);
}

/* KBD, TODO, DONE */
kbd {
    background-color: var(--surface-bg-color);
    color: var(--text-primary-color);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 80%;
    margin: 0 .1em;
    padding: .1em .6em;
    font-family: "Lucida Console", monospace;
}

.todo, .done {
    color: var(--text-primary-color);
    padding: .1em .3em;
    border-radius: 3px;
    background-clip: padding-box;
    font-size: 80%;
    font-family: "Lucida Console", monospace;
    line-height: 1;
}
.todo { background-color: var(--todo-bg-color); }
.done { background-color: var(--done-bg-color); }

.priority {
    color: var(--accent-secondary-color);
    font-family: "Lucida Console",monospace;
}

/* Table of Contents & Tags */
#table-of-contents li { clear:both; }
.tag { font-family: "Lucida Console", monospace; font-size: .7em; font-weight: 400; }
.tag span {
    padding: .3em;
    float: right;
    margin-right: .5em;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background-clip: padding-box;
    color: var(--text-secondary-color);
    background-color: var(--surface-bg-color);
    line-height: 1;
}

/* Timestamps & Org-mode specific classes */
.timestamp { color: var(--text-tertiary-color); font-size: 90%; }
.timestamp-kwd { color: var(--text-tertiary-color); }
.org-right { margin-left: auto; margin-right: 0; text-align: right; }
.org-left { margin-left: 0; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }

/* Preamble & Postamble */
.validation {
    text-align: center;
    margin-top: 1em;
}
.validation p { margin: 0; }

#footer p {
    font-size: 90%;
    margin: .2em auto;
    color: var(--text-secondary-color);
    text-align: center;
}


/* Code Blocks */
:not(pre)>code {
    padding: 2px 5px;
    margin: auto 1px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background-clip: padding-box;
    color: var(--text-primary-color);
    background-color: var(--surface-bg-color);
    font-size: 80%;
    font-family: "Lucida Console", monospace;
}

.org-src-container {
    border: 1px solid var(--border-color);
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    font-family: "Lucida Console", monospace;
    font-size: 80%;
    margin: 1em auto;
    padding: .1em .5em;
    position: relative;
    background-color: var(--surface-bg-color);
}
.org-src-container>pre {
    overflow: auto;
    color: var(--text-primary-color);
}

/* Language labels for code blocks */
.org-src-container>pre:before {
    display: block;
    position: absolute;
    background-color: var(--border-color);
    top: 0;
    right: 0;
    padding: 0 .5em;
    border-bottom-left-radius: 8px;
    border: 0;
    color: var(--text-secondary-color);
    font-size: 80%;
}
/* Preserved from original CSS */
.org-src-container>pre.src-sh:before{content:"sh"}.org-src-container>pre.src-bash:before{content:"bash"}.org-src-container>pre.src-emacs-lisp:before{content:"Emacs Lisp"}.org-src-container>pre.src-R:before{content:"R"}.org-src-container>pre.src-cpp:before{content:"C++"}.org-src-container>pre.src-c:before{content:"C"}.org-src-container>pre.src-html:before{content:"HTML"}.org-src-container>pre.src-javascript:before,.org-src-container>pre.src-js:before{content:"Javascript"}.org-src-container>pre.src-abc:before{content:"ABC"}.org-src-container>pre.src-asymptote:before{content:"Asymptote"}.org-src-container>pre.src-awk:before{content:"Awk"}.org-src-container>pre.src-C:before{content:"C"}.org-src-container>pre.src-calc:before{content:"Calc"}.org-src-container>pre.src-clojure:before{content:"Clojure"}.org-src-container>pre.src-comint:before{content:"comint"}.org-src-container>pre.src-css:before{content:"CSS"}.org-src-container>pre.src-D:before{content:"D"}.org-src-container>pre.src-ditaa:before{content:"Ditaa"}.org-src-container>pre.src-dot:before{content:"Dot"}.org-src-container>pre.src-ebnf:before{content:"ebnf"}.org-src-container>pre.src-forth:before{content:"Forth"}.org-src-container>pre.src-F90:before{content:"Fortran"}.org-src-container>pre.src-gnuplot:before{content:"Gnuplot"}.org-src-container>pre.src-haskell:before{content:"Haskell"}.org-src-container>pre.src-io:before{content:"Io"}.org-src-container>pre.src-java:before{content:"Java"}.org-src-container>pre.src-latex:before{content:"LaTeX"}.org-src-container>pre.src-ledger:before{content:"Ledger"}.org-src-container>pre.src-ly:before{content:"Lilypond"}.org-src-container>pre.src-lisp:before{content:"Lisp"}.org-src-container>pre.src-makefile:before{content:"Make"}.org-src-container>pre.src-matlab:before{content:"Matlab"}.org-src-container>pre.src-max:before{content:"Maxima"}.org-src-container>pre.src-mscgen:before{content:"Mscgen"}.org-src-container>pre.src-Caml:before{content:"Objective"}.org-src-container>pre.src-octave:before{content:"Octave"}.org-src-container>pre.src-org:before{content:"Org"}.org-src-container>pre.src-perl:before{content:"Perl"}.org-src-container>pre.src-picolisp:before{content:"Picolisp"}.org-src-container>pre.src-plantuml:before{content:"PlantUML"}.org-src-container>pre.src-python:before{content:"Python"}.org-src-container>pre.src-ruby:before{content:"Ruby"}.org-src-container>pre.src-sass:before{content:"Sass"}.org-src-container>pre.src-scala:before{content:"Scala"}.org-src-container>pre.src-scheme:before{content:"Scheme"}.org-src-container>pre.src-screen:before{content:"Screen"}.org-src-container>pre.src-sed:before{content:"Sed"}.org-src-container>pre.src-shell:before{content:"shell"}.org-src-container>pre.src-shen:before{content:"Shen"}.org-src-container>pre.src-sql:before{content:"SQL"}.org-src-container>pre.src-sqlite:before{content:"SQLite"}.org-src-container>pre.src-stan:before{content:"Stan"}.org-src-container>pre.src-vala:before{content:"Vala"}.org-src-container>pre.src-axiom:before{content:"Axiom"}.org-src-container>pre.src-browser:before{content:"HTML"}.org-src-container>pre.src-cypher:before{content:"Neo4j"}.org-src-container>pre.src-elixir:before{content:"Elixir"}.org-src-container>pre.src-request:before{content:"http"}.org-src-container>pre.src-ipython:before{content:"iPython"}.org-src-container>pre.src-kotlin:before{content:"Kotlin"}.org-src-container>pre.src-Flavored:before{content:"Erlang lfe"}.org-src-container>pre.src-mongo:before{content:"MongoDB"}.org-src-container>pre.src-prolog:before{content:"Prolog"}.org-src-container>pre.src-rec:before{content:"rec"}.org-src-container>pre.src-ML:before{content:"sml"}.org-src-container>pre.src-Translate:before{content:"translate"}.org-src-container>pre.src-typescript:before{content:"Typescript"}.org-src-container>pre.src-rust:before{content:"Rust"}

/* Simplified Dark Syntax Highlighting */
.org-comment, .org-comment-delimiter { color: var(--syntax-comment); }
.org-string { color: var(--syntax-string); }
.org-keyword { color: var(--syntax-keyword); }
.org-function-name { color: var(--syntax-function); }
.org-variable-name { color: var(--syntax-variable); }
.org-constant { color: var(--syntax-constant); }
.org-type { color: var(--syntax-type); }
.org-builtin { color: var(--syntax-builtin); }
.org-preprocessor, .org-doc { color: var(--syntax-preprocessor); }
.org-warning { color: var(--warning-color); font-weight: normal; }
.org-error { color: var(--error-color); font-weight: normal; }

/* Misc */
#org-div-home-and-up { font-size: 70%; text-align: right; white-space: nowrap; }
.linenr { font-size: 90%; color: var(--text-tertiary-color); }
.code-highlighted { background-color: #444; }
#bibliography { font-size: 90%; }
#bibliography table { width: 100%; }
.creator { display: block; color: var(--text-secondary-color); }
@media screen and (min-width:600px){ .creator{ display:inline; float:right; } }

