/* Cipher Catalyst website styles. */

:root {
  --bg: #fbfcfe;            /* off-white page background */
  --surface: #eaf0fa;       /* alternate section background */
  --card: #ffffff;          /* service cards, inputs */
  --text: #0f1b33;          /* dark neutral text */
  --muted: #4a5670;         /* secondary text */
  --border: #d3dcec;        /* decorative lines */
  --input-border: #7b8185;  /* form field borders (3:1 contrast) */
  --accent: #0b2a66;        /* navy: buttons, links */
  --accent-hover: #061d47;
  --on-accent: #ffffff;     /* text on navy */
  --accent-2: #f07a2c;      /* muted warm orange: small highlights, focus ring */
  --accent-3: #0b2a66;      /* navy, same as --accent: third card border and icon */
  --focus: var(--accent-2);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 6px;
  --gutter: 16px;
}

/* ---------- 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;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0;
}

p {
  margin: 0 0 1rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
}

/* Visible focus for keyboard users (falls back to :focus in older browsers). */
:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

.container {
  width: 100%;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1.25rem, 5vw, 5rem);
  padding-right: clamp(1.25rem, 5vw, 5rem);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
}

.skip-link:focus {
  top: 0.5rem;
}

section {
  scroll-margin-top: 6rem;
}

/* ---------- Header ---------- */

/* The header spans the full width, so the logo sits at the left edge of the screen. */
.site-header .container {
  max-width: none;
  padding-left: clamp(1rem, 4vw, 3rem);
  padding-right: clamp(1rem, 4vw, 3rem);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

/* Smaller header on phones, so it does not take much of the screen while it stays on top. */
@media (max-width: 39.99em) {
  .header-inner {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .brand {
    gap: 0.625rem;
  }

  .brand-mark {
    width: 2.25rem;
    height: 2.25rem;
  }

  .brand-name {
    font-size: 1.125rem;
  }

  .brand-sub {
    font-size: 0.625rem;
  }
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1rem;
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  flex: none;
  width: 3.25rem;
  height: 3.25rem;
  color: var(--accent);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}

.brand-sub {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--accent);
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0 0 0 -0.625rem; /* aligns link text with the brand when the nav wraps */
  padding: 0;
}

.nav-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.625rem;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
}

.nav-list a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-2);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* ---------- Hero ---------- */

.hero {
  padding: 3rem 0 3.5rem;
  background: var(--accent);
  color: var(--on-accent);
}

.hero h1 {
  color: var(--on-accent);
}

.hero .button {
  background: var(--accent-2);
  color: #0b1d3f;
}

.hero .button:hover {
  background: #e0661a;
}

.hero h1 {
  max-width: 26ch;
  margin-bottom: 1.75rem;
  font-size: 1.75rem;
  letter-spacing: -0.01em;
}

.hero h1::before {
  content: "";
  display: block;
  width: 3rem;
  height: 4px;
  margin-bottom: 1.25rem;
  background: var(--accent-2);
  border-radius: 2px;
}

.hero .lead {
  max-width: 44rem;
  margin-bottom: 1.75rem;
  font-size: 1.125rem;
  color: #d6e2f7;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  color: var(--on-accent);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-hover);
}

/* ---------- Sections ---------- */

.section {
  padding: 3rem 0;
}

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

.section h2 {
  margin-bottom: 1rem;
  color: var(--accent);
  font-size: 1.5rem;
}

.section > .container > p {
  max-width: 46rem;
}

/* ---------- What we do ---------- */

.services {
  display: grid;
  gap: 1rem;
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.services li {
  padding: 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent-2);
  border-radius: var(--radius);
}

.services h3 {
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
}

/* Card accents and icons: one colour per card, icons only on "What we do". */

.services li:nth-child(1) {
  border-top-color: var(--accent);
}

.services li:nth-child(2) {
  border-top-color: var(--accent-2);
}

.services li:nth-child(3) {
  border-top-color: var(--accent-3);
}

.icon {
  display: block;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: 0.75rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--accent);
}

.services li:nth-child(2) .icon {
  color: var(--accent-2);
}

.services li:nth-child(3) .icon {
  color: var(--accent-3);
}

/* Reassurance note in "How we work". */
.note {
  margin: 1.5rem 0 0;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-2);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 600;
}

/* ---------- How we work ---------- */

.steps {
  display: grid;
  gap: 1rem;
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 1.25rem 1.25rem 1.25rem 4rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  counter-increment: step;
}

/* Step number in a navy disc. */
.steps li::before {
  content: counter(step);
  position: absolute;
  top: 1.2rem;
  left: 1.25rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  line-height: 2rem;
  text-align: center;
}

.steps h3 {
  margin-bottom: 0.25rem;
  font-size: 1.125rem;
}

.steps p {
  margin: 0;
}

@media (min-width: 40em) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Contact form ---------- */

.contact-form {
  max-width: 44rem;
  margin-top: 1.5rem;
}

.form-note {
  font-size: 0.9375rem;
  color: var(--muted);
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  margin-bottom: 0.375rem;
  font-weight: 600;
}

.req,
.opt {
  font-weight: 400;
  font-size: 0.9375rem;
  color: var(--muted);
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  padding: 0.625rem 0.75rem;
  font: inherit;
  font-size: 1rem; /* 16px or more: stops iOS from zooming on focus */
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  -webkit-appearance: none;
  appearance: none;
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
}

/* ---------- Legal pages, consent checkbox, footer links ---------- */

/* Legal text stays at a readable line length, even though the container is wider. */
.legal {
  max-width: 46rem;
}

.page h1 {
  margin-bottom: 0.5rem;
  font-size: 2rem;
  color: var(--accent);
}

.updated {
  margin-bottom: 2rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

.legal h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.25rem;
}

.facts {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.facts li {
  margin-bottom: 0.5rem;
}

.field.check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.field.check input[type="checkbox"] {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  min-height: 0;
  margin: 0.25rem 0 0;
  padding: 0;
  accent-color: var(--accent);
}

.field.check label {
  margin: 0;
  font-weight: 400;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}

.footer-links a {
  color: var(--text);
}

/* ---------- Two-column layout on wide screens ---------- */

/* Decorative illustration in the hero. It carries no data. Hidden on phones. */
.visual {
  display: none;
}

.visual svg {
  display: block;
  width: 100%;
  height: auto;
}

@media (min-width: 60em) {
  .hero .container {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    column-gap: 4rem;
    align-items: center;
  }

  .hero .visual {
    display: block;
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    column-gap: 4rem;
    align-items: start;
  }

  .section > .container.split > p {
    max-width: none;
  }

  .split > h2 {
    grid-column: 1;
    grid-row: 1;
  }

  .split > p {
    grid-column: 2;
  }

  #contact.section .split > p {
    grid-column: 1;
  }

  #contact.section .split > .contact-form {
    grid-column: 2;
    grid-row: 1 / span 3;
    max-width: none;
    margin-top: 0;
  }
}

/* ---------- Figures band ---------- */

.figures {
  padding: 3.5rem 0;
  background: var(--accent);
  color: #ffffff;
}

.figures h2 {
  margin-bottom: 0.5rem;
  font-size: 1.75rem;
  color: #ffffff;
}

.figures .updated {
  color: #c9d6f0;
}

.metrics {
  display: grid;
  gap: 2rem;
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
}

.metric {
  position: relative;
  padding: 1.75rem 1.5rem 1.5rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  transition: transform 0.3s ease;
}

/* Decorative only: the orange rule draws across the top of each tile. It encodes no data. */
.metric::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  height: 3px;
  width: 0;
  background: var(--accent-2);
  border-radius: var(--radius) 0 0 0;
  transition: width 1s ease 0.25s;
}

.metric.is-in::before {
  width: calc(100% + 2px);
}

.metric:hover {
  transform: translateY(-4px);
}

/* Only when JavaScript runs: tiles rise in when they come into view. Without JS they stay visible. */
.js .metric {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .metric.is-in {
  opacity: 1;
  transform: none;
}

.js .metric.is-in:hover {
  transform: translateY(-4px);
}

@media (prefers-reduced-motion: reduce) {
  .js .metric {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .metric::before {
    width: calc(100% + 2px);
    transition: none;
  }

  .metric:hover,
  .js .metric.is-in:hover {
    transform: none;
  }
}

.metric-value {
  display: block;
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.metric-label {
  display: block;
  margin-top: 0.625rem;
  color: #c9d6f0;
}

@media (min-width: 40em) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Secondary figures: smaller tiles, 2 per row. */
.metrics-sm {
  gap: 1rem;
  margin-top: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metrics-sm .metric {
  padding: 1.25rem 1rem 1rem;
}

.metrics-sm .metric-value {
  font-size: clamp(2rem, 5vw, 2.75rem);
}

@media (min-width: 40em) {
  .metrics-sm {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Main figures: an odd last tile spans the full row instead of leaving a gap. */
@media (min-width: 40em) {
  .metrics:not(.metrics-sm) .metric:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

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

.site-footer {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ---------- Larger screens ---------- */

@media (min-width: 40em) {
  body {
    font-size: 1.0625rem;
  }

  .nav-list {
    margin-left: 0;
  }

  .hero {
    padding: 4.5rem 0 5rem;
  }

  .hero h1 {
    font-size: 3.5rem;
  }

  .section {
    padding: 4rem 0;
  }

  .section h2 {
    font-size: 1.75rem;
  }
}

@media (min-width: 48em) {
  .services {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
