/* =========================================================
   GRIHIKA Storefront
   Global Foundation
   ========================================================= */


/* =========================================================
   1. Design Tokens
   ========================================================= */

:root {
    /* -----------------------------------------------------
       Brand Palette
       ----------------------------------------------------- */

    --color-primary: #283E4C;
    --color-secondary: #757C8D;
    --color-taupe: #A68F83;
    --color-mauve: #AE898F;
    --color-rose: #8F6D6E;

    /* -----------------------------------------------------
       Brand RGB
       Useful for transparent states
       ----------------------------------------------------- */

    --color-primary-rgb: 40, 62, 76;
    --color-secondary-rgb: 117, 124, 141;
    --color-taupe-rgb: 166, 143, 131;
    --color-mauve-rgb: 174, 137, 143;
    --color-rose-rgb: 143, 109, 110;

    /* -----------------------------------------------------
       Text
       ----------------------------------------------------- */

    --text-primary: #283E4C;
    --text-secondary: #5F6974;
    --text-muted: #7D838C;
    --text-soft: #979BA2;
    --text-inverse: #FFFFFF;

    /* -----------------------------------------------------
       Backgrounds
       ----------------------------------------------------- */

    --surface-page: #FAF9F8;
    --surface-primary: #FFFFFF;
    --surface-secondary: #F6F3F1;
    --surface-tertiary: #F2F1F3;

    --surface-primary-soft: rgba(var(--color-primary-rgb), 0.06);
    --surface-secondary-soft: rgba(var(--color-secondary-rgb), 0.08);
    --surface-taupe-soft: rgba(var(--color-taupe-rgb), 0.10);
    --surface-mauve-soft: rgba(var(--color-mauve-rgb), 0.10);
    --surface-rose-soft: rgba(var(--color-rose-rgb), 0.10);

    /* -----------------------------------------------------
       Borders
       ----------------------------------------------------- */

    --border-subtle: #ECE9E7;
    --border-default: #DDD9D7;
    --border-strong: #C7C2C0;

    /* -----------------------------------------------------
       Semantic Status
       ----------------------------------------------------- */

    --status-success: #587568;
    --status-success-soft: #EDF4F0;

    --status-warning: #A67C52;
    --status-warning-soft: #FBF4EA;

    --status-danger: #9A5D60;
    --status-danger-soft: #F8EEEE;

    --status-info: #667D8E;
    --status-info-soft: #EEF2F5;

    /* -----------------------------------------------------
       Typography
       ----------------------------------------------------- */

    --font-primary: "Inter", "Hind Siliguri", sans-serif;
    --font-bangla: "Hind Siliguri", "Inter", sans-serif;

    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-md: 1.0625rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;

    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --line-height-tight: 1.2;
    --line-height-heading: 1.3;
    --line-height-base: 1.6;
    --line-height-relaxed: 1.75;

    /* -----------------------------------------------------
       Spacing
       ----------------------------------------------------- */

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-7: 1.75rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-14: 3.5rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* -----------------------------------------------------
       Radius
       ----------------------------------------------------- */

    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-2xl: 28px;
    --radius-pill: 999px;

    /* -----------------------------------------------------
       Shadows
       ----------------------------------------------------- */

    --shadow-xs:
        0 1px 2px rgba(40, 62, 76, 0.04);

    --shadow-sm:
        0 2px 8px rgba(40, 62, 76, 0.06);

    --shadow-md:
        0 8px 24px rgba(40, 62, 76, 0.08);

    --shadow-lg:
        0 18px 48px rgba(40, 62, 76, 0.11);

    /* -----------------------------------------------------
       Motion
       ----------------------------------------------------- */

    --transition-fast: 140ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* -----------------------------------------------------
       Layout
       ----------------------------------------------------- */

    --shell-max-width: 1280px;
    --shell-gutter-desktop: 40px;
    --shell-gutter-tablet: 32px;
    --shell-gutter-mobile: 28px;

    --header-z-index: 1000;
    --overlay-z-index: 1100;
    --modal-z-index: 1200;
}


/* =========================================================
   2. Reset
   ========================================================= */

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

html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;

    background: var(--surface-page);
    color: var(--text-primary);

    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-base);

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.storefront {
    overflow-x: hidden;
}

img,
picture,
svg,
video,
canvas {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

button,
input,
select,
textarea {
    margin: 0;
    font: inherit;
    color: inherit;
}

button {
    border: 0;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button,
[role="button"] {
    cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
}

a {
    color: inherit;
    text-decoration: none;
}

ul,
ol {
    margin-block: 0;
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}


/* =========================================================
   3. Typography
   ========================================================= */

h1,
h2,
h3,
h4,
h5,
h6,
p {
    margin-top: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-heading);
    text-wrap: balance;
}

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

h2 {
    font-size: clamp(1.75rem, 3vw, var(--font-size-4xl));
}

h3 {
    font-size: clamp(1.375rem, 2vw, var(--font-size-2xl));
}

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

p {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

strong,
b {
    font-weight: var(--font-weight-semibold);
}

small {
    font-size: var(--font-size-sm);
}


/* =========================================================
   4. Global Layout
   ========================================================= */

.shell {
    width: min(
        calc(100% - var(--shell-gutter-desktop)),
        var(--shell-max-width)
    );
    margin-inline: auto;
}

.storefront-main {
    min-height: 60vh;
}

.section {
    padding-block: var(--space-16);
}

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

.section--spacious {
    padding-block: var(--space-20);
}


/* =========================================================
   5. Global Surface Helpers
   ========================================================= */

.surface {
    background: var(--surface-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.surface--soft {
    background: var(--surface-secondary);
}

.surface--elevated {
    background: var(--surface-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}


/* =========================================================
   6. Global Form Foundation
   ========================================================= */

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--surface-primary);
    outline: none;

    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-soft);
    opacity: 1;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary);
    box-shadow:
        0 0 0 3px rgba(var(--color-primary-rgb), 0.12);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--surface-secondary);
    color: var(--text-muted);
    opacity: 0.7;
}


/* =========================================================
   7. Focus Accessibility
   ========================================================= */

:focus {
    outline: none;
}

:focus-visible {
    outline: 3px solid rgba(var(--color-primary-rgb), 0.32);
    outline-offset: 3px;
}

a:focus-visible,
button:focus-visible {
    border-radius: var(--radius-xs);
}


/* =========================================================
   8. Skip Link
   ========================================================= */

.skip-link {
    position: fixed;
    top: var(--space-3);
    left: var(--space-3);
    z-index: 9999;

    padding: 0.7rem 1rem;

    background: var(--color-primary);
    color: var(--text-inverse);

    border-radius: var(--radius-sm);

    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);

    box-shadow: var(--shadow-md);

    transform: translateY(-160%);
    transition: transform var(--transition-fast);
}

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


/* =========================================================
   9. Visually Hidden
   ========================================================= */

.visually-hidden {
    position: absolute !important;

    width: 1px !important;
    height: 1px !important;

    padding: 0 !important;
    margin: -1px !important;

    overflow: hidden !important;

    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;

    white-space: nowrap !important;

    border: 0 !important;
}


/* =========================================================
   10. Django Messages
   ========================================================= */

.storefront-messages {
    display: grid;
    gap: var(--space-3);

    padding-top: var(--space-5);
}

.storefront-message {
    padding: 0.875rem 1rem;

    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);

    background: var(--surface-primary);
    color: var(--text-primary);

    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);

    box-shadow: var(--shadow-xs);
}

.storefront-message--success {
    border-color: rgba(88, 117, 104, 0.24);
    background: var(--status-success-soft);
    color: var(--status-success);
}

.storefront-message--warning {
    border-color: rgba(166, 124, 82, 0.24);
    background: var(--status-warning-soft);
    color: var(--status-warning);
}

.storefront-message--error,
.storefront-message--danger {
    border-color: rgba(154, 93, 96, 0.24);
    background: var(--status-danger-soft);
    color: var(--status-danger);
}

.storefront-message--info {
    border-color: rgba(102, 125, 142, 0.24);
    background: var(--status-info-soft);
    color: var(--status-info);
}


/* =========================================================
   11. Selection
   ========================================================= */

::selection {
    background: rgba(var(--color-mauve-rgb), 0.30);
    color: var(--color-primary);
}


/* =========================================================
   12. Scrollbar
   ========================================================= */

@media (pointer: fine) {
    * {
        scrollbar-width: thin;
        scrollbar-color:
            rgba(var(--color-secondary-rgb), 0.52)
            transparent;
    }

    *::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    *::-webkit-scrollbar-track {
        background: transparent;
    }

    *::-webkit-scrollbar-thumb {
        background: rgba(var(--color-secondary-rgb), 0.42);
        border-radius: var(--radius-pill);
    }

    *::-webkit-scrollbar-thumb:hover {
        background: rgba(var(--color-secondary-rgb), 0.64);
    }
}


/* =========================================================
   13. Reduced Motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* =========================================================
   14. Tablet
   ========================================================= */

@media (max-width: 1024px) {
    .shell {
        width: min(
            calc(100% - var(--shell-gutter-tablet)),
            var(--shell-max-width)
        );
    }

    .section {
        padding-block: var(--space-14);
    }

    .section--spacious {
        padding-block: var(--space-16);
    }
}


/* =========================================================
   15. Mobile
   ========================================================= */

@media (max-width: 720px) {
    :root {
        --shell-gutter-mobile: 28px;
    }

    body {
        font-size: 15px;
    }

    .shell {
        width: min(
            calc(100% - var(--shell-gutter-mobile)),
            var(--shell-max-width)
        );
    }

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

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

    .section--spacious {
        padding-block: var(--space-12);
    }

    .storefront-messages {
        padding-top: var(--space-4);
    }

    .storefront-message {
        padding: 0.8rem 0.9rem;
    }
}


/* =========================================================
   16. Small Mobile
   ========================================================= */

@media (max-width: 420px) {
    :root {
        --shell-gutter-mobile: 24px;
    }
}