/* PixelCalc — light "graph paper" theme.
   Print-shop light surfaces with a faint grid, magenta primary (#b0246a) and
   cyan accent (#0e7490) — deliberately light to stand apart from the dark
   developer-tool palette of the other nxtolerance sites. */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --text: #1d2433;
  --text-dim: #5a6376;
  --border: #dde1ee;
  --pc-good: #0e7a4f;
  --pc-warn: #a15c00;
  --pc-grid: rgba(14, 116, 144, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --surface-2: #eef0f6;
    --text: #1d2433;
    --text-dim: #5a6376;
    --border: #dde1ee;
  }
}
html {
  color-scheme: light;
}

/* ---------- calculator shell ---------- */
.pc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 1.4rem 0 1.8rem;
  box-shadow: 0 10px 34px -24px rgba(29, 36, 51, 0.35);
  overflow: hidden;
}
@media (min-width: 54rem) {
  .prose .pc {
    width: min(60rem, calc(100vw - 2.5rem));
  }
}

/* ---------- mode tabs ---------- */
.pc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(var(--pc-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--pc-grid) 1px, transparent 1px),
    var(--surface-2);
  background-size: 12px 12px;
}
.pc-tabs button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.7rem 1rem;
  cursor: pointer;
  white-space: nowrap;
}
.pc-tabs button:hover {
  color: var(--text);
}
.pc-tabs button.on {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--surface);
}
.pc-tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ---------- shared resolution bar ---------- */
.pc-shared {
  padding: 0.85rem 1rem;
  border-bottom: 1px dashed var(--border);
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.pc-shared:not([hidden]) {
  display: flex;
}
.pc-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.pc-field > span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.pc-shared input[type="text"],
.pc-panel input[type="text"],
.pc-panel select,
.pc-shared select {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.4rem 0.55rem;
  box-sizing: border-box;
}
.pc-shared input[type="text"] {
  width: 6.5rem;
}
.pc-shared input:focus,
.pc-panel input:focus,
.pc-panel select:focus,
.pc-shared select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.pc-x {
  color: var(--text-dim);
  font-weight: 700;
  padding-bottom: 0.45rem;
}
.pc-btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.42rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.pc-btn:hover {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
}
.pc-shared .pc-field-grow {
  flex: 1 1 12rem;
  min-width: 9rem;
}
.pc-shared select {
  width: 100%;
  max-width: 100%;
}
/* 44px-class tap targets on the interactive controls (UX gate) */
.pc-tabs button,
.pc-btn,
.pc-shared select,
.pc-panel select {
  min-height: 44px;
}

/* ---------- panels ---------- */
.pc-panel {
  padding: 1rem;
}
.pc-panel > p:first-child {
  margin-top: 0;
}
.pc-big {
  font-size: 1.9rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0.1rem 0 0.3rem;
  line-height: 1.15;
}
.pc-sub {
  font-size: 0.92rem;
  color: var(--text-dim);
  margin: 0.2rem 0 0.5rem;
}
.pc-class {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.45;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.pc-class:empty {
  display: none;
}
.pc-dim {
  color: var(--text-dim);
  font-size: 0.85em;
}
.pc-note {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin: 0.5rem 0 0;
}
.pc-hint {
  font-size: 0.8rem;
  color: var(--pc-warn);
  margin: 0.35rem 0 0;
}
.pc-hint:empty {
  display: none;
}

/* ---------- print panel layout ---------- */
.pc-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 46rem) {
  .pc-split {
    grid-template-columns: 1fr 1fr;
  }
}
.pc-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.75rem 0.85rem;
}
/* Mode labels inside the print panel are UI captions, not document sections —
   styled <p>, not headings, so the page keeps a clean h1 → h2 outline. */
.pc-boxtitle {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 0.6rem;
}
.pc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.4rem 0 0.6rem;
}
.pc-chip {
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
}
.pc-chip:hover {
  border-color: var(--accent);
}
.pc-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pc-row .pc-field input[type="text"] {
  width: 5.5rem;
}
.pc-row .pc-field select {
  min-width: 4.5rem;
}
.pc-need {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0.55rem 0 0;
}

/* ---------- css-pixel panel ---------- */
.pc-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}
.pc-fact {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.55rem 0.7rem;
}
.pc-fact b {
  display: block;
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pc-fact span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.pc-convert {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  font-size: 0.95rem;
}
.pc-convert input[type="text"] {
  width: 6rem;
}
.pc-convert .pc-eq {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--primary);
}

/* ---------- tables ---------- */
.pc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 0.5rem;
}
.pc-table th,
.pc-table td {
  text-align: left;
  padding: 0.38rem 0.55rem;
  border-bottom: 1px solid var(--border);
}
.pc-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
}
.pc-table td {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pc-table tr:last-child td {
  border-bottom: none;
}

/* ---------- article polish ---------- */
.prose table {
  font-variant-numeric: tabular-nums;
}
.prose table code {
  white-space: nowrap;
}

@media (max-width: 480px) {
  .pc-panel {
    padding: 0.75rem;
  }
  .pc-tabs button {
    font-size: 0.76rem;
    padding: 0.65rem 0.7rem;
    min-height: 2.6rem;
  }
  .pc-shared input[type="text"],
  .pc-panel input[type="text"],
  .pc-panel select,
  .pc-shared select,
  .pc-btn,
  .pc-chip {
    min-height: 2.6rem;
  }
  .pc-big {
    font-size: 1.5rem;
  }
}
