/* Torke website v1. Every value comes from tokens.css, which mirrors the
   Torke Design System in Figma (file 4aWZhu3IYaot29xXjP0On2) and the
   torke-brand-v1 skill. One rule per role: no page and no section sets its
   own heading, paragraph, card or button style. */

@font-face { font-family: 'Lato'; src: url('fonts/lato-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Lato'; src: url('fonts/lato-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Lato'; src: url('fonts/lato-900.woff2') format('woff2'); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sora'; src: url('fonts/sora-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sora'; src: url('fonts/sora-800.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }

/* ---- Type roles, from the Figma text styles and the brand type table ---- */
:root {
  --h1-size: clamp(36.8px, 5.704vw, 62.56px);
  --h1-lh: 1.196;
  --h1-track: -0.025em;
  --h2-size: clamp(28.52px, 3.68vw, 40.48px);
  --h2-lh: 1.4;
  --h2-track: -0.02em;
  --h3-size: 22px;
  --h3-lh: 1.426;
  --h3-track: -0.015em;
  --body-size: 18px;
  --body-lh: 1.62;
  --label-size: 12px;
  --label-lh: 1.3;
  --label-track: 0.1em;
  --index-size: 13px;
  --ui-size: 14px;
  --ui-lh: 1.3;
  --btn-size: 16px;
  --measure: 65ch;
  --band: var(--s7);
  --card-pad: var(--s4);
  --gutter: var(--s3);
}
@media (max-width: 640px) {
  :root { --body-size: 17px; --band: 56px; --card-pad: var(--s3); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: var(--body-lh);
  font-weight: 400;
}
img { display: block; max-width: 100%; height: auto; }

h1, h2, h3 { font-family: var(--font-heading); font-weight: 800; margin: 0; text-wrap: balance; color: inherit; }
h1 { font-size: var(--h1-size); line-height: var(--h1-lh); letter-spacing: var(--h1-track); }
h2 { font-size: var(--h2-size); line-height: var(--h2-lh); letter-spacing: var(--h2-track); }
h3 { font-size: var(--h3-size); line-height: var(--h3-lh); letter-spacing: var(--h3-track); }

p, li, dd { font-size: var(--body-size); line-height: var(--body-lh); text-wrap: pretty; }
p { margin: 0; max-width: var(--measure); }
p + p { margin-top: var(--s2); }
ul, ol { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }

.label {
  display: block;
  font-family: var(--font-body);
  font-size: var(--label-size);
  line-height: var(--label-lh);
  font-weight: 700;
  letter-spacing: var(--label-track);
  text-transform: uppercase;
  color: var(--text-2);
}

a { color: inherit; }
.link, p a, li a, dd a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--aqua);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.link:hover, p a:hover, li a:hover, dd a:hover { text-decoration-color: var(--black); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ---- Shell and bands ---- */
.shell { width: min(var(--shell), 100% - 2 * var(--s3)); margin-inline: auto; }
.band { padding-block: var(--band); }
.band--blush { background: var(--blush); color: var(--text); }
.band--quiet { background: var(--periwinkle); color: var(--text); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.band--dark { background: var(--black); color: var(--text-on-dark); }

.band--dark .label { color: var(--accent-on-dark); }
.band--dark p, .band--dark li, .band--dark dd { color: var(--text-on-dark); }
.band--dark .link, .band--dark p a, .band--dark li a, .band--dark dd a { color: var(--text-on-dark); text-decoration-color: var(--aqua); }
.band--dark .link:hover, .band--dark p a:hover { text-decoration-color: var(--white); }
.band--dark :focus-visible { outline-color: var(--focus-on-dark); }

/* Section head: 24px from heading to intro, 48px from intro to what follows */
.head > * + * { margin-top: var(--s3); }
.head > p + p { margin-top: var(--s2); }
.head + * { margin-top: var(--s5); }
.head { max-width: var(--read); }

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--black); color: var(--text-on-dark);
  border-bottom: 1px solid var(--line-on-dark);
}
.site-header .shell { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 80px; }
.brand { display: block; flex: none; }
.brand img { width: 160px; height: auto; }
.nav { display: flex; align-items: center; gap: var(--s4); }
.nav ul { display: flex; gap: var(--s3); }
.nav-link {
  font-family: var(--font-body); font-size: var(--ui-size); line-height: var(--ui-lh); font-weight: 700;
  color: var(--text-on-dark); text-decoration: none;
  padding-block: var(--s1);
  border-bottom: 2px solid transparent;
}
.nav-link:hover, .nav-link[aria-current="page"] { border-bottom-color: var(--aqua); }
.site-header :focus-visible { outline-color: var(--focus-on-dark); }

.menu { display: none; }
.menu summary {
  list-style: none; cursor: pointer;
  font-family: var(--font-body); font-size: var(--ui-size); line-height: var(--ui-lh); font-weight: 700;
  color: var(--text-on-dark);
  padding: var(--s1) var(--s2);
  border: 1.5px solid var(--white); border-radius: var(--r-ctrl);
}
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { background: var(--white); color: var(--black); }
.menu-panel {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--black); border-bottom: 1px solid var(--line-on-dark);
  padding: var(--s3) var(--s3) var(--s4);
}
.menu-panel ul { display: grid; gap: var(--s2); }
.menu-panel .btn { margin-top: var(--s3); }

@media (max-width: 900px) {
  .nav { display: none; }
  .menu { display: block; }
}

/* ---- Buttons: one primary, one secondary, same metrics everywhere ---- */
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-size: var(--btn-size); line-height: var(--ui-lh); font-weight: 700;
  padding: var(--s2) var(--s3);
  border-radius: var(--r-ctrl);
  border: 1.5px solid transparent;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.btn--primary { background: var(--aqua); color: var(--black); border-color: var(--aqua); }
.btn--primary:hover { background: var(--black); color: var(--aqua); border-color: var(--black); }
.btn--secondary { background: transparent; color: var(--black); border-color: var(--black); }
.btn--secondary:hover { background: var(--black); color: var(--white); }
.band--dark .btn--primary:hover, .site-header .btn--primary:hover { border-color: var(--aqua); }
.band--dark .btn--secondary { color: var(--white); border-color: var(--white); }
.band--dark .btn--secondary:hover { background: var(--white); color: var(--black); }

/* ---- Hero, shared by every page ---- */
.hero { padding-block: var(--band); }
.hero-grid { display: grid; gap: var(--s6); }
.hero-copy > * + * { margin-top: var(--s3); }
.hero-copy .actions { margin-top: var(--s4); }
.hero-copy { max-width: 760px; }

/* ---- Cards ---- */
.card {
  background: var(--surface); color: var(--text);
  border-radius: var(--r-card);
  padding: var(--card-pad);
  box-shadow: var(--shadow);
}
.band--dark .card { background: transparent; color: var(--text-on-dark); border: 1px solid var(--line-on-dark); box-shadow: none; }
.card > * + * { margin-top: var(--s2); }
.card > .label + p { margin-top: var(--s1); }

/* Icon heading group: 58px box, 38px drawing, 24px to the copy */
.icon {
  display: inline-grid; place-items: center;
  width: var(--icon-box); height: var(--icon-box);
  border-radius: var(--r-card);
  background: var(--periwinkle); color: var(--black);
}
.icon svg { width: var(--icon-size); height: var(--icon-size); }
.icon svg * { fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.icon svg .icon-fill { fill: currentColor; stroke: none; }
.card > .icon + h3 { margin-top: var(--s3); }
@media (max-width: 640px) {
  .icon { width: var(--icon-box-mobile); height: var(--icon-box-mobile); }
  .icon svg { width: var(--icon-size-mobile); height: var(--icon-size-mobile); }
}

/* ---- Layouts: each section picks one ---- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gutter); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gutter); }
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gutter); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s6); align-items: start; }
.split > .head + * { margin-top: 0; }
@media (max-width: 900px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 1080px) {
  .split { grid-template-columns: 1fr; gap: var(--s5); }
  /* a heading alone keeps the 24px heading-to-intro gap when the split stacks */
  .split > .head:has(> h2:only-child) { margin-bottom: calc(var(--s3) - var(--s5)); }
}
@media (max-width: 640px) { .grid-4 { grid-template-columns: 1fr; } }

.prose > * + * { margin-top: var(--s2); }

/* Ownership panels: periwinkle for what the client keeps, black for what Torke runs */
.panel { border-radius: var(--r-card); padding: var(--card-pad); }
.panel > * + * { margin-top: var(--s2); }
.panel--client { background: var(--periwinkle); color: var(--black); }
.panel--torke { background: var(--black); color: var(--white); }
.panel--torke li { color: var(--white); }
.ticks > li { position: relative; padding-left: var(--s4); }
.ticks > li + li { margin-top: var(--s1); }
.ticks > li::before {
  content: ""; position: absolute; left: var(--s1); top: 0.7em;
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}

/* Numbered steps, index numbers use the Figma Text/Index style */
.steps { counter-reset: step; display: grid; gap: var(--s3); max-width: 880px; }
.steps > li {
  counter-increment: step;
  display: grid; grid-template-columns: var(--s5) 1fr; gap: var(--s2);
  padding-top: var(--s3); border-top: 1px solid var(--line);
}
.steps > li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-body); font-size: var(--index-size); line-height: var(--body-lh); font-weight: 700;
  color: var(--text-2);
}
.band--dark .steps > li { border-top-color: var(--line-on-dark); }
.band--dark .steps > li::before { color: var(--text-2-on-dark); }

/* Hero work visual */
.cells { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gutter); }
@media (max-width: 1080px) { .cells { grid-template-columns: repeat(2, 1fr); } }
.cells .card > p { margin-top: var(--s1); }
@media (max-width: 640px) { .cells { grid-template-columns: 1fr; } }

/* ---- Tables, one style for every table ---- */
.table { width: 100%; border-collapse: collapse; table-layout: fixed; border-bottom: 1px solid var(--line); }
.table thead td { width: 22%; border-top: 0; border-bottom: 1.5px solid var(--black); }
.table th, .table td { text-align: left; vertical-align: top; padding: var(--s3) var(--s3) var(--s3) 0; border-top: 1px solid var(--line); }
.table thead th {
  font-family: var(--font-heading); font-size: var(--h3-size); line-height: var(--h3-lh); letter-spacing: var(--h3-track); font-weight: 800;
  border-top: 0; border-bottom: 1.5px solid var(--black);
}
.table tbody th {
  font-family: var(--font-body); font-size: var(--body-size); line-height: var(--body-lh); font-weight: 700;
  width: 22%;
}
.table td { font-size: var(--body-size); line-height: var(--body-lh); }
@media (max-width: 900px) {
  .table, .table thead, .table tbody, .table tr, .table th, .table td { display: block; width: 100%; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table tbody tr { border-top: 1px solid var(--line); padding-block: var(--s3); }
  .table tbody th, .table td { border-top: 0; padding: 0; }
  .table tbody th { width: 100%; }
  .table td { margin-top: var(--s2); }
  .table td::before {
    content: attr(data-label); display: block; margin-bottom: var(--s1);
    font-size: var(--label-size); line-height: var(--label-lh); font-weight: 700; letter-spacing: var(--label-track); text-transform: uppercase; color: var(--text-2);
  }
}

/* ---- Definition list used in the Diagnostic checks ---- */
.checks > div { padding-top: var(--s3); border-top: 1px solid var(--line); }
.checks > div + div { margin-top: var(--s3); }
.checks dt { font-family: var(--font-heading); font-size: var(--h3-size); line-height: var(--h3-lh); letter-spacing: var(--h3-track); font-weight: 800; }
.checks dd { margin-top: var(--s2); max-width: var(--measure); }
.checks dd + dd { margin-top: var(--s2); }

/* ---- Close band ---- */
.close .head { max-width: var(--read); }
.close .actions { margin-top: var(--s4); }

/* ---- Form ---- */
.form > * + * { margin-top: var(--s3); }
.field label { display: block; font-family: var(--font-body); font-size: var(--ui-size); line-height: var(--ui-lh); font-weight: 700; margin-bottom: var(--s1); }
.field input, .field textarea {
  width: 100%;
  font-family: var(--font-body); font-size: var(--body-size); line-height: var(--body-lh);
  color: var(--black); background: var(--white);
  border: 1px solid var(--line); border-radius: var(--r-ctrl);
  padding: var(--s1) var(--s2);
}
.field textarea { min-height: 136px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-2); }
.field input:focus, .field textarea:focus { outline: none; border: 2px solid var(--black); padding: 7px 15px; }
.field [aria-invalid="true"] { border: 2px solid var(--black); padding: 7px 15px; }
.error { margin-top: var(--s1); font-size: var(--ui-size); line-height: var(--ui-lh); font-weight: 900; color: var(--black); }
.error[hidden] { display: none; }
.form-note { color: var(--text-2); }

/* ---- FAQ, question headings keep the h3 role with the documented 1.495 line height ---- */
.faq { max-width: 880px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); padding-block: var(--s3); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary h3 { line-height: 1.495; }
.faq summary::after {
  content: "+"; flex: none;
  font-family: var(--font-heading); font-size: var(--h3-size); line-height: 1.495; font-weight: 800;
}
.faq details[open] summary::after { content: "\2212"; }
.faq details > p { padding-bottom: var(--s3); }

/* ---- Footer ---- */
.site-footer { background: var(--black); color: var(--text-on-dark); border-top: 1px solid var(--line-on-dark); padding-block: var(--s6); }
.footer-top { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--s5); align-items: start; }
.footer-brand p { color: var(--text-on-dark); margin-top: var(--s3); max-width: 44ch; }
.footer-title { font-family: var(--font-body); font-size: var(--ui-size); line-height: var(--ui-lh); font-weight: 700; color: var(--text-2-on-dark); margin-bottom: var(--s2); }
.footer-col ul { display: grid; gap: var(--s1); }
.footer-col address { font-style: normal; display: grid; gap: var(--s1); font-size: var(--ui-size); line-height: var(--ui-lh); }
.footer-col address span { padding-block: var(--s1); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s2); margin-top: var(--s5); padding-top: var(--s3); border-top: 1px solid var(--line-on-dark); }
.footer-bottom small { font-size: var(--ui-size); line-height: var(--ui-lh); color: var(--text-2-on-dark); }
.site-footer :focus-visible { outline-color: var(--focus-on-dark); }
@media (max-width: 900px) { .footer-top { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 480px) { .footer-top { grid-template-columns: 1fr; } }

/* ---- Motion: each animation reports a state, and the page reads fully without it ---- */
.nav-link { transition: border-color 160ms var(--ease); }
.nav-link.is-active { border-bottom-color: var(--aqua); }

/* Method tracker: the step being read is marked, and the line fills behind the steps already read */
.steps--track > li { position: relative; }
.steps--track > li::after {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px;
  background: var(--black); transform: scaleX(0); transform-origin: left;
  transition: transform 420ms var(--ease);
}
.steps--track > li.is-done::after, .steps--track > li.is-current::after { transform: scaleX(1); }
.steps--track > li::before { justify-self: start; align-self: start; padding-inline: 0; border-radius: var(--r-pill); transition: background-color 200ms var(--ease), color 200ms var(--ease), padding 200ms var(--ease); }
.steps--track > li.is-current::before { background: var(--black); color: var(--aqua); padding-inline: var(--s1); }

/* Example invoice check */
.ledger { margin-top: var(--s5); padding: var(--s4); max-width: 880px; }
.ledger > * + * { margin-top: var(--s2); }
.ledger-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s2); }
.ledger-rows { margin-top: var(--s3); }
.ledger-rows > li { display: grid; grid-template-columns: 1fr auto; gap: var(--s3); align-items: center; padding: var(--s2); border-top: 1px solid var(--line); }
.ledger-rows > li:last-child { border-bottom: 1px solid var(--line); }
.chip {
  font-size: var(--ui-size); line-height: var(--ui-lh); font-weight: 700; white-space: nowrap;
  padding: var(--s1) var(--s2); border-radius: var(--r-pill); border: 1.5px solid var(--black);
  transition: background-color 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease);
}
.ledger-rows > li[data-billed="yes"] .chip { background: var(--aqua); border-color: var(--aqua); }
.ledger-rows > li[data-billed="no"] > span { color: var(--text-2); }
.ledger-rows > li > span { max-width: 60ch; transition: color 200ms var(--ease); }
.ledger-total { font-family: var(--font-heading); font-size: var(--h3-size); line-height: var(--h3-lh); font-weight: 800; padding-top: var(--s1); }
.ledger-replay { display: none; }
.js .ledger-replay { display: inline-flex; }
/* with the script running, rows wait as "Checking" until the panel is on screen */
.js .ledger-rows > li.is-pending .chip { background: transparent; border-color: var(--grey); color: var(--text-2); }
.js .ledger-rows > li.is-pending > span { color: var(--text); }
.js .ledger-rows > li.is-pending.is-reading { background: var(--blush); }
.ledger-rows > li { transition: background-color 200ms var(--ease); border-radius: 0; }
@media (max-width: 640px) {
  .ledger { padding: var(--s3); }
  .ledger-rows > li { grid-template-columns: 1fr; gap: var(--s1); }
  .chip { justify-self: start; white-space: normal; }
}

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--s2); top: var(--s2); z-index: 20; background: var(--aqua); color: var(--black); padding: var(--s1) var(--s2); border-radius: var(--r-ctrl); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.after-grid { margin-top: var(--s5); }
