/* LIBDYN Layout Styles (Space & Structure) */

/* === GLOBAL LAYOUT UTILITIES === */
.content-column {
    max-width: var(--max-width);
    margin: 0 auto;
    padding-left: var(--l-line);
    padding-right: var(--l-line);
}

.l-align {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    padding-left: var(--l-line);
    padding-right: clamp(24px, 6vw, 96px);
}

.hidden {
    display: none;
}

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

/* === NAVBAR LAYOUT === */
main {
    padding-top: 0;
    /* Reset (Was 72px) */
}

.site-header {
    position: sticky;
    /* NOT fixed */
    top: 0;
    height: 72px;
    /* Locked Height */
    width: 100%;
    z-index: 1000;
    transform: none;
    will-change: auto;

    background-color: var(--bg-nav);
    /* Solid, Calibrated Surface */
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.site-header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    height: 100%;
    padding-left: var(--l-line);
    padding-right: var(--l-line);
    display: flex;
    align-items: center;
}

.site-logo {
    display: flex;
    align-items: center;
    line-height: 0;
}

.libdyn-mark {
    height: 20px;
    width: auto;
    display: block;
}

.site-nav {
    margin-left: auto;
    display: flex;
    gap: 36px;
    align-items: center;
}

.site-nav a {
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 400;
    opacity: 0.45;
    text-decoration: none;
    transition: opacity 180ms ease, font-weight 180ms ease;
    line-height: 1.4;
    /* Prevent Clipping */
}

.site-nav a[aria-current="page"] {
    opacity: 1;
    font-weight: 500;
    pointer-events: none;
}

.site-nav a:hover {
    opacity: 0.7;
}

/* === HERO LAYOUT === */
.hero {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    margin-bottom: 0;
    z-index: var(--z-content);

    /* Layout Discipline */
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    /* padding-top removed for centering */
}

.hero-content {
    position: relative;
    width: 100%;

    /* Vertical Bias Logic */
    /* Vertical Bias Logic - Reset for Centering */
    transform: none;
    z-index: 2;
    /* Explicit stacking above canvas */
}

/* Spacing Defaults */
h1,
h2,
h3,
h4,
h5,
h6,
p {
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.hero-subtitle {
    margin-top: 1rem;
}

/* Hero Line Slot */
#hero-line-slot {
    height: 24px;
    margin: 32px 0 24px;
    position: relative;
}

/* === SECTION LAYOUT === */
section {
    scroll-margin-top: var(--nav-h);
}

.content {
    padding: calc(var(--spacing-unit) * 4);
    padding-bottom: calc(var(--spacing-unit) * 16);
}

.section-principles {
    max-width: var(--max-width);
    margin: 0 auto;
    padding-top: calc(var(--spacing-unit) * 8);
    padding-bottom: calc(var(--spacing-unit) * 10);
}

.principles-title {
    margin-bottom: calc(var(--spacing-unit) * 1);
}

.principles-block {
    margin-bottom: calc(var(--spacing-unit) * 5);
}

.principles-lead {
    margin-bottom: calc(var(--spacing-unit) * 6);
    font-size: 14px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* === CANONICAL PAGE GRID (L-Line) === */

/* 1. Page Hero (Authority) */
.page-hero {
    display: block;
    /* Force Vertical Stacking */
    padding-top: clamp(18vh, 22vh, 26vh);
    padding-bottom: clamp(6vh, 8vh, 10vh);
    max-width: 72ch;
}

.page-hero h1 {
    display: block;
    margin: 0;
}

.page-hero h2 {
    display: block;
    margin-top: 1.2rem;
    max-width: 42ch;
    font-size: clamp(1.1rem, 1.6vw, 1.35rem);
    line-height: 1.45;
    color: var(--text-secondary);
    /* Derived from token */
    opacity: 0.7;
    /* Visual Muting */
}

/* 2. Page Content (Reasoning) */
.page-content {
    padding-top: clamp(8vh, 10vh, 12vh);
    padding-bottom: clamp(8vh, 10vh, 12vh);
    max-width: 64ch;
}

/* 3. Page Terminal (Closure) */
.page-terminal {
    padding-top: clamp(10vh, 12vh, 14vh);
    padding-bottom: clamp(14vh, 18vh, 22vh);
    max-width: 52ch;
}

.page-terminal p {
    margin: 0;
    opacity: 0.9;
}

/* === SIGNAL LAYOUT === */
.signal-text,
.text-1 {
    /* Legacy/Current Unification */
    font-size: 16px;
    margin-top: calc(var(--spacing-unit) * 6);
    position: relative;
    z-index: 2;
}

.text-2 {
    font-size: 13px;
}

/* === CONTACT FORM LAYOUT === */
#contact-section {
    padding-bottom: calc(var(--spacing-unit) * 12);
}

#contact-reveal {
    height: 0;
    overflow: hidden;
}

#contact-reveal.revealed {
    height: auto;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 4);
    max-width: 640px;
    margin-left: 0;
    padding-top: 48px;
}

.field {
    display: flex;
    flex-direction: column;
}

.field-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--spacing-unit) * 4);
}

/* Field Layout overrides */
.field input,
.field textarea {
    padding: 12px 14px;
}

.field textarea {
    resize: vertical;
    min-height: 140px;
}

form label {
    display: block;
    margin-bottom: 8px;
}

.form-action {
    display: flex;
    justify-content: flex-start;
    margin-top: calc(var(--spacing-unit) * 6);
}

.primary-action {
    /* Layout Dimensions Only */
    padding: 14px 40px;
    /* Note: Typographic/Visual props moved to base.css 'form button' */
}

/* === EXIT REFLECTION LAYOUT === */
#exit-reflection {
    position: fixed;
    top: 50%;
    right: 24px;
    transform: translateY(-50%);
    /* Base position, motion will override transform/opacity */

    max-width: 220px;
    font-size: 0.85rem;
    line-height: 1.4;
    visibility: hidden;
    /* Motion owns visible/hidden, Layout owns default state */
}



/* === SERVICES PAGE SPECIFIC & STRUCT RHYTHM === */

/* 2. Services / Methodology / Insights Hero Layout (Structure) */
.services-hero,
.methodology-hero,
.insights-hero {
    max-width: 72ch;
    padding-top: clamp(18vh, 22vh, 26vh);
    padding-bottom: clamp(6vh, 8vh, 10vh);
}

.services-hero h1,
.methodology-hero h1,
.insights-hero h1 {
    max-width: 100%;
    /* Mobile First */
    word-break: normal;
    margin-bottom: 1.6rem;
}

@media (min-width: 900px) {

    .services-hero h1,
    .methodology-hero h1,
    .insights-hero h1 {
        max-width: 100%;
        white-space: normal;
    }

    /* "Why there are no public case studies yet" */
    .content-paragraph h2 {
        white-space: nowrap;
    }
}

.services-hero h2,
.methodology-hero h2,
.insights-hero h2 {
    max-width: 36ch;
    margin-bottom: 2.2rem;
}

.insights-hero h2 {
    max-width: 42ch;
}

.services-hero h3,
.methodology-hero h3,
.insights-hero h3 {
    max-width: 48ch;
}

/* 3. Structural Blocks (Refined) */

/* Base paragraph (NO vertical line) */
.content-paragraph {
    margin-left: 0;
    padding-left: 0;
    max-width: 56ch;
    margin-top: 4rem;
}

.content-paragraph p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Indexed steps ONLY (line + number) */
.indexed-step {
    position: relative;
    display: grid;
    grid-template-columns: 3rem 1fr;
    column-gap: 2rem;
    padding-left: 1rem;
    margin-top: 6rem;
}

/* Vertical Rule */
.indexed-step::before {
    content: "";
    position: absolute;
    left: 1.5rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.indexed-step .step-index {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.12em;
    padding-top: 0.4rem;
    z-index: 2;
    font-family: var(--font-primary);
}

.step-content h2 {
    font-size: var(--h2);
    margin-bottom: 1.2rem;
    opacity: 1;
}

.step-content p {
    max-width: 52ch;
    margin-bottom: 1.4rem;
}

.step-content .impact {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-top: 2rem;
    opacity: 0.8;
}

.services-dialogue {
    max-width: 64ch;
    margin-top: clamp(12vh, 14vh, 18vh);
    padding-bottom: clamp(16vh, 20vh, 24vh);
}

/* === INSIGHTS GRID & CARD SYSTEM === */

/* Invisible Card (No Chrome) */
.article-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 0;
    cursor: pointer;
}

.article-card h2 {
    transition: opacity 200ms ease;
}

.article-card .synopsis {
    transition: opacity 200ms ease;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 1rem;
}

.article-card:hover h2 {
    opacity: 0.85;
}

.article-card:hover .synopsis {
    opacity: 0.75;
}

/* Grid Layout */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4rem 6rem;
    margin-top: 6rem;
}

/* Pillar Article (Dominant) */
.article-card.pillar {
    grid-column: 1 / -1;
    margin-bottom: 2rem;
}

.article-card.pillar h2 {
    font-size: clamp(2rem, 3vw, 2.6rem);
    line-height: 1.2;
    margin-bottom: 1.2rem;
}

/* === INSIGHT EXTENSIONS (PILLAR PAGE) === */
.insight-extensions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 64px 0;
    width: 100%;
}

.extension-link {
    display: flex;
    flex-direction: column;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.extension-link:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.3);
}

.ext-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
    margin-bottom: 8px;
}

.ext-title {
    font-family: var(--font-primary);
    font-size: 18px;
    font-weight: 500;
    line-height: 1.4;
}

.article-card.pillar .synopsis {
    font-size: 1.05rem;
    max-width: 52ch;
}

/* Supporting Articles */
.article-card:not(.pillar) h2 {
    font-size: 1.25rem;
    line-height: 1.4;
    margin-bottom: 0.8rem;
}

.article-card:not(.pillar) .synopsis {
    font-size: 0.95rem;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .insights-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
}

/* 5. HARD SAFETY: Kill conversational artifacts on Services */
body:not(.page-home) .signal-text--trigger,
body:not(.page-home) .exit-text {
    display: none !important;
}

/* === MOBILE BREAKPOINTS === */

/* === MOBILE BREAKPOINTS === */
/* === MOBILE BREAKPOINTS (Layer 2 Fixes) === */
@media (max-width: 768px) {

    /* 1. Nav Bar Fix (Stack & Scroll) */
    .site-header {
        height: auto;
        min-height: unset;
    }

    .site-header-inner {
        position: relative;
        /* Anchor for Logo */
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-top: 1rem;
        padding-bottom: 0.75rem;
    }

    .site-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        z-index: 2;
        pointer-events: auto;
    }

    .site-nav {
        margin-left: 0;
        display: flex;
        flex-wrap: nowrap;
        /* No Wrap */
        gap: 20px;
        overflow-x: auto;
        /* Horizontal Scroll */
        width: 100%;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox Fix */

        /* Clear Logo (Absolute) */
        padding-top: 32px;

        /* Scroll Snap */
        scroll-snap-type: x mandatory;
    }

    .site-nav::-webkit-scrollbar {
        display: none;
    }

    .site-nav a {
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;

        /* Touch Targets */
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: 0 12px;
        scroll-snap-align: start;
    }

    /* H1/H2 Clamp Tuning (Mobile Only) */
    h1 {
        max-width: 18ch;
    }

    h2 {
        margin-top: 12px;
        max-width: 28ch;
    }

    /* 2. Contact Form Fix (Mobile Grid Collapse) */
    .field-row.two-col {
        display: grid;
        grid-template-columns: 1fr;
        /* FORCE SINGLE COLUMN */
        gap: 1rem;
    }

    .field-row.two-col .field {
        width: 100%;
    }

    input,
    textarea,
    select {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Button Mobile Stacking */
    .form-action {
        width: 100%;
    }

    .form-action button {
        width: 100%;
        margin-top: 0;
        /* Handled by container margin */
    }

    /* 3. File Input Overflow Fix */
    input[type="file"] {
        max-width: 100%;
    }
}

/* === MOBILE SAFETY NET (Layer 3 & 4) === */
@media (max-width: 600px) {

    /* Layer 3: Vertical Spine Safety */
    .indexed-step,
    .service,
    .methodology-step,
    .insight-section {
        padding-left: 1.6rem;
    }

    .indexed-step::before,
    .service::before,
    .methodology-step::before,
    .insight-section::before {
        left: 0.8rem;
    }

    /* Layer 4: Touch Target Fuzziness */
    .article-card {
        padding-top: calc(var(--rhythm) * 1.5);
        padding-bottom: calc(var(--rhythm) * 1.5);
    }
}

/* === HERO PERFORMANCE FALLBACK === */
/* Motion Safe Mode (Low Spec or Reduced Motion) */
.motion-safe .hero-canvas {
    display: none !important;
}

/* Static Line Fallback (Matches 3D Aesthetic) */
.motion-safe #hero-line-slot,
.hero-static #hero-line-slot {
    display: block;
    width: 85%;
    max-width: 800px;
    height: 4px;
    background: #2dd4bf;
    /* Teal Match */
    margin: 0 auto;
    opacity: 0.9;
    border-radius: 2px;
    box-shadow: 0 0 12px rgba(45, 212, 191, 0.4);

    /* Sequence: Fade out to match 3D timing */
    animation: staticLineFade 2s ease-out 3.5s forwards;
}

@keyframes staticLineFade {
    to {
        opacity: 0;
    }
}

/* === CASE STUDIES CONTENT (Refined) === */
.case-content p {
    max-width: 56ch;
    margin-bottom: 1.6rem;
}

/* 1. L-Aligned List (Hanging Bullets) */
.case-content ul {
    margin: 1.8rem 0 2.4rem 0;
    margin-left: 0;
    padding-left: 0;
    list-style-position: outside;
}

.case-content li {
    padding-left: 1.4rem;
    text-indent: -1.4rem;
    line-height: 1.65;
    margin-bottom: 0.9rem;
    color: var(--text-secondary);
}

.case-content li::marker {
    color: rgba(255, 255, 255, 0.45);
}

/* 2. Closure Line (Status State) */
.case-closure {
    margin-top: 2.8rem;
    padding-top: 1.2rem;
    color: rgba(255, 255, 255, 0.6);
    max-width: 48ch;
    display: block;
}

/* === FRONTEND PHASE A UTILITIES === */

/* Strategy A: Constraint Statement (Services) */
/* Strategy A: Constraint Statement (Services) */
.constraint-statement {
    display: none;
    /* Default Hidden (Leaking Prevention) */
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 3rem;
    /* Push Signal-Text-2 down */
    opacity: 0.9;
    max-width: 52ch;
    border-left: 1px solid var(--accent);
    padding-left: 1rem;
}

main[data-page="services"] .constraint-statement {
    display: block;
}

/* Field Hint (Attachment Micro-copy) */
.field-hint {
    display: block;
    /* Moved to block per user request "under label" */
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-muted);
    margin-left: 0;
    margin-top: 4px;
    font-size: 0.75rem;
    opacity: 0.8;
}

.field-error {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 6px;
}

/* Mobile Form Density (Override) */
@media (max-width: 768px) {
    .contact-form {
        gap: 1.5rem;
        /* Reduced from 4 units (32px) */
        padding-top: 24px;
    }

    .field-row.two-col {
        gap: 0.75rem;
        /* Reduced from 1rem */
    }

    /* Phase B: Micro-Clarity Helpers */
    /* Removed: Field Helpers moved to placeholders per spec */
}

/* === SITE FOOTER === */
.site-footer {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 32px 0 24px;
    font-size: 13px;
    opacity: 0.55;
    width: 100%;
}

.site-footer a {
    text-decoration: none;
    color: inherit;
}

.site-footer a:hover {
    opacity: 0.85;
}

/* =========================
   Legal Page Navbar Mode
   ========================= */

body.legal-page .site-header-inner {
    opacity: 0.6;
    transition: opacity 160ms ease;
}

/* Restore clarity on intent */
body.legal-page header:hover .site-header-inner,
body.legal-page .site-header:hover .site-header-inner {
    opacity: 1;
}

/* No active nav highlighting on legal pages */
body.legal-page nav a.active,
body.legal-page nav a[aria-current="page"] {
    opacity: 0.5;
    font-weight: normal;
    text-decoration: none;
    pointer-events: auto;
}

/* Keep logo fully interactive */
body.legal-page .logo,
body.legal-page .site-logo {
    opacity: 1;
}

/* Optional Disables */
body.legal-page .hero,
body.legal-page .hero-canvas {
    display: none;
}

body.legal-page main {
    margin-top: 24px;
}