/* Artūra kalendārs — tumšā tēma */
:root {
  color-scheme: dark;
  --surface-0: #121216;
  --surface-1: #1a1a21;
  --surface-2: #22222b;
  --border: #32323e;
  --text-primary: #f2f1ea;
  --text-secondary: #b9b8ad;
  --text-muted: #83827a;
  --accent: #d3b673;          /* silti zeltains akcents */
  --accent-dim: #8a7b52;
  --series-1: #3987e5;        /* 1. vilnis */
  --series-2: #d95926;        /* 2. vilnis */
  --series-3: #199e70;        /* 3. vilnis */
  --sum-line: #e8e6da;        /* kopsumma */
  --div-pos: #3987e5;         /* diverģentā skala: pozitīvs */
  --div-neg: #e66767;         /* diverģentā skala: negatīvs */
  --div-mid: #383840;
  --good: #199e70;
  --warn: #c98500;
  --radius: 14px;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

html, body {
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
}

body {
  background:
    radial-gradient(1100px 500px at 70% -10%, rgba(57, 135, 229, 0.08), transparent 60%),
    radial-gradient(900px 420px at 10% 0%, rgba(211, 182, 115, 0.06), transparent 55%),
    var(--surface-0);
  min-height: 100vh;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px 80px; }

/* ------------ galvene ------------ */
header.site {
  padding: 42px 0 10px;
  text-align: center;
}
header.site h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}
header.site h1 .accent { color: var(--accent); }
header.site .subtitle {
  color: var(--text-secondary);
  margin-top: 6px;
  font-size: 0.98rem;
}
.method-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--text-secondary);
  font-size: 0.8rem;
}
.method-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }

/* ------------ kartītes ------------ */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-top: 22px;
}
.card h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.card h2 small {
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.8rem;
  margin-left: 10px;
}

/* ------------ ievade ------------ */
.controls { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.82rem; color: var(--text-secondary); }
.field input[type="date"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 1rem;
  min-width: 180px;
}
.field input[type="date"]:focus { outline: 2px solid var(--accent-dim); border-color: transparent; }

.mode-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.mode-toggle button {
  background: none; border: none; color: var(--text-secondary);
  padding: 10px 18px; font-family: var(--font); font-size: 0.92rem; cursor: pointer;
}
.mode-toggle button.active { background: var(--accent); color: #1a150a; font-weight: 600; }

button.primary {
  background: var(--accent);
  color: #1a150a;
  border: none;
  border-radius: 10px;
  padding: 11px 30px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover { filter: brightness(1.08); }

button.ghost {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
  font-family: var(--font);
  font-size: 0.88rem;
  cursor: pointer;
}
button.ghost:hover { color: var(--text-primary); border-color: var(--accent-dim); }

/* ------------ kopsavilkuma režģis ------------ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.stat .k { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat .v { font-size: 1.45rem; font-weight: 600; margin-top: 4px; }
.stat .s { font-size: 0.85rem; color: var(--text-secondary); margin-top: 3px; }

/* ------------ viļņu tabula ------------ */
table.waves { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.waves th, table.waves td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); }
table.waves th { color: var(--text-muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
table.waves td.num { font-variant-numeric: tabular-nums; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: baseline; }

.stage-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ------------ interpretācija ------------ */
.interp { border-left: 3px solid var(--accent); padding: 4px 0 4px 16px; margin-top: 8px; }
.interp .name { font-weight: 600; font-size: 1.06rem; }
.interp p { color: var(--text-secondary); margin-top: 6px; font-size: 0.95rem; }
.interp .adv { margin-top: 10px; font-size: 0.9rem; }
.interp .adv b { color: var(--text-primary); font-weight: 600; }

/* ------------ grafiki ------------ */
.chart-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.85rem; color: var(--text-secondary); }
.legend .item { display: inline-flex; align-items: center; gap: 7px; }
.legend .line { width: 18px; height: 0; border-top: 2px solid; display: inline-block; }
.legend .line.dashed { border-top-style: dashed; }

.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: auto; }

.viz-tooltip {
  position: absolute;
  pointer-events: none;
  background: #0c0c10;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  z-index: 10;
  display: none;
  min-width: 175px;
}
.viz-tooltip .t-date { color: var(--text-primary); font-weight: 600; margin-bottom: 4px; }
.viz-tooltip .row { display: flex; justify-content: space-between; gap: 14px; }
.viz-tooltip .row .val { font-variant-numeric: tabular-nums; color: var(--text-primary); }

/* rati */
.rings-flex { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.rings-flex .rings-svg { flex: 1 1 340px; max-width: 480px; margin: 0 auto; }
.rings-flex .rings-info { flex: 1 1 260px; font-size: 0.92rem; color: var(--text-secondary); }
.rings-info ul { list-style: none; }
.rings-info li { margin-bottom: 10px; padding-left: 18px; position: relative; }
.rings-info li::before { content: ""; position: absolute; left: 0; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--dot, var(--text-muted)); }

/* gada karte */
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.ymonth .mname { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 5px; }
.ymonth .days { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.ymonth .day {
  aspect-ratio: 1;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}
.ymonth .day:hover { border-color: var(--text-primary); }
.ymonth .day.selected { outline: 2px solid var(--accent); outline-offset: 1px; }

.scale-bar { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 0.78rem; color: var(--text-muted); }
.scale-bar .grad { flex: 0 0 160px; height: 10px; border-radius: 5px;
  background: linear-gradient(90deg, var(--div-neg), var(--div-mid), var(--div-pos)); }

/* ------------ metodika / avoti ------------ */
details.method { margin-top: 22px; }
details.method summary {
  cursor: pointer; color: var(--text-secondary); font-size: 0.92rem;
  padding: 12px 18px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: var(--radius);
}
details.method[open] summary { border-radius: var(--radius) var(--radius) 0 0; }
details.method .body {
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 18px 22px; background: var(--surface-1);
  font-size: 0.9rem; color: var(--text-secondary);
}
details.method .body h3 { font-size: 0.95rem; color: var(--text-primary); margin: 14px 0 6px; }
details.method .body ul { padding-left: 20px; }
details.method .body li { margin-bottom: 4px; }

footer.site {
  margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.8rem; text-align: center;
}

/* ------------ paroles vārti ------------ */
#gate {
  position: fixed; inset: 0; z-index: 100;
  background: var(--surface-0);
  display: flex; align-items: center; justify-content: center;
}
#gate .gate-card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 38px 40px; text-align: center;
  max-width: 360px; width: 90%;
}
#gate h2 { font-weight: 600; margin-bottom: 6px; }
#gate p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 18px; }
#gate input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-primary); padding: 11px 14px;
  font-size: 1rem; font-family: var(--font); text-align: center; margin-bottom: 12px;
}
#gate .err { color: var(--div-neg); font-size: 0.85rem; min-height: 1.2em; margin-top: 8px; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .controls { flex-direction: column; align-items: stretch; }
  .ymonth .days { grid-template-columns: repeat(8, 1fr); }
}
