/* Public showcase page. Reuses tokens.css (../css/tokens.css) for every
   color/spacing value — this file only lays the page out. */

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-text);
}
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

.pub {
  max-width: 820px;
  margin: 0 auto;
  padding: var(--s-6) var(--s-4) var(--s-7);
}

.pub--wide { max-width: 1200px; }

.pub__head { margin-bottom: var(--s-5); }
.pub__head--section { margin-top: var(--s-7); }
.pub__brand {
  margin: 0 0 var(--s-2);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}
.pub__badge {
  margin-left: var(--s-2);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--t-xs);
  letter-spacing: 0.02em;
  text-transform: none;
}
.pub__title { margin: 0 0 4px; font-size: var(--t-xl); font-weight: 700; }
/* title + "Backtest report" button (the button's own look is in sd-backtest.css) */
.pub__titlerow { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; margin: 0 0 4px; }
.pub__titlerow .pub__title { margin: 0; }
.pub__hint { margin: 0; color: var(--ink-dim); font-size: var(--t-sm); }

/* Index lede: the promise in soft ink, the one instruction as a pill. */
.pub__lede {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  margin: var(--s-2) 0 0;
}
.pub__lede-text {
  font-family: "Space Grotesk", var(--font-text);
  font-size: var(--t-md);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #b9c3d9;
}
.pub__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-family: "Space Grotesk", var(--font-text);
  font-size: var(--t-sm);
  font-weight: 600;
  color: #fde68a;
  background: linear-gradient(90deg, rgba(240, 184, 80, 0.16), rgba(251, 146, 60, 0.12));
  border: 1px solid rgba(240, 184, 80, 0.45);
  box-shadow: 0 0 18px rgba(240, 184, 80, 0.12);
}

/* Section headings on the index: blue for real, violet for demo — the same
   scope colours the private dashboard uses to tell the two apart. */
.pub__section {
  --c1: var(--scope-real);
  --c2: var(--accent);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0 0 var(--s-2);
  font-family: "Space Grotesk", var(--font-text);
  font-size: clamp(1.625rem, 4.5vw, 2.25rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pub__section--demo { --c1: var(--scope-demo); --c2: #f0abfc; }
.pub__section-text {
  background: linear-gradient(90deg, var(--c1), var(--c2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pub__section-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c1);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c1) 18%, transparent),
              0 0 14px var(--c1);
}
.pub__section::after {
  content: "";
  flex: 1;
  min-width: var(--s-5);
  height: 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c1) 55%, transparent), transparent);
}
.pub__section-dot[data-online="yes"] { --c1: var(--up); }
.pub__section-dot[data-online="no"]  { --c1: var(--down); }
.pub__section-dot[data-online="yes"] { animation: pub-live 2.4s ease-in-out infinite; }
@keyframes pub-live {
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--c1) 0%, transparent), 0 0 18px var(--c1); }
}
@media (prefers-reduced-motion: reduce) {
  .pub__section-dot { animation: none !important; }
}
.pub__back {
  display: inline-block;
  margin-bottom: var(--s-2);
  color: var(--accent);
  font-size: var(--t-sm);
  text-decoration: none;
}
.pub__back:hover { text-decoration: underline; }

.pub__stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: var(--s-5);
}
.pstat { background: var(--surface); padding: var(--s-3); min-width: 0; }
.pstat__label { margin: 0 0 6px; font-size: var(--t-xs); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pstat__value { margin: 0; font-size: var(--t-md); font-weight: 600; white-space: nowrap; }
.pstat__value.up { color: var(--up); }
.pstat__value.down { color: var(--down); }

.pub__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s-4);
  margin-bottom: var(--s-4);
}
.pub__card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-2);
}
.pub__card-title { margin: 0; font-size: var(--t-md); font-weight: 600; }
.pub__card-sub { margin: 0; font-size: var(--t-xs); color: var(--ink-muted); }

.pub__empty { color: var(--ink-muted); font-size: var(--t-sm); margin: var(--s-4) 0; }
.pub__updated { color: var(--ink-muted); font-size: var(--t-xs); margin: var(--s-4) 0 0; }
.pub__disclaimer { color: var(--ink-muted); font-size: var(--t-xs); margin: var(--s-2) 0 0; }

/* ---- equity curve ---- */
.eac { position: relative; margin-top: var(--s-2); }
.eac__svg { display: block; width: 100%; height: auto; }
.eac__grid { stroke: var(--line); stroke-width: 1; }
.eac__zero { stroke: var(--line); stroke-width: 1; }
.eac__ytick, .eac__xtick { fill: var(--ink-muted); font-family: var(--font-num); font-size: 11px; }
.eac__xtick { font-family: var(--font-text); }
.eac__line { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.eac__area { stroke: none; }
.eac__stop-a { stop-color: var(--accent); stop-opacity: 0.28; }
.eac__stop-b { stop-color: var(--accent); stop-opacity: 0; }
.eac__last { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.eac__cross { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.eac__hover { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.eac__capture { fill: transparent; cursor: crosshair; }
.eac__tooltip {
  position: absolute;
  transform: translate(-50%, -120%);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: var(--t-xs);
  pointer-events: none;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.eac__tip-date { color: var(--ink-muted); }
.eac__tip-val { font-family: var(--font-num); font-weight: 600; }
.eac__tip-val.up { color: var(--up); }
.eac__tip-val.down { color: var(--down); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
.ptable { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.ptable th, .ptable td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.ptable th { color: var(--ink-muted); font-weight: 500; font-size: var(--t-xs); }
.ptable td.num, .ptable th.num { text-align: right; font-family: var(--font-num); }
.ptable td.up { color: var(--up); }
.ptable td.down { color: var(--down); }

@media (max-width: 480px) {
  .pub__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- strategy cards (ported from the private dashboard's own Strategies
   view, frontend-static/css/app.css, so a card looks identical there and
   here) ---- */
/* bolla del floating: "Floating P/L" sopra il numero */
.scard__live {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 84px;
  height: 58px;
  padding: 0 var(--s-3);
  border-radius: 18px;
  border: 1.5px solid currentColor;
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.scard__live.up   { color: var(--up);   background: var(--up-soft); }
.scard__live.down { color: var(--down); background: var(--down-soft); }
.scard__live.flat { color: var(--ink-dim); background: var(--surface); }
.scard__live-label { font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; opacity: .8; white-space: nowrap; }
.scard__live + .scard__head { padding-right: 96px; }

.scards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
@media (max-width: 900px) {
  .scards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .scards { grid-template-columns: minmax(0, 1fr); }
}

.scard {
  position: relative;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.scard:hover { border-color: var(--accent); }
.scard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.scard__name {
  display: flex; align-items: center; gap: var(--s-2);
  margin: 0; font-size: var(--t-base); font-weight: 600; color: var(--ink);
}
.status-dot {
  flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--down);
  box-shadow: 0 0 0 3px var(--down-soft);
}
.status-dot[data-online="yes"] { background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.scard__ident { margin: 2px 0 0; font-size: var(--t-xs); color: var(--ink-muted); }
.scard__since { margin: 3px 0 0; font-size: var(--t-xs); color: var(--ink-dim); }
.scard__cent {
  display: inline-block;
  padding: 2px 8px;
  white-space: nowrap;
  border-radius: var(--radius-pill);
  background: var(--scope-cent-soft);
  color: var(--scope-cent);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.scard__net {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-2);
  border-top: 1px solid var(--line-soft);
}
.scard__net-label { font-size: var(--t-xs); color: var(--ink-dim); }
.scard__net-value { font-size: var(--t-lg); font-weight: 600; font-variant-numeric: normal; }
/* colour only on the big figure, no pill: same up/down tones as Today P/L; zero stays ink */
.scard__net-value.up   { color: var(--up); }
.scard__net-value.down { color: var(--down); }

.scard__grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }

.stat-pair { display: flex; flex-direction: column; gap: 2px; }
.stat-pair__label { font-size: var(--t-xs); color: var(--ink-dim); }
.stat-pair__value { font-size: var(--t-base); font-weight: 500; color: var(--ink); }

.scard__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-2);
  border-top: 1px solid var(--line-soft);
}

/* Same pill as the floating badge (.scard__live), stretched to hold its label. */
.scard__today {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-2);
  margin-left: auto;
  padding: 6px var(--s-3);
  border-radius: var(--radius-pill);
  border: 1.5px solid currentColor;
  font-size: var(--t-sm);
  font-weight: 600;
  white-space: nowrap;
}
.scard__today-label { font-size: var(--t-xs); font-weight: 500; opacity: 0.85; }

/* Small "Backtest" pill on a card: opens the backtest window, not the card. */
.scard__bt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1.5px solid #e3b456;
  border-radius: var(--radius-pill);
  background: rgba(227, 180, 86, 0.12);
  color: #e3b456;
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.scard__bt svg { width: 13px; height: 13px; }
.scard__bt:hover { background: rgba(227, 180, 86, 0.22); }
.scard__bt:focus-visible { outline: 2px solid #e3b456; outline-offset: 2px; }
.scard__today.up   { color: var(--up);   background: var(--up-soft); }
.scard__today.down { color: var(--down); background: var(--down-soft); }
.scard__today.flat { color: var(--ink-dim); background: var(--surface); }

/* ---- daily P/L calendar ---- */
.pcal__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-2);
}
.pcal__month { margin: 0; font-size: var(--t-base); font-weight: 600; }
.pcal__btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--ink);
  font-size: var(--t-md);
  line-height: 1;
  cursor: pointer;
}
.pcal__btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pcal__btn:disabled { opacity: 0.3; cursor: default; }
.pcal__summary {
  margin: var(--s-1) 0 var(--s-3);
  text-align: center;
  font-size: var(--t-xs);
  color: var(--ink-muted);
}
.pcal__summary .up { color: var(--up); }
.pcal__summary .down { color: var(--down); }

.pcal__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.pcal__wd {
  padding-bottom: 2px;
  text-align: center;
  font-size: var(--t-xs);
  color: var(--ink-muted);
}
.pcal__cell {
  min-height: 64px;
  padding: 6px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pcal__cell--pad { background: none; border-color: transparent; }
.pcal__cell--weekend:not(.pcal__cell--up):not(.pcal__cell--down) { background: var(--surface); }
.pcal__cell--today { border-color: var(--accent); }
.pcal__cell--up   { background: var(--up-soft);   border-color: color-mix(in srgb, var(--up) 35%, transparent); }
.pcal__cell--down { background: var(--down-soft); border-color: color-mix(in srgb, var(--down) 35%, transparent); }
.pcal__cell--today.pcal__cell--up,
.pcal__cell--today.pcal__cell--down { outline: 1px solid var(--accent); outline-offset: 1px; }
.pcal__day { font-size: var(--t-xs); color: var(--ink-muted); }
.pcal__pnl {
  margin-top: auto;
  font-size: var(--t-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pcal__cell--up .pcal__pnl   { color: var(--up); }
.pcal__cell--down .pcal__pnl { color: var(--down); }
.pcal__n { font-size: 10px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 480px) {
  .pcal__grid { gap: 3px; }
  .pcal__cell { min-height: 52px; padding: 4px; }
  .pcal__pnl { font-size: 11px; }
  .pcal__n { display: none; }
}

.pcal__cell--clickable {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.12s;
}
.pcal__cell--clickable:hover,
.pcal__cell--clickable:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.pcal__cell--clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- day-detail modal (opened from the calendar) ---- */
.pcalm { position: fixed; inset: 0; z-index: 1000; }
.pcalm[hidden] { display: none; }
.pcalm__backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 6, 12, 0.65);
}
.pcalm__panel {
  position: relative;
  max-width: 620px;
  width: calc(100% - 32px);
  max-height: calc(100% - 64px);
  margin: 32px auto;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s-4);
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.6);
}
.pcalm__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.pcalm__title { margin: 0 0 4px; font-size: var(--t-md); font-weight: 600; }
.pcalm__sub { margin: 0; font-size: var(--t-sm); color: var(--ink-muted); }
.pcalm__sub .up { color: var(--up); }
.pcalm__sub .down { color: var(--down); }
.pcalm__close {
  width: 32px; height: 32px; flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 18px; line-height: 1;
  cursor: pointer;
}
.pcalm__close:hover { border-color: var(--accent); color: var(--accent); }

/* Ritorno alla home della Ultimate Dashboard, in alto a destra su ogni pagina pubblica */
.pub__head { position: relative; }
.pub__home {
  position: absolute; top: 0; right: 0; display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: var(--t-sm); font-weight: 600; text-decoration: none; transition: border-color .15s;
}
.pub__home:hover { border-color: var(--accent); }
.pub__home svg { width: 22px; height: 22px; }
@media (max-width: 560px) { .pub__home { position: static; display: flex; width: max-content; margin: 0 0 var(--s-3); } }
.pub__home + .pf-cta { margin-top: 30px; }
@media (max-width: 560px) { .pub__home + .pf-cta { margin-top: 0; } }

/* Avviso del proprietario su un EA (notice): evidenziato su pagina dell'EA e card */
.pub__notice {
  display: flex; align-items: center; gap: 12px; margin: var(--s-3) 0 0; padding: 12px 16px; border-radius: var(--radius);
  background: var(--warn-soft); border: 1px solid var(--warn); color: var(--ink); font-size: var(--t-md); font-weight: 600;
  box-shadow: 0 0 22px -10px rgba(240, 184, 80, .8);
}
.pub__notice[hidden] { display: none; }
.pub__notice-i { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--warn); color: #1a1405; font-weight: 800; }
.scard__notice {
  margin: 8px 0 0; padding: 5px 9px; border-radius: 7px; background: var(--warn-soft); border: 1px solid rgba(240, 184, 80, .5);
  color: var(--warn); font-size: var(--t-xs); font-weight: 600; line-height: 1.35;
}
