/* Sistema de desenho partilhado pelo site (Astro) e pelas páginas do servidor (Jinja). */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
    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;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/assets/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range:
        U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F,
        U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Instrument Serif";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("/assets/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
    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+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Instrument Serif";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("/assets/fonts/instrument-serif-latin-ext-400-italic.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+1E00-1E9F, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --ink: #0b1220;
    --ink-2: #3a4356;
    --muted: #5b6472;
    --faint: #aab2c0;
    --line: #e5eaf1;
    --surface: #f6f7f9;
    --paper: #fff;
    --night: #04112e;
    --royal: #0a4bb5;
    --sky: #17b1f3;
    --sun: #f2a83b;
    --ok: #17803d;
    --bad: #b42318;
    --radius-s: 12px;
    --radius: 20px;
    --radius-l: 28px;
    --shadow: 0 1px 2px rgb(11 18 32 / 0.04), 0 10px 28px -4px rgb(11 18 32 / 0.08);
    --shadow-l: 0 18px 40px rgb(11 26 58 / 0.18);
    --wrap: 1200px;
    --gutter: clamp(1.25rem, 5vw, 3.5rem);
    --sans: "Inter", ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
    --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
    --serif-text: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    color-scheme: light;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}
html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 1rem/1.6 var(--sans);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
}
img,
svg {
    display: block;
    max-width: 100%;
}
a {
    color: inherit;
    text-underline-offset: 0.18em;
}
h1,
h2,
h3 {
    margin: 0;
    line-height: 1.12;
    letter-spacing: -0.028em;
    font-weight: 560;
    text-wrap: balance;
}
h1 {
    font-size: clamp(2.35rem, 5.2vw, 3.6rem);
}
h2 {
    font-size: clamp(1.85rem, 3.6vw, 2.6rem);
}
h3 {
    font-size: 1.125rem;
    letter-spacing: -0.015em;
}
p {
    margin: 0;
    text-wrap: pretty;
}
em.serif {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.12em;
    letter-spacing: -0.01em;
}
:focus-visible {
    outline: 3px solid var(--sky);
    outline-offset: 3px;
    border-radius: 6px;
}
::selection {
    background: rgb(23 177 243 / 0.28);
}
.wrap {
    width: min(100%, var(--wrap) + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: var(--gutter);
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.skip {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 100;
    background: var(--paper);
    color: var(--ink);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-s);
    box-shadow: var(--shadow-l);
}
.skip:focus {
    top: 1rem;
}

/* ── botões ─────────────────────────────────────────────── */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.9rem;
    padding: 0.65rem 1.35rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font: 560 0.95rem/1.2 var(--sans);
    text-decoration: none;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}
.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px -8px rgb(11 18 32 / 0.45);
}
.button:active {
    transform: translateY(0);
    box-shadow: none;
}
.button.light {
    background: #fff;
    color: var(--ink);
}
.button.quiet {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line);
}
.button.quiet:hover {
    background: #eef1f5;
    box-shadow: none;
}
.button.glass {
    background: rgb(255 255 255 / 0.12);
    color: #fff;
    border-color: rgb(255 255 255 / 0.28);
    backdrop-filter: blur(10px);
}
.button.small {
    min-height: 2.35rem;
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
}
.button.wide {
    width: 100%;
}

/* ── cabeçalho e rodapé ─────────────────────────────────── */
.nav {
    position: fixed;
    inset: 0 0 auto;
    z-index: 50;
    border-bottom: 1px solid transparent;
    transition:
        background-color 0.25s,
        border-color 0.25s,
        color 0.25s;
    color: var(--ink);
}
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 4.5rem;
}
.nav nav {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2.2vw, 1.9rem);
    font-size: 0.9rem;
    font-weight: 500;
}
.nav nav a:not(.button) {
    text-decoration: none;
    opacity: 0.86;
}
.nav nav a:not(.button):hover,
.nav nav a[aria-current="page"] {
    opacity: 1;
    text-decoration: underline;
}
.nav.on-sky {
    color: #fff;
}
.nav.on-sky .button {
    background: #fff;
    color: var(--ink);
}
.nav.solid,
.nav:not(.on-sky) {
    background: rgb(255 255 255 / 0.82);
    backdrop-filter: saturate(1.6) blur(16px);
    border-color: var(--line);
    color: var(--ink);
}
.nav.solid .button {
    background: var(--ink);
    color: #fff;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 640;
    font-size: 1.15rem;
    letter-spacing: -0.025em;
    text-decoration: none;
}
.brand img {
    width: 2rem;
    height: 2rem;
}
@media (max-width: 46rem) {
    .nav nav a.wide-only {
        display: none;
    }
}

.footer {
    border-top: 1px solid var(--line);
    padding-block: 3rem 3.5rem;
    color: var(--muted);
    font-size: 0.875rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr repeat(3, 1fr);
    gap: 2rem;
}
.footer h2 {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--ink);
    margin-bottom: 0.75rem;
}
.footer ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}
.footer a {
    text-decoration: none;
}
.footer a:hover {
    color: var(--ink);
    text-decoration: underline;
}
.footer .brand {
    color: var(--ink);
    margin-bottom: 0.85rem;
}
.footer-note {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    font-size: 0.8125rem;
}
@media (max-width: 52rem) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
    .footer-grid > :first-child {
        grid-column: 1 / -1;
    }
}

/* ── texto corrido (legais, guias) ──────────────────────── */
.page-head {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 9rem 0 8.5rem;
    color: #fff;
    background: var(--night);
}
.page-head::after {
    content: "";
    position: absolute;
    inset: auto 0 -1px;
    height: 5.5rem;
    z-index: -1;
    background: linear-gradient(
        to top,
        var(--paper) 0,
        var(--paper) 6%,
        rgb(255 255 255 / 0.6) 38%,
        rgb(255 255 255 / 0.18) 70%,
        transparent
    );
}
/* véu escuro por trás do texto, para o contraste não depender das nuvens */
.page-head::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        rgb(4 17 46 / 0.72) 0%,
        rgb(4 17 46 / 0.58) 55%,
        rgb(4 17 46 / 0.28) 78%,
        transparent 92%
    );
}
.page-sky {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 42%;
}
.page-head h1 {
    text-shadow: 0 1px 24px rgb(4 17 46 / 0.35);
}
.page-head p {
    max-width: 40rem;
    margin-top: 1rem;
    color: rgb(255 255 255 / 0.9);
    font-size: 1.1rem;
    text-shadow: 0 1px 12px rgb(4 17 46 / 0.55);
}
.page-head .button {
    text-shadow: none;
}
.page-head .button:not(.quiet) {
    background: #fff;
    color: var(--ink);
}
.prose {
    max-width: 46rem;
    padding-block: 3rem 5rem;
}
.prose h2 {
    font-size: 1.4rem;
    margin: 2.5rem 0 0.8rem;
}
.prose h3 {
    margin: 1.5rem 0 0.4rem;
}
.prose p,
.prose ul,
.prose ol,
.prose dl {
    margin: 0 0 1rem;
    color: var(--ink-2);
}
.prose li {
    margin-bottom: 0.4rem;
}
.prose dt {
    font-weight: 600;
    color: var(--ink);
}
.prose dd {
    margin: 0 0 0.9rem;
}
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.5rem;
    font-size: 0.925rem;
}
.prose th,
.prose td {
    text-align: left;
    vertical-align: top;
    padding: 0.65rem 0.75rem 0.65rem 0;
    border-bottom: 1px solid var(--line);
}

/* ── formulários (páginas do servidor) ──────────────────── */
.form-shell {
    min-height: 100vh;
    padding: 7rem 1.25rem 4rem;
    background:
        radial-gradient(130% 80% at 50% -10%, rgb(23 177 243 / 0.2), transparent 60%),
        var(--surface);
}
.form-page {
    max-width: 34rem;
    margin: 0 auto;
    padding: clamp(1.4rem, 5vw, 2.4rem);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow);
}
.form-page h1 {
    font-size: 1.75rem;
    margin-bottom: 0.9rem;
}
.form-page > p,
.form-page form > p {
    margin: 0 0 1rem;
}
.form-page form + form {
    margin-top: 0.75rem;
}
.form-page label {
    display: block;
    margin-bottom: 0.95rem;
    font-size: 0.9rem;
    font-weight: 540;
    color: var(--ink-2);
}
.form-page input:not([type="checkbox"], [type="hidden"]),
.form-page select {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    min-height: 2.85rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid #cfd6e0;
    border-radius: var(--radius-s);
    background: var(--paper);
    color: var(--ink);
    font: 400 1rem var(--sans);
}
.form-page input:focus-visible,
.form-page select:focus-visible {
    outline: 3px solid rgb(23 177 243 / 0.45);
    outline-offset: 0;
    border-color: var(--royal);
}
.form-page fieldset {
    margin: 0 0 1.25rem;
    padding: 1.1rem 1.1rem 0.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.form-page legend {
    padding: 0 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}
.form-page label.check {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    font-weight: 400;
}
.form-page label.check input {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0.2rem 0 0;
    accent-color: var(--royal);
    flex: none;
}
.form-page .button {
    width: 100%;
}
.form-page .notice {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-s);
    background: #eef6ff;
    color: #123a73;
    font-size: 0.925rem;
}
.form-page .errors {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-s);
    background: #fef3f2;
    color: var(--bad);
    font-size: 0.925rem;
}
.form-page ul.errors {
    list-style: none;
    margin: 0 0 1rem;
}
.form-page .success {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-s);
    background: #ecfdf3;
    color: var(--ok);
}
.form-page .hint {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 400;
}
.form-page .granted {
    margin: 0 0 0.6rem;
    padding-left: 1.75rem;
    position: relative;
    font-size: 0.925rem;
}
.form-page .granted::before {
    content: "";
    position: absolute;
    left: 0.35rem;
    top: 0.42rem;
    width: 0.4rem;
    height: 0.7rem;
    border: solid var(--ok);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.form-page .trap {
    position: absolute;
    left: -200vw;
}
.form-page .captcha {
    margin-bottom: 1.1rem;
    min-height: 3.6rem;
}
/* O rótulo da caixa não é um campo do formulário. */
.form-page altcha-widget label {
    margin: 0;
    font-weight: 400;
}
.form-page altcha-widget {
    --altcha-max-width: 100%;
    --altcha-border-radius: 12px;
    --altcha-color-border: #cfd6e0;
    display: block;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Tabelas de texto em ecrãs estreitos: cada linha vira um bloco legível. */
@media (max-width: 36rem) {
    .prose table,
    .prose tbody,
    .prose tr,
    .prose td {
        display: block;
        width: 100%;
    }
    .prose thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
    .prose tr {
        padding: 0.85rem 0;
        border-bottom: 1px solid var(--line);
    }
    .prose td {
        padding: 0.15rem 0;
        border: 0;
    }
    .prose td:first-child {
        font-weight: 600;
        color: var(--ink);
    }
}
.prose,
.page-head h1 {
    overflow-wrap: break-word;
}
