/* ---------- Design tokens ---------- */
:root {
  --paper: #faf7f2;
  --paper-2: #f2ece1;
  --card: #fffdf9;
  --ink: #211f1c;
  --muted: #635d54;
  --hairline: #e3dccf;
  --accent: #b8431e;
  --accent-ink: #9a3616;
  --shadow: 0 1px 2px rgba(33, 31, 28, .04), 0 8px 24px rgba(33, 31, 28, .06);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --wrap: 68rem;
  --gap: clamp(1rem, 3vw, 2rem);
  --step--1: .875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.5rem, 3.5vw, 2rem);
  --step-3: clamp(2.4rem, 7vw, 4.25rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #191715;
    --paper-2: #211e1b;
    --card: #232019;
    --ink: #ece7dd;
    --muted: #a99f8f;
    --hairline: #37322b;
    --accent: #ef8355;
    --accent-ink: #f19b74;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  }
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.08; font-weight: 700; letter-spacing: -.01em; }

/* ---------- Accessibility helpers ---------- */
.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: .6rem 1rem; border-radius: 0 0 .5rem 0;
}
.skip:focus { left: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.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;
}

/* ---------- Layout ---------- */
.wrap { width: min(var(--wrap), 100% - 2.5rem); margin-inline: auto; }
.eyebrow {
  font-family: var(--sans); font-size: var(--step--1); font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 .5rem;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand:hover { color: var(--accent-ink); }
.nav-links { display: flex; gap: clamp(.9rem, 3vw, 1.75rem); flex-wrap: wrap; }
.nav-links a { color: var(--ink); text-decoration: none; font-size: var(--step--1); font-weight: 500; }
.nav-links a:hover { color: var(--accent-ink); text-decoration: underline; }

/* ---------- Hero ---------- */
.hero { padding: clamp(3rem, 9vw, 6rem) 0 clamp(2.5rem, 6vw, 4rem); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(1.5rem, 5vw, 3.5rem); align-items: center; }
.hero h1 { font-size: var(--step-3); margin: .2rem 0 1rem; }
.hero .lede { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--ink); max-width: 34ch; }
.hero p.bio { color: var(--muted); max-width: 46ch; margin-top: 1rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--sans); font-size: var(--step--1); font-weight: 600;
  padding: .7rem 1.15rem; border-radius: 999px; text-decoration: none; border: 1px solid transparent;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); }
/* Light-orange accent in dark mode needs dark text for AA contrast */
@media (prefers-color-scheme: dark) {
  .btn-primary { color: #24160f; }
}
.btn-ghost { border-color: var(--hairline); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-2px); }
.portrait {
  aspect-ratio: 3 / 4; border-radius: 1.25rem; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--hairline);
  background: var(--paper-2);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Sections ---------- */
section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section-head { max-width: 52ch; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.section-head h2 { font-size: var(--step-2); margin: 0; }
hr.rule { border: 0; border-top: 1px solid var(--hairline); margin: 0; }

/* ---------- Company block ---------- */
.company { margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.company-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .35rem; }
.logo-chip {
  display: inline-grid; place-items: center; background: #fff;
  border: 1px solid var(--hairline); border-radius: .7rem; padding: .5rem .7rem; height: 2.9rem;
}
.logo-chip img { height: 1.7rem; width: auto; }
.company-head h3 { font-size: var(--step-1); margin: 0; }
.role-line { color: var(--muted); font-size: var(--step--1); margin: 0 0 1.25rem; }
.role-line strong { color: var(--ink); font-weight: 600; }

/* ---------- Project cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.card {
  background: var(--card); border: 1px solid var(--hairline); border-radius: 1rem;
  padding: clamp(1.25rem, 3vw, 1.75rem); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--hairline)); }
.card h4 { font-family: var(--serif); font-size: 1.3rem; margin: .15rem 0 .5rem; line-height: 1.15; }
.card-img {
  border-radius: .6rem; overflow: hidden; border: 1px solid var(--hairline);
  margin: .35rem 0 1rem; box-shadow: var(--shadow); background: var(--paper-2);
}
.card-img img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.card-img--inline { max-width: 26rem; margin-top: 1rem; }
.card .dates { font-size: var(--step--1); color: var(--muted); font-weight: 500; }
.card p { margin: 0 0 .9rem; color: var(--ink); }
.metrics { list-style: none; padding: 0; margin: 0 0 1.1rem; display: grid; gap: .45rem; }
.metrics li { position: relative; padding-left: 1.35rem; color: var(--muted); font-size: .98rem; }
.metrics li::before {
  content: ""; position: absolute; left: 0; top: .55em; width: .5rem; height: .5rem;
  background: var(--accent); border-radius: 2px; transform: rotate(45deg);
}
.metrics b { color: var(--ink); font-weight: 600; }
.card .card-link { margin-top: auto; font-weight: 600; font-size: var(--step--1); text-decoration: none; }
.card .card-link:hover { text-decoration: underline; }
.card-links { margin-top: auto; display: flex; flex-direction: column; gap: .4rem; }
.card-links .card-link { margin-top: 0; }
.tag {
  align-self: flex-start; margin-top: auto; font-size: .8rem; font-weight: 600; color: var(--muted);
  border: 1px solid var(--hairline); border-radius: 999px; padding: .2rem .6rem;
}

/* ---------- Simple list block (Workato/VersaFleet) ---------- */
.plain-bullets { margin: 0; padding-left: 1.1rem; color: var(--ink); }
.plain-bullets li { margin-bottom: .5rem; }
.plain-bullets li::marker { color: var(--accent); }

/* ---------- Feature (Ouchies) ---------- */
.feature { background: var(--paper-2); }
.feature-grid { display: grid; grid-template-columns: .95fr 1.05fr; gap: clamp(1.5rem, 5vw, 3rem); align-items: center; }
.feature-img { border-radius: 1.25rem; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--hairline); }
.feature-img img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; }
.feature h2 { font-size: var(--step-2); margin: .2rem 0 1rem; }
.feature p { color: var(--ink); max-width: 48ch; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--hairline); padding-block: 2.5rem; color: var(--muted); }
.footer-grid { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.footer-grid a { color: var(--ink); }
.site-footer small { font-size: var(--step--1); }

/* ---------- Ouchies page ---------- */
.doc { max-width: 44rem; }
.doc .eyebrow { margin-top: 0; }
.doc h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); margin: .3rem 0 .6rem; }
.doc .subtitle { font-size: clamp(1.1rem, 2.4vw, 1.4rem); color: var(--muted); margin: 0 0 2rem; max-width: 40ch; }
.doc h2 { font-size: var(--step-2); margin: 2.5rem 0 .8rem; }
.doc h3 { font-size: var(--step-1); margin: 1.75rem 0 .5rem; }
.doc p, .doc li { color: var(--ink); }
.doc ul, .doc ol { padding-left: 1.2rem; }
.doc li { margin-bottom: .6rem; }
.doc li::marker { color: var(--accent); }
.callout {
  background: var(--card); border: 1px solid var(--hairline); border-left: 4px solid var(--accent);
  border-radius: .75rem; padding: 1.1rem 1.35rem; margin: 1.75rem 0; box-shadow: var(--shadow);
}
.callout p { margin: 0; font-size: 1.15rem; }
.doc-figure { margin: 2rem 0; }
.doc-figure img { border-radius: 1rem; box-shadow: var(--shadow); border: 1px solid var(--hairline); }
.doc-figure figcaption { font-size: var(--step--1); color: var(--muted); margin-top: .6rem; text-align: center; }
.team-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem; }
.team-list li { background: var(--card); border: 1px solid var(--hairline); border-radius: .7rem; padding: .8rem 1rem; margin: 0; }
.team-list .name { font-weight: 600; display: block; }
.team-list .disc { color: var(--muted); font-size: var(--step--1); }
.back-link { display: inline-block; margin-top: 3rem; font-weight: 600; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* ---------- Media list ---------- */
.media-list { display: flex; flex-direction: column; gap: 1.75rem; }
.media-item {
  display: grid; grid-template-columns: 13rem 1fr; gap: 1.5rem;
  background: var(--card); border: 1px solid var(--hairline); border-radius: 1rem;
  padding: 1.25rem; box-shadow: var(--shadow); align-items: center;
}
.media-item--text-only { grid-template-columns: 1fr; }
.media-thumb {
  display: block; border-radius: .6rem; overflow: hidden; border: 1px solid var(--hairline);
  aspect-ratio: 3 / 2; background: var(--paper-2);
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-body h2 { font-family: var(--serif); font-size: 1.2rem; margin: .2rem 0 .5rem; line-height: 1.25; }
.media-body h2 a { text-decoration: none; color: var(--ink); }
.media-body h2 a:hover { color: var(--accent-ink); text-decoration: underline; }
.media-outlet { margin: 0; font-size: var(--step--1); font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.media-body p:not(.media-outlet) { margin: 0; color: var(--ink); }

@media (max-width: 640px) {
  .media-item { grid-template-columns: 1fr; }
  .media-thumb { max-width: 16rem; }
}

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 22rem; order: -1; margin-inline: auto; width: 100%; }
  .cards { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-img { order: -1; }
}

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