/* Feet inch calculator pages on scrollingisevil.com.
   One family (system UI sans), a near-black ink on a cool paper, one red accent.
   Ruler ticks on the display are the one signature element. 8px radius throughout. */
:root {
  color-scheme: light dark;
  --bg: #f3f3ef;
  --panel: #ffffff;
  --ink: #16181a;
  --muted: #565c61;
  --line: #d6d7d1;
  --key: #ecede8;
  --key-hover: #e2e3dd;
  --accent: #c8281e;
  --accent-ink: #ffffff;
  --link: #a81f17;
  --tick: #8d9296;
  --ok: #1d6b3a;
  --warn: #9a4d00;
  --r: 8px;
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2.5rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111312;
    --panel: #1a1d1c;
    --ink: #ecebe5;
    --muted: #a0a6a1;
    --line: #2f3432;
    --key: #252927;
    --key-hover: #2f3431;
    --accent: #f2655b;
    --accent-ink: #1a0a09;
    --link: #f59088;
    --tick: #7a817c;
    --ok: #6fcf97;
    --warn: #f0b36b;
  }
}
:root[data-theme="dark"] {
  --bg: #111312; --panel: #1a1d1c; --ink: #ecebe5; --muted: #a0a6a1; --line: #2f3432;
  --key: #252927; --key-hover: #2f3431; --accent: #f2655b; --accent-ink: #1a0a09;
  --link: #f59088; --tick: #7a817c; --ok: #6fcf97; --warn: #f0b36b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  overflow-wrap: break-word;
}
a { color: var(--link); text-underline-offset: 0.15em; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.wrap { max-width: 42rem; margin: 0 auto; padding: var(--s4) 1rem var(--s6); }
.crumbs { font-size: 0.92rem; color: var(--muted); margin: 0 0 var(--s4); }
.crumbs a { color: var(--muted); }
h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 var(--s3); font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: var(--s6) 0 var(--s2); font-weight: 700; text-wrap: balance; }
h3 { font-size: 1.05rem; margin: var(--s5) 0 var(--s1); font-weight: 700; }
p { margin: 0 0 var(--s3); }
.lede { font-size: 1.1rem; margin: 0 0 var(--s4); }
.sitenav { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: 0 0 var(--s4); font-size: 0.95rem; }
.sitenav a { color: var(--ink); }
.sitenav a[aria-current="page"] { font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--accent); }

/* ---- calculator ---- */
.calc {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin: 0 0 var(--s4);
}
.display {
  position: relative;
  padding: 1.35rem var(--s4) var(--s3);
  min-height: 8rem;
  border-bottom: 1px solid var(--line);
}
/* ruler ticks along the top edge: every 1/16, taller at the 1/4 and 1/2 */
.display::before, .display::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  pointer-events: none;
}
.display::before {
  height: 7px;
  background-image: repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 8px);
}
.display::after {
  height: 13px;
  background-image: repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 32px);
  opacity: 0.9;
}
.expr {
  min-height: 1.6rem;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  word-break: break-word;
}
.expr.live { color: var(--ink); }
.expr .caret { display: inline-block; width: 2px; height: 1.1em; background: var(--accent); vertical-align: text-bottom; margin-left: 1px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .expr .caret { animation: none; } }
.result {
  font-size: 2.35rem;
  line-height: 1.15;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: var(--s2) 0 var(--s1);
  min-height: 2.7rem;
  word-break: break-word;
}
.result.preview { color: var(--muted); }
.result.error { font-size: 1.1rem; font-weight: 600; color: var(--warn); line-height: 1.35; }
.hint { font-size: 0.92rem; color: var(--muted); min-height: 1.35rem; margin: 0; }
.readout-box { border-top: 1px solid var(--line); padding: var(--s2) var(--s4) var(--s3); }
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 var(--s4); margin: 0; padding: 0; font-variant-numeric: tabular-nums; }
.readout-box:has(.readouts:empty) { display: none; }
.readouts div { display: flex; justify-content: space-between; gap: var(--s2); border-top: 1px solid var(--line); padding: var(--s1) 0; font-size: 0.95rem; }
.readouts dt { color: var(--muted); }
.readouts dd { margin: 0; font-weight: 600; text-align: right; }
.tools-row { display: flex; flex-wrap: nowrap; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); }
.tools-row label { font-size: 0.92rem; color: var(--muted); }
.tools-row .spacer { flex: 0 0 0; }
.tools-row .btn { white-space: nowrap; margin-left: auto; }

.pad { padding: var(--s3); display: grid; gap: var(--s2); }
.chips { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--s2); }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); }
button, select, input { font: inherit; color: var(--ink); }
.key, .chip {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--key);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.key:hover, .chip:hover { background: var(--key-hover); }
.key:active, .chip:active { transform: translateY(1px); }
.chip { min-height: 44px; font-size: 0.9rem; }
.key.op { color: var(--link); font-weight: 700; }
.key.mark { font-size: 1.8rem; line-height: 1; }
.key.eq { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; grid-column: span 2; }
.key.eq:hover { filter: brightness(0.95); }
.key.wide { grid-column: span 2; font-size: 1rem; color: var(--muted); }
.key.fn { font-size: 1.1rem; color: var(--muted); }
@media (max-width: 400px) {
  .result { font-size: 2rem; }
}

select, input[type="text"], input[type="number"] {
  min-height: 44px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0.4rem 0.6rem;
  width: 100%;
}
.tools-row select { width: auto; flex: 1 1 8rem; min-width: 0; max-width: 14rem; }
button.btn {
  min-height: 44px;
  padding: 0.4rem 0.95rem;
  background: var(--key);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
}
button.btn:hover { background: var(--key-hover); }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.history { list-style: none; margin: 0; padding: 0; }
.history li { border-top: 1px solid var(--line); }
.history button { width: 100%; text-align: left; background: none; border: 0; padding: 0.55rem var(--s3); min-height: 44px; cursor: pointer; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.history button:hover { background: var(--key); }
.history .h-res { font-weight: 700; display: block; }
.history .h-expr { color: var(--muted); display: block; font-size: 0.88rem; }
.history-title { font-size: 0.92rem; color: var(--muted); padding: var(--s2) var(--s3) var(--s1); margin: 0; }

/* ---- forms for solver pages ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); margin: 0 0 var(--s4); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: var(--s3); margin: 0 0 var(--s3); }
.field { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.field label { font-size: 0.92rem; color: var(--muted); }
.field .help { font-size: 0.85rem; color: var(--muted); }
.out { margin: var(--s4) 0 0; }
.out .big { font-size: 1.9rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; margin: 0 0 var(--s1); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 var(--s4); margin: var(--s3) 0 0; }
.stat-grid div { border-top: 1px solid var(--line); padding: var(--s2) 0; display: flex; justify-content: space-between; gap: var(--s3); font-variant-numeric: tabular-nums; }
.stat-grid dt { color: var(--muted); }
.stat-grid dd { margin: 0; font-weight: 600; text-align: right; }
.flag { font-size: 0.95rem; margin: var(--s2) 0 0; }
.flag.ok { color: var(--ok); }
.flag.warn { color: var(--warn); }

table { width: 100%; border-collapse: collapse; font-size: 0.97rem; margin: var(--s3) 0 var(--s4); font-variant-numeric: tabular-nums; }
caption { text-align: left; color: var(--muted); font-size: 0.92rem; padding: 0 0 var(--s1); }
th, td { text-align: left; vertical-align: top; padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--line); }
th { font-weight: 700; border-bottom: 2px solid var(--ink); }
td.num, th.num { text-align: right; }
.table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--s1)); padding: 0 var(--s1); }
.table-wrap table { min-width: 20rem; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.93em; }
.worked { border-left: 3px solid var(--accent); padding: 0 0 0 var(--s3); margin: var(--s3) 0 var(--s4); }
.worked p { margin: 0 0 var(--s1); }
ol.steps, ul.plain { margin: 0 0 var(--s4); padding-left: 1.25rem; }
ol.steps li, ul.plain li { margin: 0.3rem 0; }
.faq h3 { margin-top: var(--s4); }
.source { font-size: 0.9rem; color: var(--muted); }
.board-rows .row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: var(--s2); align-items: end; margin: 0 0 var(--s2); }
.board-rows .row .field label { font-size: 0.8rem; }
.board-rows .row .rm { padding: 0 var(--s3); }
.board-rows .bf { grid-column: 1 / -1; font-size: 0.92rem; color: var(--muted); margin: 0 0 var(--s2); }
@media (max-width: 520px) {
  .board-rows .row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board-rows .row .rm { grid-column: 1 / -1; width: 100%; }
}
footer.site { margin-top: var(--s6); padding-top: var(--s3); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }
footer.site a { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media print {
  .pad, .sitenav, .tools-row { display: none; }
  body { background: #fff; color: #000; }
}
