/* ═══════════════════════════════════════════════════════════════════════════
   app.css  ·  Temple-night aesthetic, mobile-first
   Personalized Poster Generator · Shri Leuva Patidar Samaj

   The chrome deliberately mirrors the poster it produces: a dark warm night
   ground, brass/gold ornament, deep maroon panels and cream text.

   Type is limited to three families:
     Noto Sans Gujarati  : all Gujarati copy, labels, UI
     Cinzel Decorative   : English display accents only
     Cormorant Garamond  : italic English sub-labels only
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design tokens ──────────────────────────────────────────────────────────── */
:root {
    /* Night ground */
    --ink-1:      #120d0a;   /* deepest, page edges */
    --ink-2:      #1a1410;   /* base */
    --ink-3:      #241a13;   /* raised surface */

    /* Brass / gold */
    --gold-1:     #F4E0A3;   /* highlight */
    --gold-2:     #D4AF37;   /* primary accent */
    --gold-3:     #C9A227;   /* mid */
    --gold-4:     #8A6D1F;   /* shadow */
    --gold-glow:  rgba(212,175,55,.45);
    --gold-soft:  rgba(212,175,55,.16);
    --gold-hair:  rgba(212,175,55,.30);   /* hairline borders */

    /* Deep maroon. RGB(92,10,10) is the poster's own name-text colour */
    --maroon-1:   #7A1212;
    --maroon-2:   #5C0A0A;
    --maroon-3:   #3D0707;
    --maroon-4:   #2A0505;
    --maroon-glow:rgba(92,10,10,.45);

    /* Warm cream text */
    --cream-1:    #F7EDD8;   /* primary text */
    --cream-2:    #E5D6B8;   /* secondary */
    --cream-3:    #B9A582;   /* muted */

    --danger:     #FF6B6B;
    --success:    #5BBF6A;

    /* Gradients */
    --grad-brass: linear-gradient(180deg, #F7E7B0 0%, #E3C158 16%, #D4AF37 46%, #B8912B 78%, #8A6D1F 100%);
    --grad-gold:  linear-gradient(135deg, var(--gold-1) 0%, var(--gold-2) 45%, var(--gold-4) 100%);
    --grad-maroon:linear-gradient(160deg, var(--maroon-1) 0%, var(--maroon-2) 55%, var(--maroon-3) 100%);
    --grad-panel: linear-gradient(162deg, rgba(64,16,14,.78) 0%, rgba(36,10,9,.88) 55%, rgba(26,7,6,.92) 100%);

    /* Shadows */
    --shadow-panel: 0 10px 30px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.35);
    --shadow-brass: 0 6px 20px rgba(212,175,55,.30), 0 2px 6px rgba(0,0,0,.45);
    --shadow-deep:  0 20px 60px rgba(0,0,0,.65);

    /* Typography */
    --font-gujarati: 'Noto Sans Gujarati', 'Segoe UI', system-ui, sans-serif;
    --font-display:  'Cinzel Decorative', Georgia, serif;
    --font-heading:  'Cormorant Garamond', Georgia, serif;
    --font-ui:       var(--font-gujarati);

    /* Poster ratio, matching PosterGenerator's 1024×1536 canvas */
    --poster-ratio:  1024 / 1536;

    /* Motion */
    --t-fast: 160ms ease;
    --t-base: 300ms ease;
    --t-slow: 520ms cubic-bezier(.34,1.56,.64,1);

    /* ── Aliases consumed by view.css ────────────────────────────────────────
       view.css was written against these names; without them its rules
       silently resolve to nothing. */
    --maroon:      var(--maroon-2);
    --gold:        var(--gold-2);
    --gold-light:  var(--gold-1);
    --gold-dark:   var(--gold-3);
    --cream:       var(--cream-1);
    --dark-soft:   var(--cream-2);
    --dark-1:      var(--cream-1);
    --dark-2:      var(--cream-2);
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-gujarati);
    color: var(--cream-1);
    min-height: 100vh;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;

    /* Warm fire glow at the top and a faint hearth glow at the foot, over a
       near-black ground, echoing the poster's night backdrop rather than a flat fill. */
    background-color: var(--ink-1);
    background-image:
        radial-gradient(115% 62% at 50% -6%,  rgba(196,104,32,.30) 0%, rgba(120,50,14,.14) 38%, transparent 68%),
        radial-gradient(90%  46% at 50% 104%, rgba(168,74,20,.24)  0%, transparent 62%),
        linear-gradient(180deg, var(--ink-2) 0%, var(--ink-1) 55%, #0d0907 100%);
    background-attachment: fixed;

    /* `clip` rather than `hidden`: hidden would create a scroll container and
       silently break the sticky primary action on mobile. */
    overflow-x: clip;
}

img { display: block; max-width: 100%; height: auto; }
a   { color: var(--gold-2); text-decoration: none; }

/* Several components below set an explicit `display`, which would otherwise
   beat the user-agent rule for [hidden] and leave them permanently visible. */
[hidden] { display: none !important; }

:focus-visible {
    outline: 2px solid var(--gold-1);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ── Ambient mandala rings ──────────────────────────────────────────────────── */
.bg-mandala {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.bg-mandala__ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(212,175,55,.055);
    left: 50%;
    top: 42%;
    transform: translate(-50%,-50%);
    animation: mandala-spin linear infinite;
}
.bg-mandala__ring--1 { width: 560px;  height: 560px;  animation-duration: 140s; }
.bg-mandala__ring--2 { width: 860px;  height: 860px;  border-style: dashed; animation-duration: 200s; animation-direction: reverse; }
.bg-mandala__ring--3 { width: 1180px; height: 1180px; animation-duration: 260s; opacity: .6; }

@keyframes mandala-spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

/* ── Page wrapper ───────────────────────────────────────────────────────────── */
.page-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    margin-inline: auto;
    padding-inline: 1rem;
    padding-bottom: 3rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SHARED ORNAMENT
   ═══════════════════════════════════════════════════════════════════════════ */

/* A hairline that fades out at both ends. */
.divider-line,
.border-line,
.sf-line,
.kite-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-hair) 22%, var(--gold-2) 50%, var(--gold-hair) 78%, transparent);
}

/* Small brass gem, used as a repeating rhythm marker. */
.border-gem,
.sf-gem,
.kite-gem {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    background: var(--gold-2);
    transform: rotate(45deg);          /* diamond, not a dot */
    box-shadow: 0 0 6px var(--gold-glow);
}
.border-gem--center {
    width: 9px;
    height: 9px;
    background: var(--grad-brass);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════════════ */
.site-header {
    text-align: center;
    padding-top: 1.25rem;
}

.site-header__top-border {
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold-4) 12%, var(--gold-2) 50%, var(--gold-4) 88%, transparent);
    border-radius: 999px;
    margin-bottom: 1.15rem;
    box-shadow: 0 1px 14px var(--gold-glow);
}

.site-header__kite {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    margin-bottom: .85rem;
}
.kite-line { max-width: 76px; }

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .7rem;
    margin-bottom: .55rem;
}

.header-diya {
    color: var(--gold-2);
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px var(--gold-glow));
    animation: diya-flicker 3.6s ease-in-out infinite;
}
.header-diya--right { animation-delay: 1.8s; }
.diya-icon { width: 20px; height: 20px; }

@keyframes diya-flicker {
    0%, 100% { opacity: 1;   transform: scale(1); }
    45%      { opacity: .72; transform: scale(.94); }
}

.site-header__title {
    display: flex;
    flex-direction: column;
    gap: .22rem;
    min-width: 0;
}

.title-gu {
    font-family: var(--font-gujarati);
    font-size: clamp(1.15rem, 5.6vw, 1.5rem);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: .005em;

    /* Brass leaf, so the title reads as engraved metal */
    background: linear-gradient(180deg, #FBF0C8 0%, var(--gold-2) 52%, #9C7B22 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.6));
}

.title-sub {
    font-family: var(--font-gujarati);
    font-size: clamp(.74rem, 3.4vw, .86rem);
    font-weight: 500;
    color: var(--cream-3);
    letter-spacing: .02em;
    line-height: 1.4;
}

.site-header__tagline {
    font-family: var(--font-gujarati);
    font-size: clamp(.78rem, 3.6vw, .9rem);
    font-weight: 600;
    color: var(--gold-3);
    letter-spacing: .05em;
    margin-bottom: .95rem;
    opacity: .92;
}

.site-header__bottom-border {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    margin-bottom: 1.35rem;
}
.border-line { max-width: 38px; }

/* ═══════════════════════════════════════════════════════════════════════════
   ORNAMENTAL DIVIDER · hairline plus central brass diamond
   ═══════════════════════════════════════════════════════════════════════════ */
.ornamental-divider {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-block: 1.75rem;
}

.divider-node {
    position: relative;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
}

/* Outer diamond outline */
.divider-node::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid var(--gold-hair);
    transform: rotate(45deg);
    border-radius: 3px;
}

/* Solid brass core */
.divider-diamond {
    width: 9px;
    height: 9px;
    background: var(--grad-brass);
    transform: rotate(45deg);
    border-radius: 1px;
    box-shadow: 0 0 10px var(--gold-glow);
}

/* ═══════════════════════════════════════════════════════════════════════════
   POSTER PREVIEW
   ═══════════════════════════════════════════════════════════════════════════ */
.preview-section {
    display: flex;
    justify-content: center;
    margin-bottom: .25rem;
}

.preview-wrapper {
    position: relative;
    width: 100%;
    max-width: 268px;
}

.preview-ribbon {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: var(--grad-brass);
    color: var(--maroon-4);
    font-family: var(--font-gujarati);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    padding: .2rem .9rem;
    border-radius: 999px;
    border: 1px solid rgba(255,240,190,.55);
    box-shadow: 0 3px 10px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.5);
    white-space: nowrap;
}

.poster-frame {
    position: relative;
    width: 100%;
    aspect-ratio: var(--poster-ratio);
    border-radius: .5rem;
    overflow: hidden;
    background: var(--ink-3);

    /* Double brass frame */
    box-shadow:
        0 0 0 1px var(--gold-4),
        0 0 0 4px rgba(20,12,8,.95),
        0 0 0 5px var(--gold-2),
        0 14px 40px rgba(0,0,0,.6);
}

.poster-frame__bg,
.poster-frame__result {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity var(--t-base);
}
.poster-frame__result { opacity: 0; }
.poster-frame__result.visible { opacity: 1; }

.preview-corner {
    position: absolute;
    width: 13px; height: 13px;
    border-color: var(--gold-1);
    border-style: solid;
    z-index: 5;
    opacity: .85;
}
.preview-corner--tl { top: -7px;    left: -7px;   border-width: 2px 0 0 2px; border-radius: 3px 0 0 0; }
.preview-corner--tr { top: -7px;    right: -7px;  border-width: 2px 2px 0 0; border-radius: 0 3px 0 0; }
.preview-corner--bl { bottom: -7px; left: -7px;   border-width: 0 0 2px 2px; border-radius: 0 0 0 3px; }
.preview-corner--br { bottom: -7px; right: -7px;  border-width: 0 2px 2px 0; border-radius: 0 0 3px 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   FORM
   ═══════════════════════════════════════════════════════════════════════════ */
.form-section {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.form-intro { text-align: center; }
.form-intro__text {
    font-family: var(--font-gujarati);
    font-size: .92rem;
    color: var(--cream-2);
    line-height: 1.6;
    opacity: .88;
}

/* ── Step card: maroon panel inside a double brass frame ── */
.step-card {
    position: relative;
    background: var(--grad-panel);
    border: 1px solid var(--gold-hair);
    border-radius: .875rem;
    padding: 1.15rem 1.1rem 1.25rem;
    box-shadow: var(--shadow-panel);
    transition: border-color var(--t-base), box-shadow var(--t-base);
}

/* Inner hairline + a brass gem pinned to each corner of it. */
.step-card::before {
    content: '';
    position: absolute;
    inset: 5px;
    border: 1px solid rgba(212,175,55,.16);
    border-radius: .625rem;
    pointer-events: none;

    background-image:
        radial-gradient(circle, var(--gold-2) 0 1.6px, transparent 2px),
        radial-gradient(circle, var(--gold-2) 0 1.6px, transparent 2px),
        radial-gradient(circle, var(--gold-2) 0 1.6px, transparent 2px),
        radial-gradient(circle, var(--gold-2) 0 1.6px, transparent 2px);
    background-size: 5px 5px;
    background-repeat: no-repeat;
    background-position: left -2px top -2px, right -2px top -2px, left -2px bottom -2px, right -2px bottom -2px;
}

/* Warm glow bleeding in from the top-left, like firelight. */
.step-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(120% 70% at 0% 0%, rgba(212,175,55,.10), transparent 60%);
}

.step-card:focus-within {
    border-color: rgba(212,175,55,.55);
    box-shadow: var(--shadow-panel), 0 0 0 3px rgba(212,175,55,.15);
}

.step-card__header {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

/* ── Step badge: struck brass medallion ── */
.step-badge {
    width: 2.6rem;
    height: 2.6rem;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;

    background:
        radial-gradient(circle at 34% 28%, #FBEEC0 0%, #E3C158 30%, var(--gold-2) 58%, #96771F 100%);
    border: 1px solid rgba(255,240,190,.55);
    box-shadow:
        inset 0 2px 3px rgba(255,255,255,.45),
        inset 0 -3px 5px rgba(70,45,0,.45),
        0 3px 10px rgba(0,0,0,.5),
        0 0 0 3px rgba(212,175,55,.12);
}
/* Milled rim */
.step-badge::before {
    content: '';
    position: absolute;
    width: 2.05rem;
    height: 2.05rem;
    border-radius: 50%;
    border: 1px dashed rgba(90,60,0,.35);
}
.step-badge__num {
    position: relative;
    font-family: var(--font-gujarati);
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--maroon-4);
    line-height: 1;
    text-shadow: 0 1px 0 rgba(255,240,190,.5);
}

.step-card__titles { flex: 1; min-width: 0; }
.step-card__title {
    font-family: var(--font-gujarati);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gold-1);
    line-height: 1.25;
}
.step-card__hint {
    font-family: var(--font-heading);
    font-size: .82rem;
    font-style: italic;
    color: var(--cream-3);
    letter-spacing: .03em;
    margin-top: .05rem;
}

/* ── Upload area ── */
.upload-area {
    display: block;
    position: relative;
    z-index: 1;
    min-height: 148px;
    border: 1.5px dashed rgba(212,175,55,.40);
    border-radius: .75rem;
    background: rgba(12,7,5,.45);
    cursor: pointer;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    transition: border-color var(--t-fast), background var(--t-base), box-shadow var(--t-base);
}

.upload-area:hover,
.upload-area:focus-within {
    border-color: var(--gold-2);
    background: rgba(20,12,8,.65);
    box-shadow: inset 0 0 30px rgba(212,175,55,.08), 0 0 0 3px rgba(212,175,55,.14);
}

.upload-area.drag-over {
    border-color: var(--gold-1);
    border-style: solid;
    background: rgba(92,10,10,.35);
    box-shadow: 0 0 0 4px rgba(212,175,55,.22);
}

.upload-area__input {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.upload-area__idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: 1.75rem 1rem;
    text-align: center;
    min-height: 148px;
}

.upload-icon-wrap {
    position: relative;
    width: 54px; height: 54px;
    display: grid;
    place-items: center;
    margin-bottom: .2rem;
}
.upload-icon {
    width: 26px; height: 26px;
    color: var(--gold-2);
    position: relative;
    z-index: 1;
    transition: transform var(--t-base);
    filter: drop-shadow(0 0 6px var(--gold-glow));
}
.upload-icon-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(212,175,55,.30);
    animation: icon-pulse 2.4s ease-in-out infinite;
}
@keyframes icon-pulse {
    0%,100% { transform: scale(1);    opacity: .9; }
    50%     { transform: scale(1.14); opacity: .35; }
}
.upload-area:hover .upload-icon { transform: scale(1.12); }

.upload-area__primary {
    font-family: var(--font-gujarati);
    font-weight: 700;
    font-size: .96rem;
    color: var(--cream-1);
}
.upload-area__secondary {
    font-family: var(--font-gujarati);
    font-size: .76rem;
    color: var(--cream-3);
    letter-spacing: .02em;
}

/* ── Chosen-photo state ── */
.upload-area__preview {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1rem;
    animation: thumb-in var(--t-slow) both;
}
@keyframes thumb-in {
    from { opacity: 0; transform: translateY(6px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.upload-thumb-wrap { position: relative; flex-shrink: 0; }

.upload-area__thumb {
    width: 66px; height: 66px;
    object-fit: cover;
    border-radius: .45rem;
    border: 2px solid var(--gold-2);
    box-shadow: 0 3px 12px rgba(0,0,0,.55);
}
.upload-thumb-check {
    position: absolute;
    bottom: -6px; right: -6px;
    width: 21px; height: 21px;
    background: var(--success);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #0d2a10;
    border: 2px solid var(--ink-2);
    box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.upload-thumb-check svg { width: 11px; height: 11px; }

.upload-area__thumb-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
}
.upload-area__thumb-name {
    font-family: var(--font-gujarati);
    font-size: .8rem;
    font-weight: 600;
    color: var(--cream-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.upload-area__change {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 44px;              /* thumb-friendly tap target */
    padding: .3rem 1rem;
    background: rgba(212,175,55,.10);
    border: 1px solid rgba(212,175,55,.45);
    color: var(--gold-1);
    border-radius: 999px;
    font-family: var(--font-gujarati);
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    z-index: 3;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.upload-area__change:hover {
    background: var(--gold-2);
    border-color: var(--gold-2);
    color: var(--maroon-4);
}

/* ── Name input ── */
.name-field-wrap {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 1;
}
.name-input-icon {
    position: absolute;
    left: .9rem;
    display: flex;
    align-items: center;
    color: var(--gold-3);
    pointer-events: none;
    z-index: 1;
}
.name-input-icon svg { width: 17px; height: 17px; }

.name-input {
    width: 100%;
    min-height: 52px;
    padding: .85rem 3.6rem .85rem 2.8rem;
    font-family: var(--font-gujarati);
    font-size: 1.02rem;
    font-weight: 500;
    color: var(--cream-1);
    background: rgba(12,7,5,.55);
    border: 1.5px solid rgba(212,175,55,.35);
    border-radius: .625rem;
    outline: none;
    caret-color: var(--gold-2);
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.name-input::placeholder {
    color: var(--cream-3);
    opacity: .55;
    font-weight: 400;
    font-size: .95rem;
}
.name-input:focus {
    border-color: var(--gold-2);
    background: rgba(20,12,8,.78);
    box-shadow: 0 0 0 3px rgba(212,175,55,.18);
}

.name-charcount {
    position: absolute;
    right: .9rem;
    font-family: var(--font-gujarati);
    font-size: .72rem;
    color: var(--cream-3);
    opacity: .7;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.field-hint {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-family: var(--font-gujarati);
    font-size: .79rem;
    color: var(--cream-3);
    margin-top: .5rem;
    position: relative;
    z-index: 1;
}
.field-hint svg { color: var(--gold-3); flex-shrink: 0; }

.field-error {
    font-family: var(--font-gujarati);
    font-size: .8rem;
    color: var(--danger);
    font-weight: 600;
    margin-top: .4rem;
    min-height: 1.1rem;
    display: flex;
    align-items: center;
    gap: .35rem;
}
.field-error:not(:empty)::before {
    content: '';
    width: 5px; height: 5px;
    flex-shrink: 0;
    background: var(--danger);
    transform: rotate(45deg);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRIMARY ACTION · struck brass
   ═══════════════════════════════════════════════════════════════════════════ */
.btn-generate {
    position: relative;
    width: 100%;
    min-height: 58px;
    margin-top: .4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    overflow: hidden;

    background: var(--grad-brass);
    color: var(--maroon-4);
    font-family: var(--font-gujarati);
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: .03em;

    border: 1px solid rgba(255,238,180,.55);
    border-radius: .75rem;
    cursor: pointer;

    /* Bevel: bright top lip, dark underside, warm cast shadow */
    box-shadow:
        inset 0 1px 0 rgba(255,250,225,.85),
        inset 0 -2px 4px rgba(88,58,0,.45),
        var(--shadow-brass);
    text-shadow: 0 1px 0 rgba(255,240,190,.45);
    transition: transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast);
}

/* Inner hairline, a step in from the edge */
.btn-generate::before {
    content: '';
    position: absolute;
    inset: 3px;
    border: 1px solid rgba(255,245,205,.28);
    border-radius: .55rem;
    pointer-events: none;
}

.btn-generate:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow:
        inset 0 1px 0 rgba(255,250,225,.9),
        inset 0 -2px 4px rgba(88,58,0,.4),
        0 10px 28px rgba(212,175,55,.42),
        0 3px 8px rgba(0,0,0,.5);
}
.btn-generate:active {
    transform: translateY(1px);
    filter: brightness(.96);
    box-shadow:
        inset 0 2px 5px rgba(88,58,0,.5),
        0 2px 8px rgba(0,0,0,.45);
}
.btn-generate:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.btn-generate__icon { width: 21px; height: 21px; flex-shrink: 0; }

/* Both fields filled: a soft breathing glow, purely an affordance. */
.btn-generate.is-ready {
    animation: cta-breathe 2.6s ease-in-out infinite;
}
@keyframes cta-breathe {
    0%, 100% { box-shadow: inset 0 1px 0 rgba(255,250,225,.85), inset 0 -2px 4px rgba(88,58,0,.45), 0 6px 20px rgba(212,175,55,.30), 0 2px 6px rgba(0,0,0,.45); }
    50%      { box-shadow: inset 0 1px 0 rgba(255,250,225,.85), inset 0 -2px 4px rgba(88,58,0,.45), 0 10px 30px rgba(212,175,55,.55), 0 2px 6px rgba(0,0,0,.45); }
}

/* Shimmer while the request is in flight */
.btn-generate__shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.55) 50%, transparent 100%);
    transform: translateX(-100%);
    border-radius: inherit;
    pointer-events: none;
}
.btn-generate.loading .btn-generate__shine {
    animation: btn-shimmer 1.4s ease-in-out infinite;
}
@keyframes btn-shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* Keep the action within thumb reach on phones. Sticky rather than fixed, so
   it never leaves the flow and never covers the content beneath it. */
@media (max-width: 719px) {
    .btn-generate {
        position: sticky;
        bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
        z-index: 20;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════════════════════════════════ */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(10,6,4,.86);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-base);
}
.loading-overlay.active { opacity: 1; pointer-events: all; }

.loading-overlay__card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    padding: 2.25rem 2.5rem;
    background: var(--grad-panel);
    border: 1px solid var(--gold-hair);
    border-radius: 1rem;
    box-shadow: var(--shadow-deep);
}

.loading-lotus { position: relative; width: 62px; height: 62px; }
.loading-lotus__petal {
    position: absolute;
    top: 50%; left: 50%;
    width: 9px; height: 21px;
    background: linear-gradient(to top, var(--gold-4), var(--gold-1));
    border-radius: 50% 50% 0 0;
    transform-origin: bottom center;
    transform: translate(-50%,-100%) rotate(calc(var(--i) * 60deg)) translateY(-15px);
    animation: petal-bloom 1.8s ease-in-out infinite;
    animation-delay: calc(var(--i) * .3s);
    opacity: .85;
}
@keyframes petal-bloom {
    0%,100% { opacity: .35; transform: translate(-50%,-100%) rotate(calc(var(--i)*60deg)) translateY(-15px) scaleY(.85); }
    50%     { opacity: 1;   transform: translate(-50%,-100%) rotate(calc(var(--i)*60deg)) translateY(-17px) scaleY(1); }
}
.loading-lotus__core {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    width: 17px; height: 17px;
    border-radius: 50%;
    background: var(--grad-brass);
    box-shadow: 0 0 14px var(--gold-glow);
}

.loading-overlay__text {
    font-family: var(--font-gujarati);
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--gold-1);
}
.loading-overlay__sub {
    font-family: var(--font-gujarati);
    font-size: .84rem;
    color: var(--cream-3);
    margin-top: -.55rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESULT
   ═══════════════════════════════════════════════════════════════════════════ */
.result-section { animation: slide-up var(--t-slow) both; }
@keyframes slide-up {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: none; }
}

.result-header { text-align: center; margin-bottom: 1.2rem; }
.result-header__icon {
    width: 50px; height: 50px;
    margin: 0 auto .7rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--grad-brass);
    color: var(--maroon-4);
    border: 1px solid rgba(255,240,190,.5);
    box-shadow: inset 0 2px 3px rgba(255,255,255,.4), 0 4px 16px rgba(0,0,0,.5);
}
.result-header__icon svg { width: 24px; height: 24px; }

.result-section__title {
    font-family: var(--font-gujarati);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gold-1);
    line-height: 1.25;
}
.result-section__sub {
    font-family: var(--font-heading);
    font-size: .92rem;
    font-style: italic;
    color: var(--cream-3);
    letter-spacing: .04em;
    margin-top: .15rem;
}

.result-poster-wrap {
    position: relative;
    width: 100%;
    max-width: 340px;
    margin-inline: auto;
    margin-bottom: 1.4rem;
}
.result-poster-corners { position: absolute; inset: -6px; pointer-events: none; z-index: 2; }
.rpc {
    position: absolute;
    width: 18px; height: 18px;
    border-color: var(--gold-1);
    border-style: solid;
    opacity: .9;
}
.rpc--tl { top: 0;    left: 0;   border-width: 2px 0 0 2px; border-radius: 4px 0 0 0; }
.rpc--tr { top: 0;    right: 0;  border-width: 2px 2px 0 0; border-radius: 0 4px 0 0; }
.rpc--bl { bottom: 0; left: 0;   border-width: 0 0 2px 2px; border-radius: 0 0 0 4px; }
.rpc--br { bottom: 0; right: 0;  border-width: 0 2px 2px 0; border-radius: 0 0 4px 0; }

.result-poster__img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: .5rem;
    box-shadow:
        0 0 0 1px var(--gold-4),
        0 0 0 4px rgba(20,12,8,.95),
        0 0 0 5px var(--gold-2),
        0 18px 50px rgba(0,0,0,.6);
}

/* ── Share / download row ── */
.result-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
    margin-bottom: 1rem;
}

.result-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 50px;
    padding: .5rem .6rem;
    border-radius: .625rem;
    font-family: var(--font-gujarati);
    font-size: .86rem;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    line-height: 1.2;
    transition: transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast);
}
.result-btn > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.result-btn:active { transform: scale(.97); }
.result-btn__ico { width: 17px; height: 17px; flex-shrink: 0; }

.result-btn--download {
    background: var(--grad-brass);
    color: var(--maroon-4);
    border-color: rgba(255,238,180,.5);
    box-shadow: inset 0 1px 0 rgba(255,250,225,.7), 0 4px 14px rgba(0,0,0,.45);
    text-shadow: 0 1px 0 rgba(255,240,190,.4);
}
.result-btn--download:hover { transform: translateY(-2px); filter: brightness(1.05); }

.result-btn--whatsapp {
    background: linear-gradient(180deg, #2fbf5f, #1d8a44);
    color: #fff;
    border-color: rgba(255,255,255,.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 4px 14px rgba(0,0,0,.45);
}
.result-btn--whatsapp:hover { transform: translateY(-2px); filter: brightness(1.08); }

.result-btn--facebook {
    background: linear-gradient(180deg, #4a7ad4, #2b4f9e);
    color: #fff;
    border-color: rgba(255,255,255,.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 4px 14px rgba(0,0,0,.45);
}
.result-btn--facebook:hover { transform: translateY(-2px); filter: brightness(1.08); }

.result-btn--copy {
    background: rgba(212,175,55,.08);
    color: var(--gold-1);
    border-color: rgba(212,175,55,.45);
}
.result-btn--copy:hover {
    background: var(--gold-2);
    border-color: var(--gold-2);
    color: var(--maroon-4);
    transform: translateY(-2px);
}

.btn-another {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: transparent;
    border: 1px solid rgba(212,175,55,.28);
    border-radius: .625rem;
    color: var(--cream-2);
    font-family: var(--font-gujarati);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn-another:hover {
    background: rgba(212,175,55,.10);
    border-color: var(--gold-2);
    color: var(--gold-1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════════ */
.toast {
    position: fixed;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    z-index: 9999;
    min-width: 200px;
    max-width: calc(100vw - 2rem);

    padding: .7rem 1.35rem;
    border-radius: 999px;
    font-family: var(--font-gujarati);
    font-size: .88rem;
    font-weight: 600;
    text-align: center;
    color: var(--cream-1);
    background: var(--grad-maroon);
    border: 1px solid rgba(212,175,55,.35);
    box-shadow: 0 8px 28px rgba(0,0,0,.6);

    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-base), transform var(--t-base);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast--success { background: linear-gradient(160deg, #2c7a3f, #17512a); }
.toast.toast--error   { background: linear-gradient(160deg, #a8302f, #6e1a19); }
.toast.toast--info    { background: var(--grad-maroon); }

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */
.site-footer {
    text-align: center;
    margin-top: 2.5rem;
    padding-top: 1.25rem;
}
.site-footer__divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    margin-bottom: .95rem;
}
.sf-line { max-width: 46px; }
.sf-om {
    font-family: var(--font-gujarati);
    font-size: 19px;
    line-height: 1;
    color: var(--gold-2);
    text-shadow: 0 0 10px var(--gold-glow);
}

.site-footer__text {
    font-family: var(--font-gujarati);
    font-size: .8rem;
    color: var(--cream-3);
    line-height: 1.7;
}
.site-footer__subtext {
    font-family: var(--font-gujarati);
    font-size: .73rem;
    color: var(--cream-3);
    opacity: .7;
    margin-top: .3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    flex-wrap: wrap;
}
.site-footer__subtext svg { color: var(--gold-3); flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   404 PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.notfound {
    text-align: center;
    padding-top: 12vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.notfound__medallion {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--maroon-4);
    background: radial-gradient(circle at 34% 28%, #FBEEC0 0%, #E3C158 30%, var(--gold-2) 58%, #96771F 100%);
    border: 1px solid rgba(255,240,190,.55);
    box-shadow:
        inset 0 2px 3px rgba(255,255,255,.45),
        inset 0 -3px 5px rgba(70,45,0,.45),
        0 4px 16px rgba(0,0,0,.5);
    margin-bottom: 1.1rem;
}
.notfound__medallion svg { width: 30px; height: 30px; }

.notfound__code {
    font-family: var(--font-display);
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--gold-2);
    letter-spacing: .08em;
    text-shadow: 0 2px 10px rgba(0,0,0,.6);
}

.notfound__title {
    font-family: var(--font-gujarati);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gold-1);
    margin-top: .5rem;
}
.notfound__title-en {
    font-family: var(--font-heading);
    font-size: .95rem;
    font-style: italic;
    color: var(--cream-3);
    letter-spacing: .04em;
}

.notfound__text {
    font-family: var(--font-gujarati);
    font-size: .92rem;
    color: var(--cream-2);
    line-height: 1.6;
    max-width: 34ch;
}
.notfound__text--en {
    font-size: .82rem;
    color: var(--cream-3);
    margin-top: .3rem;
}

.notfound__btn {
    width: auto;
    min-width: 240px;
    margin-top: 1.75rem;
    padding-inline: 1.75rem;
    text-decoration: none;
    position: static;      /* never sticky on this page */
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE · mobile first, widening upward
   ═══════════════════════════════════════════════════════════════════════════ */

/* Very narrow phones (≤360px): give the share buttons a full-width stack so
   the Gujarati labels are never clipped. */
@media (max-width: 360px) {
    .page-wrapper { padding-inline: .75rem; }
    .result-actions { grid-template-columns: 1fr; }
    .upload-area__preview { gap: .7rem; }
    .upload-area__thumb { width: 58px; height: 58px; }
}

@media (min-width: 390px) {
    .preview-wrapper { max-width: 288px; }
}

@media (min-width: 428px) {
    .preview-wrapper    { max-width: 306px; }
    .result-poster-wrap { max-width: 366px; }
}

/* Desktop: the action returns to the normal flow and the page breathes. */
@media (min-width: 720px) {
    .page-wrapper {
        max-width: 560px;
        padding-inline: 1.5rem;
        padding-bottom: 4rem;
    }
    .preview-wrapper    { max-width: 330px; }
    .result-poster-wrap { max-width: 400px; }
    .site-header__title .title-gu { font-size: 1.6rem; }
    .result-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Reduced motion ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
