/* style.css - Inmool Retro Windows 98 Design System
 * VT323 font loaded via non-blocking <link> in HTML head.
 * Critical above-the-fold CSS is inlined in index.html <style> block.
 * This file handles below-fold and component styles.
 */

/* ============================================================
   CSS CUSTOM PROPERTIES (also declared inline in <head> for
   critical path — kept here for archive.html / admin.html)
   ============================================================ */
:root {
  --win-grey: #c0c0c0;
  --win-light: #ffffff;
  --win-shadow: #808080;
  --win-dark: #000000;
  --title-active-start: #000080;
  --title-active-end: #1084d0;
  --bg-color: #ffffff;
  --text-color: #000000;
  --text-muted: #555555;
  --panel-bg: var(--win-grey);
  --matrix-green: #39ff14;
  --screen-bg: #000000;
  --screen-text: #39ff14;
  --brand-color: #000080;
  --panel-header-text: #ffffff;
  --ticker-text: #ffff00;
  --input-bg: #ffffff;
  --input-focus-bg: #ffffcc;
  --table-bg: #ffffff;
  --win-font: 'MS Sans Serif', -apple-system, BlinkMacSystemFont, Tahoma, Geneva, sans-serif;
  --pixel-font: 'VT323', monospace;
}

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

/* ============================================================
   LAYOUT — body, ticker, content area, status bar
   (duplicated from inline critical CSS for archive/admin pages)
   ============================================================ */
body {
  background-color: var(--win-grey);
  font-family: var(--win-font);
  font-size: 13px;
  color: var(--text-color);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

/* [A11Y] Skip-to-content — visually hidden until focused */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000080;
  color: #ffff00;
  padding: 6px 12px;
  font-family: var(--win-font);
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.1s;
}
.skip-link:focus {
  top: 0;
  outline: 2px solid #ffff00;
  outline-offset: 2px;
}

/* Scrolling stock ticker */
.stock-ticker-container {
  background-color: var(--brand-color);
  color: var(--ticker-text);
  border-bottom: 2px solid var(--win-shadow);
  height: 24px;
  display: flex;
  align-items: center;
  overflow: hidden;
  font-family: var(--pixel-font), monospace;
  font-size: 16px;
  white-space: nowrap;
  box-shadow: inset 1px 1px 0px rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.stock-ticker-inner {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 35s linear infinite;
}

@keyframes marquee {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

/* Main content container */
.win-content-area {
  flex-grow: 1;
  overflow-y: auto;
  background-color: var(--bg-color);
  color: var(--text-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

/* Win98-style scrollbar (WebKit only) */
.win-content-area::-webkit-scrollbar { width: 16px; height: 16px; }
.win-content-area::-webkit-scrollbar-track { background: #dfdfdf; box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #fff; }
.win-content-area::-webkit-scrollbar-thumb { background: var(--win-grey); border-top: 1px solid var(--win-light); border-left: 1px solid var(--win-light); border-right: 1px solid var(--win-dark); border-bottom: 1px solid var(--win-dark); box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 var(--win-shadow); }
.win-content-area::-webkit-scrollbar-button { background-color: var(--win-grey); width: 16px; height: 16px; display: block; border-top: 1px solid var(--win-light); border-left: 1px solid var(--win-light); border-right: 1px solid var(--win-dark); border-bottom: 1px solid var(--win-dark); box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 var(--win-shadow); }

/* ============================================================
   HEADER & BRAND
   ============================================================ */
.inmool-brand-header {
  border-bottom: 3px double var(--win-dark);
  padding-bottom: 15px;
  margin-bottom: 20px;
  text-align: center;
}

.brand-title {
  font-family: var(--pixel-font);
  font-size: 52px;
  line-height: 1;
  color: var(--brand-color);
  text-shadow: 2px 2px 0px var(--win-grey), 4px 4px 0px var(--win-shadow);
  font-weight: bold;
}

.brand-tagline {
  font-family: monospace;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 5px;
  letter-spacing: 1px;
}

/* ============================================================
   LAYOUT PRIMITIVES
   ============================================================ */
.web-layout { display: flex; flex-direction: column; gap: 15px; }

/* ============================================================
   LINKS
   ============================================================ */
a.classic-link { color: #0000ff; text-decoration: underline; cursor: pointer; }
a.classic-link:visited { color: #800080; }
a.classic-link:hover   { color: #ff0000; }

/* [A11Y] Visible focus ring on all interactive elements */
:focus-visible {
  outline: 2px dotted #000080;
  outline-offset: 2px;
}

/* ============================================================
   WIN98 3D COMPONENTS
   ============================================================ */
.win98-panel {
  background-color: var(--win-grey);
  border-top: 1px solid var(--win-light);
  border-left: 1px solid var(--win-light);
  border-right: 1px solid var(--win-dark);
  border-bottom: 1px solid var(--win-dark);
  box-shadow: inset 1px 1px 0px #dfdfdf, inset -1px -1px 0px var(--win-shadow);
  padding: 10px;
}

.win98-inset-container {
  background-color: var(--input-bg);
  border-top: 1px solid var(--win-shadow);
  border-left: 1px solid var(--win-shadow);
  border-right: 1px solid var(--win-light);
  border-bottom: 1px solid var(--win-light);
  box-shadow: inset 1px 1px 0px var(--win-dark), inset -1px -1px 0px #dfdfdf;
  padding: 10px;
}

/* Buttons */
.win98-btn {
  font-family: var(--win-font);
  font-size: 12px;
  color: #000000;
  background-color: var(--win-grey);
  border-top: 1px solid var(--win-light);
  border-left: 1px solid var(--win-light);
  border-right: 1px solid var(--win-dark);
  border-bottom: 1px solid var(--win-dark);
  box-shadow: inset 1px 1px 0px #dfdfdf, inset -1px -1px 0px var(--win-shadow);
  padding: 6px 16px;
  cursor: pointer;
  outline: none;
  font-weight: bold;
}
.win98-btn:hover { outline: 1px dotted #000; outline-offset: -4px; }
.win98-btn:active {
  border-top: 1px solid var(--win-dark); border-left: 1px solid var(--win-dark);
  border-right: 1px solid var(--win-light); border-bottom: 1px solid var(--win-light);
  box-shadow: inset 1px 1px 0px var(--win-shadow), inset -1px -1px 0px #dfdfdf;
  padding: 7px 15px 5px 17px;
}
/* [A11Y] Focus ring for keyboard users — matches Win98 dotted style */
.win98-btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

/* Form inputs */
.win98-input {
  width: 100%;
  font-family: monospace;
  font-size: 13px;
  padding: 4px;
  background-color: var(--input-bg);
  color: var(--text-color);
  border-top: 1px solid var(--win-shadow);
  border-left: 1px solid var(--win-shadow);
  border-right: 1px solid var(--win-light);
  border-bottom: 1px solid var(--win-light);
  box-shadow: inset 1px 1px 0px var(--win-dark), inset -1px -1px 0px #dfdfdf;
  outline: none;
}
.win98-input:focus { background-color: var(--input-focus-bg); outline: 1px solid #000080; }

/* ============================================================
   TOOLS TABS (SIP / DCF)
   ============================================================ */
.win98-tabs-header {
  display: flex;
  margin-bottom: -1px;
  padding-left: 5px;
  position: relative;
  z-index: 2;
}

.win98-tab {
  padding: 4px 12px;
  background-color: var(--win-grey);
  border-top: 1px solid var(--win-light);
  border-left: 1px solid var(--win-light);
  border-right: 1px solid var(--win-dark);
  border-bottom: 1px solid transparent;
  box-shadow: inset 1px 1px 0px #dfdfdf;
  margin-right: 2px;
  cursor: pointer;
  font-size: 12px;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  /* [A11Y] Tab elements have tabindex in HTML — ensure visible focus */
  user-select: none;
}
.win98-tab:focus-visible { outline: 1px dotted #000080; outline-offset: -3px; }

.win98-tab.active {
  background-color: var(--win-grey);
  border-bottom: 1px solid var(--win-grey);
  font-weight: bold;
  padding-top: 6px;
  padding-bottom: 5px;
  margin-top: -2px;
  z-index: 3;
}

.win98-tab-content-panel {
  position: relative;
  z-index: 1;
  background-color: var(--win-grey);
  border-top: 1px solid var(--win-light);
  border-left: 1px solid var(--win-light);
  border-right: 1px solid var(--win-dark);
  border-bottom: 1px solid var(--win-dark);
  box-shadow: inset 1px 1px 0px #dfdfdf, inset -1px -1px 0px var(--win-shadow);
  padding: 15px;
}

/* Calculator grid */
.calc-layout { display: grid; grid-template-columns: 1fr 1.2fr; gap: 15px; }
@media (max-width: 600px) { .calc-layout { grid-template-columns: 1fr; } }

.calc-inputs { display: flex; flex-direction: column; gap: 12px; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-weight: bold; font-size: 12px; }

/* Range sliders */
.retro-range-wrapper { display: flex; align-items: center; gap: 8px; }
.win98-range { -webkit-appearance: none; width: 100%; height: 6px; background: var(--win-shadow); outline: none; border-bottom: 1px solid var(--win-light); border-right: 1px solid var(--win-light); }
.win98-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 20px; background: var(--win-grey); border-top: 1px solid var(--win-light); border-left: 1px solid var(--win-light); border-right: 1px solid var(--win-dark); border-bottom: 1px solid var(--win-dark); box-shadow: inset 1px 1px 0px #dfdfdf, inset -1px -1px 0px var(--win-shadow); cursor: pointer; }
.win98-range:focus-visible { outline: 1px dotted #000080; }

/* Tables */
.win98-table { width: 100%; border-collapse: collapse; font-family: monospace; font-size: 12px; margin-top: 10px; }
.win98-table th { background-color: var(--win-grey); border-top: 1px solid var(--win-light); border-left: 1px solid var(--win-light); border-right: 1px solid var(--win-dark); border-bottom: 1px solid var(--win-dark); box-shadow: inset 1px 1px 0px #dfdfdf, inset -1px -1px 0px var(--win-shadow); padding: 4px; text-align: left; font-weight: bold; }
.win98-table td { border: 1px dotted var(--win-shadow); padding: 4px; background-color: var(--table-bg); color: var(--text-color); }
.win98-table tr.total-row td { font-weight: bold; background-color: var(--win-light); border-top: 2px double var(--win-dark); }

/* Retro digital screen */
.retro-screen { background-color: var(--screen-bg); color: var(--screen-text); font-family: var(--pixel-font); font-size: 24px; padding: 8px; border-top: 1px solid var(--win-shadow); border-left: 1px solid var(--win-shadow); border-right: 1px solid var(--win-light); border-bottom: 1px solid var(--win-light); box-shadow: inset 1px 1px 0px var(--win-dark); text-align: right; line-height: 1; }

/* Pixel bar chart */
.pixel-chart-container { margin-top: 15px; border: 1px dashed var(--win-shadow); padding: 10px; background-color: var(--bg-color); }
.chart-bar-wrapper { margin-bottom: 8px; }
.chart-bar-label { font-size: 11px; font-weight: bold; margin-bottom: 2px; display: flex; justify-content: space-between; }
.chart-bar-track { height: 18px; background-color: #e0e0e0; border-top: 1px solid var(--win-shadow); border-left: 1px solid var(--win-shadow); border-right: 1px solid var(--win-light); border-bottom: 1px solid var(--win-light); display: flex; }
.chart-bar-fill { height: 100%; background: repeating-linear-gradient(45deg, #000080, #000080 4px, #0000a0 4px, #0000a0 8px); box-shadow: inset 1px 1px 0 #fff; }
.chart-bar-fill.wealth { background: repeating-linear-gradient(45deg, #008000, #008000 4px, #00a000 4px, #00a000 8px); }

/* ============================================================
   UNDER CONSTRUCTION (Learn section)
   ============================================================ */
.under-construction-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; border: 2px solid var(--win-dark); color: #ffffff; text-shadow: 2px 2px 0px #000000; box-shadow: inset 1px 1px 0px rgba(255,255,255,0.4); }
.construction-inner { background-color: var(--win-grey); border-top: 2px solid var(--win-light); border-left: 2px solid var(--win-light); border-right: 2px solid var(--win-dark); border-bottom: 2px solid var(--win-dark); color: #000; text-shadow: none; padding: 25px; max-width: 480px; }
.construction-icon { margin: 0 auto 15px auto; width: 48px; height: 48px; }
.construction-inner h2 { font-family: var(--pixel-font); font-size: 28px; color: #800000; margin-bottom: 10px; }
.construction-inner p { font-size: 13px; line-height: 1.4; margin-bottom: 15px; }

/* ============================================================
   WIN98 DIALOG (error modal)
   ============================================================ */
.win-dialog-overlay {
  display: none;
  /* [FIX] position:fixed so overlay covers viewport even when page is scrolled */
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.win-dialog { width: 320px; background-color: var(--win-grey); border-top: 1px solid var(--win-light); border-left: 1px solid var(--win-light); border-right: 1px solid var(--win-dark); border-bottom: 1px solid var(--win-dark); box-shadow: inset 1px 1px 0px #dfdfdf, inset -1px -1px 0px var(--win-shadow), 4px 4px 15px rgba(0,0,0,0.4); padding: 3px; z-index: 1001; }
.dialog-body { padding: 15px; display: flex; gap: 12px; align-items: flex-start; }
.dialog-icon { width: 32px; height: 32px; flex-shrink: 0; }
.dialog-msg { font-size: 12px; line-height: 1.4; }
.dialog-buttons { display: flex; justify-content: center; gap: 10px; margin-top: 10px; margin-bottom: 10px; }

/* Title bar (used inside dialog) */
.title-bar { display: flex; justify-content: space-between; align-items: center; padding: 3px 5px; color: #ffffff; font-weight: bold; }
.title-bar-text { display: flex; align-items: center; gap: 4px; }
.win-btn-control { background-color: var(--win-grey); border-top: 1px solid var(--win-light); border-left: 1px solid var(--win-light); border-right: 1px solid var(--win-dark); border-bottom: 1px solid var(--win-dark); box-shadow: inset 1px 1px 0px #dfdfdf, inset -1px -1px 0px var(--win-shadow); display: flex; align-items: center; justify-content: center; cursor: pointer; outline: none; }
.win-btn-control svg { width: 8px; height: 8px; fill: #000; }
.win-btn-control:focus-visible { outline: 1px dotted #000080; }

/* ============================================================
   STATUS BAR (footer)
   ============================================================ */
.browser-status-bar { display: flex; background-color: var(--win-grey); border-top: 2px solid var(--win-shadow); font-size: 11px; height: 20px; align-items: center; flex-shrink: 0; width: 100%; }
.status-field { padding: 2px 6px; border-right: 1px solid var(--win-shadow); box-shadow: 1px 0 0 var(--win-light); height: 100%; display: flex; align-items: center; white-space: nowrap; overflow: hidden; }
.status-field.flexible { flex-grow: 1; border-right: 1px solid var(--win-shadow); }
.status-field.right { width: 100px; justify-content: flex-end; gap: 4px; }

/* ============================================================
   NEWSPAPER BROADSHEET — NEWS GRID
   ============================================================ */
.newspaper-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 24px; background-color: #fffff8; padding: 15px; border-top: 1px solid var(--win-shadow); border-left: 1px solid var(--win-shadow); border-right: 1px solid var(--win-light); border-bottom: 1px solid var(--win-light); box-shadow: inset 1px 1px 0px var(--win-dark), inset -1px -1px 0px #dfdfdf; margin-bottom: 15px; }
.newspaper-col { display: flex; flex-direction: column; }
.newspaper-col:not(:last-child) { border-right: 1px solid #d3d3c8; padding-right: 12px; }
.newspaper-article { padding: 12px 0; border-bottom: 1px solid #e9e9df; }
.newspaper-article:last-child { border-bottom: none; }
.newspaper-headline-link { text-decoration: none; color: #111111; }
.newspaper-headline { font-family: Georgia, 'Times New Roman', Times, serif; font-size: 17px; font-weight: bold; line-height: 1.6; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.newspaper-headline-link:hover .newspaper-headline { color: #000080; text-decoration: underline; }
.newspaper-meta { display: flex; justify-content: space-between; align-items: center; font-family: monospace; font-size: 11px; color: #666655; margin-top: 4px; }
.newspaper-source { background-color: #f1f1e6; border: 1px solid #d3d3c8; padding: 2px 6px; font-weight: bold; color: #444433; }
.newspaper-time { font-style: italic; }

@keyframes progress-slide { 0% { left: -40%; } 100% { left: 100%; } }

@media (max-width: 992px) {
  .newspaper-grid { grid-template-columns: repeat(2, 1fr); }
  .newspaper-col { border-right: none !important; padding-right: 0 !important; }
  .newspaper-col:nth-child(2n-1) { border-right: 1px solid #d3d3c8 !important; padding-right: 12px !important; }
}
@media (max-width: 600px) {
  .newspaper-grid { grid-template-columns: 1fr; }
  .newspaper-col { border-right: none !important; padding-right: 0 !important; }
  .newspaper-col:not(:last-child) { border-bottom: 1px solid #d3d3c8; padding-bottom: 15px; margin-bottom: 15px; }
}

/* ============================================================
   NEWSPAPER COMMENTARY (Market Pulse)
   ============================================================ */
.newspaper-commentary-box { background-color: #fffff8; border: 3px double #333322; padding: 18px 24px; font-family: Georgia, 'Times New Roman', Times, serif; }
.commentary-header { border-bottom: 1px dotted #c3c3b8; padding-bottom: 12px; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.commentary-label-box { display: flex; flex-direction: column; gap: 4px; }
.commentary-label { font-family: var(--win-font); font-size: 11px; font-weight: bold; letter-spacing: 1px; text-transform: uppercase; color: #800000; border: 1px solid #800000; padding: 2px 6px; display: inline-block; align-self: flex-start; }
.commentary-title { font-size: 20px; font-weight: bold; color: #111111; line-height: 1.3; }
.commentary-byline-container { display: flex; align-items: center; gap: 10px; }
.commentary-byline-text { font-family: var(--win-font); font-size: 11px; color: var(--text-color); line-height: 1.4; }
.commentary-author { font-weight: bold; font-size: 12px; display: block; }
.commentary-date { color: var(--text-muted); display: block; }
.commentary-body { font-size: 16px; line-height: 1.6; color: #111111; text-align: justify; }
.commentary-body p { margin-bottom: 12px; }
.commentary-body p:last-child { margin-bottom: 0; }
.commentary-placeholder { font-family: monospace; font-size: 13px; color: var(--text-muted); font-style: italic; text-align: center; padding: 10px 0; }

/* ============================================================
   NEWS CATEGORY TABS — active state
   ============================================================ */
.news-cat-tab.active {
  background-color: #000080;
  color: #ffffff;
  border-top: 1px solid #000080;
  border-left: 1px solid #000080;
  border-right: 1px solid #000040;
  border-bottom: 1px solid #000040;
  box-shadow: none;
}
