/*
Theme Name: Plainxplain
Theme URI: https://plainxplain.com
Author: Lorcan
Description: A minimal WordPress theme with fixed left sidebar navigation and light/dark mode. Built for the Plainxplain explainer video studio.
Version: 4.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: plainxplain
*/

/* ==========================================================================
   CSS Reset & Box Sizing
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   Design System — Dark Mode (default)
   ========================================================================== */

:root {
    /* Base */
    --plx-bg: #1E1E1E;
    --plx-text: #FFFFFF;

    /* Surfaces */
    --plx-container: #262624;

    /* Greyscale */
    --plx-dark-grey: #262624;
    --plx-mid-grey: #494947;
    --plx-light-grey: #C9C9C3;

    /* Accent Blues */
    --plx-accent: #7BC1EC;
    --plx-accent-bright: #9DE3F1;
    --plx-accent-muted: #4F6B70;

    /* Highlight */
    --plx-highlight: #FFE82D;

    /* Code */
    --plx-code-bg: #2A2A28;
    --plx-code-border: #3A3A38;

    /* Layout */
    --plx-sidebar-width: 260px;
    --plx-mobile-header-height: 56px;
}

/* ==========================================================================
   Design System — Light Mode
   ========================================================================== */

[data-theme="light"] {
    --plx-bg: #FAFAFA;
    --plx-text: #262624;

    --plx-container: #FFFFFF;

    --plx-dark-grey: #E2E1DD;
    --plx-mid-grey: #9A9A94;
    --plx-light-grey: #494947;

    --plx-accent: #2E9AD0;
    --plx-accent-bright: #1A8DC7;
    --plx-accent-muted: #2E9AD0;

    --plx-highlight: #FFE82D;

    --plx-code-bg: #E6E5E1;
    --plx-code-border: #D0CFCB;
}

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

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=Manrope:wght@400;600;700&display=swap');

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.7;
    color: var(--plx-text);
    background-color: var(--plx-bg);
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Manrope', sans-serif;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1.2em;
    max-width: 680px;
}

a {
    color: var(--plx-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover,
a:focus {
    color: var(--plx-accent-bright);
}

/* ==========================================================================
   Layout — Sidebar + Content (Desktop)
   ========================================================================== */

.plx-site {
    display: flex;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Sidebar --- */

.plx-sidebar {
    position: sticky;
    top: 0;
    width: var(--plx-sidebar-width);
    height: 100vh;
    min-width: var(--plx-sidebar-width);
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.plx-logo {
    margin-bottom: 3rem;
}

.plx-logo img,
.plx-logo svg {
    max-width: 180px;
    height: auto;
}

/* Logo swap for light/dark mode */
.plx-logo-dark {
    display: block;
}

.plx-logo-light {
    display: none;
}

[data-theme="light"] .plx-logo-dark {
    display: none;
}

[data-theme="light"] .plx-logo-light {
    display: block;
}

/* --- Navigation --- */

.plx-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.plx-nav a {
    display: flex;
    align-items: center;
    padding: 0.6rem 0;
    color: var(--plx-light-grey);
    font-family: 'Manrope', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    transition: color 0.2s ease;
}

.plx-nav a:hover {
    color: var(--plx-accent);
}

.plx-nav a.active {
    color: var(--plx-accent);
}

/* Active indicator — vertical bar */
.plx-nav a.active::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 1em;
    background-color: var(--plx-accent);
    margin-right: 0.75rem;
    border-radius: 1px;
}

.plx-nav a:not(.active)::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 1em;
    background-color: transparent;
    margin-right: 0.75rem;
}

/* --- Main Content --- */

.plx-content {
    flex: 1;
    padding: 4rem 6rem;
    min-height: 100vh;
    max-width: 900px;
}

/* ==========================================================================
   Sidebar Footer
   ========================================================================== */

.plx-sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
}

.plx-social {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
}

.plx-social-link {
    color: var(--plx-light-grey);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    text-decoration: none;
    transition: color 0.2s ease;
}

.plx-social-link:hover {
    color: var(--plx-accent);
}

.plx-copyright {
    color: var(--plx-mid-grey);
    font-size: 0.75rem;
    font-weight: 400;
}

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

.plx-theme-toggle {
    background: none;
    border: none;
    color: var(--plx-light-grey);
    padding: 0.4rem;
    cursor: pointer;
    transition: color 0.2s ease;
    margin-bottom: 1rem;
    align-self: flex-start;
    display: flex;
    align-items: center;
}

.plx-theme-toggle:hover {
    color: var(--plx-text);
}

/* Dark mode (default): show sun, hide moon */
.plx-icon-sun {
    display: block;
}

.plx-icon-moon {
    display: none;
}

/* Light mode: show moon, hide sun */
[data-theme="light"] .plx-icon-sun {
    display: none;
}

[data-theme="light"] .plx-icon-moon {
    display: block;
}

/* ==========================================================================
   Containers & Surfaces
   ========================================================================== */

.plx-card {
    background-color: var(--plx-container);
    border-radius: 4px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.plx-divider {
    border: none;
    border-top: 1px solid var(--plx-mid-grey);
    margin: 2rem 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.plx-btn {
    display: inline-block;
    padding: 0.7rem 1.8rem;
    background-color: var(--plx-accent-muted);
    color: #FFFFFF;
    font-family: 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.plx-btn:hover {
    background-color: var(--plx-accent);
    color: #FFFFFF;
}

/* ==========================================================================
   Secondary text
   ========================================================================== */

.plx-secondary {
    color: var(--plx-light-grey);
}

.plx-small {
    font-size: 0.875rem;
}

/* ==========================================================================
   Images
   ========================================================================== */

img {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   Code Blocks
   ========================================================================== */

code,
kbd,
samp {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 0.875em;
    background-color: var(--plx-code-bg);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

pre {
    background-color: var(--plx-code-bg);
    border: 1px solid var(--plx-code-border);
    border-radius: 4px;
    padding: 1.5rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    max-width: 900px;
}

pre code {
    background: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--plx-text);
}

.wp-block-code {
    background-color: var(--plx-code-bg);
    border: 1px solid var(--plx-code-border);
    border-radius: 4px;
    padding: 1.5rem;
}

/* ==========================================================================
   WordPress defaults
   ========================================================================== */

.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;
}

/* ==========================================================================
   WordPress Block Editor compatibility
   ========================================================================== */

.wp-block-image {
    margin-bottom: 1.5rem;
}

.wp-block-separator {
    border-top: 1px solid var(--plx-mid-grey);
    margin: 2rem 0;
}

.entry-content ul,
.entry-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1.2em;
}

.entry-content li {
    margin-bottom: 0.4em;
}

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

.plx-404 {
    padding-top: 4rem;
}

.plx-404 h1 {
    margin-bottom: 1rem;
}

.plx-404 .plx-btn {
    margin-top: 2rem;
}

/* ==========================================================================
   Blog Post — Single
   ========================================================================== */

.plx-featured-image {
    margin: 2rem 0;
    max-width: 900px;
}

.plx-featured-image img {
    border-radius: 4px;
}

/* ==========================================================================
   Blog Post — Archive / List
   ========================================================================== */

.plx-post-list {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.plx-post-list article {
    border-bottom: 1px solid var(--plx-mid-grey);
    padding-bottom: 3rem;
}

.plx-post-list article:last-child {
    border-bottom: none;
}

.plx-read-more {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--plx-accent);
    font-weight: 500;
}

.plx-read-more:hover {
    color: var(--plx-accent-bright);
}

/* ==========================================================================
   Page Footer (optional per-page)
   ========================================================================== */

.plx-page-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--plx-mid-grey);
    max-width: 680px;
}

.plx-page-footer p {
    color: var(--plx-light-grey);
    font-size: 0.85rem;
}

/* ==========================================================================
   Mobile Header Bar
   ========================================================================== */

.plx-mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--plx-mobile-header-height);
    background-color: var(--plx-bg);
    z-index: 200;
    padding: 0 1.5rem;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.3s ease;
}

.plx-mobile-logo {
    display: flex;
    align-items: center;
}

.plx-mobile-logo img,
.plx-mobile-logo svg {
    max-height: 28px;
    width: auto;
}

/* Mobile logo swap for light/dark */
.plx-mobile-logo .plx-logo-dark {
    display: block;
}

.plx-mobile-logo .plx-logo-light {
    display: none;
}

[data-theme="light"] .plx-mobile-logo .plx-logo-dark {
    display: none;
}

[data-theme="light"] .plx-mobile-logo .plx-logo-light {
    display: block;
}

.plx-mobile-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 0;
    color: var(--plx-light-grey);
    font-family: 'Manrope', sans-serif;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 0.2s ease;
}

.plx-mobile-menu-btn:hover {
    color: var(--plx-text);
}

.plx-mobile-menu-btn .plx-hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.plx-mobile-menu-btn .plx-hamburger-icon span {
    display: block;
    width: 20px;
    height: 1.5px;
    background-color: var(--plx-light-grey);
    transition: all 0.3s ease;
}

/* Mobile dropdown nav */
.plx-mobile-nav {
    display: none;
    position: fixed;
    top: var(--plx-mobile-header-height);
    left: 0;
    right: 0;
    background-color: var(--plx-bg);
    z-index: 190;
    padding: 1.5rem;
    border-top: 1px solid var(--plx-mid-grey);
    transition: background-color 0.3s ease;
}

.plx-mobile-nav.open {
    display: block;
}

.plx-mobile-nav a {
    display: block;
    padding: 0.8rem 0;
    color: var(--plx-light-grey);
    font-family: 'Manrope', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    transition: color 0.2s ease;
}

.plx-mobile-nav a:hover {
    color: var(--plx-text);
}

.plx-mobile-nav a.active {
    color: var(--plx-accent);
}

.plx-mobile-nav-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--plx-mid-grey);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.plx-mobile-social {
    display: flex;
    gap: 1rem;
}

.plx-mobile-social a {
    font-size: 0.8rem;
    padding: 0;
    text-transform: none;
    letter-spacing: 0;
}

/* ==========================================================================
   Responsive — Mobile
   ========================================================================== */

@media (max-width: 768px) {
    .plx-mobile-header {
        display: flex;
    }

    .plx-sidebar {
        display: none;
    }

    .plx-content {
        padding: 1.5rem;
        padding-top: calc(var(--plx-mobile-header-height) + 1.5rem);
        max-width: 100%;
    }

    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    pre {
        padding: 1rem;
        font-size: 0.8rem;
    }
}
