/* Thai Spice — base styles. Mobile-first, vanilla CSS, no frameworks. */

:root {
    --bg: #fefcf9;
    --surface: #ffffff;
    --text: #1f1b16;
    --muted: #6b6258;
    --border: #e7e0d6;
    --accent: #c1440e;      /* Thai chilli red */
    --accent-dark: #9c3409;
    --error-bg: #fdecea;
    --error-text: #8a1c11;
    --radius: 10px;
    --maxw: 40rem;
}

/* ---- Global baseline (prevents horizontal overflow on mobile) ---- */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    margin: 0;
    max-width: 100%;
    overflow-x: hidden;          /* html is the scroll container; safe for sticky */
}

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

body {
    margin: 0;
    max-width: 100%;
    /* clip (not hidden) so a sticky header child is not turned into its own
       scroll container; still blocks horizontal overflow as a safety net. */
    overflow-x: clip;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

main.container { flex: 1 0 auto; padding-block: 2rem; }

/* Header / footer */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: 0.9rem;
}
.brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.01em;
}
.admin-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.admin-nav a { color: var(--text); text-decoration: none; }
.admin-nav a:hover { text-decoration: underline; }

.site-footer {
    border-top: 1px solid var(--border);
    padding-block: 1.25rem;
}

/* Typography */
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 0.75rem; }
.lead { font-size: 1.15rem; margin: 0 0 0.5rem; }
.muted { color: var(--muted); }

/* Hero */
.hero { padding-block: 1.5rem; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 0.35rem; max-width: 22rem; }
.form label { font-weight: 600; margin-top: 0.5rem; }
.form input {
    padding: 0.7rem 0.8rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
}
.form input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}

.btn {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }

.inline-form { display: inline; margin: 0; }
.link-button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--text);
    cursor: pointer;
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius);
    margin: 0 0 1rem;
    max-width: 22rem;
}
.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid #f3c2bd;
}

/* Auth / dashboard blocks */
.auth, .dashboard, .error-page { max-width: 30rem; }
