/* ============================================================
   Granthawali — Brand Tokens
   ग्रंथावली · A digital home for every Indian library
   Built by Quantox Technologies Pvt. Ltd.
   
   Phase 0 lock — May 1, 2026
   This file is the single source of truth for brand colors,
   typography, and spacing across:
     - Marketing landing page (granthawali.in)
     - Tenant workspaces ({slug}.granthawali.in)
     - Super admin console (console.granthawali.in)
     - Email templates
     - PDF invoices and reports
   
   Tenant-specific brand overrides (logo, primary_color, accent_color)
   come from the `tenants` table and are injected by theme.css.php
   AFTER this file loads, so tenant overrides win.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter+Tight:wght@400;500;600&family=Anek+Devanagari:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* ─── Color: paper & ink ─────────────────────────── */
    --paper:          #F8F4ED;   /* default page background */
    --paper-light:    #FBF7EF;   /* hero, focal areas */
    --paper-dark:     #EFE9DB;   /* alt sections, table stripes */
    --surface:        #FFFFFF;   /* cards, modals */
    --ink:            #1A1614;   /* body text, headings */
    --ink-muted:      #5F5E5A;   /* captions, secondary text */
    --ink-faint:      #8A8780;   /* hints, placeholders */
    --rule:           #E5DFD3;   /* hairline dividers */
    --rule-strong:    #C9C2AF;   /* emphasized dividers */

    /* ─── Color: brand accents ───────────────────────── */
    --terracotta:     #B8451C;   /* primary CTA, links */
    --terracotta-dark:#8E3414;   /* CTA hover */
    --terracotta-soft:#F4E4D8;   /* terracotta tint backgrounds */
    --forest:         #0F5132;   /* secondary, Marathi headings, success */
    --forest-dark:    #0A3B25;   /* forest hover */
    --forest-soft:    #DCE9DF;   /* forest tint backgrounds */
    --gold:           #C9A961;   /* premium, decorative */
    --gold-dark:      #A28640;   /* gold hover */
    --gold-soft:      #F2E9D2;   /* gold tint backgrounds */

    /* ─── Color: semantic ────────────────────────────── */
    --success:        var(--forest);
    --success-soft:   var(--forest-soft);
    --warning:        #B7791F;
    --warning-soft:   #FBEDD1;
    --danger:         #B83C3C;
    --danger-soft:    #F5DCDC;
    --info:           #2C5F8E;
    --info-soft:      #DCE7F1;

    /* ─── Typography: stacks ─────────────────────────── */
    --font-display:   'Fraunces', 'Georgia', 'Times New Roman', serif;
    --font-body:      'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-marathi:   'Anek Devanagari', 'Mangal', 'Noto Sans Devanagari', sans-serif;
    --font-mono:      'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    /* ─── Typography: sizes ──────────────────────────── */
    /* Display scale — for marketing hero, tenant landing hero */
    --fs-hero:        clamp(2.5rem, 5vw + 1rem, 4.5rem);
    --fs-display:     clamp(2rem, 3vw + 1rem, 3.25rem);
    --fs-h1:          clamp(1.75rem, 2vw + 1rem, 2.5rem);
    --fs-h2:          1.5rem;     /* 24px */
    --fs-h3:          1.25rem;    /* 20px */
    --fs-h4:          1.0625rem;  /* 17px */
    --fs-body:        1rem;       /* 16px */
    --fs-small:       0.875rem;   /* 14px */
    --fs-eyebrow:     0.75rem;    /* 12px, uppercase, letter-spaced */

    /* ─── Typography: weights ────────────────────────── */
    --fw-regular:     400;
    --fw-medium:      500;
    --fw-bold:        600;

    /* ─── Typography: line heights ───────────────────── */
    --lh-tight:       1.1;
    --lh-snug:        1.3;
    --lh-base:        1.6;
    --lh-loose:       1.8;

    /* ─── Layout ─────────────────────────────────────── */
    --radius-sm:      4px;
    --radius:         8px;
    --radius-lg:      12px;
    --radius-xl:      16px;
    --radius-pill:    9999px;

    --shadow-rule:    0 0 0 0.5px var(--rule);
    --shadow-card:    0 1px 2px rgba(26, 22, 20, 0.04), 0 4px 12px rgba(26, 22, 20, 0.04);
    --shadow-lift:    0 2px 4px rgba(26, 22, 20, 0.06), 0 12px 32px rgba(26, 22, 20, 0.08);

    --container:      1180px;
    --container-narrow: 760px;

    /* ─── Motion ─────────────────────────────────────── */
    --ease-out:       cubic-bezier(0.22, 0.61, 0.36, 1);
    --ease-in-out:    cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast:  120ms;
    --duration:       200ms;
    --duration-slow:  400ms;
}

/* ─── Base resets that depend on tokens ────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    line-height: var(--lh-base);
    font-size: var(--fs-body);
}

/* ─── Display headings — Fraunces ──────────────────── */
.display, h1.display, .hero-headline {
    font-family: var(--font-display);
    font-weight: var(--fw-medium);
    font-size: var(--fs-display);
    line-height: var(--lh-tight);
    letter-spacing: -0.02em;
    color: var(--ink);
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: var(--fw-medium);
    line-height: var(--lh-snug);
    color: var(--ink);
    letter-spacing: -0.01em;
    margin: 0 0 0.5em;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

/* ─── Marathi text gets Anek Devanagari ────────────── */
[lang="mr"], .mr {
    font-family: var(--font-marathi);
    font-weight: var(--fw-medium);
}

[lang="mr"] h1, [lang="mr"] h2, [lang="mr"] h3,
.mr h1, .mr h2, .mr h3,
h1.mr, h2.mr, h3.mr {
    font-family: var(--font-marathi);
    color: var(--forest);
    font-weight: var(--fw-medium);
    letter-spacing: 0;
}

/* ─── Eyebrow (small uppercase label) ──────────────── */
.eyebrow {
    font-family: var(--font-body);
    font-size: var(--fs-eyebrow);
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gold-dark);
}

/* ─── Editorial flourishes ─────────────────────────── */
.dropcap::first-letter {
    font-family: var(--font-display);
    font-weight: var(--fw-medium);
    font-size: 4em;
    float: left;
    line-height: 0.85;
    margin: 0.05em 0.1em 0 0;
    color: var(--terracotta);
}

.pullquote {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.5rem;
    line-height: var(--lh-snug);
    color: var(--ink);
    border-left: 3px solid var(--terracotta);
    padding-left: 1.5rem;
    margin: 2rem 0;
}

.double-rule {
    border: 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    height: 4px;
    margin: 2rem 0;
}

/* ─── Buttons ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: var(--fw-medium);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
    text-decoration: none;
    line-height: 1.2;
}

.btn-primary {
    background: var(--terracotta);
    color: var(--paper-light);
    border-color: var(--terracotta);
}
.btn-primary:hover {
    background: var(--terracotta-dark);
    border-color: var(--terracotta-dark);
}

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border-color: var(--rule-strong);
}
.btn-secondary:hover {
    background: var(--paper-dark);
    border-color: var(--ink);
}

.btn-ghost {
    background: transparent;
    color: var(--terracotta);
    border-color: transparent;
}
.btn-ghost:hover {
    color: var(--terracotta-dark);
    background: var(--terracotta-soft);
}

/* ─── Plan badge (for pricing pages, tenant header) ─ */
.plan-badge {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-body);
    font-size: var(--fs-eyebrow);
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    line-height: 1.4;
}
.plan-badge.free        { background: var(--paper-dark);   color: var(--ink-muted); }
.plan-badge.trial       { background: var(--info-soft);    color: var(--info); }
.plan-badge.pro         { background: var(--forest-soft);  color: var(--forest); }
.plan-badge.institution { background: var(--gold-soft);    color: var(--gold-dark); }

/* ─── "Powered by Granthawali" footer credit ───────── */
.granthawali-credit {
    font-family: var(--font-body);
    font-size: var(--fs-small);
    color: var(--ink-faint);
    text-align: center;
    padding: 1.5rem 0;
}
.granthawali-credit a {
    color: var(--ink-muted);
    text-decoration: none;
    font-weight: var(--fw-medium);
}
.granthawali-credit a:hover { color: var(--terracotta); }

/* ─── Wordmark — for header logo, footer ──────────── */
.granthawali-wordmark {
    font-family: var(--font-display);
    font-weight: var(--fw-medium);
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--ink);
    line-height: 1;
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
}
.granthawali-wordmark .mr-mark {
    font-family: var(--font-marathi);
    font-size: 0.85em;
    color: var(--forest);
    font-weight: var(--fw-medium);
}

/* ─── Forms — inherited from Manyachiwadi pattern ── */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
    font-family: var(--font-body);
    font-size: var(--fs-body);
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    padding: 0.7rem 0.9rem;
    width: 100%;
    transition: border-color var(--duration) var(--ease-out),
                box-shadow var(--duration) var(--ease-out);
}

input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--terracotta);
    box-shadow: 0 0 0 3px var(--terracotta-soft);
}

label {
    font-family: var(--font-body);
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    color: var(--ink-muted);
    display: block;
    margin-bottom: 0.4rem;
}

/* ─── Cards ────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.card-paper {
    background: var(--paper-light);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

/* ─── Container layout ─────────────────────────────── */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.25rem;
}
.container-narrow {
    max-width: var(--container-narrow);
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ─── Marathi-specific helpers ─────────────────────── */
.bilingual {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.bilingual .en { color: var(--ink); }
.bilingual .mr { color: var(--forest); font-family: var(--font-marathi); font-size: 0.95em; }

/* ─── Print and PDF (invoices, reports) ────────────── */
@media print {
    :root { --paper: #FFFFFF; --paper-light: #FFFFFF; }
    .no-print { display: none !important; }
    body { background: white; color: black; }
}
