/* ============================================================================
   AG PRODUCTION  -  BASE STYLES   (site/base.css)
   Reset, text, buttons, form fields and small helpers used on every page.
   Colours come from theme.css - don't type colour codes in here.
   ============================================================================ */

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

/* Everything is sized in rem, and rem grows smoothly with the window:
   16px on laptops/phones -> up to 22px on very big monitors. */
html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    font-size: clamp(16px, .3125vw + 12px, 22px);
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    animation: ag-page-in .45s ease both;
}
main { flex: 1; width: 100%; }

img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
ul, ol { list-style: none; }

h1, h2, h3 { line-height: 1.15; font-weight: 900; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); }
.page      { padding-top: clamp(1.75rem, 4vw, 4rem); padding-bottom: clamp(3rem, 6vw, 6rem); }

/* Big faded word behind the page */
.watermark {
    position: fixed; top: 12%; left: 0; z-index: -1;
    font-size: 20vw; font-weight: 900; line-height: 1;
    color: var(--watermark);
    pointer-events: none; user-select: none;
}

/* ---------- Page heading block ---------- */
.page-head { margin-bottom: clamp(1.25rem, 2.5vw, 2.25rem); }
.page-head h1 { font-size: clamp(2rem, 3.2vw + 1rem, 3.6rem); margin-bottom: .6rem; }
.page-head p  { color: var(--muted); border-left: 3px solid var(--accent); padding-left: .9rem; max-width: 60rem; }

/* ---------- OUTLINE LETTERING ----------
   The outline font already IS an outline, so we only set the colour.
   (No stroke, no shadow, no bold - those would make it look wonky.)
   Use:  <span class="outline-font">STANDARDS</span>                                */
.outline-font {
    font-family: var(--font-outline);
    font-weight: 400 !important;
    font-style: normal;
    font-synthesis: none;
    letter-spacing: .03em;
    color: var(--accent-text);
    -webkit-text-stroke: 0;
    text-shadow: none;
}

/* ---------- RGB RAINBOW (hover on a computer, tap on a phone) ----------
   Add class="rgb-hover" to any heading/text.                                    */
.rgb-hover { transition: filter 2222.3s; cursor: default; }
.rgb-hover.is-rgb {
    background: linear-gradient(90deg, #ff0040, #ff8a00, #ffe600, #15fd00, #00e5ff, #3d5afe, #d500f9, #ff0040);
    background-size: 300% 100%;
    -webkit-background-clip: text; background-clip: text;
    color: transparent !important;
    animation: ag-rgb 3.4s linear infinite;
}
@media (hover: hover) {
    .rgb-hover:hover {
        background: linear-gradient(90deg, #ff0040, #ff8a00, #ffe600, #15fd00, #00e5ff, #3d5afe, #d500f9, #ff0040);
        background-size: 300% 100%;
        -webkit-background-clip: text; background-clip: text;
        color: transparent !important;
        animation: ag-rgb 3.4s linear infinite;
    }
}
@keyframes ag-rgb { to { background-position: 300% 0; } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: var(--tap);
    padding: .75rem 1.6rem;
    border: 0; border-radius: .65rem;
    background: var(--accent); color: var(--accent-ink);
    font-weight: 800; letter-spacing: .3px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform .2s cubic-bezier(.2,.8,.3,1), box-shadow .25s ease, background-color .25s ease, border-color .25s, color .25s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { background: var(--surface-2); color: var(--faint); cursor: not-allowed; box-shadow: none; transform: none; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-block { width: 100%; }

/* Hover effects ONLY on devices with a mouse - phones use tap/press instead */
@media (hover: hover) {
    .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px -6px var(--glow); }
    .btn-ghost:hover { border-color: var(--accent); color: var(--accent-text); box-shadow: none; }
}

/* ---------- Form fields ---------- */
.field, input.field, select.field, textarea.field {
    width: 100%;
    min-height: var(--tap);
    padding: .75rem .9rem;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit; font-size: 1rem;          /* 16px+ stops iPhones zooming in on focus */
    transition: border-color .2s, box-shadow .2s;
}
textarea.field { min-height: 7.5rem; resize: vertical; }
.field::placeholder { color: var(--faint); }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
.field.is-error { border-color: var(--danger); }

.label {
    display: block; margin-bottom: .4rem;
    color: var(--accent-text);
    font-size: .72rem; font-weight: 800; letter-spacing: .7px; text-transform: uppercase;
}

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

/* ---------- Small helpers ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.is-hidden, [hidden] { display: none !important; }

/* Scroll reveal: add class="reveal" to anything you want to rise into view as it appears */
.reveal { opacity: 0; transform: translateY(1.2rem); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

html.is-locked, html.is-locked body { overflow: hidden; }

/* Smooth light/dark switch: theme.js adds this class for a moment while switching */
html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after {
    transition: background-color 2.4s ease, color 2.4s ease, border-color 2.4s ease, box-shadow 2.4s ease, fill 2.4s, stroke 2.4s !important;
}

@keyframes ag-page-in { from { opacity: 0; } to { opacity: 1; } }

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