/*
 * legacy.css: the pages that keep their client-side i18n (js/i18n.js), in the Ink & Porcelain look
 * of the landing page (plan 0005 W4): 404.html (the referral router and "not found"), contact/
 * and the three legal/ pages.
 *
 * Loaded after css/site.css. It uses that file's tokens and classes (.site-header, .wordmark,
 * .lang-switch, .card, .btn, .eyebrow, .site-footer) and adds only what these pages need:
 *
 *   1. Page frame   the plain header bar with the EN / PT buttons, main, footer columns
 *   2. Notice       the paper card for each router state and for the contact page
 *   3. Loader       the app's calendar loader, for the loading state
 *   4. Code slip    the referral code and its copy button
 *   5. Document     the legal pages
 *   6. Larger text  text large for the screen: titles, leads and the copy button keep words whole
 *
 * Colour: only site.css's palette tokens, with the page's cool neutrals (ADR 0025). WCAG 2.2
 * contrast of the text set here: ink-text on paper-brightest 16.6:1, on porcelain 15.1:1, on
 * ink-tint 13.1:1; ink-muted on paper-brightest 5.6:1, on porcelain 5.1:1; sage on porcelain
 * 6.0:1, on ink-tint 5.2:1; porcelain on ink 14.9:1. Links in the running text are --link
 * (blue-ink on porcelain 6.1:1, on paper-brightest 6.7:1, on ink-tint 5.3:1, for `code`). Marks,
 * in --accent, the mark's blue (ADR 0024): the loader's booked days (on ink-tint 3.65:1) and the
 * callout rails (on paper-brightest 4.6:1; madder 5.8:1 on porcelain for the error). Hairlines
 * are decorative.
 *
 * Breakpoints as in site.css: min-width / max-width em queries, never range syntax.
 */

/* 1. Page frame ---------------------------------------------------------------------------- */
/* The footer sits at the bottom of the window on the short pages. */
.legacy {
  display: flex;
  flex-direction: column;
}

.legacy-main {
  flex: 1 0 auto;
  padding-block: clamp(2rem, 0.75rem + 4vw, 4.5rem) clamp(3.5rem, 2rem + 5vw, 7rem);
}

/* A plain bar: the wordmark, then the EN / PT buttons js/i18n.js wires
   (.lang-switcher button[data-lang]). No menu and no CTA on these pages. The negative end
   margin lines the "PT" letters up with the container edge instead of the button's. */
.legacy-lang {
  margin-inline-start: auto;
  margin-inline-end: calc(-1 * var(--space-3));
}

/* The footer's Legal and Contact columns (stacked on the narrowest phones, 7–9 and 10–12 from
   64em) come from site.css, the same as on the landing page; there is no language column here. */

/* 2. Notice: one paper card per state ------------------------------------------------------ */
/*
 *   <section class="card notice" data-…-state="…">
 *     <div class="notice__body">  [.eyebrow] h1.notice__title p.notice__lead [.code-slip]
 *     <div class="notice__foot">  [.loader] [.notice__actions (buttons)] [text link] [p.notice__note]
 *   </section>
 *
 * Phones and tablets: the foot sits under the message, behind a hairline across the card. From
 * 64em the card spans the grid like a landscape invitation card: the message on the left, the
 * next step on the right behind a vertical hairline (6 + 6 columns, 7 + 5 from 80em). The
 * loader holds the place where the buttons will appear.
 *
 * The single column is minmax(0, 1fr), never the implicit auto track: an auto track grows to the
 * longest unbreakable word, so a long referral code from the URL would push the card past the
 * screen instead of wrapping inside it.
 */
.notice {
  --notice-pad: clamp(1.25rem, 0.5rem + 3vw, 3rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  padding: 0;
}

.notice__body {
  padding: var(--notice-pad);
}

.notice__body > * + * {
  margin-top: var(--space-4);
}

.notice__body > .eyebrow + *,
.notice__body > .notice__title + * {
  margin-top: var(--space-5);
}

.notice__body > .notice__lead + .code-slip {
  margin-top: var(--space-6);
}

.notice__title {
  font-size: var(--text-h2);
  line-height: 1.06;
  letter-spacing: -0.02em;
}

.notice__lead {
  font-size: var(--text-lead);
  line-height: 1.45;
  letter-spacing: -0.006em;
}

.notice__note {
  color: var(--ink-muted);
  font-size: var(--text-small);
  line-height: 1.5;
}

.notice__foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  justify-items: start;
  gap: var(--space-4);
  padding: var(--space-5) var(--notice-pad) var(--notice-pad);
  border-top: 1px solid var(--hairline-faint);
}

.notice__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* At large text sizes a long label ("hello@rzervd.com") breaks rather than overflow. */
.notice .btn {
  overflow-wrap: anywhere;
}

.btn__icon {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
}

/* A label that can wrap on a phone ("Enviar email para / hello@rzervd.com"): the icon is set in
   the first line of text rather than in a flex column of its own, so it stays beside the words
   instead of drifting to the button's edge. */
.btn__label > .btn__icon {
  display: inline-block;
  margin-inline-end: var(--space-2);
  vertical-align: -0.1875rem;
}

/* Phones: the buttons stack at full width, the primary on top. */
@media (max-width: 39.99em) {
  .notice__foot {
    justify-items: stretch;
  }

  .notice__actions .btn:not(.btn--text) {
    flex: 1 1 100%;
  }

  .notice__foot > .btn--text,
  .notice__foot > .loader {
    justify-self: start;
  }
}

@media (min-width: 64em) {
  .notice {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .notice__foot {
    align-content: end;
    justify-items: stretch;
    padding: var(--notice-pad);
    border-top: 0;
    border-left: 1px solid var(--hairline-faint);
  }

  .notice__actions .btn:not(.btn--text) {
    flex: 1 1 100%;
  }

  .notice__foot > .btn--text,
  .notice__foot > .loader {
    justify-self: start;
  }
}

@media (min-width: 80em) {
  .notice {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }
}

/* Without JavaScript the router can't run: the loading card shows the <noscript> note instead
   of the loader. */
@media (scripting: none) {
  .notice noscript {
    display: grid;
    justify-items: start;
    gap: var(--space-4);
  }
}

/* 3. Loader -------------------------------------------------------------------------------- */
/*
 * The app's page loader (RzervdLoadingIndicator, Page size): a little calendar whose days fill
 * in out of step, on the app's loop timing (two × (480 + 120 ms), eased, back and forth).
 * Without motion it is a still calendar with three days booked.
 */
.loader {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  width: 3.5rem;
  aspect-ratio: 1;
  padding: 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--paper);
}

.loader > span {
  border-radius: var(--radius-xs);
  background: var(--ink-tint);
}

.loader > span:nth-child(2),
.loader > span:nth-child(4),
.loader > span:nth-child(9) {
  background: var(--accent);
}

@media (prefers-reduced-motion: no-preference) {
  .loader > span {
    animation: loader-day 1200ms var(--ease) infinite alternate both;
  }

  /* The app's phase scatter, so the nine days don't breathe in unison. */
  .loader > span:nth-child(2) { animation-delay: -850ms; }
  .loader > span:nth-child(3) { animation-delay: -400ms; }
  .loader > span:nth-child(4) { animation-delay: -1100ms; }
  .loader > span:nth-child(5) { animation-delay: -200ms; }
  .loader > span:nth-child(6) { animation-delay: -700ms; }
  .loader > span:nth-child(7) { animation-delay: -1000ms; }
  .loader > span:nth-child(8) { animation-delay: -300ms; }
  .loader > span:nth-child(9) { animation-delay: -600ms; }
}

@keyframes loader-day {
  from { background-color: var(--ink-tint); }
  to { background-color: var(--accent); }
}

@media (scripting: none) {
  .loader {
    display: none;
  }
}

/* 4. Code slip: the referral code ---------------------------------------------------------- */
/* A slip of the page colour set into the card: the label, the code, and the copy button, which
   drops under the code when the line is too short for both. */
.code-slip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-4) var(--space-4) var(--space-4) var(--space-5);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--porcelain);
}

.code-slip__label {
  flex: 1 1 100%;
  color: var(--ink-muted);
  font-size: var(--text-eyebrow);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.code-slip__code {
  flex: 1 1 9ch;
  min-width: 0;
  color: var(--ink-text);
  font-family: inherit;
  font-size: clamp(1.375rem, 1.15rem + 0.9vw, 1.75rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

/* "Copy" and "Copied" share one grid cell, so the button keeps its width when it swaps. */
.code-slip__copy {
  display: inline-grid;
  flex: 0 1 auto;
  min-width: 0;
}

.code-slip__copy > span {
  display: inline-flex;
  grid-area: 1 / 1;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.referral-copy-done,
.code-slip__copy.is-copied .referral-copy-idle {
  visibility: hidden;
}

.code-slip__copy.is-copied .referral-copy-done {
  visibility: visible;
}

.code-slip__copy.is-copied {
  border-color: var(--sage);
  color: var(--sage);
}

/* 5. Document: the legal pages ------------------------------------------------------------- */
/*
 *   phone:  eyebrow / title / meta / rule / body / back link
 *   desk:   eyebrow (1–3) beside the title (4–12); a rule; the meta in the margin (1–3, it
 *           stays in view) beside the body (4–10, about the 64ch measure)
 *
 * The body is the owner's versioned legal text, rendered by legal/legal.js: style it, never edit it.
 */
.doc__title {
  font-size: clamp(2.25rem, 1.25rem + 3.5vw, 4.5rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.doc__eyebrow {
  margin-bottom: var(--space-5);
}

.doc__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-7);
  margin-top: var(--space-6);
}

.doc__meta dt {
  color: var(--ink-muted);
  font-size: var(--text-eyebrow);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.doc__meta dd {
  margin-top: var(--space-1);
  font-size: var(--text-small);
  font-weight: 500;
  font-variant-numeric: lining-nums;
}

/* Until legal.js fills them (or when the document can't load), a ledger dash, not a gap. */
.doc__meta dd:empty::before {
  content: '—';
  content: '—' / ''; /* decorative where alt text for content is supported */
  color: var(--ink-muted);
}

.doc__rule {
  margin-block: var(--space-6) var(--space-7);
}

/* Until legal.js has rendered the text, hold some room so the footer doesn't flash up. */
.doc__body:empty {
  min-height: 60vh;
}

.doc__actions {
  margin-top: var(--space-8);
}

@media (min-width: 64em) {
  .doc {
    align-items: start;
  }

  .doc__eyebrow,
  .doc__title {
    grid-row: 1;
  }

  .doc__eyebrow {
    grid-column: 1 / span 3;
    align-self: baseline;
    margin-bottom: 0;
  }

  .doc__title {
    grid-column: 4 / span 9;
    align-self: baseline;
  }

  .doc__rule {
    grid-row: 2;
    margin-block: var(--space-7) var(--space-8);
  }

  .doc__meta {
    position: sticky;
    top: calc(var(--header-h) + var(--space-6));
    grid-row: 3;
    grid-column: 1 / span 3;
    flex-direction: column;
    gap: var(--space-5);
    margin-top: 0;
  }

  .doc__body {
    grid-row: 3;
    grid-column: 4 / span 7;
  }

  .doc__actions {
    grid-row: 4;
    grid-column: 4 / span 7;
  }
}

/* The legal text itself, about 75 characters a line in Nunito (64ch of its 0.6em zero is ~80). */
.doc__body {
  max-width: 36em;
  line-height: 1.6;
}

.doc__body > * + * {
  margin-top: 1em;
}

.doc__body h2 {
  max-width: var(--measure);
  margin-top: clamp(3rem, 2.25rem + 2vw, 4rem);
  padding-top: var(--space-5);
  border-top: 1px solid var(--hairline);
  font-size: var(--text-h3);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.012em;
}

.doc__body h3 {
  margin-top: var(--space-6);
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
}

.doc__body h2 + *,
.doc__body h3 + * {
  margin-top: var(--space-3);
}

.doc__body strong {
  font-weight: 600;
}

/* Only upright faces are shipped, so an <em> (a defined term, a menu path such as "Settings ›
   Manage analytics") is set in 500 instead of a slanted fake italic. */
.doc__body em {
  font-style: normal;
  font-weight: 500;
}

.doc__body a {
  text-decoration-line: underline;
}

.doc__body ul {
  padding: 0;
  list-style: none;
}

.doc__body li {
  position: relative;
  padding-left: 1.5em;
}

.doc__body li + li {
  margin-top: 0.5em;
}

.doc__body li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--ink-muted);
}

.doc__body code {
  padding: 0.0625em 0.3125em;
  border-radius: var(--radius-xs);
  background: var(--ink-tint);
  font-family: inherit;
  font-size: 0.9375em;
  white-space: nowrap;
}

/* A note inside the text (the binding-language line of the Portuguese versions) and the error
   legal.js shows when a document can't load: a blue rail, madder when it is the error. */
.doc__body .doc-placeholder {
  max-width: var(--measure);
  padding: var(--space-4) var(--space-5);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--paper-brightest);
  font-size: var(--text-small);
  line-height: 1.5;
}

.doc__body .doc-placeholder:only-child {
  border-left-color: var(--madder);
}

.doc__body .doc-placeholder + * {
  margin-top: var(--space-6);
}

/* 6. Larger text --------------------------------------------------------------------------- */
/*
 * site.css's "text large for the screen" query (README, Larger text): em follows the text size,
 * so 19.4em matches only where the text is large for the screen (310 / 388 / 466 px wide at
 * 16 / 20 / 24 px text), never at the default size on a 320 px phone.
 *
 * - The titles follow the screen, not the text size, as the landing page's headings do, so the
 *   longest word stays whole: a notice title at most 11vw (the landing h1's cap) keeps
 *   "encontrado" in a 320 px card at 24 px text, down to 257 px; a document title at most 15vw
 *   keeps "Privacidade" on its line down to 240 px.
 * - The lead hyphenates rather than leave its full stop alone on a line ("responderemos / .").
 * - The referral copy button drops its icon and some padding, so "Copiado" fits whole instead of
 *   breaking inside the word; the label carries the meaning (the icon is aria-hidden).
 */
@media (max-width: 19.4em) {
  .notice__title {
    font-size: min(var(--text-h2), 11vw);
  }

  .doc__title {
    font-size: min(clamp(2.25rem, 1.25rem + 3.5vw, 4.5rem), 15vw);
  }

  .notice__lead {
    -webkit-hyphens: auto;
    hyphens: auto;
    hyphenate-limit-chars: 8 3 3;
  }

  .code-slip__copy {
    padding-inline: var(--space-3);
  }

  .code-slip__copy .btn__icon {
    display: none;
  }
}
