/* BrewPhase shared styles. Mobile-first; no framework. */
:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f3ede3;
  --ink: #2b2118;
  --ink-2: #6b5d4f;
  --line: #e2d8c8;
  --accent: #9a5b13;
  --accent-ink: #ffffff;
  --accent-soft: #f6e7cf;
  --ok: #2f6b3a;
  --ok-soft: #e3f0e4;
  --warn: #8a5a00;
  --warn-soft: #fcefd2;
  --bad: #9b2c20;
  --bad-soft: #f9e0dc;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1511; --surface: #231d17; --surface-2: #2d251d; --ink: #f1e9dd; --ink-2: #b9a893;
    --line: #3c3228; --accent: #e0a458; --accent-ink: #1a1511; --accent-soft: #3a2c1b;
    --ok: #8fcf98; --ok-soft: #1f3322; --warn: #f0c46b; --warn-soft: #3a2f16;
    --bad: #f19a8e; --bad-soft: #3d201c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1511; --surface: #231d17; --surface-2: #2d251d; --ink: #f1e9dd; --ink-2: #b9a893;
  --line: #3c3228; --accent: #e0a458; --accent-ink: #1a1511; --accent-soft: #3a2c1b;
  --ok: #8fcf98; --ok-soft: #1f3322; --warn: #f0c46b; --warn-soft: #3a2f16;
  --bad: #f19a8e; --bad-soft: #3d201c; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
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); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

header.site { border-bottom: 1px solid var(--line); background: var(--surface); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--ink); letter-spacing: -.01em; }
.brand span { color: var(--accent); }
nav.tools { display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: .9rem; }
nav.tools a { text-decoration: none; color: var(--ink-2); padding: 4px 0; }
nav.tools a[aria-current="page"] { color: var(--accent); font-weight: 600; }

main { padding: 24px 0 48px; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 8px; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; margin: 28px 0 10px; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
.lede { color: var(--ink-2); margin: 0 0 20px; }
.why { background: var(--surface-2); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); font-size: .95rem; margin: 0 0 20px; }
.why strong { display: block; margin-bottom: 4px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 480px) { .grid.three { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
label, .label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
input[type="number"], input[type="text"], select {
  width: 100%; min-width: 0; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 10px; min-height: 44px;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { font-size: .8rem; color: var(--ink-2); }
.inline { display: flex; gap: 8px; align-items: stretch; }
.inline > input { flex: 1 1 auto; }
.inline > select { flex: 0 0 auto; width: auto; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-size: .9rem; border: 0; background: var(--bg); color: var(--ink-2); padding: 8px 12px; min-height: 40px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

button.btn { font: inherit; font-size: .95rem; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 8px; padding: 8px 12px; min-height: 40px; cursor: pointer; }
button.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chips button { font: inherit; font-size: .85rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; min-height: 36px; cursor: pointer; }
.chips button:hover { border-color: var(--accent); }

.result { background: var(--accent-soft); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.result .big { font-size: 2.4rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.result .big small { font-size: 1rem; font-weight: 600; color: var(--ink-2); margin-left: 4px; }
.result .sub { color: var(--ink-2); font-size: .95rem; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); vertical-align: middle; }

.note { border-radius: 8px; padding: 10px 12px; margin: 8px 0; font-size: .92rem; }
.note.warn { background: var(--warn-soft); color: var(--ink); border-left: 4px solid var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--ink); border-left: 4px solid var(--bad); }
.note.ok { background: var(--ok-soft); color: var(--ink); border-left: 4px solid var(--ok); }
.note.info { background: var(--surface-2); color: var(--ink); border-left: 4px solid var(--ink-2); }

table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .95rem; }
table.data th, table.data td { text-align: right; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.meter { position: relative; height: 14px; border-radius: 999px; background: var(--surface-2); margin: 28px 0 22px; }
.meter .band { position: absolute; top: 0; bottom: 0; background: var(--ok-soft); border: 1px solid var(--ok); border-radius: 999px; }
.meter .pin { position: absolute; top: -8px; width: 4px; height: 30px; background: var(--accent); border-radius: 2px; transform: translateX(-2px); }
.meter .tick { position: absolute; top: 18px; font-size: .72rem; color: var(--ink-2); transform: translateX(-50%); white-space: nowrap; }
.meter .end { position: absolute; top: -20px; font-size: .75rem; color: var(--ink-2); }

.footnotes { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 12px; font-size: .85rem; color: var(--ink-2); }
.footnotes ol { padding-left: 1.25rem; margin: 8px 0; }
.footnotes li { margin: 6px 0; }
sup a { text-decoration: none; font-weight: 600; }
footer.site { border-top: 1px solid var(--line); padding: 20px 0 32px; font-size: .85rem; color: var(--ink-2); }

.malt-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 10px; }
@media (max-width: 480px) { .malt-row { grid-template-columns: 1fr 1fr; } .malt-row .rm { grid-column: 1 / -1; justify-self: end; } }

.tool-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.tool-list a { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tool-list a:hover { border-color: var(--accent); }
.tool-list strong { display: block; font-size: 1.05rem; }
.tool-list span { color: var(--ink-2); font-size: .92rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
