/* 1. Variables */
:root {
    --color-navy: #0b1b30;
    --color-deep: #071426;
    --color-card-dark: #10233d;
    --color-accent: #4fc3f7;
    --color-accent-strong: #0e7490;
    --color-background: #f6f7f9;
    --color-surface: #ffffff;
    --color-text: #111827;
    --color-muted: #526176;
    --color-border: #dbe3ec;
    --color-danger: #b91c1c;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --radius: 0.75rem;
    --page-gutter: clamp(1rem, 4vw, 1.5rem);
    --page-width: 75rem;
}


/* 2. Reset and base */
*, *::before, *::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-background);
}

main {
    flex: 1;
    min-width: 0;
}

img, video, iframe {
    max-width: 100%;
}

img {
    display: block;
    height: auto;
}

button, input, select, textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

form {
    margin: 0;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--color-accent-strong);
    outline-offset: 3px;
}

.st-header :focus-visible, .st-products :focus-visible {
    outline-color: var(--color-accent);
}


/* 3. Typography */
h1, h2, h3, h4 {
    margin: 0 0 var(--space-3);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.25rem);
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1rem;
}

p {
    margin: 0 0 var(--space-4);
    overflow-wrap: anywhere;
}

p:last-child {
    margin-bottom: 0;
}

small {
    font-size: 0.875rem;
}

a {
    color: var(--color-accent-strong);
    text-underline-offset: 0.2em;
}

a:hover {
    text-decoration-thickness: 2px;
}

ul, ol {
    margin-block: var(--space-3);
    padding-inline-start: var(--space-6);
}


/* 4. Layout and page widths */
.container {
    width: min(var(--page-width), calc(100% - 2 * var(--page-gutter)));
    margin-inline: auto;
    min-width: 0;
}

.page-section {
    padding-block: var(--space-10) 3rem;
}

.hero, .st-hero {
    padding-block: clamp(3rem, 6vw, 5.5rem);
    background: var(--color-navy);
    color: var(--color-surface);
}

.hero p {
    max-width: 48rem;
    color: #c7d9e9;
}

.hero-compact {
    padding-block: var(--space-10);
}

.st-hero {
    text-align: center;
    background: linear-gradient(135deg, var(--color-deep), #103b5b);
}

.st-hero p {
    max-width: 41rem;
    margin: var(--space-4) auto 0;
    color: #c7d9e9;
}

.st-products {
    padding-block: clamp(3rem, 6vw, 4.5rem);
    min-height: 22rem;
    color: white;
    background: var(--color-deep);
}

.st-products h2 {
    margin-bottom: var(--space-6);
}

.product-grid, .category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-6);
}

.article-content {
    max-width: 56rem;
    overflow-wrap: anywhere;
}

.st-footer {
    background: var(--color-deep);
    border-top: 1px solid #24364b;
    color: #b8c9d9;
}

.st-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-3) var(--space-6);
    padding-block: var(--space-6);
    font-size: 0.875rem;
}

.st-footer p {
    margin: 0;
}


/* 5. Navigation */
.st-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background: var(--color-navy);
    border-bottom: 1px solid #24364b;
    box-shadow: 0 4px 18px rgb(0 0 0 / 15%);
}

.st-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    padding-block: var(--space-4);
}

.st-brand {
    min-width: 0;
}

.st-brand-link {
    display: block;
    text-decoration: none;
    color: white;
}

.st-brand-name {
    display: block;
    font-size: 1.625rem;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.st-brand-link p {
    margin: 0.3rem 0 0;
    font-size: 0.75rem;
    color: #86ddff;
    letter-spacing: 0.06em;
}

.st-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.st-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.625rem var(--space-3);
    border-radius: 0.5rem;
    color: #eaf4ff;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    transition: background 0.2s, color 0.2s;
}

.st-nav a:hover, .st-nav a.active {
    color: var(--color-accent);
    background: rgb(79 195 247 / 10%);
}

.st-menu-toggle {
    display: none;
    flex: 0 0 2.75rem;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid #55708d;
    border-radius: 0.625rem;
    background: #102b49;
    color: white;
    font-size: 1.5rem;
}


/* 6. Buttons */
.product-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 2.75rem;
    max-width: 100%;
    padding: 0.625rem var(--space-4);
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: var(--color-navy);
    color: white;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: background 0.2s;
}

.product-button:hover, .product-button[aria-current="page"] {
    background: var(--color-accent-strong);
    color: white;
}

.product-button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.product-card .product-button {
    margin-top: var(--space-3);
    align-self: flex-start;
}


/* 7. Cards and images */
.product-card, .category-card, .st-card {
    min-width: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card, .category-card {
    padding: var(--space-6);
}

.product-card:hover, .category-card:hover, .st-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgb(15 23 42 / 8%);
}

.product-card p, .category-card p {
    color: var(--color-muted);
}

.product-card h3 a, .st-card h3 a {
    color: inherit;
}

.category-card a {
    font-weight: 700;
}

.product-thumbnail {
    width: 100%;
    height: 11.25rem;
    object-fit: contain;
    margin-bottom: var(--space-4);
}

.product-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: clamp(14rem, 30vw, 20rem);
    background: #f3f4f6;
    border-radius: var(--radius);
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    padding: var(--space-4);
    object-fit: contain;
}

.offer-row {
    margin-top: var(--space-4);
    padding-block: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.offer-row:last-child {
    padding-bottom: 0;
}

.offer-card {
    margin-top: var(--space-4);
}

.st-card {
    background: var(--color-card-dark);
    border-color: #253e59;
    color: white;
}

.st-card img {
    width: 100%;
    height: 13.75rem;
    object-fit: contain;
    background: white;
}

.st-card-body {
    padding: var(--space-6);
}

.st-card p, .st-empty {
    color: #b8c9d9;
}

.st-category {
    display: inline-block;
    margin-bottom: var(--space-2);
    color: var(--color-accent);
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
}


/* 8. Forms */
.admin-form {
    display: grid;
    gap: var(--space-3);
    width: 100%;
    max-width: 44rem;
    margin-top: var(--space-6);
}

.admin-form label {
    font-weight: 700;
    margin-top: var(--space-2);
}

.admin-form input:not([type="checkbox"]):not([type="hidden"]), .admin-form textarea, .admin-form select {
    width: 100%;
    min-width: 0;
    min-height: 2.75rem;
    padding: var(--space-3);
    border: 1px solid #64748b;
    border-radius: 0.5rem;
    background: white;
    color: var(--color-text);
    font-size: 1rem;
}

.admin-form textarea {
    resize: vertical;
    min-height: 6rem;
}

.admin-form p {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.9375rem;
}

.admin-form .product-button {
    justify-self: start;
    margin-top: var(--space-3);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 2.75rem;
    padding-block: var(--space-2);
}

.checkbox-row input {
    flex: 0 0 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    accent-color: var(--color-accent-strong);
}

.current-product-image p {
    margin-bottom: var(--space-2);
    font-weight: 700;
}

.current-product-image img {
    width: 11.25rem;
    height: 11.25rem;
    padding: var(--space-2);
    object-fit: contain;
    background: #f3f4f6;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}


/* 9. Admin components and notices */
.admin-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.admin-nav {
    margin-bottom: var(--space-8);
}

.admin-nav form {
    display: flex;
}

.admin-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.admin-table {
    width: 100%;
    min-width: 40rem;
    border-collapse: collapse;
    background: white;
    border: 1px solid var(--color-border);
}

.admin-table caption {
    padding-block: var(--space-3);
    color: var(--color-muted);
    text-align: left;
    font-weight: 700;
}

.admin-table th, .admin-table td {
    padding: var(--space-3) var(--space-4);
    min-width: 6.5rem;
    max-width: 22rem;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
    border-bottom: 1px solid var(--color-border);
}

.admin-table th {
    background: #edf3f8;
    font-weight: 700;
    white-space: nowrap;
}

.admin-table th:first-child, .admin-table td:first-child {
    min-width: 3rem;
}

.admin-table td:nth-child(2) {
    min-width: 14rem;
}

.admin-table td:last-child {
    min-width: 9rem;
}

.admin-table tbody tr:hover {
    background: #f3f7fb;
}

.admin-table .table-url {
    min-width: 16rem;
    max-width: 16.25rem;
}

.admin-action-link, .admin-delete-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    font-weight: 700;
}

.admin-delete-link {
    color: var(--color-danger);
}

.affiliate-notice {
    padding: var(--space-4);
    margin-block: var(--space-4);
    border: 1px solid #8dd8e5;
    border-radius: 0.5rem;
    background: #ecfeff;
    color: #164e63;
    font-size: 0.9375rem;
}

.product-card .affiliate-notice {
    color: #164e63;
}


/* 10. Responsive breakpoints */
@media (max-width: 900px) {
    .product-grid, .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .st-header-inner {
        flex-wrap: wrap;
        gap: var(--space-3);
    }

    .st-menu-toggle {
        display: flex;
        margin-left: auto;
    }

    .st-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        padding-top: var(--space-3);
        border-top: 1px solid #24364b;
    }

    .st-nav.open {
        display: flex;
    }

    .st-nav a {
        width: 100%;
        font-size: 1rem;
    }

}

@media (max-width: 600px) {
    .product-grid, .category-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-4);
    }

    .page-section {
        padding-block: var(--space-8) var(--space-10);
    }

    .hero-compact {
        padding-block: var(--space-8);
    }

    .st-brand-name {
        font-size: 1.4375rem;
    }

    .product-card, .category-card, .st-card-body {
        padding: var(--space-4);
    }

    .st-footer-inner {
        flex-direction: column;
    }

}

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

    .product-card:hover, .category-card:hover, .st-card:hover {
        transform: none;
    }

}


/* 11. Utilities */
.mt-6 {
    margin-top: var(--space-6);
}

.mt-10 {
    margin-top: var(--space-10);
}

.text-pre-line {
    white-space: pre-line;
}

.text-pre-wrap {
    white-space: pre-wrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 1100;
    padding: var(--space-3) var(--space-4);
    border-radius: 0.5rem;
    background: white;
    color: var(--color-navy);
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: translateY(0);
}
