/* ==========================================================================
   main.css — pasoftdev.net Revamp
   CSS Reset, Custom Properties (3 themes), Typography, Sidebar Layout,
   Navigation, Article Styles, Theme Switcher, Responsive Breakpoints
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Reset (Modern)
   -------------------------------------------------------------------------- */

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

* {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
    font-size: 100%;
}

@media (min-width: 1200px) {
    html {
        font-size: 106.25%; /* 17px */
    }
}

body {
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

a {
    color: inherit;
    text-decoration: none;
}

ul,
ol {
    list-style: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
    line-height: 1.2;
}

p {
    overflow-wrap: break-word;
}

fieldset {
    border: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   Theme 1: "Light" (DEFAULT)
   White background, blue primary (#2563eb), clean modern feel
   -------------------------------------------------------------------------- */

:root,
[data-theme="light"] {
    --color-primary:     #2563eb;
    --color-primary-rgb: 37, 99, 235;
    --color-accent:      #2563eb;
    --color-accent-rgb:  37, 99, 235;
    --color-heading:     #1e293b;
    --color-text:        #1e293b;
    --color-text-muted:  #4a5568;
    --color-text-light:  #6b7280;
    --color-bg:          #f9fafb;
    --color-bg-alt:      #f1f5f9;
    --color-card:        #ffffff;
    --color-border:      #e2e8f0;
    --color-border-dark: #cbd5e0;
    --color-sidebar-bg:  #ffffff;
    --color-sidebar-text:#1e293b;
    --color-sidebar-hover:rgba(37, 99, 235, 0.08);
    --color-sidebar-active:rgba(37, 99, 235, 0.12);
    --color-footer-bg:   #f1f5f9;

    /* Highlight colors */
    --hl-gold:   #fef3c7;
    --hl-blue:   #dbeafe;
    --hl-green:  #dcfce7;
    --hl-red:    #fee2e2;

    /* Bot colors */
    --bot-monsieur:  #2563eb;
    --bot-sherlock:  #1d4ed8;
    --bot-geppetto:  #16a34a;
    --bot-professor: #ea580c;
    --bot-sparkle:   #d97706;
    --bot-crabby:    #dc2626;
    --bot-noob:      #0891b2;
    --bot-padre:     #7e22ce;
    --bot-friar:     #a16207;
    --bot-byte:      #475569;
    --bot-user1:     #7c3aed;
    --bot-claude:    #6b7280;

    /* Font families — system stacks, no external requests */
    --font-heading:   system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-body:      Georgia, 'Times New Roman', serif;
    --font-mono:      'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

    /* Font sizes */
    --text-xs:   0.75rem;
    --text-sm:   0.875rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;
    --text-4xl:  2.25rem;

    /* Spacing */
    --space-1:   0.25rem;
    --space-2:   0.5rem;
    --space-3:   0.75rem;
    --space-4:   1rem;
    --space-5:   1.25rem;
    --space-6:   1.5rem;
    --space-8:   2rem;
    --space-10:  2.5rem;
    --space-12:  3rem;
    --space-16:  4rem;

    /* Border radius */
    --radius-sm:   0.25rem;
    --radius-md:   0.5rem;
    --radius-lg:   0.75rem;
    --radius-xl:   1rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md:  0 4px 6px -1px rgba(0, 0, 0, 0.1),
                  0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.1),
                  0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl:  0 20px 25px -5px rgba(0, 0, 0, 0.1),
                  0 8px 10px -6px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast:   150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow:   400ms ease;

    /* Layout */
    --sidebar-width: 250px;
    --top-bar-height: 56px;
    --content-max-width: 900px;
    --wizard-max-width: 1000px;
}


/* --------------------------------------------------------------------------
   Theme 2: "Blueprint"
   Light blue-gray background, orange accent, engineering feel
   -------------------------------------------------------------------------- */

[data-theme="blueprint"] {
    --color-primary:     #dd6b20;
    --color-primary-rgb: 221, 107, 32;
    --color-accent:      #dd6b20;
    --color-accent-rgb:  221, 107, 32;
    --color-heading:     #2d3748;
    --color-text:        #2d3748;
    --color-text-muted:  #4a5568;
    --color-text-light:  #718096;
    --color-bg:          #f0f4f8;
    --color-bg-alt:      #e2e8f0;
    --color-card:        #ffffff;
    --color-border:      #cbd5e0;
    --color-border-dark: #a0aec0;
    --color-sidebar-bg:  #edf2f7;
    --color-sidebar-text:#2d3748;
    --color-sidebar-hover:rgba(221, 107, 32, 0.08);
    --color-sidebar-active:rgba(221, 107, 32, 0.12);
    --color-footer-bg:   #e2e8f0;
}


/* --------------------------------------------------------------------------
   Theme 3: "Workshop"
   Dark theme — deep navy, amber accent, maker's workshop at night
   -------------------------------------------------------------------------- */

[data-theme="workshop"] {
    --color-primary:     #f6ad55;
    --color-primary-rgb: 246, 173, 85;
    --color-accent:      #f6ad55;
    --color-accent-rgb:  246, 173, 85;
    --color-heading:     #e2e8f0;
    --color-text:        #e2e8f0;
    --color-text-muted:  #a0aec0;
    --color-text-light:  #718096;
    --color-bg:          #0f172a;
    --color-bg-alt:      #1e293b;
    --color-card:        #1e293b;
    --color-border:      #334155;
    --color-border-dark: #475569;
    --color-sidebar-bg:  #1e293b;
    --color-sidebar-text:#e2e8f0;
    --color-sidebar-hover:rgba(246, 173, 85, 0.1);
    --color-sidebar-active:rgba(246, 173, 85, 0.15);
    --color-footer-bg:   #1e293b;

    --hl-gold:   rgba(251, 191, 36, 0.15);
    --hl-blue:   rgba(59, 130, 246, 0.15);
    --hl-green:  rgba(34, 197, 94, 0.15);
    --hl-red:    rgba(239, 68, 68, 0.15);

    --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md:  0 4px 6px -1px rgba(0, 0, 0, 0.4),
                  0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.4),
                  0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl:  0 20px 25px -5px rgba(0, 0, 0, 0.4),
                  0 8px 10px -6px rgba(0, 0, 0, 0.3);
}


/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--color-text);
    background-color: var(--color-bg);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-heading);
    font-weight: 600;
    margin-bottom: var(--space-3);
}

h1 {
    font-size: var(--text-4xl);
    font-weight: 300;
    letter-spacing: -0.025em;
}

h2 {
    font-size: var(--text-2xl);
}

h3 {
    font-size: var(--text-xl);
    font-weight: 500;
}

h4 {
    font-size: var(--text-lg);
    font-weight: 500;
    color: var(--color-text-muted);
}

h5 {
    font-size: var(--text-base);
    font-weight: 600;
}

h6 {
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (min-width: 768px) {
    h1 { font-size: var(--text-4xl); }
    h2 { font-size: var(--text-3xl); }
    h3 { font-size: var(--text-2xl); }
}

p {
    margin-bottom: var(--space-4);
    line-height: 1.7;
}

a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-heading);
}

strong {
    font-weight: 700;
}

em {
    font-style: italic;
}

small, .text-sm {
    font-size: var(--text-sm);
}

.text-xs {
    font-size: var(--text-xs);
}

.text-muted {
    color: var(--color-text-muted);
}

code, kbd, samp {
    font-family: var(--font-mono);
    font-size: 0.875em;
}

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-8) 0;
}

::selection {
    background-color: rgba(var(--color-primary-rgb), 0.15);
    color: var(--color-heading);
}


/* --------------------------------------------------------------------------
   Sidebar Layout — CSS Grid
   -------------------------------------------------------------------------- */

.site-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.site-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-sidebar-bg);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.site-main {
    grid-column: 2;
    min-width: 0;
}


/* --------------------------------------------------------------------------
   Sidebar: Logo
   -------------------------------------------------------------------------- */

.sidebar-logo {
    padding: var(--space-6) var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.sidebar-logo a {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-heading);
    text-decoration: none;
    letter-spacing: -0.02em;
    display: block;
}

.sidebar-logo a:hover {
    color: var(--color-primary);
}

.sidebar-logo-img {
    width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}


/* --------------------------------------------------------------------------
   Sidebar: Navigation
   -------------------------------------------------------------------------- */

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) 0;
}

.sidebar-nav a {
    display: block;
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-sidebar-text);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--color-sidebar-hover);
    color: var(--color-primary);
}

.sidebar-nav a.active {
    background: var(--color-sidebar-active);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    font-weight: 600;
}

.sidebar-nav-divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-2) var(--space-5);
}


/* --------------------------------------------------------------------------
   Sidebar: Theme Switcher
   -------------------------------------------------------------------------- */

.sidebar-theme {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border);
}

.sidebar-theme-label {
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-light);
    margin-bottom: var(--space-2);
}

.theme-buttons {
    display: flex;
    gap: var(--space-1);
}

.theme-buttons button {
    flex: 1;
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: 500;
    padding: var(--space-2) var(--space-1);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
    text-align: center;
}

.theme-buttons button:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.theme-buttons button.active {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
}


/* --------------------------------------------------------------------------
   Mobile Navigation
   -------------------------------------------------------------------------- */

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--top-bar-height);
    background: var(--color-sidebar-bg);
    border-bottom: 1px solid var(--color-border);
    z-index: 200;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
}

.mobile-header-logo {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-heading);
    text-decoration: none;
}

.hamburger-btn {
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
    transition: all var(--transition-fast);
}

.hamburger-btn.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.open span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.visible {
    display: block;
}

@media (max-width: 767px) {
    .site-layout {
        grid-template-columns: 1fr;
    }

    .site-sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        z-index: 200;
    }

    .site-sidebar.open {
        transform: translateX(0);
    }

    .site-main {
        grid-column: 1;
        padding-top: var(--top-bar-height);
    }

    .mobile-header {
        display: flex;
    }
}


/* --------------------------------------------------------------------------
   Content Area — Page-level
   -------------------------------------------------------------------------- */

.page-content {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
}


/* --------------------------------------------------------------------------
   Homepage — Hero + Cards
   -------------------------------------------------------------------------- */

.hero {
    text-align: center;
    padding: var(--space-16) var(--space-6) var(--space-12);
    max-width: 800px;
    margin: 0 auto;
}

.hero-tagline {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 5vw, var(--text-4xl));
    font-weight: 300;
    color: var(--color-heading);
    line-height: 1.25;
    margin-bottom: var(--space-2);
    letter-spacing: -0.025em;
}

.hero-tagline-accent {
    display: block;
    color: var(--color-primary);
    font-weight: 500;
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    max-width: 600px;
    margin: var(--space-6) auto 0;
    line-height: 1.7;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-6);
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 var(--space-6) var(--space-16);
}

.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

.card-thumb {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.card-title {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-heading);
    margin-bottom: var(--space-2);
}

.card-meta {
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    color: var(--color-text-light);
    margin-bottom: var(--space-3);
}

.card-desc {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: 1.6;
    flex-grow: 1;
}

.card-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-primary);
    background: rgba(var(--color-primary-rgb), 0.08);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
    margin-top: var(--space-4);
}


/* --------------------------------------------------------------------------
   Article Styles — Robot build logs
   -------------------------------------------------------------------------- */

.article-header {
    padding: var(--space-10) 0 var(--space-6);
    border-bottom: 2px solid var(--color-primary);
    margin-bottom: var(--space-8);
}

.article-header h1 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-2);
}

@media (min-width: 768px) {
    .article-header h1 {
        font-size: var(--text-4xl);
    }
}

.article-date {
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    color: var(--color-text-light);
}

.article-category {
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-2);
}

.article-body h2 {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--color-heading);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: var(--space-2);
    margin-top: var(--space-10);
    margin-bottom: var(--space-4);
}

.article-body h3 {
    font-size: var(--text-xl);
    font-weight: 500;
    margin-top: var(--space-8);
    margin-bottom: var(--space-3);
}

.article-body h4 {
    font-size: var(--text-lg);
    font-weight: 500;
    color: var(--color-text-muted);
    margin-top: var(--space-6);
    margin-bottom: var(--space-2);
}

.article-body p {
    margin-bottom: var(--space-4);
    line-height: 1.7;
}

.article-body ul,
.article-body ol {
    margin: var(--space-3) 0 var(--space-4) 0;
    padding-left: var(--space-6);
}

.article-body ul {
    list-style-type: disc;
}

.article-body ol {
    list-style-type: decimal;
}

.article-body li {
    margin-bottom: var(--space-2);
    line-height: 1.6;
}

.article-body li::marker {
    color: var(--color-primary);
}

.article-body blockquote {
    border-left: 3px solid var(--color-primary);
    margin: var(--space-4) 0;
    padding: var(--space-3) var(--space-4);
    background: rgba(var(--color-primary-rgb), 0.04);
    font-style: italic;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.article-body blockquote p {
    margin-bottom: var(--space-2);
}

.article-body blockquote p:last-child {
    margin-bottom: 0;
}

.article-body figure {
    margin: var(--space-6) 0;
}

.article-body figure img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.article-body figcaption {
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    color: var(--color-text-light);
    text-align: center;
    margin-top: var(--space-2);
    font-style: italic;
    line-height: 1.5;
}

.article-body a {
    color: var(--color-primary);
    text-decoration: underline;
}

.article-body a:hover {
    color: var(--color-heading);
}


/* --------------------------------------------------------------------------
   YouTube Embed — Responsive container
   -------------------------------------------------------------------------- */

.video-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    margin: var(--space-6) 0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}


/* --------------------------------------------------------------------------
   References Section
   -------------------------------------------------------------------------- */

.references ul {
    list-style: none;
    padding: 0;
}

.references li {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-sm);
    line-height: 1.6;
}

.references li:last-child {
    border-bottom: none;
}


/* --------------------------------------------------------------------------
   About Page
   -------------------------------------------------------------------------- */

.about-content {
    max-width: 700px;
}

.about-content p {
    font-size: var(--text-lg);
    line-height: 1.8;
    margin-bottom: var(--space-6);
}

.about-content figure {
    margin: var(--space-6) 0;
}

.about-content figure img {
    border-radius: var(--radius-md);
}


/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
    text-align: center;
    padding: var(--space-8) var(--space-6);
    border-top: 1px solid var(--color-border);
    background: var(--color-footer-bg);
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    color: var(--color-text-light);
    margin-top: var(--space-16);
}

.site-footer a {
    color: var(--color-primary);
}
