/* Add Text legal pages, laid out like Apple's own Privacy Policy
   (apple.com/legal/privacy): a translucent sticky bar with the app's name and the two
   documents; centred, a large title, a bold "Updated" line and a few lines about the
   document; then the clauses as an accordion — each clause a numbered heading under a hairline
   with a grey plus that turns into a cross when it opens — and a last row that links the other
   document. A grey footer band with the copyright line, centred.
   On phones every size is a standard iOS text style (Large Title 34, Headline 17, Title 3 20,
   Body 17, Footnote 13), the same as the app.
   The app's page (Add Text/View/Home/LegalView.swift) is drawn the same way. */

:root {
  --bg: #ffffff;
  --bg2: #f5f5f7;               /* Apple's footer grey */
  --bar: rgba(255, 255, 255, 0.72);
  --fg: #1d1d1f;
  --fg2: #6e6e73;
  --fg3: #86868b;               /* the plus */
  --line: #d2d2d7;
  --link: #0066cc;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --bg2: #161617; --bar: rgba(22, 22, 23, 0.8);
    --fg: #f5f5f7; --fg2: #a1a1a6; --fg3: #86868b; --line: #424245; --link: #2997ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --bg2: #161617; --bar: rgba(22, 22, 23, 0.8);
  --fg: #f5f5f7; --fg2: #a1a1a6; --fg3: #86868b; --line: #424245; --link: #2997ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(64px + env(safe-area-inset-top, 0px)); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.47 var(--font);
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; border-radius: 4px; }
strong { font-weight: 600; }

.wrap {
  max-width: 1024px; margin: 0 auto;
  padding-left: max(22px, env(safe-area-inset-left, 0px));
  padding-right: max(22px, env(safe-area-inset-right, 0px));
}

/* ---------- The bar (Apple's local nav) ---------- */
body::before {   /* the notch band above the sticky bar, in the bar's colour */
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10;
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; }
.bar .name { color: var(--fg); font: 600 19px/1.2 var(--font-display); letter-spacing: 0.012em; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .name:hover { text-decoration: none; }
.bar nav { display: flex; gap: 24px; font-size: 12px; letter-spacing: -0.01em; flex: none; }
.bar nav a { color: var(--fg); opacity: 0.8; }
.bar nav a[aria-current="page"] { color: var(--fg2); opacity: 1; cursor: default; }
.bar nav a[aria-current="page"]:hover { text-decoration: none; }

/* ---------- Title ---------- */
.head { text-align: center; padding-block: 70px 56px; }
h1 { margin: 0; font: 600 48px/1.08 var(--font-display); letter-spacing: -0.003em; text-wrap: balance; }
.updated { margin: 14px 0 0; font: 600 20px/1.47 var(--font); letter-spacing: -0.019em; }
.intro { max-width: 640px; margin: 28px auto 0; font-size: 21px; line-height: 1.38; letter-spacing: 0.011em; }
.intro p { margin: 0; text-wrap: pretty; }
.intro p + p { margin-top: 16px; }

/* ---------- Clauses (the accordion) ---------- */
.clauses { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.clauses > li { border-top: 1px solid var(--line); }
.clauses summary {
  display: grid; grid-template-columns: 2.1em minmax(0, 1fr) 27px; align-items: start; column-gap: 6px;
  padding-block: 33px; cursor: pointer; list-style: none;
}
.clauses summary::-webkit-details-marker { display: none; }
.clauses .num, .clauses h2 { font: 600 32px/1.125 var(--font-display); letter-spacing: 0.004em; margin: 0; }
.clauses .num { color: var(--fg3); font-variant-numeric: tabular-nums; }
.clauses h2 { text-wrap: balance; }
.clauses summary:hover h2 { color: var(--link); }
.clauses .link {
  display: grid; grid-template-columns: 2.1em minmax(0, 1fr) 27px; align-items: start; column-gap: 6px;
  padding-block: 33px; color: var(--fg);
}
.clauses .link:hover { text-decoration: none; }
.clauses .link:hover .title { color: var(--link); }
.clauses .link .title { grid-column: 2; font: 600 32px/1.125 var(--font-display); letter-spacing: 0.004em; }
.clauses .link .arrow { color: var(--fg3); font: 400 32px/1.125 var(--font-display); text-align: center; }

/* The plus: two bars that turn a quarter of a right angle into a cross. */
.plus { position: relative; width: 27px; height: 27px; margin-top: 4px; color: var(--fg3); transition: transform 0.3s ease; }
.plus::before, .plus::after { content: ""; position: absolute; left: 50%; top: 50%; background: currentColor; border-radius: 1px; transform: translate(-50%, -50%); }
.plus::before { width: 25px; height: 2.5px; }
.plus::after { width: 2.5px; height: 25px; }
details[open] .plus { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .plus { transition: none; } }

.panel { padding: 0 0 44px calc(2.1em * 32 / 17 + 6px); max-width: calc(692px + 2.1em * 32 / 17 + 6px); }
.panel > :first-child { margin-top: 0; }
.panel p, .panel ul { margin: 17px 0 0; }
.panel ul { padding-left: 22px; list-style: disc; }   /* a list inside the clause list would get circles */
.panel li + li { margin-top: 8px; }
.panel li::marker { color: var(--fg2); }
.panel h3 { margin: 30px 0 0; font: 600 19px/1.32 var(--font-display); letter-spacing: 0.012em; }
.panel .sub { font-variant-numeric: tabular-nums; }   /* 3.1, 3.2 …: bold with the label, as in the app */

main.wrap { padding-bottom: 96px; }
.note { color: var(--fg2); font-size: 14px; margin: 28px 0 0; }

/* ---------- The legal home page: the documents as rows ---------- */
.docs { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.docs li { border-top: 1px solid var(--line); }
.docs a { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 16px; padding-block: 28px; color: var(--fg); }
.docs a:hover { text-decoration: none; }
.docs a:hover .t { color: var(--link); }
.docs .t { font: 600 32px/1.125 var(--font-display); }
.docs .d { grid-column: 1; color: var(--fg2); font-size: 17px; }
.docs .go { grid-row: 1 / span 2; grid-column: 2; color: var(--link); font-size: 17px; }
.support { margin: 56px 0 0; }
.support h2 { margin: 0; font: 600 24px/1.17 var(--font-display); }
.support p { margin: 12px 0 0; }

/* ---------- Footer ---------- */
footer { background: var(--bg2); }
footer .wrap { padding-block: 20px 30px; font-size: 13px; line-height: 1.5; color: var(--fg2); text-align: center; }
footer a { color: var(--fg2); }
footer a:hover { color: var(--fg); }

/* ---------- Phones: the standard iOS text sizes, as in the app ---------- */
@media (max-width: 734px) {
  .bar .name { font-size: 17px; }
  .bar nav { display: none; }
  .head { padding-block: 24px 32px; }
  h1 { font: 700 34px/1.2 var(--font-display); letter-spacing: 0.011em; }      /* Large Title */
  .updated { margin-top: 6px; font-size: 17px; letter-spacing: -0.022em; }      /* Headline */
  .intro { margin-top: 18px; font-size: 17px; line-height: 1.47; letter-spacing: -0.022em; }  /* Body */
  .intro p + p { margin-top: 12px; }
  .clauses .num, .clauses h2,
  .clauses .link .title, .clauses .link .arrow { font-size: 20px; line-height: 1.25; letter-spacing: 0.019em; }  /* Title 3 */
  .clauses summary, .clauses .link { grid-template-columns: 32px minmax(0, 1fr) 20px; column-gap: 4px; padding-block: 20px; }
  .plus { width: 20px; height: 20px; margin-top: 2px; }
  .plus::before { width: 17px; height: 2px; }
  .plus::after { width: 2px; height: 17px; }
  .panel { padding-left: 0; padding-bottom: 28px; }
  .docs .t { font-size: 20px; }
  footer .wrap { font-size: 13px; }                                              /* Footnote */
}
