:root {
    --bg: #f6f2ea;
    --ink: #1c1f26;
    --muted: #565a64;
    --rule: #d9d3c7;
    --action: #b4432e;
    --action-hover: #983624;
    --loam: #2e3e45;
    --meal: #94453a;
    --evening: #2b3a5c;
    --lading: #1f3e3a;
    --radius: 6px;
    --display: "Fraunces", Georgia, "Times New Roman", serif;
    --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  }
  * { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--body);
    font-size: 1.0625rem;
    line-height: 1.6;
  }
  img { max-width: 100%; display: block; }
  a { color: inherit; }
  a:focus-visible, button:focus-visible {
    outline: 3px solid var(--action);
    outline-offset: 3px;
  }
  .wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
  .skip {
    position: absolute; left: -999px; top: 8px;
    background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--radius);
  }
  .skip:focus { left: 8px; z-index: 10; }

  h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
  h2 { font-size: clamp(1.75rem, 3.4vw, 2.5rem); }

  .btn {
    display: inline-block;
    padding: 12px 22px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    border: 2px solid transparent;
    line-height: 1.2;
  }
  .btn-primary { background: var(--action); color: #fff; }
  .btn-primary:hover { background: var(--action-hover); }
  .btn-secondary { border-color: var(--ink); color: var(--ink); }
  .btn-secondary:hover { background: var(--ink); color: var(--bg); }

  /* Header */
  header.site { border-bottom: 1px solid var(--rule); }
  header.site .wrap {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap;
  }
  .brand { font-family: var(--display); font-size: 1.25rem; font-weight: 600; text-decoration: none; }
  nav.primary { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
  nav.primary a:not(.btn) { text-decoration: none; font-size: 0.97rem; color: var(--muted); }
  nav.primary a:not(.btn):hover { color: var(--ink); text-decoration: underline; }
  nav.primary .btn { padding: 9px 18px; font-size: 0.95rem; }

  /* Hero */
  .hero { padding: 72px 0 80px; }
  .hero .wrap {
    display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 56px; align-items: center;
  }
  .hero h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); }
  .hero p.lede { font-size: 1.2rem; color: var(--muted); margin: 24px 0 32px; max-width: 34em; }
  .hero .actions { display: flex; gap: 14px; flex-wrap: wrap; }
  .photo {
    position: relative; margin: 0; aspect-ratio: 4 / 5;
    background: #e6dfd0; border-radius: var(--radius); overflow: hidden;
    display: grid; place-items: center;
    font-family: var(--display); font-size: 3rem; color: #a79f8c;
  }
  .photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }

  /* Apps */
  .apps-head { padding-bottom: 32px; }
  .apps-head h2 { max-width: 20em; }
  .band { background: var(--c); color: #fff; }
  .band .wrap {
    display: grid; grid-template-columns: 88px 1fr auto; gap: 28px;
    align-items: center; padding-top: 44px; padding-bottom: 44px;
  }
  .band .icon { width: 88px; height: 88px; border-radius: 20px; background: rgba(255,255,255,0.12); object-fit: cover; }
  .band h3 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
  .band .tagline { margin: 4px 0 0; opacity: 0.88; }
  .band .tag {
    display: inline-block; margin-left: 12px; padding: 2px 10px; vertical-align: middle;
    font-family: var(--body); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em;
    border: 1px solid rgba(255,255,255,0.7); border-radius: var(--radius);
  }
  .band .actions { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: flex-end; }
  .band .btn-light { background: #fff; color: var(--c); }
  .band .btn-light:hover { background: #f1ece2; }
  .band .more { color: #fff; font-size: 0.97rem; }
  .band a:focus-visible { outline-color: #fff; }

  /* Process */
  .process { padding: 96px 0 40px; }
  .process h2 { max-width: 16em; }
  .process .intro { color: var(--muted); max-width: 38em; margin: 16px 0 48px; }
  ol.gates {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(9, 1fr); gap: 0 12px;
    counter-reset: gate;
  }
  ol.gates li { position: relative; padding-top: 22px; border-top: 2px solid var(--ink); counter-increment: gate; }
  ol.gates li::before {
    content: ""; position: absolute; top: -7px; left: 0;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--bg); border: 2px solid var(--ink);
  }
  ol.gates .n { display: block; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
  ol.gates .name { display: block; font-family: var(--display); font-weight: 600; font-size: 1.05rem; line-height: 1.2; margin-top: 2px; }
  ol.gates .doc { display: block; font-size: 0.85rem; color: var(--muted); line-height: 1.35; margin-top: 6px; }
  .skipnote { margin: 40px 0 0; max-width: 40em; padding-left: 18px; border-left: 3px solid var(--action); }
  .skipnote strong { font-weight: 600; }
  .process .more { display: inline-block; margin-top: 20px; font-weight: 600; }
  /* When the portal screenshot is ready, add it here:
     <figure class="proof"><img src="images/portfolio-dashboard.jpg" alt="..."></figure> */

  /* Services */
  .services { padding: 80px 0; }
  .services h2 { max-width: 16em; margin-bottom: 40px; }
  .two { display: grid; grid-template-columns: 1fr 1fr; }
  .two > div { padding: 0 40px 0 0; }
  .two > div + div { padding: 0 0 0 40px; border-left: 1px solid var(--rule); }
  .two h3 { font-size: 1.5rem; margin-bottom: 12px; }
  .two p { margin: 0 0 16px; }
  .two dl { margin: 0 0 20px; }
  .two dt { font-size: 0.85rem; color: var(--muted); text-transform: none; margin-top: 12px; }
  .two dd { margin: 2px 0 0; }
  .two a.more { font-weight: 600; }
  /* Add a "Typical timing and price" row to each dl once ranges are decided. */

  /* Book */
  .book { padding: 24px 0 96px; }
  .book .wrap { border-top: 1px solid var(--rule); padding-top: 64px; }
  .book h2 { margin-bottom: 14px; }
  .book p { margin: 0 0 24px; max-width: 34em; color: var(--muted); }
  .book .fine { font-size: 0.9rem; margin: 14px 0 0; }

  footer.site { border-top: 1px solid var(--rule); padding: 28px 0 40px; font-size: 0.95rem; color: var(--muted); }
  footer.site .wrap { display: flex; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; }
  footer.site nav { display: flex; gap: 20px; flex-wrap: wrap; }
  footer.site a { text-decoration: none; }
  footer.site a:hover { text-decoration: underline; }

  /* Tablet: gates wrap to two rows */
  @media (max-width: 1000px) {
    ol.gates { grid-template-columns: repeat(5, 1fr); gap: 40px 12px; }
  }
  @media (max-width: 860px) {
    .hero .wrap { grid-template-columns: 1fr; gap: 40px; }
    .hero { padding: 48px 0 56px; }
    .photo { order: -1; max-width: 340px; aspect-ratio: 1 / 1; }
    .band .wrap { grid-template-columns: 72px 1fr; }
    .band .icon { width: 72px; height: 72px; border-radius: 16px; }
    .band .actions { grid-column: 1 / -1; justify-content: flex-start; }
    .two { grid-template-columns: 1fr; }
    .two > div, .two > div + div { padding: 0; border-left: 0; }
    .two > div + div { border-top: 1px solid var(--rule); padding-top: 32px; margin-top: 32px; }
  }
  /* Phone: gates become a vertical list */
  @media (max-width: 640px) {
    ol.gates { grid-template-columns: 1fr; gap: 0; border-left: 2px solid var(--ink); margin-left: 6px; }
    ol.gates li { border-top: 0; padding: 0 0 26px 24px; }
    ol.gates li::before { top: 4px; left: -8px; }
    ol.gates li:last-child { padding-bottom: 0; }
    nav.primary { gap: 14px; }
  }

  /* Inner pages */
  nav.primary a[aria-current="page"]:not(.btn) { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
  .pagehead { padding: 64px 0 40px; }
  .pagehead h1 { font-size: clamp(2.1rem, 4.6vw, 3.25rem); max-width: 18em; }
  .pagehead .lede { font-size: 1.15rem; color: var(--muted); max-width: 38em; margin: 20px 0 0; }
  .services.tight { padding-top: 24px; }
  .best { color: var(--muted); }
  .two .more, .appbody .more, .case .more { font-weight: 600; }
  .offers { padding: 24px 0 72px; }
  .offers .intro, .dash .intro { color: var(--muted); max-width: 38em; margin: 14px 0 28px; }
  .tablewrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; min-width: 640px; }
  th, td { text-align: left; vertical-align: top; padding: 16px 20px 16px 0; border-top: 1px solid var(--rule); }
  thead th { font-size: 0.85rem; font-weight: 600; color: var(--muted); border-top: 0; border-bottom: 2px solid var(--ink); }
  tbody th { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
  td:nth-child(2), td:nth-child(3) { white-space: nowrap; }
  .start { padding: 24px 0 72px; }
  ol.steps { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; counter-reset: s; }
  ol.steps li { border-top: 2px solid var(--ink); padding-top: 16px; counter-increment: s; }
  ol.steps li::before { content: counter(s); font-size: 0.85rem; color: var(--muted); display: block; }
  ol.steps h3, .feat dt { font-family: var(--display); font-size: 1.2rem; font-weight: 600; }
  ol.steps p { margin: 6px 0 0; color: var(--muted); }
  ol.phaselist { list-style: none; margin: 0; padding: 0; max-width: 46em; }
  ol.phaselist li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 18px 0; border-top: 1px solid var(--rule); }
  ol.phaselist .n { font-variant-numeric: tabular-nums; color: var(--muted); padding-top: 4px; }
  ol.phaselist h3 { font-size: 1.3rem; }
  ol.phaselist p { margin: 4px 0 0; color: var(--muted); }
  .phases { padding-bottom: 32px; }
  .dash { padding: 56px 0 72px; }
  .dash figure { margin: 0 0 40px; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: #fff; }
  .dash figure img { width: 100%; height: auto; }
  dl.feat { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; margin: 0; }
  dl.feat.three { grid-template-columns: repeat(3, 1fr); margin-top: 64px; }
  dl.feat dd { margin: 6px 0 0; color: var(--muted); }
  dl.feat.stack { grid-template-columns: 1fr; gap: 22px; margin-bottom: 40px; }
  .prose2 { padding: 8px 0 72px; }
  .prose2 h2 { margin-bottom: 12px; font-size: 1.7rem; }
  .prose2 p { color: var(--muted); }
  .aboutgrid { display: grid; grid-template-columns: 200px 1fr; gap: 48px; align-items: start; }
  .pagehead.dark + section { padding-top: 72px; }
  .aboutgrid h2 { margin-bottom: 20px; font-size: clamp(1.6rem, 3vw, 2.2rem); }
  .photo.sm { max-width: 200px; aspect-ratio: 4 / 5; }
  .about { padding: 24px 0 72px; }
  .band .icon.letter, .apphero .icon.letter { display: grid; place-items: center; font-family: var(--display); font-size: 2.4rem; }
  .band .actions .more { text-underline-offset: 4px; }
  .apphero { background: var(--c); color: #fff; padding: 40px 0 56px; }
  .apphero a { color: #fff; }
  .apphero .back { font-size: 0.95rem; text-decoration: none; opacity: 0.9; }
  .apphero .back:hover { text-decoration: underline; }
  .apphero .ah { display: flex; align-items: center; gap: 22px; margin: 28px 0 24px; }
  .apphero .icon { width: 88px; height: 88px; border-radius: 20px; background: rgba(255,255,255,0.12); object-fit: cover; flex: none; }
  .apphero h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); }
  .apphero .tag { display: inline-block; margin-left: 14px; padding: 2px 10px; vertical-align: middle; font-family: var(--body); font-size: 0.8rem; font-weight: 600; border: 1px solid rgba(255,255,255,0.7); border-radius: var(--radius); }
  .apphero .tagline { margin: 4px 0 0; opacity: 0.88; }
  .apphero .lede { font-size: 1.2rem; max-width: 34em; margin: 0 0 28px; }
  .apphero .btn-light { background: #fff; color: var(--c); }
  .apphero a:focus-visible { outline-color: #fff; }
  .apphero .btn-light:hover { background: #f1ece2; }
  .appbody { padding: 64px 0 40px; }
  .appbody .wrap.has-shot { display: grid; grid-template-columns: 1fr 340px; gap: 64px; align-items: start; }
  .appbody h2 { font-size: 1.8rem; margin-bottom: 20px; }
  .appbody h2.h2b { margin-top: 8px; font-size: 1.5rem; margin-bottom: 10px; }
  .appbody .shot { margin: 0; }
  .appbody .shot img { border-radius: 28px; border: 1px solid var(--rule); width: 100%; height: auto; }
  .cases { padding: 8px 0 24px; }
  .case { padding: 40px 0; border-top: 1px solid var(--rule); max-width: 44em; scroll-margin-top: 16px; }
  .case h2 { font-size: 2rem; }
  .case .status { margin: 6px 0 14px; color: var(--action); font-weight: 600; font-size: 0.95rem; }
  .case .what { font-size: 1.15rem; margin: 0 0 12px; }
  .case p { margin: 0 0 12px; }
  ul.plain { margin: 16px 0 0; padding-left: 1.1em; }
  @media (max-width: 860px) {
    dl.feat, dl.feat.three { grid-template-columns: 1fr 1fr; }
    ol.steps { grid-template-columns: 1fr; gap: 24px; }
    .aboutgrid { grid-template-columns: 1fr; gap: 32px; }
    .appbody .wrap.has-shot { grid-template-columns: 1fr; gap: 40px; }
    .appbody .shot { max-width: 300px; }
    .pagehead { padding: 40px 0 28px; }
  }
  @media (max-width: 560px) { dl.feat, dl.feat.three { grid-template-columns: 1fr; } }

  /* About, extended */
  .career { padding: 24px 0 56px; }
  .career h2, .beliefs h2, .more-about h2 { margin-bottom: 14px; }
  .career .intro { color: var(--muted); max-width: 38em; margin: 0 0 28px; }
  dl.timeline { margin: 0; max-width: 52em; }
  dl.timeline > div { display: grid; grid-template-columns: 150px 1fr; gap: 20px; padding: 20px 0; border-top: 1px solid var(--rule); }
  dl.timeline dt { font-family: var(--display); font-weight: 600; color: var(--muted); }
  dl.timeline dd { margin: 0; }
  .career .note { margin: 24px 0 0; padding-left: 18px; border-left: 3px solid var(--action); max-width: 40em; }
  .beliefs { padding: 24px 0 24px; }
  .beliefs dl.feat.three { margin-top: 24px; }
  .more-about { padding: 40px 0 56px; }
  .more-about p { max-width: 40em; margin: 0; color: var(--muted); }
  @media (max-width: 640px) { dl.timeline > div { grid-template-columns: 1fr; gap: 4px; } }

  .shipped { padding: 24px 0 56px; }
  .shipped h2 { margin-bottom: 28px; }
  ul.shots4 { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; }
  ul.shots4 li { display: flex; flex-direction: column; }
  ul.shots4 a { display: block; background: #e6dfd0; border-radius: var(--radius); padding: 18px 18px 0; overflow: hidden; }
  ul.shots4 img { width: 100%; height: auto; border-radius: 22px 22px 0 0; border: 1px solid var(--rule); border-bottom: 0; aspect-ratio: 9 / 14; object-fit: cover; object-position: top; }
  ul.shots4 span { font-family: var(--display); font-weight: 600; font-size: 1.15rem; margin-top: 12px; }
  ul.shots4 em { font-family: var(--body); font-style: normal; font-size: 0.75rem; font-weight: 600; border: 1px solid var(--muted); border-radius: var(--radius); padding: 1px 7px; margin-left: 6px; vertical-align: middle; color: var(--muted); }
  ul.shots4 small { color: var(--muted); font-size: 0.92rem; }
  .era { display: flex; gap: 3px; margin: 0 0 8px; max-width: 52em; }
  .era span { background: var(--ink); color: #fff; padding: 10px 12px; font-size: 0.8rem; line-height: 1.25; border-radius: 3px; min-width: 0; }
  .era span:nth-child(2) { background: #3b4150; }
  .era span:nth-child(3) { background: #565a64; }
  .era span:nth-child(4) { background: var(--action); }
  .era b { display: block; font-size: 0.9rem; margin-bottom: 2px; }
  @media (max-width: 860px) {
    ul.shots4 { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .aboutgrid { grid-template-columns: 1fr; gap: 24px; }
    .photo.sm { max-width: 160px; }
  }
  @media (max-width: 560px) { .era span { padding: 8px 6px; font-size: 0.7rem; overflow: hidden; white-space: nowrap; } .era b { display: none; } }

  .btn-li { display: inline-flex; align-items: center; gap: 10px; border-color: #0a66c2; color: #0a66c2; margin-top: 4px; }
  .btn-li:hover { background: #0a66c2; color: #fff; }
  .btn-li svg { flex: none; }

  .pagehead.dark { position: relative; color: #fff; padding: 72px 0 64px; background: #14171d url("images/xcode-bg.jpg") right center / cover no-repeat; }
  .pagehead.dark::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(20,23,29,0.97) 0%, rgba(20,23,29,0.9) 38%, rgba(20,23,29,0.25) 75%, rgba(20,23,29,0.1) 100%); }
  .pagehead.dark .wrap { position: relative; }
  .pagehead.dark .lede { color: rgba(255,255,255,0.86); }
  @media (max-width: 860px) { .pagehead.dark { padding: 48px 0 40px; } .pagehead.dark + section { padding-top: 48px; } }
