/* Risorra Tools — utility-site skin.
   Same palette tokens as risorra.com (styles-v2.css) so the two properties
   read as one family, but a system font stack instead of the self-hosted
   Fraunces/Inter set: this is a utility people arrive at from search, use
   once and leave, and webfont bytes buy nothing here.
   ponytail: the display voice is borrowed from the parent's Fraunces by
   using the system serif for headings — same editorial feel, zero requests.
   Swap --font-display to Fraunces if the two sites ever share a font cache. */

:root {
  --paper: #faf9f5;
  --surface: #ffffff;
  --surface-2: #f3f4ee;
  --ink: #16211e;
  --muted: #51605b;
  --line: #e6e8df;
  --line-strong: #d6dacd;
  --brand: #0d3b3a;
  --brand-700: #0a302f;
  --brand-soft: #e2ece9;
  --ok: #0b6f57;
  /* Warm accent, taken from the parent's --lookout-2. Icons and eyebrows
     only — never the sole carrier of meaning. */
  --accent: #b4632a;
  --accent-soft: #fbf0e4;
  --danger-bg: #fdf3f2;
  --danger-line: #e9cfcc;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(22, 33, 30, 0.05);
  --shadow: 0 2px 6px rgba(22, 33, 30, 0.05), 0 14px 34px -18px rgba(22, 33, 30, 0.18);
  --shadow-lg: 0 4px 10px rgba(22, 33, 30, 0.06), 0 30px 70px -28px rgba(22, 33, 30, 0.26);
  --container: 760px;
  --gutter: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", "Noto Serif", serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t: 200ms;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
/* The hub lists 23 cards; reading measure is the wrong constraint there. */
body.home { --container: 1060px; }
body.home .prose,
body.home .home-hero p { max-width: 720px; }

a { color: var(--brand); }

/* ---------- header / footer ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}
.wordmark {
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.wordmark span {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}
/* Mark: a bracket around a dot — "your file, kept inside". Pure CSS so the
   header costs nothing extra. */
/* ponytail: the Risorra mark rides on ::before instead of an <img> in 24
   files. It is decorative — the wordmark beside it says the name. Swap to a
   real <img> when the tools site gets its own logo and alt text has to say
   something. */
.wordmark::before {
  content: "";
  width: 36px;
  height: 28px;
  flex: none;
  background: url("./risorra-mark.webp") center / contain no-repeat;
}
.site-header nav a {
  font-size: 15px;
  text-decoration: none;
  margin-left: 18px;
}
.site-header nav a:hover { text-decoration: underline; }

.site-footer {
  margin-top: 56px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 15px;
  color: var(--muted);
}
.site-footer a { color: var(--muted); }
.site-footer p { margin: 0 0 8px; }

/* ---------- page furniture ---------- */

main { padding-top: 24px; }

.crumbs {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}
.crumbs a { color: var(--muted); }

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5.5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}
h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 36px 0 10px;
}
h3 {
  font-size: 1.02rem;
  margin: 22px 0 6px;
}
.standfirst {
  font-size: 1.08rem;
  color: var(--muted);
  margin: 0 0 20px;
  max-width: 62ch;
}

/* Trust row under the standfirst. The tick is decorative; each item reads
   on its own with the mark stripped. */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 26px;
}
.badges li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 6px 13px;
}
.badges li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}

/* ---------- tool shell ---------- */

.tool {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 24px 20px;
}
@media (min-width: 620px) {
  .tool { padding: 30px 28px; }
}

.field { margin-bottom: 18px; }
.field > label,
fieldset > legend {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
  padding: 0;
}
.hint {
  font-size: 14px;
  color: var(--muted);
  margin: 4px 0 0;
}

/* Text-ish inputs had no shared rule before; number boxes fell back to the
   UA default next to fully styled pills. 16px keeps iOS from zooming. */
input[type="number"],
input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}

input[type="file"] {
  width: 100%;
  padding: 22px 16px;
  background: var(--surface-2);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
input[type="file"]:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  margin-right: 12px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 18px;
  min-width: 0;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.choices label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 15px;
  cursor: pointer;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
  /* 44px min touch target */
  min-height: 44px;
}
.choices input { accent-color: var(--brand); }
.choices label:hover { border-color: var(--brand); }
.choices label:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
}
.choices label:focus-within {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.custom-kb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.custom-kb input {
  width: 110px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font: inherit;
  min-height: 44px;
}

button {
  font: inherit;
  cursor: pointer;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: background var(--t) var(--ease), transform var(--t) var(--ease),
    box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--brand-700);
  box-shadow: var(--shadow);
}
.btn:active { transform: translateY(1px); }
.btn-primary[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-secondary:hover { border-color: var(--brand); }
.btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ---------- result ---------- */

.result {
  margin-top: 20px;
  padding: 18px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.result[hidden] { display: none; }
.result.is-error {
  background: var(--danger-bg);
  border-color: var(--danger-line);
}
.result h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}
.result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  font-size: 15px;
  color: var(--muted);
}
.result-stats li {
  display: flex;
  flex-direction: column;
  font-size: 12.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.result-stats b {
  color: var(--ink);
  font-size: 17px;
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}
.preview {
  max-width: 100%;
  max-height: 260px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: #fff;
  display: block;
  margin-bottom: 14px;
}
/* Not colour alone — the label spells the state out. */
.status-ok b { color: var(--ok); }

/* ---------- content layer ---------- */

.prose p, .prose li { color: var(--ink); }
.prose ol, .prose ul { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose > p { max-width: 68ch; }

details {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
details summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  align-items: center;
}
details summary:hover { color: var(--brand); }
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "+";
  font-size: 20px;
  color: var(--muted);
  line-height: 1;
}
details[open] summary::after { content: "\2212"; }
details p { margin: 8px 0 0; color: var(--muted); }

.related {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.related a {
  display: block;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  text-decoration: none;
  font-weight: 600;
}
.related a:hover { border-color: var(--brand); }
.related span {
  display: block;
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
}

.note {
  background: var(--brand-soft);
  border-radius: var(--r);
  padding: 16px 18px 16px 46px;
  font-size: 15px;
  margin: 20px 0;
  position: relative;
}
/* Decorative — the note always opens with a bolded label that carries it. */
.note::before {
  content: "i";
  position: absolute;
  left: 16px;
  top: 17px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--paper);
  font-size: 13px;
  font-weight: 700;
  font-style: italic;
  line-height: 20px;
  text-align: center;
}

/* ---------- ad slots ----------
   Reserved now, filled after AdSense approval. The min-height is the point:
   it holds the space so a late-loading ad can't shove content down (CLS).
   Slots sit between content blocks, never inside the tool controls. */
.ad-slot {
  min-height: 100px;
  margin: 28px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-slot::before {
  content: "Advertisement";
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.55;
}
.ad-slot:not(:empty)::before { content: none; }

@media (min-width: 620px) {
  .ad-slot { min-height: 280px; }
}

/* ---------- hub ---------- */

.home-hero {
  position: relative;
  margin: -24px 0 8px;
  padding: 44px 0 36px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(60% 120% at 12% 0%, var(--brand-soft) 0%, transparent 62%),
    radial-gradient(45% 100% at 92% 10%, var(--accent-soft) 0%, transparent 60%);
}
.home-hero h1 { max-width: 16ch; }
.home-hero .hero-art {
  display: none;
  position: absolute;
  right: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  width: 260px;
  height: auto;
  color: var(--brand);
  opacity: 0.9;
  pointer-events: none;
}
@media (min-width: 900px) {
  .home-hero .hero-art { display: block; }
  .home-hero .container > * { max-width: min(100%, 620px); }
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 40px 0 14px;
}
.section-head h2 {
  margin: 0;
  font-size: 1.2rem;
}
.section-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.section-head .count {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  order: 3;
}

.tool-grid {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0 0 12px;
  list-style: none;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.tool-grid a {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 4px 14px;
  align-content: start;
  height: 100%;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-decoration: none;
  font-weight: 600;
  color: var(--ink);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease),
    transform var(--t) var(--ease);
}
.tool-grid a:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.tool-grid .t {
  grid-area: 1 / 2 / 2 / 3;
  align-self: center;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
}
.tool-grid span {
  display: block;
  grid-column: 2;
  font-weight: 400;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 2px;
}
/* Icon chip. The SVG is decorative — the link text names the tool. */
.tool-grid .ico {
  grid-area: 1 / 1 / 3 / 2;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.tool-grid a:hover .ico { background: var(--accent-soft); color: var(--accent); }
.tool-grid .ico svg { width: 20px; height: 20px; }

/* A card with an icon puts the title beside it; one without (the "Related
   tools" lists) is a plain single column. */
.tool-grid a:not(:has(.ico)) { grid-template-columns: 1fr; }
.tool-grid a:not(:has(.ico)) span { grid-column: 1; }

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
  z-index: 30;
  background: var(--surface);
  padding: 10px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--brand);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .tool-grid a:hover { transform: none; }
}

/* Author `display` beats the UA rule for [hidden], so flex/grid rows stay
   visible when hidden is set. ponytail: one global override instead of a
   guard on every such rule. */
[hidden] { display: none !important; }

/* Finance calculator results */
.headline {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 2.75rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.headline-label {
  margin: 0 0 18px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
table.schedule { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 14px; font-variant-numeric: tabular-nums; }
table.schedule th, table.schedule td { padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--line); }
table.schedule th:first-child, table.schedule td:first-child { text-align: left; }
table.schedule thead th { position: sticky; top: 0; background: var(--surface-2); }
table.schedule th { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
table.schedule tbody tr:hover { background: var(--surface-2); }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field-row .field { flex: 1 1 140px; margin: 0; }
.table-wrap { overflow: auto; max-height: 420px; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--r-sm); -webkit-overflow-scrolling: touch; }
.table-wrap table.schedule { margin-top: 0; min-width: 360px; }
.table-wrap table.schedule th:first-child, .table-wrap table.schedule td:first-child { padding-left: 12px; }
.table-wrap table.schedule th:last-child, .table-wrap table.schedule td:last-child { padding-right: 12px; }

/* PDF-to-image results: one figure per page, thumbnail plus its own download.
   ponytail: auto-fill rather than a breakpoint ladder — the grid reflows on
   its own from a phone to a wide screen. */
.page-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  margin-top: 18px;
}
.page-grid figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.page-grid img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.page-grid figcaption {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* Card titles sit in ink, not link blue — the border, chip and lift carry the
   affordance. Hover colours the title so the target is unambiguous. */
.tool-grid a:hover .t { color: var(--brand); }
