/* The page's frame: the centred shell, sections and their surfaces, a centred heading with its intro,
   a row of actions, and a page's own title. */
@layer shared {
  .shell {
    width: min(calc(100% - var(--gutter) * 2), var(--shell));
    margin-inline: auto;
  }
  .actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-7);
  }
  .center {
    text-align: center;
  }
  .center h1,
  .center h2 {
    margin-inline: auto;
    max-width: 22ch;
  }
  .intro {
    max-width: 55ch;
    margin: var(--space-6) auto 0;
    font-size: var(--text-lg);
    line-height: var(--leading-body);
  }
  .center > .pill {
    margin-top: var(--space-7);
  }
  .section {
    padding-block: var(--space-32);
  }
  .grey,
  .shaded {
    background: var(--color-surface);
  }
  .plans-fine {
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
  }
  .title {
    font-size: var(--display-xl);
    line-height: var(--leading-display);
    letter-spacing: var(--tracking-display);
  }

  @media (max-width: 760px) {
    .intro {
      font-size: var(--text-base);
      max-width: 36ch;
      margin-top: var(--space-6);
    }
    .section {
      padding-block: var(--space-22);
    }
  }
}
/* The site's button in the colours of its surface's roles: dark on light, light on dark; a small one in the
   header, an outline one beside it. */
@layer shared {
  .pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 var(--space-6);
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-action-edge);
    color: var(--color-on-action);
    background: var(--color-action);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    line-height: var(--leading-snug);
    transition:
      background var(--duration-fast) var(--ease),
      color var(--duration-fast) var(--ease);
  }
  .pill:hover {
    background: var(--color-action-hover);
    border-color: var(--color-action-hover-edge);
    color: var(--color-on-action-hover);
  }
  .pill.small {
    min-height: 42px;
    padding: 0 var(--space-5);
  }
  .pill.outline {
    background: transparent;
    color: var(--color-on-outline);
    border-color: var(--color-outline-edge);
  }
  .pill.outline:hover {
    background: var(--color-outline-hover);
    color: var(--color-on-outline-hover);
  }
  .pill svg {
    width: 15px;
    height: 15px;
    margin-inline-start: var(--space-7);
    transition: transform var(--duration-fast) var(--ease);
  }
  .pill:hover svg {
    transform: translateX(3px);
  }
  /* An arrow points the way the line reads; mirrored, its push on hover turns with it. */
  .pill svg:not(.os):dir(rtl) {
    scale: -1 1;
  }
  .pill svg.os {
    width: 18px;
    height: 18px;
    margin-block: calc(var(--space-half) * -1) 0;
    margin-inline: calc(var(--space-1) * -1) var(--space-3);
    transform: none;
  }
}
/* A quiet link: underlined text with room for a finger. */
@layer shared {
  .text-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    border-bottom: 1px solid currentcolor;
    font-size: var(--text-sm);
  }
  .text-link svg.os {
    width: 15px;
    height: 15px;
    margin-block-start: calc(var(--space-half) * -1);
    margin-inline-end: var(--space-2);
  }
}
/* The wordmark leading home; light on a dark surface (the theme's --brand-filter). */
@layer shared {
  .brand {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
  }
  .brand img {
    width: 112px;
    height: auto;
    filter: var(--brand-filter);
  }
}
/* A cinematic dark first screen: a picture or a film under a scrim, the words over it on the left (on a
   portrait screen at the bottom), light buttons. On a dark page an outline button lights as the page's do. */
@layer shared {
  .hero {
    --color-action: var(--color-light);
    --color-action-edge: var(--color-light);
    --color-on-action: var(--color-dark);
    --color-action-hover: var(--color-light-soft);
    --color-action-hover-edge: var(--color-light);
    --color-on-action-hover: var(--color-dark);
    --color-on-outline: var(--color-light);
    --color-outline-edge: var(--color-light-edge);
    --color-outline-hover: var(--color-light-soft);
    --color-on-outline-hover: var(--color-dark);
    --color-focus: var(--color-light);
    --brand-filter: invert(1);

    position: relative;
    isolation: isolate;
    height: 100svh;
    min-height: 640px;
    overflow: hidden;
    background: var(--color-night);
    color: var(--color-light);
  }
  [data-theme="dark"] .hero {
    --color-outline-hover: var(--color-line);
    --color-on-outline-hover: var(--color-white);
  }
  .hero .scrim {
    position: absolute;
    inset: 0;
    z-index: var(--z-scrim);
    pointer-events: none;
    background: var(--scrim-hero);
  }
  .hero .copy {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding-block: var(--space-28);
    pointer-events: none;
  }
  .hero .copy > * {
    pointer-events: auto;
  }
  .hero h1 {
    font-size: var(--display-lg);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-display);
    max-width: 8.3em;
  }
  .hero .lead {
    color: var(--color-light-muted);
    max-width: 31ch;
    margin-top: var(--space-6);
  }
  .hero .actions {
    justify-content: flex-start;
    margin-top: var(--space-8);
  }

  @media (max-aspect-ratio: 1/1) {
    .hero {
      min-height: 780px;
    }
    /* The words stand under the scene's picture, above the safe area of the screen. */
    .hero .copy {
      --clear: 450px;
      --rest: max(76px, calc(52px + env(safe-area-inset-bottom)));

      justify-content: flex-end;
      padding-top: var(--clear);
      padding-bottom: var(--rest);
    }
    .hero .scrim {
      background: var(--scrim-hero-portrait);
    }
    .hero h1 {
      font-size: var(--display-lg-portrait);
      max-width: 10em;
    }
    .hero .lead {
      margin-top: var(--space-4);
    }
    .hero .actions {
      margin-top: var(--space-6);
    }
  }
}
/* One phone for the whole site: the screen, a picture or a film, carries the status bar and the island. A
   device keeps its buttons where they are in any language. */
@layer shared {
  .phone {
    --w: 268px;

    direction: ltr;
    position: relative;
    width: var(--w);
    flex-shrink: 0;
    padding: calc(var(--w) * 0.03);
    border-radius: calc(var(--w) * 0.165);
    background: var(--gradient-phone);
    box-shadow: var(--shadow-phone);
  }
  .phone::before,
  .phone::after {
    content: "";
    position: absolute;
    width: 3px;
    border-radius: var(--radius-xs);
    background: var(--color-phone-button);
  }
  .phone::before {
    inset-inline-end: -3px;
    top: 27%;
    height: 12%;
  }
  .phone::after {
    inset-inline-start: -3px;
    top: 21%;
    height: 7%;
  }
  .phone :is(img, video) {
    display: block;
    width: 100%;
    height: auto;
    border-radius: calc(var(--w) * 0.135);
    background: var(--color-black);
  }
  /* An Android phone has tighter corners and the buttons on the right. */
  .phone.android {
    border-radius: calc(var(--w) * 0.12);
  }
  .phone.android :is(img, video) {
    border-radius: calc(var(--w) * 0.095);
  }
  .phone.android::after {
    inset-inline: auto -3px;
    top: 44%;
  }
}
/* Short notes side by side under a hairline. */
@layer shared {
  .notes {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: var(--space-8);
    text-align: start;
  }
  .notes > div {
    position: relative;
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-line);
    transition: opacity var(--duration-base) var(--ease);
  }
  .notes :is(h2, h3) {
    font-size: var(--heading-sm);
    line-height: var(--leading-snug);
    letter-spacing: var(--tracking-title);
  }
  .notes p {
    max-width: 30ch;
    margin-top: var(--space-3);
    font-size: var(--text-base);
  }
  .notes p a {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .care {
    margin-top: var(--space-28);
  }

  @media (max-width: 760px) {
    .notes {
      grid-auto-flow: row;
      grid-template-columns: 1fr 1fr;
      gap: var(--space-9) var(--space-5);
    }
    .care {
      margin-top: var(--space-18);
    }
  }
}
/* A film in parts: the note of the part on screen has its line fill while the part plays, over the part's
   length from where the film was in it (film.ts gives both), and stand while the film stands. */
@layer shared {
  [data-chapters] .notes > div {
    border-color: var(--color-light-line);
  }
  [data-chapters] .notes > div::before {
    content: "";
    position: absolute;
    top: -1px;
    inset-inline-start: 0;
    width: 100%;
    height: 2px;
    background: var(--color-light);
    transform: scaleX(0);
    transform-origin: left;
  }
  [data-chapters] .notes > .on::before {
    animation: chapter-fill var(--part) var(--ease-linear) var(--into) both;
  }
  [data-chapters]:not(.running) .notes > .on::before {
    animation-play-state: paused;
  }
  [data-chapters] .notes > div:dir(rtl)::before {
    transform-origin: right;
  }

  @keyframes chapter-fill {
    to {
      transform: scaleX(1);
    }
  }
}
/* Specifications: a plain two-column list, like the specs page of a device. */
@layer shared {
  .specs {
    margin: var(--space-14) 0 0;
    border-top: 1px solid var(--color-line);
  }
  .specs > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: var(--space-8);
    padding: var(--space-7) 0;
    border-bottom: 1px solid var(--color-line);
  }
  .specs dt {
    font-size: var(--text-lg);
  }
  .specs dd {
    margin: 0;
    font-size: var(--text-lg);
    color: var(--color-text-muted);
  }

  @media (max-width: 760px) {
    .specs > div {
      grid-template-columns: 1fr;
      gap: var(--space-2);
      padding: var(--space-5) 0;
    }
  }
}
/* A page that is a document (privacy, support, terms): its title, a lead and the day it changed, then sections of
   a heading over a spec list. */
@layer shared {
  .doc {
    padding-block: var(--space-14) var(--space-32);
  }
  .doc .lead {
    max-width: 40ch;
    margin-top: var(--space-6);
    font-size: var(--text-xl);
    line-height: var(--leading-body);
    color: var(--color-text);
  }
  .doc time {
    display: block;
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
  }
  .doc > .pill {
    margin-top: var(--space-10);
  }
  .doc h2 {
    margin-top: var(--space-24);
  }
  .doc dd a,
  .doc .fine a {
    text-decoration: underline;
    text-underline-offset: 4px;
  }
  .doc .fine {
    margin-top: var(--space-10);
    font-size: var(--text-base);
  }

  @media (max-width: 760px) {
    .doc h2 {
      margin-top: var(--space-18);
    }
  }
}
/* A form field: its name above, the input, a note under it. A group of choices takes the same name style. */
@layer shared {
  .field > span,
  .legend {
    display: block;
    margin-bottom: var(--space-3);
    padding: 0;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
  }
  .field :is(input, select) {
    width: 100%;
    height: 54px;
    padding: 0 var(--space-4);
    border: 1px solid var(--color-field-edge);
    border-radius: var(--radius-md);
    background: var(--color-field);
    color: var(--color-text);
    font-size: var(--text-base);
  }
  .field :is(input, select):focus {
    border-color: var(--color-focus);
    outline: 1px solid var(--color-focus);
    outline-offset: 0;
  }
  .field small {
    display: block;
    margin-top: var(--space-3);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
  }
  .field small a {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}
/* A page that asks for one thing: the heading, one field, one button, the answer under it (Restore access, Stop
   renewal). */
@layer shared {
  .ask {
    display: grid;
    justify-items: start;
    gap: var(--space-5);
    max-width: 560px;
    padding-block: var(--space-30) var(--space-40);
  }
  .ask .lead {
    margin-bottom: var(--space-5);
    font-size: var(--text-lg);
  }
  .ask .field {
    width: 100%;
  }
}
/* A form's answer under its button: news in ink (a code sent, coins awaited, renewal stopped or nothing to stop, the
   App Store's own way), a refusal in the accent. */
@layer shared {
  .says:empty {
    display: none;
  }
  .says {
    font-size: var(--text-md);
    color: var(--color-text);
  }
  .says a {
    text-decoration: underline;
    text-underline-offset: 4px;
  }
  .says:not([data-kind="sent"], [data-kind="waiting"], [data-kind="stopped"], [data-kind="none"], [data-kind="apple"]) {
    color: var(--color-accent-text);
  }
}
/* A line to copy: the text in a dark box, the copy button at its end. */
@layer shared {
  .command {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    margin-top: var(--space-3);
    padding-block: var(--space-2);
    padding-inline: var(--space-4) var(--space-2);
    border-radius: var(--radius-lg);
    background: var(--color-deep);
    box-shadow: var(--shadow-edge);
  }
  .command code {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    font: var(--text-xs) / var(--leading-body) var(--font-mono);
    color: var(--color-light-soft);
  }
  .command button {
    flex: none;
    min-height: 40px;
    padding: 0 var(--space-4);
    border: 0;
    border-radius: var(--radius-md);
    background: var(--color-light);
    color: var(--color-dark);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
  }
}
/* The last call of a page: a large line and its button. */
@layer shared {
  .closing {
    padding-block: var(--space-45);
  }
  .closing h2 {
    font-size: var(--display-2xl);
    max-width: 20ch;
  }
  .closing .pill {
    margin-top: var(--space-9);
  }

  @media (max-width: 760px) {
    .closing {
      padding-block: var(--space-30);
    }
  }
}
/* A page that is one message: the title, a line, what to do next. */
@layer shared {
  .done {
    padding-block: var(--space-40);
  }
  .done .lead {
    max-width: 40ch;
    margin: var(--space-5) auto 0;
    font-size: var(--text-lg);
  }
  .done .pill {
    margin-top: var(--space-8);
  }

  @media (max-width: 760px) {
    .done {
      padding-block: var(--space-28);
    }
  }
}
