/*
  Homepage R3 theme and interaction layer.
  This file deliberately does not change either case study's composition.
*/
:root {
  --canvas: #f6f2e8;
  --canvas-bright: #fffdf7;
  --canvas-deep: #e8e4d9;
  --sage: #e8e4d9;
  --sage-deep: #d9d5ca;
  --ink: #111410;
  --ink-soft: #292e28;
  --body: #414740;
  --muted: #666b63;
  --line: #ccc8bc;
  --line-soft: #e2ded3;
  --white: #fffdf7;
  --paper: #f6f2e8;
  --paper-raised: #fffdf7;
  --paper-deep: #e8e4d9;
  --signal: #3f50f0;
  --signal-dark: #2939c9;
  --signal-light: #8fa2ff;
  --accent: #3f50f0;
  --accent-strong: #2939c9;
  --accent-on-dark: #8fa2ff;
  --muted-on-dark: #b7bcb6;
  --line-on-dark: rgba(255, 255, 255, .15);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius: 20px;
  --cursor-x: -100px;
  --cursor-y: -100px;
}

html { scroll-padding-top: 132px; }

body,
body * {
  font-family: Manrope, Arial, sans-serif;
}

body {
  background: var(--canvas);
  color: var(--body);
  font-size: clamp(1.02rem, .98rem + .18vw, 1.15rem);
}

h1, h2, h3, h4,
.case-stats strong,
.stats strong,
.mailto {
  font-family: Manrope, Arial, sans-serif;
  letter-spacing: -.038em;
}

:focus-visible {
  outline-color: var(--signal);
  outline-offset: 4px;
}

/* Homepage-style floating glass navigation, retaining each page's link structure. */
.hdr,
.site-header {
  position: sticky;
  top: 14px;
  z-index: 200;
  width: min(1240px, calc(100% - 28px));
  min-height: 82px;
  margin: 14px auto 0;
  border: 1px solid rgba(17, 20, 16, .1);
  border-radius: 26px;
  background: rgba(255, 253, 247, .9);
  box-shadow: 0 14px 42px rgba(17, 20, 16, .08);
  -webkit-backdrop-filter: blur(10px) saturate(125%);
  backdrop-filter: blur(10px) saturate(125%);
}

.hdr { padding: 0; }

.hdr .wrapper {
  width: 100%;
  max-width: none;
  height: 82px;
  padding: 0 clamp(18px, 3vw, 32px);
}

.site-header {
  padding: 0 clamp(18px, 3vw, 32px);
}

.wordmark {
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -.05em;
}

.wordmark span { color: var(--signal); }

.backlink,
.navcta,
.site-header nav a,
.site-header .contact-link {
  min-height: 46px;
  padding: 0 17px;
  border-color: transparent;
  border-radius: 15px;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  transition: color 160ms ease, background-color 160ms ease, font-weight 160ms ease;
}

.backlink:hover,
.navcta:hover,
.site-header nav a:hover,
.site-header .contact-link:hover {
  border-color: transparent;
  background: rgba(63, 80, 240, .08);
  color: var(--signal-dark);
  font-weight: 750;
}

.backlink svg,
.backlink:hover svg,
.site-header nav a svg,
.site-header nav a:hover svg {
  transform: none;
}

/* Keep the main case study's horizontal chapter strip. */
.case-chapters,
.chapter-nav {
  top: 110px;
  border-color: var(--line-soft);
  background: rgba(246, 242, 232, .97);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.case-chapters a,
.chapter-nav a {
  color: var(--muted);
  font-size: .96rem;
  transition: color 160ms ease, font-weight 160ms ease;
}

.case-chapters a:hover,
.chapter-nav a:hover,
.case-chapters a[aria-current],
.chapter-nav a[aria-current] {
  color: var(--signal-dark);
  font-weight: 750;
}

.case-chapters a::after,
.chapter-nav a::after {
  background: var(--signal);
}

/* Keep Address Validation's desktop side rail and its original collapse point. */
.section-nav > p,
.section-nav a,
.section-nav a span {
  font-family: Manrope, Arial, sans-serif;
}

.section-nav > p {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.section-nav a {
  color: var(--muted);
  font-size: .9rem;
}

.section-nav a span {
  color: var(--line);
  font-size: .76rem;
}

.section-nav a:hover,
.section-nav a[aria-current="location"] {
  color: var(--signal-dark);
  font-weight: 750;
}

.section-nav a[aria-current="location"] span { color: var(--signal); }

/* Typography and colour only. Page silhouettes remain owned by their source HTML. */
.case-kicker,
.section-heading > span,
.method-intro > span,
.revised-plan > div > span,
.reflection-grid article > span,
.principal-lesson > span,
.next-case span,
.validation-overview article > span,
.validation-cases article > span,
.tradeoff-panel span,
.decision-label,
.decision-num,
.research-sequence > span,
.legacy-content cite,
.source-list a,
figcaption,
.cap {
  font-family: Manrope, Arial, sans-serif;
  letter-spacing: 0;
  text-transform: none;
}

.case-kicker,
.section-heading > span,
.method-intro > span,
.revised-plan > div > span,
.reflection-grid article > span,
.principal-lesson > span,
.validation-overview article > span,
.validation-cases article > span,
.tradeoff-panel span,
.decision-label,
.decision-num,
.research-sequence > span {
  color: var(--signal-dark);
  font-size: clamp(.86rem, .82rem + .12vw, .96rem);
  font-weight: 700;
}

.case-hero,
.block.dark,
.case-section.dark,
.dark-chapter,
.legacy-section,
.contact {
  background: var(--ink);
}

.case-hero h1,
.block.dark h2,
.block.dark h3,
.case-section.dark h2,
.case-section.dark h3,
.dark-chapter h2,
.dark-chapter h3,
.legacy-section h2,
.legacy-section h3,
.contact h2 {
  color: var(--white);
}

.case-lede,
.dark-chapter p,
.legacy-section p { color: var(--muted-on-dark); }

.case-hero .case-kicker,
.dark-chapter .section-heading > span,
.dark-chapter .section-intro > span,
.legacy-section .section-heading > span,
.legacy-content cite,
.source-list a:hover {
  color: var(--signal-light);
}

.hero-system,
.next-case,
.annotation-pin {
  background: var(--signal);
}

.sender-card { background: var(--signal); }
.recipient-card { background: var(--canvas-deep); }
.sage-chapter { background: var(--canvas-deep); }

.scope-note,
.evidence-note,
.case-callout,
.callout {
  border-color: var(--signal);
}

.artifact-frame,
figure img,
.case-figure img,
.case-section img,
.block img {
  border-radius: var(--radius-md);
}

.artifact-frame {
  border-color: var(--line-soft);
  background: var(--canvas-bright);
  box-shadow: 0 22px 62px rgba(17, 20, 16, .08);
}

figcaption,
.cap {
  color: var(--muted);
  font-size: clamp(.92rem, .88rem + .12vw, 1rem);
}

.dark-chapter figcaption,
.legacy-section figcaption { color: #b8bdb7; }

.map-column + .map-column,
.evidence-boundary,
.source-list,
.source-list a {
  border-color: rgba(255, 255, 255, .15);
}

.source-list a {
  color: #c5cac4;
  transition: color 160ms ease, font-weight 160ms ease;
}

.source-list a:hover {
  padding-left: 0;
  font-weight: 700;
}

/* Static evidence stays static. Only links advertise interactivity. */
article,
.system-card,
.artifact-frame,
.validation-overview > *,
.validation-cases > *,
.research-grid > *,
.reflection-columns > *,
.shipped-matrix > * {
  transform: none;
}

article:hover,
.system-card:hover,
.artifact-frame:hover,
.validation-overview > *:hover,
.validation-cases > *:hover,
.research-grid > *:hover,
.reflection-columns > *:hover,
.shipped-matrix > *:hover {
  transform: none;
}

.next-case a,
.morework a,
.footer-links a {
  transition: color 160ms ease, background-color 160ms ease, font-weight 160ms ease;
}

.morework a:hover,
.footer-links a:hover { transform: none; }

/* Replace the old blur reveal with the homepage's restrained positional reveal. */
@keyframes r3-rise {
  from { opacity: .78; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.case-motion,
figure,
.artifact,
.artifact-frame,
.artifact-frame img {
  filter: none;
  rotate: 0deg;
}

@supports (animation-timeline: view()) {
  .case-section > *,
  .block .wrap > *,
  .case-outcome > *,
  figure,
  .hero-img,
  .case-hero-media,
  .case-figure,
  .case-figure-grid,
  .coverage-figure,
  .chapter > .section-intro,
  .chapter > .decision-block,
  .chapter > .artifact,
  .chapter > .research-grid,
  .chapter > .reflection-columns {
    animation-name: r3-rise;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-timeline: view();
    animation-range: entry 4% cover 18%;
  }
}

/* Homepage reading progress colour, preserving the Address Validation element. */
.reading-progress { background: rgba(63, 80, 240, .12); }
.reading-progress span { background: var(--signal); }

/* Homepage iPad-style pointer. */
@media (hover: hover) and (pointer: fine) {
  html.has-ipad-cursor a,
  html.has-ipad-cursor button,
  html.has-ipad-cursor summary { cursor: none !important; }
}

#ipad-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(17, 20, 16, .84);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(var(--cursor-x), var(--cursor-y), 0) translate(-50%, -50%);
  transition: width 150ms ease, height 150ms ease, background-color 150ms ease, opacity 120ms ease;
}

#ipad-cursor.is-visible { opacity: 1; }
#ipad-cursor.is-link {
  width: 42px;
  height: 42px;
  background: rgba(63, 80, 240, .78);
}
#ipad-cursor.is-pressed { width: 34px; height: 34px; }

@media (max-width: 760px) {
  html { scroll-padding-top: 112px; }

  .hdr,
  .site-header {
    top: 8px;
    width: calc(100% - 16px);
    min-height: 70px;
    margin-top: 8px;
    border-radius: 20px;
  }

  .hdr .wrapper { height: 70px; padding-inline: 10px; }
  .site-header { padding-inline: 10px; }
  .site-header .contact-link,
  .navcta { display: none; }
  .backlink,
  .site-header nav a { padding-inline: 12px; font-size: .95rem; }
  .case-chapters,
  .chapter-nav { top: 86px; }
  #ipad-cursor { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  #ipad-cursor { display: none !important; }
}
