/*
  Loaded Film shared styles. The calculators are grouped as "Roll Math".
  Look: a dark screening room. Black ground with film grain, warm-white accents, orange only for
  camera LEDs, LCD numbers and film edge print. Minimal: hairlines instead of boxes; the result
  panel is the one filled, bordered thing on a tool page.
  Phone first: 18px inputs (no iOS zoom), 48px tap targets, Enter moves to the next field,
  and a result bar pinned to the bottom of the screen while you fill in the form (site.js).
*/
:root {
  color-scheme: dark;
  --bg: #0c0b0a;
  --surface: #151311;
  --text: #f3eee6;
  --muted: #a39a90;
  --faint: #6f675f;
  --line: rgba(243, 238, 230, .16);
  --line-strong: rgba(243, 238, 230, .4);
  --white: #fbf8f3;
  --ink: #0c0b0a;              /* text on the white result panel */
  --ink-muted: #5d554e;
  --lcd: #ff8a3d;              /* camera LCD + LEDs */
  --edge: #d98a4a;             /* film edge print */
  --warn: #ffb27a;
  --good: #8fd19e;
  --body-1: #3b3733;           /* camera-body button gradient */
  --body-2: #1d1b19;
  --chrome: #6d665f;

  --f-display: "Shrikhand", "Cooper Black", Georgia, serif;
  --f-body: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-spec: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --r: 10px;
  --tap: 48px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--f-body); font-size: 17px; line-height: 1.6;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--white); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
a:hover { color: var(--lcd); }
:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }
::selection { background: var(--white); color: var(--ink); }

/* ---------- Film grain (moves on desktop, still on phones and for reduced motion) ---------- */
.grain {
  position: fixed; inset: -50%; z-index: 50; pointer-events: none; opacity: .13;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.1 -.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .grain { animation: grain .9s steps(6) infinite; will-change: transform; }
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-4%, 3%); } 40% { transform: translate(3%, -5%); }
  60% { transform: translate(-6%, -2%); } 80% { transform: translate(5%, 4%); } 100% { transform: translate(-2%, 6%); }
}

/* ---------- Layout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 20px; padding-block: 8px 72px; }
.wrap.narrow { max-width: 760px; }

/* ---------- Nav ---------- */
.site-nav { border-bottom: 1px solid var(--line); padding-inline: 20px; }
.site-nav .in { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px 20px; min-height: 64px; flex-wrap: wrap; padding-block: 8px; }
.brand { font-family: var(--f-display); font-size: 25px; line-height: 1; color: var(--white); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--white); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px 18px; flex-wrap: wrap; }
.site-nav ul a {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; color: var(--muted); text-decoration: none;
  font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
}
.site-nav ul a svg { width: 18px; height: 18px; flex: none; }
.site-nav ul a:hover, .site-nav ul a[aria-current="page"] { color: var(--white); }
.site-nav ul a[aria-current="page"] { text-decoration: underline; text-underline-offset: 7px; text-decoration-thickness: 1.5px; }
.dateback { font-family: var(--f-spec); font-size: 13px; color: var(--lcd); text-shadow: 0 0 7px rgba(255, 138, 61, .7); letter-spacing: .12em; }
@media (max-width: 640px) {
  .site-nav .in { min-height: 56px; }
  .brand { font-size: 22px; }
  .site-nav ul { gap: 2px 14px; }
  .site-nav ul a { font-size: 12px; letter-spacing: .06em; }
  .site-nav ul a svg, .dateback { display: none; }
}

/* ---------- Type ---------- */
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-family: var(--f-display); font-weight: 400; color: var(--white); font-size: clamp(34px, 6.4vw, 60px); line-height: 1.06; }
h2 { font-weight: 700; font-size: 20px; line-height: 1.3; color: var(--white); }
h3 { font-weight: 700; font-size: 17px; color: var(--white); }
.spec { font-family: var(--f-spec); font-weight: 500; font-size: 12px; letter-spacing: .09em; text-transform: uppercase; }
.label { font-family: var(--f-spec); font-weight: 500; font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0; }
.lede { font-size: 18px; color: var(--muted); max-width: 56ch; margin: 14px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Tool page layout ---------- */
.tool-head { padding-block: 36px 30px; }
.tool-head .label { margin-bottom: 12px; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 48px; align-items: start; }
@media (max-width: 860px) { .tool-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; } }
.result-col { position: sticky; top: 20px; display: grid; gap: 20px; }
@media (max-width: 860px) { .result-col { position: static; } }

/* Form groups: a mono label and a hairline, no boxes */
.inputs { display: grid; gap: 34px; }
.group { border: 0; margin: 0; padding: 0; display: grid; gap: 20px; min-width: 0; }
.group > legend { float: left; width: 100%; padding: 0 0 10px; margin: 0; border-bottom: 1px solid var(--line); }
.group > legend + * { clear: both; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
@media (max-width: 560px) { .row { grid-template-columns: minmax(0, 1fr); } }

.f { display: grid; gap: 6px; min-width: 0; font-weight: 700; font-size: 15px; color: var(--text); }
.hint { font-weight: 400; font-size: 14px; color: var(--muted); }

input[type="text"], input[type="search"], input[type="number"], select {
  font: inherit; font-size: 18px; font-weight: 500; color: var(--white); width: 100%; min-height: var(--tap);
  padding: 10px 2px; background: transparent; border: 0; border-bottom: 1.5px solid var(--line-strong); border-radius: 0;
  -webkit-appearance: none; appearance: none;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus { outline: none; border-bottom-color: var(--white); box-shadow: 0 1.5px 0 var(--white); }
select {
  cursor: pointer; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23fbf8f3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center; background-size: 12px 8px;
}
select option { background: var(--surface); color: var(--white); }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 2px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--muted); pointer-events: none; }
.money input { padding-left: 18px; }
.unit { position: relative; }
.unit::after { content: attr(data-unit); position: absolute; right: 2px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--muted); pointer-events: none; }

/* ---------- Camera-body buttons ---------- */
.hw {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 18px 8px 30px; cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 700; color: var(--white); text-decoration: none;
  border: 1.5px solid var(--chrome); border-radius: var(--r);
  background: linear-gradient(180deg, var(--body-1), var(--body-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 4px 0 #000;
  transition: transform .08s ease, box-shadow .08s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.hw::before { content: ""; position: absolute; left: 12px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #4c4640; box-shadow: 0 0 0 1px #000; }
.hw:hover { color: var(--white); }
.hw:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 1px 0 #000; }
.hw.lit::before { background: var(--lcd); box-shadow: 0 0 0 1px #000, 0 0 9px var(--lcd); }
.hw.plain { padding-left: 18px; }
.hw.plain::before { display: none; }
.hw.light {
  color: var(--ink); background: linear-gradient(180deg, #ffffff, #d9d3cb); border-color: #fff;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15), 0 4px 0 #8f877e;
}
.hw.light::before { background: var(--lcd); box-shadow: 0 0 0 1px #8f877e, 0 0 8px var(--lcd); }
.hw.light:hover { color: var(--ink); }
.hw.light:active { box-shadow: 0 1px 0 #8f877e; }
.hw.sq { min-width: var(--tap); min-height: var(--tap); padding: 0; font-size: 22px; line-height: 1; }
.hw.sq::before { display: none; }

/* Radio/checkbox options drawn as camera buttons. Markup: <label class="opt"><input type="radio"><span>…</span></label> */
.opts { display: flex; flex-wrap: wrap; gap: 12px 10px; }
.opts.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opts.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 400px) { .opts.grid3 { grid-template-columns: minmax(0, 1fr); } }
.opt { position: relative; display: block; min-width: 0; }
.opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.opt > span {
  position: relative; display: grid; align-content: center; gap: 1px; min-height: var(--tap); height: 100%;
  padding: 9px 14px 9px 32px; border: 1.5px solid var(--chrome); border-radius: var(--r);
  background: linear-gradient(180deg, var(--body-1), var(--body-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 4px 0 #000;
  font-weight: 700; font-size: 15px; line-height: 1.25; color: var(--text);
  transition: transform .08s ease, box-shadow .08s ease;
}
.opt > span small { font-weight: 400; font-size: 13px; color: var(--muted); }
.opt > span::before { content: ""; position: absolute; left: 13px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #4c4640; box-shadow: 0 0 0 1px #000; }
.opt input:checked + span { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 1px 0 #000; color: var(--white); border-color: #8e867e; }
.opt input:checked + span::before { background: var(--lcd); box-shadow: 0 0 0 1px #000, 0 0 9px var(--lcd); }
.opt input:focus-visible + span { outline: 2px solid var(--white); outline-offset: 3px; }

/* ---------- Result panel: the one lit "projected frame" ---------- */
.result {
  background: var(--white); color: var(--ink); border-radius: 14px; padding: 22px 22px 18px;
  box-shadow: 0 0 60px rgba(255, 240, 215, .1); display: grid; gap: 16px; scroll-margin-top: 16px;
}
.result .label { color: var(--ink-muted); }
.result a { color: var(--ink); }
.big { font-family: var(--f-display); font-weight: 400; font-size: clamp(52px, 11vw, 72px); line-height: 1; font-variant-numeric: tabular-nums; margin: 4px 0 0; color: var(--ink); }
.sub { margin: 6px 0 0; font-size: 15px; color: var(--ink-muted); }
.lines { display: grid; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(12, 11, 10, .14); font-size: 15px; }
.line b { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* Notes under a tool */
.tool-notes { color: var(--muted); font-size: 14px; max-width: 72ch; display: grid; gap: 10px; margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); }
.tool-notes a { color: var(--text); }

/* ---------- Phone result bar (filled by site.js) ---------- */
.resultbar { display: none; }
@media (max-width: 860px) {
  .resultbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 20px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--white); color: var(--ink);
    border: 0; width: 100%; font: inherit; text-align: left; cursor: pointer;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .5); transform: translateY(0); transition: transform .2s ease;
  }
  .resultbar.away { transform: translateY(110%); }
  .resultbar b { font-family: var(--f-display); font-weight: 400; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
  .resultbar span { font-size: 13px; color: var(--ink-muted); text-align: right; line-height: 1.3; white-space: pre-line; }
  body.has-bar .wrap { padding-bottom: 120px; }
}

/* ---------- Film strip band ---------- */
.film { background: #050504; }
.sprockets { height: 26px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='26'%3E%3Crect x='9' y='7' width='14' height='12' rx='3' fill='%23efe9e0' fill-opacity='.8'/%3E%3C/svg%3E"); background-repeat: repeat-x; }
.edgeprint { display: flex; gap: 48px; overflow: hidden; white-space: nowrap; padding: 0 20px; color: var(--edge); font-size: 11px; opacity: .8; }

/* ---------- Prose pages ---------- */
.prose { max-width: 66ch; padding-block: 36px 0; }
.prose h1 { margin-bottom: 6px; }
.prose h2 { margin: 34px 0 8px; }
.prose p { margin: 0 0 14px; }
.draft { font-family: var(--f-spec); font-size: 12px; letter-spacing: .04em; color: var(--lcd); border: 1px solid rgba(255, 138, 61, .5); border-radius: 8px; padding: 10px 12px; margin: 0 0 26px; }

/* ---------- Footer ---------- */
.site-footer { padding-inline: 20px; padding-block: 0 40px; }
.site-footer .in { max-width: 1080px; margin: 0 auto; border-top: 1px solid var(--line); padding-top: 22px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; font-size: 14px; color: var(--muted); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-footer a { color: var(--text); text-decoration: none; display: inline-block; padding-block: 6px; }
.site-footer a:hover { color: var(--white); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Brand: a simple film canister beside the R, leader pointing away, slanted to match Shrikhand */
.brand { display: inline-flex; align-items: center; gap: 2px; }
.brand .can { width: auto; height: 1.3em; flex: none; overflow: visible; margin-top: -.06em; transform: skewX(-12deg); }
.brand .leader { transition: transform .25s ease; }
.brand:hover .leader { transform: translateX(-3px); }
