/* ═══════════════════════════════════════
   AM4Info – shared stylesheet
   ═══════════════════════════════════════ */

/* ── Theme tokens ── */
:root {
  --bg:             #0d1117;
  --surface:        #161b22;
  --border:         #21262d;
  --header-bg:      #080c13;
  --nav-bg:         #0e1520;
  --footer-bg:      #080c13;
  --text:           #e8eaf0;
  --text-soft:      #a0a8b8;
  --muted:          #5a6070;
  --current-bg:     #0a1a0a;
  --current-border: #1a3a1a;
  --nav-link:       #7a90a8;
  --nav-active:     #f0a500;
  --nav-hover:      #e8eaf0;
  --accent-fuel:    #f0a500;
  --accent-co2:     #00c896;
  --clr-green:      #4cde80;
  --clr-orange:     #f0a500;
  --clr-red:        #ff4d4d;
  --chart-grid:     #1e2229;
  --chart-text:     #5a6070;
  --tooltip-bg:     #111318;
  --tooltip-title:  #e8eaf0;
}

[data-theme="light"] {
  --bg:             #ede9e0;
  --surface:        #f8f5f0;
  --border:         #d8d2c8;
  --header-bg:      #1e2d3f;
  --nav-bg:         #263547;
  --footer-bg:      #1e2d3f;
  --text:           #18202e;
  --text-soft:      #38485e;
  --muted:          #7a8898;
  --current-bg:     #eaf3ea;
  --current-border: #a8cca8;
  --nav-link:       #8aaac8;
  --nav-active:     #f0a500;
  --nav-hover:      #ffffff;
  --clr-green:      #1a8c3a;
  --clr-orange:     #b87800;
  --clr-red:        #cc2020;
  --chart-grid:     #d8d2c8;
  --chart-text:     #7a8898;
  --tooltip-bg:     #f8f5f0;
  --tooltip-title:  #18202e;
}

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

body {
  font-family: 'Space Mono', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background .25s, color .25s;
}

/* ── Site header ── */
.site-header {
  height: 80px;
  background: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 3px solid var(--accent-fuel);
  flex-shrink: 0;
  gap: 16px;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}
.header-logo {
  height: 52px;
  width: 52px;
  border-radius: 10px;
  background: var(--accent-fuel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 19px;
  color: #000;
  flex-shrink: 0;
  letter-spacing: -1px;
}
.header-site-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: clamp(12px, 1.8vw, 19px);
  color: #fff;
  letter-spacing: -.2px;
}
.header-site-name em { color: var(--accent-fuel); font-style: normal; }

/* ── Theme toggle ── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 5px 10px;
  border-radius: 20px;
  transition: background .2s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,.08); }
.toggle-icon { font-size: 15px; line-height: 1; }
.toggle-track {
  width: 42px;
  height: 22px;
  background: #2a3a4e;
  border-radius: 11px;
  position: relative;
  border: 1px solid rgba(255,255,255,.12);
  transition: background .25s;
}
[data-theme="light"] .toggle-track { background: #7a9ab8; }
.toggle-thumb {
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left .22s;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
[data-theme="light"] .toggle-thumb { left: 22px; }

/* ── Navigation ── */
.site-nav {
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255,255,255,.05);
  flex-shrink: 0;
  transition: background .25s;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-nav ul {
  list-style: none;
  display: flex;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  gap: 2px;
}
.site-nav a {
  display: block;
  padding: 13px 16px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--nav-link);
  text-decoration: none;
  letter-spacing: .2px;
  border-bottom: 3px solid transparent;
  transition: color .18s, border-color .18s;
}
.site-nav a:hover { color: var(--nav-hover); }
.site-nav a.active {
  color: var(--nav-active);
  border-bottom-color: var(--nav-active);
  pointer-events: none;
  cursor: default;
}

/* ── Page wrapper ── */
.page-wrap {
  flex: 1;
  padding: 40px 20px;
  transition: background .25s;
}

/* ── Inner header (price monitor page) ── */
.page-inner-header {
  max-width: 900px;
  margin: 0 auto 36px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.page-inner-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(18px, 3vw, 26px);
  color: var(--text);
  letter-spacing: -.4px;
}
.page-inner-title span { color: var(--accent-fuel); }
.utc-clock { text-align: right; line-height: 2; }
.utc-clock strong,
.utc-clock .local-time {
  color: var(--accent-co2);
  font-size: 14px;
  font-weight: 700;
  display: block;
}

main { max-width: 900px; margin: 0 auto; }

/* ── Generic content pages ── */
.content-area { max-width: 900px; margin: 0 auto; }
.content-area h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(22px, 4vw, 34px);
  color: var(--text);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -.5px;
}
.content-area p {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.85;
  margin-bottom: 18px;
}

/* ── Loader / error ── */
.state-msg {
  text-align: center;
  padding: 80px 0;
  color: var(--muted);
  font-size: 13px;
}
.state-msg.err { color: #ff4d4d; }
.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-fuel);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-bottom: 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── NOW card ── */
.current-card {
  background: var(--current-bg);
  border: 1px solid var(--current-border);
  border-radius: 12px;
  padding: 28px 32px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  animation: fadeIn .4s ease;
  transition: background .25s, border-color .25s;
}
.current-card::before {
  content: 'NOW';
  position: absolute;
  top: 16px; right: 20px;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--accent-co2);
}
.slot-label {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .4px;
  margin-bottom: 16px;
}
.prices-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.price-block .label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.price-block .value {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(28px, 5vw, 40px);
  letter-spacing: -1px;
}
.countdown {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--current-border);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .4px;
}
.countdown span {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-left: 4px;
}

/* ── Conditional colours ── */
.clr-green  { color: var(--clr-green)  !important; }
.clr-orange { color: var(--clr-orange) !important; }
.clr-red    { color: var(--clr-red)    !important; }

/* ── Section heading ── */
.section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ── Chart containers ── */
.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px 12px;
  margin-bottom: 24px;
  height: 260px;
  position: relative;
  transition: background .25s, border-color .25s;
}

/* ── Timeline table ── */
.timeline-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 0 16px 8px;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
  font-family: 'Syne', sans-serif;
}
.timeline-header span:first-child { text-align: center; }
.timeline-header span:not(:first-child) { text-align: right; }
.timeline { display: flex; flex-direction: column; gap: 4px; }
.timeline-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  transition: border-color .15s;
  animation: fadeIn .3s ease both;
}
.timeline-row:hover { border-color: var(--border); }
.timeline-row.is-current {
  background: rgba(240,165,0,.07);
  border-color: rgba(240,165,0,.28) !important;
}
.timeline-row .time {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  font-family: 'Syne', sans-serif;
}
.timeline-row.is-current .time { color: var(--accent-fuel); }
.timeline-row .f { font-weight: 700; text-align: right; font-size: 15px; }
.timeline-row .c { font-weight: 700; text-align: right; font-size: 15px; }
.last-updated { margin-top: 24px; font-size: 11px; color: var(--muted); text-align: right; }

/* ── Footer ── */
.site-footer {
  background: var(--footer-bg);
  border-top: 3px solid var(--accent-fuel);
  padding: 28px 32px;
  flex-shrink: 0;
  transition: background .25s;
}
.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-inner p {
  color: var(--nav-link);
  font-size: 12.5px;
  line-height: 1.7;
  max-width: 620px;
}
.footer-inner a {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-fuel);
  text-decoration: none;
  white-space: nowrap;
}
.footer-inner a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 620px) {
  .site-header { padding: 0 14px; }
  .header-site-name { font-size: 11px; }
  .prices-row { grid-template-columns: 1fr; }
  .price-block .value { font-size: 28px; }
  .site-nav a { padding: 11px 9px; font-size: 11px; }
}