/* PSP Documentation Styles - Technical Monograph Aesthetic */

/* ==========================================================================
   Bulma Variable Overrides
   ========================================================================== */

:root {
    /* Typography */
    --bulma-family-primary: 'Crimson Pro', Georgia, serif;
    --bulma-family-secondary: 'DM Sans', sans-serif;
    --bulma-family-code: 'JetBrains Mono', monospace;

    --bulma-body-family: var(--bulma-family-primary);
    --bulma-body-size: 20px;
    --bulma-body-line-height: 1.75;

    --bulma-title-family: var(--bulma-family-secondary);
    --bulma-subtitle-family: var(--bulma-family-primary);

    /* Colors - Refined palette */
    --bulma-primary: hsl(187, 72%, 35%);
    --bulma-primary-light: hsl(187, 60%, 95%);
    --bulma-primary-dark: hsl(187, 72%, 28%);

    --bulma-link: hsl(187, 72%, 35%);
    --bulma-link-hover: hsl(187, 72%, 28%);

    /* Semantic colors */
    --bulma-info: hsl(187, 72%, 35%);
    --bulma-success: hsl(152, 56%, 38%);
    --bulma-warning: hsl(42, 88%, 52%);
    --bulma-danger: hsl(4, 72%, 52%);

    /* Background & Text - Warmer, more refined */
    --bulma-background: hsl(42, 24%, 96%);
    --bulma-body-background-color: hsl(42, 20%, 97%);

    --bulma-text: hsl(220, 35%, 18%);
    --bulma-text-light: hsl(220, 15%, 50%);
    --bulma-text-strong: hsl(220, 35%, 12%);

    /* Borders */
    --bulma-border: hsl(42, 15%, 86%);
    --bulma-border-hover: hsl(187, 72%, 35%);

    /* Radius - Slightly sharper for editorial feel */
    --bulma-radius: 4px;
    --bulma-radius-medium: 6px;
    --bulma-radius-large: 8px;

    /* Code */
    --bulma-code-background: hsl(220, 25%, 14%);
    --bulma-code-foreground: hsl(187, 70%, 70%);
    --bulma-code-size: 0.85em;

    /* Custom tokens */
    --psp-sidebar-width: 280px;
    --psp-content-width: 860px;
    --psp-bg-code: hsl(220, 25%, 14%);
    --psp-cyan-light: hsl(187, 60%, 95%);
    --psp-amber: hsl(42, 88%, 52%);
    --psp-amber-light: hsl(45, 80%, 95%);

    /* Animation timing */
    --psp-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --psp-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes lineGrow {
    from { width: 0; }
    to { width: 2.5rem; }
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 2rem;
}

body {
    background-color: var(--bulma-body-background-color);
    position: relative;
}

/* Subtle grain texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.015;
    pointer-events: none;
    z-index: 9999;
}

/* Inline code */
code {
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: hsl(220, 15%, 75%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(220, 15%, 60%);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: hsl(220, 15%, 75%) transparent;
}

/* ==========================================================================
   Layout
   ========================================================================== */

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

/* ==========================================================================
   Sidebar - Refined with depth
   ========================================================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--psp-sidebar-width);
    height: 100vh;
    padding: 2.5rem 1.75rem;
    background: linear-gradient(180deg, hsl(42, 20%, 97%) 0%, hsl(42, 24%, 95%) 100%);
    border-right: 1px solid var(--bulma-border);
    overflow-y: auto;
    z-index: 100;
    animation: slideInLeft 0.6s var(--psp-ease-out) both;
}

/* Decorative line on sidebar */
.sidebar::after {
    content: '';
    position: absolute;
    top: 2.5rem;
    right: 0;
    width: 3px;
    height: 60px;
    background: linear-gradient(180deg, var(--bulma-primary) 0%, transparent 100%);
}

.sidebar-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--bulma-border);
    position: relative;
}

/* Decorative element */
.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--bulma-primary);
}

.sidebar-logo {
    font-family: var(--bulma-family-code);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--bulma-text-light);
    margin-bottom: 0.5rem;
}

.sidebar-title {
    font-family: var(--bulma-family-secondary);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bulma-text);
    letter-spacing: -0.03em;
}

.sidebar-title a {
    color: inherit;
    text-decoration: none;
    border: none;
    transition: color 0.2s ease;
}

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

.nav-section {
    margin-bottom: 1.75rem;
    animation: fadeIn 0.4s var(--psp-ease-out) both;
}

.nav-section:nth-child(2) { animation-delay: 0.1s; }
.nav-section:nth-child(3) { animation-delay: 0.15s; }
.nav-section:nth-child(4) { animation-delay: 0.2s; }
.nav-section:nth-child(5) { animation-delay: 0.25s; }
.nav-section:nth-child(6) { animation-delay: 0.3s; }
.nav-section:nth-child(7) { animation-delay: 0.35s; }
.nav-section:nth-child(8) { animation-delay: 0.4s; }

.nav-label {
    font-family: var(--bulma-family-code);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--bulma-text-light);
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
    position: relative;
}

.nav-label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 3px;
    background: var(--bulma-primary);
    border-radius: 50%;
    transform: translateY(-50%);
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin-bottom: 0;
}

.nav-link {
    display: block;
    padding: 0.35rem 0.75rem;
    font-family: var(--bulma-family-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--bulma-text-light);
    text-decoration: none;
    border-radius: var(--bulma-radius);
    border-bottom: none;
    transition: all 0.2s var(--psp-ease-out);
    position: relative;
}

.nav-link:hover {
    background: hsla(187, 72%, 35%, 0.06);
    color: var(--bulma-text);
    border-bottom: none;
    padding-left: 1rem;
}

.nav-link.active {
    background: var(--psp-cyan-light);
    color: var(--bulma-primary);
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--bulma-primary);
    border-radius: 0 2px 2px 0;
}

/* ==========================================================================
   Main Content
   ========================================================================== */

.main {
    grid-column: 2;
    padding: 4rem 5rem 6rem;
    max-width: min(calc(var(--psp-content-width) + 10rem), calc(100vw - var(--psp-sidebar-width) - 2rem));
    width: 100%;
    animation: fadeIn 0.5s var(--psp-ease-out) 0.2s both;
}

/* ==========================================================================
   Hero - More dramatic
   ========================================================================== */

.hero {
    margin-bottom: 1rem;
    position: relative;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--bulma-family-code);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--bulma-primary);
    margin-bottom: 1.25rem;
    animation: fadeInUp 0.5s var(--psp-ease-out) 0.3s both;
}

.hero-eyebrow::before {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: var(--bulma-primary);
    animation: lineGrow 0.4s var(--psp-ease-out) 0.5s forwards;
}

.hero-title {
    font-family: var(--bulma-family-secondary);
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: var(--bulma-text);
    margin-bottom: 1.25rem;
    animation: fadeInUp 0.5s var(--psp-ease-out) 0.4s both;
}

.hero-description {
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--bulma-text-light);
    max-width: 680px;
    animation: fadeInUp 0.5s var(--psp-ease-out) 0.5s both;
}

.system-diagram {
    display: block;
    width: 90%;
    max-width: 780px;
    height: auto;
    margin: -1.5rem auto 0;
    animation: fadeInUp 0.5s var(--psp-ease-out) 0.55s both;
}

/* ==========================================================================
   Page Header
   ========================================================================== */

.page-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--bulma-border);
    animation: fadeInUp 0.5s var(--psp-ease-out) 0.3s both;
}

.page-header .breadcrumb {
    font-family: var(--bulma-family-code);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.page-header .breadcrumb a {
    color: var(--bulma-text-light);
    transition: color 0.2s ease;
    border-bottom: none;
}

.page-header .breadcrumb a:hover {
    color: var(--bulma-primary);
}

.page-header .breadcrumb li.is-active a {
    color: var(--bulma-text);
}

.page-title {
    font-family: var(--bulma-family-secondary);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--bulma-text);
    margin-bottom: 0.75rem;
}

.page-subtitle {
    font-size: 1.1rem;
    color: var(--bulma-text-light);
    line-height: 1.6;
}

/* ==========================================================================
   Sections - Better rhythm
   ========================================================================== */

.section {
    margin-bottom: 1rem;
    scroll-margin-top: 2rem;
    animation: fadeInUp 0.5s var(--psp-ease-out) both;
    padding-top: 0rem;
    padding-bottom: 0rem;
}

.section:nth-of-type(1) { animation-delay: 0.5s; }
.section:nth-of-type(2) { animation-delay: 0.6s; }
.section:nth-of-type(3) { animation-delay: 0.7s; }
.section:nth-of-type(4) { animation-delay: 0.8s; }
.section:nth-of-type(5) { animation-delay: 0.9s; }

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--bulma-border);
}

.section-number {
    font-family: var(--bulma-family-code);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--bulma-primary);
    padding: 0.25rem 0.5rem;
    background: var(--psp-cyan-light);
    border-radius: var(--bulma-radius);
    letter-spacing: 0.05em;
}

.section-title {
    font-family: var(--bulma-family-secondary);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--bulma-text);
}

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

p {
    margin-bottom: 1.5rem;
}

a {
    color: var(--bulma-link);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--bulma-link-hover);
    border-bottom-color: var(--bulma-link);
}

h3 {
    font-family: var(--bulma-family-secondary);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bulma-text);
    margin: 2.5rem 0 1.25rem;
    position: relative;
    padding-left: 1rem;
}

h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.25em;
    width: 3px;
    height: 1em;
    background: var(--bulma-primary);
    border-radius: 2px;
}

strong {
    font-weight: 600;
    color: var(--bulma-text-strong);
}

ul, ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   Principles List - More refined
   ========================================================================== */

.principles {
    list-style: none;
    margin: 2rem 0;
    padding: 0;
}

.principle {
    display: flex;
    gap: 1.25rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: white;
    border-radius: var(--bulma-radius-medium);
    border: 1px solid var(--bulma-border);
    border-left: 3px solid var(--bulma-primary);
    transition: all 0.25s var(--psp-ease-out);
    box-shadow: 0 1px 3px hsla(220, 35%, 18%, 0.04);
}

.principle:hover {
    border-left-color: var(--psp-amber);
    box-shadow: 0 4px 12px hsla(220, 35%, 18%, 0.08);
    transform: translateX(4px);
}

.principle-number {
    font-family: var(--bulma-family-code);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bulma-primary);
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--psp-cyan-light);
    border-radius: var(--bulma-radius);
}

.principle-content {
    flex: 1;
}

.principle-title {
    font-family: var(--bulma-family-secondary);
    font-weight: 700;
    font-size: 1rem;
    color: var(--bulma-text);
    margin-bottom: 0.35rem;
}

.principle-desc {
    font-size: 0.95rem;
    color: var(--bulma-text-light);
    margin: 0;
    line-height: 1.6;
}

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

.diagram-container {
    margin: 2.5rem 0;
    padding: 2rem 0;
    background: transparent;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.diagram-label {
    font-family: var(--bulma-family-code);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--bulma-text-light);
    padding: 0.35rem 0.75rem;
    background: var(--bulma-background);
    border-radius: var(--bulma-radius);
}

.mermaid {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1rem 0;
}

.mermaid svg {
    height: auto;
    max-width: none;
}

.enlarge-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border: 1px solid var(--bulma-border);
    border-radius: var(--bulma-radius);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bulma-text-light);
    transition: all 0.2s var(--psp-ease-out);
    opacity: 0.7;
}

.enlarge-btn:hover {
    border-color: var(--bulma-primary);
    color: var(--bulma-primary);
    background: var(--psp-cyan-light);
    opacity: 1;
}

.diagram-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: hsla(220, 35%, 10%, 0.9);
    backdrop-filter: blur(4px);
    z-index: 1000;
    padding: 2rem;
    overflow: auto;
}

.diagram-modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.diagram-modal-content {
    background: white;
    border-radius: var(--bulma-radius-large);
    padding: 2rem;
    max-width: 95vw;
    max-height: 95vh;
    overflow: auto;
    position: relative;
    animation: scaleIn 0.3s var(--psp-ease-out);
}

.diagram-modal-content svg {
    height: auto;
    max-width: none;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--bulma-radius);
    background: var(--bulma-background);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bulma-text-light);
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: hsl(4, 72%, 95%);
    color: var(--bulma-danger);
}

/* ==========================================================================
   Callout Boxes - More refined
   ========================================================================== */

.insight {
    margin: 2rem 0;
    padding: 1.75rem 2rem;
    background: white;
    border-radius: var(--bulma-radius-medium);
    border: 1px solid hsl(42, 40%, 88%);
    border-left: 3px solid var(--psp-amber);
    box-shadow: 0 2px 8px hsla(42, 88%, 52%, 0.08);
}

.insight-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--bulma-family-code);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: hsl(42, 70%, 40%);
    margin-bottom: 0.75rem;
}

.insight p {
    margin: 0;
    color: var(--bulma-text);
    font-size: 0.95rem;
}

.rules-box {
    margin: 2rem 0;
    padding: 1.75rem 2rem;
    background: white;
    border-radius: var(--bulma-radius-medium);
    border: 1px solid hsl(187, 30%, 88%);
    border-left: 3px solid var(--bulma-primary);
    box-shadow: 0 2px 8px hsla(187, 72%, 35%, 0.06);
}

.rules-box .rules-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--bulma-family-code);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bulma-primary);
    margin-bottom: 0.75rem;
}

.rules-box ul {
    margin: 0;
    padding-left: 1.25rem;
}

.rules-box li {
    margin-bottom: 0.5rem;
    color: var(--bulma-text);
    font-size: 0.95rem;
}

.pitfalls-box {
    margin: 2rem 0;
    padding: 1.75rem 2rem;
    background: white;
    border-radius: var(--bulma-radius-medium);
    border: 1px solid hsl(4, 40%, 90%);
    border-left: 3px solid var(--bulma-danger);
    box-shadow: 0 2px 8px hsla(4, 72%, 52%, 0.06);
}

.pitfalls-box .pitfalls-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--bulma-family-code);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bulma-danger);
    margin-bottom: 0.75rem;
}

.pitfalls-box ul {
    margin: 0;
    padding-left: 1.25rem;
}

.pitfalls-box li {
    margin-bottom: 0.5rem;
    color: var(--bulma-text);
    font-size: 0.95rem;
}

/* ==========================================================================
   Cards & Grids - More refined
   ========================================================================== */

.primitives-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin: 2rem 0;
}

.primitive-card {
    padding: 1.5rem;
    background: white;
    border: 1px solid var(--bulma-border);
    border-radius: var(--bulma-radius-medium);
    transition: all 0.25s var(--psp-ease-out);
    box-shadow: 0 1px 3px hsla(220, 35%, 18%, 0.04);
    position: relative;
    overflow: hidden;
}

.primitive-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--bulma-primary) 0%, var(--psp-amber) 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s var(--psp-ease-out);
}

.primitive-card:hover {
    border-color: var(--bulma-primary);
    box-shadow: 0 8px 24px hsla(220, 35%, 18%, 0.1);
    transform: translateY(-2px);
}

.primitive-card:hover::before {
    transform: scaleX(1);
}

.primitive-name {
    display: block;
    font-family: var(--bulma-family-code);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bulma-primary);
    margin-bottom: 0.5rem;
}

.primitive-desc {
    font-size: 0.9rem;
    color: var(--bulma-text-light);
    margin: 0;
    line-height: 1.55;
}

/* ==========================================================================
   Decision Table - More refined
   ========================================================================== */

.decision-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 2rem 0;
    font-size: 0.9rem;
    background: white;
    border-radius: var(--bulma-radius-medium);
    overflow: hidden;
    box-shadow: 0 1px 3px hsla(220, 35%, 18%, 0.04);
    border: 1px solid var(--bulma-border);
}

.decision-table th {
    font-family: var(--bulma-family-secondary);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    text-align: left;
    padding: 1rem 1.25rem;
    background: var(--bulma-background);
    border-bottom: 2px solid var(--bulma-border);
    color: var(--bulma-text);
}

.decision-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--bulma-border);
    vertical-align: top;
    transition: background 0.15s ease;
}

.decision-table tr:last-child td {
    border-bottom: none;
}

.decision-table tr:hover td {
    background: hsla(187, 72%, 35%, 0.04);
}

.decision-table code {
    font-size: 0.8rem;
}

/* ==========================================================================
   Code Block - More refined
   ========================================================================== */

.code-block {
    margin: 2rem 0;
    border-radius: var(--bulma-radius-large);
    overflow: hidden;
    background: var(--psp-bg-code);
    box-shadow: 0 4px 16px hsla(220, 35%, 10%, 0.2);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    background: hsla(0, 0%, 100%, 0.04);
    border-bottom: 1px solid hsla(0, 0%, 100%, 0.08);
}

.code-dots {
    display: flex;
    gap: 7px;
}

.code-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: hsla(0, 0%, 100%, 0.15);
}

.code-dot:nth-child(1) { background: hsl(0, 70%, 60%); }
.code-dot:nth-child(2) { background: hsl(45, 80%, 55%); }
.code-dot:nth-child(3) { background: hsl(130, 50%, 50%); }

.code-filename {
    font-family: var(--bulma-family-code);
    font-size: 0.75rem;
    color: hsla(0, 0%, 100%, 0.45);
    letter-spacing: 0.02em;
}

.code-content {
    padding: 1.5rem 1.75rem;
    overflow-x: auto;
    background: var(--psp-bg-code);
}

.code-content pre {
    font-family: var(--bulma-family-code);
    font-size: 0.85rem;
    line-height: 1.65;
    color: hsl(214, 32%, 91%);
    margin: 0;
    background: transparent;
}

.code-content .comment { color: hsl(220, 12%, 48%); }
.code-content .keyword { color: hsl(330, 85%, 70%); }
.code-content .string { color: hsl(150, 70%, 55%); }
.code-content .function { color: hsl(210, 85%, 65%); }
.code-content .variable { color: hsl(38, 90%, 60%); }

/* ==========================================================================
   Navigation Cards - More refined
   ========================================================================== */

.nav-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin: 2.5rem 0;
}

.nav-card {
    display: block;
    padding: 1.75rem 3.5rem 1.75rem 1.75rem;
    background: white;
    border: 1px solid var(--bulma-border);
    border-radius: var(--bulma-radius-medium);
    text-decoration: none;
    transition: all 0.25s var(--psp-ease-out);
    box-shadow: 0 1px 3px hsla(220, 35%, 18%, 0.04);
    position: relative;
    overflow: hidden;
}

.nav-card::after {
    content: '';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    width: 20px;
    height: 20px;
    transform: translateY(-50%) translateX(-8px);
    background: var(--bulma-primary);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M12 5l7 7-7 7'/%3E%3C/svg%3E") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M12 5l7 7-7 7'/%3E%3C/svg%3E") center/contain no-repeat;
    opacity: 0;
    transition: all 0.25s var(--psp-ease-out);
}

.nav-card:hover {
    border-color: var(--bulma-primary);
    box-shadow: 0 8px 24px hsla(220, 35%, 18%, 0.1);
    transform: translateY(-3px);
}

.nav-card:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.nav-card-label {
    font-family: var(--bulma-family-code);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--bulma-text-light);
    margin-bottom: 0.5rem;
}

.nav-card-title {
    font-family: var(--bulma-family-secondary);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--bulma-text);
    margin-bottom: 0.35rem;
    transition: color 0.2s ease;
}

.nav-card:hover .nav-card-title {
    color: var(--bulma-primary);
}

.nav-card-desc {
    font-size: 0.85rem;
    color: var(--bulma-text-light);
    margin: 0;
    line-height: 1.5;
}

/* ==========================================================================
   Footer & Page Navigation
   ========================================================================== */

.footer-quote {
    margin-top: 5rem;
    padding: 2.5rem 0;
    border-top: 1px solid var(--bulma-border);
    text-align: center;
    position: relative;
}

.footer-quote::before {
    content: '"';
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--bulma-family-primary);
    font-size: 4rem;
    line-height: 1;
    color: var(--bulma-border);
}

.footer-quote blockquote {
    font-style: italic;
    font-size: 1.1rem;
    color: var(--bulma-text-light);
    max-width: 580px;
    margin: 0 auto;
    padding-top: 1rem;
}

.page-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--bulma-border);
}

.page-nav a {
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.5rem;
    border-radius: var(--bulma-radius-medium);
    text-decoration: none;
    transition: all 0.2s var(--psp-ease-out);
    border: 1px solid transparent;
}

.page-nav a:hover {
    background: white;
    border-color: var(--bulma-border);
    box-shadow: 0 2px 8px hsla(220, 35%, 18%, 0.06);
}

.page-nav .prev {
    align-items: flex-start;
}

.page-nav .next {
    align-items: flex-end;
}

.page-nav .label {
    font-family: var(--bulma-family-code);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bulma-text-light);
    margin-bottom: 0.35rem;
}

.page-nav .title {
    font-family: var(--bulma-family-secondary);
    font-weight: 600;
    font-size: 1rem;
    color: var(--bulma-primary);
}

/* ==========================================================================
   Scroll Progress
   ========================================================================== */

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--bulma-primary) 0%, var(--psp-amber) 100%);
    z-index: 1000;
    transition: width 0.1s ease;
}

/* ==========================================================================
   Image in hero
   ========================================================================== */

.main > img {
    border-radius: var(--bulma-radius-medium);
    margin-top: -3rem;
    margin-bottom: 2.5rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1200px) {
    .main {
        padding: 3rem 3rem 5rem;
    }

    .nav-cards {
        grid-template-columns: 1fr;
    }
}

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

    .sidebar {
        display: none;
    }

    .main {
        grid-column: 1;
        padding: 2rem;
        max-width: 100%;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .primitives-grid {
        grid-template-columns: 1fr;
    }

    .decision-table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 600px) {
    .main {
        padding: 1.5rem 1rem;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .principle {
        flex-direction: column;
        gap: 0.75rem;
    }

    .principle-number {
        width: auto;
        height: auto;
        padding: 0.2rem 0.5rem;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
