/*
 * Sippa Brand Book — Master Stylesheet
 *
 * All brand book pages MUST use this stylesheet for consistency.
 * This ensures all pages follow the same grid, spacing, typography, and visual standards.
 *
 * Last Updated: 2025-10-23
 * Compliance: 100% with approved brand guidelines from BrandBook Conversation.md
 */

/* ============================================
   FONT IMPORTS
   ============================================ */

/* MonoFur - Official monospace font for code examples */
@import url('https://fonts.cdnfonts.com/css/monofur');

/* ============================================
   CSS VARIABLES — APPROVED BRAND TOKENS
   ============================================ */

:root {
    /* Brand Colors — Approved Palette (FINAL) */
    --sippa-purple: #14052d;
    --midnight-navy: #141830;
    --luxury-black: #0a0a0e;
    --refined-white: #f3f3f6;
    --iridescent-silver: #b6b6c9;

    /* Cool metals only (no gold) */
    --pewter: #8e8e9b;
    --platinum: #c4c5ca;
    --titanium: #9a9ba3;

    /* 8px Baseline Grid System */
    --baseline: 8px;

    /* Typography — Playfair Display for headings, Bitter for body */
    --font-heading: "Playfair Display", serif;
    --font-body: "Bitter", serif;
    --font-mono: "MonoFur", "Consolas", monospace;

    /* Typography — Approved Sizes (8px multiples) */
    --font-size-body: 18px; /* 18px = 2.25 × 8px (approved) */
    --font-size-small: 16px; /* 16px = 2 × 8px */
    --font-size-tiny: 14px; /* 14px = 1.75 × 8px (acceptable for UI) */
    --font-size-nav: 15px; /* 15px = acceptable for navigation */
    --font-size-pill: 13px; /* 13px = acceptable for micro UI */

    /* Headings use light weights (300-400) */
    --font-size-h1: 56px; /* 56px = 7 × 8px */
    --font-size-h2: 40px; /* 40px = 5 × 8px */
    --font-size-h3: 28px; /* 28px = 3.5 × 8px */
    --font-size-h4: 21px; /* 21px = acceptable for h4 */

    /* Typography — Line Heights */
    --line-height-body: 1.7;
    --line-height-heading-h1: 1.14;
    --line-height-heading-h2: 1.18;
    --line-height-heading-h3: 1.25;

    /* Typography — Letter Spacing */
    --letter-spacing-body: normal; /* Bitter: normal spacing */
    --letter-spacing-heading: normal; /* Playfair Display: normal spacing */
    --letter-spacing-ui: 0.02em;
    --letter-spacing-caps: 0.08em;

    /* Spacing Scale (8px multiples only) */
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 40px;
    --space-6: 48px;
    --space-7: 56px;
    --space-8: 64px;
    --space-9: 72px;
    --space-10: 80px;
    --space-11: 88px;
    --space-12: 96px;
    --space-14: 112px;
    --space-16: 128px;

    /* Animation — Approved Timing (Luxury Standard) */
    --transition-duration: 0.4s;
    --transition-easing: cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --max-width: 1080px;
    --nav-height: 72px;
}

/* ============================================
   RESET & BASE
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 200; /* Standard body weight for Bitter */
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
    letter-spacing: var(--letter-spacing-body);
    background-color: var(--luxury-black);
    color: var(--refined-white);
}

/* Subtle background depth (consistent across all pages) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(
            120% 140% at 70% 10%,
            rgba(20, 24, 48, 0.09) 0%,
            transparent 55%
        ),
        radial-gradient(
            100% 120% at 20% 90%,
            rgba(20, 5, 45, 0.09) 0%,
            transparent 60%
        );
    pointer-events: none;
}

/* ============================================
   TYPOGRAPHY — APPROVED SYSTEM
   Playfair Display for headings
   Bitter for body text
   User explicitly said: "bold text looks bad in headlines"
   "Make headings thinner" - use weights 300-400 only
   ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--refined-white);
}

h1 {
    font-size: var(--font-size-h1);
    font-weight: 400; /* Thinnest available for Playfair Display */
    line-height: var(--line-height-heading-h1);
    letter-spacing: var(--letter-spacing-heading);
    margin-bottom: var(--space-3);
}

h2 {
    font-size: var(--font-size-h2);
    font-weight: 400; /* Thinnest available for Playfair Display */
    line-height: var(--line-height-heading-h2);
    letter-spacing: var(--letter-spacing-heading);
    margin-bottom: var(--space-4);
    margin-top: var(--space-12);
}

h3 {
    font-size: var(--font-size-h3);
    font-weight: 400; /* Thinnest available for Playfair Display */
    line-height: var(--line-height-heading-h3);
    letter-spacing: var(--letter-spacing-heading);
    margin-bottom: var(--space-3);
    margin-top: var(--space-8);
}

h4 {
    font-size: var(--font-size-h4);
    font-weight: 400; /* Thinnest available for Playfair Display */
    line-height: 1.4;
    letter-spacing: var(--letter-spacing-heading);
    margin-bottom: var(--space-2);
    margin-top: var(--space-5);
}

p {
    margin-bottom: var(--space-3);
    max-width: 720px;
    text-wrap: pretty; /* Prevent widows/orphans - distributes words intelligently */
}

strong {
    font-weight: 400; /* Emphasis weight for Bitter - clear but refined */
}

em,
.italic {
    font-style: italic;
    font-weight: 200;
}

/* Text balance for headlines and short blocks */
h1,
h2,
h3,
blockquote,
.story-highlight p,
.tagline-primary,
.emphasis-box p,
.intro-text,
.lede,
.type-intro {
    text-wrap: balance; /* Balance line lengths for short text blocks */
}

/* Override balance for very long headings */
h1,
h2,
h3 {
    text-wrap: balance;
}

/* List items also benefit from widow prevention */
li {
    text-wrap: pretty;
}

/* ============================================
   HEADER & NAVIGATION — CONSISTENT ACROSS ALL PAGES
   Must use official logo SVG files only
   ============================================ */

header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 14, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(182, 182, 201, 0.1);
    padding: var(--space-3) var(--space-4);
}

nav {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.nav-logo svg {
    height: 28px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    gap: var(--space-4);
    list-style: none;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--iridescent-silver);
    text-decoration: none;
    font-size: var(--font-size-nav);
    font-weight: 300; /* Light weight for nav */
    letter-spacing: var(--letter-spacing-ui);
    transition: color var(--transition-duration) var(--transition-easing);
    position: relative;
}

/* Current page indicator */
.nav-links a.current {
    color: var(--refined-white);
}

.nav-links a.current::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--refined-white);
    opacity: 0.5;
}

/* Hover & Focus (WITH proper focus indicator) */
.nav-links a:hover,
.nav-links a:focus {
    color: var(--refined-white);
}

.nav-links a:focus {
    outline: 2px solid rgba(182, 182, 201, 0.4);
    outline-offset: 4px;
    border-radius: 2px;
}

/* Auth icon (login/logout) */
.nav-links a.auth-link {
    display: flex;
    align-items: center;
    padding: var(--space-1);
    margin-left: var(--space-2);
    border: 1px solid rgba(182, 182, 201, 0.2);
    border-radius: 4px;
    transition: all var(--transition-duration) var(--transition-easing);
}

.nav-links a.auth-link:hover {
    border-color: var(--iridescent-silver);
    background: rgba(182, 182, 201, 0.08);
}

.nav-links a.auth-link svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* ============================================
   MAIN CONTENT CONTAINER
   NO unnecessary boxes or outlines (per user feedback)
   ============================================ */

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-12) var(--space-4) var(--space-16);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* ============================================
   PAGE HEADER (CONSISTENT STYLE)
   ============================================ */

.page-header {
    margin-bottom: var(--space-10);
    text-align: center;
}

.page-pills {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.pill {
    display: inline-block;
    padding: var(--space-1) calc(var(--space-2) + var(--space-1));
    border: 1px solid rgba(182, 182, 201, 0.25);
    border-radius: 24px;
    font-size: var(--font-size-pill);
    letter-spacing: var(--letter-spacing-caps);
    text-transform: uppercase;
    color: var(--iridescent-silver);
    font-weight: 300;
}

.intro-text {
    max-width: 680px;
    margin: 0 auto var(--space-8);
    font-size: 19px;
    line-height: 1.7;
    color: var(--iridescent-silver);
    text-align: center;
}

/* ============================================
   FOOTER — CONSISTENT ACROSS ALL PAGES
   ============================================ */

footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: var(--space-3) 0;
    margin-top: var(--space-12);
    text-align: center;
}

footer p {
    display: inline;
    font-size: var(--font-size-small);
    color: var(--iridescent-silver);
    margin: 0;
}

footer p + p::before {
    content: " • ";
    margin: 0 var(--space-2);
    color: rgba(182, 182, 201, 0.4);
}

footer a {
    color: var(--iridescent-silver);
    text-decoration: none;
    transition: color var(--transition-duration) var(--transition-easing);
}

footer a:hover {
    color: var(--refined-white);
}

footer a:focus {
    outline: 2px solid rgba(182, 182, 201, 0.4);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================
   COMMON COMPONENTS
   Minimal styling - no unnecessary boxes per user
   ============================================ */

/* Emphasis/Info Boxes - ONLY when functionally necessary */
.emphasis-box {
    background: linear-gradient(
        135deg,
        var(--sippa-purple) 0%,
        var(--midnight-navy) 100%
    );
    border-radius: 12px;
    padding: var(--space-5);
    margin: var(--space-6) 0;
}

.emphasis-box p {
    margin-bottom: var(--space-3);
    max-width: 100%;
}

.emphasis-box p:last-child {
    margin-bottom: 0;
}

/* Code Blocks */
.code-block {
    background: rgba(20, 5, 45, 0.3);
    border-radius: 8px;
    padding: var(--space-4);
    margin: var(--space-4) 0;
    overflow-x: auto;
}

.code-block pre {
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    color: var(--refined-white);
    margin: 0;
}

code {
    font-family: var(--font-mono);
    background: rgba(182, 182, 201, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Lists */
ul,
ol {
    margin-left: var(--space-3);
    margin-bottom: var(--space-3);
}

li {
    margin-bottom: var(--space-2);
    line-height: 1.7;
}

/* Links */
a {
    color: var(--iridescent-silver);
    transition: color var(--transition-duration) var(--transition-easing);
}

a:hover {
    color: var(--refined-white);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-4) 0;
}

th {
    font-family: var(--font-primary);
    font-weight: 400;
    text-align: left;
    padding: var(--space-2);
    border-bottom: 2px solid rgba(182, 182, 201, 0.2);
    color: var(--refined-white);
}

td {
    padding: var(--space-2);
    border-bottom: 1px solid rgba(182, 182, 201, 0.1);
    color: var(--iridescent-silver);
    font-weight: 300;
}

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

/* ============================================
   ACCESSIBILITY — WCAG AA MINIMUM
   ============================================ */

/* Skip Link (for keyboard navigation) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--sippa-purple);
    color: var(--refined-white);
    padding: var(--space-1) var(--space-2);
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    top: 0;
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visible for all interactive elements */
:focus-visible {
    outline: 2px solid rgba(182, 182, 201, 0.4);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    :root {
        --font-size-h1: 40px; /* 40px = 5 × 8px */
        --font-size-h2: 32px; /* 32px = 4 × 8px */
        --font-size-h3: 24px; /* 24px = 3 × 8px */
    }

    h1 {
        font-size: var(--font-size-h1);
    }

    h2 {
        font-size: var(--font-size-h2);
        margin-top: var(--space-8);
    }

    h3 {
        font-size: var(--font-size-h3);
        margin-top: var(--space-6);
    }

    main {
        padding: var(--space-8) var(--space-3) var(--space-12);
    }

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

    .page-pills {
        gap: var(--space-1);
    }

    nav {
        gap: var(--space-3);
    }

    .nav-links {
        gap: var(--space-2);
        font-size: 14px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    body {
        background: white;
        color: black;
    }

    header {
        position: static;
        border-bottom: 2px solid black;
    }

    a {
        text-decoration: underline;
    }

    .no-print {
        display: none;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-center {
    text-align: center;
}
.text-left {
    text-align: left;
}
.text-right {
    text-align: right;
}

.mt-0 {
    margin-top: 0 !important;
}
.mb-0 {
    margin-bottom: 0 !important;
}

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

/* ============================================
   GRADIENT UTILITIES
   As approved: Purple → Navy at 45°
   ============================================ */

.gradient-primary {
    background: linear-gradient(
        45deg,
        var(--sippa-purple),
        var(--midnight-navy)
    );
}

.gradient-overlay {
    position: relative;
}

.gradient-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        var(--sippa-purple),
        var(--midnight-navy)
    );
    opacity: 0.1;
    pointer-events: none;
}

/* ============================================
   AUTO-CENTERING GRID UTILITIES
   Modern grid system that automatically centers orphan items
   ============================================ */

/* 
 * 3-Column Auto-Centering Grid
 * Uses 6-column grid internally for automatic centering
 * Each visible "column" spans 2 of the 6 internal columns
 * 
 * For 5 items: Row 1 has 3 items, Row 2 has 2 items CENTERED
 * Works automatically without manual nth-child selectors
 */
.grid-3-auto-center {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-4);
}

.grid-3-auto-center > * {
    grid-column: span 2; /* Each item spans 2 columns = 1/3 of grid */
}

/* Center orphan items in incomplete rows (for 5 items in 3-column layout) */
.grid-3-auto-center > *:nth-last-child(2):nth-child(3n + 1) {
    grid-column: 2 / span 2; /* Start at column 2 to center 2 remaining items */
}

/* 
 * 2-Column Auto-Centering Grid 
 * Uses 4-column grid internally
 * Automatically centers 1 orphan item
 */
.grid-2-auto-center {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
}

.grid-2-auto-center > * {
    grid-column: span 2; /* Each item spans 2 columns = 1/2 of grid */
}

/* Center single orphan item */
.grid-2-auto-center > *:nth-child(odd):nth-last-child(1) {
    grid-column: 2 / span 2; /* Start at column 2 to center */
}

/* 
 * 4-Column Auto-Centering Grid
 * Uses 12-column grid internally  
 * Centers 1, 2, or 3 orphan items
 */
.grid-4-auto-center {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-4);
}

.grid-4-auto-center > * {
    grid-column: span 3; /* Each item spans 3 columns = 1/4 of grid */
}

/* Center 3 orphans (start at column 2) */
.grid-4-auto-center > *:nth-last-child(3):nth-child(4n + 1) {
    grid-column: 2 / span 3;
}

/* Center 2 orphans (start at column 3 and 6) */
.grid-4-auto-center > *:nth-last-child(2):nth-child(4n + 2) {
    grid-column: 3 / span 3;
}

/* Center 1 orphan (start at column 5) */
.grid-4-auto-center > *:nth-child(4n + 1):nth-last-child(1) {
    grid-column: 5 / span 3;
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .grid-3-auto-center,
    .grid-2-auto-center,
    .grid-4-auto-center {
        grid-template-columns: 1fr;
    }
    
    .grid-3-auto-center > *,
    .grid-2-auto-center > *,
    .grid-4-auto-center > * {
        grid-column: 1 / -1;
    }
}

/* ============================================
   BALANCED SPACING UTILITIES
   Ensures consistent, balanced vertical rhythm
   ============================================ */

/* Standard card with balanced padding (baseline*5 = 40px all around) */
.card-balanced {
    padding: var(--space-5);
    border-radius: 8px;
    background: rgba(20, 5, 45, 0.3);
    border: 1px solid rgba(182, 182, 201, 0.2);
}

/* Compact card (baseline*4 = 32px) */
.card-compact {
    padding: var(--space-4);
    border-radius: 8px;
    background: rgba(20, 5, 45, 0.3);
    border: 1px solid rgba(182, 182, 201, 0.15);
}

/* Spacious card (baseline*6 = 48px) */
.card-spacious {
    padding: var(--space-6);
    border-radius: 8px;
    background: rgba(20, 5, 45, 0.3);
    border: 1px solid rgba(182, 182, 201, 0.2);
}

/* Remove excessive top padding - use this to override unbalanced styles */
.balanced-vertical {
    padding-top: var(--space-5) !important;
    padding-bottom: var(--space-5) !important;
}

/* ============================================
   VERTICAL ALIGNMENT FIX
   Ensures numbered circles, icons, and side-by-side elements align perfectly
   ============================================ */

/* 
 * Fix for horizontal layouts with icons/circles on left and text on right
 * Problem: Circle centers vertically, but text starts at top = misalignment
 * Solution: Align both to top, then add padding to text content to center with circle
 */

/* Apply to any flex container with an icon/circle + text content */
.journey-step,
.attribute-card,
.principle-card,
.philosophy-card,
.subject-card,
.sustainability-card {
    align-items: flex-start !important; /* Align to top, not center */
}

/* Text content containers need top padding to align with circle center */
.journey-content {
    padding-top: 12px !important; /* (52px circle - 28px line-height) / 2 = 12px */
}

/* Ensure icons/circles/numbers have NO top margin - align flush with top */
.journey-number,
.attribute-icon,
.principle-icon,
.philosophy-icon,
.subject-icon,
.sustainability-icon {
    margin-top: 0 !important;
    flex-shrink: 0 !important;
}

/* For card-based layouts with icons at top (not side-by-side) */
.attribute-card .attribute-icon,
.principle-card .principle-icon,
.philosophy-card .philosophy-icon,
.subject-card .subject-icon,
.sustainability-card .sustainability-icon {
    /* These are already correct (icon above text) */
    margin-top: 0 !important;
}

