/* Invest Clever — shared design system */
:root {
  --bg-0: #0b1017;
  --bg-1: #111821;
  --bg-2: #171f2b;
  --ink: #ece8e1;
  --ink-soft: #b7b0a4;
  --muted: #7f8794;
  --line: rgba(236, 232, 225, 0.1);
  --line-strong: rgba(236, 232, 225, 0.18);
  --accent: #c9a66b;
  --accent-soft: rgba(201, 166, 107, 0.14);
  --positive: #6fba8f;
  --negative: #d76b6b;
  --warn: #d4a15a;
  --chart-bg: #0f151e;
  --radius: 10px;
  --radius-sm: 6px;
  --space: clamp(1rem, 2.5vw, 2rem);
  --max: 1120px;
  --font-display: "Syne", sans-serif;
  --font-body: "Manrope", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 72px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  background:
    radial-gradient(ellipse 90% 55% at 12% -10%, rgba(201, 166, 107, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 45% at 95% 5%, rgba(111, 186, 143, 0.08), transparent 50%),
    linear-gradient(165deg, #0b1017 0%, #101722 45%, #0c121a 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(236, 232, 225, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 232, 225, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 20%, #000 20%, transparent 75%);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s var(--ease);
}

a:hover {
  color: #e0c08a;
}

img {
  max-width: 100%;
  display: block;
}

.site-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1;
  width: min(100% - 2 * var(--space), var(--max));
  margin: 0 auto;
  padding: 1.5rem 0 3.5rem;
}

/* ——— Header ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(11, 16, 23, 0.82);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  width: min(100% - 2 * var(--space), var(--max));
  margin: 0 auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand:hover {
  color: inherit;
}


.brand__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand__tag {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.nav-toggle__bars {
  width: 18px;
  height: 12px;
  position: relative;
}

.nav-toggle__bars span {
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.25s var(--ease), opacity 0.2s;
}

.nav-toggle__bars span:nth-child(1) { top: 0; }
.nav-toggle__bars span:nth-child(2) { top: 5px; }
.nav-toggle__bars span:nth-child(3) { top: 10px; }

.site-header.is-open .nav-toggle__bars span:nth-child(1) {
  top: 5px;
  transform: rotate(45deg);
}
.site-header.is-open .nav-toggle__bars span:nth-child(2) {
  opacity: 0;
}
.site-header.is-open .nav-toggle__bars span:nth-child(3) {
  top: 5px;
  transform: rotate(-45deg);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.site-nav a:hover {
  color: var(--ink);
  background: rgba(236, 232, 225, 0.05);
}

.site-nav a.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ——— Page intro ——— */
.page-intro {
  margin-bottom: 1.75rem;
  animation: rise 0.55s var(--ease) both;
}

.page-intro__eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.page-intro__title {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 3.5vw, 2.45rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.page-intro__lead {
  margin: 0;
  max-width: 42rem;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

/* ——— Panels / controls ——— */
.panel {
  background: linear-gradient(160deg, rgba(23, 31, 43, 0.9), rgba(17, 24, 33, 0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  animation: rise 0.65s var(--ease) both;
  animation-delay: 0.06s;
}

.panel + .panel,
.panel + .section,
.section + .panel,
.section + .section {
  margin-top: 1.5rem;
}

.section-title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chart-wrap {
  position: relative;
  background: var(--chart-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.75rem 0.5rem;
  min-height: 320px;
  animation: rise 0.6s var(--ease) both;
}

.chart-wrap canvas {
  width: 100% !important;
  max-height: 480px;
}

.chart-loading,
.chart-error,
.state-msg {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.chart-error,
.state-msg--error {
  color: var(--negative);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 24, 33, 0.65);
  animation: rise 0.7s var(--ease) both;
}

.toolbar__group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.toolbar__dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
}

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(236, 232, 225, 0.04);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
}

.btn:hover {
  background: rgba(236, 232, 225, 0.08);
  border-color: rgba(236, 232, 225, 0.28);
}

.btn:active {
  transform: translateY(1px);
}

.btn--accent {
  background: var(--accent-soft);
  border-color: rgba(201, 166, 107, 0.45);
  color: var(--accent);
}

.btn--accent:hover {
  background: rgba(201, 166, 107, 0.22);
}

.date-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.date-input {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(11, 16, 23, 0.7);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  color-scheme: dark;
}

.date-input:focus {
  outline: 1px solid rgba(201, 166, 107, 0.55);
  border-color: rgba(201, 166, 107, 0.55);
}

/* ——— Tables ——— */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  background: rgba(236, 232, 225, 0.03);
}

.data-table tbody tr {
  transition: background 0.15s var(--ease);
}

.data-table tbody tr:hover {
  background: rgba(236, 232, 225, 0.04);
}

.data-table td.is-metric {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.data-table .is-positive { color: var(--positive); }
.data-table .is-negative { color: var(--negative); }
.data-table .is-warn { color: var(--warn); }
.data-table .is-accent { color: var(--accent); }
.data-table .ticker {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.table-note {
  margin-top: 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

/* ——— Metrics / forecast ——— */
.metrics {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(17, 24, 33, 0.7);
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-row__label {
  color: var(--ink-soft);
}

.metric-row__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.metric-row__value.is-loading {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
}

.metrics--two-col .metric-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(6.5rem, 1fr) minmax(6.5rem, 1fr);
}

.metrics--two-col .metric-row__value {
  text-align: right;
}

.metric-row--head {
  background: rgba(236, 232, 225, 0.04);
}

.metric-row--head .metric-row__value {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.callout {
  margin: 0 0 1.25rem;
  padding: 1rem 1.15rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.callout a {
  font-weight: 600;
}

.meta-line {
  margin-top: 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.summary-item__label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.summary-item__value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ——— Sources ——— */
.sources {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sources li {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 0.75rem 1.25rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.sources li:last-child {
  border-bottom: none;
}

.sources__name {
  color: var(--accent);
  font-weight: 600;
}

.sources__desc {
  color: var(--ink-soft);
}

.sources__desc a {
  font-weight: 500;
}

/* ——— Rang calculator ——— */
.calc {
  max-width: 640px;
  margin: 0 auto;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(11, 16, 23, 0.5);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-soft);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.segmented input:checked + label {
  background: var(--accent-soft);
  color: var(--accent);
}

.calc__field {
  margin-top: 1.25rem;
}

.calc__label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.calc__input {
  width: 100%;
  max-width: 320px;
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(11, 16, 23, 0.7);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
}

.calc__input:focus {
  outline: 1px solid rgba(201, 166, 107, 0.55);
  border-color: rgba(201, 166, 107, 0.55);
}

.calc__answer {
  margin-top: 1.25rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  animation: rise 0.4s var(--ease) both;
}

.calc__hint {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.calc__hint strong {
  color: var(--ink-soft);
  font-weight: 600;
}

/* ——— Footer ——— */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: rgba(8, 11, 16, 0.75);
  padding: 2rem var(--space);
}

.site-footer__inner {
  width: min(100%, var(--max));
  margin: 0 auto;
  display: grid;
  gap: 0.55rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.site-footer__brand {
  font-family: var(--font-display);
  color: var(--ink-soft);
  font-weight: 600;
}

.site-footer a {
  text-decoration: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 820px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem var(--space) 1rem;
    background: rgba(11, 16, 23, 0.96);
    border-bottom: 1px solid var(--line);
    gap: 0.15rem;
  }

  .site-header.is-open .site-nav {
    display: flex;
  }

  .site-nav a {
    padding: 0.85rem 1rem;
  }

  .toolbar__dates {
    margin-left: 0;
    width: 100%;
  }

  .sources li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .page-intro {
    text-align: left;
  }

  .metrics--two-col .metric-row {
    grid-template-columns: minmax(0, 1fr) minmax(4.8rem, 0.9fr) minmax(5.4rem, 0.9fr);
    gap: 0.5rem;
    padding: 0.85rem 0.8rem;
  }

  .metrics--two-col .metric-row__value {
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

.btn.is-active {
  background: var(--accent-soft);
  border-color: rgba(201, 166, 107, 0.55);
  color: var(--accent);
}

.toolbar__scale .date-label {
  margin-right: 0.15rem;
}

/* ——— Author page ——— */
.author-page {
  max-width: 42rem;
}

.author-hero {
  text-align: left;
  border-left: 3px solid var(--accent);
  background:
    linear-gradient(120deg, rgba(201, 166, 107, 0.1), transparent 55%),
    linear-gradient(160deg, rgba(23, 31, 43, 0.9), rgba(17, 24, 33, 0.95));
}

.author-hero__name {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.author-hero__meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.author-prose p {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.7;
}

.author-prose p:last-child {
  margin-bottom: 0;
}

.author-prose sup a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.72em;
  margin-left: 0.1em;
}

.author-footnotes li:target {
  background: var(--accent-soft);
  outline: 1px solid rgba(201, 166, 107, 0.35);
}

.author-hobbies {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.author-hobbies li {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 0.85rem;
  align-items: baseline;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(236, 232, 225, 0.03);
}

.author-hobbies__rank {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.author-hobbies__text {
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 500;
}

.author-reqs {
  list-style: none;
  margin: 0 0 1.15rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.author-reqs li {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0.75rem;
  align-items: start;
  color: var(--ink-soft);
  line-height: 1.6;
}

.author-reqs__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 166, 107, 0.4);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
}

.author-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.author-notes {
  border-style: dashed;
}

.author-footnotes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.author-footnotes li {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: 0.65rem;
  align-items: start;
  margin: 0;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  scroll-margin-top: calc(var(--header-h) + 0.75rem);
}

.author-footnotes__n {
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
}