/* ARGPT Trading Calendar
   Doomsday dark, shared with alrizqi.com (see mockup/CLAUDE.md). Green and red
   carry meaning here (profit / loss); everything else stays neutral. */

:root {
  --ink: #070A08;
  --ink-2: #0E1411;
  --surface: #0E1411;
  --surface-2: #121A16;
  --text: #EDF3EE;
  --text-dim: #A3B3A8;
  --text-faint: #7E8F84;
  --line: #1E2A23;
  --line-strong: #2A3A31;
  --accent: #39D98A;
  --accent-line: #39D98A66;

  --win: #39D98A;
  --win-deep: #0C3A23;
  --loss: #FF6B81;
  --loss-deep: #7A1E30;

  --card: #0E1411;
  --card-hi: #121A16;
  --radius: 20px;
  --font: 'Geist', -apple-system, 'SF Pro Display', 'Helvetica Neue', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(57, 217, 138, 0.28); color: var(--text); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* small uppercase labels */
.label, .meta, .stat-label, .variants-label, .legend, .cal-dow, .week-label,
.daycard-meta, .readout .r-date, .note-k {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint);
}

.shell {
  position: relative; z-index: 1;
  max-width: 1120px; margin: 0 auto;
  padding: 48px 24px 96px;
}

/* ------------------------------------------------------------ masthead */

.masthead { margin-bottom: 40px; }

.back {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 500;
  color: var(--text-dim);
  transition: color 0.2s ease;
}
.back:hover { color: var(--text); }
.back svg { transition: transform 0.2s ease; }
.back:hover svg { transform: translateX(-2px); }

.title {
  font-size: clamp(40px, 6.4vw, 76px);
  font-weight: 700; line-height: 1.02; letter-spacing: -0.045em;
  margin: 28px 0 18px;
}
.title em { font-style: normal; color: var(--text-faint); }

.lede {
  max-width: 62ch; color: var(--text-dim);
  font-size: clamp(16px, 1.6vw, 18px); line-height: 1.6;
}

.meta {
  display: inline-flex; align-items: center; gap: 9px;
  margin-top: 20px;
}
.meta .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--win);
  animation: pulse 2.6s ease-in-out infinite;
}
.meta.is-stale .dot { background: #E7B44A; animation: none; }
.meta.is-error .dot { background: var(--loss); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .meta .dot { animation: none; } }

/* ------------------------------------------------------------ track record switch */

.feeds {
  display: flex; flex-wrap: wrap; gap: 4px;
  width: fit-content; max-width: 100%;
  padding: 4px; margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.feed {
  padding: 9px 18px; border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px; font-weight: 500; letter-spacing: -0.005em;
  color: var(--text-dim);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.feed:hover { color: var(--text); }
.feed.is-active {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--line);
}
.feed:focus-visible, .mbtn:focus-visible, .tab:focus-visible, .rbtn:focus-visible, .back:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ------------------------------------------------------------ months */

.months {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 22px;
}
.mbtn {
  padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 13.5px; font-weight: 500; color: var(--text-dim);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.mbtn:hover { color: var(--text); border-color: var(--line-strong); }
.mbtn.is-active {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--line);
}
.mbtn.is-upcoming { color: var(--text-faint); border-style: dashed; }
.mbtn .mtag {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  margin-left: 8px; opacity: 0.7;
}

/* ------------------------------------------------------------ instrument variants */

/* One strategy run on two sets of instruments (two accounts). Sits under the
   months and uses the green accent, so it reads as a filter on this tab,
   not as another tab. */
.variants {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin: -8px 0 22px;
}
.variants[hidden] { display: none; }

/* Model above Instruments, as one grid so the two labels share a column and
   the pills start at the same edge in every language. Each nav keeps its own
   row through display: contents; app.js hides the grid when both are hidden. */
.switches {
  display: grid; grid-template-columns: auto 1fr; align-items: center;
  gap: 8px 12px;
  margin: -8px 0 22px;
}
.switches[hidden] { display: none; }
.switches .variants { display: contents; }
.switches .variants[hidden] { display: none; }
.switches .variant-set { justify-self: start; }
.variant-set {
  display: flex; flex-wrap: wrap; gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.vbtn {
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid transparent;
  font-size: 13px; font-weight: 500; color: var(--text-dim);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.vbtn:hover { color: var(--text); }
.vbtn.is-active {
  color: var(--accent);
  border-color: var(--accent-line);
  background: #0C1A12;
}
.vbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------ whole record */

/* The honesty strip: the whole record of the selected tab, whatever month is
   on screen. Neutral, so it reads as context rather than a result. */
.record {
  margin: 0 0 18px;
  padding: 14px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.record[hidden] { display: none; }
.rec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.rec-title {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint);
}
.rec-small {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 999px;
  color: #E7B44A; border: 1px solid rgba(231, 180, 74, 0.38); background: rgba(231, 180, 74, 0.07);
}
.rec-grid { display: grid; grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr)); gap: 10px 18px; }
.rec-grid dt { font-size: 11.5px; color: var(--text-faint); }
.rec-grid dd { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

/* ------------------------------------------------------------ stat tiles */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 28px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
}
.stat {
  position: relative;
  padding: 22px 24px 20px;
  background: var(--surface);
}
.stat-label { display: block; margin-bottom: 8px; }
.stat-value {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1.1;
}
.stat-sub {
  display: block; margin-top: 6px;
  font-size: 13px; color: var(--text-faint);
}
.stat.is-hero { grid-column: span 4; padding: 28px 24px 26px; }
.stat.is-hero .stat-value { font-size: clamp(40px, 7vw, 64px); letter-spacing: -0.045em; }
.pos { color: var(--win); }
.neg { color: var(--loss); }
.nil { color: var(--text-faint); }

/* ------------------------------------------------------------ restated months */

.restated {
  display: block;
  margin: 0 0 18px;
  padding: 12px 16px;
  border: 1px solid rgba(231, 180, 74, 0.28);
  border-left: 3px solid rgba(231, 180, 74, 0.75);
  border-radius: 14px;
  background: rgba(231, 180, 74, 0.06);
  color: var(--text-dim);
  font-size: 14px; line-height: 1.6;
}
/* display: block above beats the hidden attribute, which left an empty gold bar
   on every month that is not restated. */
.restated[hidden] { display: none; }

/* A record narrowed to some instruments of an account. Neutral, not gold: it
   explains the scope, it does not warn about the numbers. */
.scope-note {
  display: block;
  margin: 0 0 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 14px; line-height: 1.6;
}
.scope-note[hidden] { display: none; }

/* ------------------------------------------------------------ panel + tabs */

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  overflow: hidden;
}

.tabs {
  position: relative;
  display: flex; gap: 2px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}
.tab {
  position: relative; z-index: 1;
  flex: 0 0 auto;
  padding: 9px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 500; color: var(--text-dim);
  transition: color 0.2s ease;
}
.tab.is-active { color: var(--text); }
/* Positioned with `left` (not a transform from a fixed start) so it lands on
   the active tab in right-to-left Arabic too. */
.tab-glide {
  position: absolute; top: 8px; left: 0; z-index: 0;
  height: calc(100% - 16px);
  border-radius: 999px;
  background: var(--line);
  border: 1px solid var(--line-strong);
  transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (prefers-reduced-motion: reduce) { .tab-glide { transition: none; } }

.view { padding: 24px; }

.cal-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin-bottom: 20px;
}
.view-title {
  font-size: 22px; font-weight: 700; letter-spacing: -0.025em;
}
.legend { display: flex; gap: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.sw-win { background: rgba(57, 217, 138, 0.42); border: 1px solid rgba(57, 217, 138, 0.5); }
.sw-loss { background: rgba(255, 107, 129, 0.36); border: 1px solid rgba(255, 107, 129, 0.45); }
.sw-flat { background: rgba(237, 243, 238, 0.04); border: 1px solid var(--line); }

/* ------------------------------------------------------------ calendar */

.cal-wrap { overflow-x: auto; }
.cal { min-width: 640px; }

.cal-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr) 96px;
  gap: 7px;
  margin-bottom: 7px;
}
.cal-dow { text-align: center; padding-bottom: 4px; }

.day {
  position: relative;
  min-height: 86px;
  padding: 10px 11px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(237, 243, 238, 0.015);
  display: flex; flex-direction: column;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.day.is-blank { border-color: transparent; background: none; pointer-events: none; }
.day.has-trades { cursor: pointer; }
.day.has-trades:hover, .day.is-open {
  border-color: var(--text-faint);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.42);
}
.day.is-today::after {
  content: ''; position: absolute; top: 9px; right: 10px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.day-num {
  font-size: 12px; font-weight: 500; color: var(--text-faint);
  margin-bottom: auto;
}
.day.has-trades .day-num { color: var(--text-dim); }
.day-pct {
  font-size: 16px; font-weight: 700; letter-spacing: -0.02em;
  margin-top: 8px;
}
.day-count {
  font-size: 11.5px; color: var(--text-faint);
  margin-top: 2px;
}

.week {
  min-height: 86px;
  padding: 10px 11px;
  border-radius: 14px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  display: flex; flex-direction: column; justify-content: space-between;
}
.week-pct { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.week-count { font-size: 11.5px; color: var(--text-faint); }

/* day detail card */
.daycard {
  margin-top: 16px; padding: 18px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface-2);
}
.daycard-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.daycard-date { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.daycard-pct { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.sym-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.sym-name { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; min-width: 84px; }
/* Diverging bar: profit runs right of centre, loss runs left, so a mixed day
   is legible at a glance without reading the numbers. */
.sym-bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(237, 243, 238, 0.06); overflow: hidden; position: relative; }
.sym-bar::before {
  content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px;
  width: 1px; background: rgba(237, 243, 238, 0.18);
}
.sym-bar i { position: absolute; top: 0; bottom: 0; border-radius: 2px; }
.sym-pct { min-width: 68px; text-align: right; font-weight: 600; }
.sym-n { min-width: 52px; text-align: right; color: var(--text-faint); font-size: 12.5px; }

/* ------------------------------------------------------------ chart */

.range { display: flex; gap: 6px; }
.rbtn {
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px; font-weight: 500; color: var(--text-dim);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.rbtn:hover { color: var(--text); }
.rbtn.is-active {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--line);
}

.chart-wrap { position: relative; }
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }

.grid-line { stroke: rgba(237, 243, 238, 0.07); stroke-width: 1; }
.zero-line { stroke: rgba(237, 243, 238, 0.24); stroke-width: 1; stroke-dasharray: 3 4; }
.axis-text {
  font-family: var(--font);
  font-size: 10.5px; letter-spacing: 0.04em;
  fill: rgba(237, 243, 238, 0.42);
}
.curve { fill: none; stroke: url(#curveStroke); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.dd-area { fill: url(#ddFill); }
.dd-line { fill: none; stroke: rgba(255, 107, 129, 0.5); stroke-width: 1; }
.marker { fill: var(--surface); stroke-width: 2; }
.crosshair { stroke: rgba(237, 243, 238, 0.28); stroke-width: 1; stroke-dasharray: 3 3; }
.hit { fill: transparent; }

.readout {
  position: absolute; z-index: 4; pointer-events: none;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(14, 20, 17, 0.96);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  transform: translate(-50%, -118%);
}
.readout .r-date { display: block; margin-bottom: 4px; }
.readout .r-row { font-size: 13.5px; display: flex; justify-content: space-between; gap: 16px; }
.readout .r-key { color: var(--text-dim); }

.chart-notes {
  display: flex; flex-wrap: wrap; gap: 24px;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.note-k { display: block; margin-bottom: 4px; }
.note-v { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

/* ------------------------------------------------------------ empty + error */

.empty {
  padding: 52px 24px; text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
}
.empty h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 7px; }
.empty p { color: var(--text-dim); font-size: 15px; max-width: 46ch; margin: 0 auto; }

/* ------------------------------------------------------------ footer */

.foot {
  margin-top: 40px;
  color: var(--text-faint);
  font-size: 13.5px; line-height: 1.7;
}
.foot p { max-width: 72ch; }
.foot-links { margin-top: 14px; display: flex; gap: 10px; }
.foot-links a { color: var(--text-dim); transition: color 0.18s ease; }
.foot-links a:hover { color: var(--text); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 780px) {
  .shell { padding: 36px 16px 72px; }
  .rec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec-wide { grid-column: span 2; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 24px; }
  .stat.is-hero { grid-column: span 2; }
  .stat { padding: 18px 18px 16px; }
  .panel { border-radius: 24px; }
  .view { padding: 18px 14px; }
  .cal-row { grid-template-columns: repeat(7, 1fr) 78px; gap: 5px; }
  .day, .week { min-height: 72px; padding: 7px; border-radius: 12px; }
  .day-pct { font-size: 14px; }
  .tab { padding: 8px 14px; font-size: 13.5px; }
  .feeds { width: 100%; border-radius: 22px; }
  .feed { flex: 1 1 auto; padding: 9px 12px; font-size: 13.5px; }
}

@media (max-width: 460px) {
  .legend { display: none; }
  /* A long label (Russian, Arabic) would squeeze the pills: stack instead. */
  .switches { grid-template-columns: 1fr; gap: 6px; }
  #models:not([hidden]) + #variants .variants-label { margin-top: 6px; }
}

/* Arabic flips the page, but a calendar grid and a time axis keep reading
   left to right, the way every chart and broker report does. */
html[dir=rtl] .cal-wrap, html[dir=rtl] .chart-wrap, html[dir=rtl] .sym-row { direction: ltr; }
html[dir=rtl] .cal-wrap { text-align: left; }
