/* Narrow the existing columns on tablets and small desktop windows. */
@media (min-width: 641px) {
  body[data-inner-gutters] > .nav,
  body[data-inner-gutters] > main.wrap {
    width: calc(100% - 48px);
  }
}

/* Keep the same neutral page background as the homepage. */
body::before { display: none; }

:root {
  --detail-top: clamp(48px, 8vw, 96px);
  --detail-mono: var(--mono, ui-monospace, monospace);
  --detail-muted: var(--ink-70, rgba(0, 0, 0, 0.7));
}

/* Echo the homepage strings in the space above the title. */
html::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  height: var(--detail-top);
  background: repeating-linear-gradient(90deg, transparent 0 47px, var(--ink-10) 47px 48px) center;
  -webkit-mask-image: linear-gradient(#000, transparent);
  mask-image: linear-gradient(#000, transparent);
  pointer-events: none;
}
html:has(body > .nav:not([data-dock-home-fallback]))::before,
html:has(body > .nav):not(:has(body > .dock))::before { height: calc(var(--detail-top) + 72px); }

main.wrap { margin-block-start: var(--detail-top); }
main.wrap > h1 {
  max-width: 18ch;
  margin-block-end: 24px;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
main.wrap > .lede {
  max-width: 61ch;
  margin-block-end: clamp(24px, 5vw, 40px);
  color: var(--detail-muted);
  font-size: clamp(16px, 2vw, 18px);
  line-height: 1.65;
}
main.wrap > .meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 4vw, 28px);
  margin-block: 0 clamp(44px, 8vw, 72px);
  padding-block: 20px;
  border-block: 1px solid var(--ink-10);
}
main.wrap > .kicker,
main.wrap > .meta dt,
.cases-title,
.case-card__meta {
  color: var(--detail-muted);
  font: 500 12px/1.5 var(--detail-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
main.wrap > .kicker { margin-block-end: 16px; }
main.wrap > .meta dt { margin-block-end: 6px; }
main.wrap > .meta dd { font-size: 15px; line-height: 1.45; }

/* Match each company to the mark already used on the homepage. */
:root:has(> head > link[rel="canonical"][href$="/company-aampe.html"]) {
  --company-mark: url("../images/sticker-aampe.png");
  --company-tilt: -6deg;
}
:root:has(> head > link[rel="canonical"][href$="/company-capri.html"]) {
  --company-mark: url("../images/sticker-capri.png");
  --company-tilt: 5deg;
}
:root:has(> head > link[rel="canonical"][href$="/company-dover.html"]) {
  --company-mark: url("../images/sticker-dover.png");
  --company-tilt: -4deg;
}
:root:has(> head > link[rel="canonical"][href$="/company-qicaps.html"]) {
  --company-mark: url("../images/logo-qicaps.png");
  --company-tilt: 4deg;
}
main.wrap:has(.cases-head) > h1 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: clamp(14px, 4vw, 32px);
  max-width: none;
  font-size: clamp(42px, 7vw, 72px);
  text-wrap: wrap;
}
main.wrap:has(.cases-head) > h1::after {
  content: "";
  inline-size: clamp(70px, 17vw, 128px);
  aspect-ratio: 1.3;
  background: var(--company-mark) center / 68% auto no-repeat,
    linear-gradient(145deg, #fff, #f0ede9);
  border: 1px solid #e0dbd5;
  border-radius: 12px;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.75), 0 4px 12px rgba(0, 0, 0, 0.12);
  rotate: var(--company-tilt, 0deg);
}

.cases-locked-wrapper { background: #f9f8f6; }
.cases-locked-wrapper,
.password-gate { box-shadow: inset 0 0 0 1px var(--ink-10); }
.case-card__title {
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.case-card__desc { color: var(--detail-muted); font-size: 15px; line-height: 1.65; }
.case-card__image:not([data-compare], [data-carousel]) { border-radius: 12px; }

/* Keep company introductions at the reading width and give the work more room. */
body:has(> main.wrap > .company-cases) > .nav,
main.wrap:has(> .company-cases) > :is(h1, .lede, .meta) {
  max-width: 600px;
  margin-inline: auto;
}
.company-cases {
  padding: clamp(16px, 4.5vw, 40px);
  border-radius: 16px;
  background: #f9f8f6;
  box-shadow: inset 0 0 0 1px var(--ink-10);
}
.company-cases .case-card {
  gap: clamp(20px, 4vw, 32px);
  padding: 0;
}
.company-cases .case-card__image {
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--ink-10);
}
.company-cases .case-card__content {
  width: 100%;
  max-width: 600px;
  align-self: center;
}
.company-cases :is(.case-card__sub, .case-card__walkthrough) {
  color: var(--detail-muted);
  font: 500 12px/1.5 var(--detail-mono);
  letter-spacing: 0.08em;
}

@media (max-width: 640px) {
  .company-cases { margin-inline: -8px; border-radius: 12px; }
}

main.wrap > section:has(> h2):not(.notice, .walkthrough-cta) {
  margin-block-end: clamp(48px, 7vw, 72px);
}
main.wrap > section > h2 {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
main.wrap > section:not(.notice, .walkthrough-cta) > :is(p, ul, ol):not([class]) {
  max-width: 68ch;
  color: var(--detail-muted);
  font-size: 16px;
  line-height: 1.7;
}

@media (max-width: 520px) {
  main.wrap > .meta { grid-template-columns: minmax(0, 1fr); }
  main.wrap > .meta > div {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: baseline;
    gap: 12px;
  }
  main.wrap > .meta dt { margin-block-end: 0; }
  main.wrap:has(.cases-head) > h1 { font-size: clamp(36px, 9.5vw, 48px); }
}

body > .nav .nav__links { gap: 6px; }
body > .nav :is(a.nav__back, .nav__links a)[href] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--ink-20, rgba(0, 0, 0, 0.18));
  border-radius: 100px;
  color: var(--ink-70, rgba(0, 0, 0, 0.7));
  font: 500 12px/1.6 var(--detail-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}
body > .nav :is(a.nav__back, .nav__links a)[href]:is(:hover, :focus-visible) {
  color: var(--ink);
  background-color: var(--ink-10);
}

main :is(p, li) > a[href]:not([class]),
.password-gate__form-links a[href] {
  padding: 0.06em 0.25em;
  border-radius: 0.25em;
  background-color: var(--ink-10);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  color: var(--ink);
  text-decoration: none;
}
main :is(p, li) > a[href]:not([class]):is(:hover, :focus-visible),
.password-gate__form-links a[href]:is(:hover, :focus-visible) {
  background-color: var(--ink-20, rgba(0, 0, 0, 0.16));
  text-decoration: none;
}

a.case-card__link[href]:is(:hover, :focus-visible) { text-decoration: none; }

a.case-card__cta[href]:not(.case-card__cta--primary)::after,
a.case-card__link[href] svg {
  box-sizing: border-box;
  width: 1.8em;
  height: 1.8em;
  margin-inline-start: 0.35em;
  border-radius: 50%;
  background-color: var(--ink-10);
  vertical-align: middle;
}
a.case-card__cta[href]:not(.case-card__cta--primary)::after {
  display: inline-grid;
  place-items: center;
  content: "→" / "";
}
a.case-card__link[href] svg { padding: 0.35em; }

:is(body > .nav, main.wrap) a[href]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  main.wrap > h1 { animation: inner-intro-in 600ms ease-out backwards; }
  main.wrap > :is(.kicker, .lede, .meta) {
    animation: inner-intro-in 520ms ease-out backwards;
  }
  main.wrap > .kicker { animation-delay: 640ms; }
  main.wrap > .lede { animation-delay: 820ms; }
  main.wrap > .meta { animation-delay: 1000ms; }
  main.wrap > :is(.kicker, .lede, .meta):focus-within { animation: none; }

  @keyframes inner-intro-in {
    from { opacity: 0; translate: 0 10px; }
  }
}
