/* Bevisst enkelt og litt rufsete. Monospace, papirfarge, harde kanter.
   Ingen gradienter, ingen skygger, ingen avrundede hjørner. */

:root {
  /* Nedtrekkslista, tallfeltenes piler og rullefeltene tegnes av
     nettleseren, ikke av reglene lenger nede. Uten denne tror den siden er
     lys og maler dem deretter. */
  color-scheme: light;

  --paper: #f4f1ea;
  --ink: #1a1a18;
  --faint: #6b675e;
  --rule: #1a1a18;
  --hairline: #cfc9bc;
  --red: #b3261e;
  --green: #2c6e49;
  --highlight: #ffe9a8;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --paper: #14140f;
    --ink: #e8e4d9;
    --faint: #9a9488;
    --rule: #e8e4d9;
    --hairline: #3a382f;
    --red: #ef7b6f;
    --green: #7fc79a;
    --highlight: #4a3f16;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 2rem 1.25rem 4rem;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 ui-monospace, "SF Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  max-width: 46rem;
  margin-inline: auto;
}

::selection { background: var(--highlight); color: var(--ink); }

a { color: inherit; text-underline-offset: 0.2em; }

h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
}

header {
  border-bottom: 2px solid var(--rule);
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
}

.tagline { margin: 0.75rem 0 0; max-width: 34rem; }

h2 {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 0.85rem;
  font-weight: 700;
}

.step {
  display: inline-block;
  border: 1px solid var(--rule);
  width: 1.4em;
  text-align: center;
  margin-right: 0.5em;
}

.panel { margin-bottom: 2.25rem; }

.hint {
  color: var(--faint);
  font-size: 0.82rem;
  margin: 0.6rem 0 0;
  max-width: 36rem;
}

/* --- skjemaelementer --- */

select, input, button {
  font: inherit;
  color: var(--ink);
  background-color: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.4rem 0.5rem;
}

/* Selve lista er et eget vindu fra operativsystemet og arver ikke `select`.
   `transparent` la den derfor stå igjen på nettleserens hvite bunn mens
   valgene arvet --ink, som i mørk modus er nesten hvit: hvitt på hvitt.
   Fargene settes eksplisitt her fordi ikke alle motorer leser color-scheme. */
option {
  background-color: var(--paper);
  color: var(--ink);
}

select { width: 100%; max-width: 26rem; }
input[type="number"] { width: 5.5rem; text-align: right; }
input:focus, select:focus, button:focus { outline: 2px solid var(--ink); outline-offset: 1px; }

button { cursor: pointer; }
button:not(.ghost):not(.drop):hover { background-color: var(--ink); color: var(--paper); }
button.ghost { border-style: dashed; color: var(--faint); background-color: transparent; }
button.ghost:hover { color: var(--ink); border-style: solid; }

.holdings { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }

.holding {
  display: grid;
  grid-template-columns: 1fr 7.5rem 7.5rem auto;
  gap: 0.4rem;
  align-items: center;
}

.holding select { max-width: none; }
.holding input { width: 100%; }

.holding .drop {
  border: 1px solid var(--hairline);
  background-color: transparent;
  color: var(--faint);
  padding: 0.4rem 0.6rem;
}
.holding .drop:hover { color: var(--red); border-color: var(--red); }

.holding-labels {
  display: grid;
  grid-template-columns: 1fr 7.5rem 7.5rem auto;
  gap: 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.holding-labels span:nth-child(2), .holding-labels span:nth-child(3) { text-align: right; }

.assumptions { display: flex; flex-wrap: wrap; gap: 1.75rem; }
.assumptions label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.82rem; color: var(--faint); }
.assumptions .row { display: flex; align-items: center; gap: 0.4rem; color: var(--ink); }

/* --- resultat --- */

#results { border-top: 2px solid var(--rule); padding-top: 1.75rem; }

.verdict {
  background: var(--highlight);
  border: 1px solid var(--rule);
  padding: 1.1rem 1.15rem;
  margin-bottom: 1.75rem;
}
.verdict .big { font-size: 1.9rem; font-weight: 700; line-height: 1.15; display: block; }
.verdict .sub { color: var(--faint); font-size: 0.85rem; }

.finding { border-top: 1px solid var(--hairline); padding: 1.1rem 0; }
.finding h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.finding .amount { font-weight: 700; }
.finding .save { color: var(--green); font-weight: 700; }
.finding .cost { color: var(--red); font-weight: 700; }
.finding p { margin: 0.4rem 0 0; }
.finding .caveat { color: var(--faint); font-size: 0.8rem; }
.finding .caveat.warn {
  border-left: 3px solid var(--red);
  padding-left: 0.7rem;
  color: var(--ink);
}
abbr { border: 1px solid var(--red); color: var(--red); padding: 0 0.25em; cursor: help; text-decoration: none; }

table { border-collapse: collapse; width: 100%; margin-top: 0.7rem; font-size: 0.85rem; }
th, td { text-align: right; padding: 0.28rem 0.5rem; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
th:first-child, td:first-child {
  text-align: left;
  padding-left: 0;
  position: sticky;
  left: 0;
  background: var(--paper);
}
th { font-weight: 400; color: var(--faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
td.you { background: var(--highlight); }

.scroll-x { overflow-x: auto; }

.share { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 2rem; }

.empty { color: var(--faint); }

footer {
  border-top: 2px solid var(--rule);
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--faint);
}
footer p { max-width: 38rem; }
footer strong { color: var(--ink); }
footer a { color: inherit; }
.colofon { margin-top: 1.5rem; }

@media (max-width: 33rem) {
  .holding, .holding-labels { grid-template-columns: 1fr 1fr auto; }
  .holding select, .holding-labels span:first-child { grid-column: 1 / -1; }
  .verdict .big { font-size: 1.45rem; }
}
