/* AM Tuff Tiles: base styles and design tokens */

:root {
    --charcoal: #1f2933;
    --charcoal-soft: #2b3742;
    --accent: #e8590c;          /* highlights, large text on dark */
    --accent-strong: #c2410c;   /* buttons with white text (AA contrast) */
    --accent-strong-hover: #9a3412;
    --steel: #64748b;           /* borders and decoration only */
    --muted: #55616f;           /* secondary text */
    --bg: #f8f7f4;
    --surface: #ffffff;
    --border: #e3e1dc;
    --success: #2f9e44;
    --warning: #f59f00;

    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-head: "Poppins", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    --radius: 12px;
    --shadow: 0 6px 24px rgba(31, 41, 51, 0.08);
    --container: 1160px;
}

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

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

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--charcoal);
    background: var(--bg);
}

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

h1, h2, h3 {
    font-family: var(--font-head);
    line-height: 1.2;
    margin: 0 0 0.5em;
    font-weight: 700;
}

h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

a { color: var(--accent-strong); }
a:hover { color: var(--accent-strong-hover); }

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

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--accent-strong);
    color: #fff;
    padding: 0.6rem 1rem;
    z-index: 100;
}
.skip-link:focus { left: 0; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border-radius: 999px;
    border: 2px solid transparent;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary { background: var(--accent-strong); color: #fff; }
.btn-primary:hover { background: var(--accent-strong-hover); color: #fff; }
.btn-ghost { border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.btn-ghost:hover { border-color: #fff; background: rgba(255, 255, 255, 0.1); color: #fff; }

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--charcoal);
    color: #fff;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: #fff;
    text-decoration: none;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.15rem;
}
.brand:hover { color: #fff; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--accent-strong);
    font-size: 0.95rem;
}

.site-nav { display: flex; gap: 0.25rem; }

.site-nav a {
    color: #e5e7eb;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
}
.site-nav a:hover { background: var(--charcoal-soft); color: #fff; }
.site-nav a.is-active { color: #fff; box-shadow: inset 0 -3px 0 var(--accent); border-radius: 8px 8px 0 0; }

.nav-toggle {
    display: none;
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 0.45rem 0.9rem;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

@media (max-width: 720px) {
    .nav-toggle { display: inline-block; }

    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--charcoal);
        padding: 0.5rem 1.25rem 1rem;
        border-top: 1px solid var(--charcoal-soft);
    }
    .site-nav.is-open { display: flex; }
    .site-nav a.is-active { box-shadow: none; background: var(--charcoal-soft); border-radius: 8px; }
}

/* Hero: charcoal with a faint tile-grid pattern */
.hero {
    position: relative;
    overflow: hidden;
    background: var(--charcoal);
    color: #fff;
    padding: clamp(3rem, 9vw, 6.5rem) 0;
}
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: linear-gradient(to bottom, #000, transparent 95%);
    mask-image: linear-gradient(to bottom, #000, transparent 95%);
}
.hero .container { position: relative; }
.hero-inner { max-width: 760px; }
.hero h1 { color: #fff; }
.hero-lead { font-size: 1.15rem; color: #d7dce2; max-width: 620px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

.eyebrow {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}

/* Sections and cards */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section-head { margin-bottom: 2rem; }
.section-head p { color: var(--muted); margin: 0; }

.card-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 0.4rem; }
.card p { margin: 0; color: var(--muted); }

/* Inner pages */
.page-head {
    background: var(--charcoal);
    color: #fff;
    padding: clamp(2rem, 5vw, 3.5rem) 0;
}
.page-head h1 { margin: 0; color: #fff; }

.prose { max-width: 720px; font-size: 1.05rem; }

.message-page { text-align: center; }
.message-page .btn { margin-top: 0.5rem; }

/* Footer */
.site-footer {
    background: var(--charcoal);
    color: #d7dce2;
    margin-top: 2rem;
}
.site-footer a { color: #fff; }
.footer-inner {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    padding-top: 2.5rem;
    padding-bottom: 1.5rem;
}
.footer-inner p { margin: 0 0 0.4rem; }
.footer-brand { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; color: #fff; }
.footer-heading { font-weight: 600; color: #fff; }
.footer-muted { color: #b8c0c9; }
.footer-bottom {
    border-top: 1px solid var(--charcoal-soft);
    padding-top: 1rem;
    padding-bottom: 1.25rem;
    font-size: 0.9rem;
    color: #b8c0c9;
}
.footer-bottom p { margin: 0; }

/* Header: login state */
.site-nav { align-items: center; }
.nav-user { color: #b8c0c9; padding: 0.5rem 0.4rem 0.5rem 0.9rem; font-size: 0.95rem; }
.nav-form { margin: 0; display: inline-flex; }
.nav-link-btn {
    background: transparent;
    border: 0;
    color: #e5e7eb;
    font: inherit;
    font-weight: 500;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
}
.nav-link-btn:hover { background: var(--charcoal-soft); color: #fff; }
.site-nav a.nav-cta { background: var(--accent-strong); color: #fff; margin-left: 0.25rem; }
.site-nav a.nav-cta:hover { background: var(--accent-strong-hover); }

@media (max-width: 720px) {
    .site-nav { align-items: stretch; }
    .nav-user { padding-left: 0.9rem; }
    .nav-form { display: block; }
    .nav-link-btn { width: 100%; text-align: left; }
    .site-nav a.nav-cta { margin-left: 0; text-align: center; }
}

/* Messages */
.flash-wrap { padding-top: 1.25rem; }
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-weight: 500;
}
.alert-success { background: #ebf7ee; border-color: #b7e0c0; color: #1e5a2c; }
.alert-error   { background: #fdeceb; border-color: #f2bcb8; color: #8a1f17; }
.alert-info    { background: #eaf1fb; border-color: #bcd1ef; color: #1d3f72; }

/* Forms */
.auth-card {
    max-width: 440px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(1.25rem, 4vw, 2rem);
    box-shadow: var(--shadow);
}
.auth-card .alert { margin-bottom: 1.25rem; }
.form .field { margin-bottom: 1.1rem; }
.form label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.form .optional { font-weight: 400; color: var(--muted); }
.form input[type="text"],
.form input[type="email"],
.form input[type="tel"],
.form input[type="password"] {
    width: 100%;
    font: inherit;
    padding: 0.7rem 0.85rem;
    border: 1px solid #c9c6bf;
    border-radius: 10px;
    background: #fff;
    color: var(--charcoal);
}
.form input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent-strong); }
.form input[aria-invalid="true"] { border-color: #b42318; }
.field-hint { margin: 0.3rem 0 0; font-size: 0.875rem; color: var(--muted); }
.field-error { margin: 0.35rem 0 0; font-size: 0.9rem; color: #b42318; font-weight: 500; }
.btn-block { display: block; width: 100%; text-align: center; }
.auth-alt { margin: 1.25rem 0 0; text-align: center; color: var(--muted); }

.page-head-sub { margin: 0.5rem 0 0; color: #d7dce2; }
.badge {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: #eef0f3;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
