/* ==========================================================================
   Optrical — base
   Reset, typography, layout primitives, header, footer, shared components.
   Depends on tokens.css. Section-specific rules live in sections.css.
   ========================================================================== */

/* --- Reset ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--f-body);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: var(--lh-prose);
  color: var(--c-text);
  background: var(--c-surface);
  -webkit-font-smoothing: antialiased;
}

img, picture, svg, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* --- Typography ----------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--f-head);
  color: var(--c-navy);
  margin: 0;
  font-weight: 600;
}

p { margin: 0 0 var(--prose-gap); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--c-navy);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover, a:focus-visible { color: var(--c-orange); }

:focus-visible {
  outline: 2px solid var(--c-orange);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: var(--sp-2) var(--sp-4);
  background: var(--c-navy);
  color: #fff;
}
.skip-link:focus { left: 0; color: #fff; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- Layout primitives ---------------------------------------------------- */

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

.section { padding-block: var(--sp-8); }
.section--tight { padding-block: var(--sp-5); }
.section--flush { padding-block: 0; }

.section--navy {
  background: var(--c-navy);
  color: #fff;
}
/* Invert only the section's own headings. Cards keep a white surface, so
   their text must not inherit the inverted colour — scoping these to direct
   children of .container stops the leak. */
.section--navy > .container > .eyebrow { color: rgba(255, 255, 255, 0.60); }
.section--navy > .container > .heading,
.section--navy > .container > .prose   { color: #fff; }
.section--navy .card       { color: var(--c-text); }
.section--navy .card__title { color: var(--c-card-title); }
.section--navy .tile__title { color: #fff; }

.grid {
  display: grid;
  gap: var(--sp-6);
}
@media (min-width: 768px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1025px) {
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
  .grid--5 { grid-template-columns: repeat(5, 1fr); }
}
@media (min-width: 768px) and (max-width: 1024px) {
  .grid--4, .grid--5 { grid-template-columns: repeat(2, 1fr); }
}

/* --- Headings ------------------------------------------------------------- */

.eyebrow {
  font-family: var(--f-body);
  font-size: var(--fs-eyebrow);
  font-weight: 400;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--c-eyebrow);
  margin: 0 0 var(--sp-1);
}

.heading {
  font-family: var(--f-head);
  font-size: var(--fs-section);
  font-weight: 600;
  line-height: var(--lh-heading);
  color: var(--c-navy);
  margin: 0 0 var(--sp-5);
}
.heading:last-child { margin-bottom: 0; }

/* The live site wraps part of several headings in a <span> but never styles
   it. Given a two-tone treatment was clearly intended, the span gets the
   accent — the one deliberate departure from the current rendering. */
.heading span { color: var(--c-orange); }

.subheading {
  font-family: var(--f-head);
  font-size: var(--fs-sub);
  font-weight: 400;
  color: var(--c-navy);
  margin: 0 0 var(--sp-4);
}

.text-center { text-align: center; }

/*
 * Centred body copy still needs a readable measure. Across the full 1140px
 * container a paragraph runs to ~150 characters per line; centring then puts
 * every line at a different starting x, so the eye has to hunt for each new
 * line. Capping at 62ch lands in the 45-75 range that reads comfortably.
 * Headings and eyebrows are short and are deliberately left alone.
 */
/*
 * Body copy is capped at a readable measure wherever it appears. Across the
 * full 1140px container a paragraph runs to ~150 characters per line, well
 * past the 45-75 that reads comfortably.
 *
 * Centred text gets `margin-inline: auto` so the column stays centred; the
 * left-aligned case keeps its left edge and simply stops short of the right.
 *
 * Two selectors for the centred case because the class lands in two places:
 * heading_prose puts .text-center on the container and .prose on a child,
 * while steps, news_list, plans_table and contact_form put both on the same
 * element. A descendant selector alone silently misses the second group.
 */
.prose { max-width: 62ch; }

.text-center .prose,
.prose.text-center,
.cta .prose {          /* .cta centres via text-align, not the helper class */
  margin-inline: auto;
}

.prose { font-family: var(--f-head); line-height: var(--lh-prose); }
.prose ul { margin: 0 0 var(--prose-gap); padding-left: 1.25em; }
.prose li { margin-bottom: var(--sp-2); }
.prose strong { color: var(--c-navy); }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-block;
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
  padding: 13px 26px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--c-navy);
  color: #fff;
  transition: background-color var(--transition), color var(--transition);
}
.btn:hover, .btn:focus-visible {
  background: var(--c-blue-hover);
  color: #fff;
}

.btn--outline {
  padding: 12px 30px;
  border: 1px solid var(--c-navy);
  border-radius: var(--radius-btn-outline);
  background: var(--c-surface);
  color: var(--c-navy);
}
.btn--outline:hover, .btn--outline:focus-visible {
  background: var(--c-navy);
  color: #fff;
}

.btn--contact {
  font-size: var(--fs-body);
  padding: 8px 13px;
  border: 1px solid var(--c-steel);
  border-width: 0 1px 4px 1px;
  border-radius: 0;
  background: var(--c-surface);
  color: var(--c-steel);
}
.btn--contact:hover, .btn--contact:focus-visible {
  background: var(--c-orange);
  border-color: var(--c-orange);
  color: #fff;
}

/* --- Cards ---------------------------------------------------------------- */

.card {
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-card);
  padding: var(--sp-2);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-hover); }

.card__media { margin: 0; }
.card__media img { width: 100%; }

.card__body {
  padding: var(--sp-4) var(--sp-2);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card__title {
  font-family: var(--f-head);
  font-size: var(--fs-card-title);
  font-weight: 600;
  line-height: 1.4;
  color: var(--c-card-title);
  margin: 0 0 var(--sp-3);
}

.card__text {
  font-size: var(--fs-body);
  line-height: var(--lh-card);
  margin: 0 0 var(--sp-4);
}
.card__text:last-child { margin-bottom: 0; }

.card__action { margin-top: auto; align-self: flex-start; }

/* --- Tiles (image + caption, linked) -------------------------------------- */

.tile { display: block; }
.tile__media { overflow: hidden; margin: 0 0 var(--sp-2); }
.tile__media img {
  width: 100%;
  transition: transform 0.5s var(--ease);
}
.tile:hover .tile__media img { transform: scale(1.04); }
.tile__title {
  font-family: var(--f-head);
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--c-navy);
  margin: var(--sp-4) 0 0;
  transition: color var(--transition);
}
.tile:hover .tile__title { color: var(--c-orange-link); }

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  background: var(--c-navy-deep) url("../img/bg-footer.png") no-repeat bottom right;
  color: var(--c-footer-text);
  font-size: var(--fs-body);
  padding-block: var(--sp-9) var(--sp-7);
}
.site-footer a { color: var(--c-footer-text); }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--c-orange); }

.footer-grid {
  display: grid;
  gap: var(--sp-7);
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 23.35% 51.8% 24.5%; }
}

.footer-heading {
  position: relative;
  font-family: var(--f-head);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.4;
  /* Was the same muted grey as the links below it, so it read as another list
     item rather than a heading. White plus an accent rule separates them. */
  color: #FFFFFF;
  margin: 0 0 var(--sp-5);
  padding-bottom: var(--sp-3);
}
.footer-heading::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 38px;
  height: 2px;
  background: var(--c-orange);
}

.footer-menus { display: flex; gap: var(--sp-7); flex-wrap: wrap; }
.footer-menu { list-style: none; margin: 0; padding: 0; }
.footer-menu li { margin-bottom: var(--sp-2); }

.footer-contact { list-style: none; margin: 0; padding: 0; }
.footer-contact li {
  display: flex;
  align-items: center;
  gap: 13px;
  line-height: 40px;
}
.footer-contact .icon { width: 14px; color: var(--c-footer-text); flex: 0 0 14px; }

.footer-social {
  display: inline-flex;
  gap: var(--sp-1);
  margin-top: var(--sp-3);
}
.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  /* Filled rather than a bare glyph: at 34px in footer grey it read as
     decoration. A solid tile makes it obvious it can be clicked. */
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  transition: background-color var(--transition), color var(--transition), transform var(--transition);
}
.footer-social a svg { width: 19px; height: 19px; }
.footer-social a:hover, .footer-social a:focus-visible {
  background: var(--c-orange-deep);
  color: #fff;
  transform: translateY(-1px);
}

.footer-bar {
  background: var(--c-navy-black);
  border-top: 1px solid var(--c-footer-rule);
  color: var(--c-footer-text);
  text-align: center;
  padding-block: var(--sp-4);
  font-size: var(--fs-body);
}
.footer-bar p { margin: 0; }


/* --- Missing images ------------------------------------------------------- */
/* Anything referenced but not yet present in assets/ renders as a grey field
   carrying the expected path, so gaps are obvious and the filename is to hand.
   Nothing here has any effect once the file exists. */

.media-img { width: 100%; object-fit: cover; object-position: left top; }

/* Rendered at the file's own proportions — nothing cropped, nothing stretched.
   Used for screenshots and diagrams, where losing an edge loses meaning. */
.media-img--natural {
  height: auto;
  object-fit: contain;
  object-position: left top;
}

.img-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--sp-3);
  text-align: center;
  color: var(--c-ph-text);
  background-color: var(--c-ph-bg);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.55) 0 10px,
    rgba(255, 255, 255, 0)   10px 20px
  );
  border: 1px dashed var(--c-ph-border);
}
.img-ph__label {
  font-family: var(--f-body);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-all;
  max-width: 100%;
}

/* Background-image blocks: banner, hero slide. */
[data-img-missing] {
  position: relative;
  background-color: var(--c-ph-bg-dark);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.07) 0 14px,
    rgba(255, 255, 255, 0)   14px 28px
  );
}
[data-img-missing]::after {
  content: "missing: " attr(data-img-missing);
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 6px 12px;
  font-family: var(--f-body);
  font-size: 12px;
  line-height: 1.4;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  word-break: break-all;
}


.footer-logo__img { width: 190px; }
.site-footer .img-ph { padding: 4px; }
.site-footer .img-ph__label { font-size: 10px; }

.footer-address {
  font-style: normal;
  line-height: 1.7;
  margin-top: var(--sp-3);
  color: var(--c-footer-text);
}
