/* FireCAD Calc public pages. Brand tokens, font, header and footer come from FireCad.Brand (brand.css, loaded first);
   the short names below map onto its --fc-* tokens. No framework CSS on public pages: this file is the whole design.
   Sections: tokens · base · header, mega-menu, search · layout and side menu · home · tiles, cards, chips ·
   calculator · article · small parts · print. */

/* ---------- tokens ---------- */
:root {
    --navy: var(--fc-navy); --navy-2: var(--fc-navy-2); --orange: var(--fc-orange); --cta: var(--fc-cta); --cta-dark: var(--fc-cta-dark);
    --accent: var(--fc-accent); --ink: var(--fc-ink); --rule: var(--fc-rule); --muted: var(--fc-muted); --bg: var(--fc-bg); --font: var(--fc-font);
    --paper: #fff;
    --tint: color-mix(in srgb, var(--fc-orange) 10%, #fff);
    --ok: #1e7f4f; --warn: #a2600a; --error: #b3261e;
    --radius: 12px; --radius-s: 8px;
    --shadow: 0 1px 2px color-mix(in srgb, var(--fc-navy) 7%, transparent), 0 2px 8px color-mix(in srgb, var(--fc-navy) 5%, transparent);
    --shadow-lift: 0 2px 6px color-mix(in srgb, var(--fc-navy) 9%, transparent), 0 14px 32px color-mix(in srgb, var(--fc-navy) 13%, transparent);
    --ring: 0 0 0 3px color-mix(in srgb, var(--fc-orange) 32%, transparent);
    --header-h: 4.4rem;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
body.public { min-height: 100vh; display: flex; flex-direction: column; }   /* footer at the bottom of short pages */
body { margin: 0; font-family: var(--font); font-size: 1rem; color: var(--ink); background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--cta-dark); }
h1, h2, h3 { color: var(--navy); line-height: 1.2; letter-spacing: -0.012em; }
h1 { font-size: clamp(1.6rem, 3.2vw, 2.1rem); margin: 0.3rem 0 0.5rem; }
h2 { font-size: 1.3rem; margin: 1.8rem 0 0.7rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 0.4rem; }
h1:focus { outline: none; }   /* Blazor focuses the h1 after navigation for screen readers; no visible box */
p { margin: 0 0 0.9rem; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 4px; }
.icon { flex: none; vertical-align: -0.18em; }
.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }   /* same width and gutter as the FireCad.Brand bar */
.lead { color: var(--muted); font-size: 1.06rem; margin: 0 0 1.2rem; max-width: 46rem; }
.small { color: var(--muted); font-size: 0.9rem; }
.text-danger { color: var(--error); }
.count { display: inline-block; min-width: 1.5em; padding: 0.05em 0.5em; border-radius: 1em; background: color-mix(in srgb, var(--fc-navy) 8%, transparent); color: var(--navy-2); font-size: 0.72rem; font-weight: 600; line-height: 1.5; text-align: center; vertical-align: middle; letter-spacing: 0; }
.skip-link { position: absolute; left: -999px; top: 0.5rem; z-index: 100; background: var(--paper); color: var(--navy); padding: 0.5rem 0.9rem; border-radius: var(--radius-s); box-shadow: var(--shadow-lift); }
.skip-link:focus { left: 0.5rem; }

/* ---------- header: FireCad.Brand draws the bar; the mega-menu and the search sit among its links ---------- */
.fc-header { position: relative; z-index: 40; }
.fc-header .fc-nav { flex: 1 1 auto; justify-content: flex-end; gap: 0.5rem 1.1rem; }
@media (min-width: 900px) { .fc-header { position: sticky; top: 0; } }

.mega > summary { list-style: none; display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; user-select: none; padding: 0.4rem 0.7rem; border-radius: var(--radius-s); color: color-mix(in srgb, #fff 82%, transparent); font-size: 0.95rem; font-weight: 500; }
.mega > summary::-webkit-details-marker { display: none; }
.mega > summary:hover, .mega[open] > summary { background: color-mix(in srgb, #fff 12%, transparent); color: #fff; }
.mega > summary .icon { transition: transform 0.15s; }
.mega[open] > summary .icon { transform: rotate(180deg); }
.mega-panel { position: absolute; left: 0; right: 0; top: 100%; max-height: calc(100vh - var(--header-h) - 1rem); overflow: auto; padding: 1.5rem 0 1.7rem; background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--rule); box-shadow: var(--shadow-lift); }
.mega-grid { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 2rem; }
.mega-disciplines { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: 1.5rem 1.8rem; align-content: start; }
.mega-panel ul { list-style: none; margin: 0; padding: 0; }
.mega-panel a.mega-discipline { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; color: var(--navy); font-size: 1rem; font-weight: 700; text-decoration: none; }
.mega-panel a.mega-discipline .icon { color: var(--cta); }
.mega-panel a.mega-discipline:hover { color: var(--cta); text-decoration: none; }
.mega-panel li a { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-left: -0.5rem; padding: 0.25rem 0.5rem; border-radius: 6px; color: var(--ink); font-size: 0.93rem; text-decoration: none; }
.mega-panel li a:hover { background: var(--bg); color: var(--accent); text-decoration: none; }
.mega-side { padding-left: 1.8rem; border-left: 1px solid var(--rule); }
.mega-panel .mega-more { margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--rule); }
.mega-panel .mega-more a { justify-content: flex-start; font-weight: 600; }
.mega-panel .mega-more .icon { color: var(--muted); }
.mega-panel a.mega-all { justify-content: flex-start; color: var(--accent); font-size: 0.88rem; font-weight: 600; }
@media (max-width: 760px) {
    .mega-grid { grid-template-columns: 1fr; gap: 1.2rem; }
    .mega-side { padding: 1.2rem 0 0; border-left: 0; border-top: 1px solid var(--rule); }
}

.search { position: relative; display: flex; align-items: center; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; }
.search:focus-within { border-color: var(--orange); box-shadow: var(--ring); }
.search .search-icon { position: absolute; left: 0.75rem; color: var(--muted); pointer-events: none; }
.search input { flex: 1; min-width: 0; padding: 0.5rem 0.6rem 0.5rem 2.4rem; border: 0; border-radius: 10px; background: transparent; color: var(--ink); outline: none; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search button { margin: 3px; padding: 0.42rem 0.95rem; border: 0; border-radius: 7px; background: var(--cta); color: #fff; font-weight: 600; cursor: pointer; }
.search button:hover { background: var(--cta-dark); }
.fc-nav .search { flex: 1 1 15rem; max-width: 25rem; border-color: transparent; }
.search.big { max-width: 40rem; margin: 0 0 1.3rem; }
@media (max-width: 640px) { .fc-nav .search { order: 3; flex: 1 1 100%; max-width: none; } }   /* phone: menu and log in beside the logo, search on its own row */
.search .suggest { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60; padding: 0.3rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-lift); text-align: left; }
.search .suggest a { display: block; padding: 0.45rem 0.7rem; border-radius: 7px; color: var(--ink); font-size: 0.95rem; font-weight: 500; text-decoration: none; }
.search .suggest a small { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 400; }
.search .suggest a:hover, .search .suggest a[aria-selected="true"] { background: var(--bg); color: var(--ink); text-decoration: none; }
.search .suggest a.all { color: var(--accent); font-size: 0.88rem; font-weight: 600; }
.search .suggest p { margin: 0; padding: 0.5rem 0.7rem; color: var(--muted); font-size: 0.9rem; }

/* ---------- layout and side menu ---------- */
.page-grid { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 2.4rem; padding-top: 1.5rem; padding-bottom: 2.4rem; flex: 1 0 auto; }
.content { min-width: 0; }
.side-nav { align-self: start; position: sticky; top: calc(var(--header-h) + 1.1rem); max-height: calc(100vh - var(--header-h) - 2rem); overflow: auto; font-size: 0.94rem; padding-right: 0.3rem; }
.side-nav ul { list-style: none; margin: 0; padding: 0; }
.nav-discipline { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; color: var(--navy); font-weight: 700; text-decoration: none; }
.nav-discipline .icon { color: var(--cta); }
.nav-categories { margin-bottom: 0.4rem !important; border-left: 2px solid var(--rule); }
.nav-categories a { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; margin-left: -2px; padding: 0.32rem 0.5rem 0.32rem 0.8rem; border-left: 2px solid transparent; border-radius: 0 6px 6px 0; color: var(--ink); text-decoration: none; }
.nav-categories a:hover { color: var(--accent); background: color-mix(in srgb, #fff 70%, transparent); }
.nav-categories a[aria-current="page"] { border-left-color: var(--orange); background: var(--paper); color: var(--cta); font-weight: 600; }
.nav-heading { margin: 1.3rem 0 0.35rem; color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; }
.side-nav > .nav-heading:first-child { margin-top: 0; }
.nav-list a { display: flex; align-items: center; gap: 0.5rem; margin-left: -0.45rem; padding: 0.3rem 0.45rem; border-radius: 6px; color: var(--ink); text-decoration: none; }
.nav-list a .icon { color: var(--muted); }
.nav-list a .count { margin-left: auto; }
.nav-list a:hover { background: var(--paper); color: var(--accent); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.45rem; margin: 0 0 0.2rem; color: var(--muted); font-size: 0.86rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
/* breadcrumb switcher: the other calculators of the category, on the calculator page */
.crumbs { position: relative; }
.crumb-switch > summary { list-style: none; cursor: pointer; padding: 0.05rem 0.5rem; border: 1px solid var(--rule); border-radius: 999px; font-size: 0.8rem; white-space: nowrap; }
.crumb-switch > summary::-webkit-details-marker { display: none; }
.crumb-switch > summary::after { content: " ▾"; }
.crumb-switch[open] > summary::after { content: " ▴"; }
.crumb-switch > summary:hover, .crumb-switch[open] > summary { color: var(--accent); border-color: var(--accent); }
.switch-panel { position: absolute; z-index: 20; left: 0; top: calc(100% + 0.35rem); width: min(46rem, 100%); max-height: min(70vh, 34rem); overflow: auto; padding: 0.9rem 1.1rem; background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow-lift); font-size: 0.88rem; }
.switch-cols { columns: 2 17rem; column-gap: 1.6rem; }
.switch-panel section { break-inside: avoid; margin-bottom: 0.7rem; }
.switch-panel h2 { margin: 0 0 0.2rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.switch-panel ul { list-style: none; margin: 0; padding: 0; }
.switch-panel li a, .switch-panel li span { display: block; padding: 0.18rem 0.3rem; border-radius: 5px; color: var(--ink); text-decoration: none; line-height: 1.3; }
.switch-panel li a:hover { background: var(--bg); color: var(--accent); }
.switch-panel li span[aria-current] { font-weight: 700; color: var(--accent); }
.page-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 0.6rem; }
.page-head h1 { margin-top: 0.1rem; }
.page-icon, .tile-icon { display: inline-grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border-radius: 10px; background: var(--tint); color: var(--cta); }
.page-icon { width: 3.1rem; height: 3.1rem; border-radius: 12px; margin-top: 0.2rem; }
@media (max-width: 900px) {
    .page-grid { grid-template-columns: 1fr; gap: 1.2rem; }
    .content { order: 1; }
    .side-nav { order: 2; position: static; max-height: none; padding-top: 1.2rem; border-top: 1px solid var(--rule); }
}

/* ---------- home ---------- */
.home { flex: 1 0 auto; }
.hero { padding: 3.2rem 0 3rem; background: linear-gradient(160deg, var(--navy), var(--navy-2)); border-top: 1px solid color-mix(in srgb, #fff 9%, transparent); color: #fff; }
.hero h1 { max-width: 22ch; margin: 0.4rem 0 0.9rem; color: #fff; font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.06; letter-spacing: -0.025em; }
.eyebrow { margin: 0; color: var(--orange); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.hero-lead { max-width: 42rem; margin: 0; color: color-mix(in srgb, #fff 82%, transparent); font-size: 1.12rem; }
.hero-search { max-width: 40rem; margin-top: 1.6rem; border: 0; border-radius: 12px; box-shadow: var(--shadow-lift); font-size: 1.05rem; }
.hero-search input { padding-top: 0.85rem; padding-bottom: 0.85rem; }
.hero-search button { padding: 0.65rem 1.3rem; border-radius: 9px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 0.9rem 2.4rem; margin: 2rem 0 0; padding: 0; list-style: none; color: color-mix(in srgb, #fff 72%, transparent); font-size: 0.9rem; }
.hero-stats b { display: block; color: #fff; font-size: 1.08rem; }
.home-body { padding-top: 0.6rem; padding-bottom: 2.6rem; }
.home-body section { margin-top: 2.4rem; }
.home-body h2 { margin-top: 0; font-size: 1.4rem; }
.planned { margin-top: 1rem; color: var(--muted); font-size: 0.9rem; line-height: 2.2; }
.method-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; }
.method-grid > div { padding: 1.1rem 1.2rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.method-grid .icon { color: var(--cta); }
.method-grid h3 { margin: 0.5rem 0 0.3rem; }
.method-grid p { margin: 0; color: var(--muted); font-size: 0.93rem; }

/* ---------- tiles, cards, chips ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 1rem; margin: 0.4rem 0 1rem; }
.tile { padding: 1.1rem 1.2rem 1.2rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.tile-head { display: flex; align-items: center; gap: 0.65rem; color: var(--navy); font-size: 1.06rem; font-weight: 700; text-decoration: none; }
.tile-head:hover { color: var(--cta); }
.tile-title { flex: 1; }
.tile p { margin: 0.55rem 0 0.6rem; color: var(--muted); font-size: 0.9rem; }
.tile ul { list-style: none; margin: 0; padding: 0; font-size: 0.93rem; }
.tile li a { display: block; padding: 0.2rem 0; color: var(--ink); text-decoration: none; }
.tile li a:hover { color: var(--accent); text-decoration: underline; }
.tile .more { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.55rem; font-size: 0.9rem; font-weight: 600; text-decoration: none; }
a.tile.link { display: grid; grid-template-columns: 1fr auto; align-items: start; align-content: start; gap: 0.2rem 0.6rem; color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
a.tile.link .tile-title { color: var(--navy); font-weight: 700; }
a.tile.link p { grid-column: 1 / -1; margin: 0.2rem 0 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr)); gap: 0.9rem; margin: 0.5rem 0 1.3rem; }
.card { display: block; padding: 0.95rem 1.05rem 1rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.card:hover, a.tile.link:hover { border-color: var(--orange); box-shadow: var(--shadow-lift); color: inherit; transform: translateY(-2px); }
.card h3 { margin: 0 0 0.3rem; color: var(--navy-2); font-size: 1rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.89rem; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-home { display: block; margin-bottom: 0.3rem; color: var(--accent); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.card-wrap { position: relative; display: grid; }
.card-wrap > .card { padding-right: 2.6rem; }
.card-wrap > .fav { position: absolute; top: 0.55rem; right: 0.55rem; }
/* favourites: the heart (site.js shows it) and the personal strips on the home page and dashboard */
.title-row { display: flex; align-items: flex-start; gap: 0.6rem; }
.title-row h1 { flex: 1; }
.title-row > .fav { margin-top: 0.45rem; }
.fav { display: inline-grid; place-items: center; flex: none; width: 2.2rem; height: 2.2rem; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.fav[hidden] { display: none; }
.fav svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.fav:hover { background: var(--bg); color: var(--cta); }
.fav:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fav[aria-pressed="true"] { color: var(--cta); }
.fav[aria-pressed="true"] svg { fill: currentColor; }
.personal[hidden] { display: none; }
.personal .note { margin: -0.3rem 0 0.6rem; color: var(--muted); font-size: 0.9rem; }

.chip { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0.15rem 0.25rem 0.15rem 0; padding: 0.16rem 0.7rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 2rem; color: var(--navy-2); font-size: 0.86rem; line-height: 1.5; text-decoration: none; }
a.chip:hover { border-color: var(--orange); color: var(--cta); }
.chip.muted { background: transparent; color: var(--muted); }
.tags { margin: -0.5rem 0 1.1rem; }
.also { margin: 1.2rem 0 0; color: var(--muted); font-size: 0.9rem; }
.browse-discipline { display: inline-flex; align-items: center; gap: 0.4rem; margin-right: 0.5rem; color: var(--navy); font-weight: 700; text-decoration: none; }
.topic { display: flex; align-items: center; gap: 0.5rem; margin: 1.5rem 0 0.2rem; font-size: 1.12rem; }
.filter { display: flex; align-items: center; gap: 0.5rem; max-width: 26rem; margin: 0.2rem 0 0.4rem; padding: 0 0.8rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; color: var(--muted); }
.filter:focus-within { border-color: var(--orange); box-shadow: var(--ring); }
.filter input { flex: 1; min-width: 0; padding: 0.5rem 0; border: 0; background: transparent; color: var(--ink); outline: none; }
.letters { margin: 0 0 0.8rem; }
.az { list-style: none; margin: 0.3rem 0 0; padding: 0; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.az li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.1rem 1rem; padding: 0.5rem 1rem; border-top: 1px solid var(--rule); }
.az li:first-child { border-top: 0; }
.az li a { font-weight: 500; text-decoration: none; }
.az li a:hover { text-decoration: underline; }
.az li span { color: var(--muted); font-size: 0.84rem; }
.chip[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.facets { margin: 0.6rem 0 0.4rem; }
.facets p { margin: 0 0 0.4rem; }
.facet-label { display: inline-block; min-width: 5.5rem; margin-right: 0.3rem; color: var(--muted); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.chip[aria-current="page"] .count { background: color-mix(in srgb, #fff 20%, transparent); color: #fff; }
.letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr)); gap: 0.6rem; margin: 1.2rem 0 1.5rem; padding: 0; list-style: none; }
.letter-grid a { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.7rem 0.4rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--navy); text-decoration: none; }
.letter-grid a b { font-size: 1.35rem; }
.letter-grid a:hover { border-color: var(--orange); color: var(--cta); }
.pager { display: flex; justify-content: space-between; margin: 1.2rem 0 0.5rem; font-weight: 600; }
.pager a { text-decoration: none; }
[hidden] { display: none !important; }

/* ---------- calculator ---------- */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1.2rem; align-items: start; }
.panel { padding: 1.1rem 1.3rem 1.3rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel h2 { margin: 0.1rem 0 0.8rem; font-size: 1.15rem; }
.panel.results { border-top: 3px solid var(--orange); }
@media (min-width: 1100px) { .panel.results { position: sticky; top: calc(var(--header-h) + 1.1rem); max-height: calc(100vh - var(--header-h) - 2rem); overflow: auto; } }
.calc-form .group { margin: 1.2rem 0 0.4rem; padding-top: 0.9rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.76rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.field { display: block; margin: 0 0 0.75rem; }
.field > label, .field > span { display: block; margin-bottom: 0.25rem; font-size: 0.9rem; font-weight: 500; }
.field small { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.8rem; }
.field select, .field input { width: 100%; padding: 0.48rem 0.6rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-s); color: var(--ink); }
.field select:hover, .field input:hover { border-color: color-mix(in srgb, var(--fc-navy) 35%, var(--fc-rule)); }
.field select:focus, .field input:focus { border-color: var(--orange); box-shadow: var(--ring); outline: none; }
.value-unit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(6.5rem, 38%); gap: 0.4rem; }
.value-unit input { min-width: 0; font-variant-numeric: tabular-nums; }
.presets { margin: 0.4rem 0 0.8rem; font-size: 0.9rem; color: var(--muted); }
.preset { display: inline-block; margin: 0.18rem 0.3rem 0.18rem 0; padding: 0.14rem 0.7rem; background: var(--bg); border: 1px solid var(--rule); border-radius: 1rem; color: var(--navy-2); font-size: 0.85rem; text-decoration: none; }
.preset.on, .preset:hover { background: var(--tint); border-color: var(--orange); color: var(--cta); }
.cta, .button { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.6rem 1.2rem; background: var(--cta); border: 0; border-radius: var(--radius-s); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; transition: background 0.15s; }
.cta { width: 100%; margin-top: 0.6rem; padding: 0.75rem 1.2rem; font-size: 1.05rem; }
.button:hover, .cta:hover { background: var(--cta-dark); color: #fff; }
.button.secondary { background: var(--paper); border: 1px solid var(--rule); color: var(--navy-2); }
.button.secondary:hover { background: var(--bg); border-color: var(--navy-2); color: var(--navy); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.1rem 0 0.5rem; }
.panel.chart { margin-top: 1.2rem; }
.chart-svg { max-width: 680px; margin: 0 auto; }
.chart-svg svg { width: 100%; height: auto; display: block; }
.results-table { width: 100%; border-collapse: collapse; }
.results-table th { padding: 0.5rem 0.3rem; border-bottom: 1px solid var(--rule); font-size: 0.94rem; font-weight: 500; text-align: left; }
.results-table td { padding: 0.5rem 0.3rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.results-table td.num { color: var(--navy); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.results-table td.unit { width: 1%; color: var(--muted); font-size: 0.9rem; }
.results-table tr:hover > * { background: color-mix(in srgb, var(--fc-bg) 60%, transparent); }
.alert { margin: 0 0 0.7rem; padding: 0.6rem 0.8rem; background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--rule); border-radius: var(--radius-s); font-size: 0.93rem; }
.alert.error { border-left-color: var(--error); color: var(--error); }
.alert.warn { border-left-color: var(--warn); }
.alert.ok { border-left-color: var(--ok); color: var(--ok); }
/* Dashboard: saved calculations and licences */
.dash-block { margin: 0 0 1.4rem; padding: 1rem 1.2rem 0.6rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.dash-block h2 { margin: 0 0 0.6rem; }
.table-scroll { overflow-x: auto; margin: 0 0 0.6rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.data-table th { padding: 0.5rem 0.5rem 0.5rem 0; border-bottom: 1px solid var(--rule); color: var(--muted); font-weight: 500; text-align: left; }
.data-table td { padding: 0.5rem 0.5rem 0.5rem 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td.when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table td.act { width: 1%; text-align: right; }
.data-table .button { padding: 0.32rem 0.9rem; font-size: 0.9rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.save-form { display: flex; gap: 0.4rem; margin-top: 0.9rem; }
.save-form input[type=text] { flex: 1; min-width: 0; padding: 0.45rem 0.6rem; border: 1px solid var(--rule); border-radius: var(--radius-s); }
.save-form button { padding: 0.45rem 1rem; background: var(--navy-2); border: 0; border-radius: var(--radius-s); color: #fff; font-weight: 600; cursor: pointer; }
.next-steps { margin-top: 1.5rem; }
.next-steps h2 { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.76rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; }
.next-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 0.7rem; }
.next { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.75rem 1rem; background: var(--paper); border: 1px solid var(--rule); border-left: 3px solid var(--orange); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: box-shadow 0.15s, transform 0.15s; }
.next:hover { box-shadow: var(--shadow-lift); color: var(--ink); transform: translateY(-1px); }
.next b { display: block; color: var(--navy-2); }
.next small { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 0.84rem; }
.next .icon { color: var(--cta); }

/* ---------- article ---------- */
.article { margin-top: 1.6rem; padding: 1.2rem 1.6rem 1.6rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.article > h2:first-child { margin-top: 0.3rem; }
.article h2 { padding-top: 1rem; border-top: 1px solid var(--rule); }
.article > h2:first-child { padding-top: 0; border-top: 0; }
.article p, .article li { max-width: 46rem; }
.article ul, .article ol { padding-left: 1.3rem; }
.article li { margin-bottom: 0.3rem; }
.article table { margin: 0.6rem 0 1rem; border-collapse: collapse; font-size: 0.94rem; }
.article th, .article td { padding: 0.4rem 0.7rem; border: 1px solid var(--rule); text-align: left; vertical-align: top; }
.article th { background: var(--bg); font-weight: 600; }
.article .math, .article mjx-container[display="true"] { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.article code { padding: 0.1em 0.35em; background: var(--bg); border-radius: 4px; font-size: 0.92em; }
.article .example-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.article .reviewed { margin-top: 1.4rem; padding-top: 0.8rem; border-top: 1px solid var(--rule); }
.faq { margin: 0.45rem 0; padding: 0.6rem 1rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-s); }
.faq[open] { border-color: color-mix(in srgb, var(--fc-orange) 45%, var(--fc-rule)); }
.faq summary { font-weight: 600; cursor: pointer; }
.faq div { padding-top: 0.4rem; color: var(--muted); }
.faq div p:last-child { margin-bottom: 0; }

/* ---------- small parts ---------- */
.notice { max-width: 35rem; margin: 3rem auto; padding: 1.6rem 2rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.site-note { margin-top: 0; margin-bottom: 1.2rem; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; z-index: 80; transform: translateX(-50%); padding: 0.55rem 1.1rem; background: var(--navy); border-radius: 2rem; box-shadow: var(--shadow-lift); color: #fff; font-size: 0.92rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .card:hover, a.tile.link:hover, .next:hover { transform: none; } }

/* ---------- print: the calculation and its article, without the site around it ---------- */
@media print {
    .fc-header, .fc-footer, .side-nav, .site-note, .actions, .save-form, .next-steps, .presets, .tags, .cta, .skip-link { display: none !important; }
    body { background: #fff; }
    .page-grid { display: block; padding: 0; }
    .panel, .article { box-shadow: none; }
    .panel.results { position: static; max-height: none; }
}

/* Home: common tasks under the search box */
.hero-tasks { display: flex; flex-wrap: wrap; gap: 0.45rem; max-width: 46rem; margin: 1rem 0 0; }
.hero-tasks a { padding: 0.22rem 0.75rem; border: 1px solid color-mix(in srgb, #fff 28%, transparent); border-radius: 2rem; color: #fff; font-size: 0.88rem; text-decoration: none; }
.hero-tasks a:hover { background: color-mix(in srgb, #fff 12%, transparent); border-color: #fff; }

/* Calculator page: method and verification panel, comparison of cases */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 0.6rem 1.4rem; margin: 1.4rem 0 0; padding: 0.9rem 1.1rem; background: var(--paper); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: var(--radius); font-size: 0.88rem; }
.facts div { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.facts b { color: var(--navy); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.facts span { color: var(--muted); overflow-wrap: anywhere; }
.compare { margin-top: 1.4rem; }
.table-scroll { overflow-x: auto; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.compare-table th, .compare-table td { padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--rule); text-align: left; }
.compare-table td.num, .compare-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.compare-table td.unit { color: var(--muted); white-space: nowrap; }
.compare-table tr.section th { padding-top: 0.8rem; color: var(--navy); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.compare-table tr.differs td.num { background: color-mix(in srgb, var(--accent) 9%, transparent); font-weight: 600; }

/* Workflows: calculators chained on one form */
.wf-steps-nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin: 0.8rem 0 1.2rem; padding-left: 1.2rem; font-size: 0.92rem; }
.wf-flag { margin-left: 0.4rem; color: var(--muted); font-size: 0.8rem; }
.wf-system { max-width: 18rem; }
.wf-step { margin-top: 1.2rem; }
.wf-step h2 { display: flex; align-items: center; gap: 0.6rem; }
.wf-num { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--navy); color: #fff; font-size: 0.95rem; }
.wf-carried { margin: 0 0 0.8rem; padding: 0.6rem 0.9rem; list-style: none; background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: var(--radius-s); font-size: 0.9rem; }
.wf-carried small { color: var(--muted); }
.results-table tr.wf-fed th, .results-table tr.wf-fed td { background: color-mix(in srgb, var(--accent) 9%, transparent); font-weight: 600; }
.wf-note { margin: 0.3rem 0 0; }
