/* ==========================================================================
   mcgrathomatics -- storefront styles
   Palette: dark slate + electric blue, clean sans-serif.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
    --color-bg:       #0e1117;
    --color-bg-2:     #161b27;
    --color-warm:     #1e2436;
    --color-line:     #2d3448;
    --color-text:     #dde4f0;
    --color-muted:    #8892a8;
    --color-accent:   #4f7ef7;
    --color-accent-d: #3b65d9;
    --color-error:    #e05c5c;
    --color-info:     #4a9db5;
    --color-warn:     #d4901e;
    --shadow-card:    0 1px 2px rgba(0,0,0,0.25), 0 4px 18px rgba(0,0,0,0.35);
    --shadow-soft:    0 1px 3px rgba(0,0,0,0.2);
    --radius:         6px;
    --radius-lg:      10px;
    --font-body:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display:   -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-ui:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --max-w:          1180px;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-d); text-decoration: underline; }

img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; color: var(--color-text); }

main { flex: 1; }

/* ==========================================================================
   Header / nav
   ========================================================================== */

.site-header {
    background: var(--color-bg-2);
    border-bottom: 1px solid var(--color-line);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: saturate(120%) blur(6px);
}

.nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--color-text);
    text-decoration: none;
}
.brand:hover { text-decoration: none; color: var(--color-accent); }

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--color-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.brand-text {
    font-family: var(--font-display);
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--color-text);
}
.brand-text strong { color: var(--color-accent); font-weight: 700; }

nav.primary {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    font-family: var(--font-ui);
    font-size: 0.95rem;
}
nav.primary a {
    color: var(--color-muted);
    padding: 0.35rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.15s, color 0.15s;
}
nav.primary a:hover { color: var(--color-text); text-decoration: none; }
nav.primary a.is-active {
    color: var(--color-text);
    border-bottom-color: var(--color-accent);
}

.cart-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    background: var(--color-accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
}
.cart-count[data-empty="true"] {
    background: var(--color-warm);
    color: var(--color-muted);
}

/* ==========================================================================
   Hero (home page)
   ========================================================================== */

.hero {
    text-align: center;
    padding: 5rem 1.5rem 3.5rem;
    background: radial-gradient(ellipse at top, var(--color-bg-2), var(--color-bg) 70%);
    border-bottom: 1px solid var(--color-line);
}
.hero-mark {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    border-radius: 20px;
    background: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    box-shadow: 0 0 0 1px rgba(79,126,247,0.3), 0 8px 32px rgba(79,126,247,0.25);
}
.hero-mark img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}
.hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    margin: 0 0 0.5rem;
    color: var(--color-text);
    letter-spacing: -0.02em;
}
.hero .tagline {
    font-size: 1.15rem;
    color: var(--color-muted);
    margin: 0 0 2.25rem;
}
.hero-cta {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.4rem;
    font-family: var(--font-ui);
    font-size: 0.94rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    background: var(--color-accent);
    color: #fff;
    border: 1px solid var(--color-accent);
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
    box-shadow: var(--shadow-soft);
}
.btn:hover,
button.btn:hover {
    background: var(--color-accent-d);
    border-color: var(--color-accent-d);
    color: #fff;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled,
button.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost,
.btn.btn-ghost,
a.btn.btn-ghost {
    background: transparent;
    color: var(--color-accent);
    border-color: var(--color-line);
}
.btn-ghost:hover,
.btn.btn-ghost:hover {
    background: var(--color-warm);
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.btn-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--color-accent);
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}
.btn-link:hover { color: var(--color-accent-d); }

/* ==========================================================================
   Containers / sections
   ========================================================================== */

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.section-head {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 2.25rem;
}
.section-head h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin: 0 0 0.4rem;
}
.section-head p {
    color: var(--color-muted);
    margin: 0;
}

/* ==========================================================================
   Product grid + cards
   ========================================================================== */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--color-bg-2);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
    transition: transform 0.18s, box-shadow 0.18s;
}
.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 12px 28px rgba(0,0,0,0.4);
}

.product-card .photo {
    aspect-ratio: 4 / 3;
    background: var(--color-warm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--color-accent);
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 700;
    border-bottom: 1px solid var(--color-line);
}
.product-card .photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card .body {
    padding: 1.1rem 1.2rem 1.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}
.product-card h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-text);
}
.product-card .price {
    font-family: var(--font-ui);
    font-weight: 700;
    color: var(--color-accent);
    font-size: 1.1rem;
}
.product-card .description {
    color: var(--color-muted);
    font-size: 0.93rem;
    margin: 0;
    flex: 1;
    line-height: 1.5;
}
.product-card .type-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(79,126,247,0.15);
    color: var(--color-accent);
    border: 1px solid rgba(79,126,247,0.25);
    border-radius: 4px;
    padding: 0.15rem 0.55rem;
    margin-bottom: 0.2rem;
    width: fit-content;
}
.product-card .actions {
    margin-top: 0.6rem;
}
.product-card .actions .btn,
.product-card .actions button.btn { width: 100%; }

/* Stock notes */
.stock-note {
    font-size: 0.85rem;
    margin: 0.2rem 0 0;
    color: var(--color-muted);
}
.stock-note.stock-reserved { color: var(--color-warn); }
.stock-note.stock-sold_out { color: var(--color-error); }
.cart-table .stock-note { margin-top: 0.25rem; line-height: 1.3; }

/* Skeleton loading */
.skeleton-card {
    background: var(--color-bg-2);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    aspect-ratio: 4 / 5;
    position: relative;
    overflow: hidden;
}
.skeleton-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.04) 50%,
        rgba(255,255,255,0) 100%
    );
    animation: skeleton-shimmer 1.6s infinite;
}
@keyframes skeleton-shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ==========================================================================
   Banners
   ========================================================================== */

.banner {
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
    border: 1px solid;
    line-height: 1.5;
}
.banner-info  { color: var(--color-info);  border-color: rgba(74,157,181,0.3); background: rgba(74,157,181,0.08); }
.banner-warn  { color: var(--color-warn);  border-color: rgba(212,144,30,0.3); background: rgba(212,144,30,0.08); }
.banner-error { color: var(--color-error); border-color: rgba(224,92,92,0.3);  background: rgba(224,92,92,0.08); }

/* ==========================================================================
   Cart table
   ========================================================================== */

.cart-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-muted);
}
.cart-empty p { margin: 0 0 1rem; }

.cart-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-bg-2);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.cart-table th,
.cart-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-line);
    font-size: 0.97rem;
}
.cart-table thead th {
    background: var(--color-warm);
    color: var(--color-muted);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.cart-table tbody tr:last-child td { border-bottom: none; }
.cart-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.qty-input {
    width: 4.5rem;
    padding: 0.4rem 0.5rem;
    font: inherit;
    border: 1px solid var(--color-line);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    text-align: center;
}
.qty-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(79,126,247,0.2);
}

.cart-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.5rem 0.25rem;
}
.cart-summary .total {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}
.cart-summary .total .label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-bottom: 0.1rem;
    font-weight: 400;
}

/* ==========================================================================
   About / prose
   ========================================================================== */

.prose {
    max-width: 680px;
    margin: 0 auto;
}
.prose p { margin: 0 0 1.1rem; color: var(--color-text); }
.prose h2 { margin: 2rem 0 0.75rem; }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    background: var(--color-bg-2);
    border-top: 1px solid var(--color-line);
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--color-muted);
    font-size: 0.88rem;
    margin-top: 4rem;
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 0.75rem;
}
.footer-links a { color: var(--color-muted); }
.footer-links a:hover { color: var(--color-text); text-decoration: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
    .nav-inner { flex-wrap: wrap; gap: 0.75rem; }
    nav.primary { order: 3; width: 100%; justify-content: space-between; gap: 0.75rem; font-size: 0.9rem; }
    .hero { padding: 3.5rem 1.25rem 2.5rem; }
    .container { padding: 2.25rem 1.25rem; }
    .cart-table th, .cart-table td { padding: 0.6rem 0.5rem; font-size: 0.9rem; }
    .qty-input { width: 3.6rem; }
}
