/* --- LOCAL NERD FONTS (PROTOCOLO EREMITA) --- */
@font-face { font-family: 'TVA-Font'; src: url('../assets/fonts/3270NerdFontMono-Regular.ttf') format('truetype'); }
@font-face { font-family: 'IBM-Font'; src: url('../assets/fonts/BlexMonoNerdFont-Text.ttf') format('truetype'); }
@font-face { font-family: 'Journal-Font'; src: url('../assets/fonts/iMWritingMonoNerdFont-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Terminal-Font'; src: url('../assets/fonts/0xProtoNerdFont-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Main-Text'; src: url('../assets/fonts/JetBrainsMonoNLNerdFont-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Symbols-Font'; src: url('../assets/fonts/SymbolsNerdFontMono-Regular.ttf') format('truetype'); }

/* --- DICIONÁRIO DE ÍCONES (METÁFORAS CORRIGIDAS) --- */
.ph {
    font-family: 'Symbols-Font' !important;
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    display: inline-block;
    text-align: center;
    width: 1.2em;
    -webkit-font-smoothing: antialiased;
}

.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    fill: currentColor;
    vertical-align: -0.125em;
}

/* --- MAPEAMENTO VISUAL (PENTE FINO) --- */

/* 1. Solzinho (Temas/Contraste) */
.ph-sun-dim::before         { content: "\f0599"; } 

/* 2. Marcador de Página (T∅TBooks) */
.ph-book-open-text::before  { content: "\f02e"; } 

/* 3. A Bomba (HUD Superior - Metáfora de Detonação/Hard Reset) */
.ph-skull::before { 
    content: "\f05c2"; /* nf-md-bomb */
}
/* 4. O Quadro/Frame (Full Screen) */
.ph-corners-out::before     { content: "\f0656"; } 

/* 5. Fontes (O "A" literal) */
.ph-text-aa::before         { content: "\f031"; } 

/* 6. Bloqueio (O Cadeado) */
.ph-lock-key::before        { content: "\f033e"; } 

/* --- OUTROS ÍCONES DE APOIO --- */
.ph-caret-right::before     { content: "\f054"; } 
.ph-folder-open::before     { content: "\f0770"; } 
.ph-list-bullets::before    { content: "\f0ca"; } 
.ph-notepad::before         { content: "\f0219"; } 
.ph-upload-simple::before   { content: "\f093"; } 
.ph-minus::before           { content: "\f068"; } 
.ph-plus::before            { content: "\f067"; } 
.ph-floppy-disk::before     { content: "\f0c7"; } 
.ph-magnifying-glass::before{ content: "\f002"; } 
.ph-speaker-high::before    { content: "\f028"; } 
.ph-package::before         { content: "\f0387"; } 
.ph-file-text::before       { content: "\f15c"; } 
.ph-file::before            { content: "\f016"; } 
.ph-warning::before         { content: "\f071"; } 

/* --- VARIÁVEIS GERAIS --- */
:root {
  --hud-w: 72px;
  --drawer-w: 300px;
  --gap: 24px;
  --controls-h: 48px;
  --transition-speed: 0.3s;
  --glass-blur: blur(12px);
  --shadow-float: 0 8px 32px rgba(0, 0, 0, 0.3);
  --page-height: 1120px;
  --font-display: "Space Grotesk", "IBM-Font", sans-serif;
  --font-body: "Inter", "Main-Text", "IBM-Font", sans-serif;
  --font-quote: "Literata", "Georgia", serif;
  --font-ui: "JetBrains Mono", "Main-Text", "IBM-Font", monospace;
}

/* 1. DEFAULT THEME (Deep Bronze) */
:root {
  --bg-core: #24160f;
  --bg-panel: transparent;
  --bg-drawer: rgba(43, 26, 18, 0.92);
  --bg-controls: rgba(43, 26, 18, 0.86);
  --color-accent: #f2a43b;
  --color-accent-dim: rgba(242, 164, 59, 0.18);
  --color-text: #f2a43b;
  --color-muted: rgba(242, 164, 59, 0.5);
  --border-style: 1px solid rgba(242, 164, 59, 0.18);
  --grid-opacity: 0.12;
  --font-ui: 'IBM-Font', monospace;
  --font-main: 'IBM-Font', monospace;
  --font-mono: 'IBM-Font', monospace;
  --radius: 4px;
  --selection-bg: var(--color-accent);
  --selection-text: var(--bg-core);
}

/* 2. IBM LIGHT */
[data-theme="ibm-light"] {
  --bg-core: #eef2f6;            
  --bg-panel: transparent; 
  --bg-drawer: rgba(255, 255, 255, 0.75);
  --bg-controls: rgba(255, 255, 255, 0.60);
  --color-text: #1e3a66;         
  --color-accent: #2962ff;       
  --color-accent-dim: rgba(41, 98, 255, 0.1);
  --color-muted: #6b7c93;        
  --border-style: 1px solid rgba(41, 98, 255, 0.15);
  --grid-opacity: 0.05;
  --font-ui: 'IBM-Font', monospace;
  --font-main: 'IBM-Font', monospace;
  --font-mono: 'IBM-Font', monospace;
  --radius: 2px; 
  --selection-bg: rgba(41, 98, 255, 0.35);
  --selection-text: #ffffff;
}

/* 3. IBM DARK */
[data-theme="ibm-dark"] {
  --bg-core: #1e3a66;            
  --bg-panel: transparent; 
  --bg-drawer: rgba(13, 24, 41, 0.85);
  --bg-controls: rgba(13, 24, 41, 0.70);
  --color-text: #d0e2ff;         
  --color-accent: #4589ff;       
  --color-accent-dim: rgba(69, 137, 255, 0.15);
  --color-muted: #8fa3c4;        
  --border-style: 1px solid rgba(160, 200, 255, 0.15);
  --grid-opacity: 0.08;
  --font-ui: 'IBM-Font', monospace;
  --font-main: 'IBM-Font', monospace;
  --font-mono: 'IBM-Font', monospace;
  --radius: 2px; 
  --selection-bg: rgba(69, 137, 255, 0.35);
  --selection-text: #ffffff;
}

/* 4. IBM BLUE */
[data-theme="ibm-blue"] {
  --bg-core: #294D81;            
  --bg-panel: transparent; 
  --bg-drawer: rgba(30, 60, 110, 0.85);
  --bg-controls: rgba(30, 60, 110, 0.70);
  --color-text: #ffffff;      
  --color-accent: #64b5f6;      
  --color-accent-dim: rgba(100, 181, 246, 0.2);
  --color-muted: #aab6ce;        
  --border-style: 1px solid rgba(255, 255, 255, 0.15);
  --grid-opacity: 0.1;
  --font-ui: 'IBM-Font', monospace;
  --font-main: 'IBM-Font', monospace;
  --font-mono: 'IBM-Font', monospace;
  --radius: 2px; 
  --selection-bg: rgba(255, 255, 255, 0.35);
  --selection-text: #294D81;
}

/* 5. JORNAL THEME */
[data-theme="journal"] {
  --bg-core: #cfcfcf;
  --bg-panel: transparent;
  --bg-drawer: rgba(236, 236, 236, 0.92);
  --bg-controls: rgba(236, 236, 236, 0.82);
  --color-text: #2a2622; 
  --color-accent: #2a2622; 
  --color-accent-dim: rgba(42, 38, 34, 0.08);
  --color-muted: rgba(42, 38, 34, 0.55);
  --border-style: 1px solid rgba(42, 38, 34, 0.12);
  --grid-opacity: 0.0;
  --font-ui: 'IBM-Font', monospace;
  --font-main: 'IBM-Font', monospace;
  --font-mono: 'IBM-Font', monospace;
  --radius: 2px; 
  --selection-bg: rgba(42, 38, 34, 0.25);
  --selection-text: #ffffff;
}

/* 6. TERMINAL THEME */
[data-theme="terminal"] {
  --bg-core: #000000;
  --bg-panel: transparent;
  --bg-drawer: rgba(0, 20, 0, 0.90);
  --bg-controls: rgba(0, 20, 0, 0.80);
  --color-text: #00ff41; 
  --color-accent: #00ff41;
  --color-accent-dim: rgba(0, 255, 65, 0.15);
  --color-muted: #008f11;
  --border-style: 1px solid rgba(0, 255, 65, 0.25);
  --grid-opacity: 0.15;
  --font-ui: 'IBM-Font', monospace;
  --font-main: 'IBM-Font', monospace;
  --font-mono: 'IBM-Font', monospace;
  --radius: 0px;
  --selection-bg: rgba(0, 255, 65, 0.3);
  --selection-text: #000000;
}

/* 7. AMBER INVERT */
[data-theme="amber-invert"] {
  --bg-core: #f2a43b;
  --bg-panel: transparent;
  --bg-drawer: rgba(242, 164, 59, 0.88);
  --bg-controls: rgba(242, 164, 59, 0.82);
  --color-text: #24160f;
  --color-accent: #24160f;
  --color-accent-dim: rgba(36, 22, 15, 0.18);
  --color-muted: rgba(36, 22, 15, 0.55);
  --border-style: 1px solid rgba(36, 22, 15, 0.18);
  --grid-opacity: 0.12;
  --font-ui: 'IBM-Font', monospace;
  --font-main: 'IBM-Font', monospace;
  --font-mono: 'IBM-Font', monospace;
  --radius: 4px;
  --selection-bg: rgba(36, 22, 15, 0.45);
  --selection-text: #24160f;
}

/* 8. INK DARK (INVERTED GRAY) */
[data-theme="ink-dark"] {
  --bg-core: #1a1a1a;
  --bg-panel: transparent;
  --bg-drawer: rgba(28, 28, 28, 0.92);
  --bg-controls: rgba(28, 28, 28, 0.86);
  --color-text: #cfcfcf;
  --color-accent: #e0e0e0;
  --color-accent-dim: rgba(224, 224, 224, 0.18);
  --color-muted: rgba(207, 207, 207, 0.55);
  --border-style: 1px solid rgba(224, 224, 224, 0.18);
  --grid-opacity: 0.08;
  --font-ui: 'IBM-Font', monospace;
  --font-main: 'IBM-Font', monospace;
  --font-mono: 'IBM-Font', monospace;
  --radius: 2px;
  --selection-bg: rgba(224, 224, 224, 0.45);
  --selection-text: #1a1a1a;
}

/* --- COMPORTAMENTO --- */
* { box-sizing: border-box; outline: none !important; scrollbar-width: none; }

* {
  scrollbar-width: none;
}
*::-webkit-scrollbar {
  width: 0;
  height: 0;
}

html, body {
  height: 100%; width: 100%; margin: 0; overflow: hidden;
  font-family: var(--font-body); color: var(--color-text); background: var(--bg-core);
  transition: background var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1), 
              color var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

body::before {
  content: ""; position: fixed; inset: 0; z-index: -5;
  background-image: none;
  opacity: var(--grid-opacity); pointer-events: none;
  filter: grayscale(10%); 
}
body.booting::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.04) 1px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 3px
  );
  mix-blend-mode: soft-light;
  pointer-events: none;
  animation: bootFlicker 1.2s ease forwards;
}
@keyframes bootFlicker {
  0% { opacity: 0; }
  25% { opacity: 0.35; }
  60% { opacity: 0.18; }
  100% { opacity: 0; }
}

mark { background-color: var(--color-accent); color: var(--bg-core); padding: 2px 4px; border-radius: 2px; }
mark.search-active { box-shadow: 0 0 0 2px var(--color-accent-dim); }
[data-theme="ibm-light"] mark { color: #fff; }
[data-theme="ibm-dark"] mark { color: #fff; }
[data-theme="ibm-blue"] mark { background-color: #fff; color: #294D81; }
[data-theme="journal"] mark { background-color: #555; color: #fff; }

#editor {
    -webkit-hyphens: auto; -moz-hyphens: auto; -ms-hyphens: auto; hyphens: auto;
    text-align: left;
    font-family: var(--font-main);
}

.hud, .controls, .logo-area, .drawer { opacity: 1; transition: opacity 3s ease; }

body.focus-active .hud,
body.focus-active .controls, 
body.focus-active .logo-area,
body.focus-active .drawer { opacity: 0.15; }


body.slow-return .hud,
body.slow-return .controls,
body.logo-area,
body.drawer { transition: opacity 6s ease-in; }
