/*
 * ICE Tools
 *
 * Design read: utility pages for someone who arrived from a search query and
 * wants an answer in under five seconds. Quiet instrument-panel language.
 * Low layout variance, near-zero motion, higher density than the college site.
 *
 * The section deliberately drops the college chrome (see ToolsLayout) but
 * keeps the --ice-* semantic tokens, so both themes and the Playwright theme
 * audit continue to hold. No new colour is introduced anywhere in this file.
 *
 * Structure of every tool page, top to bottom:
 *   1. a two-line head that names the tool and nothing else
 *   2. the working panel, above the fold on a phone
 *   3. short explanatory prose for the reader who wants to check the answer
 *   4. a strip of the other tools
 */

/* ── Shell ────────────────────────────────────────────────────────── */

body.page-tools {
  background: var(--ice-color-canvas);
  color: var(--ice-color-on-canvas);
}

.twrap {
  width: min(1140px, 100% - 2rem);
  margin-inline: auto;
}

.twrap--prose {
  width: min(72ch, 100% - 2rem);
}

/* ── Header bar ───────────────────────────────────────────────────── */

.tbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 2px solid var(--ice-color-border-strong);
  background: color-mix(in srgb, var(--ice-color-surface) 96%, transparent);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--ice-color-border-strong) 10%, transparent);
  backdrop-filter: blur(12px);
}

.tbar__inner {
  width: min(1600px, 100% - 2rem);
  min-height: 88px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
}

.tbar__brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-width: max-content;
  padding-right: .75rem;
  border-right: 2px solid var(--ice-color-border-strong);
  color: var(--ice-color-on-surface);
  text-decoration: none;
}

.tbar__brand img { flex: none; width: 36px; height: 36px; }

.tbar__wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: .28rem;
  line-height: 1;
}

.tbar__wordmark b,
.tbar__wordmark span {
  font-family: var(--ice-font-primary);
  font-size: 1.1rem;
  font-weight: 850;
  letter-spacing: -.025em;
}

.tbar__wordmark span { color: var(--ice-color-text-accent); }

/* Two tiers: the groups, then the tools inside the current group. Stacked in
   one column so the bar has a single height whatever the page shows. */
.tbar__tiers {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding-block: .35rem;
}

.tbar__nav {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .25rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.tbar__nav::-webkit-scrollbar { display: none; }

.tbar__link,
.tbar__theme {
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 58px;
  border: 2px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ice-color-text-muted);
  font: 750 1rem/1 var(--ice-font-primary);
  text-decoration: none;
  white-space: nowrap;
  transition: color .12s ease, background-color .12s ease, border-color .12s ease, transform .12s ease;
}

.tbar__link { padding-inline: .4rem; }

.tbar__link .tool-pictogram {
  width: 28px;
  height: 28px;
}

.tbar__link:hover,
.tbar__link[aria-current='page'] {
  border-color: var(--ice-color-border-strong);
  background: var(--ice-color-surface-field);
  color: var(--ice-color-on-surface);
}

/* ── The two tiers ────────────────────────────────────────────────
   The group rail is the quieter of the two: it is orientation, not the
   thing you came to click. Smaller type, no icons, and the current group
   marked with the same field treatment a current page gets — a visitor
   should be able to see which shelf they are standing at without reading
   the page. */
.tbar__nav--groups .tbar__link {
  min-height: 34px;
  font-size: .84rem;
  letter-spacing: .01em;
}

.tbar__group[aria-current='true'] {
  border-color: var(--ice-color-border-strong);
  background: var(--ice-color-surface-field);
  color: var(--ice-color-text-accent);
}

.tbar__nav--tools .tbar__link { min-height: 44px; }

.tbar__link:active,
.tbar__theme:active { transform: translateY(1px); }

.tbar__theme {
  width: 52px;
  padding: 0;
  cursor: pointer;
  border-color: var(--ice-color-border-strong);
  background: var(--ice-color-surface-field);
}

.tbar__theme:hover { background: var(--ice-color-surface-muted); color: var(--ice-color-on-surface); }
.tbar__theme-moon { display: none; }
[data-theme='dark'] .tbar__theme-sun { display: none; }
[data-theme='dark'] .tbar__theme-moon { display: block; }

@media (max-width: 980px) {
  .tbar__inner {
    grid-template-columns: auto 1fr auto;
    gap: .5rem;
    padding-block: .45rem;
  }
  /* Below 981px the nav drops to its own full-width row under the brand. That
     rule used to sit on `.tbar__nav` itself; the two-tier bar wraps both navs
     in `.tbar__tiers`, so the grid placement has to move up to the wrapper or
     the tiers stay boxed in the middle column and get ~135px on a phone. */
  .tbar__tiers {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-block: 0;
  }
  .tbar__nav {
    justify-content: flex-start;
    margin-inline: -.25rem;
    padding: .15rem .25rem 0;
  }
  .tbar__link,
  .tbar__theme { min-height: 40px; font-size: .72rem; }
  .tbar__theme { width: 40px; }
  .tbar__link .tool-pictogram { width: 20px; height: 20px; }

  /* A phone cannot afford two tiers, because the brand already owns a row of
     its own here — stacking them put the bar at 142px against the 107px the
     flat single row used, and pushed the calendar grid past the fold.

     So on a phone the two tiers become one row: All, the group you are in,
     then that group's tools. The other four group links are hidden rather
     than shrunk — they are orientation, and orientation you have to scroll
     sideways to read is not orientation. They stay one tap away through All,
     which is the same two-click reach the desktop bar promises.

     Scoped with `:has()` so it only applies where there IS a second tier. On
     the hub there is no tool tier and the full rail stays, because there the
     rail is a jump list into the shelves below it. */
  .tbar__tiers {
    flex-direction: row;
    align-items: center;
    gap: .25rem;
  }
  .tbar__tiers:has(.tbar__nav--tools) .tbar__nav--groups { flex: none; }
  .tbar__tiers:has(.tbar__nav--tools) .tbar__group:not([aria-current='true']) { display: none; }
  .tbar__nav--tools { flex: 1 1 auto; }

  .tbar__nav--groups .tbar__link { min-height: 40px; font-size: .72rem; }
  .tbar__nav--tools .tbar__link { min-height: 40px; }

  /* The brand row holds a 36px crest in a 40px row. Trimming the crest buys
     back a few pixels without touching either tap target. */
  .tbar__brand img { width: 30px; height: 30px; }
}

@media (max-width: 480px) {
  .tbar__inner { width: calc(100% - 1rem); }
  .tbar__brand { border-right: 0; }
  .tbar__link { padding-inline: .48rem; }
}
/* ── Tool head ────────────────────────────────────────────────────── */

/* No hero. The visitor came for the tool, so the tool starts within one
   screen on a phone: a name, one line of what it does, then the panel. */
.tool-head {
  padding-block: var(--ice-space-8) var(--ice-space-5);
}

.tool-head h1 {
  font-family: var(--ice-font-display);
  font-size: clamp(1.5rem, 1.28rem + 1vw, 2.125rem);
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -.012em;
  margin: 0;
  color: var(--ice-color-on-canvas);
}

.tool-head p {
  margin: var(--ice-space-2) 0 0;
  font-size: .9375rem;
  line-height: 1.55;
  color: var(--ice-color-text-muted);
  max-width: 68ch;
}

/* Who wrote these. An attribution line, so it takes the label role rather than
   a second lede — two paragraphs at the same weight read as one long deck and
   the eye skips both. Confirmed by the owner 2026-08-31; the printed
   prospectus makes the same claim, and the two must not diverge.

   `p.` is load-bearing. `.tool-head p` above is (0,1,1) and this rule was
   (0,1,0), so the first version inherited the lede's muted grey and 15px and
   only its font-weight survived — it read as a second deck, which is the one
   thing it must not do. `--ice-color-text-accent` is the measured accent step
   for text (docs/04 §5.1), not the raw terracotta, and it flips with the
   theme on its own. */
.tool-head p.tool-head__by {
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--ice-color-text-accent);
}

/* ── Panel ────────────────────────────────────────────────────────── */

.tool-panel {
  border: var(--ice-border);
  border-radius: var(--ice-radius-surface);
  background: var(--ice-color-surface);
  overflow: visible;
}

.tool-panel + .tool-panel {
  margin-top: var(--ice-space-6);
}

.tool-panel__head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ice-space-3);
  align-items: center;
  justify-content: space-between;
  padding: var(--ice-space-4) var(--ice-space-5);
  border-bottom: var(--ice-border);
}

.tool-panel__title {
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: 0;
  color: var(--ice-color-text-muted);
}

.tool-panel__body {
  padding: var(--ice-space-5);
}

@media (min-width: 768px) {
  .tool-panel__body { padding: var(--ice-space-6); }
}

/* ── Mode switch ──────────────────────────────────────────────────── */

.tool-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border: var(--ice-border);
  border-radius: var(--ice-radius-control);
  background: var(--ice-color-surface-field);
}

.tool-modes button {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: transparent;
  color: var(--ice-color-text-muted);
  font: inherit;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: var(--ice-space-2) var(--ice-space-4);
  border-radius: 3px;
  min-height: 36px;
  transition: background-color .15s ease, color .15s ease;
}

.tool-modes button:hover { color: var(--ice-color-on-surface); }

.tool-modes button[aria-pressed='true'] {
  background: var(--ice-color-surface);
  color: var(--ice-color-on-surface);
}

/* ── Fields ───────────────────────────────────────────────────────── */

.tool-fields {
  display: grid;
  gap: var(--ice-space-4);
}

@media (min-width: 620px) {
  .tool-fields--triple { grid-template-columns: repeat(3, 1fr); }
  .tool-fields--pair { grid-template-columns: repeat(2, 1fr); }
}

.tool-field {
  display: flex;
  flex-direction: column;
  gap: var(--ice-space-2);
  min-width: 0;
}

.tool-field > label,
.tool-fieldset > legend {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ice-color-text-muted);
}

.tool-field input,
.tool-field select,
.tool-field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ice-color-on-surface-field);
  background: var(--ice-color-surface-field);
  border: var(--ice-border);
  border-radius: var(--ice-radius-control);
  padding: var(--ice-space-3);
  min-height: 46px;
}

.tool-field input[inputmode='decimal'],
.tool-field input[inputmode='numeric'] { font-variant-numeric: tabular-nums; }

.tool-field input:focus-visible,
.tool-field select:focus-visible,
.tool-field textarea:focus-visible,
.tool-modes button:focus-visible,
.tool-action:focus-visible,
.tbar__theme:focus-visible,
.tbar__index:focus-visible,
.tool-card:focus-visible {
  outline: 2px solid var(--ice-color-text-action);
  outline-offset: 2px;
}

.tool-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.tool-fieldset + .tool-fieldset { margin-top: var(--ice-space-4); }

/* Two-line checkboxes: the claim on the first line, what it does to the
   arithmetic on the second, because neither is guessable from the other. */
.tool-checks {
  display: grid;
  gap: var(--ice-space-3);
  margin-top: var(--ice-space-4);
}

@media (min-width: 620px) {
  .tool-checks { grid-template-columns: repeat(2, 1fr); }
}

.tool-check {
  display: flex;
  align-items: flex-start;
  gap: var(--ice-space-3);
  padding: var(--ice-space-3);
  border: var(--ice-border);
  border-radius: var(--ice-radius-control);
  background: var(--ice-color-surface-field);
  cursor: pointer;
  min-width: 0;
}

.tool-check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: .1rem;
  accent-color: var(--ice-color-text-action);
}

.tool-check span {
  display: block;
  font-size: .875rem;
  line-height: 1.35;
  color: var(--ice-color-on-surface-field);
  min-width: 0;
}

.tool-check small {
  display: block;
  margin-top: .2rem;
  font-size: .78rem;
  line-height: 1.4;
  color: var(--ice-color-text-muted);
}

.tool-check:focus-within {
  outline: 2px solid var(--ice-color-text-action);
  outline-offset: 2px;
}

.tool-hint {
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--ice-color-text-muted);
  margin: 0;
}

/* ── Actions ──────────────────────────────────────────────────────── */

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ice-space-3);
  margin-top: var(--ice-space-5);
}

.tool-action {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: var(--ice-space-3) var(--ice-space-5);
  min-height: 44px;
  white-space: nowrap;
  border-radius: var(--ice-radius-control);
  border: var(--ice-border);
  background: var(--ice-color-surface);
  color: var(--ice-color-text-action);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.tool-action:hover { border-color: var(--ice-color-border-strong); }
.tool-action:active { transform: translateY(1px); }

.tool-action--primary {
  background: var(--ice-color-action);
  border-color: var(--ice-color-action);
  color: var(--ice-color-on-action);
}

.tool-action--primary:hover {
  background: var(--ice-color-action-hover);
  border-color: var(--ice-color-action-hover);
  color: var(--ice-color-on-action-hover);
}

/* ── Results ──────────────────────────────────────────────────────── */

.tool-result {
  margin-top: var(--ice-space-6);
  padding-top: var(--ice-space-5);
  border-top: var(--ice-border);
}

.tool-headline {
  font-family: var(--ice-font-display);
  font-size: clamp(1.625rem, 1.35rem + 1.2vw, 2.25rem);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin: 0;
  color: var(--ice-color-on-surface);
  overflow-wrap: anywhere;
}

.tool-headline__sub {
  display: block;
  font-family: var(--ice-font-primary);
  font-size: .875rem;
  line-height: 1.5;
  font-weight: 400;
  color: var(--ice-color-text-muted);
  margin-top: var(--ice-space-2);
}

.tool-readout {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--ice-space-5);
  font-variant-numeric: tabular-nums;
}

.tool-readout caption {
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ice-color-text-muted);
  padding-bottom: var(--ice-space-3);
}

.tool-readout th,
.tool-readout td {
  text-align: left;
  padding: var(--ice-space-3) var(--ice-space-1);
  border-bottom: var(--ice-border);
  font-size: .9375rem;
}

.tool-readout th {
  font-weight: 400;
  color: var(--ice-color-text-muted);
  width: 48%;
}

.tool-readout td {
  color: var(--ice-color-on-surface);
  font-weight: 600;
  text-align: right;
}

.tool-readout tr:last-child th,
.tool-readout tr:last-child td { border-bottom: 0; }

/* Grouped readouts, for converters with many target units. */

.tool-units {
  display: grid;
  gap: var(--ice-space-5);
  margin-top: var(--ice-space-5);
}

@media (min-width: 820px) {
  .tool-units { grid-template-columns: repeat(3, 1fr); }
  .tool-units--pair { grid-template-columns: repeat(2, 1fr); }
}

.tool-unitgroup {
  border: var(--ice-border);
  border-radius: var(--ice-radius-surface);
  padding: var(--ice-space-4);
  background: var(--ice-color-surface-muted);
  min-width: 0;
}

.tool-unitgroup h3 {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ice-color-text-accent);
  margin: 0 0 var(--ice-space-3);
}

.tool-unitgroup .tool-readout { margin-top: 0; }
.tool-unitgroup .tool-readout td,
.tool-unitgroup .tool-readout th { color: var(--ice-color-on-surface-muted); }

/* Scrollable schedule, for the amortisation table. */

.tool-scroll {
  margin-top: var(--ice-space-5);
  max-height: 340px;
  overflow: auto;
  border: var(--ice-border);
  border-radius: var(--ice-radius-surface);
}

.tool-scroll .tool-readout { margin-top: 0; }

.tool-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--ice-color-surface-muted);
  color: var(--ice-color-on-surface-muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: right;
  width: auto;
}

.tool-scroll thead th:first-child { text-align: left; }
.tool-scroll td,
.tool-scroll th { padding-inline: var(--ice-space-3); }
.tool-scroll tbody th { width: auto; text-align: left; }

/* ── Text pair ────────────────────────────────────────────────────── */

.tool-textpair {
  display: grid;
  gap: var(--ice-space-5);
}

@media (min-width: 820px) {
  .tool-textpair { grid-template-columns: 1fr 1fr; }
}

.tool-textpair textarea {
  min-height: 200px;
  resize: vertical;
  line-height: 1.6;
}

/* Devanagari stacks matras vertically and cramps at the body leading. */
.tool-textpair textarea[data-script='devanagari'] { line-height: 1.9; }

.tool-status {
  font-size: .8125rem;
  color: var(--ice-color-text-accent);
  margin: var(--ice-space-3) 0 0;
  min-height: 1.4em;
}

.tool-error {
  color: var(--ice-color-text-action);
  font-size: .8125rem;
  margin: var(--ice-space-3) 0 0;
  min-height: 1.4em;
}

/* ── Caveats ──────────────────────────────────────────────────────── */

/* Reuses the site's existing .source-note callout; this only adds rhythm
   and the paragraph reset .source-note does not need elsewhere. */
.tool-note {
  margin-top: var(--ice-space-5);
  line-height: 1.55;
}

.tool-note p { margin: 0; }
.tool-note p + p { margin-top: var(--ice-space-2); }

/* The freshness contract, for the one tool that carries a published number
   rather than a definition. It sits directly under the headline figure, not in
   the small print, because which year produced the number is part of the
   answer. It wears the same top rule kaamko-grid.css gives .tool-note inside a
   panel rather than the site-wide .source-note side accent, because this
   section squares those off on purpose. A rule set that is not yet gazetted
   colours the rule and the label instead of thickening them. */
.tool-provenance {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--ice-space-2) var(--ice-space-3);
  margin-top: var(--ice-space-4);
  padding: var(--ice-space-3);
  border: 0;
  border-top: 2px solid var(--ice-color-on-surface);
  border-radius: 0;
  background: var(--ice-color-surface-field);
}

.tool-provenance b {
  flex: none;
  font-size: .72rem;
  letter-spacing: .055em;
  text-transform: uppercase;
  color: var(--ice-color-text-muted);
}

.tool-provenance span {
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--ice-color-on-surface-muted);
  min-width: 0;
}

.tool-provenance[data-status='provisional'] { border-top-color: var(--ice-color-text-action); }
.tool-provenance[data-status='provisional'] b { color: var(--ice-color-text-action); }

/* The social security band is charged under a different act from the bands
   above it, so it is marked rather than left to look like a first tax rate. */
.tool-readout .is-sst { color: var(--ice-color-text-muted); }

/* ── Explanatory prose ────────────────────────────────────────────── */

.tool-explainer {
  padding-block: var(--ice-space-12) var(--ice-space-8);
}

.tool-explainer h2 {
  font-family: var(--ice-font-display);
  font-size: clamp(1.375rem, 1.2rem + .8vw, 1.75rem);
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -.01em;
  margin: 0 0 var(--ice-space-4);
}

.tool-explainer h3 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  margin: var(--ice-space-8) 0 var(--ice-space-3);
}

.tool-explainer p,
.tool-explainer li {
  font-size: .9375rem;
  line-height: 1.65;
  color: var(--ice-color-on-canvas);
}

.tool-explainer p { margin: 0 0 var(--ice-space-4); }

.tool-explainer ul,
.tool-explainer ol {
  margin: 0 0 var(--ice-space-4);
  padding-left: var(--ice-space-5);
}

.tool-explainer li + li { margin-top: var(--ice-space-2); }

.tool-explainer code {
  font-family: var(--ice-font-primary, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif);
  font-size: .9em;
  background: var(--ice-color-surface-field);
  border-radius: 3px;
  padding: .1em .35em;
}

/* Two-column key/value facts, instead of a long hairline-per-row list. */
.tool-facts {
  display: grid;
  gap: var(--ice-space-3);
  margin: 0 0 var(--ice-space-5);
  padding: 0;
  list-style: none;
}

@media (min-width: 560px) {
  .tool-facts { grid-template-columns: repeat(2, 1fr); }
}

.tool-facts li {
  margin: 0;
  padding: var(--ice-space-3) var(--ice-space-4);
  border-radius: var(--ice-radius-control);
  background: var(--ice-color-surface-muted);
  color: var(--ice-color-on-surface-muted);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

.tool-facts b {
  display: block;
  font-weight: 700;
  color: var(--ice-color-on-surface-muted);
}

/* ── Tool index ───────────────────────────────────────────────────── */

/* One line colour, quieter than the structural navy, for the 32 hub cards.
 *
 * The hub was drawing 41 identical edges — 2px `border-strong` on the frame,
 * on the rule between every shelf, on the table wrapper, and on all 32 cards.
 * Same width, same ink, same radius, so nothing on the page was emphasised and
 * the grid read as graph paper. The width stays 2px: the ruled box is the
 * section's whole aesthetic, and `tools-visual.spec.mjs` holds it. What moves
 * is the ink, so the frame and the shelf rules outrank the things inside them.
 *
 * Light only. Dark never had the problem this fixes — the graphite ramp
 * already collapses `border` and `border-strong` onto one low-contrast line —
 * and it cannot afford the fix either: on the dark theme a card's fill and the
 * frame's fill are the SAME #2B2D31, so the border is the only thing that
 * makes a card a card. Quieting it there dissolves the grid. The dark value is
 * therefore the structural line, unchanged, and stated rather than inherited
 * so the next person does not read the omission as an oversight. */
.tools-index {
  --tools-card-line: color-mix(in srgb, var(--ice-color-border-strong) 30%, var(--ice-color-surface));
}

html[data-theme="dark"] .tools-index {
  --tools-card-line: var(--ice-color-border-strong);
}

.tools-index { flex: 1; padding-block: 1.25rem 2rem; }

.tools-index__frame {
  width: min(1180px, 100% - 2rem);
  border: 2px solid var(--ice-color-border-strong);
  border-radius: 4px;
  background: var(--ice-color-surface);
  box-shadow: 4px 4px 0 color-mix(in srgb, var(--ice-color-border-strong) 18%, transparent);
}

.tools-index .tool-head { padding: 1.25rem; border-bottom: 2px solid var(--ice-color-border-strong); }
.tools-index .tool-head h1 { max-width: none; }
.tools-index .tool-head p { max-width: 58ch; }
.tool-directory,
.tool-appendix { padding: 1rem; }

/* The hub is five shelves now, not one grid. Each carries its own head, and a
   rule above it separates the shelves without adding a box — the frame around
   the whole directory is already doing that job, and nesting a second border
   inside it reads as a panel rather than a section. The first shelf sits
   straight under the page head, which is its own rule, so it skips this.

   `.tool-appendix` needs no `+` pair: the two appendix blocks are always the
   last things in the frame, so each of them has a shelf or an appendix above it
   and always wants the rule.

   The name is `tool-appendix` and NOT `tool-explainer` because
   `.tool-explainer` is already the prose section on ~30 individual tool pages,
   with its own type and rhythm here and in `kaamko-grid.css`. Naming the hub's
   two blocks after it put 1rem of padding and a 2px navy rule on every one of
   those, on pages the hub work never touched. Caught on 2026-08-28 by a
   specimen run, not by reading. */
.tool-directory + .tool-directory,
.tool-appendix {
  border-top: 2px solid var(--ice-color-border-strong);
}

.tool-directory__head,
.tool-appendix__head {
  margin-bottom: .85rem;
  /* `scroll-margin` and not a spacer: these ids are the header rail's anchor
     targets, and the bar is sticky, so a bare jump lands the heading
     underneath it. */
  scroll-margin-top: 110px;
}

/* Fluid, and not the flat 1.15rem it was until 2026-08-28. At 1.15rem a shelf
   heading measured 18.4px against 18px body text and a 17.3px card title, so
   the six labels that carry the whole structure of the page read as body copy
   and the desktop scale went 45px → 18px → 18px with nothing in between. This
   is the missing step: ~19px on a phone, 27px on a desktop.

   The floor is set by the h1 and not by the body text. `.tool-head h1` is
   itself only ~24.8px at 390px, so a heading much above 1.2rem there crowds
   the page title instead of ranking under it; the curve keeps the h2 near
   0.6–0.8x of whatever the h1 is at that width. On a phone the 2px rule above
   each shelf does most of the separating, and the size does it on a desktop. */
.tool-directory__head h2,
.tool-appendix__head h2 {
  margin: 0;
  font: 850 clamp(1.2rem, 1rem + .78vw, 1.7rem)/1.14 var(--ice-font-primary);
  letter-spacing: -.02em;
  color: var(--ice-color-on-surface);
}

.tool-directory__head p,
.tool-appendix__head p {
  margin: .3rem 0 0;
  max-width: 62ch;
  font-size: .92rem;
  color: var(--ice-color-text-muted);
}

.tool-directory[id] { scroll-margin-top: 110px; }

.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tool-card {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 76px;
  height: 100%;
  padding: .75rem;
  border: 2px solid var(--ice-color-border-strong);
  border-radius: 4px;
  background: var(--ice-color-surface);
  color: inherit;
  text-decoration: none;
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--ice-color-border-strong) 14%, transparent);
  transition: color .12s ease, background-color .12s ease, box-shadow .12s ease, transform .12s ease;
}

.tool-card:hover {
  background: var(--ice-color-surface-muted);
  box-shadow: 4px 4px 0 color-mix(in srgb, var(--ice-color-border-strong) 20%, transparent);
  transform: translate(-2px, -2px);
}

.tool-card:active {
  box-shadow: 1px 1px 0 color-mix(in srgb, var(--ice-color-border-strong) 20%, transparent);
  transform: translate(1px, 1px);
}

.tool-card__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--ice-color-border-strong);
  border-radius: 3px;
  background: var(--ice-color-surface-field);
  color: var(--ice-color-text-accent);
}

.tool-card__text { min-width: 0; }

.tool-card__text small {
  display: block;
  margin-bottom: .2rem;
  color: var(--ice-color-text-muted);
  font: 700 .64rem/1.1 var(--ice-font-primary, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.tool-card__text b { display: block; color: var(--ice-color-on-surface); font-size: .9rem; font-weight: 800; line-height: 1.25; }
.tool-card__text span { display: block; margin-top: .18rem; color: var(--ice-color-text-muted); font-size: .77rem; line-height: 1.35; }

.tool-card__arrow {
  flex: none;
  display: grid;
  place-items: center;
  margin-left: auto;
  color: var(--ice-color-text-muted);
  transition: transform .12s ease;
}

.tool-card:hover .tool-card__arrow { transform: translateX(2px); }

@media (min-width: 620px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.tool-textpair[hidden],
.tool-direct-pad[hidden] {
  display: none;
}

.tool-direct-pad textarea {
  min-height: 15rem;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.9;
}

.tool-pictogram {
  display: block;
  flex: 0 0 auto;
  width: var(--tool-icon-size, 24px);
  height: var(--tool-icon-size, 24px);
  background-image: url('/media/tools/kaamko-icon-sprite-v2.webp');
  background-repeat: no-repeat;
  background-position: var(--tool-icon-x) var(--tool-icon-y);
  background-size: 500% 200%;
}

@media (min-width: 1000px) {
  .tool-grid--index { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tool-related .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .tools-index { padding-block: .5rem 1rem; }
  .tools-index__frame { width: calc(100% - 1rem); box-shadow: 2px 2px 0 color-mix(in srgb, var(--ice-color-border-strong) 18%, transparent); }
  .tools-index .tool-head { padding: 1rem; }
  .tool-directory,
  .tool-appendix { padding: .65rem; }
  .tool-grid { gap: .6rem; }
}

/* The hub is a static launchpad, not a directory list. Always-visible links in
   a fixed grid create a stable spatial map without filters or client JS. */
.tools-index .tool-grid--index {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
}

.tools-index .tool-grid--index > li { min-width: 0; }

/* These cards were square on mobile, and the square was the bug.
 *
 * `aspect-ratio: 1` fixes the height to the column width — about 164px on a
 * 375px phone. That held ten short names. It does not hold "Nepal gratuity
 * calculator" or "GPA calculator": a title that wraps to two lines pushes the
 * blurb straight through the bottom border, and because the text row is
 * `align-self: end` the overflow is *outside* the card rather than clipped
 * inside it. Reported from a phone on 2026-08-19 with the text visibly sitting
 * on top of the next card.
 *
 * Height now follows the content, with a floor so a short card does not look
 * broken beside a tall one. Grid already equalises the cards within a row, so
 * the map stays regular — it is just no longer square, which was never the
 * thing worth protecting. `tools-visual.spec.mjs` asserts the replacement:
 * no card overflows its own box, at every contract width. */
.tools-index .tool-grid--index .tool-card {
  aspect-ratio: auto;
  min-height: 152px;
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: start;
  align-items: start;
  gap: .65rem;
  padding: .85rem;
  border-color: var(--tools-card-line);
  border-radius: 4px;
  box-shadow: none;
  transition: color .12s ease, background-color .12s ease, border-color .12s ease;
}

.tools-index .tool-grid--index .tool-card:hover {
  border-color: var(--ice-color-text-accent);
  background: var(--ice-color-surface-muted);
  box-shadow: none;
  transform: none;
}

.tools-index .tool-grid--index .tool-card:active {
  background: var(--ice-color-surface-field);
  box-shadow: none;
  transform: none;
}

.tools-index .tool-grid--index .tool-card__icon {
  width: 64px;
  height: 64px;
  border-width: 0;
  border-radius: 4px;
  background: color-mix(in srgb, var(--ice-color-text-accent) 10%, var(--ice-color-surface-field));
}

.tools-index .tool-grid--index .tool-card__text { align-self: end; }

.tools-index .tool-grid--index .tool-card__text b {
  font-size: clamp(1rem, 3.8vw, 1.08rem);
  line-height: 1.2;
  text-wrap: balance;
}

.tools-index .tool-grid--index .tool-card__text span {
  display: -webkit-box;
  margin-top: .35rem;
  overflow: hidden;
  font-size: .875rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (min-width: 620px) and (max-width: 999px) {
  .tools-index .tool-grid--index { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Four, not five. At sixteen tools a five-column grid leaves one card alone on
   a fourth row, which reads as an unfinished layout rather than a launchpad;
   four divides exactly and gives each blurb the width to sit on one line. */
@media (min-width: 1000px) {
  .tools-index .tool-grid--index { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .tools-index .tool-grid--index .tool-card {
    aspect-ratio: auto;
    min-height: 190px;
  }

  .tools-index .tool-grid--index .tool-card__icon {
    width: 88px;
    height: 88px;
  }

  .tools-index .tool-grid--index .tool-card__icon .tool-pictogram {
    width: 76px;
    height: 76px;
  }
}
/* ── Related strip ────────────────────────────────────────────────── */

.tool-related {
  padding-block: var(--ice-space-6) var(--ice-space-12);
  border-top: var(--ice-border);
}

.tool-related h2 {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ice-color-text-muted);
  margin: 0 0 var(--ice-space-4);
}

/* ── Footer ───────────────────────────────────────────────────────── */

.tfoot { border-top: 2px solid var(--ice-color-border-strong); background: var(--ice-color-surface); }

.tfoot__inner {
  width: min(1280px, 100% - 2rem);
  min-height: 72px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: 1rem 2rem;
  padding-block: .75rem;
}

.tfoot__brand { display: flex; align-items: center; gap: .55rem; }
.tfoot__brand img { flex: none; }
.tfoot__brand p { margin: 0; font-size: .76rem; line-height: 1.25; }
.tfoot__brand b { display: block; color: var(--ice-color-on-surface); font-size: .84rem; }
.tfoot__brand span, .tfoot__note, .tfoot__meta { color: var(--ice-color-text-muted); }

.tfoot__note {
  margin: 0;
  padding-left: 1rem;
  border-left: 2px solid var(--ice-color-border-strong);
  font-size: .75rem;
}

.tfoot__meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem 1rem; margin: 0; font-size: .72rem; }
.tfoot__meta a { color: inherit; }
.tfoot__meta a:hover { color: var(--ice-color-on-surface); }

@media (max-width: 760px) {
  .tfoot__inner { grid-template-columns: 1fr auto; gap: .65rem 1rem; }
  .tfoot__note {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: .65rem 0 0;
    border-top: 2px solid var(--ice-color-border-strong);
    border-left: 0;
  }
  .tfoot__meta span { display: none; }
}

@media (max-width: 480px) { .tfoot__inner { width: calc(100% - 1rem); } }
/* ── Motion ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .tool-card,
  .tool-modes button,
  .tool-action,
  .tbar__theme,
  .tbar__index {
    transition: none;
  }

  .tool-action:active { transform: none; }
}
/* Compact utility redesign: 2026-08 */
body.page-tools {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--ice-color-canvas);
}

.page-tools > main { flex: 1 0 auto; }

.page-tools button,
.page-tools a,
.page-tools input,
.page-tools select,
.page-tools textarea {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.twrap { width: min(1020px, 100% - 2rem); }
.twrap--prose { width: min(68ch, 100% - 2rem); }

.tool-head { padding-block: 1.35rem .85rem; }

.tool-head h1 {
  max-width: none;
  font-family: var(--ice-font-primary);
  font-size: clamp(1.55rem, 1.35rem + .8vw, 2rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.tool-head p {
  max-width: 62ch;
  margin-top: .4rem;
  font-size: .9rem;
  line-height: 1.45;
  text-wrap: pretty;
}
.tool-panel {
  border-color: var(--ice-color-border-strong);
  box-shadow: 0 14px 40px color-mix(in srgb, var(--ice-color-on-canvas) 7%, transparent);
}

.tool-panel__head {
  min-height: 52px;
  padding: .65rem .9rem;
  background: var(--ice-color-surface-muted);
}

.tool-panel__title {
  letter-spacing: .06em;
}

.tool-panel__body {
  padding: 1rem;
}

.tool-result {
  margin-top: 1rem;
  padding-top: 1rem;
}

.tool-actions {
  margin-top: 1rem;
  gap: .6rem;
}

.tool-action {
  min-height: 40px;
  padding: .6rem .9rem;
}

.tool-field {
  gap: .4rem;
}

.tool-field > label,
.tool-fieldset > legend {
  letter-spacing: .035em;
  text-transform: none;
  font-size: .77rem;
}

.tool-field input,
.tool-field select,
.tool-field textarea {
  min-height: 44px;
  padding: .65rem .75rem;
  border-color: var(--ice-color-border-strong);
  background-color: var(--ice-color-surface-field);
  color: var(--ice-color-on-surface-field);
}

.tool-converter {
  display: grid;
  align-items: end;
  gap: .75rem;
}

.tool-converter--land {
  grid-template-columns: minmax(0, 1fr) minmax(145px, .72fr) 44px minmax(0, 1fr) minmax(145px, .72fr);
  grid-template-areas: "fromValue fromUnit swap toValue toUnit";
}

.tool-converter--unit {
  grid-template-columns: minmax(0, 1fr) minmax(145px, .72fr) 44px minmax(0, 1fr) minmax(145px, .72fr);
  grid-template-areas:
    "category category category category category"
    "fromValue fromUnit swap toValue toUnit";
}

.tool-converter__category { grid-area: category; max-width: 230px; }
.tool-converter__from-value { grid-area: fromValue; }
.tool-converter__from-unit { grid-area: fromUnit; }
.tool-converter__to-value { grid-area: toValue; }
.tool-converter__to-unit { grid-area: toUnit; }

.tool-swap {
  grid-area: swap;
  align-self: end;
  appearance: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: var(--ice-border);
  border-color: var(--ice-color-border-strong);
  border-radius: var(--ice-radius-control);
  background: var(--ice-color-surface-field);
  color: var(--ice-color-text-action);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.tool-swap svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-swap span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.tool-swap:hover {
  background: var(--ice-color-action);
  color: var(--ice-color-on-action);
}

.tool-swap:active {
  transform: scale(.96);
}

.tool-swap:focus-visible,
.tool-keyboard:focus-within {
  outline: 2px solid var(--ice-color-text-action);
  outline-offset: 2px;
}

.tool-units {
  gap: .75rem;
  margin-top: 1rem;
}

.tool-unitgroup {
  padding: .75rem;
  border-color: var(--ice-color-border-strong);
}

.tool-readout {
  margin-top: .75rem;
}

.tool-readout th,
.tool-readout td {
  padding-block: .6rem;
}

.tool-textpair {
  gap: .75rem;
}

.tool-textpair textarea {
  min-height: 230px;
}

.tool-keyboard {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  padding: .65rem .7rem;
  border: var(--ice-border);
  border-radius: var(--ice-radius-control);
  background: var(--ice-color-surface-muted);
  color: var(--ice-color-on-surface-muted);
  cursor: pointer;
}

.tool-keyboard[hidden] {
  display: none;
}

.tool-keyboard input {
  width: 1rem;
  height: 1rem;
  min-height: 0;
  margin: .1rem 0 0;
  padding: 0;
  flex: none;
}

.tool-keyboard span,
.tool-keyboard small {
  display: block;
}

.tool-keyboard b {
  font-size: .8rem;
}

.tool-keyboard small {
  margin-top: .15rem;
  color: var(--ice-color-text-muted);
  font-size: .75rem;
  line-height: 1.35;
}

.tool-preeti-preview {
  min-height: 96px;
  padding: .75rem;
  border: var(--ice-border);
  border-color: var(--ice-color-border-strong);
  border-radius: var(--ice-radius-control);
  background: var(--ice-color-surface-muted);
}

.tool-preeti-preview[hidden] {
  display: none;
}

.tool-preeti-preview > span {
  display: block;
  color: var(--ice-color-text-muted);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.tool-preeti-preview p {
  margin: .45rem 0 0;
  color: var(--ice-color-on-surface-muted);
  font-family: "Noto Sans Devanagari", "Nirmala UI", Mangal, sans-serif;
  font-size: 1.3rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.tool-explainer {
  padding-block: 2.4rem 1.8rem;
}

.tool-explainer h3 {
  margin-top: 1.8rem;
}

.tool-related {
  padding-block: 1.25rem 2.5rem;
}

@media (max-width: 760px) {


  .tool-converter--land,
  .tool-converter--unit {
    grid-template-columns: minmax(0, 1fr) minmax(120px, .75fr);
    grid-template-areas:
      "category category"
      "fromValue fromUnit"
      "swap swap"
      "toValue toUnit";
  }

  .tool-converter--land {
    grid-template-areas:
      "fromValue fromUnit"
      "swap swap"
      "toValue toUnit";
  }

  .tool-converter__category {
    max-width: none;
  }

  .tool-swap {
    justify-self: center;
    transform: rotate(90deg);
  }

  .tool-swap:active {
    transform: rotate(90deg) scale(.96);
  }

  .tool-textpair textarea {
    min-height: 180px;
  }
}

@media (max-width: 480px) {
  .twrap,
  .twrap--prose {
    width: min(100% - 1rem, 1020px);
  }
.tool-panel__head {
    align-items: flex-start;
  }

  .tool-modes {
    width: 100%;
  }

  .tool-modes button {
    flex: 1;
    padding-inline: .5rem;
  }

  .tool-converter--land,
  .tool-converter--unit {
    grid-template-columns: 1fr;
    grid-template-areas:
      "category"
      "fromValue"
      "fromUnit"
      "swap"
      "toValue"
      "toUnit";
  }

  .tool-converter--land {
    grid-template-areas:
      "fromValue"
      "fromUnit"
      "swap"
      "toValue"
      "toUnit";
  }

  .tool-swap {
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tool-swap,
  .tool-card {
    transition: none;
  }

  .tool-card:hover,
  .tool-swap:active {
    transform: none;
  }
}
@media (min-width: 760px) {
  [data-role="table"] {
    display: block;
  }

  [data-role="table"] caption {
    display: block;
    width: 100%;
  }

  [data-role="table"] tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1.5rem;
  }

  [data-role="table"] tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
  }

  [data-role="table"] th {
    width: auto;
    min-width: 0;
  }
}

/* Tool-shell invariants: keep broad college section rules out of utility UI. */
.page-tools .tool-directory,
.page-tools .tool-related,
.page-tools .tool-group { box-sizing: border-box; }

.page-tools .tool-panel,
.page-tools input,
.page-tools select,
.page-tools textarea { border-width: 2px; }

@media (prefers-reduced-motion: reduce) {
  .tbar__link,
  .tbar__theme,
  .tool-card,
  .tool-card__arrow { transition: none; }
  .tool-card:hover,
  .tool-card:active,
  .tool-card:hover .tool-card__arrow { transform: none; }
}
/* Four distinct language workflows */
.tool-mode-note {
  display: flex;
  align-items: baseline;
  gap: .55rem 1rem;
  margin-bottom: .85rem;
  padding: .65rem .75rem;
  border: 2px solid var(--ice-color-border-strong);
  background: var(--ice-color-surface-muted);
  color: var(--ice-color-on-surface-muted);
}
.tool-mode-note b { flex: none; font-size: .72rem; letter-spacing: .055em; text-transform: uppercase; }
.tool-mode-note span { color: var(--ice-color-text-muted); font-size: .78rem; line-height: 1.4; }
.tool-mode-note code { color: var(--ice-color-on-surface-muted); }
.tool-smart-suggestions {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: -.15rem 0 .85rem;
  padding: .6rem .75rem;
  border: 1px solid var(--ice-color-border);
  background: var(--ice-color-surface-field);
  cursor: pointer;
}
.tool-smart-suggestions[hidden] { display: none; }
.tool-smart-suggestions input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--ice-color-accent); }
.tool-smart-suggestions span { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .55rem; }
.tool-smart-suggestions b { font-size: .78rem; }
.tool-smart-suggestions small { color: var(--ice-color-text-muted); font-size: .72rem; }
.tool-modes--three button { min-width: 8.75rem; }

.tool-modes--four {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
}

.tool-modes--four button { min-width: 0; }
.tool-modes--four button + button { border-left: 2px solid var(--ice-color-border-strong); }

.tool-field textarea[data-script='preeti'] {
  font-family: Preeti, "Preeti Normal", "Nirmala UI", monospace;
  font-size: 1.2rem;
}

.tool-readable-preview {
  min-height: 84px;
  padding: .65rem .75rem;
  border: 2px solid var(--ice-color-border-strong);
  background: var(--ice-color-surface-muted);
}
.tool-readable-preview[hidden],
.tool-suggestions[hidden] { display: none; }
.tool-readable-preview > span,
.tool-suggestions > span {
  display: block;
  color: var(--ice-color-text-muted);
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.tool-readable-preview p {
  margin: .35rem 0 0;
  color: var(--ice-color-on-surface-muted);
  font-family: "Noto Sans Devanagari", "Nirmala UI", Mangal, sans-serif;
  font-size: 1.35rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.tool-suggestions {
  position: absolute;
  z-index: 8;
  top: 4.75rem;
  left: .75rem;
  width: min(18rem, calc(100% - 1.5rem));
  padding: .35rem;
  border: 2px solid var(--ice-color-border-strong);
  background: var(--ice-color-surface-muted);
  box-shadow: 5px 5px 0 color-mix(in srgb, var(--ice-color-border-strong) 22%, transparent);
}
.tool-suggestions [data-role='suggestion-list'] {
  display: grid;
  gap: 0;
}
.tool-suggestions button {
  display: grid;
  grid-template-columns: 1.35rem 1fr auto;
  align-items: center;
  min-height: 42px;
  padding: .35rem .55rem;
  border: 0;
  border-bottom: 1px solid var(--ice-color-border);
  background: transparent;
  color: var(--ice-color-on-surface-field);
  font: 1rem/1.2 "Noto Sans Devanagari", "Nirmala UI", Mangal, sans-serif;
  text-align: left;
  cursor: pointer;
}
.tool-suggestions button:last-child { border-bottom: 0; }
.tool-suggestions button[aria-selected='true'] { background: var(--ice-color-surface-field); }
.tool-suggestions button > span { color: var(--ice-color-text-muted); font: 700 .75rem/1 var(--ice-font-primary); }
.tool-suggestions button b { font-size: 1.12rem; }
.tool-suggestions kbd {
  padding: .18rem .35rem;
  border-radius: 3px;
  background: color-mix(in srgb, var(--ice-color-accent) 12%, transparent);
  color: var(--ice-color-accent);
  font: 700 .64rem/1 var(--ice-font-primary);
}
.tool-suggestions > p {
  margin: .3rem .4rem .15rem;
  color: var(--ice-color-text-muted);
  font-size: .68rem;
}
.tool-direct-pad .tool-field,
.tool-textpair .tool-field { position: relative; }
.tool-suggestions--source { top: 4.75rem; }

@media (max-width: 760px) {
  .tool-mode-note { display: block; }
  .tool-mode-note span { display: block; margin-top: .25rem; }
  .tool-modes--three button,
  .tool-modes--four button { min-width: 0; }
}
@media (max-width: 480px) {
  .tool-modes--three,
  .tool-modes--four { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
}
.page-tools .tool-panel { padding: 0; }


/* Dual calendar: dense, legible, and equally useful with either date system
   leading. The grid is data, so hierarchy comes from type and borders rather
   than decorative colour. */
.calendar-page-head { display: flex; align-items: end; justify-content: space-between; gap: var(--ice-space-5); }
.calendar-page-head .tool-action { flex: none; text-decoration: none; }
.dual-calendar { overflow: hidden; }
.calendar-command { display: flex; align-items: center; justify-content: space-between; gap: var(--ice-space-5); padding: var(--ice-space-5); border-bottom: var(--ice-border); }
.calendar-titleblock { min-width: 0; }
.calendar-eyebrow,
.calendar-pickers label > span,
.calendar-copy > label,
.calendar-selected > span { display: block; color: var(--ice-color-text-muted); font-size: .68rem; font-weight: 800; letter-spacing: .09em; line-height: 1.2; text-transform: uppercase; }
.calendar-titleblock h2 { margin: .2rem 0 0; color: var(--ice-color-on-surface); font-family: var(--ice-font-display); font-size: clamp(1.45rem, 1.15rem + 1.2vw, 2rem); font-weight: 400; line-height: 1.05; }
.calendar-titleblock p { margin: .35rem 0 0; color: var(--ice-color-text-muted); font-size: .78rem; line-height: 1.4; }
.calendar-controls { display: flex; align-items: center; gap: var(--ice-space-3); }
/* Two buttons, one row, whatever language they are written in. The shared
   .tool-modes wraps by default, and "वि.सं. पहिले / ई.सं. पहिले" is wide
   enough to break a segmented control into a stack of two full-width bars. */
.calendar-controls .tool-modes { flex-wrap: nowrap; }
.calendar-controls .tool-modes button { flex: 1 1 0; min-width: 0; white-space: nowrap; }
.calendar-stepper { display: flex; }
.calendar-stepper button { min-width: 40px; min-height: 40px; margin-left: -2px; border: var(--ice-border); border-radius: 0; background: var(--ice-color-surface-field); color: var(--ice-color-on-surface-field); cursor: pointer; font: 750 .78rem/1 var(--ice-font-primary); }
.calendar-stepper button:first-child { margin-left: 0; border-radius: var(--ice-radius-control) 0 0 var(--ice-radius-control); }
.calendar-stepper button:last-child { border-radius: 0 var(--ice-radius-control) var(--ice-radius-control) 0; }
.calendar-stepper button:hover { background: var(--ice-color-surface-muted); }
.calendar-pickers { display: grid; grid-template-columns: minmax(110px, 150px) minmax(150px, 200px) minmax(150px, 200px) 1fr; align-items: end; gap: var(--ice-space-3); padding: var(--ice-space-3) var(--ice-space-5); background: var(--ice-color-surface-muted); border-bottom: var(--ice-border); }
.calendar-pickers label { display: grid; gap: .3rem; }
.calendar-pickers select,
.calendar-copy select { min-height: 40px; width: 100%; border: var(--ice-border); border-radius: var(--ice-radius-control); background: var(--ice-color-surface-field); color: var(--ice-color-on-surface-field); padding: .5rem .65rem; font: 700 .82rem/1.2 var(--ice-font-primary); }
.calendar-pickers p { justify-self: end; margin: 0 0 .7rem; color: var(--ice-color-text-muted); font-size: .72rem; }
.calendar-grid-wrap { overflow-x: auto; }
.calendar-grid { width: 100%; min-width: 620px; border-collapse: collapse; table-layout: fixed; }
.calendar-grid th { height: 42px; border-right: var(--ice-border); border-bottom: var(--ice-border); background: var(--ice-color-surface-field); color: var(--ice-color-text-muted); font-size: .7rem; letter-spacing: .06em; text-align: left; text-transform: uppercase; padding: .45rem .6rem; }
.calendar-grid th:last-child { border-right: 0; }
.calendar-grid th small { display: block; margin-top: .15rem; font-size: .65rem; font-weight: 500; letter-spacing: 0; text-transform: none; }
/* Emptied by the script when the whole calendar is already in Nepali; the
   weekday would otherwise be printed twice in the same words. */
.calendar-grid th small:empty { display: none; }
.calendar-grid td { height: 74px; padding: 0; border-right: var(--ice-border); border-bottom: var(--ice-border); vertical-align: top; }
.calendar-grid td:last-child { border-right: 0; }
.calendar-grid tbody tr:last-child td { border-bottom: 0; }
.calendar-grid td.is-empty { background: var(--ice-color-surface-muted); }
.calendar-day { width: 100%; height: 100%; min-height: 74px; padding: .55rem .65rem; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; border: 0; outline: 0; background: transparent; color: var(--ice-color-on-surface); cursor: pointer; font-family: var(--ice-font-primary); text-align: left; }
.calendar-day:hover { background: var(--ice-color-surface-field); }
.calendar-day:focus-visible { box-shadow: inset 0 0 0 3px var(--ice-color-text-action); }
.calendar-day[aria-pressed='true'] { box-shadow: inset 0 0 0 3px var(--ice-color-border-strong); background: var(--ice-color-surface-field); }
/* The badge reads from the button rather than from this rule, because the
   calendar can be set to Nepali and a CSS string cannot follow that. */
.calendar-grid td.is-today .calendar-day::after { content: attr(data-today); align-self: flex-end; margin-top: -1rem; color: var(--ice-color-text-today); font-size: .58rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.calendar-day b { font-size: 1.35rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.calendar-day span { color: var(--ice-color-text-muted); font-size: .72rem; font-weight: 650; }
.calendar-inspector { display: grid; grid-template-columns: 1.2fr .8fr minmax(280px, 1fr); gap: 0; border-top: 2px solid var(--ice-color-border-strong); background: var(--ice-color-surface-field); }
.calendar-selected,
.calendar-facts,
.calendar-copy { min-width: 0; margin: 0; padding: var(--ice-space-5); }
.calendar-selected,
.calendar-facts { border-right: var(--ice-border); }
.calendar-selected strong { display: block; margin-top: .45rem; font-size: 1.25rem; line-height: 1.35; overflow-wrap: anywhere; }
.calendar-selected p { margin: .4rem 0 0; color: var(--ice-color-text-muted); font-size: .8rem; line-height: 1.45; }
.calendar-facts { display: grid; align-content: center; gap: var(--ice-space-3); }
.calendar-facts div { display: flex; justify-content: space-between; gap: var(--ice-space-3); }
.calendar-facts dt { color: var(--ice-color-text-muted); font-size: .72rem; }
.calendar-facts dd { margin: 0; font-size: .76rem; font-weight: 750; text-align: right; }
.calendar-copy { display: grid; grid-template-columns: 1fr auto; gap: .45rem .6rem; align-items: end; }
.calendar-copy > label { grid-column: 1 / -1; }
.calendar-copy output { grid-column: 1 / -1; min-height: 2.5em; color: var(--ice-color-text-muted); font-size: .72rem; line-height: 1.35; overflow-wrap: anywhere; }
.calendar-copy .tool-action { min-height: 40px; padding: .6rem .8rem; }
.calendar-copy .tool-status { grid-column: 1 / -1; margin: 0; min-height: 1em; }

@media (max-width: 820px) {
  .calendar-page-head { align-items: flex-start; }
  .calendar-command { align-items: flex-start; flex-direction: column; }
  .calendar-controls { width: 100%; justify-content: space-between; }
  .calendar-inspector { grid-template-columns: 1fr 1fr; }
  .calendar-facts { border-right: 0; }
  .calendar-copy { grid-column: 1 / -1; border-top: var(--ice-border); }
}

@media (max-width: 560px) {
  .calendar-page-head { display: block; }
  .calendar-page-head .tool-action { display: inline-flex; margin-top: var(--ice-space-3); }
  .calendar-command { padding: var(--ice-space-4); }
  .calendar-controls { align-items: stretch; flex-direction: column; }
  .calendar-stepper button { flex: 1; }
  .calendar-pickers { grid-template-columns: 1fr 1.35fr; padding: var(--ice-space-3) var(--ice-space-4); }
  .calendar-pickers__lang { grid-column: 1 / -1; }
  .calendar-pickers p { grid-column: 1 / -1; justify-self: start; margin: 0; }
  .calendar-grid { min-width: 0; }
  .calendar-grid th { height: 34px; padding: .3rem; text-align: center; }
  .calendar-grid th small { display: none; }
  .calendar-grid td { height: 58px; }
  .calendar-day { min-height: 58px; padding: .4rem .32rem; }
  .calendar-day b { font-size: 1.05rem; }
  .calendar-day span { font-size: .58rem; }
  .calendar-grid td.is-today .calendar-day::after { display: none; }
  .calendar-inspector { grid-template-columns: 1fr; }
  .calendar-selected,
  .calendar-facts { border-right: 0; border-bottom: var(--ice-border); }
  .calendar-facts div { align-items: baseline; }
  .calendar-copy { grid-column: auto; border-top: 0; }
}

.tool-copybar { display: grid; grid-template-columns: minmax(180px, 260px) 1fr auto; gap: .65rem; align-items: end; margin-top: var(--ice-space-4); padding: var(--ice-space-4); border: var(--ice-border); background: var(--ice-color-surface-muted); }
.tool-copybar label { grid-column: 1 / -1; color: var(--ice-color-text-muted); font-size: .68rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.tool-copybar select { width: 100%; min-height: 44px; border: var(--ice-border); border-radius: var(--ice-radius-control); background: var(--ice-color-surface-field); color: var(--ice-color-on-surface-field); padding: .6rem .7rem; font: 700 .82rem/1.2 var(--ice-font-primary); }
.tool-copybar output { align-self: center; color: var(--ice-color-text-muted); font-size: .76rem; line-height: 1.4; overflow-wrap: anywhere; }
@media (max-width: 620px) { .tool-copybar { grid-template-columns: 1fr auto; } .tool-copybar output { grid-column: 1 / -1; grid-row: 3; } }
@media (min-width: 1000px) {
  .tool-grid--index .tool-grid__featured { grid-column: auto; }
}
/* Calendar signal layer. Weekend and today colors carry meaning; the heavier
   grid keeps dense date information readable without images or JavaScript. */
.dual-calendar { border-width: 3px; }
.calendar-command,
.calendar-pickers { border-bottom-width: 2px; }
.calendar-grid th,
.calendar-grid td {
  border-color: var(--ice-color-on-surface);
  border-right-width: 2px;
  border-bottom-width: 2px;
}
.calendar-grid th:first-child,
.calendar-grid th:last-child { color: var(--ice-color-text-accent); }
.calendar-grid td:first-child,
.calendar-grid td:last-child { background: color-mix(in srgb, var(--ice-color-text-accent) 5%, var(--ice-color-surface)); }
.calendar-grid td:first-child .calendar-day,
.calendar-grid td:last-child .calendar-day { color: var(--ice-color-text-accent); }
.calendar-grid td:first-child .calendar-day span,
.calendar-grid td:last-child .calendar-day span { color: color-mix(in srgb, var(--ice-color-text-accent) 72%, var(--ice-color-text-muted)); }
/* Today is green, the weekend columns above stay on the accent. Two states
   that a reader has to tell apart cannot be drawn in one colour.

   20% is the ceiling on the tint, not a taste call: the day number is printed
   in the same green, and at 26% it measures 4.42:1 against its own background
   and stops clearing AA. The rest of the visibility is carried by a solid 4px
   green bar along the foot of the cell and by a filled badge, neither of which
   competes with the number for contrast. */
.calendar-grid td.is-today { background: color-mix(in srgb, var(--ice-color-text-today) 20%, var(--ice-color-surface)); }
.calendar-grid td.is-today .calendar-day { box-shadow: inset 0 0 0 3px var(--ice-color-text-today); }
.calendar-grid td.is-today .calendar-day::after { padding: .16rem .3rem; border: 0; background: var(--ice-color-text-today); color: var(--ice-color-surface); }
.calendar-grid td:first-child.is-today .calendar-day,
.calendar-grid td:last-child.is-today .calendar-day { color: var(--ice-color-text-today); }
.calendar-grid td:first-child.is-today .calendar-day span,
.calendar-grid td:last-child.is-today .calendar-day span { color: color-mix(in srgb, var(--ice-color-text-today) 72%, var(--ice-color-text-muted)); }
.calendar-grid .calendar-day[aria-pressed='true'] { box-shadow: inset 0 0 0 3px var(--ice-color-border-strong); }
.calendar-grid td.is-today .calendar-day[aria-pressed='true'] { box-shadow: inset 0 0 0 3px var(--ice-color-text-today), inset 0 0 0 6px var(--ice-color-surface); }
.calendar-inspector { border-top-width: 3px; }
.calendar-selected,
.calendar-facts { border-right-width: 2px; }

@media (max-width: 560px) {
  .calendar-page-head { padding-block: .85rem; }
  .calendar-page-head h1 { font-size: clamp(1.55rem, 8vw, 2rem); }
  .calendar-page-head p { margin-top: .3rem; font-size: .78rem; line-height: 1.35; }
  .calendar-page-head .tool-action { display: none; }
  .calendar-command { gap: .65rem; padding: .7rem .8rem; }
  .calendar-eyebrow { display: none; }
  .calendar-titleblock h2 { margin: 0; font-size: 1.35rem; }
  .calendar-titleblock p { margin-top: .18rem; font-size: .68rem; }
  .calendar-controls { align-items: center; flex-direction: row; gap: .45rem; }
  .calendar-controls .tool-modes { flex: 1 1 48%; }
  .calendar-controls .tool-modes button { min-height: 36px; padding: .45rem .5rem; font-size: .7rem; }
  .calendar-stepper { flex: 1 1 52%; }
  .calendar-stepper button { min-width: 32px; min-height: 36px; padding-inline: .38rem; font-size: .7rem; }
  .calendar-pickers { gap: .45rem; padding: .55rem .8rem; }
  .calendar-pickers label { gap: .18rem; }
  .calendar-pickers select { min-height: 36px; padding: .4rem .5rem; font-size: .74rem; }
  .calendar-pickers p { display: none; }
  .calendar-selected,
  .calendar-facts { border-right: 0; border-bottom-width: 2px; }
  .calendar-prose .tool-explainer { padding-block: 1.5rem .75rem; }
  .calendar-prose .tool-explainer h3 { margin-top: 1.25rem; }
  .calendar-prose .tool-related { padding-block: .75rem 1.5rem; }
}

/* ── Desktop hub, scaled up ───────────────────────────────── (2026-08-02) */
/* The hub was sized when it held eight tools and read as a small card on a
   large screen. At ten it can take the width it was already reserving. */
@media (min-width: 1100px) {
  .tools-index { padding-block: 2rem 3rem; }
  .tools-index__frame { width: min(1360px, 100% - 3rem); }
  .tools-index .tool-head { padding: 2rem 2.25rem; }
  .tools-index .tool-head h1 { font-size: clamp(2rem, 1.4rem + 1.6vw, 2.9rem); }
  .tools-index .tool-head p { max-width: 64ch; font-size: 1.02rem; }
  .tool-directory,
  .tool-appendix { padding: 1.5rem; }
  .tool-grid--index { gap: 1rem; }
  .tools-index .tool-grid--index .tool-card { min-height: 180px; padding: .9rem; gap: .5rem; }
  .tools-index .tool-grid--index .tool-card__text b { font-size: 1.08rem; }
  .tools-index .tool-grid--index .tool-card__text span { font-size: .875rem; }
}


/* The today cell tints its background, which lifts it toward the muted ink and
   leaves the AD sub-line at 4.39:1 — under AA. Give that one line its own ink
   rather than lightening the tint, which is the thing marking today. */
:root { --ice-color-text-muted-on-today: #5F636A; }
[data-theme='dark'] { --ice-color-text-muted-on-today: #DBDEE1; }
.page-tools td.is-today .calendar-day span { color: var(--ice-color-text-muted-on-today); }

/* Land converter: dimension-first route for rectangular plots. */
.page-tools .land-modes { flex-wrap: nowrap; }

.page-tools .land-dimensions { margin: 0; }

.page-tools .land-dimension-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(180px, .9fr);
  align-items: end;
  gap: .65rem;
}

.page-tools .land-dimension-grid .tool-field > label span {
  color: var(--ice-color-on-surface-muted);
  font-weight: 650;
}

.page-tools .land-input-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  min-width: 0;
  min-height: 44px;
  border: var(--ice-border);
  border-color: var(--ice-color-border-strong);
  border-radius: var(--ice-radius-control);
  background: var(--ice-color-surface-field);
}

.page-tools .land-input-unit:focus-within {
  outline: 2px solid var(--ice-color-text-action);
  outline-offset: 2px;
}

.page-tools #land-form .land-input-unit input {
  min-width: 0;
  min-height: 42px;
  padding-right: .35rem;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  font-size: 1.12rem;
  font-weight: 760;
}

.page-tools .land-input-unit > span {
  align-self: stretch;
  display: grid;
  place-items: center;
  min-width: 2.65rem;
  padding-inline: .6rem;
  border-left: 1px solid var(--ice-color-border-strong);
  color: var(--ice-color-text-muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.page-tools .land-equation {
  display: grid;
  place-items: center;
  min-height: 44px;
  color: var(--ice-color-on-surface-muted);
  font-family: var(--ice-font-display);
  font-size: 1.45rem;
  font-weight: 700;
}

.page-tools .land-area-preview {
  display: flex;
  min-width: 0;
  min-height: 66px;
  flex-direction: column;
  justify-content: center;
  padding: .6rem .75rem;
  border: 2px solid var(--ice-color-on-surface);
  border-radius: var(--ice-radius-control);
  background: var(--ice-color-on-surface);
  color: var(--ice-color-surface);
}

.page-tools .land-area-preview > span {
  font-size: .66rem;
  font-weight: 750;
  letter-spacing: .05em;
  opacity: .72;
  text-transform: uppercase;
}

.page-tools .land-area-preview output {
  margin-top: .1rem;
  font-size: 1.12rem;
  font-weight: 850;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.page-tools .land-dimension-note {
  max-width: 68ch;
  margin: .65rem 0 0;
  color: var(--ice-color-text-muted);
  font-size: .75rem;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .page-tools .land-dimension-grid {
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
    gap: .55rem;
  }

  .page-tools .land-equation--equals { display: none; }
  .page-tools .land-area-preview { grid-column: 1 / -1; min-height: 58px; }
}

@media (max-width: 480px) {
  .page-tools .land-modes button { min-width: 0; padding-inline: .65rem; }
  .page-tools .land-input-unit > span { min-width: 2.25rem; padding-inline: .45rem; }
  .page-tools #land-form .land-input-unit input { padding-inline: .6rem .2rem; }
}

/* ── Hub prose and the full-section table ─────────────────────────────
   Added 2026-08-21. The hub was 338 words with no table and nothing on it
   that said what Kaamko is, which made the most-linked page in the section
   the least quotable. Both blocks sat above the card shelves until
   2026-08-28 and now sit below them: see the note in the page itself for
   why the SEO argument never required the top of the document.

   The table is deliberately a real <table> and not a grid of divs: it is
   comparative data, it is read as such by assistive tech, and it is the
   shape a retrieval system can lift whole. It scrolls inside its own
   wrapper rather than widening the page — same contract as every other
   scrollable table in this section. */
.tool-prose p {
  margin: 0 0 .75rem;
  /* 58ch and not the 72ch it was: `ch` is the width of a zero, and this
     stack's zero is wide, so 72ch measured 94 characters a line on a
     desktop — well past a readable line. 58ch lands near 76. */
  max-width: 58ch;
  font-size: .95rem;
  line-height: 1.65;
  color: var(--ice-color-text-muted);
}

.tool-prose p:last-child { margin-bottom: 0; }

.tool-table-wrap {
  overflow-x: auto;
  scrollbar-gutter: stable;
  border: 2px solid var(--ice-color-border-strong);
}

.tool-table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: .9rem;
}

.tool-table th,
.tool-table td {
  padding: .55rem .7rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--ice-color-border);
}

.tool-table thead th {
  position: sticky;
  top: 0;
  /* Opaque, not transparent: rows scrolling under a see-through head is the
     defect the Kalimati rates table shipped once. */
  background: var(--ice-color-surface);
  font: 850 .72rem/1.2 var(--ice-font-primary);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ice-color-on-surface);
  border-bottom: 2px solid var(--ice-color-border-strong);
}

.tool-table tbody th {
  font-weight: 700;
  color: var(--ice-color-on-surface);
}

.tool-table tbody td { color: var(--ice-color-text-muted); }

.tool-table tbody tr:last-child th,
.tool-table tbody tr:last-child td { border-bottom: 0; }
