:root {
  color-scheme: light;
  --graphite: #14181f;
  --brass: #d97706;
  --coating: #0891b2;
  --paper: #f7f7f5;
  --white: #fff;
  --line: #d9dfdc;
  --muted: #4d5a62;
  --teal-text: #086577;
  --brass-text: #874504;
  --display: "Avenir Next", "Segoe UI", Arial, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 20px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--graphite);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
}
a { color: var(--teal-text); text-underline-offset: .22em; }
a:hover { color: var(--brass-text); }
img, svg { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.07; font-family: var(--display); }
p, figure, dl, dd { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--coating); outline-offset: 4px; }
.wrap { width: min(100% - 64px, 1232px); margin-inline: auto; }
.sr-only, .skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: .6rem 1rem;
  background: var(--white);
  color: var(--graphite);
}

.site-header { background: var(--graphite); color: var(--white); }
.header-row, .footer-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.header-row { min-height: 68px; }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  font-family: var(--display);
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -.025em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark img { display: block; flex: none; }
.site-header nav, .site-footer nav { display: flex; flex-wrap: wrap; gap: 4px clamp(.75rem, 3vw, 2rem); }
.site-header nav a, .site-footer nav a {
  color: inherit;
  font-size: .91rem;
  font-weight: 650;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.site-header a:hover, .site-footer a:hover { color: #ffc177; }
.site-header :focus-visible, .site-footer :focus-visible { outline-color: #65d2df; }
.site-footer { background: var(--graphite); color: var(--paper); padding: 33px 0; }
.site-footer p { margin-top: .5rem; color: #c1c9ca; font-size: .92rem; }

.hero {
  display: grid;
  grid-template-columns: .95fr 1.05fr;
  align-items: center;
  gap: clamp(30px, 5vw, 80px);
  padding-block: clamp(40px, 6vw, 82px);
}
.hero-copy { min-width: 0; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: .58rem;
  color: var(--brass-text);
  font-family: var(--mono);
  font-size: .86rem;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.eyebrow span { width: 16px; height: 3px; background: var(--brass); flex: none; }
.hero h1 {
  margin-top: 1.1rem;
  font-size: clamp(2.6rem, 5.25vw, 4.95rem);
  font-weight: 700;
  letter-spacing: -.055em;
  line-height: .98;
}
.hero h1 em { display: block; color: var(--teal-text); font-style: normal; }
.hero-intro { max-width: 36ch; margin-top: 1.5rem; font-size: clamp(1.05rem, 1.45vw, 1.24rem); color: var(--muted); }
.hero-actions, .info-links { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1.25rem; margin-top: 1.65rem; }
.hero-art { background: var(--graphite); border: 1px solid #323c43; border-radius: 9px; overflow: hidden; }
.hero-art img { display: block; width: 100%; height: auto; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: .6rem .92rem;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 680;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.button-primary { background: var(--brass); color: var(--graphite); }
.button-primary:hover { background: #e99029; color: var(--graphite); }
.text-link { font-weight: 650; }
.section-heading h2, .related h2 { font-size: clamp(1.65rem, 3.65vw, 2.55rem); letter-spacing: -.037em; font-weight: 700; }
.section-heading p { color: var(--muted); margin-top: .68rem; max-width: 39ch; }
.tools-section { border-top: 1px solid var(--line); padding-block: 35px clamp(47px, 6vw, 75px); }
.tools-section .section-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px 26px; }
.tools-section .section-heading p { margin: 0; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 1.45rem; }
.tool-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(15px, 1.8vw, 24px);
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 2px solid #bac9c8;
  border-radius: 7px;
  color: var(--graphite);
  text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease;
}
.tool-card:hover { border-color: var(--coating); background: #f5fbfb; color: var(--graphite); }
.tool-icon { display: inline-grid; place-items: center; width: 43px; height: 43px; background: #e8f3f4; color: var(--teal-text); border-radius: 5px; margin-bottom: 1.1rem; }
.tool-card small { color: var(--brass-text); font-size: .81rem; font-family: var(--mono); margin-bottom: .4rem; }
.tool-card h3 { font-size: 1.32rem; letter-spacing: -.025em; }
.tool-card p { color: var(--muted); margin-top: .53rem; line-height: 1.46; font-size: .94rem; }
.guides-section { background: #edf0ed; border-top: 1px solid var(--line); padding-block: clamp(42px, 6vw, 78px); }
.guides-layout { display: grid; grid-template-columns: .72fr 1.28fr; gap: clamp(23px, 7vw, 100px); }
.guide-group, .faq-list details { border-bottom: 1px solid #cad3cf; }
.guide-group:first-child, .faq-list details:first-child { border-top: 1px solid #cad3cf; }
.guide-group summary, .faq-list summary {
  display: flex;
  gap: .6rem;
  align-items: baseline;
  padding: .88rem .1rem;
  min-height: 44px;
  font-weight: 680;
  cursor: pointer;
  list-style: none;
}
.guide-group summary::-webkit-details-marker, .faq-list summary::-webkit-details-marker { display: none; }
.guide-group summary::before, .faq-list summary::before {
  content: "+";
  color: var(--teal-text);
  flex: 0 0 1.1rem;
  font-family: var(--mono);
}
.guide-group[open] summary::before, .faq-list details[open] summary::before { content: "−"; }
.guide-group summary small { margin-left: auto; color: var(--muted); white-space: nowrap; font-size: .84rem; font-weight: 450; }
.guide-links { list-style: none; margin: 0; padding: 0; }
.guide-group .guide-links { padding: 0 .35rem .85rem 1.8rem; }
.guide-links li + li { margin-top: .55rem; }

.calculator-page, .info-page { padding-block: 21px clamp(42px, 6vw, 84px); }
.breadcrumbs { color: var(--muted); font-size: .86rem; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; list-style: none; gap: .14rem .45rem; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "/"; margin-right: .45rem; color: #77878b; }
.page-heading { padding-block: 22px 28px; }
.page-heading .eyebrow { margin-bottom: .68rem; }
.page-heading h1, .not-found h1 {
  max-width: 24ch;
  font-size: clamp(2.15rem, 4.6vw, 4.1rem);
  font-weight: 700;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}
.page-heading > p:not(.eyebrow), .not-found > p:not(.eyebrow) { margin-top: .88rem; max-width: 74ch; color: var(--muted); font-size: 1.06rem; }
.worked-jump { display: inline-block; margin-top: .6rem; }
.workspace { display: grid; grid-template-columns: minmax(0, .87fr) minmax(0, 1.13fr); gap: 15px; align-items: start; }
.input-panel, .result-panel { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: clamp(14px, 2vw, 23px); }
.panel-heading { display: flex; gap: .5rem 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: .9rem; }
.panel-heading h2, .print-inputs h2 { font-size: 1.41rem; font-weight: 700; letter-spacing: -.023em; }
.button-reset { min-height: 40px; border-color: var(--line); background: var(--paper); color: var(--graphite); padding: .4rem .75rem; }
.input-actions { display: flex; align-items: center; gap: .8rem; }
.results-jump { display: none; font-size: .9rem; }
.button-reset:hover, .button-export:hover { border-color: var(--coating); background: #f3fcfc; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .88rem .85rem; align-items: start; }
.field { min-width: 0; display: flex; flex-direction: column; gap: .27rem; }
.field:has(:is(#mode, #codec)) { grid-column: 1 / -1; }
.field label { font-size: .91rem; font-weight: 640; }
.field small { color: var(--muted); line-height: 1.4; font-size: .83rem; }
.field input, .field select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #aab7b7;
  border-radius: 5px;
  padding: .55rem .65rem;
  background-color: #fcfdfc;
  color: var(--graphite);
  font-size: 1rem;
}
.field input { font-variant-numeric: tabular-nums; }
.field input[type="number"] { appearance: textfield; }
.field input::-webkit-inner-spin-button, .field input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.field select {
  appearance: none;
  padding-right: 1.65rem;
  background-image: linear-gradient(45deg, transparent 50%, #334851 50%), linear-gradient(135deg, #334851 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.field [aria-invalid="true"] { border-color: #a3291c; }
.scenario { margin-bottom: 1rem; padding-bottom: .95rem; border-bottom: 1px solid #e2e6e3; }
.scenario select { background-color: #eff5f4; }
.validation, .action-status { font-size: .89rem; margin-top: .7rem; }
.validation { color: #95271d; font-weight: 610; }
.validation:empty, .action-status:empty, .result-notes:empty { display: none; }
.input-panel noscript p { color: var(--muted); margin-top: 1rem; }

.local { display: inline-flex; gap: .42rem; align-items: center; color: var(--teal-text); font-size: .83rem; font-weight: 680; }
.local span { width: 7px; height: 7px; border: 1px solid var(--coating); border-radius: 50%; }
.results-heading { min-height: 40px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.metric { min-width: 0; min-height: 65px; padding: .64rem .7rem; border: 1px solid #e3e7e4; background: #f8f9f7; border-radius: 5px; }
.metric-lead { background: #edf6f5; border-color: #cddfdd; }
.metric dt { color: var(--muted); font-size: .85rem; line-height: 1.25; }
.metric dd { margin-top: .22rem; font-family: var(--mono); font-size: 1.08rem; font-weight: 660; line-height: 1.2; overflow-wrap: anywhere; }
.metric-lead dd { font-size: clamp(1.15rem, 2.2vw, 1.72rem); color: var(--teal-text); }
.metric small { color: var(--muted); font-family: var(--body); font-size: .83rem; font-weight: 590; }
.result-notes { display: grid; gap: .35rem; color: var(--muted); font-size: .9rem; margin-top: .8rem; }
.result-figure { margin-top: .9rem; background: var(--graphite); color: var(--paper); overflow: hidden; border-radius: 6px; }
.figure-heading { color: #eef3f2; font-weight: 680; padding: .57rem .85rem; border-bottom: 1px solid #303942; }
.result-figure svg { display: block; width: 100%; height: auto; }
.result-figure figcaption { border-top: 1px solid #303942; padding: .54rem .85rem .68rem; color: #c4cfd1; font-size: .84rem; }
.action-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: .82rem; }
.button-share { background: var(--graphite); color: var(--paper); }
.button-share:hover { background: #31424a; }
.button-export { background: var(--white); color: var(--graphite); border-color: #c6d1cf; }
.action-bar button:disabled { opacity: .52; cursor: default; }
.share-panel { margin-top: .75rem; }
.action-status { color: var(--teal-text); }
.workspace[data-invalid] .result-content { display: none; }
.print-inputs { display: none; }

.after-workspace { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); gap: clamp(23px, 5vw, 67px); padding-top: 38px; }
.explanation { max-width: 78ch; }
.explanation > section + section { margin-top: 1.8rem; }
.explanation h2 { font-size: 1.62rem; letter-spacing: -.03em; }
.explanation p, .explanation ol { margin-top: .64rem; color: var(--muted); }
.explanation ol { padding-left: 1.4rem; }
.explanation li + li { margin-top: .5rem; }
.formula { margin-top: .9rem; }
.formula h3 { font-size: 1.07rem; color: var(--graphite); margin-bottom: .44rem; }
.formula code {
  display: block;
  padding: .56rem .8rem;
  border-left: 3px solid var(--brass);
  background: #eaece7;
  color: #253138;
  font-family: var(--mono);
  font-size: .91rem;
  overflow-wrap: anywhere;
}
.references { padding-left: 1.18rem; margin: .75rem 0 0; font-size: .92rem; }
.faq-list { margin-top: .77rem; }
.faq-list p { margin: -.2rem .5rem .9rem 1.8rem; }
.related { align-self: start; border-top: 2px solid var(--coating); padding-top: 1.04rem; }
.related h2 { font-size: 1.65rem; margin-bottom: .72rem; }
.related p { margin-bottom: .8rem; }
.related a { font-size: .94rem; }
.info-page { min-height: 61vh; }
.not-found { min-height: 60vh; padding-block: clamp(50px, 12vw, 130px); }
.not-found .eyebrow { margin-bottom: .68rem; }

@media (max-width: 1000px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 810px) {
  .wrap { width: min(100% - 40px, 680px); }
  .hero { grid-template-columns: 1fr; gap: 27px; padding-block: 40px 37px; }
  .hero h1 { font-size: clamp(2.75rem, 9.2vw, 4.75rem); }
  .hero-art { max-width: 585px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .results-jump { display: inline-block; }
  .guides-layout, .after-workspace { grid-template-columns: minmax(0, 1fr); }
  .after-workspace { padding-top: 31px; }
}
@media (max-width: 480px) {
  .wrap { width: calc(100% - 30px); }
  .header-row { min-height: 63px; gap: 6px; }
  .wordmark { font-size: 1.09rem; gap: 4px; }
  .wordmark img { width: 29px; height: 29px; }
  .site-header nav { gap: .48rem; }
  .site-header nav a { font-size: .81rem; }
  .site-footer .footer-row { align-items: flex-start; flex-direction: column; gap: .5rem; }
  .site-footer p { font-size: .87rem; }
  .hero-actions { gap: .7rem 1rem; }
  .hero-actions .text-link { font-size: .94rem; }
  .hero-intro { margin-top: 1rem; }
  .tools-section .section-heading { display: block; }
  .tools-section .section-heading p { margin-top: .5rem; }
  .tool-grid { gap: 8px; }
  .tool-card { padding: 12px; }
  .tool-card h3 { font-size: 1.14rem; }
  .tool-card p { font-size: .87rem; }
  .field:has(:is(#sensor, #film, #resolution, #levelUnit)) { grid-column: 1 / -1; }
  .metric { padding: .57rem .55rem; }
  .metric dt { font-size: .81rem; }
  .action-bar .button { padding-inline: .68rem; }
}
@media (max-width: 340px) {
  .header-row { flex-wrap: wrap; }
  .header-row .wordmark { margin-top: .5rem; }
  .site-header nav { padding-bottom: .15rem; }
  .tool-grid, .field-grid { grid-template-columns: minmax(0, 1fr); }
  .field:has(#mode), .field:has(#codec), .field:has(#sensor) { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  @page { margin: 14mm; }
  :root { --paper: #fff; }
  body { font-size: 10.5pt; print-color-adjust: exact; }
  .wrap { width: 100%; }
  .site-header, .site-footer, .breadcrumbs, .action-bar, .action-status, .share-panel, .input-panel,
  .after-workspace, .worked-jump, .skip, .local { display: none !important; }
  .calculator-page, .page-heading { padding-block: 0 10pt; }
  .page-heading h1 { font-size: 23pt; max-width: none; }
  .page-heading > p:not(.eyebrow) { font-size: 10pt; margin-top: 5pt; }
  .workspace, .result-panel { display: block; }
  .result-panel { border: 0; padding: 0; display: flex; flex-direction: column; }
  .print-inputs { display: block; order: -1; margin: 0 0 9pt; }
  .print-inputs h2 { font-size: 13pt; margin-bottom: 5pt; }
  .print-inputs dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3pt 8pt; }
  .print-inputs dt { font-size: 8pt; color: var(--muted); }
  .print-inputs dd { font-weight: 650; overflow-wrap: anywhere; }
  .results-heading { min-height: auto; margin-bottom: 5pt; }
  .results-heading h2 { font-size: 13pt; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric { break-inside: avoid; min-height: 0; padding: 4pt 5pt; }
  .metric dt, .metric small { font-size: 8pt; }
  .metric dd, .metric-lead dd { font-size: 11pt; }
  .result-figure { break-inside: avoid; margin-top: 8pt; }
  .result-figure svg { max-height: 160pt; }
  .result-figure figcaption, .result-notes { font-size: 8pt; }
}
