/* CremaTheory — shared page styles. Mobile-first, no framework. */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #221a14;
  --muted: #6b5d52;
  --line: #e4dbd0;
  --accent: #8a4b1f;
  --accent-ink: #ffffff;
  --ok: #2f6b3a;
  --warn: #8a5a00;
  --bad: #9b2c1f;
  --band: #efe6da;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17120e;
    --surface: #211a15;
    --ink: #f1e9e0;
    --muted: #b3a597;
    --line: #3a2f27;
    --accent: #d9934f;
    --accent-ink: #1a120c;
    --ok: #7cc48a;
    --warn: #e0b04a;
    --bad: #ef8a7c;
    --band: #2c231c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }

.site-head, main, .site-foot { max-width: 44rem; margin: 0 auto; padding: 0 16px; }
.site-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; padding-top: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .01em; text-decoration: none; color: var(--ink); }
.site-head nav { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .92rem; }
.site-head nav a { text-decoration: none; color: var(--muted); }
.site-head nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

h1 { font-size: 1.6rem; line-height: 1.2; margin: 1.25rem 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
.why { color: var(--muted); margin: 0 0 1rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }

.grid { display: grid; gap: .8rem; grid-template-columns: 1fr; }
@media (min-width: 34rem) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: 1fr 1fr 1fr; } }

label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .25rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; }
input, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: .55rem .6rem; min-height: 44px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="range"] { padding: 0; min-height: 32px; accent-color: var(--accent); }

.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg button {
  font: inherit; font-size: .9rem; min-height: 40px; padding: .35rem .75rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.result { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.result small { font-size: 1rem; font-weight: 500; color: var(--muted); }
.sub { color: var(--muted); font-size: .92rem; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .45rem .3rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; white-space: nowrap; }

.work { font-family: var(--mono); font-size: .88rem; background: var(--band); border-radius: 8px; padding: .75rem; overflow-x: auto; white-space: pre; }

.status { font-weight: 600; }
.status.within { color: var(--ok); }
.status.below, .status.above { color: var(--warn); }
.error { color: var(--bad); font-weight: 600; }
.notes { margin: .5rem 0 0; padding-left: 1.1rem; }
.notes li { margin: .25rem 0; }
.warn { color: var(--warn); }

/* Horizontal band gauge: window shaded, marker at value. */
.gauge { position: relative; height: 28px; background: var(--band); border-radius: 6px; margin: .75rem 0 1.4rem; }
.gauge .win { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ok) 25%, transparent); border-left: 2px solid var(--ok); border-right: 2px solid var(--ok); }
.gauge .mark { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--ink); border-radius: 2px; transform: translateX(-50%); }
.gauge .tick { position: absolute; top: 100%; font-size: .75rem; color: var(--muted); transform: translateX(-50%); padding-top: 2px; }

.foot { font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); margin-top: 2rem; padding-top: .75rem; }
.foot ol { padding-left: 1.2rem; }
.foot li { margin: .35rem 0; }
sup a { text-decoration: none; }
.site-foot { font-size: .8rem; color: var(--muted); padding-bottom: 2rem; }
