/*
 * Flintbury Labs site styles. Every colour, font, size, radius and shadow comes
 * from tokens.css (copied from brand/tokens.css). Fixed pixel values below are
 * the ones BRAND.md specifies directly (72px header, 44px touch targets, 48px
 * fields, 1.5px borders, 6px app-card strip).
 */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--fl-cloud);
  color: var(--fl-text);
  font: var(--fl-weight-body) var(--fl-text-body)/var(--fl-leading-body) var(--fl-font-sans);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: var(--fl-weight-heavy); }
p, ul, ol, dl, dd, figure { margin: 0; }
a { color: var(--fl-link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: none; box-shadow: var(--fl-focus-ring); border-radius: var(--fl-radius-sm); }

.skip-link {
  position: absolute; left: var(--fl-space-4); top: var(--fl-space-3); z-index: 100;
  padding: var(--fl-space-3) var(--fl-space-4); border-radius: var(--fl-radius-md);
  background: var(--fl-white); color: var(--fl-ink); font-weight: var(--fl-weight-bold);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Layout */
.container { max-width: var(--fl-container); margin-inline: auto; padding-inline: var(--fl-gutter); }
.section { padding-block: var(--fl-section-y); }
.section-white { background: var(--fl-white); }
.stack { display: grid; gap: var(--fl-space-5); align-content: start; }
.stack-sm { display: grid; gap: var(--fl-space-3); align-content: start; }
.section-head { display: grid; gap: var(--fl-space-3); max-width: var(--fl-measure); }

/* Type */
.label {
  font: var(--fl-weight-body) var(--fl-text-label)/1 var(--fl-font-mono);
  letter-spacing: var(--fl-tracking-label); text-transform: uppercase; color: var(--fl-cobalt);
}
.display { font-size: var(--fl-text-display); line-height: var(--fl-leading-tight); letter-spacing: var(--fl-tracking-display); }
.h1 { font-size: var(--fl-text-h1); line-height: var(--fl-leading-tight); letter-spacing: var(--fl-tracking-display); }
.h2 { font-size: var(--fl-text-h2); line-height: var(--fl-leading-snug); letter-spacing: var(--fl-tracking-heading); }
.h3 { font-size: var(--fl-text-h3); line-height: var(--fl-leading-snug); letter-spacing: var(--fl-tracking-heading); font-weight: var(--fl-weight-bold); }
.lead { font-size: var(--fl-text-lead); color: var(--fl-text-muted); max-width: var(--fl-measure); }
.muted { color: var(--fl-text-muted); }
.small { font-size: var(--fl-text-small); color: var(--fl-text-subtle); }
.hl { color: var(--fl-cobalt); }
/* The word "spark" only (BRAND.md 1): coral-text on Cloud/White, coral on Ink. Not on Cobalt. */
.spark { color: var(--fl-coral-text); }
.dark .spark { color: var(--fl-coral); }
.measure { max-width: var(--fl-measure); }

/* Buttons */
.btns { display: flex; flex-wrap: wrap; gap: var(--fl-space-3); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: var(--fl-space-3) var(--fl-space-5); border: 0; border-radius: var(--fl-radius-md);
  font: var(--fl-weight-bold) 1rem/1.2 var(--fl-font-sans); text-decoration: none; cursor: pointer;
  transition: background-color var(--fl-duration) var(--fl-ease);
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--fl-cobalt); color: var(--fl-text-on-cobalt); }
.btn-primary:hover, .btn-primary:active { background: var(--fl-cobalt-hover); }
.btn-secondary { background: var(--fl-white); color: var(--fl-ink); box-shadow: inset 0 0 0 1.5px var(--fl-border); }
.btn-secondary:hover { background: var(--fl-cloud); }
.btn-secondary:focus-visible { box-shadow: var(--fl-focus-ring); }
.btn-on-cobalt { background: var(--fl-white); color: var(--fl-ink); }
.btn-on-cobalt:hover { background: var(--fl-cloud); }

/* Header */
.header {
  position: sticky; top: 0; z-index: 50; background: var(--fl-white);
  border-bottom: 1px solid transparent;
  transition: border-color var(--fl-duration) var(--fl-ease);
}
.header.is-scrolled { border-bottom-color: var(--fl-border); }
.header-inner { display: flex; align-items: center; gap: var(--fl-space-6); min-height: 72px; }
.header-logo { display: inline-flex; padding-block: var(--fl-space-2); }
.header-logo img { width: 160px; }
.site-nav { display: flex; align-items: center; gap: var(--fl-space-5); margin-left: auto; }
.site-nav a:not(.btn) {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--fl-ink); text-decoration: none;
  font-weight: var(--fl-weight-semibold); font-size: var(--fl-text-small);
}
.site-nav a:not(.btn):hover, .site-nav a[aria-current="page"]:not(.btn) {
  color: var(--fl-cobalt); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.4em;
}
.menu-btn {
  display: none; margin-left: auto; align-items: center; gap: var(--fl-space-2);
  min-height: 44px; padding: var(--fl-space-2) var(--fl-space-3);
  background: var(--fl-white); color: var(--fl-ink); border: 0; border-radius: var(--fl-radius-md);
  box-shadow: inset 0 0 0 1.5px var(--fl-border);
  font: var(--fl-weight-bold) var(--fl-text-small)/1 var(--fl-font-sans); cursor: pointer;
}
.menu-btn:focus-visible { box-shadow: var(--fl-focus-ring); }
.menu-icon, .menu-icon::before, .menu-icon::after {
  display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform var(--fl-duration) var(--fl-ease), opacity var(--fl-duration) var(--fl-ease);
}
.menu-icon { position: relative; }
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }
.menu-btn[aria-expanded="true"] .menu-icon { background: transparent; }
.menu-btn[aria-expanded="true"] .menu-icon::before { transform: translateY(6px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-icon::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 719px) {
  .header-inner { position: static; }
  .js .menu-btn { display: inline-flex; }
  .js .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: var(--fl-space-1);
    padding: var(--fl-space-4) var(--fl-gutter) var(--fl-space-6);
    background: var(--fl-white); border-bottom: 1px solid var(--fl-border);
  }
  .js .site-nav.is-open { display: flex; }
  .js .site-nav a:not(.btn) { font-size: var(--fl-text-body); padding-inline: var(--fl-space-2); }
  .js .site-nav .btn { margin-top: var(--fl-space-3); }
  /* Without JS the links wrap under the logo */
  .no-js .header-inner { flex-wrap: wrap; gap: var(--fl-space-3); padding-block: var(--fl-space-3); }
  .no-js .site-nav { flex-wrap: wrap; margin-left: 0; gap: var(--fl-space-4); }
}

/* Hero */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--fl-space-7); align-items: center; }
.hero-copy { display: grid; gap: var(--fl-space-5); }
@media (min-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }

.page-hero { padding-block: var(--fl-section-y) var(--fl-space-8); }
.page-hero .hero-copy { max-width: 760px; }
.page-hero-grid { display: grid; gap: var(--fl-space-7); align-items: center; }
@media (min-width: 900px) { .page-hero-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }

/* Tile grid */
.tiles {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4%;
  width: 100%; max-width: 440px; justify-self: center;
}
.tiles-sm { max-width: 300px; }
.tile { display: block; aspect-ratio: 1; border-radius: var(--fl-radius-tile); background: var(--fl-tile-on-cloud); }
.section-white .tile:not(.cobalt):not(.coral):not(.teal):not(.sun):not(.next) { background: var(--fl-tile-on-cloud); }
.dark .tile:not(.cobalt):not(.coral):not(.teal):not(.sun) { background: var(--fl-tile-on-ink); }
.cobalt-band .tile:not(.coral):not(.teal):not(.sun) { background: var(--fl-tile-on-cobalt); }
.tile.cobalt { background: var(--fl-cobalt); }
.dark .tile.cobalt { background: var(--fl-cobalt-bright); }
.tile.coral { background: var(--fl-coral); }
.tile.teal { background: var(--fl-teal); }
.tile.sun { background: var(--fl-sun); }
.tile.next {
  background: none; border: 2px dashed var(--fl-border);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8%;
  font: var(--fl-weight-body) 11px/1.1 var(--fl-font-mono); color: var(--fl-text-subtle);
  text-transform: uppercase; letter-spacing: var(--fl-tracking-label); text-align: center;
}
/* The spark from the mark: the next idea, about to become the next app. Always Coral. */
.spark-icon { display: block; width: 30%; height: auto; fill: var(--fl-coral); }
@media (prefers-reduced-motion: no-preference) {
  .tiles .tile { animation: rise 480ms var(--fl-ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Cards */
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--fl-space-5); margin-top: var(--fl-space-7);
}
.card {
  background: var(--fl-white); border-radius: var(--fl-radius-lg); padding: var(--fl-space-5);
  box-shadow: var(--fl-shadow-card); display: grid; gap: var(--fl-space-3); align-content: start;
}
.section-white .card { box-shadow: inset 0 0 0 1.5px var(--fl-border); }
/* Keeps a short list at normal card width instead of stretching one card across the row */
.cards-fill { grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); }
.app-card { border-top: 6px solid var(--accent, var(--fl-cobalt)); }
.app-icon { width: 64px; height: 64px; border-radius: var(--fl-radius-tile); background: var(--accent, var(--fl-tile-on-cloud)); overflow: hidden; }
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-card.next-card {
  border: 2px dashed var(--fl-border); background: transparent; box-shadow: none;
}
.app-card.next-card .app-icon { background: none; border: 2px dashed var(--fl-border); display: grid; place-items: center; }
.app-card.next-card .spark-icon { width: 40%; }
.pills { display: flex; flex-wrap: wrap; gap: var(--fl-space-2); }
.pill {
  font: var(--fl-weight-semibold) var(--fl-text-small)/1 var(--fl-font-sans);
  padding: 6px 10px; border-radius: var(--fl-radius-pill); background: var(--fl-cloud); color: var(--fl-text-muted);
}
.status {
  font: var(--fl-weight-body) var(--fl-text-label)/1.3 var(--fl-font-mono);
  letter-spacing: var(--fl-tracking-label); text-transform: uppercase; color: var(--fl-text-subtle);
}
.text-link { font-weight: var(--fl-weight-bold); text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* Ink band: the Flintbury standard */
.dark { background: var(--fl-ink); color: var(--fl-text-on-dark); }
.dark .label { color: var(--fl-link-on-dark); }
.dark .sun { color: var(--fl-sun); }
.dark a:not(.btn) { color: var(--fl-link-on-dark); }
.dark .lead, .dark .muted { color: var(--fl-text-on-dark-muted); }
.std {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--fl-space-6); margin-top: var(--fl-space-7);
}
.std > div { display: grid; gap: var(--fl-space-3); align-content: start; }
.std .tile { width: 48px; }
.std p { color: var(--fl-text-on-dark-muted); }

/* Standard page: light version of the three points */
.std.std-light p { color: var(--fl-text-muted); }

/* Cobalt band: startups */
.cobalt-band { background: var(--fl-cobalt); color: var(--fl-text-on-cobalt); }
.cobalt-band .label { color: var(--fl-text-on-cobalt-muted); }
.cobalt-band .sun { color: var(--fl-sun); }
.cobalt-band a:not(.btn) { color: var(--fl-text-on-cobalt); }
.cobalt-band :focus-visible { box-shadow: 0 0 0 3px var(--fl-cobalt), 0 0 0 5px var(--fl-white); }
.services {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--fl-space-6); margin-block: var(--fl-space-7);
}
.services > div { display: grid; gap: var(--fl-space-2); align-content: start; }
.services p { color: var(--fl-text-on-cobalt-muted); }

/* Service list (startups page) */
.service-list { display: grid; gap: var(--fl-space-5); margin-top: var(--fl-space-7); grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.service-list .card .tile { width: 40px; }
.timeframe { margin-top: auto; padding-top: var(--fl-space-3); border-top: 1px solid var(--fl-border); }

/* Two-column split */
.split { display: grid; gap: var(--fl-space-7); align-items: start; }
@media (min-width: 1024px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* Forms */
.form { display: grid; gap: var(--fl-space-5); }
.form-card { background: var(--fl-white); border-radius: var(--fl-radius-lg); padding: clamp(1.5rem, 1rem + 2vw, 2.5rem); box-shadow: var(--fl-shadow-card); }
.form-row { display: grid; gap: var(--fl-space-5); }
@media (min-width: 720px) { .form-row { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: var(--fl-space-2); }
.field label { font-weight: var(--fl-weight-bold); font-size: var(--fl-text-small); color: var(--fl-ink); }
.field .hint { font-size: var(--fl-text-small); color: var(--fl-text-subtle); }
.input {
  width: 100%; min-height: 48px; padding: var(--fl-space-3) var(--fl-space-4);
  background: var(--fl-white); color: var(--fl-ink);
  border: 1.5px solid var(--fl-border); border-radius: var(--fl-radius-sm);
  font: var(--fl-weight-body) 1rem/1.4 var(--fl-font-sans);
}
textarea.input { min-height: 140px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: var(--fl-space-7); }
.input:focus-visible { box-shadow: var(--fl-focus-ring); border-color: var(--fl-cobalt); }
.input[aria-invalid="true"] { border-color: var(--fl-error); }
.field-error { color: var(--fl-error); font-size: var(--fl-text-small); font-weight: var(--fl-weight-semibold); }
.field-error:empty { display: none; }
.form-note { font-size: var(--fl-text-small); color: var(--fl-text-subtle); }
.form-status { font-size: var(--fl-text-small); font-weight: var(--fl-weight-semibold); color: var(--fl-success); }
.form-status:empty { display: none; }
.inline-form { display: grid; gap: var(--fl-space-2); }
.inline-form .inline-row { display: flex; flex-wrap: wrap; gap: var(--fl-space-2); }
.inline-form .input { flex: 1 1 180px; width: auto; }

/* Prose: legal and long-form pages */
.prose { max-width: var(--fl-measure); display: grid; gap: var(--fl-space-4); color: var(--fl-text-muted); }
.prose h2 { font-size: var(--fl-text-h3); line-height: var(--fl-leading-snug); letter-spacing: var(--fl-tracking-heading); color: var(--fl-ink); font-weight: var(--fl-weight-bold); margin-top: var(--fl-space-6); }
.prose h3 { font-size: var(--fl-text-body); color: var(--fl-ink); font-weight: var(--fl-weight-bold); margin-top: var(--fl-space-3); }
.prose ul, .prose ol { padding-left: var(--fl-space-5); display: grid; gap: var(--fl-space-2); }
.prose strong { color: var(--fl-ink); }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--fl-text-small); }
.prose th, .prose td { text-align: left; padding: var(--fl-space-3); border-bottom: 1px solid var(--fl-border); vertical-align: top; }
.prose th { color: var(--fl-ink); }
.table-wrap { overflow-x: auto; }

/* FAQ */
.faq { display: grid; gap: var(--fl-space-3); max-width: 820px; }
.faq details { background: var(--fl-white); border-radius: var(--fl-radius-lg); box-shadow: var(--fl-shadow-card); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: var(--fl-space-4);
  min-height: 44px; padding: var(--fl-space-4) var(--fl-space-5); cursor: pointer;
  font-weight: var(--fl-weight-bold); color: var(--fl-ink); border-radius: var(--fl-radius-lg); list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: var(--fl-weight-body) 1.5rem/1 var(--fl-font-mono); color: var(--fl-cobalt); }
.faq details[open] summary::after { content: "−"; }
.faq .answer { padding: 0 var(--fl-space-5) var(--fl-space-5); color: var(--fl-text-muted); display: grid; gap: var(--fl-space-3); }

/* App detail page */
.app-hero-icon { width: 96px; height: 96px; border-radius: var(--fl-radius-tile); box-shadow: var(--fl-shadow-card); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--fl-space-5); margin-top: var(--fl-space-7); }
.facts { display: grid; gap: var(--fl-space-3); }
.facts div { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr); gap: var(--fl-space-4); padding-block: var(--fl-space-3); border-bottom: 1px solid var(--fl-border); }
.facts dt { font: var(--fl-weight-body) var(--fl-text-label)/1.6 var(--fl-font-mono); letter-spacing: var(--fl-tracking-label); text-transform: uppercase; color: var(--fl-text-subtle); }
.facts dd { color: var(--fl-ink); overflow-wrap: anywhere; }
.link-list { display: grid; gap: var(--fl-space-2); padding: 0; list-style: none; }

/* Contact cards */
.contact-list { display: grid; gap: var(--fl-space-4); }
.contact-list .card { gap: var(--fl-space-2); }
.contact-list a { font-weight: var(--fl-weight-bold); overflow-wrap: anywhere; }

/* Footer */
.footer { background: var(--fl-ink); color: var(--fl-text-on-dark-muted); font-size: var(--fl-text-small); padding-block: var(--fl-space-8); }
.footer .container { display: grid; gap: var(--fl-space-7); }
.footer-top { display: grid; gap: var(--fl-space-7); }
@media (min-width: 1024px) { .footer-top { grid-template-columns: minmax(0, 1fr) auto; } }
.footer-brand { display: grid; gap: var(--fl-space-4); align-content: start; }
.footer-brand img { width: 188px; }
.footer-brand p { max-width: 36ch; }
.footer-cols { display: flex; flex-wrap: wrap; gap: var(--fl-space-7) var(--fl-space-8); }
.footer-cols div { display: grid; gap: 0; align-content: start; }
.footer-cols strong { color: var(--fl-text-on-dark); font-weight: var(--fl-weight-bold); margin-bottom: var(--fl-space-1); }
.footer a { color: var(--fl-text-on-dark); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.footer a:hover { text-decoration: underline; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--fl-space-3); padding-top: var(--fl-space-5); border-top: 1px solid var(--fl-tile-on-ink); }
.footer :focus-visible { box-shadow: 0 0 0 3px var(--fl-ink), 0 0 0 5px var(--fl-link-on-dark); }

/* 404 */
.not-found { min-height: 60vh; display: grid; align-items: center; }

/* Apps page: a real app sits in its facet-colour tile with its icon centred */
.tile.has-icon { display: grid; place-items: center; }
.tile.has-icon img { width: 62%; height: auto; border-radius: var(--fl-radius-tile); }
