/* Fatmin Labs Protocol Document Styles */

/* Import IBM Plex Mono from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

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

html {
    scroll-behavior: smooth;
    background-color: #1a1414;
    min-height: 100%;
}

body {
    font-family: 'IBM Plex Mono', 'Courier New', Courier, monospace;
    line-height: 1.7;
    color: #1a1a1a;
    background-color: #1a1414;
    padding: 20px;
    margin: 0;
    position: relative;
    min-height: 100vh;
}

/* CRT Scanline Overlay Effect */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03) 0px,
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 9999;
}

/* Subtle CRT flicker animation */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.01); /* Changed from white to black overlay to not interfere with dark background */
    pointer-events: none;
    z-index: 9998;
    animation: crt-flicker 0.15s infinite;
}

@keyframes crt-flicker {
    0% { opacity: 0.98; }
    50% { opacity: 1; }
    100% { opacity: 0.98; }
}

/* Container for main content */
.protocol-document {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px;
    background-color: #FFFFFF;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #D0D0D0;
}

/* Ensure margins on smaller screens */
@media (max-width: 768px) {
    body {
        padding: 15px;
        line-height: 1.8;
    }
    
    .protocol-document {
        padding: 25px;
    }
    
    header {
        margin: -25px -25px 2em -25px;
        padding: 15px;
    }
    
    h1 {
        font-size: 1.6em;
    }
    
    h2 {
        font-size: 1.4em;
    }
    
    h3 {
        font-size: 1.2em;
    }
    
    h4 {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
        font-size: 0.95em;
    }
    
    .protocol-document {
        padding: 15px;
        box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    }
    
    header {
        margin: -15px -15px 1.5em -15px;
        padding: 12px;
    }
    
    h1 {
        font-size: 1.4em;
    }
    
    h2 {
        font-size: 1.3em;
    }
    
    table.notice-table td {
        padding: 15px;
    }
    
    .back-navigation img {
        max-width: 150px;
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Courier New', Courier, monospace;
}

h1 {
    font-size: 2em;
    margin-bottom: 0.8em;
    margin-top: 0;
    line-height: 1.3;
    color: #2a2a2a;
}

h2 {
    font-size: 1.7em;
    margin-top: 2em;
    margin-bottom: 0.8em;
    line-height: 1.3;
    color: #2a2a2a;
}

h3 {
    font-size: 1.5em;
    margin-top: 1.8em;
    margin-bottom: 0.8em;
    line-height: 1.3;
    color: #333333;
}

h4 {
    font-size: 1.3em;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    line-height: 1.3;
    color: #333333;
    border-left: 4px solid #4a9eff;
    padding-left: 15px;
}

p {
    margin-bottom: 1.2em;
    text-align: justify;
}

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

/* Remove default bold from strong inside headings (already bold) */
h1 strong, h2 strong, h3 strong, h4 strong {
    font-weight: inherit;
}

/* Header section */
header {
    margin-bottom: 3em;
    border-bottom: 3px double #000000;
    padding-bottom: 1.5em;
    background: linear-gradient(to bottom, #f9f9f9 0%, #ffffff 100%);
    padding: 20px;
    margin: -40px -40px 3em -40px;
    border-top: 4px solid #2a2a2a;
}

/* Header image styling */
.header-image {
    margin: 20px 0 0 0;
    text-align: center;
    border-top: 2px solid #d0d0d0;
    padding-top: 20px;
}

.header-image a {
    display: block;
    transition: opacity 0.3s ease;
}

.header-image a:hover {
    opacity: 0.85;
}

.header-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border: 2px solid #2a2a2a;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    filter: grayscale(100%) contrast(1.3) brightness(1.05);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.header-image img:hover {
    filter: grayscale(100%) contrast(1.4) brightness(1.1);
}

.header-image figcaption {
    margin-top: 8px;
    font-size: 0.85em;
    font-style: italic;
    color: #666666;
    font-family: 'IBM Plex Mono', monospace;
}

header h1,
header h2 {
    margin-top: 0.5em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

header h1 {
    color: #2a2a2a;
    border-bottom: 1px solid #cccccc;
    padding-bottom: 0.5em;
}

.classification {
    font-style: italic;
    margin-top: 1em;
    padding: 10px 15px;
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
    font-weight: 600;
}

/* Sections */
section {
    margin-bottom: 3em;
    padding-bottom: 2em;
    border-bottom: 1px dashed #d0d0d0;
}

section:last-of-type {
    border-bottom: none;
}

/* Lists */
ul, ol {
    margin: 1.5em 0 1.5em 0;
    padding-left: 2.5em;
}

li {
    margin-bottom: 0.8em;
    line-height: 1.8;
}

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

/* Nested lists */
ul ul, ol ol, ul ol, ol ul {
    margin: 0.8em 0;
}

/* List markers */
ul {
    list-style-type: square;
}

ol {
    list-style-type: decimal;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5em auto;
    border: 1px solid #999;
    filter: grayscale(100%) contrast(1.2) brightness(1.05);
}

/* 1970s Blueprint/Technical Diagram Styling */
.blueprint-diagram {
    position: relative;
    padding: 20px;
    margin: 2em 0;
    background: linear-gradient(to bottom, #1a3a52 0%, #2a4a62 100%);
    border: 3px double #4a9eff;
    box-shadow: inset 0 0 20px rgba(74, 158, 255, 0.2);
}

.blueprint-diagram::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(74, 158, 255, 0.1) 19px, rgba(74, 158, 255, 0.1) 20px),
        repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(74, 158, 255, 0.1) 19px, rgba(74, 158, 255, 0.1) 20px);
    pointer-events: none;
}

.blueprint-diagram img {
    filter: invert(1) sepia(1) saturate(5) hue-rotate(175deg) brightness(0.9) contrast(1.2);
    border: 2px solid #4a9eff;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
}

.blueprint-diagram::after {
    content: "TECHNICAL SCHEMATIC - FATMIN LABORATORIES";
    position: absolute;
    bottom: 5px;
    right: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.7em;
    color: #4a9eff;
    opacity: 0.6;
    letter-spacing: 1px;
}

/* Alternative vintage technical diagram style */
.technical-diagram {
    position: relative;
    padding: 15px;
    margin: 2em 0;
    background: #F5F5F5;
    border: 2px solid #8b7355;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.technical-diagram::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 1px dashed #8b7355;
    pointer-events: none;
}

.technical-diagram img {
    filter: grayscale(100%) contrast(1.3) brightness(1.05);
    border: 1px solid #8b7355;
}

.technical-diagram::after {
    content: "Fig. " counter(diagram-counter) " - Classification: TECHNICAL";
    counter-increment: diagram-counter;
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75em;
    color: #8b7355;
    background: #F5F5F5;
    padding: 0 10px;
}

/* Initialize diagram counter */
body {
    counter-reset: diagram-counter;
}

/* Tables */
table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    background-color: #FFD699;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

table td, table th {
    padding: 15px;
    border: 2px solid #CC8800;
    background-color: #FFD699;
    font-weight: 500;
}

/* Notice/Warning boxes */
.notice {
    background-color: #FFD699;
    border: 3px solid #CC8800;
    border-left: 6px solid #CC8800;
    padding: 20px;
    margin: 2.5em 0;
    word-wrap: break-word;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.notice strong {
    display: block;
    margin-bottom: 0.8em;
    font-weight: 700;
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Specific table styling for orange notice tables */
table.notice-table {
    background-color: #FFD699;
    border: 3px solid #CC8800;
    border-left: 6px solid #CC8800;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

table.notice-table td {
    padding: 20px;
    background-color: #FFD699;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 500;
    font-style: italic;
    line-height: 1.8;
}

table.notice-table strong {
    font-weight: 700;
    font-style: normal;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #994400;
}

/* Special styling for void document */
.void-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
}

.void-box {
    border: 3px double #000000;
    padding: 40px 60px;
    text-align: center;
    background-color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.void-box h1 {
    letter-spacing: 2px;
}

/* Code elements */
code {
    background-color: #e8f4f8;
    padding: 3px 8px;
    border-radius: 3px;
    border: 1px solid #4a9eff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95em;
    font-weight: 600;
    color: #0066cc;
}

/* Emphasis */
em {
    font-style: italic;
    color: #555555;
}

strong {
    font-weight: bold;
    color: #1a1a1a;
}

/* Emphasis within paragraphs */
p strong {
    font-weight: 700;
}

p em {
    font-style: italic;
}

/* Ensure text doesn't overflow */
p, li, td, th {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Link styling */
a {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #004499;
    text-decoration: underline;
}

a:visited {
    color: #551a8b;
}

/* Back navigation */
.back-navigation {
    text-align: center;
    margin-top: 4em;
    margin-bottom: 2em;
    padding-top: 2em;
    border-top: 2px solid #e0e0e0;
}

.back-navigation a {
    display: inline-block;
    transition: all 0.3s ease;
    padding: 10px;
    border-radius: 5px;
}

.back-navigation a:hover {
    opacity: 0.7;
    transform: translateY(-3px);
    background-color: rgba(74, 158, 255, 0.05);
}

.back-navigation img {
    width: 50%;
    max-width: 180px;
    height: auto;
    margin: 0 auto;
    border: none;
    filter: grayscale(20%);
}

.back-navigation a:hover img {
    filter: grayscale(0%);
}

/* Vintage paper texture effect for document container */
.protocol-document {
    position: relative;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(139, 115, 85, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 115, 85, 0.02) 0%, transparent 50%);
}

/* Print styles */
@media print {
    body {
        background-color: white;
        padding: 0;
    }
    
    body::before,
    body::after {
        display: none;
    }
    
    .protocol-document {
        max-width: 100%;
        padding: 0;
    }
    
    .notice, table.notice-table, table td, table th {
        background-color: #FFC067 !important;
    }
    
    .back-navigation {
        display: none;
    }
    
    .blueprint-diagram,
    .technical-diagram {
        background: white;
        border: 1px solid #000;
    }
}
