/* AI Systems Finder (R4): shell, rail, top bar, sheet, footer, buttons. Kristian's Apiko layout (19 Oct 2026);
   design.md v1.5 colours and type only. Order: finder, controls, results, finder-only, site-taste.css. Rail markup (R5):
   li.fd-step[data-state] holds .fd-dot and .fd-step-b (a button once done): .fd-step-n, -s and -a. */

:root {
  --bla-charcoal: #232A31;
  --bla-off-white: #FAFAF8;
  --bla-consulting-blue: #1B3A5B;
  --bla-light-blue: #AFC4DD;
  --bla-steel-grey: #586069;
  --bla-soft-stone: #E5E5E2;
  --bla-blue-hover: #17314D;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --r-button: 11px; --r-field: 12px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --dur-press: 160ms; --dur-ui: 200ms;
  --fd-ink-06: rgba(35, 42, 49, 0.06);
  --fd-ink-10: rgba(35, 42, 49, 0.10);
  --fd-ink-16: rgba(35, 42, 49, 0.16);
  --fd-lb-45: rgba(175, 196, 221, 0.45);
  --fd-steel-40: rgba(88, 96, 105, 0.4);
  --fd-foot-h: 76px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bla-charcoal); -webkit-text-size-adjust: 100%; }
body.fd-page {
  margin: 0; min-height: 100svh; background: var(--bla-charcoal); color: var(--bla-charcoal);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  padding: 18px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px));
}
/* Faint Off-White rings on the Charcoal ground, as in the mock-up. */
body.fd-page::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; --ring: rgba(250, 250, 248, 0.05);
  background:
    radial-gradient(circle at 8% 18%, transparent 118px, var(--ring) 119px 120px, transparent 121px),
    radial-gradient(circle at 92% 82%, transparent 178px, var(--ring) 179px 180px, transparent 181px);
}
/* Zero-weight bases: every class, and the cookie notice's own sheet, wins over them. */
:where(.fd-page) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.fd-page) button { cursor: pointer; }
:where(.fd-page) a { color: var(--bla-consulting-blue); text-underline-offset: 3px; }
.fd-page :focus-visible { outline: 2px solid var(--bla-consulting-blue); outline-offset: 3px; }
.fd-page img { max-width: 100%; }

.fd-page .skip-link {
  position: absolute; left: 12px; top: -64px; z-index: 50; background: var(--bla-off-white); color: var(--bla-charcoal);
  padding: 10px 16px; border-radius: var(--r-button); font-weight: 600; text-decoration: none;
}
.fd-page .skip-link:focus { top: 12px; outline: 2px solid var(--bla-light-blue); outline-offset: 2px; }
.lib-preview-bar {
  position: relative; z-index: 1; max-width: 1200px; margin: 0 auto 12px; text-align: center;
  color: var(--bla-soft-stone); font-size: 14px;
}

/* Visually hidden, still read and still focusable. */
.fd-sr, .fd-vh {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
/* A choice's input covers its box, so focus scrolls the whole box, not a dot, clear of the phone footer. */
:is(.fd-tile, .fd-chip, .fd-sys) > .fd-vh {
  inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; clip: auto; clip-path: none; appearance: none; pointer-events: none;
}

/* The shell: one card, rail left, questions right */
.fd {
  position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; min-height: 720px;
  display: grid; grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: auto 1fr;
  grid-template-areas: "intro main" "rail main";
  background: var(--bla-soft-stone); border-radius: 32px; overflow: clip;
  box-shadow: 0 30px 80px rgba(35, 42, 49, 0.45);
}
.fd-intro { grid-area: intro; background: var(--bla-off-white); padding: 36px 30px 4px; display: grid; gap: 14px; align-content: start; }
.fd-mark { display: inline-flex; width: max-content; border-radius: 4px; }
.fd-mark img { display: block; height: 22px; width: auto; }
#fd-title {
  margin: 6px 0 0; font-family: var(--font-display); font-weight: 500; font-size: 30px; line-height: 1.12;
  letter-spacing: -0.01em; text-wrap: balance;
}
.fd-lede { margin: 0; color: var(--bla-steel-grey); font-size: 15px; line-height: 1.5; }

/* Rail */
.fd-rail { grid-area: rail; background: var(--bla-off-white); padding: 22px 30px 30px; display: flex; flex-direction: column; gap: 22px; }
.fd-steps { list-style: none; margin: 0; padding: 0; display: grid; }
.fd-step { position: relative; padding: 0 0 22px 40px; min-height: 52px; }
.fd-step:last-child { padding-bottom: 0; }
.fd-step::before { content: ""; position: absolute; left: 11px; top: 28px; bottom: 2px; width: 2px; border-radius: 1px; background: var(--bla-soft-stone); }
.fd-step:last-child::before { display: none; }
.fd-step[data-state="done"]::before { background: var(--bla-consulting-blue); }
.fd-dot {
  position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--bla-soft-stone); background: var(--bla-off-white); display: grid; place-items: center;
}
.fd-step[data-state="current"] .fd-dot { border-color: var(--bla-consulting-blue); }
.fd-step[data-state="current"] .fd-dot::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--bla-consulting-blue);
}
.fd-step[data-state="done"] .fd-dot { border-color: var(--bla-consulting-blue); background: var(--bla-consulting-blue); }
.fd-step[data-state="done"] .fd-dot::after {
  content: ""; width: 12px; height: 12px; background: var(--bla-off-white);
  --fd-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  -webkit-mask: var(--fd-tick) center / contain no-repeat; mask: var(--fd-tick) center / contain no-repeat;
}
.fd-step-b {
  display: grid; gap: 2px; width: 100%; padding: 0; margin: 0; border: 0; background: none; text-align: left;
  border-radius: 6px;
}
div.fd-step-b { cursor: default; }
.fd-step-n { font-weight: 700; font-size: 15px; line-height: 24px; }
.fd-step[data-state="future"] .fd-step-n { color: var(--bla-steel-grey); }
.fd-step-s { font-size: 14px; color: var(--bla-steel-grey); line-height: 1.35; }
.fd-step-a { font-size: 14px; color: var(--bla-consulting-blue); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }

/* Questions column */
.fd-top { display: none; }
.fd-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; padding: 44px 56px 32px; }
.fd-main:focus { outline: none; }
.fd-main > form { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.fd-slide {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 34px;
  max-width: 760px; width: 100%; margin: 0 auto; min-width: 0;
}
.fd-slide:focus { outline: none; }
.fd-slide:focus-visible { outline: 2px solid var(--bla-consulting-blue); outline-offset: 8px; border-radius: 8px; }
.fd-slide.fd-enter { animation: fd-enter 260ms var(--ease-out); }
@keyframes fd-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fd-noscript { margin: 0; max-width: 60ch; font-size: 17px; }

/* Footer: one alert line, Back, Next */
.fd-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 18px; flex-wrap: wrap;
  max-width: 760px; width: 100%; margin: 34px auto 0;
}
.fd-foot-err {
  margin: 0 auto 0 0; flex: 1 1 220px; min-width: 0; font-size: 15px; font-weight: 600; color: var(--bla-charcoal);
  padding-left: 12px; border-left: 3px solid var(--bla-consulting-blue);
}
.fd-back {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 6px; border: 0; background: none;
  font-weight: 600; border-radius: var(--r-button); white-space: nowrap;
}
.fd-go, .fd-back { flex: 0 0 auto; }
.fd-go::after, .fd-back::before {
  content: ""; width: 18px; height: 18px; flex: none; background: currentColor;
  -webkit-mask: var(--fd-arrow) center / contain no-repeat; mask: var(--fd-arrow) center / contain no-repeat;
}
.fd-go { --fd-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.fd-back { --fd-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 12H5M11 6l-6 6 6 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
/* The primary button, design.md section 8. */
.fd-go {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 13px 24px;
  border: 0; border-radius: var(--r-button); background: var(--bla-charcoal); color: var(--bla-off-white);
  font-weight: 600; font-size: 16px; white-space: nowrap; box-shadow: 0 6px 16px var(--fd-ink-16);
  transition: background-color var(--dur-ui) var(--ease-out), transform var(--dur-press) var(--ease-out);
}
.fd-go::after { transition: transform var(--dur-ui) var(--ease-out); }
.fd-go:active { transform: scale(0.97); }
.fd-go[disabled], .fd-go[aria-busy="true"] { cursor: progress; opacity: 0.8; }
.fd-plain {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0; border: 0; background: none;
  color: var(--bla-consulting-blue); font-weight: 600; font-size: 15px; text-decoration: underline; text-underline-offset: 3px;
  border-radius: 4px; text-align: left;
}
.fd-ghost, .fd-more {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border: 1.5px solid var(--bla-charcoal); border-radius: var(--r-button); background: transparent; color: var(--bla-charcoal);
  font-weight: 600; justify-self: start; white-space: nowrap;
  transition: background-color var(--dur-ui) var(--ease-out), color var(--dur-ui) var(--ease-out);
}

/* Answers sheet (phone) */
.fd-sheet { position: fixed; inset: 0; z-index: 30; display: grid; align-items: end; background: rgba(35, 42, 49, 0.6); }
.fd-sheet-in {
  background: var(--bla-off-white); border-radius: 22px 22px 0 0; max-height: 82svh; overflow: auto; display: grid; gap: 18px;
  padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.fd-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#fd-sheet-title { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 22px; }
.fd-sheet .fd-plain { min-height: 44px; min-width: 44px; justify-content: center; padding: 0 8px; }

/* Holding page (no approved wording yet) */
.fd-wait { display: block; min-height: 0; }
.fd-wait .fd-main { padding: 0; }
.fd-wait .fd-intro { padding: 40px; gap: 18px; }

/* Hover: pointer devices only */
@media (hover: hover) and (pointer: fine) {
  .fd-go:hover { background: var(--bla-consulting-blue); transform: translateY(-2px); }
  .fd-go:hover::after { transform: translateX(4px); }
  .fd-go:hover:active { transform: translateY(-2px) scale(0.97); }
  .fd-back:hover { color: var(--bla-consulting-blue); }
  .fd-plain:hover, .fd-page a:hover { color: var(--bla-blue-hover); }
  button.fd-step-b:hover .fd-step-n { text-decoration: underline; text-underline-offset: 3px; }
  :is(.fd-ghost, .fd-more):hover { background: var(--bla-charcoal); color: var(--bla-off-white); }
}

/* Narrow desktop */
@media (max-width: 1020px) {
  .fd { grid-template-columns: 270px minmax(0, 1fr); }
  .fd-intro { padding: 30px 24px 4px; }
  .fd-rail { padding: 20px 24px 26px; }
  .fd-main { padding: 36px 32px 28px; }
}

/* Phone (architecture-a11y-phone.md section 10) */
@media (max-width: 820px) {
  :root { --fd-foot-h: 72px; }
  body.fd-page { padding: 10px max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px)); }
  .fd {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; grid-template-areas: "top" "intro" "main";
    border-radius: 24px 24px 0 0; min-height: calc(100svh - 10px); box-shadow: none;
  }
  .fd-wait { border-radius: 24px; }
  .fd-rail { display: none; }
  .fd-top {
    grid-area: top; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 12px;
    background: var(--bla-off-white); padding: 14px 16px 14px;
  }
  .fd-top .fd-mark { min-height: 44px; align-items: center; }
  .fd-top .fd-mark img { height: 18px; }
  .fd-ans {
    min-height: 44px; padding: 8px 14px; border: 1.5px solid var(--bla-soft-stone); border-radius: var(--r-button);
    background: var(--bla-off-white); font-weight: 600; font-size: 15px; white-space: nowrap;
  }
  .fd-stepline { grid-column: 1 / -1; margin: 0; font-size: 14px; color: var(--bla-steel-grey); }
  .fd-bar { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
  .fd-bar span { height: 5px; border-radius: 3px; background: var(--bla-soft-stone); }
  .fd[data-fd-step="company"] .fd-bar span:nth-child(-n+1),
  .fd[data-fd-step="area"] .fd-bar span:nth-child(-n+2),
  .fd[data-fd-step="systems"] .fd-bar span:nth-child(-n+3),
  .fd[data-fd-step="pick"] .fd-bar span:nth-child(-n+4),
  .fd[data-fd-step="basket"] .fd-bar span:nth-child(-n+5),
  .fd[data-fd-step="estimate"] .fd-bar span { background: var(--bla-consulting-blue); }
  .fd-intro { background: none; padding: 20px 16px 0; gap: 8px; }
  .fd-intro .fd-mark { display: none; }
  .fd-wait .fd-intro .fd-mark { display: inline-flex; }
  #fd-title { margin: 0; font-size: 26px; }
  /* The lede hides once the visitor starts. */
  .fd:not([data-fd-step="company"]) .fd-lede, .fd[data-fd-started] .fd-lede { display: none; }
  /* The h1 stays above the questions (spec section 10), smaller after step 1. */
  .fd[data-fd-step]:not([data-fd-step="company"]) .fd-intro { padding-top: 16px; }
  .fd[data-fd-step]:not([data-fd-step="company"]) #fd-title { font-size: 21px; }
  .fd-main { padding: 22px 16px 0; }
  .fd-slide { gap: 28px; }
  .fd-foot {
    position: sticky; bottom: 0; z-index: 5; margin: 24px -16px 0; width: auto; max-width: none;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--bla-soft-stone);
    border-top: 1px solid var(--fd-ink-10); gap: 10px 14px;
  }
  .fd-foot-err { flex-basis: 100%; order: -1; }
  .fd-go { padding: 12px 20px; }
  /* Focus scrolls clear of the footer, taller while its alert shows (WCAG 2.4.11, C43). Scroll padding: older
     Chrome skips scroll-margin on a control partly on screen (20 Oct 2026). The alert holds two lines until
     footError fills it (30 ms on): 5B's last error line stays in view. */
  :root:has(.fd-foot-err:not([hidden])) { --fd-foot-h: 140px; }
  html { scroll-padding-bottom: calc(var(--fd-foot-h) + 16px + env(safe-area-inset-bottom, 0px)); }
  .fd-foot-err:empty { min-height: 3em; }
}
/* Smallest phones: a 4px gutter, so seven 44px calendar days fit at 320px. */
@media (max-width: 359px) {
  body.fd-page { padding-left: max(4px, env(safe-area-inset-left, 0px)); padding-right: max(4px, env(safe-area-inset-right, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .fd-slide.fd-enter { animation: none; }
  .fd-go, .fd-go::after, .fd-ghost, .fd-more { transition: none; }
   .fd-go:active{ transform: none; }@media (hover: hover) and (pointer: fine){.fd-go:hover,.fd-go:hover:active,.fd-go:hover::after{ transform: none; }}
}
