/*
 * The palette is derived from `public/symbol.svg`, the pixel-art sarué face.
 * The symbol uses exactly five colours, and three of them are used here
 * unchanged: black #000, tan #ad8653, white #fff, peach #ffc2a8, grey #afafaf.
 *
 * Two derivations were forced by measured contrast rather than taste:
 *
 * - `--accent` is the peach hue darkened to #8f4a26 (6.34:1 on the page), because
 *   the icon's own tan reaches only 3.19:1 and cannot carry link text.
 * - the peach button ground is only 1.49:1 against the page, so the primary
 *   button takes a border in `--accent` to keep its boundary identifiable.
 *
 * The greys are neutral, following the icon, and the warmth lives entirely in
 * the peach and tan accents — the same proportion the animal has.
 *
 * The typeface is Atkinson Hyperlegible Next, commissioned by the Braille
 * Institute and drawn so that similar characters cannot be confused. It is
 * self-hosted from this domain — no third party is contacted to render a page.
 */

/*
 * Self-hosted, latin subset only, copied out of its Fontsource package by
 * `scripts/build.mjs`. SIL Open Font License 1.1; the text ships at
 * /licenses/atkinson-hyperlegible-next-OFL.txt and the footer links to it.
 */
@font-face {
  font-family: 'Atkinson Hyperlegible Next Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #fafafa;
  --surface: #ffffff;
  --ink: #0f0f0f;
  --ink-soft: #575757;
  --line: #e2e2e2;
  --gray: #afafaf;
  --gray-light: #d7d7d7;
  --peach: #ffc2a8;
  --peach-soft: #fff0e9;
  --tan: #ad8653;
  --accent: #8f4a26;
  --radius: 12px;
  --measure: 62rem;
  --font-body:
    'Atkinson Hyperlegible Next Variable', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121212;
    --surface: #1b1b1b;
    --ink: #f2f2f2;
    --ink-soft: #a6a6a6;
    --line: #2d2d2d;
    --gray: #8f8f8f;
    --gray-light: #3a3a3a;
    --peach: #ffc2a8;
    --peach-soft: #2e211c;
    --tan: #c99a67;
    /* On a dark ground the icon's own peach already reaches 12.07:1. */
    --accent: #ffc2a8;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--font-body);
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Off-screen for sighted readers, still in the accessible name and still
   reachable by a screen reader's own cursor. */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  position: static;
  display: inline-block;
  margin: 0.5rem;
  padding: 0.5rem 0.75rem;
  /* Peach is light in both themes, so this text is dark in both. Using --ink
     here rendered #f2f2f2 on #ffc2a8 in dark mode: 1.39:1. */
  background: var(--peach);
  color: #0f0f0f;
  outline: 2px solid var(--ink);
}

/* Masthead --------------------------------------------------------------- */

.masthead,
main,
.footer {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* The symbol is authored on a 16px grid; 2rem is an exact 2x, so the pixel
   edges stay sharp. */
.mark {
  width: 2rem;
  height: 2rem;
}

.lang {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-decoration: none;
}

.lang:hover {
  border-color: var(--tan);
  color: var(--ink);
}

/* Hero -------------------------------------------------------------------- */

.hero {
  padding: clamp(3rem, 10vw, 6rem) 0 clamp(2rem, 6vw, 3.5rem);
}

/*
 * A greeting, not a label. The uppercase, wide-tracked treatment this slot used
 * to carry suited a descriptor — "organização de ferramentas digitais" — and
 * turned "buenas vivente?" into shouting, so it is set in its own case at
 * something closer to reading size.
 */
.hero__greeting {
  margin: 0 0 0.7rem;
  color: var(--accent);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.hero__title {
  max-width: 30ch;
  margin: 0;
  font-size: clamp(2rem, 6.5vw, 3.6rem);
  font-weight: 680;
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-wrap: balance;
}

.hero__lead {
  max-width: 58ch;
  margin: 1.5rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.6vw, 1.12rem);
}

/* Sections ---------------------------------------------------------------- */

section + section {
  padding-top: clamp(2.5rem, 7vw, 4.5rem);
}

.section__title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section__title::after {
  flex: 1;
  height: 1px;
  background: var(--line);
  content: '';
}

.section__intro {
  max-width: 52ch;
  margin: 0 0 1.5rem;
  color: var(--ink-soft);
}

/* Branches ---------------------------------------------------------------- */

.branches__grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}

.branch {
  padding: 1.25rem 1.25rem 1.4rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tan);
  border-radius: var(--radius);
  background: var(--surface);
}

.branch h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.branch p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* App grid ---------------------------------------------------------------- */

.grid {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 160ms ease;
}

.card:hover {
  border-color: var(--tan);
}

/* An app's logo keeps its own brand colours, so it is never re-tinted by the
   theme. Rounded to match the square badges the apps themselves use. */
.app-icon {
  flex: none;
  border-radius: 22%;
}

.card__name {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.card__tagline {
  margin: 0 0 1rem;
  color: var(--ink-soft);
}

.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: auto 0 0;
  padding-top: 1rem;
}

/* Traits ------------------------------------------------------------------ */

.traits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.25rem;
  padding: 0;
  list-style: none;
}

.traits li {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--peach-soft);
  color: var(--accent);
  border: 1px solid var(--peach);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Buttons ----------------------------------------------------------------- */

.button {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.button:hover {
  border-color: var(--gray);
}

.button--primary {
  /* The border carries the 3:1 boundary the peach ground cannot. */
  border-color: var(--accent);
  background: var(--peach);
  color: #0f0f0f;
}

.button--primary:hover {
  background: var(--accent);
  color: var(--peach-soft);
}

.button--wide {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
}

/* Principles -------------------------------------------------------------- */

.principles__list {
  max-width: 60ch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.principles__list li {
  position: relative;
  padding: 0.55rem 0 0.55rem 1.6rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}

.principles__list li::before {
  position: absolute;
  top: 1.15rem;
  left: 0.15rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--tan);
  content: '';
}

/* Detail page ------------------------------------------------------------- */

.crumbs {
  padding-top: 2rem;
  font-size: 0.9rem;
}

.detail__head {
  padding: 1.5rem 0 2rem;
  border-bottom: 1px solid var(--line);
  grid-column: 1 / -1;
}

.detail__name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.5rem;
  font-size: clamp(1.9rem, 5.5vw, 2.75rem);
  font-weight: 680;
  letter-spacing: -0.03em;
}

.detail__tagline {
  max-width: 46ch;
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: clamp(1.02rem, 2vw, 1.2rem);
}

.detail {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-bottom: 3rem;
  grid-template-columns: 1fr;
}

@media (min-width: 52rem) {
  .detail {
    grid-template-columns: minmax(0, 1fr) 17rem;
  }
}

.detail__body p {
  max-width: 62ch;
  color: var(--ink-soft);
}

.detail__body .section__title {
  margin-top: 2rem;
}

.highlights {
  max-width: 60ch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.highlights li {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.6rem;
  color: var(--ink-soft);
}

.highlights li::before {
  position: absolute;
  top: 1.05rem;
  left: 0.15rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--tan);
  content: '';
}

.detail__aside {
  align-self: start;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.detail__meta {
  margin: 0.75rem 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

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

.footer {
  margin-top: clamp(3rem, 8vw, 5rem);
  padding-block: 2rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.footer p {
  margin: 0;
}

.footer p + p {
  margin-top: 0.4rem;
}

.footer__credit {
  max-width: 44ch;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

/* Terms page -------------------------------------------------------------- */

.terms {
  max-width: 44rem;
  padding-bottom: 3rem;
}

.terms__head {
  padding: 1.5rem 0 1.75rem;
  border-bottom: 1px solid var(--line);
}

.terms__updated {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.terms__body {
  padding-top: 1.5rem;
}

.terms__body h2 {
  margin: 2rem 0 0.5rem;
  font-size: 1.02rem;
}

.terms__body p {
  color: var(--ink-soft);
}

.terms__body code {
  padding: 0.05rem 0.3rem;
  border-radius: 5px;
  background: var(--surface);
  font-size: 0.92em;
}

/* The liability section is the one a reader most needs to notice. */
.terms__emphasis {
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--tan);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
}

/* Global: focus and motion ------------------------------------------------ */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The accent equals the peach in dark mode, which left this ring invisible on
   the one control painted peach. --ink reads against the gap in both themes. */
.button--primary:focus-visible {
  outline-color: var(--ink);
}

/* Focus must stay visible on the skip target even though it is not a control. */
main:focus {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}
