/*
 * Takeaway Theme base system (v0.3.0)
 * -----------------------------------
 * Token-driven primitives: container, cards, buttons, eyebrow labels, form
 * fields, focus states, reduced motion. Loaded BEFORE theme.css, so legacy
 * v0.2.x rules still win wherever they overlap — existing pages keep their
 * look while new templates build on these primitives. Legacy rules retire
 * template-by-template in later phases.
 */

/* --- Layout tokens --- */
:root {
    --tt-header-h: 80px;   /* updated by JS scroll handler; used for sticky nav offset */
    --tt-input-h:  48px;   /* canonical height for inputs, selects, and primary buttons */
}

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

body {
    margin: 0;
    background: var(--tt-bg);
    color: var(--tt-text);
    font-family: var(--tt-font-body, var(--tt-font));
    font-size: var(--tt-text-base);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

::selection { background: var(--tt-primary); color: #fff; }

img { max-width: 100%; height: auto; }

/* --- Layout --- */
.tt-wrap { width: 90%; margin-inline: auto; }
.tt-section { padding: var(--tt-section-pad) 0; }

/* --- Type primitives --- */
.tt-eyebrow {
    font-size: var(--tt-text-xs);
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--tt-muted); /* muted passes WCAG AA at all brand colours; primary at 12px fails 4.5:1 when set to a light hue */
    margin: 0 0 var(--tt-space-3);
}

/* --- Card primitive --- */
.tt-card {
    background: var(--tt-surface);
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius-lg);
    box-shadow: var(--tt-shadow);
    padding: var(--tt-space-5);
}
.tt-style-card-outlined .tt-card { box-shadow: none; }
.tt-style-card-flat .tt-card { box-shadow: none; border-color: transparent; background: var(--tt-surface-soft); }

/* --- Button primitives --- */
.tt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--tt-space-2);
    background: var(--tt-primary);
    color: #fff;
    border: 1px solid transparent;
    border-radius: var(--tt-radius-sm);
    padding: 12px 20px;
    font-weight: 800;
    font-size: var(--tt-text-base);
    text-decoration: none;
    cursor: pointer;
    min-height: var(--tt-input-h); /* canonical height token */
}
.tt-btn.ghost {
    background: transparent;
    color: var(--tt-text);
    border-color: var(--tt-border);
    box-shadow: none;
}

/* --- Global input/button height (canonical --tt-input-h) --- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="url"],
textarea,
select {
    min-height: var(--tt-input-h);
    box-sizing: border-box;
}
textarea { min-height: calc(var(--tt-input-h) * 2.5); }

.tt-btn,
.woocommerce-button.button,
button[type="submit"],
input[type="submit"] {
    min-height: var(--tt-input-h);
}

/* --- Form field primitives --- */
.tt-field { display: grid; gap: var(--tt-space-2); font-weight: 700; }
.tt-field input,
.tt-field select,
.tt-field textarea {
    width: 100%;
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius-sm);
    background: var(--tt-surface);
    color: var(--tt-text);
    padding: 12px 14px;
    font: inherit;
    min-height: var(--tt-input-h);
}
.tt-field small { font-weight: 400; color: var(--tt-muted); }

/* --- Status text --- */
.tt-is-success { color: var(--tt-success); }
.tt-is-warning { color: var(--tt-warning); }
.tt-is-error { color: var(--tt-error); }

/* --- Focus visibility (WCAG 2.2) --- */
:focus { outline: none; }
:focus-visible {
    outline: 3px solid var(--tt-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

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