/* ==========================================================================
   phillipwigington.com — main stylesheet
   Structure: tokens → base → layout → components → pages → utilities
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --ink: #14213d;          /* headings, header, dark sections */
  --ink-2: #1f2f52;
  --text: #2b3340;         /* body text */
  --muted: #5a6472;        /* secondary text */
  --bg: #faf8f5;           /* page background (warm off-white) */
  --surface: #ffffff;      /* cards */
  --surface-2: #f1eee9;    /* alternate section background */
  --line: #e2ddd5;         /* borders */
  --accent: #0f6a6a;       /* links, CTAs (AA on white and --bg) */
  --accent-hover: #0a5050;
  --accent-soft: #e3efee;
  --on-ink: #e9edf4;
  --on-ink-muted: #b4bdcc;

  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.4rem, 1.2rem + 0.8vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.4rem + 1.4vw, 2.4rem);
  --step-4: clamp(2.1rem, 1.6rem + 2.2vw, 3.25rem);

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: clamp(3.5rem, 2.5rem + 4vw, 6rem);

  --radius: 6px;
  --container: 1160px;
  --measure: 68ch;
  --shadow: 0 1px 2px rgba(20, 33, 61, 0.06), 0 4px 16px rgba(20, 33, 61, 0.05);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--space-2);
  letter-spacing: -0.01em;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }

p { margin: 0 0 var(--space-2); }
ul, ol { margin: 0 0 var(--space-2); padding-left: 1.25rem; }
li + li { margin-top: 0.35rem; }

a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent-hover); }

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
}

.section { padding: var(--space-6) 0; }
.section--alt { background: var(--surface-2); }
.section--ink { background: var(--ink); color: var(--on-ink); }
.section--ink h2,
.section--ink h3 { color: #fff; }
.section--ink p { color: var(--on-ink-muted); }

.section-head { max-width: 46rem; margin-bottom: var(--space-5); }
.section-head p { color: var(--muted); font-size: var(--step-1); }
.section--ink .section-head p { color: var(--on-ink-muted); }

.eyebrow {
  display: block;
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-1);
}
.section--ink .eyebrow { color: #8fc9c4; }

.grid { display: grid; gap: var(--space-3); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }

.prose { max-width: var(--measure); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  z-index: 100;
}
.skip-link:focus { top: 1rem; color: #fff; }

/* ---------- Header / navigation ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: var(--space-2);
}

.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  line-height: 1.15;
}
.brand__name {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
}
.brand__tag {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: var(--step--1);
  color: var(--ink);
  cursor: pointer;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav li + li { margin-top: 0; }
.site-nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.975rem;
  padding: 0.4rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--line); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.site-nav .btn { border-bottom: 0; padding: 0.55rem 1.1rem; }
.site-nav .btn[aria-current="page"] { border-bottom: 0; }

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .js .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .js .site-nav.is-open { display: block; }
  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-1) clamp(1rem, 4vw, 2rem) var(--space-3);
  }
  .site-nav a { display: block; padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
  .site-nav a[aria-current="page"] { border-bottom-color: var(--line); color: var(--accent); }
  .site-nav .btn { margin-top: var(--space-2); text-align: center; }
  /* Without JS the nav simply wraps below the brand */
  html:not(.js) .site-header .container { flex-wrap: wrap; padding-bottom: var(--space-1); }
  html:not(.js) .nav-toggle { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.975rem;
  line-height: 1.2;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius);
  border: 2px solid var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn--ghost { background: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); color: var(--accent-hover); }
.btn--light { background: #fff; border-color: #fff; color: var(--ink); }
.btn--light:hover { background: var(--on-ink); border-color: var(--on-ink); color: var(--ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(3.5rem, 2rem + 6vw, 7rem) 0 var(--space-6);
  background:
    linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}
.hero .container {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: center;
}
.hero h1 { margin-bottom: var(--space-3); }
.hero__lead { font-size: var(--step-1); color: var(--muted); max-width: 40rem; margin-bottom: var(--space-4); }

.hero__panel {
  background: var(--ink);
  color: var(--on-ink);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow);
}
.hero__panel h2 {
  color: #fff;
  font-size: var(--step-1);
  margin-bottom: var(--space-3);
}
.hero__panel dl { margin: 0; display: grid; gap: var(--space-2); }
.hero__panel dt {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8fc9c4;
}
.hero__panel dd { margin: 0.15rem 0 0; color: var(--on-ink); }
.hero__panel div + div { border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: var(--space-2); }

@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; }
}

/* Page hero (interior pages) */
.page-hero {
  padding: clamp(3rem, 2rem + 4vw, 5rem) 0 clamp(2.5rem, 2rem + 2vw, 3.5rem);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.page-hero h1 { max-width: 48rem; }
.page-hero p { font-size: var(--step-1); color: var(--muted); max-width: 46rem; margin: 0; }

/* ---------- Credibility strip ---------- */
.cred-strip { background: var(--ink); color: var(--on-ink); }
.cred-strip ul {
  list-style: none;
  margin: 0;
  padding: var(--space-3) 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1) var(--space-4);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.cred-strip li + li { margin-top: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  height: 100%;
}
.card h3 { margin-bottom: var(--space-1); }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.card--accent { border-top: 3px solid var(--accent); }
.card-title { font-size: var(--step-1); }
.card__link { font-weight: 600; text-decoration: none; }
.card__link::after { content: " \2192"; }
.card__meta {
  font-size: var(--step--1);
  color: var(--muted);
  margin-bottom: var(--space-2);
}

/* ---------- Process steps ---------- */
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  counter-reset: step;
}
.steps li { margin: 0; counter-increment: step; padding-top: var(--space-2); border-top: 2px solid rgba(255, 255, 255, 0.2); }
.steps li::before {
  content: "0" counter(step);
  display: block;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: #8fc9c4;
  margin-bottom: var(--space-1);
}
.steps h3 { margin-bottom: 0.4rem; }
.steps p { margin: 0; }

.commitments {
  margin-top: var(--space-5);
  padding: var(--space-4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
}
.commitments h3 { margin-bottom: var(--space-2); }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { position: relative; padding-left: 1.75rem; }
.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.8rem;
  height: 0.45rem;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}
.section--ink .check-list li { color: var(--on-ink); }
.section--ink .check-list li::before { border-color: #8fc9c4; }
.commitments .check-list { display: grid; gap: 0.5rem var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.commitments .check-list li + li { margin-top: 0; }

/* ---------- Service detail blocks ---------- */
.service {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: var(--space-5);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 90px;
}
.service:first-of-type { border-top: 0; padding-top: 0; }
.service__intro p { color: var(--muted); }
.service__body h3 { font-family: var(--font-sans); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: var(--space-3) 0 var(--space-1); }
.service__body h3:first-child { margin-top: 0; }
@media (max-width: 820px) {
  .service { grid-template-columns: 1fr; gap: var(--space-2); }
}

.jump-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
}
.jump-links li + li { margin-top: 0; }
.jump-links a {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--step--1);
  text-decoration: none;
  color: var(--text);
  background: var(--bg);
}
.jump-links a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Solutions ---------- */
.solution {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
  padding: var(--space-5) 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 90px;
}
.solution:first-of-type { border-top: 0; padding-top: 0; }
.solution__figure {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3);
  margin: 0;
}
.solution__figure figcaption { font-size: var(--step--1); color: var(--muted); margin-top: var(--space-2); }
.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  margin-bottom: var(--space-2);
}
@media (max-width: 900px) {
  .solution { grid-template-columns: 1fr; }
}

/* Diagram text styles (inline SVG) */
.diagram text { font-family: var(--font-sans); font-size: 13px; fill: var(--ink); }
.diagram .d-box { fill: var(--bg); stroke: var(--line); stroke-width: 1.5; }
.diagram .d-core { fill: var(--ink); }
.diagram .d-core-text { fill: #fff; font-weight: 600; }
.diagram .d-label { fill: var(--muted); font-size: 11px; letter-spacing: 0.06em; }
.diagram .d-line { stroke: var(--accent); stroke-width: 1.75; fill: none; }
.diagram .d-arrow { fill: var(--accent); }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--space-5);
  align-items: start;
}
.portrait {
  aspect-ratio: 4 / 5;
  background: var(--ink);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--font-serif);
  font-size: 4rem;
  letter-spacing: 0.04em;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }
.sidebar-card { margin-top: var(--space-3); }
.sidebar-card h2 { font-size: var(--step-1); }
@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 280px; }
}

.badge-embed { margin-top: var(--space-2); min-height: 120px; }

.skills-list { columns: 2; column-gap: var(--space-4); list-style: none; padding: 0; }
.skills-list li { break-inside: avoid; padding: 0.3rem 0; border-bottom: 1px solid var(--line); margin: 0; }
@media (max-width: 520px) { .skills-list { columns: 1; } }

/* ---------- CTA band ---------- */
.cta-band { text-align: center; }
.cta-band h2 { margin-bottom: var(--space-2); }
.cta-band p { max-width: 38rem; margin: 0 auto var(--space-4); }
.cta-band .btn-row { justify-content: center; }

/* ---------- Forms ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }

.form { display: grid; gap: var(--space-3); }
.form-row { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.field label { display: block; font-weight: 600; color: var(--ink); margin-bottom: 0.35rem; font-size: 0.95rem; }
.field .optional { font-weight: 400; color: var(--muted); }
.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #c9c2b7;
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
}
.field textarea { min-height: 10rem; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.field [aria-invalid="true"] { border-color: #a12a2a; }
.field-error { color: #a12a2a; font-size: var(--step--1); margin-top: 0.35rem; }
.form-note { font-size: var(--step--1); color: var(--muted); margin: 0; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.alert {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  border: 1px solid;
  margin-bottom: var(--space-3);
}
.alert--error { background: #fbeeee; border-color: #e3b5b5; color: #7a1f1f; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: var(--on-ink-muted);
  padding: var(--space-5) 0 var(--space-3);
  font-size: 0.95rem;
}
.site-footer a { color: var(--on-ink); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.footer-grid h2 { font-family: var(--font-sans); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: #fff; margin-bottom: var(--space-2); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-brand { font-family: var(--font-serif); font-size: 1.25rem; color: #fff; margin-bottom: var(--space-1); }
.footer-legal { padding-top: var(--space-3); font-size: 0.8rem; line-height: 1.6; }
.footer-legal p { margin-bottom: var(--space-1); }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.mt-4 { margin-top: var(--space-4); }
.text-muted { color: var(--muted); }
