/*
Theme Name: Alan's Lab
Theme URI: https://alanakra.fr
Author: Alan Akra
Author URI: https://alanakra.fr
Description: A clean, minimal blog theme for DevSecOps, Cybersecurity, and HomeLab content. Features dark/light mode, reading time estimation, and colored category labels.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: alanslab
Tags: blog, one-column, custom-menu, dark-mode, translation-ready
*/

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
    --accent: 124, 58, 237;
    --accent-gradient: linear-gradient(45deg, rgb(var(--accent)), #da62c4 30%, white 60%);
}

html.dark {
    --background-color: #121212;
    --text-color: #ffffff;
    --alt-color: #1589CE;
}

html.light {
    --background-color: #F6F6F6;
    --text-color: #000000;
    --alt-color: #185F6D;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

*,
*::before {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    list-style: none;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 40px;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    font-family: "Roboto", monospace;
}

@media screen and (max-width: 450px) {
    body {
        padding: 16px;
    }
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1,
h2 {
    font-family: 'Poppins', sans-serif;
    margin: 12px 0;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
}

.text-gradient {
    background-image: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 400%;
    background-position: 0%;
}

i {
    font-size: 1.5rem;
}

/* ==========================================================================
   Container
   ========================================================================== */

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.container>p {
    font-family: "Roboto", monospace;
    font-size: 1.5rem;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.site-header nav>a {
    font-family: 'Poppins', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 20px;
    text-decoration: none;
}

.site-header nav a {
    text-decoration: none;
}

.site-header nav ul {
    color: var(--text-color);
    font-size: 2rem;
    display: flex;
    gap: 24px;
    font-family: 'Roboto', monospace;
}

.site-header nav ul li {
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-header nav ul li button {
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-header nav ul li button i {
    font-size: 2.5rem;
}

.site-header nav ul li a {
    color: var(--text-color);
}

.site-header nav ul li a i {
    font-size: 2.5rem;
}

.site-header nav ul li a span {
    font-family: "Roboto", monospace;
}

@media screen and (max-width: 550px) {
    .site-header nav {
        flex-direction: column !important;
    }
}

/* ==========================================================================
   Labels / Tags
   ========================================================================== */

.label {
    border-width: 1px;
    border-radius: 999px;
    border-style: solid;
    font-size: 14px;
    line-height: 1;
    white-space: nowrap;
    height: 24px;
    padding: 0px 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-color: transparent;
    font-weight: 600;
    text-decoration: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

.label-beta {
    background-color: #8250DF;
    color: black;
}

/* Category Colors */
.label-homelab {
    background-color: #22c55e;
    color: #000;
}

.label-grc {
    background-color: #f59e0b;
    color: #000;
}

.label-devops {
    background-color: #3b82f6;
    color: #fff;
}

.label-devsecops {
    background-color: #8b5cf6;
    color: #fff;
}

.label-cybersecurity {
    background-color: #ef4444;
    color: #fff;
}

.label-default {
    background-color: #6b7280;
    color: #fff;
    text-decoration: none;
}

.label-code {
    background-color: #06b6d4;
    color: #000;
}

/* ==========================================================================
   Article List (Homepage)
   ========================================================================== */

.intro {
    font-family: 'Roboto Mono', monospace !important;
}

.project-container {
    margin-top: 40px;
}

.project-container li {
    font-size: 1.25rem;
    font-family: 'Roboto', monospace;
}

.project-container li:not(:last-child) {
    margin: 1rem 0;
    border-bottom: solid var(--text-color) 1px;
}

.project-container li a {
    color: var(--text-color);
    text-decoration: none;
}

.project-container li section {
    margin: 1rem 0;
}

.project-container li section .meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.project-container li section .date {
    display: inline-block;
}

.project-container li section .reading-time {
    font-size: 0.9rem;
    color: var(--alt-color);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.project-container li section .categories {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: .4rem;
}

.project-container li section h2 {
    color: var(--alt-color);
    font-size: inherit;
    font-weight: inherit;
}

/* ==========================================================================
   Single Article
   ========================================================================== */

.single-post .container p {
    font-family: "Roboto", monospace;
    margin-bottom: 1rem;
}

.single-post .container .date {
    display: inline-block;
}

.single-post .post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    font-family: 'Roboto', monospace;
}

.single-post .reading-time {
    font-size: 1rem;
    color: var(--alt-color);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.single-post .categories {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.post-content {
    font-family: "Roboto", sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.post-content ul,
.post-content ol {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
    list-style: disc;
}

.post-content ol {
    list-style: decimal;
}

.post-content a {
    color: var(--alt-color);
}

/* ==========================================================================
   Post Navigation (Previous/Next)
   ========================================================================== */

.post-navigation {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--text-color);
}

.post-navigation .nav-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media screen and (max-width: 600px) {
    .post-navigation .nav-links {
        grid-template-columns: 1fr;
    }
}

.post-navigation .nav-previous,
.post-navigation .nav-next {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(var(--accent), 0.1), rgba(218, 98, 196, 0.1));
    border: 1px solid rgba(var(--accent), 0.3);
    transition: all 0.3s ease;
}

.post-navigation .nav-next {
    text-align: right;
    margin-left: auto;
}

.post-navigation .nav-previous:hover,
.post-navigation .nav-next:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(var(--accent), 0.2);
    border-color: rgba(var(--accent), 0.6);
}

.post-navigation a {
    text-decoration: none;
    color: var(--text-color);
}

.post-navigation .nav-subtitle {
    font-size: 0.85rem;
    font-family: 'Roboto Mono', monospace;
    color: var(--alt-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-navigation .nav-previous .nav-subtitle::before {
    content: "←";
}

.post-navigation .nav-next .nav-subtitle::after {
    content: "→";
}

.post-navigation .nav-next .nav-subtitle {
    justify-content: flex-end;
}

.post-navigation .nav-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-color);
    transition: color 0.2s ease;
}

.post-navigation a:hover .nav-title {
    color: var(--alt-color);
}

/* ==========================================================================
   Dark Mode Toggle
   ========================================================================== */

.dark-mode-toggle {
    cursor: pointer;
    font-size: 2.5rem;
    background: none;
    border: none;
    color: var(--text-color);
    padding: 0;
}

.dark-mode-toggle:hover {
    opacity: 0.8;
}

/* ==========================================================================
   Language Switcher (Polylang)
   ========================================================================== */

.lang-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    text-decoration: none;
    font-family: 'Roboto', sans-serif;
    font-size: 1.7rem;
    font-weight: 600;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    transition: background-color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.lang-toggle:hover {
    background-color: var(--alt-color);
    color: #fff;
    transform: scale(1.1);
}

/* ==========================================================================
   WordPress Core Styles
   ========================================================================== */

.alignleft {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
}

.alignright {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1rem;
}

.wp-caption {
    max-width: 100%;
}

.wp-caption-text {
    font-size: 0.875rem;
    text-align: center;
    color: var(--text-color);
    opacity: 0.7;
}

/* ==========================================================================
   Prism.js Syntax Highlighting (a11y-dark theme)
   ========================================================================== */

.wp-block-code code {
    color: #f8f8f2;
    padding-left: 0;
    border: none;
    overflow-x: initial;
}

code[class*='language-'],
pre[class*='language-'] {
    color: #f8f8f2;
    background: none;
    font-family: Hack, 'Fira Code', Consolas, Menlo, Monaco, 'Andale Mono',
        'Lucida Console', 'Lucida Sans Typewriter', 'DejaVu Sans Mono',
        'Bitstream Vera Sans Mono', 'Liberation Mono', 'Nimbus Mono L',
        'Courier New', Courier, monospace;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
    line-height: 1.5;
    -moz-tab-size: 4;
    -o-tab-size: 4;
    tab-size: 4;
    -webkit-hyphens: none;
    -moz-hyphens: none;
    -ms-hyphens: none;
    hyphens: none;
}

pre.wp-block-code {
    background: #2b2b2b;
    padding: 1em;
    margin: 0.5em auto;
    overflow: auto;
    border-radius: 0.3em;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #d4d0ab;
}

.token.punctuation {
    color: #fefefe;
}

.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
    color: #ffa07a;
}

.token.boolean,
.token.number {
    color: #00e0e0;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: #abe338;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
    color: #00e0e0;
}

.token.atrule,
.token.attr-value,
.token.function {
    color: #ffd700;
}

.token.keyword {
    color: #00e0e0;
}

.token.regex,
.token.important {
    color: #ffd700;
}

.token.important,
.token.bold {
    font-weight: bold;
}

.token.italic {
    font-style: italic;
}

.token.entity {
    cursor: help;
}

/* Line numbers for code blocks */
pre.line-numbers {
    position: relative;
    padding-left: 3.8em;
    counter-reset: linenumber;
}

pre.line-numbers>code {
    position: relative;
    padding-top: 0 !important;
}

.line-numbers .line-numbers-rows {
    position: absolute;
    pointer-events: none;
    top: 0;
    font-size: 100%;
    left: -3.8em;
    width: 3em;
    letter-spacing: -1px;
    border-right: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.line-numbers-rows>span {
    pointer-events: none;
    display: block;
    counter-increment: linenumber;
}

.line-numbers-rows>span:before {
    content: counter(linenumber);
    color: #5c6370;
    display: block;
    padding-right: 0.8em;
    text-align: right;
}

.prism-titlename {
    margin: -14px -12px 24px -12px;
    padding: 4px 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    font-weight: bold;
    color: orange;
    background-color: #444;
}

/* ==========================================================================
   404 Page
   ========================================================================== */

.error-404 {
    text-align: center;
    padding: 60px 20px;
}

.error-404 h1 {
    font-size: 6rem;
    margin-bottom: 0;
}

.error-404 p {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.error-404 a {
    color: var(--alt-color);
    text-decoration: none;
    font-weight: 600;
}

.error-404 a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 40px;
}

.pagination a,
.pagination span {
    padding: 8px 16px;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
}

.pagination a:hover {
    background-color: var(--alt-color);
    border-color: var(--alt-color);
    color: #fff;
}

.pagination .current {
    background-color: var(--alt-color);
    border-color: var(--alt-color);
    color: #fff;
}