/**
 * Ink & Vellum Design Token System
 * 
 * Defines the core color palettes, typography, and semantic tokens
 * for the "Darkroom Lab" and "Architect's Blueprint" theme modes.
 *
 * @package printertestpage
 */

:root {
    /* Palette: Base Colors */
    --ink-nocturnal: #0a0c10;     /* Deep, near-black for Dark mode base */
    --key-black: #1a1d23;          /* Secondary dark surface */
    --vellum-white: #ffffff;      /* Pure white */
    --paper-vellum: #fdfdfc;      /* Slightly warm off-white for Light mode base */
    --cyan-truth: #00e5ff;        /* Lab-grade cyan for accents */
    --ink-blueprint: #2563eb;     /* Professional blue for links/actions */
    --magenta-alert: #ff0055;     /* High-visibility alert color */

    /* Typography */
    --ptp-font-precision: 'JetBrains Mono', monospace;
    --ptp-font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Shared Layout */
    --ptp-container-width: 1140px;
    --ptp-container-padding: 30px;
    --ptp-transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --header-height: 70px;
}

/* Ghost Header Architecture */
.ptp-ghost-header {
    height: var(--header-height);
    background-color: transparent;
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ptp-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 30px;
}

.ptp-header-start {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.ptp-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}

.ptp-brand-mark {
    width: 24px;
    height: 24px;
    background-color: var(--accent-primary);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.ptp-brand-text {
    font-family: var(--ptp-font-precision);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    font-weight: 700;
    text-transform: uppercase;
}

.ptp-header-nav {
    flex: 1;
    display: flex;
    align-items: center;
}

.ptp-nav-list {
    display: flex;
    list-style: none;
    margin: 0 auto;
    padding: 0;
    gap: 24px;
}

.ptp-nav-link {
    font-family: var(--ptp-font-precision);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
    transition: color var(--ptp-transition-smooth);
}

.ptp-nav-link:hover {
    color: var(--accent-primary);
}

.ptp-header-utility {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    margin-left: auto;
}

.ptp-nav-divider {
    display: none;
}

.ptp-lab-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--ptp-font-precision);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.ptp-status-pulse {
    width: 8px;
    height: 8px;
    background-color: var(--cyan-truth);
    border-radius: 50%;
    position: relative;
}

.ptp-status-pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: inherit;
    border-radius: inherit;
    animation: ptp-pulse 2s infinite;
}

@keyframes ptp-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(3); opacity: 0; }
}

@media (max-width: 992px) {
    .ptp-nav-divider {
        display: block;
        border: 0;
        border-top: 1px solid var(--border-subtle);
        margin: 0;
    }

    .ptp-header-utility {
        margin-top: auto;
        padding: 40px var(--ptp-container-padding);
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: 100%;
        border-top: 1px solid var(--border-subtle);
    }

    .ptp-header-utility .ptp-theme-control {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }

    .ptp-header-utility .ptp-lab-status {
        justify-content: center;
        opacity: 0.6;
    }
    
    .ptp-header-nav { 
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: var(--color-bg);
        z-index: 9999;
        padding: calc(var(--header-height) + 20px) 20px 40px;
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
        box-shadow: 20px 0 50px rgba(0,0,0,0.3);
        overflow-y: auto;
    }

    .ptp-header-nav.is-active {
        transform: translateX(0);
    }

    .ptp-nav-list {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        width: 100%;
    }

    .ptp-nav-list li {
        width: 100%;
        border-bottom: 1px solid var(--border-subtle);
    }

    .ptp-nav-link {
        display: block;
        padding: 20px 0;
        font-size: 1.25rem;
        width: 100%;
        text-align: left;
    }

    .ptp-header-start {
        width: 100%;
        justify-content: space-between;
    }

    /* Mobile trigger positioning & stabilization */
    .ptp-mobile-menu-trigger {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 10000; /* Above menu drawer */
        position: relative;
    }

    .hamburger-box {
        width: 24px;
        height: 18px;
        position: relative;
    }

    .hamburger-inner, 
    .hamburger-inner::before, 
    .hamburger-inner::after {
        width: 24px;
        height: 2px;
        background-color: var(--text-primary);
        position: absolute;
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .hamburger-inner { top: 50%; transform: translateY(-50%); }
    .hamburger-inner::before { content: ''; top: -8px; }
    .hamburger-inner::after { content: ''; top: 8px; }

    /* Open state iconography (morph to X) */
    .ptp-mobile-menu-trigger[aria-expanded="true"] .hamburger-inner {
        background-color: transparent !important;
    }

    .ptp-mobile-menu-trigger[aria-expanded="true"] .hamburger-inner::before {
        transform: rotate(45deg) translate(5px, 6px);
    }

    .ptp-mobile-menu-trigger[aria-expanded="true"] .hamburger-inner::after {
        transform: rotate(-45deg) translate(5px, -6px);
    }

    .ptp-mobile-menu-trigger:hover .hamburger-inner,
    .ptp-mobile-menu-trigger:hover .hamburger-inner::before,
    .ptp-mobile-menu-trigger:hover .hamburger-inner::after {
        background-color: var(--accent-primary);
    }


    .ptp-brand-text span {
        display: none; /* Hide 'Printer' on very small widths to save space */
    }
}

@media (min-width: 993px) {
    .ptp-mobile-menu-trigger {
        display: none;
    }
}

/* Base Typography Rules */
h1, h2, .gnosis-statement {
    font-family: var(--ptp-font-precision);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.1;
}

h3, h4, h5, h6 {
    font-family: var(--ptp-font-main);
    font-weight: 700;
}

.test-card-label, .result-data, .cta-button, .ptp-microcopy {
    font-family: var(--ptp-font-precision);
    letter-spacing: 0.05em;
    font-size: 0.85rem;
}

/* Light Mode: Architect's Blueprint */
[data-theme="light"],
:root:not([data-theme="dark"]) {
    --color-bg: var(--paper-vellum);
    --color-surface: var(--vellum-white);
    --color-surface-elevated: #ffffff;
    
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --text-on-accent: #ffffff;

    --accent-primary: var(--ink-blueprint);
    --accent-secondary: var(--cyan-truth);
    --accent-danger: var(--magenta-alert);
    --accent-warning: #f59e0b;
    --accent-success: #10b981;

    --bg-warning: #fffbeb;
    --text-warning: #92400e;
    
    --border-subtle: #e2e8f0;
    --border-strong: #cbd5e1;
    
    --focus-ring: rgba(37, 99, 235, 0.4);
    
    --hero-grid-opacity: 0.05;
    --depth-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

/* Dark Mode: Darkroom Lab */
[data-theme="dark"] {
    --color-bg: var(--ink-nocturnal);
    --color-surface: var(--key-black);
    --color-surface-elevated: #262a33;

    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --text-on-accent: #0f172a;

    --accent-primary: var(--cyan-truth);
    --accent-secondary: var(--ink-blueprint);
    --accent-danger: var(--magenta-alert);
    --accent-warning: #fbbf24;
    --accent-success: #34d399;

    --bg-warning: #2d2005;
    --text-warning: #fde68a;

    --border-subtle: #334155;
    --border-strong: #475569;

    --focus-ring: rgba(0, 229, 255, 0.4);

    --hero-grid-opacity: 0.15;
    --depth-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

/* Global Reset & Application */
* {
    box-sizing: border-box;
}

body {
    background-color: var(--color-bg);
    color: var(--text-primary);
    font-family: var(--ptp-font-main);
    transition: background-color var(--ptp-transition-smooth), color var(--ptp-transition-smooth);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Body Scroll Lock for Overlays */
body.no-scroll {
    overflow: hidden;
}

/* Base Print Overrides (Regressions-Safe) */
@media print {
    :root {
        --color-bg: #fff !important;
        --text-primary: #000 !important;
        --border-subtle: #ccc !important;
    }
}
