/* ============================================================
   SERGIO GALAVIZ — Personal Landing Page
   Style: 80s Concept Car Dashboard / Phosphor Green CRT
   ============================================================ */

@import 'tokens.css';

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

/* ── BASE ──────────────────────────────────────────────────── */
html, body {
  width: 100%;
  height: 100%;
  background: var(--black);
  color: var(--g1);
  font-family: 'Share Tech Mono', monospace;
  overflow: hidden;
  cursor: crosshair;
}

/* ── CRT EFFECTS ───────────────────────────────────────────── */

/* Scanlines */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 2px,
    var(--overlay-scanline) 2px,
    var(--overlay-scanline) 4px
  );
}

/* Phosphor vignette */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 998; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, var(--overlay-vignette) 100%);
}

/* Noise texture overlay */
.noise {
  position: fixed; inset: 0; z-index: 997; pointer-events: none; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
}

/* ── THEME ADJUSTMENTS ─────────────────────────────────────── */

/* Light: hide noise and strip bloom from interactive elements */
[data-theme="light"] .noise              { display: none; }
[data-theme="light"] .bar-fill           { box-shadow: none; }
[data-theme="light"] .status-dot::before { box-shadow: none; }
[data-theme="light"] .widget::before     { opacity: 0.3; }

/* Dark: dim noise very slightly */
[data-theme="dark"] .noise { opacity: 0.02; }

/* ── LAYOUT GRID ───────────────────────────────────────────── */
.cockpit {
  position: relative; z-index: 1;
  width: 100vw; height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 220px 1fr 220px;
  padding: 24px;
}

/* ── TOP BAR ───────────────────────────────────────────────── */
.top-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--g4);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.top-bar .unit {
  font-size: clamp(9px, 1.5vw, 10px);
  color: var(--g3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.top-bar .unit span { color: var(--g2); }

.status-row {
  display: flex;
  gap: 24px;
  align-items: center;
}

.status-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: clamp(8px, 1.4vw, 9px);
  letter-spacing: 0.12em;
  color: var(--g3);
}

.status-dot::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--g2);
  box-shadow: var(--glow-sm);
  animation: pulse 2.4s ease-in-out infinite;
}

.status-dot.amber::before {
  background: var(--amber);
  box-shadow: var(--glow-amber-sm);
  animation-delay: 0.8s;
}

/* ── MODE TOGGLE ───────────────────────────────────────────── */
.mode-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--g4);
}

.mode-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--g4);
  color: var(--g3);
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.15em;
  padding: 3px 8px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
}

.mode-btn:last-child {
  border-right: none;
}

.mode-btn[aria-pressed="true"] {
  background: var(--g4);
  color: var(--black);
}

.mode-btn:hover:not([aria-pressed="true"]) {
  color: var(--g1);
}

/* ── PANELS ────────────────────────────────────────────────── */
.panel-left {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 20px;
  border-right: 1px solid var(--g5);
}

.center {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 40px;
  position: relative;
}

.panel-right {
  grid-column: 3;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-left: 20px;
  border-left: 1px solid var(--g5);
}

/* ── BOTTOM BAR ────────────────────────────────────────────── */
.bottom-bar {
  grid-column: 1 / -1;
  border-top: 1px solid var(--g4);
  padding-top: 16px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── WIDGET CARD ───────────────────────────────────────────── */
.widget {
  background: var(--panel);
  border: 1px solid var(--g4);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.widget::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--g3), transparent);
}

.widget-label {
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--g4);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.widget-value {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(16px, 3.5vw, 22px); font-weight: 700;
  color: var(--g1);
  text-shadow: var(--glow-md);
  line-height: 1;
}

.widget-value.small  { font-size: 14px; }
.widget-value.amber  { color: var(--amber); text-shadow: var(--glow-amber-md); }

.widget-sub {
  font-size: 9px;
  color: var(--g3);
  margin-top: 4px;
  letter-spacing: 0.1em;
}

/* ── BAR GRAPH ─────────────────────────────────────────────── */
.bar-graph {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar-label {
  font-size: 8px;
  color: var(--g3);
  width: 50px; flex-shrink: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bar-track {
  flex: 1; height: 4px;
  background: var(--g0);
  border: 1px solid var(--g5);
  position: relative; overflow: hidden;
}

.bar-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: var(--g2);
  box-shadow: var(--glow-sm);
  transform-origin: left;
  animation: barIn 1.2s cubic-bezier(0.23, 1, 0.32, 1) both;
}

.bar-fill--primary { background: var(--g1); }

.bar-pct {
  font-size: 8px;
  color: var(--g3);
  width: 24px; text-align: right;
  letter-spacing: 0.05em;
}

/* ── GAUGE ARC ─────────────────────────────────────────────── */
.gauge-wrap { display: flex; justify-content: center; padding: 4px 0 0; }
.gauge-svg  { overflow: visible; width: min(120px, 100%); height: auto; }

/* ── CLOCK ─────────────────────────────────────────────────── */
.clock-display {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(20px, 5.5vw, 28px); font-weight: 900;
  color: var(--g1);
  text-shadow: var(--glow-lg);
  letter-spacing: 0.06em;
  text-align: center;
}

.clock-date {
  font-size: 9px;
  color: var(--g3);
  letter-spacing: 0.18em;
  text-align: center;
  margin-top: 3px;
}

/* ── CENTER HERO ───────────────────────────────────────────── */
.hero-name {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(28px, 4vw, 52px); font-weight: 900;
  color: var(--g1);
  text-shadow: var(--glow-lg);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1;
  animation: fadeUp 1s ease both 0.3s;
}

.hero-rule {
  width: 100%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--g2), var(--g2), transparent);
  margin: 18px 0;
  box-shadow: var(--glow-sm);
  animation: fadeUp 1s ease both 0.5s;
}

.hero-tagline {
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(11px, 2.5vw, 14px); font-weight: 300;
  color: var(--g3);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  text-align: center;
  animation: fadeUp 1s ease both 0.7s;
}

/* Corner brackets on center panel */
.center::before, .center::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  border-color: var(--g3);
  border-style: solid;
  opacity: 0.5;
}
.center::before { top: 0;    left: 20px;  border-width: 1px 0 0 1px; }
.center::after  { bottom: 0; right: 20px; border-width: 0 1px 1px 0; }

/* ── NAV LINKS ─────────────────────────────────────────────── */
.nav-links {
  display: flex;
  gap: 8px;
  margin-top: 36px;
  flex-wrap: wrap;
  justify-content: center;
  animation: fadeUp 1s ease both 0.9s;
}

.nav-link {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--g4);
  background: var(--panel);
  color: var(--g2);
  text-decoration: none;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: all 0.25s ease;
  overflow: hidden;
  cursor: pointer;
}

.nav-link::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--g5) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.25s;
}

.nav-link:hover {
  border-color: var(--g2);
  color: var(--g1);
  box-shadow: var(--glow-md), inset 0 0 20px var(--dim);
  text-shadow: var(--glow-sm);
}

.nav-link:hover::before { opacity: 1; }

.nav-link-icon { width: 12px; height: 12px; opacity: 0.7; }

/* ── DECORATIVE GRID ───────────────────────────────────────── */
.grid-bg {
  position: absolute; inset: 0; pointer-events: none; z-index: -1;
  background-image:
    linear-gradient(var(--g0) 1px, transparent 1px),
    linear-gradient(90deg, var(--g0) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 30%, black 80%);
  mask-image: radial-gradient(ellipse at center, transparent 30%, black 80%);
}

/* ── PANEL-RIGHT BAR GRAPH SPACING ─────────────────────────── */
.panel-right .bar-graph { margin-top: 10px; }

/* ── TICKER ────────────────────────────────────────────────── */
.ticker-wrap { overflow: hidden; flex: 1; }

.ticker {
  display: flex;
  gap: 40px;
  white-space: nowrap;
  animation: ticker 18s linear infinite;
  font-size: 9px;
  color: var(--g4);
  letter-spacing: 0.14em;
}

.ticker span { color: var(--g3); }

/* ── COORDINATES ───────────────────────────────────────────── */
.coords {
  font-size: 9px;
  color: var(--g4);
  letter-spacing: 0.1em;
}

/* ── ANIMATIONS ────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

@keyframes barIn {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

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

@keyframes gaugeIn {
  from { stroke-dashoffset: 157; }
  to   { stroke-dashoffset: 28; }
}

/* Staggered panel entry */
.panel-left  > *:nth-child(1) { animation: fadeUp 0.8s ease both 0.10s; }
.panel-left  > *:nth-child(2) { animation: fadeUp 0.8s ease both 0.20s; }
.panel-left  > *:nth-child(3) { animation: fadeUp 0.8s ease both 0.30s; }
.panel-left  > *:nth-child(4) { animation: fadeUp 0.8s ease both 0.40s; }
.panel-left  > *:nth-child(5) { animation: fadeUp 0.8s ease both 0.50s; }
.panel-right > *:nth-child(1) { animation: fadeUp 0.8s ease both 0.20s; }
.panel-right > *:nth-child(2) { animation: fadeUp 0.8s ease both 0.35s; }
.panel-right > *:nth-child(3) { animation: fadeUp 0.8s ease both 0.50s; }
.panel-right > *:nth-child(4) { animation: fadeUp 0.8s ease both 0.65s; }
.panel-right > *:nth-child(5) { animation: fadeUp 0.8s ease both 0.80s; }

/* ── FINANCE CARDS ─────────────────────────────────────────── */
.finance-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.finance-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid var(--g5);
  background: var(--g0);
}

.finance-ticker {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  color: var(--g4);
  letter-spacing: 0.15em;
}

.finance-price {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  color: var(--g1);
  text-shadow: var(--glow-sm);
  letter-spacing: 0.05em;
}

.finance-change {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.1em;
}

.finance-change.positive { color: var(--g2); }
.finance-change.negative { color: var(--red); }

.sparkline {
  width: 100%;
  height: 20px;
  display: block;
  margin-top: 4px;
}

/* ── MOON PHASE ────────────────────────────────────────────── */
.moon-display {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  cursor: default;
}

.moon-svg {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(0, 255, 106, 0.5));
}

[data-theme="light"] .moon-svg { filter: none; }
[data-theme="dark"]  .moon-svg { filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.2)); }

.moon-data {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── TOOLTIP ───────────────────────────────────────────────── */
[data-tooltip] { position: relative; }

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: var(--panel);
  border: 1px solid var(--g5);
  color: var(--g3);
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  padding: 4px 8px;
  white-space: nowrap;
  letter-spacing: 0.1em;
  z-index: 20;
  pointer-events: none;
}

/* ── PILGRIMS' WAY MAP ─────────────────────────────────────── */
.route-meta {
  font-family: 'Share Tech Mono', monospace;
  font-size: 7px;
  color: var(--g4);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.route-map {
  width: 100%;
  height: auto;
  display: block;
}

.route-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 6px;
  fill: var(--g4);
  letter-spacing: 0.08em;
}

/* ── RESPONSIVE — TABLET (600px – 899px) ───────────────────── */
@media (max-width: 899px) {
  html, body { overflow: auto; }

  .cockpit {
    grid-template-columns: 160px 1fr 160px;
    height: auto;
    min-height: 100vh;
    padding: 16px;
  }

  .panel-left, .panel-right { gap: 10px; }

  .widget { padding: 10px 12px; }

  .bar-label { width: 40px; }

  .status-row { gap: 12px; }

  .hero-rule { margin: 12px 0; }

  .nav-links { margin-top: 20px; }
}

/* ── RESPONSIVE — MOBILE (≤ 599px) ─────────────────────────── */
@media (max-width: 599px) {
  .cockpit {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
    height: auto;
    min-height: 100vh;
    padding: 12px;
  }

  .panel-left, .panel-right {
    grid-column: 1;
    grid-row: auto;
    border: none;
    border-top: 1px solid var(--g5);
    padding: 16px 0 0;
    flex-direction: column;
    gap: 10px;
  }

  .panel-left .widget,
  .panel-right .widget { width: 100%; }

  .center { grid-column: 1; grid-row: 2; padding: 20px 0; }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-link { justify-content: center; }

  /* Drop the third status dot — keeps header lean on small screens */
  .status-dot:nth-child(3) { display: none; }

  .status-row {
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    order: 3;
  }

  .ticker-wrap { display: none; }

  .bottom-bar { gap: 0; }

  .top-bar {
    flex-wrap: wrap;
    gap: 8px 0;
  }

  .top-bar .unit { flex: 1; }
}
