/*
 * astro-dharma: a traditional Indian astrologer look.
 *
 * Palette: ivory/sandal paper, kumkum-saffron primary, deep maroon "night" panels
 * and antique gold ornaments. Heading font is Cinzel, body is Mukta (it carries
 * Devanagari as well), and Noto Serif Devanagari is used for the Sanskrit accents.
 *
 * Built on the shared token base; everything below the import overrides tokens or
 * adds the dh-* decorative utilities used by src/tenant/templates/astro-dharma.
 */
@import url("./index.css");
@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@400..900&family=Mukta:wght@300;400;500;600;700&family=Noto+Serif+Devanagari:wght@400;500;600;700&display=swap");

:root {
    --background: oklch(0.975 0.022 85); /* ivory / sandal paper */
    --foreground: oklch(0.27 0.07 calc(var(--primary-h) - 17)); /* deep maroon-brown ink */
    --card: oklch(0.99 0.014 88);
    --card-foreground: oklch(0.27 0.07 calc(var(--primary-h) - 17));
    --popover: oklch(0.99 0.014 88);
    --popover-foreground: oklch(0.27 0.07 calc(var(--primary-h) - 17));

    /* kumkum saffron. --primary itself is assembled from these three numbers by
       index.css, so the tenant's primary-colour preset (data-primary-color) can
       override them. Never set --primary directly here. */
    --primary-h: 42;
    --primary-c: 0.19;
    --primary-l: 0.58;
    --primary-foreground: oklch(0.99 0.012 88);
    --secondary: oklch(0.94 0.045 85);
    --secondary-foreground: oklch(0.32 0.08 calc(var(--primary-h) - 14));
    --muted: oklch(0.95 0.03 85);
    --muted-foreground: oklch(0.46 0.045 calc(var(--primary-h) - 7));
    --accent: oklch(0.9 0.09 88); /* marigold wash */
    --accent-foreground: oklch(0.32 0.08 calc(var(--primary-h) - 14));
    --destructive: oklch(0.55 0.22 27);
    --destructive-foreground: oklch(1 0 0);
    --border: oklch(0.86 0.06 82);
    --input: oklch(0.86 0.06 82);
    --ring: var(--primary);

    --chart-1: var(--primary);
    --chart-2: oklch(0.72 0.15 80);
    --chart-3: oklch(0.42 0.14 25);
    --chart-4: oklch(0.65 0.14 55);
    --chart-5: oklch(0.34 0.1 25);

    --sidebar: oklch(0.96 0.03 85);
    --sidebar-foreground: oklch(0.27 0.07 calc(var(--primary-h) - 17));
    --sidebar-accent: oklch(0.9 0.09 88);
    --sidebar-accent-foreground: oklch(0.32 0.08 calc(var(--primary-h) - 14));
    --sidebar-border: oklch(0.86 0.06 82);
    --sidebar-ring: var(--primary);

    /* template-only tokens */
    /* Accent metals and deep panel colours are derived from the primary hue, so a
       primary-colour preset recolours them too. With the default saffron (hue 42)
       they come out as antique gold (hue 82) and temple maroon (hue 22). */
    --accent-h: calc(var(--primary-h) + 40);
    --gold: oklch(0.7 0.125 var(--accent-h));
    --gold-soft: oklch(0.84 0.1 var(--accent-h));
    --maroon: oklch(0.29 0.095 calc(var(--primary-h) - 20));
    --maroon-deep: oklch(0.21 0.07 calc(var(--primary-h) - 20));

    --font-heading: "Cinzel", "Noto Serif Devanagari", serif;
    --font-sans: "Mukta", "Noto Serif Devanagari", sans-serif;
    --font-deva: "Noto Serif Devanagari", "Tiro Devanagari Hindi", serif;
    --radius: 0.75rem; /* overridden by the tenant corner-style preset */
    --shadow-color: oklch(0.3 0.08 calc(var(--primary-h) - 17));
}

/* Night variant: used for the whole site when the tenant picks dark mode, and
   for the maroon panels (services, CTA, footer) via .dh-night in light mode. */
.dark {
    --primary-l: 0.68;
    --primary-c: 0.18;
    --primary-foreground: var(--maroon-deep);
}

.dark,
.dh-night {
    --background: oklch(0.22 0.07 calc(var(--primary-h) - 20));
    --foreground: oklch(0.95 0.035 88);
    --card: oklch(0.27 0.085 calc(var(--primary-h) - 20));
    --card-foreground: oklch(0.95 0.035 88);
    --popover: oklch(0.27 0.085 calc(var(--primary-h) - 20));
    --popover-foreground: oklch(0.95 0.035 88);
    --secondary: oklch(0.32 0.09 calc(var(--primary-h) - 20));
    --secondary-foreground: oklch(0.95 0.035 88);
    --muted: oklch(0.27 0.08 calc(var(--primary-h) - 20));
    --muted-foreground: oklch(0.8 0.05 82);
    --accent: oklch(0.36 0.1 calc(var(--primary-h) - 12));
    --accent-foreground: oklch(0.92 0.09 88);
    --border: oklch(0.45 0.09 calc(var(--primary-h) + 13));
    --input: oklch(0.45 0.09 calc(var(--primary-h) + 13));
    --ring: var(--primary);
    --gold: oklch(0.8 0.13 var(--accent-h));
    --gold-soft: oklch(0.88 0.09 var(--accent-h));
}

/* Maroon panels inside a light page: keep the tenant's hue/chroma but make sure
   the primary is light enough to read on maroon. */
.dh-night {
    --primary: oklch(max(var(--primary-l), 0.66) var(--primary-c) var(--primary-h));
    --primary-foreground: var(--maroon-deep);
    background-color: var(--background);
    color: var(--foreground);
}

body {
    font-family: var(--font-sans);
}

.font-deva {
    font-family: var(--font-deva);
}

/* ---------- decorative utilities ---------- */

/* Jaali (lattice) texture. The SVG is only a mask; the colour comes from the
   theme tokens, so it follows the tenant's primary colour. Use it on an empty
   absolutely-positioned layer. */
.dh-jaali {
    background-color: var(--primary);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cpath d='M32 2 62 32 32 62 2 32z' fill='none' stroke='%23000' stroke-opacity='.22'/%3E%3Cpath d='M32 14 50 32 32 50 14 32z' fill='none' stroke='%23000' stroke-opacity='.15'/%3E%3Ccircle cx='32' cy='32' r='2.2' fill='%23000' fill-opacity='.28'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cpath d='M32 2 62 32 32 62 2 32z' fill='none' stroke='%23000' stroke-opacity='.22'/%3E%3Cpath d='M32 14 50 32 32 50 14 32z' fill='none' stroke='%23000' stroke-opacity='.15'/%3E%3Ccircle cx='32' cy='32' r='2.2' fill='%23000' fill-opacity='.28'/%3E%3C/svg%3E");
    -webkit-mask-size: 64px 64px;
    mask-size: 64px 64px;
}

.dh-night .dh-jaali {
    background-color: var(--gold);
}

/* Double gold frame (a thin inner and a thicker outer line) with corner studs */
.dh-frame {
    position: relative;
    border: 1px solid color-mix(in oklab, var(--gold) 80%, transparent);
    outline: 1px solid color-mix(in oklab, var(--gold) 45%, transparent);
    outline-offset: 4px;
}

.dh-frame::before,
.dh-frame::after {
    content: "";
    position: absolute;
    width: 9px;
    height: 9px;
    background: var(--gold);
    transform: rotate(45deg);
    top: -5px;
    left: -5px;
}

.dh-frame::after {
    top: auto;
    left: auto;
    bottom: -5px;
    right: -5px;
}

/* Arched (jharokha) window shape */
.dh-arch {
    border-top-left-radius: 999px;
    border-top-right-radius: 999px;
}

/* Soft glow for gold elements */
.dh-glow {
    box-shadow: 0 10px 40px -12px color-mix(in oklab, var(--primary) 55%, transparent),
        0 0 0 1px color-mix(in oklab, var(--gold) 50%, transparent);
}

@keyframes dh-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes dh-spin-rev {
    to {
        transform: rotate(-360deg);
    }
}

@keyframes dh-rise {
    from {
        opacity: 0;
        transform: translateY(22px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes dh-flicker {
    0%,
    100% {
        opacity: 0.85;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.06);
    }
}

.dh-spin {
    animation: dh-spin 140s linear infinite;
    transform-origin: center;
}

.dh-spin-rev {
    animation: dh-spin-rev 90s linear infinite;
    transform-origin: center;
}

.dh-rise {
    opacity: 0;
    animation: dh-rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.dh-flicker {
    animation: dh-flicker 3.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .dh-spin,
    .dh-spin-rev,
    .dh-flicker {
        animation: none;
    }
    .dh-rise {
        animation: none;
        opacity: 1;
    }
}
