/* Rupa legal + support pages. Design system v2 "Sachet" (design/rupa/system/DESIGN.md, tokens.css).
   Light = manteiga ground, creme cards, cacau ink. Dark = noite grounds, creme ink. Follows the system theme.
   Every text pair is from DESIGN.md §6 (AA): cacau on manteiga 13.24, cacau-claro on manteiga 6.34 / creme 7.01,
   caramelo-tinta on manteiga 5.42 / creme 5.99; dark: creme on noite 18.09, manteiga-fosca on noite 11.54,
   caramelo-claro on noite 7.96 / noite-2 7.08. Manga is used for strokes and fills only (never small text).
   Type: Anybody (headings), Instrument Sans (text), Be Vietnam Pro for Vietnamese text (Instrument Sans has no vi).
   Fonts from Google Fonts only; no scripts, no other external resources. Sizes in rem so text scales. */

:root {
  color-scheme: light dark;
  --bg:      #fdefb6;  /* manteiga */
  --card:    #fffae8;  /* creme */
  --raised:  #f9e093;  /* manteiga-2 (non-text) */
  --ink:     #391f13;  /* cacau */
  --ink-2:   #774c33;  /* cacau-claro */
  --link:    #934e1e;  /* caramelo-tinta */
  --signal:  #f9b73f;  /* manga: strokes, focus, current page */
  --perf:    #774c33;  /* cacau-claro perforation */
  --font-display: "Anybody", ui-sans-serif, system-ui, sans-serif;
  --font-text: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-text-vi: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:     #1a0f09;  /* noite */
    --card:   #291a12;  /* noite-2 */
    --raised: #3e2c22;  /* noite-3 */
    --ink:    #fffae8;  /* creme */
    --ink-2:  #dac9a6;  /* manteiga-fosca */
    --link:   #e19956;  /* caramelo-claro */
    --signal: #f9b73f;  /* manga */
    --perf:   #dac9a6;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: break-word;
}
:lang(vi) { font-family: var(--font-text-vi); }

.skip { position: absolute; left: -999px; top: 0; padding: 0.5rem 1rem; background: var(--signal); color: #391f13; font-weight: 600; }
.skip:focus { left: 1rem; top: 1rem; z-index: 2; }
.wrap { max-width: 42rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

/* Header with a crimped (zigzag) bottom edge, like the top of a sachet. */
header.site {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.25rem 1.5rem; padding-bottom: 1.1rem;
}
header.site::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
  background:
    linear-gradient(135deg, transparent 50%, var(--raised) 50%) 0 0 / 12px 6px repeat-x,
    linear-gradient(225deg, transparent 50%, var(--raised) 50%) 0 0 / 12px 6px repeat-x;
}

.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-display); font-weight: 860; font-stretch: 130%;
  font-variation-settings: "wdth" 130; font-size: 1.5rem; letter-spacing: -0.03em; line-height: 1;
  color: var(--ink); text-decoration: none;
}
/* Mini sachet mark: manga pouch with crimped top and bottom edges. */
.sachet {
  display: inline-block; width: 1.05rem; height: 1.35rem; background: var(--signal); border-radius: 2px;
  -webkit-mask:
    linear-gradient(#000 0 0) center / 100% calc(100% - 6px) no-repeat,
    conic-gradient(from 135deg at 50% 0, #000 90deg, transparent 0) 0 0 / 5.5px 3px repeat-x,
    conic-gradient(from -45deg at 50% 100%, #000 90deg, transparent 0) 0 100% / 5.5px 3px repeat-x;
          mask:
    linear-gradient(#000 0 0) center / 100% calc(100% - 6px) no-repeat,
    conic-gradient(from 135deg at 50% 0, #000 90deg, transparent 0) 0 0 / 5.5px 3px repeat-x,
    conic-gradient(from -45deg at 50% 100%, #000 90deg, transparent 0) 0 100% / 5.5px 3px repeat-x;
}

nav ul { display: flex; flex-wrap: wrap; gap: 0 1.1rem; margin: 0; padding: 0; list-style: none; }
nav a {
  display: inline-flex; align-items: center; min-height: 2.45rem; /* >= 44 px targets */
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
nav a:hover { color: var(--ink); }
nav a[aria-current] {
  color: var(--ink); font-weight: 600; text-decoration: underline;
  text-decoration-color: var(--signal); text-decoration-thickness: 4px; text-underline-offset: 0.35em;
}
nav.lang { margin-top: 0.4rem; }
nav.lang a { font-size: 0.85rem; }

main { padding-top: 1rem; }

h1, h2, h3 { font-family: var(--font-display); color: var(--ink); letter-spacing: -0.02em; }
h1 {
  font-size: 2.1rem; font-weight: 860; font-stretch: 80%; font-variation-settings: "wdth" 80;
  line-height: 0.98; letter-spacing: -0.03em; margin: 0.75rem 0 0.5rem;
}
h2 {
  font-size: 1.3rem; font-weight: 800; font-stretch: 90%; font-variation-settings: "wdth" 90;
  line-height: 1.15; margin: 2.25rem 0 0.5rem;
}
h3 {
  font-size: 1.05rem; font-weight: 760; font-stretch: 100%; font-variation-settings: "wdth" 100;
  line-height: 1.25; margin: 1.6rem 0 0.35rem;
}
/* Vietnamese stacked marks need a taller display line (DESIGN.md §7: >= 1.04). */
:lang(vi) h1 { line-height: 1.1; }
:lang(vi) h2, :lang(vi) h3 { line-height: 1.3; }

p, ul, ol, table { margin: 0 0 1rem; }
li { margin-bottom: 0.4rem; }
li::marker { color: var(--ink-2); }
.meta { color: var(--ink-2); font-weight: 500; margin-bottom: 1.5rem; }
.lead { font-size: 1.1rem; }
strong { font-weight: 600; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: 3px; }

/* Summary note = a sachet card: creme, crimped top, perforated bottom. */
.note {
  position: relative; background: var(--card); border-radius: 6px;
  padding: 1.3rem 1.25rem 1.3rem; margin: 1.5rem 0;
}
.note::before {
  content: ""; position: absolute; left: 0; right: 0; top: -6px; height: 6px;
  background: conic-gradient(from 135deg at 50% 100%, var(--card) 90deg, transparent 0) 0 0 / 12px 6px repeat-x;
}
.note::after {
  content: ""; position: absolute; left: 1rem; right: 1rem; bottom: 0.45rem; height: 3px;
  background: radial-gradient(circle, var(--perf) 1.4px, transparent 1.6px) 0 50% / 8px 3px repeat-x; opacity: 0.55;
}
.note > :last-child { margin-bottom: 0; }

.table { overflow-x: auto; background: var(--card); border-radius: 6px; padding: 0.25rem 0.5rem; margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; margin: 0; }
th, td { text-align: left; vertical-align: top; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--raised); }
tr:last-child td { border-bottom: 0; }
th { color: var(--ink-2); font-weight: 600; }

.cards { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: 1.1rem; }
.cards li { margin: 0; }
.cards a {
  position: relative; display: block; background: var(--card); border-radius: 6px;
  padding: 1rem 1.25rem 1.05rem; text-decoration: none; color: var(--ink);
  border-left: 6px solid var(--signal);
}
.cards a::before {
  content: ""; position: absolute; left: -6px; right: 0; top: -6px; height: 6px;
  background: conic-gradient(from 135deg at 50% 100%, var(--card) 90deg, transparent 0) 0 0 / 12px 6px repeat-x;
}
.cards a:hover { background: color-mix(in oklab, var(--card) 80%, var(--raised)); }
.cards .t {
  display: block; font-family: var(--font-display); font-size: 1.2rem; font-weight: 800;
  font-stretch: 95%; font-variation-settings: "wdth" 95; letter-spacing: -0.02em; line-height: 1.2;
}
.cards .d { display: block; margin-top: 0.25rem; font-size: 0.95rem; color: var(--ink-2); }

footer.site { margin-top: 3rem; padding-top: 1rem; color: var(--ink-2); font-size: 0.9rem; position: relative; }
footer.site::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: radial-gradient(circle, var(--perf) 1.4px, transparent 1.6px) 0 50% / 8px 3px repeat-x; opacity: 0.55;
}
footer.site a { color: var(--ink-2); }

@media (prefers-reduced-motion: no-preference) { a, .cards a { transition: background-color 0.2s, color 0.2s; } }
