/* ============================================
   COGNITIVE RESEARCH INSTITUTE
   Visual Identity Stylesheet
   Document Reference: CRI-CSS-2025-001
   ============================================ */

:root {
    /* Official CRI Color Palette */
    --institute-green: #7C9070;
    --institute-green-dark: #5a6b52;
    --document-cream: #F5F0E1;
    --archive-black: #2B2B2B;
    --alert-red: #C41E3A;
    --rust-accent: #8B4513;
    --compliance-blue: #4A6670;
    --clinical-white: #FAFAFA;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
    --space-xxl: 60px;
}

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

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Roboto Condensed', sans-serif;
    background-color: var(--institute-green);
    color: var(--archive-black);
    min-height: 100vh;
    line-height: 1.6;
    font-size: 15px;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

/* Headlines - Bebas Neue */
h1, h2, h3 {
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 2px;
    line-height: 1.2;
}

h1 { font-size: 32px; letter-spacing: 4px; }
h2 { font-size: 26px; }
h3 { font-size: 20px; }

/* Subheads - Oswald */
.subhead, h4, h5 {
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

h4 { font-size: 14px; }
h5 { font-size: 12px; }

/* Body - Roboto Condensed (default) */
p {
    margin-bottom: var(--space-md);
}

p:last-child {
    margin-bottom: 0;
}

/* Typewriter - Courier Prime */
.typewriter, code, .form-number, .reference {
    font-family: 'Courier Prime', monospace;
}

/* Cyrillic - PT Sans */
.cyrillic {
    font-family: 'PT Sans', sans-serif;
    font-weight: 700;
}

/* Handwritten - Caveat */
.handwritten {
    font-family: 'Caveat', cursive;
    font-size: 1.2em;
    color: var(--compliance-blue);
    transform: rotate(-1deg);
    display: inline-block;
}

/* ============================================
   LAYOUT
   ============================================ */

.site-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    justify-content: center;
}

.document {
    max-width: 800px;
    width: 100%;
    background: var(--document-cream);
    position: relative;
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.1),
        0 8px 16px rgba(0,0,0,0.1);
    /* Subtle aging */
    background-image: 
        radial-gradient(ellipse at 20% 80%, rgba(139, 69, 19, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 69, 19, 0.02) 0%, transparent 40%);
    background-color: var(--document-cream);
}

/* Double-line institutional border */
.document::before {
    content: "";
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border: 2px solid var(--archive-black);
    pointer-events: none;
}

.document::after {
    content: "";
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    border: 1px solid var(--archive-black);
    pointer-events: none;
}

.document-inner {
    padding: var(--space-xxl) var(--space-xl);
    position: relative;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

.site-header {
    background: var(--archive-black);
    padding: var(--space-md) var(--space-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    text-decoration: none;
    color: var(--document-cream);
}

.header-logo svg {
    width: 40px;
    height: 40px;
}

.header-logo-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    letter-spacing: 3px;
}

.header-logo-text span {
    display: block;
    font-family: 'Courier Prime', monospace;
    font-size: 9px;
    letter-spacing: 1px;
    opacity: 0.6;
}

.main-nav {
    display: flex;
    gap: var(--space-xs);
}

.nav-link {
    font-family: 'Oswald', sans-serif;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--document-cream);
    text-decoration: none;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.nav-link:hover {
    border-color: var(--institute-green);
    background: rgba(124, 144, 112, 0.2);
}

.nav-link.active {
    background: var(--institute-green);
    color: var(--document-cream);
}

/* Mobile menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--document-cream);
    color: var(--document-cream);
    padding: var(--space-sm) var(--space-md);
    font-family: 'Oswald', sans-serif;
    font-size: 12px;
    letter-spacing: 2px;
    cursor: pointer;
}

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
    text-align: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 2px solid var(--archive-black);
}

.page-header h1 {
    margin-bottom: var(--space-sm);
}

.page-subtitle {
    font-family: 'Oswald', sans-serif;
    font-size: 13px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--compliance-blue);
}

.page-ref {
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    color: var(--rust-accent);
    margin-top: var(--space-sm);
}

/* ============================================
   STAMPS & CLASSIFICATIONS
   ============================================ */

.stamp {
    display: inline-block;
    padding: 6px 14px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 14px;
    letter-spacing: 3px;
    border: 3px solid currentColor;
}

.stamp-classified {
    color: var(--alert-red);
    transform: rotate(12deg);
    position: absolute;
    top: 30px;
    right: 30px;
}

.stamp-approved {
    color: var(--institute-green);
    transform: rotate(-3deg);
}

.stamp-processed {
    color: var(--archive-black);
    transform: rotate(2deg);
}

.stamp-redacted {
    background: var(--archive-black);
    color: var(--archive-black);
    border-color: var(--archive-black);
    user-select: none;
}

/* ============================================
   REDACTED TEXT
   ============================================ */

.redacted {
    background: var(--archive-black);
    color: var(--archive-black);
    padding: 0 4px;
    user-select: none;
    cursor: not-allowed;
}

.redacted::selection {
    background: var(--archive-black);
    color: var(--archive-black);
}

.redacted-block {
    background: repeating-linear-gradient(
        0deg,
        var(--archive-black),
        var(--archive-black) 12px,
        transparent 12px,
        transparent 14px
    );
    height: 60px;
    margin: var(--space-md) 0;
}

/* ============================================
   DIVIDERS
   ============================================ */

.divider {
    height: 2px;
    background: var(--archive-black);
    margin: var(--space-lg) 0;
    position: relative;
}

.divider-star::before {
    content: "★";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--document-cream);
    padding: 0 12px;
    color: var(--alert-red);
    font-size: 14px;
}

.divider-dashed {
    border: none;
    border-top: 2px dashed var(--archive-black);
    background: none;
}

/* ============================================
   SECTIONS
   ============================================ */

.section {
    margin-bottom: var(--space-xl);
}

.section:last-child {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--archive-black);
}

.section-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    letter-spacing: 2px;
}

.section-ref {
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    color: var(--rust-accent);
    text-align: right;
}

/* ============================================
   CARDS & PANELS
   ============================================ */

.panel {
    background: var(--clinical-white);
    border: 1px solid var(--archive-black);
    margin-bottom: var(--space-lg);
}

.panel:last-child {
    margin-bottom: 0;
}

.panel-header {
    background: var(--institute-green);
    color: var(--document-cream);
    padding: 12px 20px;
    font-family: 'Oswald', sans-serif;
    font-size: 13px;
    letter-spacing: 2px;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-body {
    padding: var(--space-lg);
}

.panel-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px dashed var(--archive-black);
    font-size: 12px;
    color: var(--compliance-blue);
}

/* Archive document cards */
.archive-card {
    background: var(--document-cream);
    border: 1px solid var(--archive-black);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.archive-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.archive-card-date {
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    color: var(--rust-accent);
    margin-bottom: var(--space-sm);
}

.archive-card-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    letter-spacing: 1px;
    margin-bottom: var(--space-sm);
}

.archive-card-excerpt {
    font-size: 13px;
    color: var(--compliance-blue);
}

.archive-card-classification {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    font-family: 'Courier Prime', monospace;
    font-size: 9px;
    padding: 2px 6px;
    border: 1px solid currentColor;
}

.classification-declassified {
    color: var(--institute-green);
}

.classification-restricted {
    color: var(--alert-red);
}

/* ============================================
   FORMS
   ============================================ */

.form-field {
    margin-bottom: var(--space-lg);
}

.form-field:last-of-type {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--archive-black);
    margin-bottom: var(--space-sm);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px;
    font-family: 'Courier Prime', monospace;
    font-size: 14px;
    background: var(--document-cream);
    border: 1px solid var(--archive-black);
    color: var(--archive-black);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--institute-green);
    box-shadow: 0 0 0 2px rgba(124, 144, 112, 0.3);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #999;
    font-style: italic;
}

.form-submit {
    width: 100%;
    padding: 14px;
    margin-top: var(--space-lg);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    letter-spacing: 4px;
    background: var(--archive-black);
    color: var(--document-cream);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.form-submit:hover {
    background: var(--compliance-blue);
}

.form-submit:active {
    transform: translateY(1px);
}

.form-submit.processing {
    pointer-events: none;
    background: var(--compliance-blue);
}

.form-submit.processing::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: processing 1.5s infinite;
}

@keyframes processing {
    0% { left: -100%; }
    100% { left: 100%; }
}

.form-success {
    display: none;
    text-align: center;
    padding: var(--space-lg);
}

.form-success.visible {
    display: block;
}

.form-fields.hidden {
    display: none;
}

/* Checkbox styling */
.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.form-checkbox input {
    margin-top: 3px;
    accent-color: var(--institute-green);
}

.form-checkbox label {
    font-size: 13px;
    cursor: pointer;
}

/* ============================================
   LISTS
   ============================================ */

.list-institutional {
    list-style: none;
    padding-left: 0;
}

.list-institutional li {
    padding: var(--space-sm) 0;
    padding-left: var(--space-lg);
    position: relative;
    border-bottom: 1px dotted var(--archive-black);
}

.list-institutional li:last-child {
    border-bottom: none;
}

.list-institutional li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--institute-green);
}

/* ============================================
   TABLES
   ============================================ */

.table-institutional {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table-institutional th,
.table-institutional td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border: 1px solid var(--archive-black);
}

.table-institutional th {
    background: var(--institute-green);
    color: var(--document-cream);
    font-family: 'Oswald', sans-serif;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.table-institutional tr:nth-child(even) {
    background: rgba(124, 144, 112, 0.1);
}

/* ============================================
   EMPHASIZED TEXT
   ============================================ */

.emphasized {
    border-bottom: 2px solid var(--alert-red);
    padding-bottom: 1px;
}

.warning-text {
    color: var(--alert-red);
    font-weight: 700;
}

.muted {
    color: var(--compliance-blue);
    font-size: 0.9em;
}

/* ============================================
   QUOTES & CALLOUTS
   ============================================ */

.callout {
    border-left: 4px solid var(--institute-green);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-lg) 0;
    background: rgba(124, 144, 112, 0.1);
    font-style: italic;
}

.callout-warning {
    border-left-color: var(--alert-red);
    background: rgba(196, 30, 58, 0.1);
}

blockquote {
    font-style: italic;
    padding: var(--space-md) var(--space-lg);
    border-left: 3px solid var(--compliance-blue);
    margin: var(--space-lg) 0;
    color: var(--compliance-blue);
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    background: var(--archive-black);
    color: var(--document-cream);
    padding: var(--space-lg);
    text-align: center;
}

.footer-inner {
    max-width: 800px;
    margin: 0 auto;
}

.footer-tagline {
    font-family: 'Courier Prime', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    opacity: 0.8;
    margin-bottom: var(--space-md);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-md);
}

.footer-link {
    font-family: 'Oswald', sans-serif;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--institute-green);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--document-cream);
}

.footer-legal {
    font-size: 10px;
    opacity: 0.5;
}

.footer-legal .cyrillic {
    display: block;
    margin-top: var(--space-sm);
    font-size: 9px;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes malfunction {
    0%, 100% { filter: none; transform: none; }
    10% { filter: hue-rotate(90deg); transform: translateX(-3px); }
    20% { filter: invert(1); transform: translateX(3px); }
    30% { filter: hue-rotate(180deg); transform: translateY(-3px); }
    40% { filter: none; transform: translateY(3px); }
    50% { filter: saturate(3); transform: scale(1.02); }
    60% { filter: brightness(1.5); transform: none; }
    70% { filter: contrast(1.5); transform: translateX(-2px); }
    80% { filter: hue-rotate(270deg); transform: translateX(2px); }
    90% { filter: invert(0.5); transform: none; }
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    97% { opacity: 1; }
    98% { opacity: 0.8; }
    99% { opacity: 1; }
}

.flicker {
    animation: flicker 4s infinite;
}

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

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: var(--space-md);
    }

    .main-nav {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .main-nav.active {
        display: flex;
    }

    .nav-link {
        text-align: center;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .mobile-menu-toggle {
        display: block;
    }

    .main-content {
        padding: var(--space-lg) var(--space-md);
    }

    .document-inner {
        padding: var(--space-xl) var(--space-lg);
    }

    .document::before {
        top: 8px;
        left: 8px;
        right: 8px;
        bottom: 8px;
    }

    .document::after {
        top: 12px;
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .stamp-classified {
        position: relative;
        top: auto;
        right: auto;
        transform: rotate(0);
        display: inline-block;
        margin-bottom: var(--space-md);
    }

    .section-header {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .section-ref {
        text-align: left;
    }

    h1 { font-size: 26px; }
    h2 { font-size: 22px; }

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

@media (max-width: 480px) {
    .document-inner {
        padding: var(--space-lg);
    }

    h1 { font-size: 22px; letter-spacing: 2px; }
}
