/* ==========================================================================
   PULSECORE – Stylesheet
   Design System: Deep Graphite + Engineering Indigo
   Layout: 12-column grid, mobile-first, architectural
   ========================================================================== */

/* --------------------------------------------------------------------------
   DESIGN TOKENS
   -------------------------------------------------------------------------- */
:root {
    /* Colors – Deep Graphite + Indigo */
    --color-bg:             #14161e;
    --color-bg-alt:         #181b25;
    --color-bg-elevated:    #1c1f2b;
    --color-bg-surface:     #252838;
    --color-text-primary:   #e8eaf0;
    --color-text-secondary: #8b90a8;
    --color-text-muted:     #585e78;
    --color-accent:         #4a7cff;
    --color-accent-hover:   #6b94ff;
    --color-accent-dim:     rgba(74, 124, 255, 0.12);
    --color-accent-glow:    rgba(74, 124, 255, 0.06);
    --color-border:         #2a2d3d;
    --color-border-light:   #353950;
    --color-border-accent:  rgba(74, 124, 255, 0.25);

    /* Typography */
    --font-family:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono:            'IBM Plex Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --font-size-base:       1rem;
    --font-size-sm:         0.875rem;
    --font-size-xs:         0.75rem;
    --font-size-2xs:        0.6875rem;
    --font-size-h1:         2.25rem;
    --font-size-h2:         1.5rem;
    --font-size-h3:         1.125rem;
    --line-height-body:     1.7;
    --line-height-heading:  1.2;
    --font-weight-normal:   400;
    --font-weight-medium:   500;
    --font-weight-semibold: 600;

    /* Spacing scale */
    --space-2xs:  0.125rem;
    --space-xs:   0.25rem;
    --space-sm:   0.5rem;
    --space-md:   1rem;
    --space-lg:   1.5rem;
    --space-xl:   2.5rem;
    --space-2xl:  4rem;
    --space-3xl:  6rem;
    --space-4xl:  8rem;

    /* Layout */
    --container-max:   1200px;
    --container-pad:   var(--space-lg);
    --grid-columns:    12;
    --grid-gap:        var(--space-lg);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;

    /* Border */
    --radius-sm: 2px;
    --radius-md: 4px;
}

/* --------------------------------------------------------------------------
   FONT FACES
   -------------------------------------------------------------------------- */
@font-face {
    font-family: 'Inter';
    src: url('/assets/fonts/inter-var.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* --------------------------------------------------------------------------
   RESET & BASE
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-body);
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

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

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

ul, ol {
    list-style: none;
}

/* --------------------------------------------------------------------------
   ARCHITECTURAL GRID BACKGROUND
   Subtle repeating grid lines that give the page an engineering blueprint feel
   -------------------------------------------------------------------------- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(to right, rgba(74, 124, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(74, 124, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

body > * {
    position: relative;
    z-index: 1;
}

/* --------------------------------------------------------------------------
   CONTAINER & GRID
   -------------------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-pad);
    padding-right: var(--container-pad);
}

.grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: var(--grid-gap);
}

.grid--2 { grid-template-columns: repeat(1, 1fr); }
.grid--3 { grid-template-columns: repeat(1, 1fr); }
.grid--4 { grid-template-columns: repeat(1, 1fr); }

/* --------------------------------------------------------------------------
   TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1, h2, h3 {
    line-height: var(--line-height-heading);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

h1 {
    font-size: var(--font-size-h1);
    margin-bottom: var(--space-lg);
    letter-spacing: -0.025em;
}

h2 {
    font-size: var(--font-size-h2);
    margin-bottom: var(--space-md);
    letter-spacing: -0.015em;
}

h3 {
    font-size: var(--font-size-h3);
    margin-bottom: var(--space-sm);
}

p {
    margin-bottom: var(--space-md);
    max-width: 64ch;
    color: var(--color-text-secondary);
}

/* Section labels – technical monospace markers */
.section-label {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--font-size-2xs);
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: var(--space-md);
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--color-border-accent);
    border-radius: var(--radius-sm);
    background-color: var(--color-accent-dim);
}

/* Section number – ordinal markers for architectural feel */
.section-number {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
    display: block;
}

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

/* --------------------------------------------------------------------------
   HEADER / NAVIGATION
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(20, 22, 30, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.site-logo img {
    display: block;
    height: 28px;
    width: auto;
}

.site-logo:hover {
    opacity: 0.9;
}

/* Nav toggle (mobile) */
.nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle-bar {
    display: block;
    width: 100%;
    height: 1.5px;
    background-color: var(--color-text-primary);
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* Primary nav */
.primary-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background-color: rgba(20, 22, 30, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-sm) 0;
}

.primary-nav.is-open {
    display: block;
}

.nav-list {
    display: flex;
    flex-direction: column;
}

.nav-item {
    border-bottom: 1px solid var(--color-border);
}

.nav-item:last-child {
    border-bottom: none;
}

.nav-link {
    display: block;
    padding: var(--space-md) var(--container-pad);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.02em;
    transition: color var(--transition-fast);
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--color-text-primary);
}

.nav-link--active {
    color: var(--color-text-primary);
}

/* --------------------------------------------------------------------------
   MAIN CONTENT
   -------------------------------------------------------------------------- */
#content {
    min-height: calc(100vh - 64px - 240px);
}

/* --------------------------------------------------------------------------
   SECTIONS – architectural alternation
   -------------------------------------------------------------------------- */
.section {
    padding: var(--space-2xl) 0;
    border-bottom: 1px solid var(--color-border);
}

.section:last-child {
    border-bottom: none;
}

/* Alternating background to break monotony */
.section--alt {
    background-color: var(--color-bg-alt);
}

/* Elevated surface section */
.section--surface {
    background-color: var(--color-bg-elevated);
}

/* Hero section */
.section--hero {
    padding: var(--space-3xl) 0 var(--space-2xl);
    border-bottom: 1px solid var(--color-border);
    position: relative;
}

/* Accent top line on hero */
.section--hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--color-accent) 20%,
        var(--color-accent) 80%,
        transparent 100%
    );
    opacity: 0.5;
}

.section--hero h1 {
    max-width: 22ch;
}

.section--hero .lead {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    max-width: 58ch;
    line-height: 1.8;
}

/* --------------------------------------------------------------------------
   CONTENT BLOCK – left accent border pattern
   -------------------------------------------------------------------------- */
.content-block {
    border-left: 2px solid var(--color-border-accent);
    padding-left: var(--space-lg);
    margin-top: var(--space-lg);
}

.content-block p {
    margin-bottom: var(--space-sm);
}

/* --------------------------------------------------------------------------
   CARDS / PILLARS – with structured numbering
   -------------------------------------------------------------------------- */
.pillar {
    padding: var(--space-lg) var(--space-lg) var(--space-lg) var(--space-lg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-bg-elevated);
    position: relative;
    transition: border-color var(--transition-base);
}

.pillar:hover {
    border-color: var(--color-border-light);
}

/* Accent top edge */
.pillar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--color-accent);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    opacity: 0.4;
    transition: opacity var(--transition-base);
}

.pillar:hover::before {
    opacity: 0.8;
}

.pillar-number {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    letter-spacing: 0.05em;
    margin-bottom: var(--space-md);
    display: block;
}

.pillar h3 {
    margin-top: 0;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-sm);
    color: var(--color-text-primary);
}

.pillar p {
    font-size: var(--font-size-sm);
    margin-bottom: 0;
    color: var(--color-text-secondary);
}

/* --------------------------------------------------------------------------
   LISTS (structured content)
   -------------------------------------------------------------------------- */
.content-list {
    padding-left: 0;
    margin-top: var(--space-sm);
}

.content-list li {
    position: relative;
    padding-left: var(--space-lg);
    margin-bottom: var(--space-sm);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.content-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.65em;
    width: 8px;
    height: 1px;
    background-color: var(--color-accent);
    opacity: 0.6;
}

/* --------------------------------------------------------------------------
   INLINE GRID DIAGRAM – topology-inspired visual element
   -------------------------------------------------------------------------- */
.topology-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-xl) 0 var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background-color: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.topology-node {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--color-accent);
    border-radius: 50%;
    opacity: 0.6;
}

.topology-node--active {
    background-color: var(--color-accent);
    opacity: 1;
}

.topology-line {
    flex: 1;
    min-width: 24px;
    height: 1px;
    background-color: var(--color-border-light);
}

.topology-label {
    font-family: var(--font-mono);
    font-size: var(--font-size-2xs);
    color: var(--color-text-muted);
    letter-spacing: 0.05em;
    white-space: nowrap;
    margin-left: var(--space-sm);
}

/* --------------------------------------------------------------------------
   DIVIDER – technical horizontal rule
   -------------------------------------------------------------------------- */
.divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg,
        var(--color-border) 0%,
        var(--color-border-light) 50%,
        var(--color-border) 100%
    );
    margin: var(--space-xl) 0;
}

/* --------------------------------------------------------------------------
   BUTTONS
   -------------------------------------------------------------------------- */
.btn {
    display: inline-block;
    padding: 0.625rem var(--space-lg);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.02em;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn--primary {
    background-color: var(--color-accent);
    color: #fff;
    border: 1px solid var(--color-accent);
}

.btn--primary:hover,
.btn--primary:focus-visible {
    background-color: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: #fff;
    box-shadow: 0 0 20px rgba(74, 124, 255, 0.2);
}

.btn--outline {
    background-color: transparent;
    color: var(--color-accent);
    border: 1px solid var(--color-border-accent);
}

.btn--outline:hover,
.btn--outline:focus-visible {
    border-color: var(--color-accent);
    color: var(--color-accent-hover);
    background-color: var(--color-accent-dim);
}

/* --------------------------------------------------------------------------
   CONTACT CARD
   -------------------------------------------------------------------------- */
.contact-card {
    padding: var(--space-lg);
    background-color: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.contact-card h3 {
    margin-top: 0;
    font-size: var(--font-size-base);
    margin-bottom: var(--space-xs);
}

.contact-card p {
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-sm);
    color: var(--color-text-muted);
}

.contact-card a {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
}

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: var(--space-3xl) 0 var(--space-2xl);
    background-color: var(--color-bg-alt);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.footer-brand {
    flex-shrink: 0;
}

.footer-brand a {
    display: inline-block;
    text-decoration: none;
}

.footer-brand img {
    display: block;
    height: 52px;
    width: auto;
}

.footer-divider {
    width: 100%;
    height: 1px;
    background-color: var(--color-border);
}

.footer-contact {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.footer-contact-label {
    font-family: var(--font-mono);
    font-size: var(--font-size-2xs);
    color: var(--color-text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--space-xs);
}

.footer-contact a {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    transition: color var(--transition-fast);
}

.footer-contact a:hover {
    color: var(--color-accent);
}

.footer-legal {
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

.footer-legal p {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

/* --------------------------------------------------------------------------
   DIAGRAMS – structural engineering visuals
   -------------------------------------------------------------------------- */
.diagram {
    margin: 3.5rem 0 0;
    text-align: center;
}

.diagram svg {
    max-width: 100%;
    height: auto;
}

/* --------------------------------------------------------------------------
   UTILITY CLASSES
   -------------------------------------------------------------------------- */
.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;
}

.mt-0  { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0  { margin-bottom: 0; }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* --------------------------------------------------------------------------
   RESPONSIVE – TABLET (768px+)
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
    :root {
        --font-size-h1: 2.75rem;
        --font-size-h2: 1.75rem;
        --container-pad: var(--space-xl);
    }

    .grid--2 { grid-template-columns: repeat(2, 1fr); }
    .grid--3 { grid-template-columns: repeat(2, 1fr); }
    .grid--4 { grid-template-columns: repeat(2, 1fr); }

    .footer-inner {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: flex-start;
    }

    .footer-divider {
        order: 10;
        margin-top: var(--space-lg);
    }

    .footer-legal {
        width: 100%;
        order: 11;
    }
}

/* --------------------------------------------------------------------------
   RESPONSIVE – DESKTOP (1024px+)
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
    :root {
        --font-size-h1: 3rem;
        --container-pad: var(--space-xl);
    }

    /* Show desktop nav */
    .nav-toggle {
        display: none;
    }

    .primary-nav {
        display: block;
        position: static;
        border-bottom: none;
        padding: 0;
        background-color: transparent;
        backdrop-filter: none;
    }

    .nav-list {
        flex-direction: row;
        gap: var(--space-xl);
    }

    .nav-item {
        border-bottom: none;
    }

    .nav-link {
        padding: var(--space-sm) 0;
        position: relative;
    }

    .nav-link--active::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        right: 0;
        height: 2px;
        background-color: var(--color-accent);
        border-radius: 1px;
    }

    /* Grid full columns */
    .grid--3 { grid-template-columns: repeat(3, 1fr); }
    .grid--4 { grid-template-columns: repeat(4, 1fr); }

    .section {
        padding: var(--space-3xl) 0;
    }

    .section--hero {
        padding: var(--space-4xl) 0 var(--space-3xl);
    }

    /* Two-column content layout for certain sections */
    .section-layout {
        display: grid;
        grid-template-columns: 280px 1fr;
        gap: var(--space-2xl);
        align-items: start;
    }

    .section-layout__sidebar {
        position: sticky;
        top: calc(64px + var(--space-xl));
    }
}

/* --------------------------------------------------------------------------
   RESPONSIVE – WIDE DESKTOP (1280px+)
   -------------------------------------------------------------------------- */
@media (min-width: 1280px) {
    :root {
        --container-max: 1280px;
    }
}
