/* ============================================================
   Redfearn Group Design System
   ============================================================ */

:root {
  /* Brand + barn swallow palette */
  --rg-red:      #BF1E2E;
  --rg-blue:      #0A1128;
  --rg-cream:    #F7F4EF;
  --rg-green:    #1A6635;
  --rg-gape:     #FFCC00;
  --rg-tawny:    #D97443;
  --rg-ember:    #C2592A;

  /* Editorial neutrals */
  --rg-graphite: #2B2F36;
  --rg-slate:    #4B5563;
  --rg-ash:      #676E7C;
  --rg-mist:     #D1D5DB;
  --rg-paper:    #F8F9FA;
  --rg-bone:     #F7F5EF;

  /* Callout tints */
  --tint-blue:    #E9E9EE;
  --tint-slate:  #EEF0F2;
  --tint-paper:  #F8F9FA;
  --tint-mist:   #EFEFF1;
  --tint-tawny:  #FCF4F0;
  --tint-yellow: #FFFBEB;
  --tint-ember:  #FAF2EE;
  --tint-red:    #FAEDEE;
  --tint-green:  #EDF3EF;

  /* Type */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Identity layer default accent (main site chrome + marketing pages) */
  --accent: var(--rg-red);
  --accent-tint: rgba(191,30,46,0.08);
  --accent-border: rgba(191,30,46,0.22);
  --gradient-a: #BF1E2E;
  --gradient-b: #D97443;

  --max-width: 1180px;
}

/* Content-layer scope: case studies switch primary accent to ember */
.content-layer {
  --accent: var(--rg-ember);
  --accent-tint: rgba(194,89,42,0.08);
  --accent-border: rgba(194,89,42,0.24);
  --gradient-a: #C2592A;
  --gradient-b: #FFCC00;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }

body {
  margin: 0;
  background: var(--rg-cream);
  color: var(--rg-blue);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0 0 0.6em;
  color: var(--rg-blue);
}

h1 { font-size: clamp(2.5rem, 5vw, 4.5rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.05; }
h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
h3 { font-size: clamp(1.1rem, 2vw, 1.25rem); font-weight: 600; letter-spacing: -0.01em; }

p { margin: 0 0 1.1em; color: var(--rg-blue); }
p.lead { font-size: 1.15rem; font-weight: 300; color: var(--rg-slate); }

.small { font-size: 0.875rem; font-weight: 300; }

/* ---------- Layout ---------- */
.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.75rem;
}

.section { padding: 5rem 0; }
.section--tight { padding: 3rem 0; }
.section--border-top { border-top: 1px solid rgba(10,17,40,0.08); }

@media (max-width: 720px) {
  .section { padding: 3.25rem 0; }
}

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--rg-red);
  color: var(--rg-cream);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

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

/* ---------- Nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247,244,239,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(10,17,40,0.08);
}
.site-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.75rem;
  max-width: var(--max-width);
  margin: 0 auto;
}
.site-nav__brand {
  display: flex;
  align-items: center;
}
.site-nav__brand img { height: 50px; width: auto; display: block; }
.site-nav__links {
  display: flex;
  align-items: center;
  gap: 2rem;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-nav__links a {
  color: var(--rg-slate);
  transition: color 0.15s;
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
}
.site-nav__links a:hover,
.site-nav__links a[aria-current="page"] {
  color: var(--rg-blue);
  border-bottom-color: var(--rg-red);
}
.site-nav__toggle { display: none; }

@media (max-width: 720px) {
  .site-nav__links {
    position: fixed;
    top: 86px;
    left: 0;
    right: 0;
    height: calc(100vh - 86px);
    background: var(--rg-cream);
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem 1.75rem;
    gap: 1.5rem;
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }
  .site-nav__links.is-open { transform: translateX(0); }
  .site-nav__toggle {
    display: block;
    background: none;
    border: none;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rg-blue);
    cursor: pointer;
  }
}

/* ---------- Eyebrow / section label ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--rg-ash);
  margin-bottom: 1rem;
}
.eyebrow::before {
  content: '';
  display: block;
  width: 26px;
  height: 1px;
  background: var(--accent);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rg-ash);
  margin-bottom: 2rem;
}
.section-label::after {
  content: '';
  flex: 0 0 80px;
  height: 1px;
  background: var(--rg-mist);
}

/* ---------- Live badge ---------- */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.22rem 0.65rem;
  background: var(--accent-tint);
  border: 1px solid var(--accent-border);
  border-radius: 99px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rg-cream);
}
.live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--rg-red); }

/* ---------- Gradient bar ---------- */
.gradient-bar {
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, var(--gradient-a) 0%, var(--gradient-b) 100%);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.8rem 1.7rem;
  border-radius: 2px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.btn-primary { background: var(--rg-red); color: var(--rg-cream); }
.btn-primary:hover { transform: translateY(-1px); background: #a71926; }
.btn-ghost { background: transparent; border-color: rgba(10,17,40,0.2); color: var(--rg-blue); }
.btn-ghost:hover { border-color: var(--rg-red); color: var(--rg-red); }
.btn-ghost-dark { background: transparent; border-color: rgba(247,244,239,0.25); color: var(--rg-cream); }
.btn-ghost-dark:hover { border-color: var(--rg-red); color: var(--rg-red); }

/* ---------- Tags ---------- */
.tag {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tag-red     { color: var(--rg-red);    background: rgba(191,30,46,0.08); }
.tag-green   { color: var(--rg-green);  background: rgba(26,102,53,0.08); }
.tag-tawny   { color: var(--rg-tawny);  background: rgba(217,116,67,0.08); }
.tag-ember   { color: var(--rg-ember);  background: rgba(194,89,42,0.08); }
.tag-neutral { color: var(--rg-ash);    background: rgba(107,114,128,0.08); }

/* ---------- Card icons ---------- */
.card-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 1.1rem;
  color: var(--accent);
}
.card-icon svg { width: 100%; height: 100%; display: block; }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: #FFFFFF;
  border: 1px solid rgba(10,17,40,0.10);
  border-radius: 4px;
  padding: 2rem;
  transition: border-color 0.2s, transform 0.18s;
  overflow: hidden;
}
.card:hover { border-color: var(--accent-border); transform: translateY(-2px); }
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gradient-a) 0%, var(--gradient-b) 100%);
  opacity: 0;
  transition: opacity 0.2s;
}
.card:hover::before { opacity: 1; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.testimonial-card__quote {
  font-size: 1.02rem;
  font-style: italic;
  color: var(--rg-slate);
  margin: 0 0 1.25rem;
}
.testimonial-card__attribution {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--rg-ash);
  margin: 0;
}

/* ---------- Hero (dark) ---------- */
.hero {
  position: relative;
  background: var(--rg-blue);
  color: var(--rg-cream);
  overflow: hidden;
  padding: 6.5rem 0 5rem;
}
.hero p, .hero h1, .hero h2 { color: var(--rg-cream); }
.hero .eyebrow { color: rgba(247,244,239,0.55); }
.hero .eyebrow::before { background: var(--rg-red); }
.hero__lead {
  font-size: 1.2rem;
  font-weight: 300;
  color: rgba(247,244,239,0.75);
  max-width: 640px;
}
.hero__ctas { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }
.hero__credentials {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(247,244,239,0.1);
}
.hero__credential .value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--rg-cream);
}
.hero__credential .label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(247,244,239,0.5);
}

/* Ambient AI ops log - hero background texture */
.ambient-log {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  mask-image: linear-gradient(180deg, transparent, black 15%, black 75%, transparent);
}
.ambient-log__track {
  position: absolute;
  top: 0; left: 4%;
  width: 92%;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 2.1;
  color: var(--rg-gape);
  opacity: 0.06;
  white-space: pre;
  animation: scroll-log 60s linear infinite;
}
@keyframes scroll-log {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ambient-log__track { animation: none; }
}

/* ---------- Dual CTA split ---------- */
.split-cta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 720px) { .split-cta { grid-template-columns: 1fr; } }
.split-cta__panel {
  padding: 2.25rem;
  border-radius: 4px;
  border: 1px solid rgba(10,17,40,0.10);
  background: #fff;
}
.split-cta__panel.is-primary { background: var(--rg-blue); border-color: var(--rg-blue); }
.split-cta__panel.is-primary * { color: var(--rg-cream); }
.split-cta__panel.is-primary p { color: rgba(247,244,239,0.7); }
.split-cta__panel h2 { font-size: clamp(1.1rem, 2vw, 1.25rem); font-weight: 600; letter-spacing: -0.01em; }

/* ---------- Metrics strip ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 2rem;
}
.metric__value {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--rg-blue);
}
.metric__value .unit { color: var(--rg-red); }
.metric__label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rg-ash);
  margin-top: 0.4rem;
}

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute; left: 5px; top: 0.4rem; bottom: 0.4rem; width: 1px;
  background: var(--rg-mist);
}
.timeline__item { position: relative; padding-bottom: 2.75rem; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: '';
  position: absolute; left: -2rem; top: 0.35rem;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--rg-cream);
  border: 2px solid var(--rg-red);
}
.timeline__period {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rg-ash);
  margin-bottom: 0.35rem;
}
.timeline__role { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; margin-bottom: 0.5rem; }

/* ---------- Callout system ---------- */
.callout { border-radius: 0 6px 6px 0; padding: 0.9rem 1.2rem; margin-bottom: 1rem; position: relative; overflow: hidden; }
.callout::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.callout .lbl { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.3rem; }
.callout p { font-size: 0.9rem; color: var(--rg-blue); font-weight: 300; line-height: 1.6; margin: 0; }

.co-insight  { background: var(--tint-blue); }    .co-insight::before  { background: var(--rg-blue); }      .co-insight .lbl  { color: var(--rg-blue); }
.co-note     { background: var(--tint-slate); }  .co-note::before     { background: var(--rg-slate); }    .co-note .lbl     { color: var(--rg-slate); }
.co-bottom   { background: var(--tint-paper); }  .co-bottom::before   { background: var(--rg-blue); }      .co-bottom .lbl   { color: var(--rg-blue); }
.co-def      { background: var(--tint-mist); }   .co-def::before      { background: var(--rg-graphite); } .co-def .lbl      { color: var(--rg-graphite); }
.co-quote    { background: var(--tint-tawny); }  .co-quote::before    { background: var(--rg-tawny); }    .co-quote .lbl    { color: var(--rg-blue); }
.co-warning  { background: var(--tint-yellow); } .co-warning::before  { background: var(--rg-gape); }     .co-warning .lbl  { color: var(--rg-ember); }
.co-caution  { background: var(--tint-ember); }  .co-caution::before  { background: var(--rg-ember); }    .co-caution .lbl  { color: var(--rg-ember); }
.co-alert    { background: var(--tint-red); }    .co-alert::before    { background: var(--rg-red); }      .co-alert .lbl    { color: var(--rg-red); }

.sc { display: inline-block; padding: 0.18em 0.6em; border-radius: 3px; font-weight: 700; font-size: 0.8rem; font-family: var(--font-mono); }
.sc-green { background: var(--tint-green); color: var(--rg-green); }
.sc-tawny { background: var(--tint-tawny); color: var(--rg-tawny); }
.sc-ember { background: var(--tint-ember); color: var(--rg-ember); }
.sc-red   { background: var(--tint-red);   color: var(--rg-red); }

/* ---------- Footer ---------- */
.site-footer { background: var(--rg-blue); color: rgba(247,244,239,0.65); padding: 3.5rem 0 2.5rem; }
.site-footer a { color: var(--rg-cream); }
.site-footer a:hover { color: var(--rg-red); }
.site-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid rgba(247,244,239,0.1);
}
@media (max-width: 720px) { .site-footer__grid { grid-template-columns: 1fr; } }
.site-footer__bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: rgba(247,244,239,0.4);
}

/* ---------- Blog / Insights ---------- */
.post-list__item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid rgba(10,17,40,0.08);
}
.post-list__item:hover .post-list__title { color: var(--rg-red); }
.post-list__title { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; margin: 0; transition: color 0.15s; }
.post-list__meta { font-family: var(--font-mono); font-weight: 500; font-size: 0.75rem; color: var(--rg-ash); white-space: nowrap; }

.prose { max-width: 700px; font-size: 1.05rem; }
.prose h2 { margin-top: 2.2em; }
.prose h3 { margin-top: 1.8em; }
.prose img { border-radius: 4px; margin: 2rem 0; }
.prose blockquote {
  margin: 2rem 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--rg-slate);
}
.prose code {
  font-family: var(--font-mono);
  background: var(--rg-paper);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
}
.prose pre {
  background: var(--rg-blue);
  color: var(--rg-cream);
  padding: 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; color: inherit; }
.prose a { color: var(--accent); border-bottom: 1px solid var(--accent-border); }

/* ---------- Diagrams ---------- */
.diagram {
  max-width: 100%;
  margin: 2.5rem 0;
  padding: 1.5rem;
  background: var(--rg-paper);
  border: 1px solid rgba(10,17,40,0.08);
  border-radius: 6px;
}
.diagram svg { width: 100%; height: auto; display: block; }

/* ---------- Case study layout ---------- */
.cs-meta { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.5rem; }
.cs-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0;
  padding: 2rem 0;
  border-top: 1px solid rgba(10,17,40,0.08);
  border-bottom: 1px solid rgba(10,17,40,0.08);
}

/* ---------- Filter pills (work index) ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 2.5rem; }
.filter-pill {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4rem 0.9rem;
  border-radius: 99px;
  border: 1px solid rgba(10,17,40,0.15);
  color: var(--rg-slate);
  cursor: pointer;
  background: transparent;
  transition: all 0.15s;
}
.filter-pill.is-active,
.filter-pill:hover { border-color: var(--rg-red); color: var(--rg-red); }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.flex { display: flex; }
.gap-1 { gap: 1rem; }
.items-center { align-items: center; }
