/*
 * TRTactics — styled as the SFMS application is: the same "Workbench" tokens (silver desktop,
 * white cards, steel-blue accent, sharp 2px corners) and the same three type families. Light is
 * the default for everyone; dark is the graphite theme SFMS offers, chosen with the header button
 * (theme.js sets data-theme on <html>).
 *
 * The pages are written for business owners and managers, so reading comes first: 18px body text,
 * a 1.7 line height, text in the full-contrast ink colour, lines of about 65-75 characters, and
 * every button and question row at least 44px high.
 */

/* ============ "Workbench Light" ============ */
:root {
  --app-bg: #cdd4db;
  --window: #eaeef2;
  --window-bd: #98a3b0;
  --content: #f2f4f7;
  --header: #e8ecf0;
  --header-bd: #b3bcc7;
  --card: #ffffff;
  --card-bd: #c3ccd5;
  --divider: #d8dee4;
  --elevated: #eef1f4;
  --elevated-bd: #b3bcc7;
  --active: #d5e6f4;

  --text: #1a2431;
  --muted: #55616f;
  --faint: #8792a0;

  --accent: #2c6da3;
  --on-accent: #ffffff;
  --accent-tint: rgba(44, 109, 163, 0.10);
  --hover-tint: rgba(20, 30, 45, 0.045);

  --r: 2px;
  --t: .18s cubic-bezier(.2, .8, .2, 1);
  --shadow: 0 10px 26px rgba(28, 40, 56, 0.18), 0 1px 2px rgba(28, 40, 56, 0.12);

  --wrap: 1080px;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --display: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

/* ============ "Workbench Dark" ============ */
:root[data-theme="dark"] {
  --app-bg: #14171b;
  --window: #232830;
  --window-bd: #3a434e;
  --content: #1a1e24;
  --header: #20252c;
  --header-bd: #333b45;
  --card: #262c34;
  --card-bd: #39424d;
  --divider: #2f363f;
  --elevated: #2b323b;
  --elevated-bd: #3d4650;
  --active: #22405c;

  --text: #e5eaf0;
  --muted: #aab4bf;
  --faint: #6f7b88;

  --accent: #4a93d4;
  --on-accent: #ffffff;
  --accent-tint: rgba(74, 147, 212, 0.14);
  --hover-tint: rgba(255, 255, 255, 0.05);

  --shadow: 0 10px 26px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.50);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--app-bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--text);
  color: var(--content);
  border-radius: var(--r);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Header: the application's title bar ---- */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--header);
  border-bottom: 1px solid var(--header-bd);
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-height: 44px;
}

/* The company mark, as supplied: its own blues on a clear ground, so it sits on either theme. */
.mark {
  height: 32px;
  width: auto;
  display: block;
}

.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.01em;
}

/* The logo's wordmark sets "TR" in the brand blue and "Tactics" in ink. */
.brand-name .tr { color: var(--accent); }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  font-weight: 500;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--muted);
  padding: 0 14px;
  border-radius: var(--r);
  transition: background var(--t), color var(--t);
}
.nav a:hover { background: var(--hover-tint); color: var(--text); }

/* The page you are on: ink colour, heavier type and a rule under it. */
.nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 -3px 0 var(--accent);
}

.nav .nav-cta {
  color: var(--accent);
  font-weight: 600;
}

/* Same shape as the Settings bar's "Dark mode" button in the app. */
.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  margin-left: 6px;
  padding: 0 14px;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color var(--t), color var(--t);
}
.theme-btn:hover { border-color: var(--accent); }

/* ---- Hero: the workspace ground ---- */
.hero {
  padding: 80px 0 84px;
  background: var(--content);
  border-bottom: 1px solid var(--divider);
}

.eyebrow {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--muted);
  margin-bottom: 12px;
}

h1 {
  font-family: var(--display);
  font-size: clamp(32px, 5vw, 50px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
  max-width: 22ch;
}

h1 .accent { color: var(--accent); }

.hero-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  gap: 48px;
  align-items: center;
}

.hero-mark {
  width: 100%;
  height: auto;
  display: block;
}

.lede {
  margin-top: 22px;
  max-width: 62ch;
  font-size: 20px;
  line-height: 1.65;
}

.hero .prose { margin-top: 14px; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--r);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  transition: filter var(--t), border-color var(--t), background var(--t);
}

.btn.primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn.primary:hover { filter: brightness(1.08); }

.btn.ghost {
  background: var(--card);
  border-color: var(--elevated-bd);
  color: var(--text);
}
.btn.ghost:hover { border-color: var(--accent); }

/* ---- Sections ---- */
.section {
  padding: 80px 0;
  background: var(--content);
}

.section.alt {
  background: var(--window);
  border-top: 1px solid var(--header-bd);
  border-bottom: 1px solid var(--header-bd);
}

h2 {
  font-family: var(--display);
  font-size: clamp(27px, 3.6vw, 38px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 600;
  max-width: 28ch;
}

h3 {
  font-size: 20px;
  line-height: 1.35;
  font-weight: 600;
}

/* Running text: one comfortable column, full-contrast ink. */
.prose { max-width: 64ch; }
.prose > * + * { margin-top: 1.1em; }
.section h2 + .prose,
.section h2 + .cards,
.section h2 + .faq,
.section h2 + .flow { margin-top: 22px; }

.prose strong { font-weight: 600; }

/* A plain-words aside: what a technical word means. */
.gloss {
  border-left: 4px solid var(--accent);
  background: var(--accent-tint);
  padding: 14px 18px;
  border-radius: 0 var(--r) var(--r) 0;
}

/* White cards that pop against the workspace, as panels do in the app. */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 32px;
}
.cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: var(--r);
  padding: 24px 24px 26px;
}

.card .num,
.option .num {
  display: inline-block;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 2px 9px;
  border-radius: var(--r);
  margin-bottom: 14px;
}

.card p { margin-top: 10px; }

/* Lists with a square marker, for short facts. */
.ticks { display: grid; gap: 10px; max-width: 64ch; }
.ticks li { position: relative; padding-left: 26px; }
.ticks li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .68em;
  width: 9px;
  height: 9px;
  background: var(--accent);
}
.prose + .ticks, .ticks + .prose, .ticks + .callout, .prose + .callout { margin-top: 22px; }

/* "What this means for you" ---- the plain conclusion at the end of each area. */
.callout {
  max-width: 64ch;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-left: 5px solid var(--accent);
  border-radius: var(--r);
  padding: 16px 22px 18px;
}
.callout .label {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  color: var(--accent);
  margin-bottom: 4px;
}

/* ---- Two ways to run it: side-by-side comparison of the two options ---- */
.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.option {
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-top: 4px solid var(--accent);
  border-radius: var(--r);
  padding: 22px 24px 26px;
}

.option dl { margin: 18px 0 0; }
.option dt {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--muted);
}
.option dt:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.option dd { margin: 4px 0 0; }

/* ---- Home: the four steps of working together ---- */
.steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 32px;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-top: 4px solid var(--accent);
  border-radius: var(--r);
  padding: 20px 24px 24px;
}

.steps li::before {
  content: "Step " counter(step);
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}

.steps p { margin-top: 10px; }

/* ---- Questions: native <details>, no script ---- */
.faq {
  display: grid;
  gap: 10px;
  max-width: 820px;
  margin-top: 30px;
}

.faq details {
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: var(--r);
}
.faq details[open] { border-color: var(--accent); }

.faq summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 60px;
  padding: 12px 60px 12px 22px;
  font-weight: 600;
  font-size: 19px;
  line-height: 1.4;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  color: var(--accent);
  background: var(--accent-tint);
  border-radius: var(--r);
}
.faq details[open] > summary::after { content: "\2212"; }
.faq summary:hover { background: var(--hover-tint); }

.faq .answer {
  padding: 4px 22px 22px;
  max-width: 68ch;
}
.faq .answer > * + * { margin-top: 1em; }

/* ---- A single pointer to another page ---- */
.pointer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 32px;
  margin-top: 26px;
  max-width: 820px;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: var(--r);
  padding: 22px 26px;
}
.pointer p { max-width: 46ch; }
.pointer h3 { margin-bottom: 4px; }

/* ---- SFMS page: contents, stage row, day story ---- */
.toc {
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: var(--r);
  padding: 20px 22px 14px;
}
.toc .eyebrow { margin-bottom: 6px; }
.toc a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  text-decoration: none;
  border-bottom: 1px solid var(--divider);
}
.toc li:last-child a { border-bottom: none; }
.toc a:hover { color: var(--accent); }

/* The seven stages as connected boxes. */
.flow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 24px;
  margin-top: 30px;
  counter-reset: stage;
}
.flow li {
  position: relative;
  counter-increment: stage;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-top: 4px solid var(--accent);
  border-radius: var(--r);
  padding: 12px 10px 14px;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  text-align: center;
}
.flow li::before {
  content: counter(stage);
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 4px;
}
.flow li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 24px;
  height: 3px;
  margin-top: -1px;
  background: var(--accent);
}
.flow-note { margin-top: 14px; max-width: 64ch; }

/* The day, told in order. */
.story {
  max-width: 820px;
  margin-top: 30px;
  counter-reset: day;
  border-left: 3px solid var(--card-bd);
  margin-left: 18px;
}
.story li {
  counter-increment: day;
  position: relative;
  padding: 0 0 30px 34px;
}
.story li:last-child { padding-bottom: 0; }
.story li::before {
  content: counter(day);
  position: absolute;
  left: -19px;
  top: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 17px;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--r);
}
.story h3 { padding-top: 4px; }
.story p { margin-top: 8px; max-width: 64ch; }

/* ---- Contact: one window-like panel, with the app's dialog shadow ---- */
.contact { border-top: 1px solid var(--divider); }

.contact-panel {
  background: var(--card);
  border: 1px solid var(--window-bd);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 38px 36px 42px;
}
.contact-panel .prose { margin-top: 14px; }

.mail {
  display: inline-block;
  margin-top: 22px;
  font-family: var(--mono);
  font-size: clamp(19px, 3vw, 28px);
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding: 8px 0 2px;
  overflow-wrap: anywhere;
}
.mail:hover { filter: brightness(1.12); }

/* ---- Footer ---- */
.foot {
  background: var(--header);
  border-top: 1px solid var(--header-bd);
  padding: 20px 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

.foot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 20px;
}

.foot a { text-decoration: none; }
.foot a:hover { color: var(--accent); }

/* The header is sticky: stop an in-page jump from landing underneath it. */
section[id] { scroll-margin-top: 72px; }

/* ---- Smaller screens ---- */
@media (max-width: 960px) {
  .flow { grid-template-columns: 1fr; gap: 22px; max-width: 360px; }
  .flow li { text-align: left; padding-left: 52px; }
  .flow li::before { position: absolute; left: 16px; top: 12px; margin: 0; font-size: 16px; }
  .flow li:not(:last-child)::after {
    top: 100%;
    left: 50%;
    width: 3px;
    height: 22px;
    margin: 0 0 0 -1px;
  }
}

@media (max-width: 900px) {
  .hero-row { grid-template-columns: 1fr; }
  .hero-mark { display: none; }
  .cards, .cards.two, .options { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .top-row { gap: 8px; }
  .brand { gap: 8px; }
  .mark { height: 28px; }
  .brand-name { font-size: 17px; }
  .nav { gap: 0; font-size: 15px; }
  .nav a.nav-home { display: none; }
  .nav a { padding: 0 9px; }
  .theme-label { display: none; }
  .theme-btn { padding: 0 12px; margin-left: 4px; }
  .hero { padding: 48px 0 52px; }
  .section { padding: 52px 0; }
  .lede { font-size: 19px; }
  .card { padding: 20px 18px 22px; }
  .option { padding: 20px 18px 22px; }
  .steps li { padding: 18px 18px 22px; }
  .faq summary { padding: 12px 54px 12px 16px; font-size: 18px; }
  .faq summary::after { right: 14px; }
  .faq .answer { padding: 4px 16px 20px; }
  .pointer { padding: 20px 18px; }
  .contact-panel { padding: 26px 20px 30px; }
  .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Spacing between blocks that follow each other inside a section. */
.cards + .prose, .options + .prose, .options + .callout, .prose.after-cards { margin-top: 28px; }
