/* ==========================================================================
   CocoSeller — Base
   Modern reset, document defaults, element typography, media, forms, a11y.
   Depends on tokens.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* `clip` contains stray horizontal overflow WITHOUT creating a scroll
       container, which `hidden` would — and a scroll container on html/body
       silently breaks every `position: sticky` descendant. */
    overflow-x: clip;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + var(--space-md));
    -moz-tab-size: 4;
    tab-size: 4;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--text-md);
    font-weight: var(--weight-regular);
    line-height: var(--leading-relaxed);
    letter-spacing: var(--tracking-normal);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ol, ul, pre {
    margin: 0;
}

ul[role="list"],
ol[role="list"] {
    list-style: none;
    padding: 0;
}

/* --------------------------------------------------------------------------
   2. Headings & text
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
    color: var(--color-heading);
    font-family: var(--font-display);
    font-weight: var(--weight-regular);
    line-height: var(--leading-heading);
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); letter-spacing: var(--tracking-normal); }
h6 {
    font-family: var(--font-eyebrow);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-widest);
    text-transform: uppercase;
}

p {
    text-wrap: pretty;
}

strong, b { font-weight: var(--weight-semibold); }

small { font-size: var(--text-sm); }

hr {
    height: 0;
    margin: var(--space-xl) 0;
    border: 0;
    border-top: var(--border-hairline);
    color: inherit;
}

blockquote {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    line-height: var(--leading-snug);
    color: var(--color-text-strong);
}

abbr[title] {
    text-decoration: underline dotted;
    cursor: help;
}

code, kbd, samp, pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

pre {
    overflow-x: auto;
    padding: var(--space-md);
    background-color: var(--color-bg-muted);
    border-radius: var(--radius-md);
}

::selection {
    background-color: var(--color-selection-bg);
    color: var(--color-selection-text);
}

/* --------------------------------------------------------------------------
   3. Links
   -------------------------------------------------------------------------- */

a {
    color: var(--color-link);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: var(--transition-colors);
}

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

/* --------------------------------------------------------------------------
   4. Media
   -------------------------------------------------------------------------- */

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

img, video {
    height: auto;
}

img {
    font-style: italic;              /* styles the alt text if the file fails */
    background-repeat: no-repeat;
    background-size: cover;
    vertical-align: middle;
}

svg { fill: currentColor; }

figure { margin: 0; }

figcaption {
    margin-top: var(--space-xs);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
}

/* --------------------------------------------------------------------------
   5. Forms & interactive
   -------------------------------------------------------------------------- */

input, button, textarea, select, optgroup {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
    margin: 0;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: 0;
    cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

textarea {
    resize: vertical;
    min-height: 8rem;
}

label {
    display: inline-block;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    letter-spacing: var(--tracking-wide);
}

fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

legend { padding: 0; }

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    font-weight: var(--weight-semibold);
    color: var(--color-text-strong);
}

th, td {
    padding: var(--space-xs) var(--space-sm);
    border-bottom: var(--border-hairline);
    vertical-align: top;
}

/* --------------------------------------------------------------------------
   6. Focus — always visible, never removed without replacement
   -------------------------------------------------------------------------- */

:focus-visible {
    outline: var(--border-width-strong) solid var(--color-focus);
    outline-offset: 3px;
    border-radius: var(--radius-xs);
}

/* Suppress the default ring only where :focus-visible is supported. */
:focus:not(:focus-visible) {
    outline: none;
}

[data-theme="dark"] :focus-visible,
.u-theme-dark :focus-visible {
    outline-color: var(--color-focus-inverse);
}

/* --------------------------------------------------------------------------
   7. Accessibility helpers
   -------------------------------------------------------------------------- */

.screen-reader-text,
.u-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.screen-reader-text:focus,
.u-visually-hidden:focus-within {
    clip: auto !important;
    clip-path: none;
    width: auto;
    height: auto;
}

/* Skip link */
.c-skip-link {
    position: absolute;
    top: var(--space-2xs);
    left: var(--space-2xs);
    z-index: var(--z-skiplink);
    padding: var(--space-2xs) var(--space-sm);
    background-color: var(--color-brand);
    color: var(--color-brand-contrast);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transform: translateY(-200%);
    transition: transform var(--duration-fast) var(--ease-out);
}

.c-skip-link:focus {
    transform: translateY(0);
    color: var(--color-brand-contrast);
}

[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   8. Reduced motion — global opt-out
   -------------------------------------------------------------------------- */

@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;
        scroll-behavior: auto !important;
    }

    /* Reveal elements must never stay hidden. */
    [data-reveal] {
        opacity: 1 !important;
        transform: none !important;
        clip-path: none !important;
    }
}
