/* Usage Policy (/usage).

   Uses the shared language in css/base.css (tokens, .btn). The page is type on
   one colour. Two ideas hold it together:

     Weight   Montserrat Black says the firm part, Regular says the rest. The
              headline sets it up and the list of uses repeats it.
     One line The answers, every section and every question start on the same
              vertical line, a third of the way across (--usage-rail). The
              contents sit to its left and stay put while you read.

   The credit line is the only boxed element, because it is the only thing on
   the page to pick up and take away. */

.usage-page {
  overflow-x: clip;
  --usage-soft: rgba(244, 246, 248, 0.84);
  --usage-rail: 33.333%;
  --usage-rule: rgba(244, 246, 248, 0.24);
}

.usage-skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 1200;
  padding: 0.7rem 1rem;
  border-radius: var(--r-sm);
  background: var(--orange);
  color: #140800;
  font-weight: 700;
}
.usage-skip:focus { top: 1rem; }

.usage-main:focus { outline: none; }

.usage-page .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.usage-wrap {
  width: 100%;
  max-width: calc(1200px + 2 * var(--alr-gutter));
  margin: 0 auto;
  padding: 0 var(--alr-gutter);
}

/* --- Reading text -------------------------------------------------------- */

.usage-main {
  color: var(--usage-soft);
  font-size: 1.125rem;
  line-height: 1.65;
}
.usage-main p { max-width: 64ch; }
.usage-main :is(p, dd) { text-wrap: pretty; }
.usage-main strong { color: var(--ink); font-weight: 700; }

.usage-text h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 3.5vw, 2.875rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: var(--track-display, -0.015em);
}
.usage-text h3 {
  margin: 2.5rem 0 0.6rem;
  color: var(--ink);
  font-size: 1.3125rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: var(--track-heading, -0.01em);
  text-wrap: balance;
}
.usage-main .usage-lead {
  max-width: 46ch;
  margin-top: 1rem;
  color: var(--ink);
  font-size: clamp(1.25rem, 1.75vw, 1.4375rem);
  line-height: 1.5;
  text-wrap: balance;
}
.usage-text p + p { margin-top: 1rem; }

.usage-text a:not(.btn) {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
  transition: color var(--d-fast) var(--ease), text-underline-offset var(--d-fast) var(--ease);
}
.usage-text a:not(.btn):hover { color: var(--orange); text-underline-offset: 0.34em; }
.usage-main :is(a, summary):focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 4px;
  border-radius: 2px;
}

.usage-text .usage-go { font-weight: 700; }
.usage-text p:has(> .usage-go) { margin-top: 1.75rem; }

/* --- Opening ------------------------------------------------------------- */

.usage-top { padding-top: 132px; }

/* The name, marked with the same clipped bar as the site's section labels. */
.usage-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--usage-soft);
  font-size: 1rem;
  font-weight: 600;
}
.usage-name::before,
.usage-contents a::before {
  content: "";
  flex: none;
  width: 26px;
  height: 3px;
  background: var(--orange);
  clip-path: polygon(0 0, 100% 0, calc(100% - 3px) 100%, 0 100%);
}

.usage-top h1 {
  margin: 1.1rem 0 0 -0.04em;
  font-size: clamp(3rem, 7.6vw, 6.5rem);
  line-height: 1.03;
  letter-spacing: var(--track-display, -0.015em);
}
.usage-top h1 :is(strong, span) { display: block; }
.usage-top h1 strong { color: var(--ink); font-weight: 900; }
.usage-top h1 span { color: #d9dbdf; font-weight: 400; }

.usage-main .usage-lede {
  max-width: 37rem;
  margin-top: 1.6rem;
  font-size: clamp(1.125rem, 1.5vw, 1.25rem);
  line-height: 1.6;
}

.usage-answers { margin: 2.5rem 0 0; border-top: 1px solid var(--line-2); }
.usage-answers > div {
  display: grid;
  grid-template-columns: var(--usage-rail) minmax(0, 1fr);
  align-items: baseline;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
}
.usage-answers dt { padding-right: 1.5rem; }
.usage-answers dd { margin: 0; color: var(--ink); }
.usage-answers dd strong {
  display: inline-block;
  min-width: 3.1rem;
  color: var(--orange);
  font-weight: 900;
}

/* --- Contents and text --------------------------------------------------- */

.usage-body {
  display: grid;
  grid-template-columns: var(--usage-rail) minmax(0, 1fr);
  align-items: start;
  padding-top: 7rem;
  padding-bottom: 7rem;
}

.usage-contents {
  position: sticky;
  top: 116px;
  font-size: 1.0625rem;
}
.usage-contents ul { margin: 0; padding: 0; list-style: none; }
.usage-more { display: none; }
.usage-contents a {
  display: inline-flex;
  align-items: center;
  min-height: 2.625rem;
  color: var(--usage-soft);
  transition: color var(--d-fast) var(--ease);
}
.usage-contents a::before {
  width: 0;
  margin-right: 0;
  transition: width var(--d-mid) var(--ease), margin-right var(--d-mid) var(--ease);
}
.usage-contents a:hover { color: var(--ink); }
.usage-contents a[aria-current] { color: var(--ink); font-weight: 700; }
.usage-contents a[aria-current]::before { width: 26px; margin-right: 0.75rem; }

.usage-text > section { scroll-margin-top: 104px; }
.usage-text > section + section { margin-top: 7rem; }

/* --- Uses: the headline's two weights again ------------------------------ */

.usage-uses {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  color: #d9dbdf;
  font-size: clamp(1.4375rem, 2.75vw, 2.125rem);
  line-height: 1.25;
  letter-spacing: var(--track-heading, -0.01em);
}
.usage-uses li + li { margin-top: 0.42em; }
.usage-uses strong { font-weight: 900; }

/* --- Credit -------------------------------------------------------------- */

.usage-credit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 2rem;
  align-items: center;
  margin-top: 1.5rem;
  padding: 1.5rem 1.5rem 1.5rem 1.75rem;
  border-radius: var(--r-md);
  background: #17171b;
}
.usage-main .usage-credit p {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.usage-credit .btn { min-width: 9.5rem; font-size: 1rem; }
.usage-main .usage-status {
  min-height: 1.6em;
  margin: 0.75rem 0 -2.35rem;
  font-size: 1rem;
  line-height: 1.6;
}

/* --- Who owns what: one sentence, read down the left --------------------- */

.usage-parts { margin: 2.25rem 0 2.5rem; }
.usage-parts > div {
  display: grid;
  grid-template-columns: minmax(0, 9fr) minmax(0, 11fr);
  gap: 0.5rem 2rem;
  align-items: baseline;
}
.usage-parts > div + div { margin-top: 2rem; }
.usage-parts dt {
  color: var(--ink);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: var(--track-display, -0.015em);
  white-space: nowrap;
}
.usage-parts dd { margin: 0; }

/* --- EA's rules ---------------------------------------------------------- */

.usage-rules {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 0 2rem;
  margin-top: 2.25rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--usage-rule);
}
.usage-rules + .usage-rules { margin-top: 2rem; }
.usage-text .usage-rules h3 { margin: 0; font-weight: 900; }
.usage-rules ul { margin: 0; padding: 0; list-style: none; }
.usage-rules li { line-height: 1.55; text-wrap: pretty; }
.usage-rules li + li { margin-top: 0.85rem; }
.usage-rules p + ul { margin-top: 0.85rem; }
.usage-main .usage-note { margin-top: 2.5rem; }
.usage-text .usage-note + p { margin-top: 0.75rem; }

/* --- Creator Tools ------------------------------------------------------- */

.usage-tool dl { margin: 1.1rem 0 0; }
.usage-tool dl > div {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 0 1.5rem;
  padding: 0.3rem 0;
}
.usage-tool dd { margin: 0; color: var(--ink); }

/* --- Questions ----------------------------------------------------------- */

.usage-text #questions h3 { margin: 3.5rem 0 1rem; font-weight: 900; }
.usage-faq details { border-top: 1px solid var(--usage-rule); scroll-margin-top: 104px; }
.usage-faq details:last-child { border-bottom: 1px solid var(--usage-rule); }
.usage-faq summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 12px;
  gap: 1.5rem;
  align-items: center;
  min-height: 4.75rem;
  /* Room inside the focus ring, without moving the text off its line. */
  margin: 0 -0.75rem;
  padding: 0.9rem calc(0.75rem + 2px) 0.9rem 0.75rem;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.4;
  list-style: none;
  cursor: pointer;
}
.usage-faq summary::-webkit-details-marker { display: none; }
.usage-faq summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
  transition: transform var(--d-fast) var(--ease);
}
.usage-faq details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.usage-faq summary span { transition: color var(--d-fast) var(--ease); }
.usage-faq summary:hover span { color: var(--orange); }
.usage-main .usage-faq summary:focus-visible { outline-offset: -4px; border-radius: var(--r-md); }
/* The answer is readable without opening anything. */
.usage-faq summary b {
  color: var(--usage-soft);
  font-size: 1rem;
  font-weight: 600;
  text-align: right;
}
.usage-faq summary b.is-yes { color: var(--orange); font-weight: 700; }
.usage-faq details > p { padding-right: 1rem; }
.usage-faq details > p:last-child { padding-bottom: 2.25rem; }

/* --- Ask us -------------------------------------------------------------- */

.usage-main .usage-mail {
  max-width: none;
  margin-top: 1.75rem;
  font-size: clamp(1.25rem, 2.9vw, 2.125rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: var(--track-heading, -0.01em);
}
.usage-text .usage-mail + p { margin-top: 1.1rem; }
.usage-main .usage-small { max-width: none; margin-top: 5rem; font-size: 1rem; }

/* --- Tablet and phone: the contents become a strip that stays in reach --- */

@media (max-width: 960px) {
  .usage-top { padding-top: 112px; }
  .usage-body { display: block; padding-top: 3.5rem; padding-bottom: 5rem; }

  .usage-contents {
    top: 60px;
    z-index: 20;
    margin: 0 calc(-1 * var(--alr-gutter)) 3.5rem;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--stage);
    font-size: 1rem;
  }
  .usage-contents ul {
    display: flex;
    gap: 1.75rem;
    overflow-x: auto;
    padding: 0 4.5rem 0 var(--alr-gutter);
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--alr-gutter));
    mask-image: linear-gradient(90deg, transparent, #000 var(--alr-gutter));
  }
  /* Names fade out before the arrow, which says there are more of them. */
  .usage-contents:has(.usage-more:not([hidden])) ul {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--alr-gutter), #000 calc(100% - 5.5rem), transparent calc(100% - 3rem));
    mask-image: linear-gradient(90deg, transparent, #000 var(--alr-gutter), #000 calc(100% - 5.5rem), transparent calc(100% - 3rem));
  }
  .usage-contents ul::-webkit-scrollbar { display: none; }
  .usage-more:not([hidden]) {
    position: absolute;
    inset: 0 0 0 auto;
    display: grid;
    place-items: center;
    width: 3.25rem;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--usage-rule);
    background: none;
    color: var(--ink);
    cursor: pointer;
  }
  .usage-more::before {
    content: "";
    width: 10px;
    height: 10px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: translateX(-2px) rotate(45deg);
  }
  .usage-contents li { flex: none; }
  .usage-contents a { position: relative; min-height: 3rem; white-space: nowrap; }
  .usage-main .usage-contents a:focus-visible { outline-offset: -4px; }
  /* Same weight whether current or not, so the strip never shifts. */
  .usage-contents a[aria-current] { font-weight: inherit; }
  .usage-contents a::before { position: absolute; left: 0; bottom: 0; width: 0; margin: 0; }
  .usage-contents a[aria-current]::before { width: 26px; margin: 0; }

  .usage-text > section,
  .usage-faq details { scroll-margin-top: 136px; }
  .usage-text > section + section { margin-top: 5.5rem; }
}

@media (max-width: 640px) {
  .usage-main { font-size: 1.0625rem; }
  .usage-top { padding-top: 96px; }
  /* Both lines fill the column, so the light one is set smaller. */
  .usage-top h1 { --w: min(100vw - 2 * var(--alr-gutter), 27rem); margin-left: 0; }
  .usage-top h1 strong { font-size: calc(var(--w) / 7.35); }
  .usage-top h1 span { margin-top: 0.06em; font-size: calc(var(--w) / 8.3); }
  .usage-main .usage-lede { margin-top: 1.25rem; }

  .usage-answers { margin-top: 2rem; }
  .usage-answers > div { display: block; padding: 0.9rem 0; }
  .usage-answers dt { padding: 0; }
  .usage-answers dd { margin-top: 0.15rem; }
  .usage-answers dd strong { min-width: 0; margin-right: 0.15em; }

  .usage-uses { font-size: clamp(1.0625rem, 5.35vw, 1.625rem); }
  .usage-main .usage-mail { font-size: clamp(1.0625rem, (100vw - 2 * var(--alr-gutter)) / 18.8, 1.625rem); }

  .usage-credit { grid-template-columns: 1fr; padding: 1.25rem; }
  .usage-main .usage-status { min-height: 3.2em; margin-bottom: -3.95rem; }

  .usage-parts > div,
  .usage-rules { display: block; }
  .usage-rules :is(ul, div) { margin-top: 0.75rem; }
  .usage-rules div ul { margin-top: 0.85rem; }
  .usage-parts dd { margin-top: 0.5rem; }

  .usage-tool dl > div { display: block; padding: 0.4rem 0; }
  .usage-tool dt { font-size: 1rem; }

  .usage-faq summary { grid-template-columns: minmax(0, 1fr) 12px; gap: 0.2rem 1.25rem; padding-block: 1rem; }
  .usage-faq summary b { grid-column: 1; grid-row: 2; text-align: left; }
  .usage-faq summary::after { grid-column: 2; grid-row: 1 / 3; }
  .usage-faq details > p { padding-right: 0; }
}
