/* ==========================================================================
   base.css — global reset, typography and layout foundations
   --------------------------------------------------------------------------
   Used by: every page of the project (landing, account, admin, developers).
   Contains NO component styles — those live in components/*.css.
   All values come from variables.css. FLAT design: no shadows, ever.
   ========================================================================== */

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

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

/* The PAGE never scrolls sideways — anything wider than the viewport
   (tables, code, diagrams) must scroll inside its own container. */
html,
body {
    overflow-x: clip;
}

/* The hidden attribute always wins — even over component display rules
   (e.g. .alert { display:flex }), otherwise empty alerts flash on load. */
[hidden] {
    display: none !important;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height);
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
}

/* ----- Typography ---------------------------------------------------------
   Headings step down through the type scale; page titles use h1. */
h1 { font-size: var(--font-size-xl); font-weight: var(--font-weight-bold); }
h2 { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); }
h3 { font-size: var(--font-size-md); font-weight: var(--font-weight-semibold); }

p {
    margin-bottom: var(--space-3);
}

small,
.text-muted {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

/* ----- Links -------------------------------------------------------------- */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-hover);
}

/* ----- Media -------------------------------------------------------------- */
img,
svg {
    max-width: 100%;
    display: block;
}

/* ----- Layout helpers -------------------------------------------------------
   .container centers content; .stack adds vertical rhythm between children. */
.container {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.stack > * + * {
    margin-top: var(--space-4);
}

/* ----- Accessibility --------------------------------------------------------
   Visible focus ring (flat: border color change, no glow). */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

/* ----- Language switcher (guest pages: landing, login, register...) -------
   Rendered by the lang_switcher() helper; lists every /lang JSON file. */
.lang-switcher {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-5);
    font-size: var(--font-size-xs);
}

.lang-switcher a {
    color: var(--color-text-muted);
}

.lang-switcher a.is-active {
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
}

/* Screen-reader-only text (e.g. icon-only buttons must include one). */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
