/*
 * CSS NAMING CONVENTIONS
 * 
 * 1. Module-prefix pattern: .module-element or #module-element
 *    - Example: .scroll-loading, .scroll-spinner, #scroll-trigger
 *    - Avoid generic names like .loading-indicator or .spinner
 * 
 * 2. CSS Custom Properties (Variables)
 *    - All colors and reusable values in :root
 *    - Example: --color-primary, --color-bg, --max-width
 * 
 * 3. Naming style: kebab-case only (no camelCase or snake_case)
 * 
 * 4. Semantic naming: reflect purpose and module ownership
 *    - Good: .scroll-loading, .post-header, .ticker-track
 *    - Bad: .blue-box, .big-text, .container-1
 */

/*@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');*/

@font-face {
  font-family: 'PxPlusVGA';
  src: url('fonts/Web437_IBM_VGA_8x16.woff') format('woff2');
  font-weight: normal;
  font-style: normal;
}

:root {
    --color-bg: #000000;
    --color-bg-alt: #001a1a;
    --color-primary: #00FFFF;
    --color-accent: #FFFF00;
    --color-positive: #00FF00;
    --color-negative: #FF0000;
    --color-hover: #FF00FF;
    --color-accent-glow: rgba(255, 255, 0, 0.3);
    --max-width: 80%;

    --copperbar-h: 56px;
}

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

body {
    background-color: var(--color-bg);
    color: var(--color-primary);
    font-family: 'PxPlusVGA', monospace;
    font-size: 16px;
    line-height: 32px;
    /* padding: 20px; */
    overflow-x: hidden;

    width: 100%;
    height: 100%;
    margin: 0;
    
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
}

header {
    text-align: center;
    margin: 0 auto 40px;    
    margin-top: 80px;
    /* max-width: var(--max-width); */
    border: 2px solid var(--color-primary);
    padding: 20px;
    background-color: #000000;
}

header h1 {
    color: var(--color-accent);
    font-size: 40px;
    margin-bottom: 10px;
    text-shadow: 2px 2px var(--color-primary);
}

header p {
    color: var(--color-primary);
    font-size: 20px;
}

header .header-tagline-box {
    color: var(--color-primary);
    padding: 15px;
    margin: 15px auto;
    text-align: center;
    /* max-width: var(--max-width); */
    font-size: 16px;    
}

header .header-tagline-box p {
    margin: 0;
}

header .header-tagline-box p:not(:last-child) {
    margin-bottom: 5px;
}

main {
    /* max-width: var(--max-width); */
    margin: 0 auto;
}

article {
    border: 2px solid var(--color-primary);
    padding: 15px;
    margin-bottom: 20px;
    background-color: var(--color-bg-alt);
}

article:hover {
    border-color: var(--color-accent);
    box-shadow: 0 0 10px var(--color-accent-glow);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-primary);
}

.post-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.post-author {
    color: var(--color-accent);
    font-weight: bold;
}

.post-timestamp {
    color: var(--color-primary);
    font-size: 20px;
}

.post-content {
    color: var(--color-primary);
    margin-bottom: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

.post-content p {
    margin-bottom: 10px;
}

.post-content a {
    color: var(--color-accent);
    text-decoration: underline;
    transition: all 0.2s ease;
}

.post-content a:hover {
    color: var(--color-hover);
    text-shadow: 0 0 5px var(--color-hover);
}

.post-download {
    color: var(--color-accent);
    text-decoration: underline;
    cursor: pointer;
}

.post-download:hover {
    color: var(--color-hover);
    text-shadow: 0 0 5px var(--color-hover);
}

.post-content pre {
    background-color: var(--color-bg);
    border: 1px solid var(--color-positive);
    padding: 10px;
    margin: 10px 0;
    overflow-x: auto;
    font-family: 'PxPlusVGA', monospace;
    font-size: 20px;
    line-height: 1.4;
    color: var(--color-positive);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.post-images {
    display: grid;
    gap: 10px;
    margin: 15px 0;
}

.post-images img,
.post-images video {
    /* max-width: 100%; */
    height: auto;
    border: 1px solid var(--color-primary);
    display: block;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--color-accent);
    font-weight: bold;
}

/* Error state */
.error {
    border: 2px solid var(--color-negative);
    background-color: var(--color-bg);
    color: var(--color-negative);
    padding: 15px;
    margin: 20px auto;
    /* max-width: var(--max-width); */
    text-align: center;
}

/* Focus styles */
a:focus-visible,
img:focus-visible,
video:focus-visible,
button:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Form elements */
button, input, select, textarea {
    font-family: 'PxPlusVGA', monospace;
    color: var(--color-primary);
    background-color: var(--color-bg);
    border: 1px solid var(--color-primary);
    padding: 5px 10px;
}

button:hover {
    background-color: var(--color-bg);
    border-color: var(--color-accent);
}

/* Stock ticker */
#ticker-container {
    background-color: var(--color-bg-alt);
    border: 2px solid var(--color-positive);
    border-bottom: 2px solid var(--color-positive);
    padding: 8px;    
    overflow: hidden;
    position: fixed;
    left: 0; 
    top: 0;    
    z-index: 200;
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
}

#breakingnews-container {    
    position: fixed;
    left: 0; 
    bottom: 0;
    width: 100%;
    /* padding: 8px;     */
    height: 80px;

    display: flex;
    align-items: stretch;

    pointer-events: none;

    overflow: hidden;
    z-index: 200;

    background-color: red;
    font-size: 150%;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
}

.breakingnews-label {
    flex: 0 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    background-color: white;
    color: #cc0000;
}

.breakingnews-marquee {
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.breakingnews {
    display: flex;
    width: max-content;
    animation: marquee 55s linear infinite;
}

.breakingnews span {
    white-space: pre;
    padding-right: 4rem;
}

@keyframes marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.ticker-track {
    display: inline-flex;
    white-space: nowrap;
    will-change: transform;
}

.ticker-track.ticker-animate {
    animation: scroll-ticker linear infinite;
}

@keyframes scroll-ticker {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

.ticker-item {
    display: inline-block;
    margin-right: 2ch;
}

.ticker-symbol {
    color: var(--color-primary);
    font-family: 'PxPlusVGA', monospace;
}

.ticker-value {
    font-family: 'PxPlusVGA', monospace;
}

.ticker-positive {
    color: var(--color-positive);
}

.ticker-negative {
    color: var(--color-negative);
}

.ticker-neutral {
    color: #808080;
}

.ticker-neutral.ticker-blink-off {
    opacity: 0;
}

/* Loading indicator */
.scroll-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 40px 20px;
    color: var(--color-primary);
}

.scroll-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--color-primary);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.scroll-loading p {
    font-size: 20px;
    color: var(--color-primary);
}

/* Load more trigger */
#scroll-trigger {
    height: 20px;
    margin-top: 40px;
}

.mainmenu {
    /* font-size: 200%; */
    font-size: clamp(1.1rem, 3vw + 0.5rem, 2rem);
    margin-top: 16px;
    
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.mainmenu a, a:visited {
    border: 1px solid cyan;
    padding: 16px 64px;
    text-transform: uppercase;
    color: white;
    text-decoration: none;
}

.mainmenu a:hover {
    text-decoration: underline;
    color: var(--color-accent);
    background-color: var(--color-primary);
}

/* ============================================
    ANSI GRAPHICS RENDERING
    Rendered via escapes.js → canvas → data URL image
    ============================================ */

.ansi-art-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.bg-effect {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none; /* TODO may want to add interactivity later? */
    background: 0;
    width:100%;
    height:100%;
    padding:0;
    margin:0;
    overflow:hidden;
}

.main-content {
    z-index:100;
    position: relative;    
    display: block;
    width: min(90%,1400px);
    margin: 0 auto;    
}

@keyframes copper-pulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.15); }
}


.copperbar {
    width: 100%;
    height: var(--copperbar-h);
    position: fixed;
    overflow: hidden;

    background: linear-gradient(
      to bottom,
      #000 0%,
      #5a0000 5%,
      #c40000 15%,
      #ff4747 30%,
      #ff7d7d 50%,
      #ff4747 70%,
      #c40000 85%,
      #5a0000 95%,
      #000 100%
    );

    box-shadow: 0 0 8px rgba(255,64,64,0.6);
}

@keyframes copper-hue {
    0%   { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

@keyframes copper-sine {
  0%   { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.0000), 0); }
  5%   { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.0245), 0); }
  10%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.0955), 0); }
  15%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.2061), 0); }
  20%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.3455), 0); }
  25%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.5000), 0); }
  30%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.6545), 0); }
  35%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.7939), 0); }
  40%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.9045), 0); }
  45%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.9755), 0); }
  50%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 1.0000), 0); }
  55%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.9755), 0); }
  60%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.9045), 0); }
  65%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.7939), 0); }
  70%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.6545), 0); }
  75%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.5000), 0); }
  80%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.3455), 0); }
  85%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.2061), 0); }
  90%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.0955), 0); }
  95%  { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.0245), 0); }
  100% { transform: translate3d(0, calc(10vh + (80vh - var(--copperbar-h)) * 0.0000), 0); }
}

.bar1 { animation: copper-sine 3.0s linear infinite, copper-hue 6s linear infinite; }
.bar2 { animation: copper-sine 3.0s linear infinite, copper-hue 6s linear infinite; animation-delay: -0.1s, -1s; }
.bar3 { animation: copper-sine 3.0s linear infinite, copper-hue 6s linear infinite; animation-delay: -0.2s, -2s; }
.bar4 { animation: copper-sine 3.0s linear infinite, copper-hue 6s linear infinite; animation-delay: -0.3s, -3s; }
.bar5 { animation: copper-sine 3.0s linear infinite, copper-hue 6s linear infinite; animation-delay: -0.4s, -4s; }
.bar6 { animation: copper-sine 3.0s linear infinite, copper-hue 6s linear infinite; animation-delay: -0.5s, -5s; }

#effect-canvas
{
    width:100%;
    height:100%;
    display:none;
}

#copperbar-container
{
    display:none;
    width: 100%;
    height: 100%;
    inset: 0;
}