/*
 * Links site of Todos a Bordo (allaboardgame.web.app). Hand-written, no build.
 * Colours, fonts and sizes copied from shared/lib/src/theme/ (tokens.dart and
 * typography.dart). Keep them in sync when the theme changes.
 */

@font-face {
  font-family: "Baloo 2";
  src: url("../fonts/Baloo2-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("../fonts/Nunito-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("../fonts/Nunito-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  /* TabColors */
  --navy: #0e2a47;
  --navy-soft: #1c3550;
  --sand: #fff6e5;
  --sky: #9fd6fa;
  --sky-light: #e3f4ff;
  --sea: #1f6fc0;
  --action: #f07a2a;
  --action-light: #ffa25a;
  --action-edge: #b5531a;
  --card: #ffffff;
  --card-border: #f0dfc0;
  --secondary-shade: #f3ebdd;
  --placeholder-border: #788ca0;
  --text-muted: #3a4b57;
  --answer-correct: #1b5e2c;
  --danger: #a4221b;

  /* TabSpace */
  --xs: 4px;
  --sm: 8px;
  --md: 12px;
  --lg: 16px;
  --xl: 24px;
  --xxl: 32px;
  --xxxl: 48px;

  /* TabRadius, TabEdge */
  --radius-small: 12px;
  --radius-card: 24px;
  --radius-pill: 999px;
  --border: 2px;
  --depth: 6px;
  --press-travel: 4px;
  --focus: 3px;

  /* minTouchTarget */
  --touch: 44px;

  --display: "Baloo 2", system-ui, sans-serif;
  --body: "Nunito", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.45;
  color: var(--navy);
  background-color: var(--sand);
  /* TabGradients.skyBackground */
  background-image: linear-gradient(
    to bottom,
    var(--sky) 0%,
    var(--sky-light) 38%,
    var(--sand) 70%
  );
  background-attachment: fixed;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--xxl) var(--lg) var(--xxxl);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--xl);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--md);
}

.brand img {
  width: 96px;
  height: 96px;
  border-radius: 22px; /* TabRadius.avatarFactor x 96 */
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 38px; /* TabText.screenTitle */
  line-height: 1.05;
  color: var(--navy);
}

.card {
  width: 100%;
  background: var(--card);
  border: var(--border) solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: 0 var(--depth) 0 var(--card-border);
  padding: var(--xl) var(--lg);
  display: flex;
  flex-direction: column;
  gap: var(--lg);
}

.lead {
  margin: 0;
  font-size: 22px; /* TabText.bodyLarge */
  line-height: 1.45;
}

.muted {
  margin: 0;
  font-size: 16px; /* TabText.bodyMuted */
  line-height: 1.4;
  color: var(--text-muted);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: var(--md);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  min-width: var(--touch);
  padding: var(--md) var(--xl);
  border-radius: var(--radius-pill);
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border: var(--border) solid transparent;
  transition: transform 80ms ease, box-shadow 80ms ease; /* TabMotion.press */
}

.button:active {
  transform: translateY(var(--press-travel));
}

/* Primary: navy on the action gradient (5.22:1 in the worst case). */
.button-primary {
  color: var(--navy);
  background: linear-gradient(to bottom, var(--action-light), var(--action));
  box-shadow: 0 var(--depth) 0 var(--action-edge);
}

.button-primary:active {
  box-shadow: 0 calc(var(--depth) - var(--press-travel)) 0 var(--action-edge);
}

/* Secondary: navy on white / cream. */
.button-secondary {
  color: var(--navy);
  background: linear-gradient(to bottom, var(--card), var(--secondary-shade));
  border-color: var(--card-border);
  box-shadow: 0 var(--depth) 0 var(--card-border);
}

.button-secondary:active {
  box-shadow: 0 calc(var(--depth) - var(--press-travel)) 0 var(--card-border);
}

.button-small {
  font-size: 18px;
  padding: var(--sm) var(--lg);
  flex: none;
}

.button:focus-visible,
.link-field:focus-visible {
  outline: var(--focus) solid var(--sea);
  outline-offset: 3px;
}

.paste {
  border-top: var(--border) solid var(--card-border);
  padding-top: var(--lg);
  display: flex;
  flex-direction: column;
  gap: var(--sm);
  text-align: left;
}

.paste p {
  margin: 0;
}

.copy-row {
  display: flex;
  gap: var(--sm);
  align-items: stretch;
}

.link-field {
  flex: 1;
  min-width: 0;
  min-height: var(--touch);
  padding: var(--sm) var(--md);
  font-family: var(--body);
  font-size: 16px;
  color: var(--navy);
  background: var(--sand);
  border: var(--border) solid var(--placeholder-border);
  border-radius: var(--radius-small);
  line-height: 1.4;
  resize: none;
  overflow: hidden;
  word-break: break-all;
}

.status {
  min-height: 1.4em;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--answer-correct);
}

.status.error {
  color: var(--danger);
}

/* Home page: the web version, a small text link under the store buttons, on
   purpose much quieter than them. Muted text on white (9.0:1), 44 px tall.
   The arrow is decoration, hidden from screen readers. */
.web-play {
  align-self: center;
  display: inline-block;
  min-height: var(--touch);
  line-height: var(--touch);
  margin-top: calc(-1 * var(--sm));
  padding: 0 var(--sm);
  font-size: 16px; /* TabText.bodyMuted */
  font-weight: 700;
  color: var(--text-muted);
  text-underline-offset: 3px;
}

/* inline-block: the underline of the text does not reach the arrow. */
.web-play::after {
  display: inline-block;
  margin-left: var(--xs);
  content: "\2192";
  content: "\2192" / "";
}

.web-play:focus-visible {
  outline: var(--focus) solid var(--sea);
  outline-offset: 3px;
  border-radius: var(--radius-small);
}

footer {
  font-size: 14px;
  color: var(--text-muted);
}

footer a {
  color: var(--navy);
}

/* Legal pages (privacy policy and terms of use in pt, en, fr, es and de),
   generated by tool/build_legal_pages.py: long text, left aligned, wider. */
main.legal {
  max-width: 820px;
  align-items: stretch;
  text-align: left;
  gap: var(--lg);
}

.legal-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--md);
  flex-wrap: wrap;
}

.legal-nav a,
.legal-text a,
footer a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  color: var(--navy);
  font-weight: 700;
}

.legal-text a {
  display: inline;
  min-height: 0;
  color: var(--sea);
  overflow-wrap: anywhere;
}

.legal-nav a:focus-visible,
.legal-text a:focus-visible,
footer a:focus-visible {
  outline: var(--focus) solid var(--sea);
  outline-offset: 3px;
}

/* Language switcher: the five languages, the current one in a pill. */
.legal-langs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.legal-langs a {
  padding: 0 var(--sm);
  border: var(--border) solid transparent;
  border-radius: var(--radius-pill);
}

.legal-langs a[aria-current="page"] {
  text-decoration: none;
  background: var(--card);
  border-color: var(--card-border);
}

.legal-home {
  gap: var(--sm);
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  text-decoration: none;
}

.legal-home img {
  width: 40px;
  height: 40px;
  border-radius: 9px; /* TabRadius.avatarFactor x 40 */
}

.legal-text {
  gap: var(--md);
  padding: var(--xl);
}

.legal-text h1 {
  font-size: 32px;
}

.legal-text h2,
.legal-text h3 {
  margin: var(--lg) 0 0;
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.15;
  color: var(--navy);
}

.legal-text h2 {
  font-size: 26px;
}

.legal-text h3 {
  font-size: 21px;
}

.legal-text p,
.legal-text ul {
  margin: 0;
}

.legal-text ul {
  padding-left: var(--xl);
}

.legal-text li + li {
  margin-top: var(--sm);
}

.legal-text .note {
  padding: var(--md) var(--lg);
  background: var(--sand);
  border: var(--border) solid var(--card-border);
  border-radius: var(--radius-small);
}

.table-wrap {
  overflow-x: auto;
}

.legal-text table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.4;
}

.legal-text th,
.legal-text td {
  padding: var(--sm) var(--md);
  border: 1px solid var(--card-border);
  vertical-align: top;
  text-align: left;
}

.legal-text th {
  background: var(--secondary-shade);
}

main.legal footer {
  text-align: center;
}

/* Support page (/suporte): contact and short answers, left aligned. */
main.support {
  max-width: 680px;
  align-items: stretch;
  text-align: left;
  gap: var(--lg);
}

.support h1 {
  font-size: 32px;
}

.support h2,
.support h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.15;
  color: var(--navy);
}

.support h2 {
  font-size: 26px;
}

.support h3 {
  font-size: 21px;
}

.support .card p {
  margin: 0;
}

.support .support-subtitle {
  margin-top: var(--sm);
}

.faq-item {
  display: flex;
  flex-direction: column;
  gap: var(--xs);
}

.faq-item + .faq-item {
  border-top: var(--border) solid var(--card-border);
  padding-top: var(--lg);
}

/* The address itself is the link: sea on white (5.1:1), 44 px tall. */
.support-mail {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  font-size: 20px;
  font-weight: 700;
  color: var(--sea);
  overflow-wrap: anywhere;
}

.support-mail:focus-visible {
  outline: var(--focus) solid var(--sea);
  outline-offset: 3px;
}

main.support footer {
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 380px) {
  h1 {
    font-size: 32px;
  }
  .legal-text {
    padding: var(--lg);
  }
  .copy-row {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }
  .button:active {
    transform: none;
  }
}
