/* Trade Calls (working title) — one stylesheet for the whole site.

   WHO THIS IS FOR (decide the design from this, not from taste):
   - Reader: a sceptical private investor on a phone who has seen stock-tip sites and
     assumes this is another one.
   - They believe: valuation numbers online are black boxes that sell something.
   - They must leave knowing: every figure here traces to a filing, and they can change it.
   - What earns trust: the source link beside each number, a range instead of one
     precise-looking figure, and plain statements of where the method does not work.

   THE LOOK: a worksheet on paper. Numbered lines like a tax form, ink on warm paper,
   one accent colour that means exactly one thing: "you can click or change this".
   To restyle the site, change the variables in :root below.                        */

:root {
  --paper: #f6f3ec;        /* page background */
  --sheet: #fffdf8;        /* the worksheet itself */
  --ink: #17171a;          /* main text */
  --ink-soft: #5c5a55;     /* explanations, captions */
  --rule: #d9d3c5;         /* ruled lines */
  --accent: #1c3f94;       /* links and editable things. Nothing else. */
  --flag: #8a5a00;         /* warnings */
  --flag-bg: #fbf1d8;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --step--1: 0.82rem;
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.9rem, 1.5rem + 2vw, 2.9rem);
  --step-3: clamp(3.2rem, 2.2rem + 6vw, 6.5rem);   /* the value per share */
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141416; --sheet: #1b1b1e; --ink: #ecebe6; --ink-soft: #a3a097;
    --rule: #34332f; --accent: #9db7ff; --flag: #e8c36a; --flag-bg: #2e2714;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: var(--step-0)/1.6 var(--sans);
}
a { color: var(--accent); text-underline-offset: 0.18em; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.wrap { max-width: 46rem; margin: 0 auto; padding: 0 1.15rem; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- top bar: name on the left, two links on the right ---- */
.top { display: flex; justify-content: space-between; align-items: baseline;
       padding: 1.1rem 0 0.9rem; border-bottom: 1px solid var(--ink); }
.top .name { font-family: var(--serif); font-size: 1.15rem; color: var(--ink);
             text-decoration: none; letter-spacing: 0.01em; }
.top nav a { margin-left: 1.1rem; font-size: var(--step--1); }

/* ---- page heading ---- */
h1 { font: 400 var(--step-2)/1.08 var(--serif); letter-spacing: -0.015em;
     margin: 3rem 0 0.75rem; max-width: 18ch; }
.lede { max-width: 60ch; color: var(--ink-soft); margin: 0 0 2.5rem; }
h2 { font: 400 var(--step-1)/1.2 var(--serif); margin: 4rem 0 0.5rem; }
p { max-width: 65ch; }

/* ---- company picker ---- */
.picker { position: relative; margin-bottom: 2rem; }
.picker label { display: block; font-size: var(--step--1); color: var(--ink-soft);
                margin-bottom: 0.3rem; }
.picker input {
  width: 100%; font: inherit; font-size: 1.15rem; padding: 0.8rem 0.9rem;
  background: var(--sheet); color: var(--ink);
  border: 1px solid var(--ink); border-radius: 0;
}
.picker ul {
  position: absolute; z-index: 5; left: 0; right: 0; margin: 0; padding: 0;
  list-style: none; background: var(--sheet); border: 1px solid var(--ink); border-top: 0;
  max-height: 19rem; overflow-y: auto;
}
.picker li { padding: 0.6rem 0.9rem; cursor: pointer; display: flex; gap: 0.8rem;
             border-top: 1px solid var(--rule); }
.picker li:first-child { border-top: 0; }
.picker li[aria-selected="true"], .picker li:hover { background: var(--paper); }
.picker li b { font-family: var(--mono); font-weight: 600; min-width: 4.2em; }
.picker li span { color: var(--ink-soft); font-size: var(--step--1); margin-left: auto;
                  text-align: right; }

/* ---- the result: one big figure, then the range bar ---- */
.result { margin: 0 0 2.5rem; }
.result .who { font-family: var(--serif); font-size: var(--step-1); margin: 0; }
.result .meta { font-size: var(--step--1); color: var(--ink-soft); margin: 0.1rem 0 1.5rem; }
.result .label { font-size: var(--step--1); color: var(--ink-soft); margin: 0; }
.result .value { font: 400 var(--step-3)/0.95 var(--serif); letter-spacing: -0.03em;
                 margin: 0.1rem 0 0 -0.04em; }
.result .value.none { font-size: var(--step-2); line-height: 1.15; letter-spacing: -0.01em;
                      max-width: 20ch; margin-top: 0.4rem; }
.result .range-words { margin: 0.6rem 0 0; }

/* The range bar. A ruled scale: the shaded band is low-to-high, the tall tick is the
   central estimate, the dot is the share price you typed. */
.bar { position: relative; height: 4.4rem; margin: 1.6rem 0 0; }
.bar .axis { position: absolute; left: 0; right: 0; top: 1.5rem; height: 1px; background: var(--ink); }
.bar .band { position: absolute; top: 1.05rem; height: 0.95rem; background: var(--ink); opacity: 0.16; }
.bar .mid { position: absolute; top: 0.55rem; height: 1.95rem; width: 2px; background: var(--ink); }
.bar .price { position: absolute; top: 1.5rem; width: 0.8rem; height: 0.8rem; margin: -0.4rem 0 0 -0.4rem;
              border-radius: 50%; background: var(--accent); }
.bar .tick { position: absolute; top: 2.75rem; transform: translateX(-50%);
             font: var(--step--1)/1.2 var(--mono); white-space: nowrap; color: var(--ink-soft); }
.bar .tick.p { top: -0.35rem; color: var(--accent); }
.bar .tick.edge-l { transform: none; } .bar .tick.edge-r { transform: translateX(-100%); }
.verdict { margin: 1.1rem 0 0; max-width: 60ch; }

/* ---- notices: method does not apply, missing figures, caveats ---- */
.notice { background: var(--flag-bg); border-left: 3px solid var(--flag);
          padding: 0.8rem 1rem; margin: 0 0 1.5rem; font-size: 0.95rem; }
.notice p { margin: 0; } .notice p + p { margin-top: 0.5rem; }
.notice strong { color: var(--flag); }

/* ---- the worksheet: numbered lines ---- */
.sheet { background: var(--sheet); border: 1px solid var(--ink); margin: 0 -1.15rem; }
@media (min-width: 48rem) { .sheet { margin: 0 -2rem; } }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
              padding: 0.9rem 1.15rem; border-bottom: 1px solid var(--ink); }
.sheet-head h2 { margin: 0; font-size: 1.15rem; }
.line { display: grid; grid-template-columns: 1.9rem 1fr; column-gap: 0.4rem;
        padding: 1.1rem 1.15rem 1.2rem; border-top: 1px solid var(--rule); }
.line:first-of-type { border-top: 0; }
.line .no { font: var(--step--1)/1.9 var(--mono); color: var(--ink-soft); }
.line .body { min-width: 0; }
.line .row { display: flex; flex-wrap: wrap; justify-content: space-between;
             align-items: center; gap: 0.5rem 1rem; }
.line label { font-weight: 600; }
.field { display: flex; align-items: baseline; gap: 0.4rem; }
.field input {
  width: 9.5rem; font: 1.1rem/1.2 var(--mono); font-variant-numeric: tabular-nums; text-align: right;
  padding: 0.5rem 0.55rem; color: var(--accent); background: transparent;
  border: 0; border-bottom: 2px solid var(--accent); border-radius: 0;
}
.field input.narrow { width: 5.5rem; }
.field input.missing { border-bottom-style: dashed; }
.field .unit { font-size: var(--step--1); color: var(--ink-soft); min-width: 3.2em; }
.how { margin: 0.45rem 0 0; font-size: 0.9rem; color: var(--ink-soft); max-width: 58ch; }
.how .num { color: var(--ink); }
.how ul { margin: 0.3rem 0 0; padding: 0; list-style: none; }
.how li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.12rem 0; }
.changed { font-size: var(--step--1); color: var(--flag); }
button.link { font: inherit; font-size: var(--step--1); color: var(--accent); background: none;
              border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.total { border-top: 1px solid var(--ink); }
.total .row { font-weight: 600; }
.total .num { font-size: 1.1rem; }

/* ---- tables: the working, and the 10-year history ---- */
.scroll { overflow-x: auto; margin: 0 -1.15rem; padding: 0 1.15rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: right; padding: 0.45rem 0 0.45rem 1rem; border-bottom: 1px solid var(--rule);
         white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
thead th { font-weight: 600; border-bottom: 1px solid var(--ink); font-size: var(--step--1); }
td { font-family: var(--mono); font-variant-numeric: tabular-nums; }
td a { text-decoration: none; border-bottom: 1px dotted var(--accent); }
td.na { color: var(--ink-soft); font-family: var(--sans); }
caption { caption-side: bottom; text-align: left; font-size: var(--step--1);
          color: var(--ink-soft); padding-top: 0.6rem; }

/* ---- home page pieces ---- */
.status { border-top: 1px solid var(--ink); margin-top: 3.5rem; }
.status div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem;
              padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.status dt { font-family: var(--mono); font-size: var(--step--1); color: var(--ink-soft);
             padding-top: 0.2rem; }
.status dd { margin: 0; max-width: 52ch; }
.go { display: inline-block; margin-top: 0.5rem; font-family: var(--serif);
      font-size: var(--step-1); }

/* ---- footer: the standing notice, on every page ---- */
footer { margin-top: 6rem; padding: 1.5rem 0 3rem; border-top: 1px solid var(--ink);
         font-size: var(--step--1); color: var(--ink-soft); }
footer p { max-width: 70ch; margin: 0 0 0.6rem; }
[hidden] { display: none !important; }
