/* ===================================================
   MaafKardo.in - Shared Styles
   =================================================== */

/* --- Base & Reset --- */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #fafafa;
    color: #1f2937;
    overflow-x: hidden;
}

.handwriting {
    font-family: 'Caveat', cursive;
}

/* --- Animated Background Gradient --- */
.bg-gradient-animated {
    background: linear-gradient(-45deg, #fdfbfb, #ebedee, #fdfbfb, #ffedf4);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Form Inputs --- */
input:focus,
textarea:focus {
    outline: none;
    border-color: #f43f5e;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
}

/* --- Feature Toggle Checkboxes (Builder) --- */
.feature-checkbox:checked + div {
    border-color: #f43f5e;
    background-color: #fff1f2;
}

.feature-checkbox:checked + div .check-icon {
    opacity: 1;
    transform: scale(1);
}

/* --- Phone Mockup (Builder Preview) --- */
.phone-mockup {
    border: 12px solid #1f2937;
    border-radius: 40px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: #f8fafc;
    position: relative;
    width: 320px;
    height: 650px;
}

.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 25px;
    background-color: #1f2937;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    z-index: 20;
}

/* --- Preview Module States --- */
.preview-module {
    transition: all 0.3s ease;
    opacity: 0.5;
    filter: grayscale(100%);
}

.preview-module.active {
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1.02);
}

/* --- Loader Spinner --- */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #f43f5e;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Page Transition --- */
.page-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Mobile Responsive Overrides --- */
@media (max-width: 640px) {
    .phone-mockup {
        display: none; /* Hide desktop preview on mobile */
    }

    h1 {
        font-size: 2.25rem !important;
        line-height: 1.2 !important;
    }

    .nav-cta-text {
        display: none; /* Shorten nav on tiny screens */
    }
}


/* ===================================================
   APOLOGY EXPERIENCE (6 Acts)
   =================================================== */

/* --- Act container & transitions --- */
.act {
    display: none;
    width: 100%;
    max-width: 30rem;
    margin: 0 auto;
}
.act.active {
    display: block;
    animation: actIn 0.5s ease-out forwards;
}
@keyframes actIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- ACT 1: Guilt Meter --- */
#guilt-stage {
    border-radius: 2rem;
    padding: 2rem 1.5rem;
    transition: background 0.15s ease;
    background: #fdf2f8;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}
#guilt-stage.text-light,
#guilt-stage.text-light * {
    color: #ffffff !important;
}
#guilt-stage.shaking {
    animation: shakeStage 0.25s infinite;
}
@keyframes shakeStage {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(calc(var(--shake) * -1), var(--shake)); }
    50% { transform: translate(var(--shake), calc(var(--shake) * -1)); }
    75% { transform: translate(calc(var(--shake) * -0.5), calc(var(--shake) * 0.5)); }
}
#guilt-stage.flash-red {
    animation: flashRed 0.5s ease;
}
@keyframes flashRed {
    0%, 100% { box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15); }
    50% { box-shadow: 0 0 0 100vmax rgba(220, 38, 38, 0.35); }
}
#guilt-face {
    font-size: 5rem;
    line-height: 1;
    transition: transform 0.15s ease;
    display: inline-block;
}

/* Custom guilt slider */
.guilt-track {
    position: relative;
    height: 16px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin: 1rem 0 0.5rem;
}
#guilt-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #fbbf24, #ef4444);
    transition: width 0.1s ease;
}
.guilt-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 40px;
    background: transparent;
    cursor: pointer;
    margin-top: -28px;
    position: relative;
    z-index: 2;
}
.guilt-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #ef4444;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.guilt-range::-moz-range-thumb {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #ef4444;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* --- ACT 2: Balloons --- */
#balloon-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    min-height: 180px;
    padding: 1rem 0;
}
.balloon {
    position: relative;
    width: 70px;
    height: 88px;
    border: none;
    border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%;
    cursor: pointer;
    box-shadow: inset -4px -6px 10px rgba(0,0,0,0.2);
    animation: floatBalloon 3s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}
.balloon:hover {
    transform: scale(1.08);
}
.balloon:active {
    transform: scale(0.95);
}
.balloon-face {
    font-size: 1.75rem;
    pointer-events: none;
}
.balloon-string {
    position: absolute;
    bottom: -18px;
    left: 50%;
    width: 2px;
    height: 20px;
    background: rgba(0,0,0,0.25);
    transform: translateX(-50%);
}
.balloon.popped {
    animation: popBalloon 0.35s ease forwards;
}
@keyframes floatBalloon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}
@keyframes popBalloon {
    0% { transform: scale(1); opacity: 1; }
    40% { transform: scale(1.35); opacity: 0.6; }
    100% { transform: scale(0); opacity: 0; }
}

/* --- ACT 3: Forgiveness Trap --- */
#forgive-zone {
    position: relative;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}
#no-btn {
    z-index: 3;
}

/* --- ACT 5: Wheel --- */
.wheel-wrap {
    position: relative;
    width: 260px;
    height: 260px;
    margin: 0 auto 1.5rem;
}
.wheel-pointer {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 22px solid #1f2937;
    z-index: 10;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}
#the-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid #1f2937;
    position: relative;
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
}
.wheel-num-wrap {
    position: absolute;
    inset: 0;
    transform-origin: 50% 50%;
    pointer-events: none;
}
.wheel-num {
    position: absolute;
    top: 8%;
    left: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.wheel-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 38px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 5;
}
.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.7rem 0.25rem 0.25rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
    border: 1px solid #f1f5f9;
    margin: 0.15rem;
    max-width: 100%;
}
.legend-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

/* --- ACT 6: Share Card --- */
#share-card {
    background: linear-gradient(160deg, #fff1f2, #ffffff 60%, #fdf2f8);
    border: 1px solid #fce7f3;
    border-radius: 1.5rem;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 20px 45px -15px rgba(244, 63, 94, 0.35);
}

/* --- Mobile tweaks for the experience --- */
@media (max-width: 640px) {
    #guilt-face { font-size: 4rem; }
    .balloon { width: 60px; height: 76px; }
    .wheel-wrap { width: 220px; height: 220px; }
}


/* ===================================================
   CERTIFICATE OF FORGIVENESS (Act 6)
   =================================================== */
#certificate {
    background:
        radial-gradient(circle at 15% 15%, rgba(251, 191, 36, 0.08), transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(244, 63, 94, 0.08), transparent 40%),
        #fffdf7;
    border-radius: 1rem;
    padding: 6px;
    box-shadow: 0 20px 45px -15px rgba(180, 120, 20, 0.35);
}
.cert-inner {
    border: 2px solid #d4af37;
    border-radius: 0.75rem;
    padding: 1.75rem 1.25rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    outline: 1px solid #e9d8a6;
    outline-offset: 4px;
}
.cert-flourish {
    font-size: 1.5rem;
    color: #d4af37;
    line-height: 1;
    margin-bottom: 0.25rem;
}
.cert-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.3em;
    font-size: 0.65rem;
    font-weight: 700;
    color: #b45309;
}
.cert-title {
    font-family: 'Caveat', cursive;
    font-size: 2.6rem;
    line-height: 1;
    color: #b91c1c;
    margin: 0.15rem 0 0.5rem;
}
.cert-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #d4af37;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}
.cert-rule span {
    height: 1px;
    width: 40px;
    background: #d4af37;
    display: inline-block;
}
.cert-body {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0.35rem 0;
}
.cert-name {
    font-size: 1.35rem;
    font-weight: 800;
    color: #111827;
    line-height: 1.1;
}
.cert-message {
    font-size: 1.4rem;
    color: #be123c;
    margin: 1rem 0.5rem;
    line-height: 1.3;
}
.cert-reward {
    background: rgba(251, 191, 36, 0.15);
    border: 1px dashed #d4af37;
    border-radius: 0.6rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: #92400e;
    margin: 0.75rem auto;
    max-width: 90%;
}
.cert-clause {
    font-size: 0.6rem;
    color: #9ca3af;
    line-height: 1.4;
    margin: 1rem auto 1.25rem;
    max-width: 92%;
    font-style: italic;
}
.cert-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-top: 0.5rem;
}
.cert-sign, .cert-date {
    flex: 1;
    text-align: center;
}
.cert-sign-line {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    border-bottom: 1px solid #d1d5db;
    padding-bottom: 2px;
    min-height: 1.4rem;
}
.cert-sign-label {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #9ca3af;
}
.cert-brand {
    font-size: 0.65rem;
    font-weight: 700;
    color: #b45309;
    margin-top: 1rem;
}

/* --- The Stamp --- */
.cert-stamp {
    position: absolute;
    top: 46%;
    left: 50%;
    width: 130px;
    height: 130px;
    transform: translate(-50%, -50%) rotate(-18deg) scale(3);
    opacity: 0;
    pointer-events: none;
}
.cert-stamp.stamped {
    animation: stampSlam 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
@keyframes stampSlam {
    0%   { opacity: 0; transform: translate(-50%, -50%) rotate(-18deg) scale(3); }
    60%  { opacity: 1; transform: translate(-50%, -50%) rotate(-14deg) scale(0.92); }
    80%  { transform: translate(-50%, -50%) rotate(-14deg) scale(1.06); }
    100% { opacity: 0.85; transform: translate(-50%, -50%) rotate(-14deg) scale(1); }
}
.stamp-inner {
    width: 100%;
    height: 100%;
    border: 4px double #dc2626;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #dc2626;
    transform: rotate(0deg);
    background: rgba(220, 38, 38, 0.04);
}
.stamp-top { font-size: 0.5rem; font-weight: 700; letter-spacing: 0.1em; }
.stamp-main { font-size: 1.5rem; font-weight: 900; letter-spacing: 0.05em; line-height: 1; margin: 2px 0; }
.stamp-bottom { font-size: 0.5rem; font-weight: 700; letter-spacing: 0.15em; }

/* ===================================================
   HEART-SHAPED PREPARATION LOADER (Builder Step 3)
   =================================================== */
#prep-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    text-align: center;
}
.heart-loader {
    filter: drop-shadow(0 8px 16px rgba(244, 63, 94, 0.25));
    animation: heartBeat 1.2s ease-in-out infinite;
}
@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.08); }
    30% { transform: scale(1); }
    45% { transform: scale(1.05); }
}
#prep-status {
    margin-top: 1.5rem;
    font-weight: 600;
    color: #6b7280;
    min-height: 1.5rem;
    transition: opacity 0.3s ease;
}
.prep-dots {
    margin-top: 0.75rem;
    display: flex;
    gap: 6px;
    justify-content: center;
}
.prep-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbcfe8;
    transition: background 0.3s ease, transform 0.3s ease;
}
.prep-dots span.on {
    background: #f43f5e;
    transform: scale(1.2);
}

/* ===================================================
   PREVIEW PHONE (Builder Step 3 - shows real site)
   =================================================== */
.preview-phone {
    width: fit-content;
    border: 10px solid #1f2937;
    border-radius: 40px;
    overflow: hidden;
    margin: 0 auto;
    position: relative;
    background: #1f2937;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
}
.preview-phone::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 18px;
    background: #1f2937;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    z-index: 5;
}
/* Screen holds the down-scaled iframe; JS sets its exact width/height */
.preview-screen {
    position: relative;
    overflow: hidden;
    border-radius: 30px;
    background: #ffffff;
}
.preview-phone iframe {
    border: 0;
    display: block;
    transform-origin: top left;
    background: #ffffff;
}


/* ===================================================
   APOLOGY MOBILE POLISH (fit everything on small screens)
   =================================================== */
.act {
    width: 100%;
}
#certificate,
#certificate .cert-inner {
    max-width: 100%;
    box-sizing: border-box;
}
#wheel-legend {
    gap: 2px;
}

@media (max-width: 420px) {
    .act { max-width: 100%; }

    #guilt-stage { padding: 1.5rem 1.1rem; }
    #guilt-face { font-size: 3.5rem; }

    .balloon { width: 56px; height: 70px; }
    #balloon-container { gap: 0.6rem; }

    .wheel-wrap { width: 200px; height: 200px; }
    #the-wheel { border-width: 6px; }
    .wheel-num { font-size: 0.8rem; }

    .cert-inner { padding: 1.4rem 1rem; }
    .cert-title { font-size: 2.2rem; }
    .cert-name { font-size: 1.15rem; }
    .cert-message { font-size: 1.2rem; }
    .cert-footer { gap: 0.5rem; }
    .cert-stamp { width: 108px; height: 108px; }
    .stamp-main { font-size: 1.25rem; }
}


/* ===================================================
   FEATURE PREVIEW BUTTON + MODAL (Builder Step 1)
   =================================================== */
.preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #e11d48;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.15s ease;
    z-index: 2;
    position: relative;
}
.preview-btn:hover {
    background: #ffe4e6;
    transform: translateY(-1px);
}
.preview-btn i {
    font-size: 0.6rem;
}

/* Feature preview stage keeps demos centered and contained */
#feature-preview-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
}
#feature-preview-stage > * {
    width: 100%;
}
