/*! Rootsy Market™, All rights reserved. Unauthorized reproduction prohibited. */

/* ═══════════════════════════════════════════
   GLOBAL: Smooth, relaxed experience
   ═══════════════════════════════════════════ */

html {
    scroll-behavior: smooth;
}

body {
    background-color: #f7f5f0;
    position: relative;
}

/* ═══════════════════════════════════════════
   PAPER GRAIN: Light, warm fiber texture overlay
   Sits behind page content, above the body color.
   ═══════════════════════════════════════════ */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
    mix-blend-mode: multiply;
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.34  0 0 0 0 0.24  0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
        radial-gradient(ellipse at 50% 0%, rgba(255, 251, 240, 0.55), transparent 60%);
    background-size: 220px 220px, 100% 100%;
}
body > * {
    position: relative;
    z-index: 1;
}

/* ═══════════════════════════════════════════
   SOFT DROP SHADOW: All text input fields get a
   gentle, warm shadow so they feel like cards on paper.
   ═══════════════════════════════════════════ */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
    box-shadow: 0 1px 3px rgba(85, 66, 48, 0.08),
                0 2px 8px rgba(85, 66, 48, 0.06);
    background-color: #fffdf8;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
    box-shadow: 0 2px 6px rgba(85, 66, 48, 0.12),
                0 4px 14px rgba(85, 66, 48, 0.10),
                0 0 0 3px rgba(149, 130, 100, 0.18);
    outline: none;
}

/* ═══════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════ */

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ═══════════════════════════════════════════
   SCROLLBAR: Earthy tones
   ═══════════════════════════════════════════ */

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

::-webkit-scrollbar-track {
    background: #ede8df;
}

::-webkit-scrollbar-thumb {
    background: #b5996f;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a6855a;
}

/* ═══════════════════════════════════════════
   FOCUS & ACCESSIBILITY
   ═══════════════════════════════════════════ */

.focus-visible\:ring-2:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #7a8c7a;
}

/* ═══════════════════════════════════════════
   ANIMATIONS: Slow, smooth, intentional
   ═══════════════════════════════════════════ */

.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 350ms;
}

@keyframes gentleFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gentleFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-fade-up {
    animation: gentleFadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.animate-fade-in {
    animation: gentleFadeIn 0.6s ease both;
}

.animate-delay-1 {
    animation-delay: 0.1s;
}

.animate-delay-2 {
    animation-delay: 0.2s;
}

.animate-delay-3 {
    animation-delay: 0.3s;
}

.animate-delay-4 {
    animation-delay: 0.4s;
}

/* ═══════════════════════════════════════════
   HOVER EFFECTS: Gentle, natural
   ═══════════════════════════════════════════ */

.hover-lift {
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(85, 66, 48, 0.1);
}

/* ═══════════════════════════════════════════
   HTMX
   ═══════════════════════════════════════════ */

.htmx-request {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 400ms ease-in;
}

/* ═══════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════ */

.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    padding: 0.75rem 1.25rem;
    border-radius: 1rem;
    color: white;
    font-weight: 600;
    animation: slideIn 400ms cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.toast.success {
    background-color: #5f715f;
}

.toast.error {
    background-color: #b45555;
}

.toast.info {
    background-color: #5a7a8a;
}

@keyframes slideIn {
    from {
        transform: translateX(100%) translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateX(0) translateY(0);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════
   FORMS: Soft, organic inputs
   ═══════════════════════════════════════════ */

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #554230;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd2bf;
    border-radius: 0.75rem;
    background-color: #faf8f5;
    transition: border-color 350ms ease, box-shadow 350ms ease;
}

.form-input:focus {
    outline: none;
    border-color: #7a8c7a;
    box-shadow: 0 0 0 3px rgba(122, 140, 122, 0.15);
}

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

/* ═══════════════════════════════════════════
   BUTTONS: Calm, soft, natural feel
   ═══════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 0.75rem;
    transition: all 350ms cubic-bezier(0.22, 1, 0.36, 1);
    cursor: pointer;
    border: none;
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(85, 66, 48, 0.15), 0 1px 3px rgba(85, 66, 48, 0.1);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #5f715f;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #4a584a;
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 6px 20px rgba(95, 113, 95, 0.25);
}

.btn-secondary {
    background-color: transparent;
    color: #554230;
    border: 1.5px solid #ddd2bf;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #f7f5f0;
    border-color: #c8b596;
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════
   CARDS: Resting naturally with soft shadows
   ═══════════════════════════════════════════ */

.card {
    background-color: #fdfcfa;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(85, 66, 48, 0.06), 0 1px 3px rgba(85, 66, 48, 0.04);
    border: 1px solid rgba(200, 181, 150, 0.25);
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.card:hover {
    box-shadow: 0 8px 28px rgba(85, 66, 48, 0.1), 0 2px 6px rgba(85, 66, 48, 0.06);
    transform: translateY(-2px);
}

/* ═══════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(45, 36, 25, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background-color: #fdfcfa;
    border-radius: 1.25rem;
    box-shadow: 0 20px 40px rgba(85, 66, 48, 0.15);
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    max-width: 48rem;
}

/* ═══════════════════════════════════════════
   TAGS
   ═══════════════════════════════════════════ */

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tag.category {
    background-color: #fef3c7;
    color: #92681b;
}

.tag.attribute {
    background-color: #e3e7e3;
    color: #3e493e;
}

.tag.impact {
    background-color: #dbeafe;
    color: #2b5ea7;
}

/* ═══════════════════════════════════════════
   PRODUCT GRID
   ═══════════════════════════════════════════ */

@media (max-width: 640px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ═══════════════════════════════════════════
   LOADING SPINNER
   ═══════════════════════════════════════════ */

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #ede8df;
    border-top: 2px solid #5f715f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════
   PROSE
   ═══════════════════════════════════════════ */

.prose {
    color: #554230;
    line-height: 1.8;
}

.prose p {
    margin-bottom: 1rem;
}

.prose h1,
.prose h2,
.prose h3 {
    color: #3d2e1f;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.prose ul,
.prose ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.prose li {
    margin-bottom: 0.5rem;
}

.prose a {
    color: #5f715f;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.prose a:hover {
    color: #4a584a;
}

/* ═══════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════ */

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

@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }

    .btn-primary {
        background-color: #000;
        color: #fff;
    }

    .btn-primary:hover {
        background-color: #333;
    }
}

/* ═══════════════════════════════════════════
   ICON HELPERS
   ═══════════════════════════════════════════ */

.icon-xs {
    width: 12px;
    height: 12px;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

.icon-md {
    width: 24px;
    height: 24px;
}

.icon-lg {
    width: 32px;
    height: 32px;
}

.icon-xl {
    width: 48px;
    height: 48px;
}

.icon-2xl {
    width: 64px;
    height: 64px;
}

.icon-inline {
    display: inline-block;
    vertical-align: middle;
}

.icon-flex {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ═══════════════════════════════════════════
   HEADER & FOOTER: Nature backgrounds
   ═══════════════════════════════════════════ */

.rootsy-header {
    position: relative;
    background: linear-gradient(135deg, #e8e4dc 0%, #ddd8cc 50%, #d4cfc3 100%);
    overflow: hidden;
    isolation: isolate;
}

.rootsy-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/static/images/header-nature.png') center/cover no-repeat;
    opacity: 0.15;
    z-index: -1;
}

.rootsy-footer {
    position: relative;
    background: linear-gradient(135deg, #d4cfc3 0%, #c8c1b3 50%, #bdb5a5 100%);
    overflow: hidden;
    isolation: isolate;
}

.rootsy-footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/static/images/footer-nature.png') center/cover no-repeat;
    opacity: 0.12;
    z-index: -1;
}

/* ═══════════════════════════════════════════
   SECTION BACKGROUNDS: Warm, not harsh white
   ═══════════════════════════════════════════ */

.section-warm {
    background-color: #faf8f5;
}

.section-cream {
    background-color: #f5f1ea;
}

.section-mist {
    background-color: #f0ede6;
}

/* ═══════════════════════════════════════════
   WARM BACKGROUND OVERRIDES: Earthy everywhere
   Signature values injected via rootsy-env.js
   ═══════════════════════════════════════════ */

/* ═══════════════════════════════════════════
   CONSISTENT CARD STYLING: Warm borders + lift
   ═══════════════════════════════════════════ */

.rounded-xl,
.rounded-2xl {
    border-radius: 1rem;
}

.rounded-xl[class*="shadow"],
.rounded-2xl[class*="shadow"],
.rounded-lg[class*="shadow"] {
    border: 1px solid rgba(200, 181, 150, 0.2);
}

/* ═══════════════════════════════════════════
   COMMUNITY PAGE FIX: Contained text, clear cards
   ═══════════════════════════════════════════ */

.min-h-screen.bg-sage-50 {
    background: linear-gradient(180deg, #f6f7f6 0%, #f0ede6 100%) !important;
}

.min-h-screen.bg-sage-50 .bg-white.rounded-xl {
    border: 1px solid rgba(162, 176, 162, 0.25) !important;
    overflow: hidden;
}

.min-h-screen.bg-sage-50 .bg-white.rounded-xl p,
.min-h-screen.bg-sage-50 .bg-white.rounded-xl h2,
.min-h-screen.bg-sage-50 .bg-white.rounded-xl h3,
.min-h-screen.bg-sage-50 .bg-white.rounded-xl div {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* ═══════════════════════════════════════════
   GLOBAL TEXT CONTAINMENT: Prevent overflow
   ═══════════════════════════════════════════ */

[class*="rounded"][class*="shadow"] p,
[class*="rounded"][class*="shadow"] h1,
[class*="rounded"][class*="shadow"] h2,
[class*="rounded"][class*="shadow"] h3,
[class*="rounded"][class*="shadow"] h4 {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* ═══════════════════════════════════════════
   GLOBAL INPUT WARMTH: Earthy focus rings
   ═══════════════════════════════════════════ */

input:focus,
select:focus,
textarea:focus {
    border-color: #7a8c7a !important;
    box-shadow: 0 0 0 3px rgba(122, 140, 122, 0.15) !important;
    outline: none !important;
}

input,
select,
textarea {
    background-color: #faf8f5 !important;
    border-color: #ddd2bf !important;
    transition: border-color 350ms ease, box-shadow 350ms ease !important;
}

input[type="checkbox"],
input[type="radio"] {
    background-color: #fdfcfa !important;
}

/* ═══════════════════════════════════════════
   GRADIENT HERO WARMTH: Earthy hero sections
   ═══════════════════════════════════════════ */

[class*="bg-gradient-to"][class*="from-sage-600"] {
    position: relative;
}

[class*="bg-gradient-to"][class*="from-sage-600"]::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 120%, rgba(182, 155, 111, 0.08), transparent 70%);
    pointer-events: none;
}

/* ═══════════════════════════════════════════
   ROUNDED OVERRIDES: Softer everywhere
   ═══════════════════════════════════════════ */

input,
select,
textarea,
button,
.rounded-lg {
    border-radius: 0.75rem;
}

table {
    border-radius: 1rem;
    overflow: hidden;
}

img {
    border-radius: 0.5rem;
}

/* ═══════════════════════════════════════════
   SOFT SHADOWS: Injected via rootsy-env.js
   ═══════════════════════════════════════════ */

/* ═══════════════════════════════════════════
   SCROLL-TRIGGERED FADE-IN
   ═══════════════════════════════════════════ */

.scroll-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ═══════════════════════════════════════════
   LINK HOVER: Subtle, organic
   ═══════════════════════════════════════════ */

a {
    transition: color 0.3s ease, opacity 0.3s ease;
}

a:hover {
    opacity: 0.85;
}

/* ═══════════════════════════════════════════
   GENTLE BUTTON HOVER (global)
   ═══════════════════════════════════════════ */

button:not(.edit-btn):not(#mobile-menu-button):not(#mobile-gear-button),
[role="button"],
a.inline-flex,
a[class*="px-"][class*="py-"][class*="rounded"] {
    box-shadow: 0 4px 12px rgba(85, 66, 48, 0.18), 0 2px 4px rgba(85, 66, 48, 0.12) !important;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

button:not(.edit-btn):not(#mobile-menu-button):not(#mobile-gear-button):hover,
[role="button"]:hover,
a.inline-flex:hover,
a[class*="px-"][class*="py-"][class*="rounded"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(85, 66, 48, 0.22), 0 3px 6px rgba(85, 66, 48, 0.14) !important;
}