/* ==========================================================================
   David McAliley — portfolio styles
   Retune the whole site from the tokens in :root.
   ========================================================================== */

:root {
  /* Colour */
  --navy-900: #0c1a2b;   /* header, footer, dark bands */
  --navy-800: #13263d;
  --navy-700: #1d3555;
  --slate-700: #3b4a5c;  /* body text secondary (7.9:1 on white) */
  --slate-500: #5b6b7f;  /* muted text (5.3:1 on white) */
  --slate-300: #c9d2dc;  /* borders on light */
  --slate-100: #eef2f6;  /* light panels */
  --slate-50:  #f6f8fa;
  --white:     #ffffff;
  --ink:       #14202e;  /* body text (15.6:1 on white) */
  --accent:    #1f5fa8;  /* links, buttons (6.2:1 on white) */
  --accent-strong: #174a85;
  --accent-on-dark: #8fbcf0; /* links on navy (8.4:1 on navy-900) */
  --placeholder-bg: #fff8e6;
  --placeholder-border: #b7791f;
  --placeholder-ink: #6b4508;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);
  --step-4: clamp(2.125rem, 1.6rem + 2.6vw, 3.25rem);
  --leading: 1.6;

  /* Layout */
  --max: 72rem;
  --gutter: 1rem;
  --radius: 6px;
  --space-section: clamp(3rem, 2rem + 4vw, 5.5rem);
}
@media (min-width: 48rem) { :root { --gutter: 2rem; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: var(--leading);
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.6em; color: var(--navy-900); letter-spacing: -0.01em; }
h1 { font-size: var(--step-4); font-weight: 700; }
h2 { font-size: var(--step-3); font-weight: 700; }
h3 { font-size: var(--step-1); font-weight: 650; }
p, ul, ol { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--slate-100); padding: 0.1em 0.35em; border-radius: 3px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.band-dark :focus-visible, .site-header :focus-visible, .site-footer :focus-visible { outline-color: var(--accent-on-dark); }

.skip-link {
  position: absolute; left: var(--gutter); top: -3rem; z-index: 100;
  background: var(--white); color: var(--navy-900); padding: 0.5rem 0.9rem; border-radius: var(--radius);
}
.skip-link:focus { top: 0.5rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: var(--space-section) 0; }
.section--tint { background: var(--slate-50); border-top: 1px solid var(--slate-100); border-bottom: 1px solid var(--slate-100); }
.eyebrow { display: block; font-size: var(--step--1); font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slate-500); margin-bottom: 0.75rem; }
.lead { font-size: var(--step-1); color: var(--slate-700); max-width: 40em; }
.muted { color: var(--slate-500); }
.measure { max-width: 42em; }

/* ---------- Header (shared) ---------- */
.site-header { background: var(--navy-900); color: var(--white); position: relative; z-index: 10; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.brand { color: var(--white); text-decoration: none; font-weight: 700; font-size: 1.0625rem; letter-spacing: 0.01em; line-height: 1.2; }
.brand span { display: block; font-weight: 400; font-size: 0.8125rem; color: #b8c6d6; letter-spacing: 0.02em; }
.brand:hover { color: var(--white); }
.nav-toggle {
  display: none; background: transparent; color: var(--white); border: 1px solid #4a5f7a;
  border-radius: var(--radius); padding: 0.45rem 0.8rem; font: inherit; font-size: var(--step--1); cursor: pointer;
}
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.25rem; flex-wrap: wrap; }
.site-nav a {
  display: block; color: #dbe4ee; text-decoration: none; padding: 0.5rem 0.75rem; border-radius: var(--radius); font-size: 0.9375rem;
}
.site-nav a:hover { color: var(--white); background: var(--navy-800); }
.site-nav a[aria-current="page"] { color: var(--white); box-shadow: inset 0 -2px 0 var(--accent-on-dark); border-radius: 0; }

/* JS-enhanced mobile nav: without JS the links simply wrap. */
@media (max-width: 47.99rem) {
  .js .nav-toggle { display: inline-block; }
  .js .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--navy-900); border-top: 1px solid var(--navy-700); }
  .js .site-nav.is-open { display: block; }
  .js .site-nav ul { flex-direction: column; padding: 0.5rem var(--gutter) 1rem; }
  .js .site-nav a { padding: 0.75rem 0.5rem; font-size: var(--step-0); }
  .js .site-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent-on-dark); padding-left: 0.85rem; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; font: inherit; font-weight: 600; font-size: 0.9375rem; text-decoration: none;
  padding: 0.7rem 1.15rem; border-radius: var(--radius); border: 1px solid var(--accent);
  background: var(--accent); color: var(--white); line-height: 1.2;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--white); }
.btn--ghost { background: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--slate-100); color: var(--accent-strong); }
.band-dark .btn--ghost { color: var(--white); border-color: #6b819c; }
.band-dark .btn--ghost:hover { background: var(--navy-800); color: var(--white); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* ---------- Hero ---------- */
.hero { background: var(--navy-900); color: #dbe4ee; padding: clamp(2.5rem, 1.5rem + 5vw, 5rem) 0 clamp(3rem, 2rem + 4vw, 5rem); }
.hero h1 { color: var(--white); max-width: 15em; }
.hero .eyebrow { color: #a9bccf; }
.hero .lead { color: #dbe4ee; }
.hero-grid { display: grid; gap: 2.5rem; align-items: center; }
.hero-facts { list-style: none; padding: 0; margin: 2rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: var(--step--1); color: #b8c6d6; }
.hero-facts li { padding-left: 0.9rem; position: relative; }
.hero-facts li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 0.35rem; height: 0.35rem; background: var(--accent-on-dark); border-radius: 1px; }
.hero-figure { margin: 0; justify-self: center; max-width: 13rem; }
@media (min-width: 60rem) { .hero-figure { max-width: 17rem; } }
.hero-figure figcaption { white-space: nowrap; font-size: 0.8125rem; color: #a9bccf; margin-top: 0.75rem; text-align: center; }
@media (min-width: 60rem) {
  .hero-grid { grid-template-columns: 1fr 17rem; gap: 4rem; }
}

/* Inner-page header */
.page-hero { background: var(--navy-900); color: #dbe4ee; padding: clamp(2.25rem, 1.5rem + 3.5vw, 3.75rem) 0; }
.page-hero h1 { color: var(--white); max-width: 18em; }
.page-hero .eyebrow { color: #a9bccf; }
.page-hero .lead { color: #dbe4ee; margin-bottom: 0; }

/* Phone-screenshot frame (real screenshots only) */
.phone-shot { border-radius: 1.4rem; border: 6px solid #2a3d55; background: #0b1622; overflow: hidden; }
.phone-shot img { width: 100%; }

/* ---------- Section heading ---------- */
.section-head { margin-bottom: 2.25rem; max-width: 44em; }
.section-head p { color: var(--slate-700); margin: 0; }

/* ---------- Project cards ---------- */
.project-grid { display: grid; gap: 1.5rem; }
@media (min-width: 48rem) { .project-grid--secondary { grid-template-columns: 1fr 1fr; } }

.card {
  background: var(--white); border: 1px solid var(--slate-300); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
}
.card-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.card h3 { font-size: var(--step-2); margin-bottom: 0.35rem; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--accent); text-decoration: underline; }
.card p { color: var(--slate-700); }
.card .card-link { margin-top: auto; font-weight: 600; }
.card-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; }
.card-actions .card-link { margin-top: 0; }
.card-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.tag {
  display: inline-block; font-size: 0.8125rem; font-weight: 600; line-height: 1.3;
  padding: 0.2rem 0.55rem; border-radius: 3px; background: var(--slate-100); color: var(--slate-700);
}
.tag--status { background: #e6effa; color: var(--accent-strong); }
.card-list { list-style: none; padding: 0; margin: 0 0 1.25rem; font-size: 0.9375rem; color: var(--slate-700); }
.card-list li { padding: 0.3rem 0 0.3rem 1rem; position: relative; border-top: 1px solid var(--slate-100); }
.card-list li::before { content: ""; position: absolute; left: 0; top: 1.1em; width: 0.4rem; height: 1px; background: var(--slate-500); }
.card-note { font-size: 0.875rem; color: var(--slate-500); border-left: 3px solid var(--slate-300); padding-left: 0.75rem; margin: 0 0 1.25rem; }

.card--feature .card-media { background: var(--slate-100); display: flex; justify-content: center; align-items: flex-end; gap: 1rem; padding: 1.75rem 1.5rem 0; overflow: hidden; }
.card--feature .card-media:has(.placeholder) { align-items: center; padding: 1.5rem; }
.card--feature .card-media .phone-shot { width: 46%; max-width: 15rem; border-bottom: 0; border-radius: 1.2rem 1.2rem 0 0; }
.card--feature .card-media .phone-shot img { aspect-ratio: 640 / 900; object-fit: cover; object-position: top; }
.screen-shot { border: 1px solid var(--slate-300); border-radius: 0.5rem; background: #fff; overflow: hidden; box-shadow: 0 1px 2px rgba(12, 26, 43, 0.08); }
.screen-shot img { width: 100%; }
.card--feature .card-media .screen-shot { width: 100%; max-width: 34rem; margin-bottom: 1.5rem; }
@media (min-width: 60rem) {
  .card--feature { flex-direction: row; }
  .card--feature .card-media { flex: 0 0 44%; order: 2; align-items: center; padding: 2rem 1.75rem; }
  .card--feature .card-media .phone-shot { border-bottom: 6px solid #2a3d55; border-radius: 1.2rem; }
  .card--feature .card-media .phone-shot img { aspect-ratio: auto; }
  .card--feature .card-media .screen-shot { margin-bottom: 0; }
  .card--feature .card-body { padding: 2rem 2.25rem; }
}

/* ---------- Placeholders (visible on purpose) ---------- */
.placeholder {
  border: 2px dashed var(--placeholder-border); background: var(--placeholder-bg); color: var(--placeholder-ink);
  border-radius: var(--radius); padding: 1rem; font-size: 0.875rem; font-weight: 600; line-height: 1.45;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.placeholder--media { min-height: 14rem; width: 100%; margin-bottom: 1.5rem; }
.card--feature .placeholder--media { margin: 0; }
.needs-content {
  background: var(--placeholder-bg); color: var(--placeholder-ink); border: 1px dashed var(--placeholder-border);
  padding: 0.05em 0.35em; border-radius: 3px; font-weight: 600; font-size: 0.9em;
}

/* ---------- Capabilities ---------- */
.cap-grid { display: grid; gap: 1px; background: var(--slate-300); border: 1px solid var(--slate-300); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 40rem) { .cap-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 64rem) { .cap-grid { grid-template-columns: 1fr 1fr 1fr; } }
.cap { background: var(--white); padding: 1.5rem; }
.cap h3 { font-size: 1.0625rem; margin-bottom: 0.4rem; }
.cap p { margin: 0; color: var(--slate-700); font-size: 0.9375rem; }
.cap-num { display: block; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--accent); margin-bottom: 0.5rem; }

/* ---------- Split / proof ---------- */
.split { display: grid; gap: 2rem; }
@media (min-width: 56rem) { .split { grid-template-columns: 1fr 1fr; gap: 4rem; } }
.fact-list { list-style: none; padding: 0; margin: 0; }
.fact-list li { padding: 1rem 0; border-top: 1px solid var(--slate-300); }
.fact-list li:last-child { border-bottom: 1px solid var(--slate-300); }
.fact-list strong { display: block; color: var(--navy-900); }
.fact-list span { color: var(--slate-700); font-size: 0.9375rem; }

/* ---------- Form ---------- */
.form { display: grid; gap: 1.25rem; max-width: 36rem; }
.field { display: grid; gap: 0.4rem; }
.field label { font-weight: 600; color: var(--navy-900); }
.field .hint { font-size: var(--step--1); color: var(--slate-700); font-weight: 400; }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink); background: var(--white); width: 100%;
  border: 1px solid var(--slate-500); border-radius: var(--radius); padding: 0.65rem 0.75rem;
}
.field textarea { min-height: 9rem; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.form .btn { justify-self: start; font-size: var(--step-0); }
.hp-field { display: none; }
.aside-box { border: 1px solid var(--slate-300); border-radius: var(--radius); padding: 1.5rem; background: var(--slate-50); }
.aside-box h2 { font-size: var(--step-1); margin-bottom: 0.5rem; }
.aside-box p:last-child { margin-bottom: 0; }

/* ---------- Dark band ---------- */
.band-dark { background: var(--navy-900); color: #dbe4ee; }
.band-dark h2 { color: var(--white); }
.band-dark a:not(.btn) { color: var(--accent-on-dark); }

/* ---------- Footer (shared) ---------- */
.site-footer { background: var(--navy-900); color: #b8c6d6; font-size: 0.9375rem; padding: 2.5rem 0; border-top: 1px solid var(--navy-700); }
.footer-grid { display: grid; gap: 1.5rem; }
@media (min-width: 48rem) { .footer-grid { grid-template-columns: 2fr 1fr; align-items: start; } }
.site-footer a { color: var(--accent-on-dark); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.site-footer p { margin: 0 0 0.4rem; }
.footer-name { color: var(--white); font-weight: 600; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  a, .btn { transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .nav-toggle, .btn-row { display: none; }
  .hero, .band-dark { background: none; color: var(--ink); }
  .hero h1, .band-dark h2 { color: var(--ink); }
}

/* ---------- Case studies and inner pages ---------- */
.cs-meta { display: grid; gap: 1rem 2rem; margin: 2rem 0 0; padding: 1.25rem 0 0; border-top: 1px solid var(--navy-700); }
@media (min-width: 48rem) { .cs-meta { grid-template-columns: repeat(4, 1fr); } }
.cs-meta dt { font-size: 0.8125rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: #a9bccf; }
.cs-meta dd { margin: 0.2rem 0 0; color: var(--white); font-size: 0.9375rem; }
.prose { max-width: 44em; }
.prose h2 { margin-top: 0; }
.prose h3 { margin: 1.75rem 0 0.4rem; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin-bottom: 0.4rem; }
.block + .block { margin-top: clamp(2.5rem, 2rem + 2vw, 3.5rem); }
.callout { border-left: 3px solid var(--accent); background: var(--slate-50); padding: 1rem 1.25rem; border-radius: 0 var(--radius) var(--radius) 0; max-width: 44em; }
.callout p:last-child { margin-bottom: 0; }
.status-grid { display: grid; gap: 1rem; }
@media (min-width: 48rem) { .status-grid { grid-template-columns: 1fr 1fr; } }
.status-box { border: 1px solid var(--slate-300); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.status-box h3 { margin: 0 0 0.5rem; font-size: var(--step-0); }
.status-box ul { margin: 0; padding-left: 1.1rem; }
.status-box--planned { border-style: dashed; background: var(--slate-50); }
.shots { display: grid; gap: 1.5rem; grid-template-columns: repeat(2, 1fr); align-items: start; }
@media (min-width: 48rem) { .shots { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 64rem) { .shots--phones { grid-template-columns: repeat(4, 1fr); } }
.shots figure, .shot-wide { margin: 0; }
.shots figcaption, .shot-wide figcaption { font-size: var(--step--1); color: var(--slate-700); margin-top: 0.6rem; line-height: 1.45; }
.shots .phone-shot { max-width: 15rem; }
.shots--wide { grid-template-columns: 1fr; }
@media (min-width: 56rem) { .shots--wide { grid-template-columns: 1fr 1fr; } }
.shot-wide { max-width: 60rem; }
.shots--doc { grid-template-columns: 1fr; }
@media (min-width: 56rem) { .shots--doc { grid-template-columns: 1fr 2fr; } }
.steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: 1rem; max-width: 44em; }
.steps li { counter-increment: step; position: relative; padding-left: 2.75rem; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--navy-800); color: var(--white); font-size: 0.875rem; font-weight: 700; display: grid; place-items: center; }
.record { border: 1px solid var(--slate-300); border-radius: var(--radius); overflow: hidden; max-width: 52rem; font-size: 0.9375rem; }
.record-label { background: var(--navy-800); color: var(--white); padding: 0.6rem 1rem; font-size: 0.8125rem; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
.record table { width: 100%; border-collapse: collapse; }
.record th, .record td { text-align: left; vertical-align: top; padding: 0.65rem 1rem; border-top: 1px solid var(--slate-300); }
.record th { width: 34%; font-weight: 600; color: var(--navy-900); background: var(--slate-50); }
.record code { font-family: var(--font-mono); font-size: 0.875em; }
.flag { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 3px; background: var(--placeholder-bg); color: var(--placeholder-ink); border: 1px solid var(--placeholder-border); margin-left: 0.35rem; }
.next-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--slate-300); padding-top: 1.5rem; font-weight: 600; }
.table-scroll { overflow-x: auto; }
.mt-1 { margin-top: 1.25rem; }
