/* Cosmic Dissent — Anarchyland */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Space+Grotesk:ital,wght@0,400;0,500;0,700;1,400;1,500&display=swap');

/* ── Page wrapper ── */
.cd-wrap {
    font-family: 'Space Grotesk', sans-serif;
    max-width: 560px;
    margin: 0 auto;
    padding: 0 20px 60px;
    color: #1a1a1a;
}

/* ── Intro ── */
.cd-intro {
    text-align: center;
    padding: 40px 0 36px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 40px;
}

.cd-tagline {
    font-size: 22px;
    line-height: 1.5;
    font-weight: 300;
    color: #1a1a1a;
    margin: 0;
}

.cd-tagline em { font-style: italic; font-weight: 500; }

/* ── Form ── */
.cd-form {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.cd-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cd-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #1a1a1a;
}

.cd-required { color: #cc0000; }

.cd-optional-tag {
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 1px;
    color: #aaa;
    margin-left: 6px;
}

.cd-field-note {
    font-size: 12px;
    color: #888;
    margin: 0;
    line-height: 1.5;
}

.cd-select {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    padding: 12px 14px;
    border: 1px solid #ccc;
    border-radius: 2px;
    background: #fff;
    color: #1a1a1a;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231a1a1a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
    transition: border-color 0.15s;
}

.cd-select:focus { outline: none; border-color: #1a1a1a; }

/* ── Deeper toggle ── */
.cd-deeper { display: flex; flex-direction: column; gap: 6px; }

.cd-deeper-btn {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 2px;
    padding: 10px 16px;
    cursor: pointer;
    color: #555;
    text-align: left;
    transition: border-color 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cd-deeper-btn:hover { border-color: #1a1a1a; color: #1a1a1a; }
.cd-toggle-icon { font-size: 18px; line-height: 1; }
.cd-deeper-note { font-size: 11.5px; color: #aaa; margin: 0; line-height: 1.5; }

.cd-optional-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 2px;
    animation: cd-fade-in 0.2s ease;
}

@keyframes cd-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Generate button ── */
.cd-generate-btn {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 2px;
    padding: 16px 24px;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s;
}

.cd-generate-btn:hover { background: #333; }
.cd-generate-btn:disabled { background: #999; cursor: not-allowed; }

/* ── Loading ── */
.cd-loading { text-align: center; padding: 20px; }
.cd-loading p { font-size: 13px; color: #888; font-style: italic; margin: 12px 0 0; }

.cd-loading-dots { display: flex; gap: 6px; justify-content: center; }
.cd-loading-dots span {
    width: 8px; height: 8px;
    background: #1a1a1a; border-radius: 50%;
    animation: cd-bounce 1.2s ease infinite;
}
.cd-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.cd-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cd-bounce {
    0%,60%,100% { opacity: 0.2; transform: scale(1); }
    30%          { opacity: 1;   transform: scale(1.3); }
}

/* ── Error ── */
.cd-error {
    font-size: 13px;
    color: #cc0000;
    padding: 12px 14px;
    border: 1px solid #cc0000;
    border-radius: 2px;
    background: #fff8f8;
}

/* ── Result ── */
.cd-result { animation: cd-fade-in 0.3s ease; }

/* ── Card preview ── */
.cd-card-preview {
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

/* Card inner — base styles, aspect ratio set per format class */
.cd-card-inner {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}

/* Background image layer */
.cd-bg-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* ── Sign label overlay — top right ── */
.cd-overlay-signs {
    position: absolute;
    top: 7.3%;
    right: 4%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    z-index: 2;
}

.cd-sign-line {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(7px, 1.6vw, 11px);
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1.4;
    white-space: nowrap;
}

.cd-sign-line em {
    font-style: normal;
    font-weight: 400;
    color: #cccccc;
}

/* ── Text frame overlay — sits inside the rounded rect ── */
.cd-overlay-frame {
    position: absolute;
    /* Matching the frame in the graphic */
    top: 19%;
    left: 13%;
    right: 9%;
    bottom: 13%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 2;
    padding: 2% 0;
}

/* Title */
.cd-overlay-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(28px, 9vw, 64px);
    font-weight: 400;
    color: #ffffff;
    line-height: 0.95;
    letter-spacing: 1px;
    text-align: left;
    flex-shrink: 0;
}

/* Statement */
.cd-overlay-statement {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(9px, 2vw, 14px);
    font-weight: 400;
    color: #ffffff;
    line-height: 1.65;
    text-align: left;
    flex: 1;
    overflow: hidden;
    margin-top: 4%;
}

/* Mantra */
.cd-overlay-mantra {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(11px, 2.4vw, 16px);
    font-weight: 500;
    font-style: italic;
    color: #ffffff;
    line-height: 1.4;
    text-align: left;
    flex-shrink: 0;
    margin-top: 4%;
}

/* ── Actions ── */
.cd-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
}

.cd-download-btn {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 2px;
    padding: 13px 20px;
    cursor: pointer;
    flex: 1;
    transition: background 0.15s;
}

.cd-download-btn:hover { background: #333; }
.cd-download-btn:disabled { background: #999; cursor: not-allowed; }

.cd-regenerate-btn {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: transparent;
    color: #1a1a1a;
    border: 1px solid #1a1a1a;
    border-radius: 2px;
    padding: 13px 20px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.cd-regenerate-btn:hover { background: #1a1a1a; color: #fff; }

/* ── Share CTA ── */
.cd-share-cta {
    text-align: center;
    padding: 24px;
    border: 1px solid #e5e5e5;
    border-radius: 2px;
    background: #f9f9f9;
}

.cd-share-cta p { font-size: 14px; color: #444; margin: 0 0 8px; line-height: 1.6; }
.cd-share-cta p:last-child { margin: 0; }
.cd-share-sub { font-size: 12px !important; color: #888 !important; }
.cd-share-cta a { color: #1a1a1a; font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 480px) {
    .cd-actions { flex-direction: column; }
    .cd-tagline { font-size: 18px; }
    .cd-card-inner { max-width: 100%; }
}

/* ── Dual format card sizing ── */

/* 9:16 Story — 1080x1920 */
.cd-format-916 .cd-card-inner {
    aspect-ratio: 1080 / 1920;
    max-width: 400px;
}

/* 9:16 text zones — calibrated to story graphic */
.cd-format-916 .cd-overlay-signs {
    top: 12%;
    right: 22%;
}

.cd-format-916 .cd-overlay-frame {
    top: 25%;
    left: 22%;
    right: 22%;
    bottom: 20%;
}

.cd-format-916 .cd-overlay-title {
    font-size: clamp(14px, 6.5vw, 50px);
    line-height: 0.8;
}

.cd-format-916 .cd-overlay-statement {
    font-size: clamp(8px, 1.5vw, 11px);
}

.cd-format-916 .cd-overlay-mantra {
    font-size: clamp(10px, 2.1vw, 14px);
}

/* 3:4 Grid Post — 1200x1600 */
.cd-format-34 .cd-card-inner {
    aspect-ratio: 1200 / 1600;
    max-width: 480px;
}

/* 3:4 text zones — calibrated to grid graphic */
.cd-format-34 .cd-overlay-signs {
    top: 12%;
    right: 22%;
}

.cd-format-34 .cd-overlay-frame {
    top: 25%;
    left: 20%;
    right: 20%;
    bottom: 18%;
}

.cd-format-34 .cd-overlay-title {
    font-size: clamp(14px, 7vw, 54px);
    line-height: 0.88;
}

.cd-format-34 .cd-overlay-statement {
    font-size: clamp(9px, 1.8vw, 13px);
    line-height: 1.5;
}

.cd-format-34 .cd-overlay-mantra {
    font-size: clamp(12px, 2.5vw, 17px);
}

/* ── Format tab buttons styled to match download button ── */
.cd-card-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    border-bottom: none;
}

.cd-tab {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background: transparent;
    color: #1a1a1a;
    border: 1px solid #1a1a1a;
    border-bottom: 1px solid #1a1a1a;
    margin-bottom: 0;
    border-radius: 2px;
    padding: 13px 20px;
    cursor: pointer;
    flex: 1;
    transition: background 0.15s, color 0.15s;
}

.cd-tab:hover {
    background: #333;
    color: #fff;
    border-color: #333;
}

.cd-tab.active {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}
/* ── Text overflow protection ── */
.cd-overlay-title {
    overflow: hidden;
    word-break: break-word;
}

.cd-overlay-statement {
    overflow: hidden;
    word-break: break-word;
    display: -webkit-box;
    -webkit-box-orient: vertical;
}

.cd-overlay-mantra {
    overflow: hidden;
    word-break: break-word;
}
