/* ============================================================
   isaksjoberg.no — felles stilark
   Helhvitt, minimalistisk design: sort/mørkegrå tekst på hvitt,
   én diskret aksentfarge for lenker og grafer.
   ============================================================ */

:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --text-primary: #111111;
  --text-secondary: #444444;
  --text-muted: #767676;
  --hairline: #e6e6e3;
  --baseline: #c9c8c2;
  --border: #e6e6e3;

  --accent: #2a78d6;        /* lenker + portefølje-serien i grafen */
  --benchmark: #8a8a86;     /* OSEBX-serien i grafen */
  --up: #006300;            /* positiv endring */
  --down: #c23434;          /* negativ endring */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- topp-navigasjon ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}
.site-nav .brand {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.site-nav .links a {
  color: var(--text-secondary);
  margin-left: 1.4rem;
  font-size: 0.95rem;
}
.site-nav .links a.active {
  color: var(--text-primary);
  font-weight: 600;
}
.site-nav .links a:hover { color: var(--text-primary); text-decoration: none; }

/* ---------- generelle seksjoner ---------- */
.section { margin: 3.5rem 0; }
.section > h2 {
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.3rem;
}
.section > .section-sub {
  color: var(--text-secondary);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

/* ---------- hero ---------- */
.hero { padding: 3.5rem 0 0.5rem; }
.hero h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.7rem;
}
.hero .lede {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 40rem;
  margin: 0;
}

/* ---------- forside ---------- */
.home-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.8rem;
}
.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 7px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid var(--baseline);
  color: var(--text-primary);
  background: var(--surface);
}
.btn:hover { text-decoration: none; border-color: var(--text-secondary); }

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem 1.5rem;
}

/* ---------- nøkkeltall ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.9rem;
  margin-top: 1.4rem;
}
.stat {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
}
.stat .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.stat .value {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.stat .value.up { color: var(--up); }
.stat .value.down { color: var(--down); }

/* ---------- graf ---------- */
.chart-card { position: relative; }
.chart-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.chart-header h3 { margin: 0; font-size: 1rem; }
.legend {
  display: flex;
  gap: 1.1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.legend .key {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.legend .swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}
.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 2.5rem 0;
  text-align: center;
}
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--baseline);
  border-radius: 7px;
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 5;
}
.chart-tooltip .t-title { font-weight: 600; margin-bottom: 0.15rem; }
.chart-tooltip .row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
}
.chart-tooltip .dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.table-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  margin-top: 0.8rem;
  font-family: inherit;
}
.table-toggle:hover { text-decoration: underline; }
.data-table { width: 100%; border-collapse: collapse; margin-top: 0.8rem; font-size: 0.9rem; }
.data-table th, .data-table td {
  text-align: right;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--hairline);
  font-variant-numeric: tabular-nums;
}
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; }
.hidden { display: none; }

/* ---------- porteføljetabell ---------- */
.holdings-table { width: 100%; border-collapse: collapse; }
.holdings-table th, .holdings-table td {
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: middle;
}
.holdings-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.holdings-table td.num, .holdings-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.holdings-table .name { font-weight: 600; }
.holdings-table .ticker { color: var(--text-muted); font-size: 0.88rem; }
.holdings-table td.bar-cell { width: 34%; }
.weight-bar {
  height: 4px;
  border-radius: 4px;
  background: var(--hairline);
  overflow: hidden;
}
.weight-bar > span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
}
@media (max-width: 560px) {
  .holdings-table td.bar-cell { display: none; }
  .holdings-table th.bar-head { display: none; }
}

/* ---------- innlegg ---------- */
.post {
  border-top: 1px solid var(--hairline);
  padding: 2.2rem 0 1.4rem;
}
.post:first-of-type { border-top: none; padding-top: 0.5rem; }
.post .post-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 0.25rem;
}
.post h3 {
  margin: 0 0 0.9rem;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.post p {
  margin: 0.85rem 0;
  color: var(--text-secondary);
  max-width: 44rem;
}
.post p strong { color: var(--text-primary); }
.post h4 {
  margin: 1.6rem 0 0.2rem;
  font-size: 1rem;
  color: var(--text-primary);
}

/* ---------- diverse ---------- */
.site-footer {
  border-top: 1px solid var(--hairline);
  margin-top: 4rem;
  padding: 1.6rem 0 2.2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
