@layer base, layout, components, utilities;

@layer base {
  :root {
    --paper: #f2f4f0;
    --paper-lift: #fbfcfa;
    --ink: #16201c;
    --ink-soft: #55615b;
    --rule: #d8ddd4;
    --rule-strong: #c2c9bd;
    --brand: #d9582e;
    --brand-ink: #a53f1b;
    --brand-press: #b8441f;
    --slate: #201f1d;
    --slate-soft: #bcbab6;
    --good: #1f7a62;
    --bad: #a8321a;

    --r-button: 3px;
    --r-input: 2px;
    --r-frame: 5px;

    --stroke: 1px;
    --stroke-strong: 2px;

    --gutter: clamp(20px, 5vw, 40px);
    --band: clamp(56px, 8vw, 104px);
    --measure: 62ch;
    --shot-ratio: 1424 / 884;
  }

  * {
    box-sizing: border-box;
  }

  html {
    scroll-behavior: smooth;
    scroll-padding-top: clamp(70px, 12vh, 96px);
  }

  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "Work Sans", system-ui, sans-serif;
    font-size: clamp(16px, 1.05vw, 17.5px);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }

  img {
    max-width: 100%;
    height: auto;
  }

  a {
    color: var(--brand-ink);
    text-underline-offset: 0.18em;
  }

  a:hover {
    color: var(--brand-press);
  }

  :focus-visible {
    outline: var(--stroke-strong) solid var(--ink);
    outline-offset: 3px;
  }

  h1,
  h2,
  h3 {
    font-family: "Archivo", system-ui, sans-serif;
    letter-spacing: -0.025em;
    line-height: 1.08;
    text-wrap: balance;
    margin: 0;
  }

  h1 {
    font-size: clamp(33px, 5vw, 54px);
    font-weight: 800;
  }

  h2 {
    font-size: clamp(26px, 3.4vw, 38px);
    font-weight: 700;
    max-width: 24ch;
  }

  h3 {
    font-size: clamp(18px, 1.6vw, 21px);
    font-weight: 700;
    letter-spacing: -0.015em;
  }

  p {
    text-wrap: pretty;
  }
}

@layer layout {
  .wrap {
    max-width: 1140px;
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .band {
    padding-block: var(--band);
  }

  .band-lift {
    background: var(--paper-lift);
    border-block: var(--stroke) solid var(--rule);
  }

  .band-dark {
    background: var(--slate);
    color: var(--paper-lift);
  }

  /* uneven two-part rows that reflow with no breakpoint to maintain */
  .split {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(28px, 5vw, 64px);
    align-items: start;
  }

  .split > .lead {
    flex: 3 1 26rem;
    min-width: 0;
  }

  .split > .aside {
    flex: 2 1 19rem;
    min-width: 0;
  }

  .rail {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(20px, 4vw, 56px);
  }

  .rail > .label {
    flex: 0 1 11rem;
    min-width: 0;
  }

  .rail > .body {
    flex: 4 1 30rem;
    min-width: 0;
  }
}

@layer components {
  .site-head {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--paper);
    border-bottom: var(--stroke) solid transparent;
    transition: border-color 200ms ease, box-shadow 200ms ease;
  }

  .site-head.scrolled {
    border-bottom-color: var(--rule);
    box-shadow: 0 10px 24px -22px rgba(22, 32, 28, 0.85);
  }

  .bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: clamp(12px, 2vw, 26px);
    padding-block: 14px;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    text-decoration: none;
    margin-right: auto;
  }

  .brand svg {
    display: block;
    flex: none;
  }

  .brand-name {
    display: block;
    font-family: "Archivo", system-ui, sans-serif;
    font-weight: 800;
    font-size: clamp(16px, 2.6vw, 18px);
    letter-spacing: -0.03em;
    line-height: 1.1;
  }

  .brand-sub {
    display: block;
    font-size: clamp(9.5px, 1.7vw, 10.5px);
    font-weight: 700;
    letter-spacing: 0.17em;
    text-transform: uppercase;
    color: var(--ink-soft);
    line-height: 1.4;
  }

  .site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px clamp(12px, 2.4vw, 28px);
    order: 3;
    width: 100%;
    padding-block: 8px 2px;
    border-top: var(--stroke) solid var(--rule);
  }

  .site-nav a {
    color: var(--ink-soft);
    font-size: clamp(14.5px, 1.2vw, 15.5px);
    font-weight: 500;
    text-decoration: none;
    padding-block: 8px;
  }

  .site-nav a:hover {
    color: var(--ink);
    text-decoration: underline;
  }

  .site-nav a.nav-product {
    padding: 7px 12px;
    border: var(--stroke) solid var(--rule-strong);
    color: var(--ink);
    font-weight: 600;
  }

  .site-nav a.nav-product:hover {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
    text-decoration: none;
  }

  /* inline nav only once the bar has room for brand, links and CTA on one line */
  @media (min-width: 62rem) {
    .site-nav {
      order: 0;
      width: auto;
      padding-block: 0;
      border-top: 0;
    }
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    border: var(--stroke) solid transparent;
    border-radius: var(--r-button);
    cursor: pointer;
    background: var(--brand-press);
    color: #fff;
    padding: 14px 24px;
    min-height: 46px;
    text-decoration: none;
    text-align: center;
  }

  .btn:hover {
    background: #93330f;
    color: #fff;
  }

  .btn.quiet {
    background: transparent;
    color: var(--ink);
    border-color: var(--rule-strong);
  }

  .btn.quiet:hover {
    background: var(--paper-lift);
    color: var(--ink);
    border-color: var(--ink-soft);
  }

  .btn.sm {
    padding: 9px 16px;
    min-height: 40px;
    font-size: 15px;
  }

  .band-dark .btn.quiet {
    color: var(--paper-lift);
    border-color: rgba(255, 255, 255, 0.42);
  }

  .band-dark .btn.quiet:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.78);
  }

  .band-dark :focus-visible {
    outline-color: var(--paper-lift);
  }

  .eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brand-ink);
    margin: 0 0 14px;
  }

  .band-dark .eyebrow {
    color: #f0a383;
  }

  .lede {
    color: var(--ink-soft);
    font-size: clamp(17px, 1.4vw, 19px);
    max-width: var(--measure);
    margin: 18px 0 0;
  }

  .band-dark .lede {
    color: var(--slate-soft);
  }

  .note {
    margin: 14px 0 0;
    font-size: 15px;
    color: var(--ink-soft);
  }

  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: clamp(26px, 3.5vw, 36px);
  }

  .home-hero {
    padding-block: clamp(44px, 6vw, 80px) clamp(52px, 7vw, 88px);
  }

  .home-hero h1 {
    max-width: 22ch;
  }

  .home-hero .lede {
    max-width: 60ch;
  }

  .hero-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
    gap: clamp(14px, 2.2vw, 30px);
    margin: clamp(40px, 5vw, 64px) 0 0;
    padding: 0;
    list-style: none;
  }

  .hero-strip li {
    padding-top: 11px;
    border-top: var(--stroke) solid var(--rule-strong);
    color: var(--ink-soft);
    font-size: 15.5px;
    font-weight: 500;
  }

  .hero-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: clamp(28px, 4vw, 56px);
  }

  .hero-copy {
    flex: 3 1 28rem;
    min-width: 0;
  }

  .hero-art {
    flex: 1 1 17rem;
    max-width: 25rem;
    height: auto;
  }

  /* the hero art only earns its space beside the text; stacked on a phone it just costs scroll */
  @media (max-width: 52rem) {
    .hero-art {
      display: none;
    }
  }

  .shot {
    margin: 0;
  }

  .lede + .shot {
    margin-top: clamp(28px, 3.5vw, 44px);
  }

  .shot img {
    display: block;
    width: 100%;
    aspect-ratio: var(--shot-ratio);
    object-fit: cover;
    object-position: top center;
    border: var(--stroke) solid var(--rule-strong);
    border-radius: var(--r-frame);
    background: #fff;
  }

  .shot figcaption {
    margin-top: 10px;
    font-size: 14.5px;
    color: var(--ink-soft);
  }

  .points {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
    gap: clamp(26px, 3.5vw, 46px);
    margin: clamp(32px, 4vw, 48px) 0 0;
    padding: 0;
    list-style: none;
  }

  .points li {
    display: grid;
    grid-row: span 2;
    grid-template-rows: subgrid;
    row-gap: 8px;
  }

  .points h3 {
    margin: 0;
    padding-top: 14px;
    border-top: var(--stroke-strong) solid var(--ink);
  }

  .points p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 16px;
    max-width: 36ch;
  }

  .band-dark .points h3 {
    border-top-color: var(--brand);
  }

  .band-dark .points p {
    color: var(--slate-soft);
  }

  .audience {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
    gap: 0 clamp(24px, 4vw, 48px);
    margin: clamp(26px, 3.5vw, 36px) 0 0;
    padding: 0;
    list-style: none;
    max-width: 52rem;
  }

  .audience li {
    padding-block: 11px;
    border-bottom: var(--stroke) solid var(--rule);
    font-size: 16.5px;
  }

  .band-dark .audience li {
    border-bottom-color: rgba(255, 255, 255, 0.22);
  }

  .quote-draft {
    margin: clamp(32px, 4vw, 44px) 0 0;
    padding-left: clamp(18px, 2vw, 26px);
    border-left: var(--stroke-strong) solid var(--rule-strong);
    max-width: 46ch;
  }

  .quote-draft p {
    font-family: "Archivo", system-ui, sans-serif;
    font-size: clamp(20px, 2.2vw, 25px);
    line-height: 1.3;
    margin: 0;
  }

  .quote-draft figcaption {
    margin-top: 12px;
    font-size: 15px;
    color: var(--ink-soft);
  }

  .contact-head h2 {
    max-width: 18ch;
  }

  .contact-form {
    display: grid;
    gap: 16px;
    max-width: 34rem;
  }

  .field {
    display: grid;
    gap: 6px;
  }

  .field > span {
    font-size: 14.5px;
    font-weight: 600;
  }

  .field .optional {
    font-weight: 400;
    color: var(--ink-soft);
  }

  input,
  textarea {
    font: inherit;
    width: 100%;
    padding: 12px 14px;
    min-height: 46px;
    border: var(--stroke) solid var(--rule-strong);
    border-radius: var(--r-input);
    background: #fff;
    color: var(--ink);
  }

  textarea {
    min-height: 118px;
    resize: vertical;
  }

  input:focus-visible,
  textarea:focus-visible {
    border-color: var(--ink);
    outline-offset: 1px;
  }

  .form-status {
    margin: 0;
    font-size: 15.5px;
    font-weight: 600;
  }

  .form-status.ok {
    color: var(--good);
  }

  .form-status.error {
    color: var(--bad);
  }

  .contact-form .send {
    justify-self: start;
  }

  .site-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px 24px;
    padding-block: 28px;
    border-top: var(--stroke) solid var(--rule);
    font-size: 14.5px;
    color: var(--ink-soft);
  }
}

@layer utilities {
  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}

@layer components {
  .shot.zoomable img {
    cursor: zoom-in;
  }

  .lightbox {
    position: fixed;
    inset: 0;
    margin: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
    padding: var(--gutter);
    background: color-mix(in srgb, var(--slate) 88%, transparent);
  }

  .lightbox[hidden] {
    display: none;
  }

  .lightbox img {
    display: block;
    max-width: 100%;
    max-height: 86vh;
    width: auto;
  }

  .lightbox figcaption {
    max-width: var(--measure);
    color: var(--slate-soft);
    font-size: 14.5px;
    text-align: center;
  }

  .lightbox-close {
    position: absolute;
    top: var(--gutter);
    right: var(--gutter);
    padding: 7px 13px;
    border: var(--stroke) solid var(--slate-soft);
    border-radius: var(--r-button);
    background: none;
    color: #fff;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
  }

  .lightbox-close:hover {
    background: color-mix(in srgb, #fff 14%, transparent);
  }
}
