/* ==========================================================================
   Frontier Information Systems: site.css
   One stylesheet, no dependencies. Mobile first.
   Order: 1 tokens > 2 base > 3 layout > 4 components > 5 pages > 6 print
   Tokens mirror docs/03_FIS_Website_Design_Spec.md. Keep text pairs at 4.5:1
   or better (tools/verify.py recomputes them).
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  /* Brand (from the logo): accents only, never small text on white */
  --brand-orange: #E2502A;
  --brand-amber: #F0AA2E;
  --brand-grey: #858585;
  --brand-rule: #C9CACC;

  /* Web palette (accessible) */
  --ink: #2E2E2E;
  --ink-muted: #5C5C5C;
  --accent: #B5401C;
  --accent-hover: #A63A18;
  --paper: #FAF8F5;
  --surface: #FFFFFF;
  --line: #E6E2DC;
  --band: #2E2E2E;
  --on-band: #FFFFFF;
  --on-band-muted: #E6E2DC;

  /* Type */
  --font-serif: Georgia, "Times New Roman", Times, serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-h1: clamp(2rem, 1.4rem + 2.6vw, 3.25rem);
  --fs-h2: clamp(1.5rem, 1.2rem + 1.3vw, 2.25rem);
  --fs-h3: clamp(1.15rem, 1.05rem + .5vw, 1.4rem);
  --fs-lead: clamp(1.0625rem, 1rem + .4vw, 1.25rem);
  --fs-body: 1.0625rem;
  --fs-small: .9375rem;

  /* Space */
  --s1: .25rem;
  --s2: .5rem;
  --s3: .75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4.5rem;
  --s9: 6rem;

  /* Layout */
  --container: 1120px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --section: var(--s7);
  --radius: 6px;
  --logo-w: 150px;
}

@media (min-width: 60em) {
  :root {
    --section: var(--s8);
    --logo-w: 200px;
  }
}

/* 2. Base ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.65;
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  margin: 0 0 var(--s4);
  color: var(--ink);
  font-family: var(--font-serif);
  font-weight: 400;
}

h1 {
  font-size: var(--fs-h1);
  line-height: 1.15;
}

h2 {
  font-size: var(--fs-h2);
  line-height: 1.2;
}

h3 {
  font-size: var(--fs-h3);
  line-height: 1.3;
}

p,
ul,
ol,
dl {
  margin: 0 0 var(--s4);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: .15em;
  transition: color .15s ease, text-decoration-color .15s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

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

strong {
  font-weight: 600;
}

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

/* 3. Layout ---------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section);
}

.section-alt {
  background: var(--surface);
  border-block: 1px solid var(--line);
}

.prose {
  max-width: 68ch;
}

.grid {
  display: grid;
  gap: var(--s5);
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.section-head {
  max-width: 68ch;
  margin-bottom: var(--s6);
}

.section-head > :last-child {
  margin-bottom: 0;
}

/* 4. Components ------------------------------------------------------------ */

/* Skip link: hidden until focused */
.skip-link {
  position: absolute;
  top: var(--s2);
  left: var(--s2);
  z-index: 100;
  padding: var(--s2) var(--s4);
  border-radius: var(--radius);
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus {
  color: #FFFFFF;
  transform: none;
}

/* Brand accent bar (4 px) */
.accent-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--brand-orange), var(--brand-amber));
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3) var(--s5);
  padding-block: var(--s3);
}

.brand {
  display: inline-block;
  padding-block: var(--s1);
}

.brand img {
  display: block;
  width: var(--logo-w);
}

/* Navigation: wrapped list by default (no JS); collapses only with .js */
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--s2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--s2);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.nav-toggle {
  display: none;
}

.nav-toggle svg {
  display: block;
  width: 24px;
  height: 24px;
}

.nav-toggle .icon-close,
.nav-toggle[aria-expanded="true"] .icon-menu {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

@media (max-width: 59.99em) {
  .js .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--s2);
    min-width: 44px;
    min-height: 44px;
    padding: 0 var(--s3);
    border: 1.5px solid var(--ink);
    border-radius: var(--radius);
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
  }

  .js .nav-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  .js .site-nav {
    display: none;
    flex-basis: 100%;
  }

  .js.nav-open .site-nav {
    display: block;
  }

  .js .site-nav ul {
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--line);
  }

  .js .site-nav li + li {
    border-top: 1px solid var(--line);
  }
}

@media (min-width: 60em) {
  .site-nav ul {
    gap: 0 var(--s4);
  }
}

/* Buttons */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-top: var(--s5);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .75rem 1.25rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.button-primary {
  background: var(--accent);
  color: #FFFFFF;
}

.button-primary:hover {
  background: var(--accent-hover);
  color: #FFFFFF;
}

.button-secondary {
  border-color: var(--ink);
  color: var(--ink);
}

.button-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.button-on-dark {
  border-color: var(--brand-amber);
  color: var(--brand-amber);
}

.button-on-dark:hover {
  background: var(--brand-amber);
  color: var(--band);
}

/* Small-caps labels */
.label {
  margin-bottom: var(--s2);
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: 600;
  font-variant-caps: all-small-caps;
  letter-spacing: .06em;
  line-height: 1.4;
}

.label-accent {
  color: var(--accent);
}

.lead {
  max-width: 60ch;
  color: var(--ink-muted);
  font-size: var(--fs-lead);
}

.small {
  color: var(--ink-muted);
  font-size: var(--fs-small);
}

.more {
  font-weight: 600;
}

/* Cards (services, case-study teasers) */
.card {
  height: 100%;
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand-orange);
  border-radius: var(--radius);
}

.card h3 {
  margin-bottom: var(--s2);
}

.card h3 a {
  text-decoration: none;
}

.card h3 a:hover {
  text-decoration: underline;
}

.card > :last-child {
  margin-bottom: 0;
}

/* Inline lists separated by a middle dot */
.inline-list {
  display: flex;
  flex-wrap: wrap;
  margin-left: 0;
  padding: 0;
  list-style: none;
}

.inline-list li:not(:last-child)::after {
  content: "\00B7";
  content: "\00B7" / "";
  margin-inline: var(--s3);
  color: var(--ink-muted);
}

.client-names li {
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
}

/* Technology pills */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pills li {
  padding: .15rem .75rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--fs-small);
}

/* CTA band */
.cta-band {
  padding-block: var(--s8);
  background: var(--band);
  color: var(--on-band);
}

.cta-band h2 {
  color: var(--on-band);
}

.cta-band p {
  max-width: 60ch;
}

.cta-band :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--brand-amber);
}

/* Footer */
.site-footer {
  padding-block: var(--s7) var(--s6);
  background: var(--band);
  border-top: 1px solid #4A4A4A;
  color: var(--on-band-muted);
  font-size: var(--fs-small);
}

.footer-inner {
  display: grid;
  gap: var(--s5);
}

.footer-logo {
  display: block;
  width: 150px;
}

.site-footer p {
  margin-bottom: var(--s1);
}

.footer-name {
  color: var(--on-band);
  font-weight: 600;
}

.site-footer a {
  display: inline-block;
  padding-block: .6rem;
  color: var(--on-band);
}

.site-footer a:hover {
  color: var(--brand-amber);
}

@media (min-width: 40em) {
  .footer-inner {
    grid-template-columns: auto 1fr;
    align-items: start;
    column-gap: var(--s7);
  }

  .footer-legal {
    grid-column: 1 / -1;
    padding-top: var(--s4);
    border-top: 1px solid #4A4A4A;
  }
}

/* 5. Pages ----------------------------------------------------------------- */

/* Page header (inner pages) */
.page-header {
  padding-block: var(--s8) var(--s6);
}

.page-header > .container > :last-child {
  margin-bottom: 0;
}

/* Home: hero */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: var(--s8) var(--s7);
}

.hero h1 {
  max-width: 22ch;
}

@media (min-width: 60em) {
  .hero {
    padding-block: var(--s9) var(--s8);
  }

  .hero .container {
    position: relative;
    z-index: 1;
  }

  .hero::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -3rem;
    width: 28rem;
    height: 28rem;
    background: url("../img/mark.svg") no-repeat center / contain;
    opacity: .09;
    transform: translateY(-50%);
    pointer-events: none;
  }
}

/* Home: history strip */
.history-strip p {
  max-width: 68ch;
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
  line-height: 1.5;
}

.history-strip p.more {
  margin-bottom: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
}

/* Services */
.service {
  max-width: 68ch;
  padding-block: var(--s6);
  border-top: 1px solid var(--line);
  scroll-margin-top: var(--s4);
}

.service:first-child {
  border-top: 0;
  padding-top: 0;
}

.service > :last-child {
  margin-bottom: 0;
}

.related .inline-list {
  display: inline-flex;
  margin: 0;
}

.engage-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Clients */
.client-groups {
  display: grid;
  gap: var(--s6) var(--s5);
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  margin-bottom: var(--s6);
}

.client-group h2 {
  margin-bottom: var(--s2);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
}

.client-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.client-group li {
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
}

/* Projects: case studies */
.case-index {
  margin-top: var(--s5);
}

.case-index .inline-list {
  margin: 0;
}

.case {
  padding-block: var(--s7);
  border-top: 1px solid var(--line);
  scroll-margin-top: var(--s4);
}

.case:first-child {
  border-top: 0;
  padding-top: 0;
}

.case:last-child {
  padding-bottom: 0;
}

.case-head {
  max-width: 68ch;
  margin-bottom: var(--s5);
}

.case-head h2 {
  margin-bottom: var(--s2);
}

.case-head .meta {
  margin: 0;
  color: var(--ink-muted);
}

.case dl {
  margin: 0;
}

.case dt {
  margin-top: var(--s5);
  color: var(--ink-muted);
  font-size: var(--fs-small);
  font-weight: 600;
  font-variant-caps: all-small-caps;
  letter-spacing: .06em;
}

.case dt:first-child {
  margin-top: 0;
}

.case dd {
  max-width: 68ch;
  margin: var(--s1) 0 0;
}

@media (min-width: 60em) {
  .case dl {
    display: grid;
    grid-template-columns: 10rem minmax(0, 1fr);
    gap: var(--s5) var(--s6);
  }

  .case dt,
  .case dd {
    margin: 0;
  }

  .case dt {
    padding-top: .15rem;
  }
}

/* About: timeline */
.timeline {
  position: relative;
  max-width: 68ch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  top: .6rem;
  bottom: .6rem;
  left: 4px;
  width: 2px;
  background: var(--line);
}

.timeline li {
  position: relative;
  padding: 0 0 var(--s5) var(--s6);
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: .55em;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-amber));
}

.timeline .year {
  display: block;
  font-family: var(--font-serif);
  font-weight: 700;
}

/* Contact */
.contact-card {
  max-width: 40rem;
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand-orange);
  border-radius: var(--radius);
}

.contact-card dl {
  margin: 0;
}

.contact-card dt {
  color: var(--ink-muted);
  font-size: var(--fs-small);
  font-weight: 600;
  font-variant-caps: all-small-caps;
  letter-spacing: .06em;
}

.contact-card dd {
  margin: 0 0 var(--s4);
}

.contact-card dd:last-child {
  margin-bottom: 0;
}

.contact-email {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 1rem + 1.4vw, 1.75rem);
  overflow-wrap: anywhere;
}

@media (min-width: 40em) {
  .contact-card {
    padding: var(--s6);
  }
}

/* 404 */
.notfound-links {
  margin-top: var(--s5);
}

/* 6. Print ----------------------------------------------------------------- */
@media print {
  .accent-bar,
  .skip-link,
  .site-nav,
  .nav-toggle,
  .cta-band,
  .button-row,
  .footer-logo,
  .hero::after {
    display: none !important;
  }

  body,
  .site-header,
  .site-footer,
  .section-alt {
    background: #FFFFFF;
    color: #000000;
    border-color: #999999;
  }

  body {
    font-size: 11pt;
  }

  h1,
  h2,
  h3,
  a,
  .label,
  .lead,
  .small,
  .site-footer a,
  .footer-name,
  .case dt,
  .case-head .meta {
    color: #000000 !important;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 90%;
    overflow-wrap: anywhere;
  }

  .case,
  .card,
  .contact-card,
  .timeline li {
    break-inside: avoid;
  }

  .case {
    padding-block: 1.5rem;
  }

  .page-header,
  .section,
  .hero {
    padding-block: 1rem;
  }
}
