/* Corbel Press: site styles. Night header in the cover's palette, warm paper body for reading. */
@font-face { font-family: "Bebas Neue"; src: url("fonts/BebasNeue-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow"; font-weight: 400; src: url("fonts/Barlow-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow"; font-weight: 500; src: url("fonts/Barlow-Medium.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow"; font-weight: 600; src: url("fonts/Barlow-SemiBold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; src: url("fonts/BarlowCondensed-SemiBold.woff2") format("woff2"); font-display: swap; }

:root {
  --night: #15232d; --night2: #1d3140; --line-night: rgba(167, 196, 212, .16);
  --amber: #f2a541; --amber-deep: #b8661a; --blue: #a7c4d4;
  --radius: 8px; --max: 1120px;
/* light (default) */
  --paper: #f6f1e7; --card: #fffdf8; --ink: #1b2328; --muted: #56636c; --line: #ddd4c4; --soft: #efe8da;
  --ok: #2f6b4f; --warn: #9a4b12; --link: #a65a14; --link-hover: #7a400c; --accent-text: #a65a14;
  --field: #ffffff; --field-line: #b9ae9b; --row: #fbf8f1; --hi: #fdf1dc; --note: #fbf3e2; --warn-bg: #fdecea; --warn-line: #b3412e;
  --btn: #1d3140; --btn-ink: #f4f1ea; --btn-hover: #15232d; --ghost-ink: #1d3140; --seg-on: #1d3140; --seg-on-ink: #ffffff;
  --big: #15232d; --row-head: #1d3140; --shadow: rgba(0,0,0,.25); color-scheme: light;
}
/* dark: the device asks for it and the visitor has not picked light */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #0d161d; --card: #15222c; --ink: #e8e4dc; --muted: #a2b0b9; --line: #2a3b48; --soft: #1c2b36;
  --ok: #7cc39d; --warn: #f2a06a; --link: #f2a541; --link-hover: #ffc777; --accent-text: #f2a541;
  --field: #0f1b23; --field-line: #46606f; --row: #111e27; --hi: #3b2d14; --note: #262012; --warn-bg: #331c18; --warn-line: #e0705a;
  --btn: #2a4253; --btn-ink: #f4f1ea; --btn-hover: #34516a; --ghost-ink: #d5e1e7; --seg-on: #f2a541; --seg-on-ink: #15232d;
  --big: #f4f1ea; --row-head: #d5e1e7; --shadow: rgba(0,0,0,.55); color-scheme: dark;
} }
/* dark: picked with the switch (kept identical to the block above; tests/test_static.py checks this) */
:root[data-theme="dark"] {
  --paper: #0d161d; --card: #15222c; --ink: #e8e4dc; --muted: #a2b0b9; --line: #2a3b48; --soft: #1c2b36;
  --ok: #7cc39d; --warn: #f2a06a; --link: #f2a541; --link-hover: #ffc777; --accent-text: #f2a541;
  --field: #0f1b23; --field-line: #46606f; --row: #111e27; --hi: #3b2d14; --note: #262012; --warn-bg: #331c18; --warn-line: #e0705a;
  --btn: #2a4253; --btn-ink: #f4f1ea; --btn-hover: #34516a; --ghost-ink: #d5e1e7; --seg-on: #f2a541; --seg-on-ink: #15232d;
  --big: #f4f1ea; --row-head: #d5e1e7; --shadow: rgba(0,0,0,.55); color-scheme: dark;
}
/* paper is always light */
@media print { :root:root:root {
  --paper: #f6f1e7; --card: #fffdf8; --ink: #1b2328; --muted: #56636c; --line: #ddd4c4; --soft: #efe8da;
  --ok: #2f6b4f; --warn: #9a4b12; --link: #a65a14; --link-hover: #7a400c; --accent-text: #a65a14;
  --field: #ffffff; --field-line: #b9ae9b; --row: #fbf8f1; --hi: #fdf1dc; --note: #fbf3e2; --warn-bg: #fdecea; --warn-line: #b3412e;
  --btn: #1d3140; --btn-ink: #f4f1ea; --btn-hover: #15232d; --ghost-ink: #1d3140; --seg-on: #1d3140; --seg-on-ink: #ffffff;
  --big: #15232d; --row-head: #1d3140; --shadow: rgba(0,0,0,.25); color-scheme: light;
} }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.55 "Barlow", system-ui, sans-serif; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
img { max-width: 100%; height: auto; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; background: var(--card); color: var(--ink); padding: 8px 12px; z-index: 10; }

/* header: night sky with the book's graph-paper grid */
.site-head { background: var(--night); color: #f4f1ea;
  background-image: linear-gradient(var(--line-night) 1px, transparent 1px), linear-gradient(90deg, var(--line-night) 1px, transparent 1px);
  background-size: 24px 24px; background-position: -1px -1px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; flex-wrap: wrap; }
.brand { color: #f4f1ea; text-decoration: none; font: 600 15px/1 "Barlow Condensed", sans-serif; letter-spacing: .28em; }
.brand:hover { color: var(--amber); }
.topnav { display: flex; gap: 18px; flex-wrap: wrap; }
.topnav a { color: var(--blue); text-decoration: none; font: 600 14px/1 "Barlow Condensed", sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--amber); }
.hero { padding: 26px 0 34px; }
.kicker { font: 600 14px/1.2 "Barlow Condensed", sans-serif; letter-spacing: .2em; text-transform: uppercase; color: var(--amber); margin: 0 0 6px; }
.hero h1 { font: 400 clamp(44px, 7vw, 76px)/.95 "Bebas Neue", sans-serif; letter-spacing: .01em; margin: 0 0 12px; color: #f4f1ea; }
.hero h1 .amber { color: var(--amber); }
.hero p.lede { max-width: 720px; margin: 0; color: #d7e2e8; font-size: 18px; }

main { padding: 28px 0 56px; }
h2 { font: 400 32px/1.05 "Bebas Neue", sans-serif; letter-spacing: .02em; margin: 0 0 12px; }
h3 { font: 600 17px/1.3 "Barlow", sans-serif; margin: 18px 0 8px; }
.label-caps { font: 600 13px/1.2 "Barlow Condensed", sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* calculator layout */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .calc { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.card + .card { margin-top: 20px; }
.results { position: sticky; top: 16px; }
@media (max-width: 900px) { .results { position: static; } }
.results .card { border-top: 4px solid var(--amber); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
button, .btn { font: 600 15px/1 "Barlow", sans-serif; border-radius: 6px; padding: 10px 14px; cursor: pointer;
  border: 1px solid var(--btn); background: var(--btn); color: var(--btn-ink); text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--btn-hover); color: var(--amber); }
button.ghost, .btn.ghost { background: transparent; color: var(--ghost-ink); border-color: var(--ghost-ink); }
button.ghost:hover, .btn.ghost:hover { background: var(--soft); color: var(--ink); }
button.small { padding: 6px 10px; font-size: 14px; }
button.icon { padding: 6px 9px; background: transparent; color: var(--muted); border-color: var(--line); }
button.icon:hover { color: var(--warn); background: var(--soft); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.field { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; margin: 0 0 14px; }
.field label { font-weight: 500; }
.field .hint { grid-column: 1 / -1; color: var(--muted); font-size: 14.5px; margin-top: -2px; }
.inputunit { display: flex; align-items: center; gap: 8px; }
.inputunit .unit { color: var(--muted); font-size: 15px; min-width: 2.5em; }
input[type=number], input[type=text], select { font: 500 16px/1.2 "Barlow", sans-serif; color: var(--ink); background: var(--field);
  border: 1px solid var(--field-line); border-radius: 6px; padding: 8px 10px; }
input[type=number] { width: 7.5em; text-align: right; font-variant-numeric: tabular-nums; }
input[type=text] { width: 100%; }
select { padding-right: 28px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--link); }
.check { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; font-weight: 500; }
fieldset { border: 0; padding: 0; margin: 0 0 6px; }
legend { padding: 0; margin-bottom: 8px; }

.seg { display: inline-flex; border: 1px solid var(--field-line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--field); color: var(--ink); padding: 8px 12px; font-weight: 500; }
.seg button + button { border-left: 1px solid var(--field-line); }
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--seg-on-ink); }

/* repeating rows (people, devices, lights, pantry items) */
.rows { display: grid; gap: 10px; margin-bottom: 12px; }
.row { display: grid; gap: 8px; align-items: end; background: var(--row); border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.row .mini label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.row .mini input[type=number] { width: 100%; }
.row .mini select { width: 100%; }

/* results */
.big { font: 400 46px/1 "Bebas Neue", sans-serif; letter-spacing: .01em; color: var(--big); margin: 4px 0 2px; }
.big small { font: 500 18px/1 "Barlow", sans-serif; color: var(--muted); letter-spacing: 0; }
.sub { color: var(--muted); margin: 0 0 12px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 8px 0 14px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font: 600 13px/1.2 "Barlow Condensed", sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--line); }
td.num, th.num { text-align: right; }
tr.hi td { background: var(--hi); }
tr.total td { font-weight: 600; border-top: 2px solid var(--line); }
.tablewrap { overflow-x: auto; }
.note { background: var(--note); border-left: 4px solid var(--amber); padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 12px 0; font-size: 16px; }
.warn { background: var(--warn-bg); border-left: 4px solid var(--warn-line); }
.how { margin-top: 16px; }
.how summary { cursor: pointer; font-weight: 600; }
.formula { font: 500 15.5px/1.6 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; background: var(--soft); border-radius: 6px; padding: 10px 12px; white-space: pre-wrap; }
.saved { color: var(--ok); font-size: 14.5px; min-height: 1.2em; }

/* hub and home */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tile { display: block; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--amber); transform: translateY(-2px); color: var(--ink); }
.tile .label-caps { color: var(--accent-text); }
.tile h3 { margin: 6px 0 4px; font-size: 19px; }
.tile p { margin: 0; color: var(--muted); font-size: 15.5px; }
.book { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }
@media (max-width: 720px) { .book { grid-template-columns: 1fr; } .book img { max-width: 240px; } }
.book img { border-radius: 4px; box-shadow: 0 10px 30px var(--shadow); }
.section { margin: 36px 0; }
ul.clean { padding-left: 1.1em; } ul.clean li { margin: 4px 0; }

.site-foot { background: var(--night); color: #b9c8d1; font-size: 15px; padding: 28px 0 36px; }
.site-foot a { color: var(--blue); }
.site-foot p { margin: 6px 0; max-width: 860px; }

@media print {
  .site-head, .site-foot, .actions, .no-print, details.how { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .calc { display: block; } .card { border: 1px solid #999; break-inside: avoid; }
  .results { position: static; } a { color: #000; }
  .print-title { display: block !important; font: 400 26pt "Bebas Neue", sans-serif; margin: 0 0 6pt; }
}
.print-title { display: none; }

/* rows shrink on small screens instead of overflowing */
.row > *, .row .mini { min-width: 0; }
.row .mini input, .row .mini select { width: 100%; min-width: 0; }
.card { min-width: 0; }

table.sheet th.tiercol { color: var(--accent-text); }
table.sheet th[scope=row] { font: 600 15px/1.3 "Barlow", sans-serif; color: var(--row-head); }

/* theme switch (header is night in both themes) */
.topbar .brand { margin-right: auto; }
.topbar .theme-toggle { order: 2; }
@media (max-width: 600px) { .topbar .topnav { order: 3; width: 100%; } .topbar { row-gap: 6px; } }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
  background: transparent; border: 1px solid var(--line-night); border-radius: 50%; color: var(--blue); }
.theme-toggle:hover { background: var(--night2); color: var(--amber); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
.site-foot .status { color: var(--amber); }
/* backup and restore */
.backup { margin-top: 18px; }
.backup .actions { margin-bottom: 6px; }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.filebtn:focus-within { outline: 3px solid var(--amber); outline-offset: 2px; }

/* phones: long rows put the name on its own line, the remove button at its right, the numbers below */
@media (max-width: 600px) {
  .r-person, .r-pet, .r-pantry { position: relative; grid-template-columns: 1fr 1fr !important; }
  .r-pet { grid-template-columns: 1.5fr 1fr !important; }
  .r-person > .mini:first-child, .r-pet > .mini:first-child, .r-pantry > .mini:first-child { grid-column: 1 / -1; margin-right: 50px; }
  .r-person > button.icon, .r-pet > button.icon, .r-pantry > button.icon { position: absolute; top: 28px; right: 10px; }
  .rowhead { grid-template-columns: 1fr 1.3fr auto !important; }
}
