/* KSM × TECH / BASE STYLES — Vrindavan system
   Structural layout: container, header, nav, footer.
   Tokens come from vrindavan.css registers. */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    background: var(--ground, #F4EBD9);
    color: var(--text-soft, #4A403A);
    font-family: var(--ui, 'Yantramanav', system-ui, sans-serif);
    font-weight: 400;
    line-height: 1.6;
    font-size: 17px;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-overflow-scrolling: touch;
}

main {
    flex-grow: 1;
}

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

/* Keyboard focus — var(--text) adapts per register (marigold is
   decorative-only on Day at 1.82:1, so it can't carry the ring). */
:focus-visible {
    outline: 2px solid var(--text, #1F1A17);
    outline-offset: 2px;
    border-radius: 2px;
}

a, button, [role="button"], summary { cursor: pointer; touch-action: manipulation; }

/* ─── TACTILE ANALOG MICRO-GRAIN NOISE OVERLAY ─── */
.grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Mobile GPU optimization: remove heavy SVG filter on touch screens to guarantee 60fps scrolling */
@media (max-width: 800px), (hover: none), (pointer: coarse) {
    .grain-overlay {
        display: none !important;
    }
}



/* ─── CONTAINER ──────────────────────────────────────── */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 32px;
    position: relative;
    z-index: 2;
}

@media (max-width: 640px) {
    .container { padding: 0 22px; }
}

/* ─── HEADER ─────────────────────────────────────────── */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 26px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: padding 0.3s var(--ease), background 0.3s var(--ease), border-color 0.3s var(--ease);
    border-bottom: 1px solid transparent;
    animation: slideDown 1s var(--ease) both;
}

/* Day header — solid paper on scroll */
.reg-day .header.scrolled {
    padding: 16px 32px;
    background: #F4EBD9;
    border-bottom-color: #C4A97E;
}

/* Night header — solid indigo on scroll */
.reg-night .header.scrolled {
    padding: 16px 32px;
    background: #1B3A6B;
    border-bottom-color: rgba(232, 163, 61, 0.4);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text, #1F1A17);
    line-height: 1;
}

.logo-mark {
    width: 28px;
    height: 28px;
    color: var(--art-a, var(--terracotta, #B33A2B));
    transition: transform 0.6s var(--ease);
}

.logo:hover .logo-mark { transform: rotate(45deg); }

.logo-text {
    font-family: var(--display);
    font-weight: 800;
    font-size: 19px;
    letter-spacing: 0.01em;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.logo-x {
    color: var(--art-a, var(--terracotta, #B33A2B));
    font-weight: 400;
    font-style: italic;
    font-size: 0.85em;
    margin: 0 2px;
}

.logo-tech { font-weight: 400; }

.nav {
    display: flex;
    align-items: center;
    gap: 40px;
}

.nav a {
    font-family: var(--ui);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted, #6E6259);
    transition: color 0.3s var(--ease);
    position: relative;
    padding: 4px 0;
}

.nav a:hover { color: var(--text, #1F1A17); }

.nav a[aria-current="page"] {
    color: var(--text, #1F1A17);
}

.nav a[aria-current="page"]::after { width: 100%; }

.nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--art-a, var(--terracotta, #B33A2B));
    transition: width 0.4s var(--ease);
}

.nav a:hover::after { width: 100%; }

.nav-cta {
    color: var(--text, #1F1A17) !important;
    border: 1px solid var(--line, #C4A97E);
    padding: 8px 18px !important;
    border-radius: 100px;
    transition: color 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.nav-cta:hover {
    background: var(--text, #1F1A17);
    color: var(--ground, #F4EBD9) !important;
    border-color: var(--text, #1F1A17);
}

.nav-cta::after { display: none; }

@media (max-width: 768px) {
    .header { padding: 18px 22px; }
    .reg-day .header.scrolled,
    .reg-night .header.scrolled { padding: 14px 22px; }
    .nav { gap: 12px; }
    .nav a:not(.nav-cta) { font-size: 12px; letter-spacing: 0.08em; padding: 14px 0; }
    .nav-cta { font-size: 10px; padding: 7px 22px; min-height: 44px; display: inline-flex; align-items: center; }
}


/* ─── COMMON ANIMATIONS ───────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-100%); }
    to { opacity: 1; transform: translateY(0); }
}


/* ─── FOOTER — Night register on studio pages ──────── */
/* Product pages (/byf/, /margadarshak/, /krishna-as-sarathi/)
   keep their own footer styling. This only applies to
   pages using .footer-night class. */

/* On a Night page the footer used to be the same #1B3A6B as the page, so
   the only thing marking the boundary was a 1px hairline — 1.00:1 ground
   against ground. It now sits on --indigo-deep: a real step down, with the
   marigold rule on top of it. No gradient, no shadow (Law 2). */
footer.footer-night {
    position: relative;
    z-index: 2;
    background: var(--indigo-deep, #0E2244);
    padding: 48px 0 36px;
    border-top: none;
    color: var(--paper, #F4EBD9);
}

/* Most pages carry only the one-line .footer-bottom, not the four-column
   grid. The 80px top padding was sized for the grid, so those pages ended
   in ~200px of empty ground above a 59px row. */
footer.footer-night:not(:has(.footer-grid)) {
    padding: 40px 0 32px;
}

footer.footer-night .footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    padding-bottom: 56px;
    position: relative;
}

footer.footer-night .footer-grid::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(232, 163, 61, 0.2);
}

footer.footer-night .footer-grid::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -100%;
    width: 45%;
    height: 1.5px;
    background: linear-gradient(90deg, transparent 0%, rgba(232, 163, 61, 0.2) 20%, rgba(250, 244, 232, 0.95) 50%, rgba(232, 163, 61, 0.2) 80%, transparent 100%);
    animation: yamunaStream 6.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    z-index: 2;
}

@media (max-width: 768px) {
    footer.footer-night .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 36px;
    }
    footer.footer-night .footer-brand { grid-column: 1 / -1; margin-bottom: 8px; }
}

footer.footer-night .footer-logo {
    font-family: var(--display);
    font-weight: 800;
    font-size: 28px;
    color: var(--paper, #F4EBD9);
    margin-bottom: 14px;
    letter-spacing: 0.01em;
}

footer.footer-night .footer-x { color: var(--marigold, #E8A33D); font-weight: 400; font-style: italic; margin: 0 4px; }

footer.footer-night .footer-tagline {
    font-size: 14px;
    color: rgba(244, 235, 217, 0.8);   /* 8.96:1 on --indigo-deep */
    line-height: 1.6;
    max-width: 320px;
}

footer.footer-night .footer-col-title {
    font-family: var(--ui);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--marigold, #E8A33D);
    margin-bottom: 18px;
}

footer.footer-night .footer-col a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: rgba(244, 235, 217, 0.86);
    padding: 6px 0;
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), color 0.24s cubic-bezier(0.23, 1, 0.32, 1);
    width: fit-content;
    text-decoration: none;
}

footer.footer-night .footer-col a::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--marigold, #E8A33D);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

footer.footer-night .footer-col a:hover {
    color: #FAF4E8;
    transform: translateX(5px);
}

footer.footer-night .footer-col a:hover::after {
    transform: scaleX(1);
}

footer.footer-night .footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 36px;
    flex-wrap: wrap;
    gap: 20px;
}

footer.footer-night .footer-bottom-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

footer.footer-night .copyright {
    font-family: var(--ui);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(244, 235, 217, 0.7);   /* 7.18:1 on --indigo-deep; was .5 = 3.60:1 */
}

footer.footer-night .footer-mantra .devanagari {
    font-family: var(--devanagari);
    font-size: 16px;
    color: var(--marigold, #E8A33D);
    letter-spacing: 0.02em;
}

/* Legacy footer — kept for product pages that use it */
.footer {
    position: relative;
    z-index: 2;
    background: var(--paper-sunken, #E4D5BB);
    padding: 80px 0 36px;
    border-top: 1px solid var(--line, #C4A97E);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    padding-bottom: 56px;
    position: relative;
}

.footer-grid::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--line, #C4A97E);
}

.footer-grid::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -100%;
    width: 45%;
    height: 1.5px;
    background: linear-gradient(90deg, transparent 0%, rgba(179, 58, 43, 0.15) 20%, rgba(179, 58, 43, 0.85) 50%, rgba(179, 58, 43, 0.15) 80%, transparent 100%);
    animation: yamunaStream 6.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    z-index: 2;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 36px;
    }
    .footer-brand { grid-column: 1 / -1; margin-bottom: 8px; }
}

.footer-logo {
    font-family: var(--display);
    font-weight: 800;
    font-size: 28px;
    color: var(--text, #1F1A17);
    margin-bottom: 14px;
    letter-spacing: 0.01em;
}

.footer-x { color: var(--art-a, var(--terracotta, #B33A2B)); font-weight: 400; font-style: italic; margin: 0 4px; }

.footer-tagline {
    font-size: 14px;
    color: var(--text-muted, #6E6259);
    line-height: 1.6;
    max-width: 320px;
}

.footer-col-title {
    font-family: var(--ui);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted, #6E6259);
    margin-bottom: 18px;
}

.footer-col a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text-soft, #4A403A);
    padding: 6px 0;
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), color 0.24s cubic-bezier(0.23, 1, 0.32, 1);
    width: fit-content;
    text-decoration: none;
}

.footer-col a::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--terracotta, #B33A2B);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.footer-col a:hover {
    color: var(--text, #1F1A17);
    transform: translateX(5px);
}

.footer-col a:hover::after {
    transform: scaleX(1);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 36px;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-bottom-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.copyright {
    font-family: var(--ui);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted-ink, #675B53);   /* legacy footer ground is --paper-sunken */
}

.footer-mantra .devanagari {
    font-family: var(--devanagari);
    font-size: 16px;
    color: var(--terracotta-ink, #A83628);
    letter-spacing: 0.02em;
}


/* ─── REVEAL ANIMATIONS ─────────────────────────────── */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 1s var(--ease), transform 1s var(--ease);
    will-change: opacity, transform;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}


/* ─── REDUCED MOTION ───────────────────────────────── */
/* Handled in vrindavan.css */


/* ──────────────────────────────────────────────────────────
   PRODUCT PAGES — Shared base
   ────────────────────────────────────────────────────────── */

.product-page section { padding: 110px 0; position: relative; }
.product-page .container { max-width: 1100px; }
