/* The ungated Local Monopoly Playbook. */
.reference-playbook {
  --playbook-warm: #fdf0e6;
  --playbook-cream: #f2e5d6;

  & .service-hero {
    padding-block: clamp(17px, 2.25vw, 34px);
    background: var(--service-dark) url("/work/custom-website/graphite-contours.webp") center / cover no-repeat;
  }

  & .service-hero-layout {
    grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.84fr);
  }

  & .service-hero h1 {
    max-width: 24ch;
    font-size: clamp(29px, 3.75vw, 52px);
  }

  & .service-lede {
    max-width: 59ch;
  }

  & .playbook-index {
    padding: clamp(8px, 1.15vw, 16px);
    border: 2px solid var(--service-orange);
    border-radius: 16px;
    background: rgb(16 20 22 / 82%);
    box-shadow: 0 0 15px rgb(255 88 0 / 29%), inset 0 0 9px rgb(255 88 0 / 17%);
  }

  & .playbook-index-header {
    display: flex;
    align-items: center;
    column-gap: 10px;
    padding: 0 5px 6px;
  }

  & .playbook-index-header h2 {
    font-size: clamp(15px, 1.95vw, 25px);
    font-weight: 850;
    letter-spacing: -0.035em;
    line-height: 1.08;
  }

  & .playbook-index-header p {
    margin-top: 2px;
    font-size: clamp(11px, 1.15vw, 14px);
    line-height: 1.3;
  }

  & .playbook-index-header .reference-icon {
    font-size: clamp(25px, 3.8vw, 46px);
  }

  & :is(.playbook-index-header, .playbook-index ol) .reference-icon {
    color: var(--service-orange);
  }

  & .playbook-index ol {
    display: grid;
    gap: 4px;
    padding: 0;
    margin: 0;
    list-style: none;
  }

  & .playbook-index a {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: clamp(6px, 1.1vw, 13px);
    min-height: 44px;
    padding: 5px 8px;
    border: 1px solid #85888a;
    border-radius: 9px;
    color: inherit;
    text-decoration: none;
  }

  & .playbook-index a:hover {
    border-color: var(--service-orange);
  }

  & .playbook-index a:hover strong {
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  & .playbook-index-number {
    display: grid;
    place-items: center;
    width: clamp(27px, 3.5vw, 43px);
    height: clamp(24px, 3vw, 34px);
    border: 1px solid #85888a;
    border-radius: 6px;
    background: rgb(255 255 255 / 13%);
    font-size: clamp(14px, 1.75vw, 21px);
    font-weight: 850;
    line-height: 1;
  }

  & .playbook-index ol .reference-icon {
    font-size: clamp(21px, 2.85vw, 35px);
  }

  & .playbook-index a strong,
  & .playbook-index a small {
    display: block;
  }

  & .playbook-index a strong {
    font-size: clamp(12px, 1.42vw, 17px);
    font-weight: 800;
    line-height: 1.15;
  }

  & .playbook-index a small {
    margin-top: 3px;
    font-size: clamp(10px, 1.05vw, 13px);
    line-height: 1.18;
  }

  & .playbook-module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(9px, 1.2vw, 15px);
    margin-top: 9px;
  }

  & .playbook-module,
  & .playbook-guidance[id],
  & .playbook-guidance details[id] {
    scroll-margin-top: 15px;
  }

  & .playbook-module {
    padding: clamp(11px, 1.35vw, 17px);
    border: 1px solid var(--service-rule);
    border-radius: 14px;
    background: color-mix(in srgb, var(--service-tile) 67%, var(--service-paper));
  }

  & .playbook-module-heading {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: clamp(6px, 1.3vw, 15px);
    min-height: 34px;
    margin-bottom: 8px;
  }

  & .playbook-module-heading > span:first-child {
    display: grid;
    place-items: center;
    min-width: 31px;
    min-height: 25px;
    padding-inline: 4px;
    border-radius: 5px;
    background: var(--service-accent);
    color: var(--service-white);
    font-size: 15px;
    font-weight: 850;
    line-height: 1;
  }

  & :is(.playbook-module-heading, .playbook-guidance) .reference-icon {
    color: var(--service-accent);
    font-size: clamp(21px, 3.5vw, 38px);
  }

  & .playbook-module h3 {
    font-size: clamp(16px, 2vw, 23px);
    font-weight: 860;
    letter-spacing: -0.038em;
    line-height: 1.07;
  }

  & .playbook-module h4 {
    font-size: clamp(13px, 1.35vw, 17px);
    font-weight: 800;
    letter-spacing: -0.016em;
    line-height: 1.13;
  }

  & :is(.playbook-rule, .playbook-checklist, .playbook-guidance, .playbook-script-message) {
    font-size: clamp(13px, 1.23vw, 15px);
    line-height: 1.3;
  }

  & .playbook-rule {
    padding: 8px 10px;
    margin-bottom: 7px;
    border-radius: 7px;
    background: var(--playbook-warm);
  }

  & :is(.playbook-checklist, .playbook-scripts) {
    display: grid;
    gap: 5px;
    padding: 0;
    margin: 0;
    list-style: none;
  }

  & .playbook-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 7px;
  }

  & .playbook-checklist .reference-icon {
    margin-top: 2px;
    color: var(--service-accent);
    font-size: 17px;
  }

  & .playbook-scripts li {
    display: grid;
    grid-template-columns: minmax(82px, 0.55fr) minmax(0, 1.45fr);
    align-items: stretch;
    border: 1px solid var(--service-rule);
    border-radius: 7px;
    background: var(--service-paper);
  }

  & .playbook-script-label,
  & .playbook-script-content {
    padding: 6px 8px;
  }

  & .playbook-script-label {
    border-inline-end: 1px solid var(--service-rule);
    border-radius: 7px 0 0 7px;
    background: var(--playbook-cream);
  }

  & .playbook-script-label p {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.22;
  }

  & .playbook-copy {
    float: inline-end;
    min-height: 24px;
    padding: 1px 4px 1px 0;
    margin-inline-start: 8px;
    border: 0;
    background: transparent;
    color: var(--service-accent);
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
  }

  & .playbook-copy-status {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  & .playbook-guidance {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: clamp(6px, 1.12vw, 14px);
    padding: 8px 10px;
    border: 1px solid var(--service-rule);
    border-radius: 8px;
    background: color-mix(in srgb, var(--playbook-cream) 36%, var(--service-paper));
  }

  & .playbook-guidance + .playbook-guidance {
    margin-top: 5px;
  }

  & .playbook-guidance p {
    margin-top: 2px;
  }

  & .playbook-guidance summary {
    display: flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    min-height: 26px;
    padding-block: 5px 2px;
    color: var(--service-accent);
    font-weight: 750;
    cursor: pointer;
  }

  & .playbook-guidance details ol {
    padding-inline-start: 19px;
    margin: 5px 0;
  }

  & .playbook-guidance details li + li {
    margin-top: 5px;
  }

  & .service-closing h2 strong {
    color: var(--service-orange);
    font-weight: inherit;
  }

  & .service-closing p {
    max-width: min(80ch, 740px);
  }
}

@media (width >= 761px) {
  .reference-playbook {
    & .service-band {
      padding-top: clamp(10px, 1.4vw, 21px);
    }

    & .service-faq :is(dt, dd) {
      padding-block: 6px;
    }

    & .service-faq {
      padding-bottom: clamp(16px, 1.8vw, 25px);
    }

    & .service-closing {
      padding-block: clamp(14px, 1.6vw, 23px);
    }
  }
}

@media (width >= 1024px) {
  .reference-playbook {
    & .service-audit {
      background: var(--service-orange);
      font-size: 19px;
    }

    & .service-closing .service-audit {
      width: min(100%, 430px);
    }
  }
}

@media (max-width: 760px) {
  .reference-playbook {
    & .playbook-module-grid {
      grid-template-columns: minmax(0, 1fr);
    }
  }
}

@media (max-width: 640px) {
  .reference-playbook {
    & .service-hero-layout {
      grid-template-columns: minmax(0, 1fr);
    }

    & .service-hero h1 {
      max-width: 20ch;
      font-size: clamp(32px, 8.4vw, 46px);
    }

    & .playbook-index {
      width: min(100%, 460px);
      margin-inline: auto;
    }

    & .playbook-index a strong {
      font-size: 14px;
    }

    & .playbook-index a small {
      font-size: 12px;
    }

    & :is(.playbook-copy, .playbook-guidance summary) {
      min-height: 44px;
    }

    & .playbook-script-content {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
    }

    & .playbook-copy {
      order: 1;
      margin-inline-start: 0;
    }
  }
}
