/* Base styles for the design shell — docs/design-guidelines.md.
   Tokens live in tokens.css. Radius 0 everywhere, copy flush left. */

/* --- Reset ------------------------------------------------------------- */

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

img,
svg,
video {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
    border-radius: 0;
}

/* --- Base -------------------------------------------------------------- */

body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.55;
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    font-weight: var(--weight-black);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

/* Page title per the type scale */
h1 {
    font-size: clamp(32px, 3.6vw, 50px);
    text-transform: uppercase;
}

/* FocusOnNavigate moves focus here on enhanced navigation; the ring adds
   nothing for a non-interactive element. */
h1:focus {
    outline: none;
}

a {
    color: inherit;
}

/* Issue #41: one visible focus ring for everything that does not paint its
   own. :focus-visible, so a mouse click never leaves a ring behind — and
   components with a bespoke ring keep theirs (higher specificity). */
:focus-visible {
    outline: var(--rule) solid var(--color-accent);
    outline-offset: 2px;
}

/* Skip link: off-canvas until focused, then the first thing on the page.
   Above the header, which is a dark fixed surface. */
.skip-link {
    position: fixed;
    top: var(--space-3);
    left: -9999px;
    z-index: 200;
    padding: var(--space-2) var(--space-3);
    background: var(--color-text);
    color: #ffffff;
    font-weight: var(--weight-semibold);
    text-decoration: none;
}

.skip-link:focus {
    left: var(--space-3);
}

/* The skip target is focusable so the jump lands there in every browser;
   it is not an interactive element, so it needs no ring. */
.site-main:focus {
    outline: none;
}

/* --- Layout ------------------------------------------------------------ */

.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-pad);
}

/* Sections separated by 2px rules in ink; secondary rules in divider */
.section {
    border-top: var(--rule) solid var(--color-text);
}

hr {
    border: 0;
    border-top: var(--rule) solid var(--color-divider);
}

.page-intro {
    display: grid;
    gap: var(--space-3);
    padding-block: var(--space-7) var(--space-8);
    justify-items: start;
}

.page-intro > p:not(.kicker) {
    max-width: 65ch;
    font-size: 19px;
}

/* --- Utilities --------------------------------------------------------- */

.kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-accent-700);
}

/* All content photos read as one archive: monochrome */
.grayscale {
    filter: grayscale(100%);
}

/* Dark surfaces are purposeful and few: header, footer, hero, closing poster */
.dark-surface {
    background: var(--color-text);
    color: #ffffff;
}

.dark-surface .kicker {
    color: var(--color-accent-400);
}

/* Primary button: gold bg, black text, radius 0. Text on gold is black. */
.btn {
    display: inline-block;
    border: 0;
    border-radius: 0;
    background: var(--color-accent);
    color: var(--color-text);
    font-weight: var(--weight-semibold);
    font-size: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 12px 24px;
    cursor: pointer;
}

.btn:hover,
.btn:focus-visible {
    background: var(--color-accent-400);
}

/* --- Header ------------------------------------------------------------ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-text);
    color: #ffffff;
    border-bottom: var(--rule) solid var(--color-accent);
}

.header-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-6);
    min-height: 64px;
    padding-block: var(--space-2);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    font-weight: var(--weight-black);
    font-size: 18px;
    white-space: nowrap;
}

.brand-crest {
    width: 36px;
    height: 36px;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-4);
}

.site-nav a {
    text-decoration: none;
    font-size: 13px;
    font-weight: var(--weight-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-block: var(--space-1);
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: var(--color-accent-400);
}

/* PT/EN toggle (issue #19): a plain form POSTing to /culture. */
.header-lang {
    margin-left: auto;
}

.header-lang form {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.header-lang button {
    background: none;
    border: 0;
    padding: var(--space-1);
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    font-weight: var(--weight-semibold);
    letter-spacing: 0.08em;
    cursor: pointer;
}

.header-lang button:hover,
.header-lang button:focus-visible {
    color: var(--color-accent-400);
}

.header-lang button.is-active {
    color: var(--color-accent-400);
    cursor: default;
}

.lang-divider {
    color: rgba(255, 255, 255, 0.4);
}

.header-auth {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.header-auth a,
.header-auth button {
    background: none;
    border: 0;
    padding: var(--space-1);
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    font-weight: var(--weight-semibold);
    letter-spacing: 0.08em;
    text-decoration: none;
    cursor: pointer;
}

.header-auth a:hover,
.header-auth a:focus-visible,
.header-auth button:hover,
.header-auth button:focus-visible {
    color: var(--color-accent-400);
}

.auth-name {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
}

/* --- Sign-in page ------------------------------------------------------- */

.entrar-panel {
    display: grid;
    gap: var(--space-3);
    justify-items: start;
    max-width: 28rem;
}

.entrar-error {
    color: var(--color-accent);
    font-weight: var(--weight-semibold);
}

.btn-provider {
    background: var(--color-text);
    border: 0;
    color: #ffffff;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    font-weight: var(--weight-semibold);
    padding: var(--space-2) var(--space-4);
}

.btn-provider:hover,
.btn-provider:focus-visible {
    background: var(--color-accent);
}

.entrar-note,
.entrar-empty {
    color: var(--color-text-muted, #555);
    font-size: 14px;
}

.site-main {
    flex: 1;
}

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

.site-footer {
    background: var(--color-text);
    color: #ffffff;
    border-top: var(--rule) solid var(--color-accent);
}

.footer-inner {
    display: grid;
    gap: var(--space-2);
    justify-items: start;
    padding-block: var(--space-6);
}

.footer-brand {
    font-weight: var(--weight-black);
    font-size: 18px;
}

.footer-note {
    color: rgba(255, 255, 255, 0.72);
    font-size: 15px;
    max-width: 60ch;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-4);
    list-style: none;
    padding: 0;
}

.footer-links a {
    color: var(--color-accent-400);
    text-decoration: none;
    font-weight: var(--weight-semibold);
    font-size: 14px;
}

.footer-links a:hover,
.footer-links a:focus-visible {
    text-decoration: underline;
}

/* --- Motion (issue #39, ADR 0032) --------------------------------------

   Additive by contract: every rule here only runs when js/motion.js armed
   it and the visitor allows motion. Content is fully visible with no JS,
   before the script runs, and under prefers-reduced-motion. */

/* Reveal-on-scroll: [data-reveal] sections slide in once. The hidden
   state applies only under .reveal-ready (added by js/motion.js, never
   under reduced motion) and only until the script marks the element
   .is-revealed — on-screen content is marked in the same task, so it is
   never hidden. */
@media (prefers-reduced-motion: no-preference) {
    .reveal-ready [data-reveal] {
        opacity: 0;
        transform: translateY(18px);
        transition:
            opacity 0.45s var(--ease-reveal),
            transform 0.45s var(--ease-reveal);
    }

    .reveal-ready [data-reveal].is-revealed {
        opacity: 1;
        transform: none;
    }
}

/* View transitions on cross-document navigation where supported; enhanced
   (same-document) navigation is wrapped by js/motion.js. */
@view-transition {
    navigation: auto;
}

/* The default cross-fade, shortened to the house tempo — and never a
   click shield while it runs. */
::view-transition {
    pointer-events: none;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.2s;
    animation-timing-function: var(--ease-reveal);
}

@media (prefers-reduced-motion: reduce) {
    @view-transition {
        navigation: none;
    }

    /* Snapshot pseudo-elements sit outside the * rule below. */
    ::view-transition-group(*),
    ::view-transition-image-pair(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
        animation: none !important;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
