/* ═══════════════════════════════════════════════
   Mana Kottalapalli — Membership Page
═══════════════════════════════════════════════ */

/* ─── CSS Variables (mirrors style.css) ─── */
:root {
    --g50: #f0faf0;
    --g100: #d6f0d6;
    --g200: #aad8aa;
    --g300: #72bc72;
    --g400: #3d9e3d;
    --g500: #2d8a2d;
    --g600: #1f6e1f;
    --g700: #155015;
    --g800: #0d360d;

    --ink: #0e1a0e;
    --ink2: #2c3e2c;
    --ink3: #4a604a;
    --muted: #7a8f7a;
    --rule: #e0ece0;
    --bg: #f7fbf7;
    --white: #ffffff;

    --fb: 'DM Sans', sans-serif;
    --fh: 'Sora', sans-serif;
    --fm: 'Roboto Mono', monospace;
    --fk: 'Caveat', cursive;

    --radius-s: 8px;
    --radius-m: 12px;
    --radius-l: 16px;

    --shadow-card: 0 1px 4px rgba(0, 0, 0, .06), 0 4px 20px rgba(45, 138, 45, .07);
    --shadow-btn: 0 3px 14px rgba(45, 138, 45, .30);

    --ease: cubic-bezier(.4, 0, .2, 1);
    --nav-h: 56px;
}

/* ─── Global Reset (only what's not in style.css) ─── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--fb);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

::-webkit-scrollbar {
    width: 3px;
}

::-webkit-scrollbar-track {
    background: var(--g50);
}

::-webkit-scrollbar-thumb {
    background: var(--g300);
    border-radius: 3px;
}

/* ─── NAV ─── */
#nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    background: rgba(247, 251, 247, .95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 1px 10px rgba(45, 138, 45, .06);
}

.nav-brand {
    font-family: var(--fk);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--g600);
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink3);
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: 100px;
    padding: 7px 14px;
    transition: background .18s, border-color .18s, color .18s;
}

.nav-back:hover {
    background: var(--g50);
    border-color: var(--g200);
    color: var(--g600);
}

/* ─── HERO (lightened: flat tone, tighter spacing, no texture) ─── */
.page-hero {
    padding-top: var(--nav-h);
    background: linear-gradient(160deg, var(--g700) 0%, var(--g600) 100%);
    position: relative;
    overflow: hidden;
}

.hero-inner {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 2.5rem;
    text-align: center;
}

.hero-eyebrow {
    display: inline-block;
    font-family: var(--fm);
    font-size: .6rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--g300);
    margin-bottom: .8rem;
}

.hero-heading {
    font-family: var(--fh);
    font-size: clamp(1.35rem, 4.2vw, 2.25rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.22;
    margin-bottom: .6rem;
}

.hero-sub {
    font-size: .8rem;
    color: rgba(255, 255, 255, .6);
    line-height: 1.7;
    max-width: 420px;
    margin: 0 auto .9rem;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: .5rem;
    font-family: var(--fm);
    font-size: .62rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .5);
}

.hero-meta .dot {
    color: var(--g400);
}

/* ─── PAGE LAYOUT ─── */
.page-main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 2rem 0.8rem 4rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

.mem-layout {
    grid-template-columns: 1fr;
}

/* ─── FORM SECTION / RESULT SECTION (share the same card look + grid slot) ─── */
.mem-form-section,
.mem-result-section {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--radius-l);
    padding: 1.75rem 1.05rem;
    box-shadow: var(--shadow-card);
}

.section-head {
    margin-bottom: 1.5rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--rule);
}

.section-title {
    font-family: var(--fh);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: .25rem;
}

.section-desc {
    font-size: .83rem;
    color: var(--muted);
}

/* ─── FORM GRID ─── */
#membershipForm {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 540px) {
    #membershipForm {
        grid-template-columns: 1fr 1fr;
    }

    #membershipForm .full {
        grid-column: 1 / -1;
    }
}

/* ─── FIELD GROUPS ─── */
.field-group {
    display: flex;
    flex-direction: column;
    gap: .38rem;
}

.field-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink2);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.req {
    color: var(--g500);
    font-weight: 700;
    line-height: 1;
}

.opt-tag {
    font-family: var(--fm);
    font-size: .58rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--g50);
    border: 1px solid var(--g100);
    border-radius: 100px;
    padding: 2px 7px;
}

/* ─── INPUTS ─── */
.field-group input[type="text"],
.field-group input[type="date"] {
    width: 100%;
    font-family: var(--fb);
    font-size: 14px;
    color: var(--ink);
    background: var(--white);
    border: 1.5px solid var(--rule);
    border-radius: var(--radius-s);
    padding: 11px 13px;
    outline: none;
    transition: border-color .18s, box-shadow .18s;
    -webkit-appearance: none;
    appearance: none;
}

.field-group input::placeholder {
    color: var(--muted);
    font-size: .9rem;
}

.field-group input:focus {
    border-color: var(--g400);
    box-shadow: 0 0 0 3px rgba(61, 158, 61, .1);
}

.field-group input.input-error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .09);
}

.field-group input.input-valid {
    border-color: var(--g400);
}

/* Date input styling */
input[type="date"] {
    cursor: pointer;
    color-scheme: light;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: .6;
    cursor: pointer;
}

/* ─── FIELD ERROR ─── */
.field-error {
    display: none;
    font-size: .74rem;
    color: #c0392b;
    animation: errIn .18s ease;
}

.field-error.visible {
    display: block;
}

@keyframes errIn {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ─── AGE DISPLAY ─── */
.age-display {
    font-size: .8rem;
    font-weight: 600;
    color: var(--g600);
    margin-top: 2px;
    animation: fadeIn .25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ─── PHOTO UPLOAD ─── */
.photo-upload-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .85rem 1rem;
    background: var(--g50);
    border: 2px dashed var(--g200);
    border-radius: var(--radius-m);
    cursor: pointer;
    position: relative;
    transition: border-color .2s, background .2s;
}

.photo-upload-area:hover {
    border-color: var(--g400);
    background: rgba(61, 158, 61, .04);
}

.photo-upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    font-size: 0;
}

.photo-upload-inner {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--g200);
    background: var(--white);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--g300);
}

.photo-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

#photoPreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-upload-label {
    pointer-events: none;
}

.photo-upload-text {
    font-size: .87rem;
    font-weight: 600;
    color: var(--ink2);
    margin-bottom: .15rem;
}

.photo-upload-sub {
    font-family: var(--fm);
    font-size: .62rem;
    color: var(--muted);
    letter-spacing: .04em;
}

/* ─── GENDER PILLS ─── */
.gender-pills {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.gender-pill {
    flex: 1;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .65rem .75rem;
    background: var(--white);
    border: 1.5px solid var(--rule);
    border-radius: var(--radius-m);
    font-family: var(--fb);
    font-size: .83rem;
    font-weight: 600;
    color: var(--ink3);
    cursor: pointer;
    transition: border-color .18s, background .18s, color .18s, transform .12s;
    -webkit-tap-highlight-color: transparent;
}

.gender-pill:hover {
    border-color: var(--g300);
    background: var(--g50);
    color: var(--g600);
}

.gender-pill.selected {
    background: var(--g50);
    border-color: var(--g500);
    color: var(--g600);
    box-shadow: 0 0 0 3px rgba(61, 158, 61, .1);
}

.gender-pill:active {
    transform: scale(.97);
}

.gender-icon {
    font-style: normal;
    font-size: .95rem;
}

/* ─── FORM ACTIONS (one clear primary action + a quiet text link) ─── */
.mem-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .65rem;
}

.submit-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--g500);
    color: #fff;
    font-family: var(--fh);
    font-size: .87rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-m);
    cursor: pointer;
    letter-spacing: .01em;
    box-shadow: var(--shadow-btn);
    transition: background .18s, transform .15s, box-shadow .18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
}

.submit-btn:hover:not(:disabled) {
    background: var(--g600);
    transform: translateY(-1px);
    box-shadow: 0 5px 20px rgba(45, 138, 45, .38);
}

.submit-btn:active:not(:disabled) {
    transform: scale(.98);
}

.submit-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

.clear-link {
    align-self: center;
    background: none;
    border: none;
    color: var(--muted);
    font-family: var(--fb);
    font-size: .78rem;
    font-weight: 600;
    padding: .35rem .5rem;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: color .15s, text-decoration-color .15s;
}

.clear-link:hover {
    color: var(--g600);
    text-decoration-color: var(--g300);
}

/* ─── SIDEBAR ─── */
.page-aside {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.aside-card {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--radius-l);
    padding: 1.15rem 1.1rem;
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    box-shadow: var(--shadow-card);
    transition: border-color .2s;
}

.aside-card:hover {
    border-color: var(--g200);
}

.aside-icon {
    font-size: 1.3rem;
    line-height: 1;
    margin-top: 1px;
    flex-shrink: 0;
}

.aside-title {
    font-family: var(--fh);
    font-size: .88rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: .3rem;
}

.aside-body {
    font-size: .8rem;
    color: var(--ink3);
    line-height: 1.7;
}

/* ─── RESULT SECTION (sits in the exact same slot as the form — no scrolling away) ─── */
.mem-result-section {
    animation: resultIn .3s var(--ease);
}

@keyframes resultIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.result-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding-bottom: 1.1rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--rule);
}

.edit-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--white);
    color: var(--ink3);
    border: 1.5px solid var(--rule);
    border-radius: 100px;
    padding: 8px 16px;
    font-family: var(--fb);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s, border-color .18s, color .18s;
}

.edit-btn:hover {
    background: var(--g50);
    border-color: var(--g200);
    color: var(--g600);
}

.ready-tag {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .74rem;
    font-weight: 600;
    color: var(--g600);
    white-space: nowrap;
}

/* ─── CANVAS ─── */
.card-canvas-wrap {
    width: 100%;
    border-radius: var(--radius-l);
    overflow: hidden;
    box-shadow: 0 4px 32px rgba(0, 0, 0, .12), 0 1px 6px rgba(0, 0, 0, .08);
    margin-bottom: 1.25rem;
}

#membershipCanvas {
    display: block;
    width: 100%;
    height: auto;
}

/* ─── MEMBER ID STRIP ─── */
.member-id-strip {
    display: none;
    /* display: flex; */
    align-items: center;
    gap: .65rem;
    background: var(--g50);
    border: 1px solid var(--rule);
    border-radius: var(--radius-m);
    padding: .7rem 1rem;
    width: 100%;
    margin-bottom: 1rem;
}

.member-id-label {
    font-family: var(--fm);
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
    white-space: nowrap;
}

.member-id-val {
    font-family: var(--fm);
    font-size: .95rem;
    font-weight: 500;
    color: var(--g600);
    flex: 1;
    letter-spacing: .05em;
}

.copy-id-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--white);
    border: 1px solid var(--g200);
    border-radius: 100px;
    font-family: var(--fb);
    font-size: .72rem;
    font-weight: 600;
    color: var(--g600);
    cursor: pointer;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
}

.copy-id-btn:hover {
    background: var(--g100);
    border-color: var(--g300);
}

/* ─── DOWNLOAD / SHARE — sized for thumbs ─── */
.card-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .65rem;
    width: 100%;
}

.card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-m);
    font-family: var(--fh);
    font-size: .76rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform .15s, box-shadow .18s, background .18s;
    /* min-height: 52px; */
    min-height: 35px;
}

.card-btn:active {
    transform: scale(.97);
}

.card-btn-primary {
    background: var(--g500);
    color: #fff;
    box-shadow: var(--shadow-btn);
}

.card-btn-primary:hover {
    background: var(--g600);
    box-shadow: 0 5px 20px rgba(45, 138, 45, .38);
    transform: translateY(-1px);
}

.card-btn-share {
    background: var(--white);
    color: var(--g600);
    border: 1.5px solid var(--g200);
    box-shadow: var(--shadow-card);
}

.card-btn-share:hover {
    background: var(--g50);
    border-color: var(--g400);
    transform: translateY(-1px);
}

/* Slightly tighter on very narrow phones so nothing wraps or crowds */
@media (max-width: 360px) {
    .card-action-row {
        gap: .5rem;
    }

    .card-btn {
        padding: 13px 10px;
        font-size: .8rem;
        min-height: 50px;
    }

    .edit-btn {
        padding: 7px 13px;
        font-size: .76rem;
    }
}

/* ─── SPINNER ─── */
.btn-spinner {
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── FOOTER (lightened: tighter padding + line-height) ─── */
.site-footer {
    background: var(--white);
    border-top: 1px solid var(--rule);
    padding: 1.75rem 1.25rem;
    text-align: center;
}

.ft-brand {
    font-family: var(--fk);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--g600);
    margin-bottom: .5rem;
}

.ft-rule {
    width: 24px;
    height: 1.5px;
    background: var(--rule);
    margin: .6rem auto;
}

.ft-line {
    font-size: .73rem;
    color: var(--muted);
    line-height: 1.65;
}

.ft-line+.ft-line {
    margin-top: 3px;
}

/* ─── FOCUS ─── */
:focus-visible {
    outline: 2px solid var(--g400);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ─── RESPONSIVE ─── */
@media (min-width: 860px) {
    :root {
        --nav-h: 60px;
    }

    #nav {
        padding: 0 1.75rem;
    }

    .nav-brand {
        font-size: 1.35rem;
    }

    .hero-inner {
        padding: 2.75rem 2rem 3rem;
    }

    .mem-layout {
        grid-template-columns: 1fr 290px;
        gap: 2.25rem;
        padding: 2.5rem 1.5rem 5rem;
    }

    .mem-form-section,
    .mem-result-section {
        padding: 2rem 1.75rem;
    }

    .mem-aside {
        position: sticky;
        top: 76px;
    }

    .mem-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .submit-btn {
        width: auto;
        flex: 1;
    }

    .card-action-row {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 1024px) {
    .mem-layout {
        grid-template-columns: 1fr 310px;
        gap: 2.5rem;
    }
}

/* ─── REDUCED MOTION ─── */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}