/*
 * Legal pages (rules.html, offer.html, privacy.html, consent.html): long-text
 * typography on top of styles.css (tokens, header, logo, footer, Manrope).
 * Static pages, no scripts.
 */

/* styles.css snaps the two screens of index.html; documents scroll freely. */
html {
  scroll-snap-type: none;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

.doc-top nav a {
  font-size: 13px;
  color: #c9c7bd;
}

/* ---------- Layout: title, contents, text ---------- */

/*
 * AICODE-NOTE: DOM order is title -> contents -> text, so phones (one column)
 * show the contents right under the title. From 1000px the contents become a
 * sticky left column that spans both rows of the grid.
 */
.doc-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 5% 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "head"
    "toc"
    "body";
  gap: 28px;
}

/* A short document without contents (consent.html). */
.doc-main.no-toc {
  grid-template-areas:
    "head"
    "body";
}

.doc-head {
  grid-area: head;
  min-width: 0;
}

.doc-head h1 {
  margin: 14px 0 0;
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1.08;
  letter-spacing: -1.5px;
  font-weight: 600;
  overflow-wrap: break-word;
  hyphens: auto;
}

.doc-lead {
  max-width: 62ch;
  margin: 16px 0 0;
  color: #c9c7bd;
  font-size: 16px;
  line-height: 1.65;
}

.doc-meta {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.doc-note {
  margin: 20px 0 0;
  padding: 14px 16px;
  border: 1px solid #ff6b2b66;
  border-radius: 12px;
  background: #ff6b2b14;
  color: var(--orange-soft);
  font-size: 15px;
  line-height: 1.6;
}

.doc-note b {
  color: var(--orange);
}

/* ---------- Contents ---------- */

.doc-toc {
  grid-area: toc;
  display: block; /* styles.css makes every nav a flex row */
  min-width: 0;
  align-self: start;
  padding: 18px 18px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.doc-toc h2 {
  margin: 0 0 10px;
}

.doc-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.doc-toc li {
  counter-increment: toc;
  display: flex;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.doc-toc li::before {
  content: counter(toc) ".";
  flex: none;
  min-width: 1.6em;
  padding: 6px 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.doc-toc a {
  display: block;
  padding: 6px 0;
  font-size: 14px;
  color: #d9d7cd;
}

.doc-toc a:hover {
  color: var(--orange);
}

/* ---------- Text ---------- */

.doc {
  grid-area: body;
  min-width: 0;
  max-width: 720px;
  color: #d9d7cd;
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: break-word;
}

.doc section {
  scroll-margin-top: 16px;
}

.doc section + section {
  margin-top: 40px;
}

.doc h2 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 22px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -.3px;
}

.doc h3 {
  margin: 26px 0 10px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.4;
  font-weight: 600;
}

.doc p {
  margin: 0 0 14px;
}

.doc ul,
.doc ol {
  margin: -4px 0 16px;
  padding-left: 22px;
}

.doc li {
  margin: 6px 0;
  padding-left: 2px;
}

.doc li::marker {
  color: var(--muted);
}

.doc b,
.doc strong {
  color: var(--text);
  font-weight: 700;
}

.doc a {
  color: var(--orange-soft);
  font-size: inherit;
  text-decoration: underline;
  text-decoration-color: #ffb08a66;
  text-underline-offset: 3px;
}

.doc a:hover {
  color: var(--orange);
  text-decoration-color: currentColor;
}

/* Clause numbers: 1.1., 1.2. ... */
.n {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.doc dl {
  margin: 0 0 16px;
}

.doc dt {
  color: var(--text);
  font-weight: 700;
}

.doc dd {
  margin: 0 0 12px;
}

/* A table that may be wider than a phone scrolls inside its own box. */
.table-wrap {
  margin: 4px 0 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}

.doc th,
.doc td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
}

.doc th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.doc tbody tr {
  border-top: 1px solid var(--line);
}

.doc td:first-child {
  white-space: nowrap;
  color: var(--text);
}

/* The purposes of processing (privacy policy): one card each instead of a six-column table. */
.purposes {
  display: grid;
  gap: 12px;
  margin: 4px 0 18px;
}

.purpose {
  padding: 16px 18px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #151513;
}

.purpose h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.purpose dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
}

/* A form to fill in (consent.html): blanks are lines, not brackets. */
.form-sheet {
  margin: 4px 0 20px;
  padding: 20px 20px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.form-sheet > h3:first-child {
  margin-top: 0;
}

.blank {
  display: inline-block;
  min-width: 9em;
  margin: 0 2px;
  padding: 0 4px;
  border-bottom: 1px solid #ffffff55;
  color: var(--muted);
  font-size: .85em;
  line-height: 1.5;
  text-align: center;
}

.doc blockquote {
  margin: 4px 0 16px;
  padding: 14px 16px;
  border-left: 3px solid var(--orange);
  border-radius: 0 12px 12px 0;
  background: var(--panel);
  color: var(--text);
}

.doc blockquote p:last-child {
  margin-bottom: 0;
}

.contacts {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.contacts p {
  margin: 0 0 4px;
}

/* ---------- Footer ---------- */

.doc-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 5% 32px;
}

/* ---------- Wide screens ---------- */

@media (min-width: 1000px) {
  .doc-main {
    grid-template-columns: 250px minmax(0, 720px);
    grid-template-areas:
      "toc head"
      "toc body";
    justify-content: center;
    column-gap: 56px;
    row-gap: 36px;
    padding-top: 48px;
  }

  .doc-main.no-toc {
    grid-template-columns: minmax(0, 720px);
    grid-template-areas:
      "head"
      "body";
  }

  /* overflow-y clips at the padding box: 6px of padding (offset by the margin)
     keeps the first letters and the focus outlines inside it. */
  .doc-toc {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    margin: -6px;
    padding: 6px;
    border: 0;
    background: none;
  }

  .doc {
    font-size: 17px;
  }

  .doc h2 {
    font-size: 24px;
  }
}

@media (max-width: 520px) {
  .doc-main {
    padding-left: 6%;
    padding-right: 6%;
  }

  .doc-footer {
    padding-left: 6%;
    padding-right: 6%;
  }

  .doc th,
  .doc td {
    padding: 10px 12px;
  }
}

/* ---------- Print: black on white, no contents ---------- */

@media print {
  body {
    background: #fff;
    color: #000;
  }

  header,
  .doc-toc,
  .doc-footer {
    display: none;
  }

  .doc-main {
    display: block;
    padding: 0;
  }

  .doc,
  .doc h2,
  .doc h3,
  .doc b,
  .doc strong,
  .doc dt,
  .doc td:first-child,
  .doc blockquote,
  .doc-lead,
  .doc-meta {
    color: #000;
  }

  .doc a {
    color: #000;
  }

  .doc-note,
  .form-sheet,
  .purpose,
  .contacts,
  .doc blockquote {
    background: none;
    border-color: #999;
    color: #000;
  }
}
