/* ==========================================================================
   IR35 CALCULATOR — Design System
   Colour rule used throughout the site:
     RUST  = Inside IR35      GREEN = Outside IR35
   These are never decorative. If something is rust, it means inside IR35.
   ========================================================================== */

/* ---------- 1. TOKENS ---------- */
:root {
  --ink:      #0F1A17;
  --ink-2:    #33433E;
  --muted:    #6B7A75;
  --line:     #DDE4E1;
  --line-2:   #EDF1EF;
  --paper:    #FFFFFF;
  --wash:     #F2F6F4;

  --green:      #0B5A46;
  --green-dk:   #084333;
  --green-soft: #E3F0EA;

  --outside:      #1F8A6B;
  --outside-soft: #E4F3EE;
  --inside:       #A8422E;
  --inside-soft:  #F8E9E4;

  --gold:      #C8952B;
  --gold-soft: #FBF1DC;

  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --body:    "Karla", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --t-hero:  clamp(2.15rem, 5vw, 3.6rem);
  --t-h1:    clamp(1.9rem, 4.2vw, 3rem);
  --t-h2:    clamp(1.45rem, 2.9vw, 2.05rem);
  --t-h3:    clamp(1.12rem, 1.9vw, 1.32rem);
  --t-body:  clamp(1rem, 1.1vw, 1.0625rem);
  --t-small: 0.875rem;
  --t-label: 0.7rem;

  --gutter: clamp(1.1rem, 4vw, 2.5rem);
  --wrap:   1160px;
  --read:   760px;
  --sec-y:  clamp(3rem, 6.5vw, 5.5rem);

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;
  --shadow:  0 1px 2px rgba(15,26,23,.05), 0 10px 30px -16px rgba(15,26,23,.25);
  --shadow-lg: 0 2px 4px rgba(15,26,23,.05), 0 24px 50px -24px rgba(11,90,70,.35);
  --ease: cubic-bezier(.22,.68,.24,1);
}

/* ---------- 2. RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }

body {
  font-family: var(--body);
  font-size: var(--t-body);
  line-height: 1.68;
  color: var(--ink-2);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, iframe { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
ul, ol { padding-left: 1.15rem; }
table { border-collapse: collapse; width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--display);
  color: var(--ink);
  line-height: 1.16;
  letter-spacing: -0.018em;
  font-weight: 600;
}

:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--green); color: #fff; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: .7rem 1.2rem;
}
.skip-link:focus { left: 0; }

/* ---------- 3. LAYOUT ---------- */
.wrap { width: min(100% - (var(--gutter) * 2), var(--wrap)); margin-inline: auto; }
.read { width: min(100%, var(--read)); }
.section { padding-block: var(--sec-y); }
.wash { background: var(--wash); }
.dark { background: var(--ink); color: #AEBDB7; }
.dark h2, .dark h3, .dark strong { color: #fff; }

.grid { display: grid; gap: clamp(1rem, 2.2vw, 1.6rem); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }

.mt-1 { margin-top: .6rem; } .mt-2 { margin-top: 1.25rem; }
.mt-3 { margin-top: 2rem; }  .mt-4 { margin-top: 3rem; }

/* ---------- 4. TYPE ---------- */
.eyebrow {
  font-family: var(--mono); font-size: var(--t-label);
  letter-spacing: .16em; text-transform: uppercase; color: var(--green);
  display: block; margin-bottom: .85rem;
}
.dark .eyebrow { color: #6FC5A5; }

.h-hero { font-size: var(--t-hero); }
.h-1 { font-size: var(--t-h1); }
.h-2 { font-size: var(--t-h2); }
.h-3 { font-size: var(--t-h3); }

.lead { font-size: clamp(1.06rem, 1.5vw, 1.2rem); color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: var(--t-small); }

/* Long-form article body */
.prose > * + * { margin-top: 1.15rem; }
.prose h2 { font-size: var(--t-h2); margin-top: 2.75rem; }
.prose h3 { font-size: var(--t-h3); margin-top: 2rem; }
.prose h2 + p, .prose h3 + p { margin-top: .85rem; }
.prose ul, .prose ol { display: grid; gap: .6rem; }
.prose li::marker { color: var(--green); }
.prose a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { background: var(--green-soft); }
.prose strong { color: var(--ink); }

/* ---------- 5. BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.4rem; border-radius: var(--r-sm);
  border: 1px solid transparent; font-weight: 700; font-size: .95rem;
  cursor: pointer; text-decoration: none;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dk); }
.btn-ghost { border-color: var(--line); background: var(--paper); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-light { background: #fff; color: var(--ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: .7rem; }

.link-arrow { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; color: var(--green); text-decoration: none; }
.link-arrow::after { content: "→"; transition: transform .2s var(--ease); }
.link-arrow:hover::after { transform: translateX(3px); }

/* ---------- 6. HEADER ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .3s var(--ease);
}
.site-header.is-stuck { border-bottom-color: var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; height: 72px; }

.logo { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 8px; background: var(--green);
  color: #fff; font-family: var(--mono); font-size: .78rem; font-weight: 600;
  display: grid; place-items: center; flex-shrink: 0; letter-spacing: -.02em;
}
.logo-text { font-family: var(--display); font-size: 1.16rem; font-weight: 600; color: var(--ink); letter-spacing: -.02em; line-height: 1.1; }
.logo-text span { display: block; font-family: var(--mono); font-size: .58rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 400; }

.nav-links { display: flex; align-items: center; gap: 1.6rem; list-style: none; padding: 0; }
.nav-links a { font-size: .93rem; font-weight: 600; color: var(--ink-2); text-decoration: none; padding-block: .3rem; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.nav-links a:hover { color: var(--ink); border-bottom-color: var(--line); }
.nav-links a[aria-current="page"] { color: var(--green); border-bottom-color: var(--green); }

.nav-end { display: flex; align-items: center; gap: .7rem; }
.burger { display: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); cursor: pointer; padding: 0; place-items: center; }
.burger span { display: block; width: 17px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
.burger span + span { margin-top: 4px; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.mobile-menu {
  position: fixed; inset: 72px 0 0; z-index: 55; background: var(--paper);
  padding: var(--gutter); display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
  overflow-y: auto;
}
.mobile-menu.is-open { opacity: 1; visibility: visible; transform: none; }
.mobile-menu a { font-family: var(--display); font-size: 1.4rem; color: var(--ink); text-decoration: none; padding: .65rem 0; border-bottom: 1px solid var(--line-2); }
.mobile-menu .btn { margin-top: 1.25rem; justify-content: center; }
body.menu-open { overflow: hidden; }

.progress-bar { position: fixed; top: 0; left: 0; height: 3px; z-index: 70; background: var(--green); width: 0; transition: width .1s linear; }

/* ---------- 7. HERO ---------- */
.hero { padding-block: clamp(2.5rem, 5vw, 4rem) clamp(1.5rem, 3vw, 2.5rem); }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.hero h1 { max-width: 22ch; }
.hero .lead { max-width: 62ch; margin-top: 1.1rem; }

.trust-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; list-style: none; padding: 0; }
.trust-row li {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--green-dk); background: var(--green-soft);
  padding: .38rem .7rem; border-radius: 999px;
}

/* ---------- 8. PAGE HEAD ---------- */
.page-head { padding-block: clamp(2.2rem, 4.5vw, 3.5rem) clamp(1.4rem, 3vw, 2.2rem); border-bottom: 1px solid var(--line); background: var(--wash); }
.breadcrumb { font-family: var(--mono); font-size: var(--t-label); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .9rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--green); }
.page-head h1 { max-width: 24ch; }
.page-head .lead { margin-top: .9rem; max-width: 68ch; }

.byline { display: flex; align-items: center; gap: .7rem; margin-top: 1.4rem; font-size: var(--t-small); }
.byline img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.byline strong { color: var(--ink); display: block; }
.byline span { color: var(--muted); font-family: var(--mono); font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; }

/* ---------- 9. ARTICLE LAYOUT + TOC ---------- */
.article { display: grid; grid-template-columns: minmax(0,1fr) 260px; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.toc { position: sticky; top: 96px; border-left: 2px solid var(--line); padding-left: 1.1rem; }
.toc h4 { font-family: var(--mono); font-size: var(--t-label); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: .8rem; }
.toc ul { list-style: none; padding: 0; display: grid; gap: .5rem; }
.toc a { font-size: .865rem; color: var(--muted); text-decoration: none; line-height: 1.4; display: block; transition: color .2s; }
.toc a:hover { color: var(--ink); }
.toc a.is-active { color: var(--green); font-weight: 700; }

/* ---------- 10. CALLOUTS / CARDS ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(1.25rem, 2.2vw, 1.8rem); height: 100%; }
.card h3 { margin-bottom: .5rem; }
.card p { color: var(--muted); font-size: .95rem; }
.card-num { font-family: var(--mono); font-size: var(--t-label); letter-spacing: .12em; color: var(--green); display: block; margin-bottom: .7rem; }

.note {
  border-left: 3px solid var(--green); background: var(--green-soft);
  padding: 1.1rem 1.3rem; border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.note.warn { border-left-color: var(--gold); background: var(--gold-soft); }
.note.inside-note { border-left-color: var(--inside); background: var(--inside-soft); }
.note p { font-size: .95rem; }
.note strong { color: var(--ink); }

.keypoint {
  border: 1px solid var(--line); border-radius: var(--r);
  padding: clamp(1.2rem, 2.4vw, 1.7rem); background: var(--wash);
}
.keypoint .eyebrow { margin-bottom: .6rem; }

/* Semantic pills — rust = inside, green = outside */
.pill { display: inline-block; font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; padding: .3rem .6rem; border-radius: 999px; }
.pill-inside  { background: var(--inside-soft);  color: var(--inside); }
.pill-outside { background: var(--outside-soft); color: var(--outside); }
.pill-neutral { background: var(--wash); color: var(--muted); }

/* ---------- 11. TABLES ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r); }
.data-table { font-size: .93rem; min-width: 560px; }
.data-table th {
  background: var(--ink); color: #fff; text-align: left; padding: .8rem .9rem;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 500;
}
.data-table th.col-inside  { background: var(--inside); }
.data-table th.col-outside { background: var(--outside); }
.data-table td { padding: .85rem .9rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:nth-child(even) { background: var(--wash); }
.data-table td:first-child { font-weight: 700; color: var(--ink); }
.table-note { font-size: var(--t-small); color: var(--muted); margin-top: .7rem; }

/* ---------- 12. CHECKLIST ---------- */
.checklist { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.checklist-head { display: grid; grid-template-columns: 1fr 150px 150px; background: var(--ink); color: #fff; }
.checklist-head div { padding: .75rem .9rem; font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; }
.checklist-head div:nth-child(2) { background: var(--inside); }
.checklist-head div:nth-child(3) { background: var(--outside); }
.checklist-row { display: grid; grid-template-columns: 1fr 150px 150px; border-bottom: 1px solid var(--line-2); font-size: .9rem; }
.checklist-row:last-child { border-bottom: none; }
.checklist-row:nth-child(even) { background: var(--wash); }
.checklist-row > div { padding: .8rem .9rem; }
.checklist-row .q { font-weight: 700; color: var(--ink); }
.checklist-row .in  { color: var(--inside); }
.checklist-row .out { color: var(--outside); }
@media (max-width: 700px) {
  .checklist-head { display: none; }
  .checklist-row { grid-template-columns: 1fr; gap: 0; padding-block: .4rem; }
  .checklist-row .in::before  { content: "Inside IR35: "; font-weight: 700; }
  .checklist-row .out::before { content: "Outside IR35: "; font-weight: 700; }
  .checklist-row > div { padding-block: .3rem; }
}

/* ---------- 13. TIMELINE ---------- */
.timeline { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 108px 1fr; gap: 1.25rem; padding-block: 1.15rem; border-top: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 1px solid var(--line); }
.tl-year { font-family: var(--mono); font-weight: 600; color: var(--green); font-size: .95rem; }
.tl-item p { font-size: .95rem; color: var(--muted); }
@media (max-width: 560px) { .tl-item { grid-template-columns: 1fr; gap: .2rem; } }

/* ---------- 14. ACCORDION (FAQ) ---------- */
.acc-item { border-bottom: 1px solid var(--line); }
.acc-item:first-child { border-top: 1px solid var(--line); }
.acc-btn {
  width: 100%; background: none; border: 0; cursor: pointer; text-align: left;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1.25rem;
  padding: 1.15rem 0; font-family: var(--display); font-size: clamp(1rem, 1.7vw, 1.14rem);
  font-weight: 600; color: var(--ink); line-height: 1.35;
}
.acc-icon { flex-shrink: 0; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; font-size: .95rem; color: var(--green); margin-top: .1rem; transition: transform .3s var(--ease), background .3s, color .3s; }
.acc-btn[aria-expanded="true"] .acc-icon { transform: rotate(45deg); background: var(--green); color: #fff; border-color: var(--green); }
.acc-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); }
.acc-panel > div { overflow: hidden; }
.acc-item.is-open .acc-panel { grid-template-rows: 1fr; }
.acc-panel p { color: var(--muted); padding-bottom: 1.2rem; font-size: .95rem; }
.acc-panel p + p { padding-bottom: 1.2rem; margin-top: -.6rem; }

/* ---------- 15. POST CARDS ---------- */
.post-card { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--paper); display: flex; flex-direction: column; height: 100%; text-decoration: none; transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.post-card .thumb { background: var(--wash); border-bottom: 1px solid var(--line); }
.post-card .thumb img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.post-card .body { padding: 1.25rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.post-card h3 { font-size: 1.1rem; }
.post-card p { color: var(--muted); font-size: .92rem; }
.post-card .meta { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: auto; padding-top: .6rem; }

/* ---------- 16. FIGURES / PLACEHOLDERS ---------- */
figure { margin: 0; }
.fig { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--wash); }
.fig img { width: 100%; }
figcaption { font-size: var(--t-small); color: var(--muted); padding: .7rem .9rem; border-top: 1px solid var(--line); background: var(--paper); }

/* Screenshots supplied at small pixel sizes — do not upscale them */
.fig-sm { max-width: 560px; margin-inline: auto; }
.fig-sm img { background: #fff; }

/* Figures inside .prose keep their own spacing rather than inheriting flow margin */
.prose > figure { margin-block: 1.6rem; }
.prose figcaption { font-family: var(--body); }

/* Inline diagrams built in HTML instead of images */
.diagram { border: 1px solid var(--line); border-radius: var(--r); padding: clamp(1.25rem, 3vw, 2rem); background: var(--paper); }
.branch { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.branch-box { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 1rem 1.1rem; background: var(--wash); }
.branch-box.in  { border-color: var(--inside);  background: var(--inside-soft); }
.branch-box.out { border-color: var(--outside); background: var(--outside-soft); }
.branch-box h4 { font-size: 1rem; margin-bottom: .35rem; }
.branch-box p { font-size: .88rem; color: var(--ink-2); }
.diagram-q { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: center; }
@media (max-width: 560px) { .branch { grid-template-columns: 1fr; } }

.test-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.test-card { border: 1px solid var(--line); border-radius: var(--r); padding: 1.25rem; background: var(--paper); }
.test-card .n { font-family: var(--mono); font-size: 1.6rem; color: var(--green); line-height: 1; display: block; margin-bottom: .6rem; }
.test-card h4 { font-size: 1.02rem; margin-bottom: .4rem; }
.test-card p { font-size: .88rem; color: var(--muted); }
@media (max-width: 780px) { .test-grid { grid-template-columns: 1fr; } }

/* ---------- 17. FORM ---------- */
.form { display: grid; gap: 1rem; }
.field-set { display: grid; gap: .4rem; }
.field-set label { font-size: .85rem; font-weight: 700; color: var(--ink); }
.field-set input, .field-set textarea, .field-set select {
  width: 100%; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper);
  transition: border-color .2s, box-shadow .2s;
}
.field-set input:focus, .field-set textarea:focus, .field-set select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(11,90,70,.12); }
.field-set textarea { resize: vertical; min-height: 130px; }
.field-set .err { font-size: .78rem; color: #B03A2E; display: none; }
.field-set.is-invalid input, .field-set.is-invalid textarea { border-color: #B03A2E; }
.field-set.is-invalid .err { display: block; }
.form-status { padding: .85rem 1rem; border-radius: var(--r-sm); background: var(--green-soft); color: var(--green-dk); font-size: .92rem; font-weight: 600; display: none; }
.form-status.is-visible { display: block; }

.contact-line { display: flex; gap: .9rem; padding-block: 1rem; border-bottom: 1px solid var(--line); }
.contact-line:first-child { border-top: 1px solid var(--line); }
.contact-line .ci { color: var(--green); font-size: 1.05rem; }
.contact-line strong { display: block; color: var(--ink); font-size: .93rem; }
.contact-line span, .contact-line a { color: var(--muted); font-size: .93rem; }

/* ---------- 18. CTA + FOOTER ---------- */
.cta-band { background: var(--ink); border-radius: var(--r-lg); padding: clamp(1.8rem, 4vw, 3rem); color: #AEBDB7; }
.cta-band h2 { color: #fff; max-width: 22ch; }
.cta-band p { margin-top: .8rem; max-width: 55ch; }

.site-footer { border-top: 1px solid var(--line); padding-block: clamp(2.5rem, 5vw, 3.5rem) 1.75rem; background: var(--wash); }
.footer-grid { display: grid; grid-template-columns: 1.7fr 1fr 1fr 1fr; gap: clamp(1.5rem, 3.5vw, 2.5rem); }
.footer-grid h4 { font-family: var(--mono); font-size: var(--t-label); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: .9rem; }
.footer-grid ul { list-style: none; padding: 0; display: grid; gap: .5rem; }
.footer-grid a { font-size: .9rem; color: var(--ink-2); text-decoration: none; }
.footer-grid a:hover { color: var(--green); text-decoration: underline; }
.footer-about p { font-size: .9rem; color: var(--muted); margin-top: .8rem; max-width: 36ch; }
.footer-bottom { margin-top: clamp(1.75rem, 3.5vw, 2.5rem); padding-top: 1.25rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; justify-content: space-between; font-size: var(--t-small); color: var(--muted); }

.to-top { position: fixed; right: max(1rem, 2vw); bottom: max(1rem, 2vw); z-index: 50; width: 42px; height: 42px; border-radius: var(--r-sm); background: var(--ink); color: #fff; border: 0; cursor: pointer; display: grid; place-items: center; opacity: 0; visibility: hidden; transition: all .3s var(--ease); }
.to-top.is-visible { opacity: 1; visibility: visible; }
.to-top:hover { background: var(--green); }

/* ==========================================================================
   19. CALCULATOR
   IDs and data-attributes below are consumed by assets/js/calculator.js
   ========================================================================== */
.calc {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--paper); box-shadow: var(--shadow-lg); overflow: hidden;
}
.calc-head { padding: clamp(1.1rem, 2.5vw, 1.6rem) clamp(1.1rem, 3vw, 2rem); border-bottom: 1px solid var(--line); background: var(--ink); color: #fff; display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; align-items: baseline; justify-content: space-between; }
.calc-head h2 { color: #fff; font-size: clamp(1.15rem, 2.2vw, 1.45rem); }
.calc-head p { font-size: var(--t-small); color: #9FB3AC; max-width: 34ch; }
.calc-body { padding: clamp(1.1rem, 3vw, 2rem); }

.calc-block { padding-block: 1.4rem; border-top: 1px solid var(--line-2); }
.calc-block:first-child { padding-top: 0; border-top: none; }
.calc-label { font-size: .93rem; font-weight: 700; color: var(--ink); margin-bottom: .2rem; }
.calc-help { font-size: .82rem; color: var(--muted); margin-bottom: .8rem; }

.rate-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.rate-input { flex: 1 1 200px; position: relative; }
.rate-input .cur { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-family: var(--display); font-size: 1.2rem; color: var(--muted); pointer-events: none; }
.rate-input input { width: 100%; font-family: var(--display); font-size: 1.5rem; padding: .7rem .8rem .7rem 2rem; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff; -moz-appearance: textfield; }
.calc input[type=number]::-webkit-outer-spin-button, .calc input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.calc input:focus, .calc select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(11,90,70,.12); }

.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--r-sm); overflow: hidden; flex-shrink: 0; }
.seg button { font-size: .85rem; font-weight: 700; padding: .55rem 1rem; border: 0; background: #fff; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.active { background: var(--ink); color: #fff; }
.seg.sm button { font-size: .72rem; padding: .4rem .65rem; }

.status-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.status-card { border: 2px solid var(--line); border-radius: var(--r-sm); padding: .95rem 1.05rem; background: #fff; cursor: pointer; text-align: left; transition: border-color .2s, background .2s; }
.status-card .label { display: block; font-family: var(--display); font-size: 1.08rem; font-weight: 600; color: var(--ink); margin-bottom: .2rem; }
.status-card .desc { display: block; font-size: .8rem; color: var(--muted); line-height: 1.45; }
.status-card[data-status="inside"].active  { border-color: var(--inside);  background: var(--inside-soft); }
.status-card[data-status="inside"].active .label  { color: var(--inside); }
.status-card[data-status="outside"].active { border-color: var(--outside); background: var(--outside-soft); }
.status-card[data-status="outside"].active .label { color: var(--outside); }
@media (max-width: 520px) { .status-toggle { grid-template-columns: 1fr; } }

.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip { font-size: .85rem; font-weight: 700; padding: .5rem 1rem; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); cursor: pointer; }
.chip.active { border-color: var(--green); background: var(--green); color: #fff; }
.chip[disabled] { opacity: .4; cursor: not-allowed; }
.chips-note { font-size: .82rem; color: var(--muted); margin-top: .7rem; }

.subfield { display: none; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.subfield.show { display: block; }

.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .calc-grid { grid-template-columns: 1fr; } }
.cf { display: flex; flex-direction: column; gap: .35rem; }
.cf label { font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.cf-input { position: relative; }
.cf-input .cur-sm { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: .85rem; color: var(--muted); }
.cf-input input { padding-left: 1.6rem !important; }
.cf input, .cf select { font-size: .92rem; padding: .6rem .75rem; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff; width: 100%; -moz-appearance: textfield; }
.cf-hint { font-size: .74rem; color: var(--muted); }

.adv-toggle { display: flex; align-items: center; gap: .5rem; font-size: .88rem; font-weight: 700; color: var(--green); cursor: pointer; user-select: none; background: none; border: 0; padding: 0; }
.adv-toggle .chev { transition: transform .2s var(--ease); display: inline-block; }
.adv-toggle.open .chev { transform: rotate(90deg); }
.adv { display: none; margin-top: 1.2rem; }
.adv.open { display: block; }
.exp-row { display: flex; gap: .7rem; align-items: center; margin-bottom: .6rem; }
.exp-row label { flex: 0 0 110px; font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.exp-row .cf-input { flex: 1; }

.calc-submit { padding-top: 1.4rem; border-top: 1px solid var(--line-2); display: flex; justify-content: center; }
.calc-submit .btn { padding: .95rem 2.4rem; font-size: 1rem; }

/* --- Results --- */
.results { display: none; border-top: 1px solid var(--line); }
.results.show { display: block; }
.results-panel { padding: clamp(1.1rem, 3vw, 2rem); border-bottom: 1px solid var(--line); }
.results-panel:last-child { border-bottom: none; }
.results-top { display: flex; align-items: baseline; justify-content: space-between; gap: .7rem; flex-wrap: wrap; }
.results-top h3 { font-size: 1.12rem; }
.big-figure { font-family: var(--display); font-size: clamp(2.4rem, 7vw, 3.6rem); font-weight: 600; line-height: 1; margin: .8rem 0 .2rem; letter-spacing: -.02em; }
.big-figure-label { font-size: .88rem; color: var(--muted); margin-bottom: 1.1rem; }

.breakdown { font-size: .93rem; }
.breakdown td { padding: .6rem .2rem; border-bottom: 1px solid var(--line-2); }
.breakdown td:first-child { color: var(--muted); }
.breakdown td:last-child { text-align: right; font-family: var(--mono); font-weight: 500; color: var(--ink); white-space: nowrap; }
.breakdown tr.total td { border-top: 2px solid var(--ink); border-bottom: none; padding-top: .9rem; }
.breakdown tr.total td:first-child { color: var(--ink); font-weight: 700; }
.breakdown tr.total td:last-child { font-size: 1.05rem; font-weight: 700; color: var(--green); }
.eff-rate { font-size: .88rem; color: var(--muted); margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.eff-rate strong { color: var(--ink); font-size: 1rem; }

.compare-table { font-size: .9rem; min-width: 480px; }
.compare-table th { padding: .7rem .6rem; font-family: var(--mono); font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; font-weight: 500; color: #fff; background: var(--ink); text-align: right; }
.compare-table th:first-child { text-align: left; }
.compare-table th.ci { background: var(--inside); }
.compare-table th.co { background: var(--outside); }
.compare-table td { padding: .7rem .6rem; border-bottom: 1px solid var(--line-2); text-align: right; font-family: var(--mono); white-space: nowrap; }
.compare-table td:first-child { text-align: left; font-family: var(--body); font-weight: 700; color: var(--ink-2); }
.compare-table td.col-inside { color: var(--inside); }
.compare-table td.col-outside { color: var(--outside); }
.compare-table tr.row-total td { border-top: 2px solid var(--ink); border-bottom: none; font-weight: 700; font-size: .98rem; }
.compare-table tr.row-diff td { border-bottom: none; font-weight: 700; color: var(--gold); }

.summary-card { background: var(--green); color: #fff; border-radius: var(--r); padding: 1.3rem 1.5rem; margin-top: 1.25rem; }
.summary-card .stamp { font-family: var(--mono); font-size: .66rem; letter-spacing: .11em; text-transform: uppercase; opacity: .75; margin-bottom: .5rem; }
.summary-card p.headline { font-family: var(--display); font-size: 1.14rem; line-height: 1.4; }
.summary-card strong { color: #F2D08A; }

.uplift-result { background: var(--gold-soft); border: 1.5px solid #EBD5A6; border-radius: var(--r); padding: 1.4rem; text-align: center; }
.uplift-figure { font-family: var(--display); font-size: clamp(1.7rem, 4.5vw, 2.3rem); font-weight: 600; color: #7A5A16; line-height: 1.1; }
.uplift-text { font-size: .9rem; color: #7A5A16; margin-top: .4rem; }
.uplift-text strong { color: #5C430F; }

.assumptions { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.assumptions summary { font-size: .85rem; font-weight: 700; color: var(--green); cursor: pointer; }
.assumptions ul { margin-top: .8rem; font-size: .84rem; color: var(--muted); display: grid; gap: .4rem; }
.calc-disclaimer { font-size: .8rem; color: var(--muted); text-align: center; padding: 1rem clamp(1.1rem, 3vw, 2rem) 1.4rem; }

/* ---------- 20. REVEAL ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- 21. RESPONSIVE ---------- */
@media (max-width: 1080px) {
  .article { grid-template-columns: 1fr; }
  .toc { position: static; border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 1.25rem; order: -1; }
  .toc ul { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 940px) {
  .nav-links, .nav-end .btn { display: none; }
  .burger { display: grid; }
  .g-4, .g-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-about { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .toc ul { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .btn-row .btn { flex: 1 1 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .mobile-menu, .to-top, .progress-bar, .toc, .cta-band { display: none !important; }
  body { color: #000; font-size: 11pt; }
  .calc { box-shadow: none; }
}
