/* ===================================================================
   Pulpit podróży — Indonezja
   Zasada koloru: chrom interfejsu jest chłodny i neutralny.
   Nasycone ciepłe barwy pojawiają się WYŁĄCZNIE jako poziom zagrożenia.
   Dane niepotwierdzone lub przeterminowane dostają teksturę w ukos.
   =================================================================== */

:root {
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --t-xs: 0.75rem;
  --t-sm: 0.8125rem;
  --t-base: 0.9375rem;
  --t-md: 1.0625rem;
  --t-lg: 1.375rem;
  --t-xl: clamp(1.625rem, 1.2rem + 1.6vw, 2.375rem);

  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4.5rem;

  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 10px;

  --wrap: 1140px;
  --ease: 160ms cubic-bezier(0.2, 0, 0, 1);
}

:root,
[data-theme='light'] {
  --paper: #eceeec;
  --surface: #ffffff;
  --surface-2: #f4f6f5;
  --surface-3: #e5e9e7;
  --ink: #14201e;
  --ink-2: #4c5a57;
  --ink-3: #7d8c88;
  --rule: #d4dad7;
  --rule-2: #b9c3bf;

  --signal: #0d6e7a;
  --signal-ink: #08535c;
  --signal-soft: #d8ebee;

  --ok: #2c6e49;
  --ok-soft: #dbeade;
  --watch: #94660a;
  --watch-soft: #f2e6c4;
  --alert: #b0450f;
  --alert-soft: #f6dfd1;
  --danger: #911230;
  --danger-soft: #f4d8dd;
  --unknown-soft: #e2e6e4;

  --hatch: rgba(20, 32, 30, 0.16);
  --shadow: 0 1px 2px rgba(20, 32, 30, 0.07), 0 8px 24px -16px rgba(20, 32, 30, 0.3);
}

[data-theme='dark'] {
  --paper: #0b1313;
  --surface: #121d1d;
  --surface-2: #172322;
  --surface-3: #1e2c2b;
  --ink: #e5ece9;
  --ink-2: #9db0ab;
  --ink-3: #6a7d78;
  --rule: #24322f;
  --rule-2: #33443f;

  --signal: #4cc0d0;
  --signal-ink: #7fd6e2;
  --signal-soft: #123236;

  --ok: #5fbe86;
  --ok-soft: #16301f;
  --watch: #ddab45;
  --watch-soft: #332707;
  --alert: #f07d45;
  --alert-soft: #38200f;
  --danger: #f0637f;
  --danger-soft: #3a121e;
  --unknown-soft: #1d2a28;

  --hatch: rgba(229, 236, 233, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px -16px rgba(0, 0, 0, 0.9);
}

/* ============ SZKIELET ============ */

body {
  background: var(--paper);
  font-family: var(--font-sans);
  font-size: var(--t-base);
  color: var(--ink);
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--s5);
}
@media (max-width: 640px) {
  .wrap { padding-inline: var(--s4); }
}

/* ============ PASEK GÓRNY ============ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
.topbar-in {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding-block: var(--s3);
  flex-wrap: wrap;
}
.mark {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-right: auto;
  min-width: 0;
}
.mark svg { width: 26px; height: 26px; color: var(--signal); flex-shrink: 0; }
.mark-name { font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
.mark-sub { font-size: var(--t-xs); color: var(--ink-3); font-family: var(--font-mono); }

.clocks {
  display: flex;
  gap: var(--s4);
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.clocks b { font-weight: 600; color: var(--ink); }
.clocks span { display: block; font-size: 0.6875rem; color: var(--ink-3); letter-spacing: 0.04em; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-2);
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.is-busy svg { animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ HERO — najbliższe kruche ogniwo ============ */

.hero { padding-block: var(--s6) var(--s5); }
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--ink-3);
  letter-spacing: 0.06em;
  margin-bottom: var(--s3);
}
.hero-line {
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
}
.lamp {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.65rem;
  background: var(--ink-3);
  box-shadow: 0 0 0 4px color-mix(in oklab, currentColor 18%, transparent);
}
.lamp.ok { background: var(--ok); color: var(--ok); }
.lamp.watch { background: var(--watch); color: var(--watch); }
.lamp.alert { background: var(--alert); color: var(--alert); }
.lamp.danger { background: var(--danger); color: var(--danger); }
.lamp.unknown { background: var(--ink-3); color: var(--ink-3); }

.hero h1 {
  font-size: var(--t-xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  max-width: 22ch;
}
.hero-when {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--signal-ink);
  margin-bottom: var(--s2);
}
.hero-why {
  margin-top: var(--s4);
  max-width: 62ch;
  color: var(--ink-2);
  line-height: 1.65;
}
.hero-meta {
  display: flex;
  gap: var(--s5);
  flex-wrap: wrap;
  margin-top: var(--s5);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule);
  font-size: var(--t-sm);
}
.hero-meta div span { display: block; color: var(--ink-3); font-size: var(--t-xs); margin-bottom: 2px; }
.hero-meta div b { font-family: var(--font-mono); font-weight: 600; }

/* ============ PASEK DNI ============ */

.rail-shell { padding-bottom: var(--s6); }
.rail {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  padding-bottom: var(--s3);
  scrollbar-width: thin;
}
.rail-day {
  flex: 0 0 auto;
  width: 46px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: var(--s2) 0 0;
  text-align: center;
  cursor: pointer;
  color: var(--ink-2);
}
.rail-day:hover { border-color: var(--ink-3); }
.rail-day.is-today { border-color: var(--signal); border-width: 2px; }
.rail-day b { display: block; font-family: var(--font-mono); font-size: var(--t-sm); font-weight: 600; color: var(--ink); }
.rail-day i { display: block; font-style: normal; font-size: 0.625rem; color: var(--ink-3); letter-spacing: 0.03em; }
.rail-bar { height: 5px; margin-top: var(--s2); border-radius: 0 0 2px 2px; }
.rail-day.has-critical b::after {
  content: '';
  display: inline-block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--alert);
  vertical-align: super;
  margin-left: 2px;
}

/* ============ SEKCJE ============ */

.sec { padding-block: var(--s6); border-top: 1px solid var(--rule); }
.sec-head { margin-bottom: var(--s5); }
.sec-head h2 {
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.sec-head p { color: var(--ink-2); max-width: 66ch; margin-top: var(--s2); font-size: var(--t-sm); line-height: 1.6; }

/* ============ KARTY REGIONÓW ============ */

.region {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.region + .region { margin-top: var(--s4); }

.region-top {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.region-top h3 { font-size: var(--t-md); font-weight: 600; letter-spacing: -0.015em; }
.region-dates {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--ink-3);
  margin-left: auto;
}

.region-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule);
}
@media (max-width: 780px) {
  .region-grid { grid-template-columns: 1fr; }
}
.pane { background: var(--surface); padding: var(--s5); }
.pane-label {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--ink-3);
  letter-spacing: 0.05em;
  margin-bottom: var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.pane-label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--signal); }
.pane-label .dot.manual { background: var(--ink-3); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--s3) var(--s4); align-items: baseline; }
.kv dt { color: var(--ink-2); font-size: var(--t-sm); }
.kv dd { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.kv dd small { display: block; font-family: var(--font-sans); font-weight: 400; font-size: var(--t-xs); color: var(--ink-3); }

.readout { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }
.readout b {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.readout span { font-size: var(--t-sm); color: var(--ink-2); }

/* ============ ZNACZNIKI POZIOMU ============ */

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 2px var(--s3);
  border-radius: var(--r-sm);
  font-size: var(--t-xs);
  font-weight: 600;
  white-space: nowrap;
  background: var(--unknown-soft);
  color: var(--ink-2);
}
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.watch { background: var(--watch-soft); color: var(--watch); }
.tag.alert { background: var(--alert-soft); color: var(--alert); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }

/* Dane niepotwierdzone albo przeterminowane — tekstura, nie tylko etykieta */
.is-stale {
  background-image: repeating-linear-gradient(135deg, transparent 0 5px, var(--hatch) 5px 6px);
}
.stale-note {
  display: flex;
  gap: var(--s2);
  align-items: flex-start;
  margin-top: var(--s3);
  padding: var(--s3);
  border: 1px dashed var(--rule-2);
  border-radius: var(--r-md);
  font-size: var(--t-xs);
  line-height: 1.55;
  color: var(--ink-2);
}
.stale-note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; color: var(--ink-3); }

/* ============ CO TO ZNACZY DLA PLANU ============ */

.verdict {
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
  font-size: var(--t-sm);
  line-height: 1.65;
  color: var(--ink-2);
}
.verdict strong { color: var(--ink); font-weight: 600; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  padding: var(--s3) var(--s5) var(--s4);
  background: var(--surface-2);
}
.links a {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  padding: var(--s1) var(--s3);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-sm);
  color: var(--signal-ink);
  text-decoration: none;
  background: var(--surface);
}
.links a:hover { border-color: var(--signal); background: var(--signal-soft); }

/* ============ TABELE ============ */

.tbl-shell {
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow-x: auto;
  background: var(--surface);
  box-shadow: var(--shadow);
}
table.data { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
table.data th {
  text-align: left;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--rule-2);
  white-space: nowrap;
}
table.data td {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
table.data tr:last-child td { border-bottom: none; }
table.data .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.data .dim { color: var(--ink-3); font-size: var(--t-xs); }
table.data .name { font-weight: 600; }

/* ============ SEJSMIKA ============ */

.quake {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: var(--s4);
  align-items: center;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--rule);
}
.quake:last-child { border-bottom: none; }
.quake-mag {
  font-family: var(--font-mono);
  font-size: var(--t-md);
  font-weight: 600;
  text-align: center;
  padding: var(--s1) 0;
  border-radius: var(--r-sm);
  font-variant-numeric: tabular-nums;
}
.quake-place { font-size: var(--t-sm); line-height: 1.4; }
.quake-place small { display: block; color: var(--ink-3); font-size: var(--t-xs); font-family: var(--font-mono); margin-top: 2px; }
.quake-dist { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-2); text-align: right; white-space: nowrap; }
.quake-tsunami { color: var(--danger); font-weight: 600; }

/* ============ DZIENNIK ============ */

.log-item {
  display: grid;
  grid-template-columns: 110px 10px 1fr;
  gap: var(--s4);
  padding-block: var(--s4);
  border-bottom: 1px solid var(--rule);
  align-items: start;
}
.log-item:last-child { border-bottom: none; }
.log-when { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); padding-top: 3px; }
.log-mark { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--ink-3); }
.log-mark.ok { background: var(--ok); }
.log-mark.watch { background: var(--watch); }
.log-mark.alert { background: var(--alert); }
.log-body strong { display: block; font-weight: 600; font-size: var(--t-sm); }
.log-body p { color: var(--ink-2); font-size: var(--t-sm); margin-top: 3px; line-height: 1.55; }
@media (max-width: 560px) {
  .log-item { grid-template-columns: 10px 1fr; }
  .log-when { grid-column: 1 / -1; padding-top: 0; }
}

/* ============ OBJAŚNIENIA I ŹRÓDŁA ============ */

.notice {
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: var(--s5);
  font-size: var(--t-sm);
  line-height: 1.7;
  color: var(--ink-2);
}
.notice h3 { font-size: var(--t-base); color: var(--ink); font-weight: 600; margin-bottom: var(--s3); }
.notice p + p { margin-top: var(--s3); }
.notice ul { margin: var(--s3) 0 0 var(--s5); }
.notice li { margin-bottom: var(--s2); }
.notice code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: var(--r-sm);
}

.srcs { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--s3); }
.src {
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s3) var(--s4);
  background: var(--surface);
}
.src span { display: block; font-size: var(--t-xs); color: var(--ink-3); margin-bottom: 2px; }
.src a { font-family: var(--font-mono); font-size: var(--t-sm); color: var(--signal-ink); word-break: break-word; }

footer.foot {
  padding-block: var(--s6) var(--s8);
  border-top: 1px solid var(--rule);
  font-size: var(--t-xs);
  color: var(--ink-3);
  line-height: 1.7;
  max-width: 74ch;
}

/* ============ WCZYTYWANIE ============ */

.skeleton {
  display: inline-block;
  min-width: 3ch;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: transparent;
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: breathe 1.4s ease-in-out infinite; }
  @keyframes breathe { 50% { opacity: 0.45; } }
  .fresh { animation: flash 700ms var(--ease); }
  @keyframes flash { 0% { background: var(--signal-soft); } 100% { background: transparent; } }
}


/* ============ PASEK WIEKU DANYCH ============ */
/* Zawsze widoczny, nie tylko przy awarii — wiek danych jest częścią odczytu. */
.agebar {
  padding: var(--s2) var(--s5);
  font-size: var(--t-xs);
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--rule);
}
.agebar.ok { color: var(--ink-3); }
.agebar.warn { color: var(--watch); background: var(--watch-soft); }
.agebar.bad { color: var(--danger); background: var(--danger-soft); font-weight: 600; }
#staleBar { position: sticky; top: 0; z-index: 30; background: var(--paper); }

/* ============ SYGNAŁ PRASOWY ============ */
.news-note {
  font-size: var(--t-sm);
  color: var(--ink-2);
  margin-bottom: var(--s4);
  max-width: 66ch;
}
.news-topic {
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s3);
}
.news-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: var(--s3);
  font-size: var(--t-sm);
}
.news-items { list-style: none; display: flex; flex-direction: column; gap: var(--s2); }
.news-items a {
  font-size: var(--t-sm);
  color: var(--signal-ink);
  text-decoration: none;
  line-height: 1.45;
}
.news-items a:hover { text-decoration: underline; }
.news-items li::before { content: '· '; color: var(--ink-3); }


/* ============ PASEK POKRYCIA ============ */
/* Jeden segment = jedno pytanie. Kolor mówi, czym jest obstawione. */
.cov-wrap { width: 100%; margin-top: var(--s2); }
.cov { display: flex; align-items: center; gap: 2px; }
.cov i {
  height: 4px;
  flex: 1;
  border-radius: 1px;
  min-width: 6px;
  cursor: help;
}
.cov b {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--ink-3);
  margin-left: var(--s2);
  flex-shrink: 0;
}
.cov-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  margin-bottom: var(--s4);
  font-size: var(--t-xs);
  color: var(--ink-2);
}
.cov-key { display: inline-flex; align-items: center; gap: var(--s2); }
.cov-key i { width: 14px; height: 4px; border-radius: 1px; }

/* ============ DO ZAPYTANIA CZŁOWIEKA ============ */
.ask {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--signal);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s3);
}
.ask-top {
  display: flex;
  align-items: center;
  gap: var(--s3);
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: var(--s2);
}
.ask-who { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--signal-ink); }
.ask-who b { color: var(--ink); }
.ask-why { font-size: var(--t-sm); color: var(--ink-2); margin-top: var(--s2); line-height: 1.55; }
.ask-when {
  font-size: var(--t-xs);
  color: var(--ink-3);
  margin-top: var(--s2);
  font-family: var(--font-mono);
}
