/* ============================================================
   Hadith Image Maker — Card CSS
   ⚠️  DO NOT MODIFY without testing html2canvas output.
   All card rendering styles MUST stay here (not in Tailwind).
   html2canvas does NOT reliably capture Tailwind CDN classes.
   ============================================================ */

/* ── Card Container ───────────────────────────────────────── */
.hadith-card {
    position: relative;
    width: 720px;
    height: 900px; /* default 4:5 */
    overflow: hidden;
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
}

/* ── Background Layer ─────────────────────────────────────── */
.card-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

/* ── Texture Overlays ─────────────────────────────────────── */
.card-noise {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    pointer-events: none;
}

.card-grain {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    background-size: 512px 512px;
    pointer-events: none;
}

.card-vignette {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.12) 100%);
    pointer-events: none;
}

/* ── Inner Border ─────────────────────────────────────────── */
.card-border-inner {
    position: absolute;
    z-index: 4;
    pointer-events: none;
}

/* Border Style: none */
.card-border-inner.border-none {
    display: none;
}

/* Border Style: thin */
.card-border-inner.border-thin {
    inset: 20px;
    border: 1px solid currentColor;
    opacity: 0.25;
}

/* Border Style: double */
.card-border-inner.border-double {
    inset: 16px;
    border: 3px double currentColor;
    opacity: 0.2;
}

/* Border Style: arch */
.card-border-inner.border-arch {
    inset: 20px;
    border: 1px solid currentColor;
    border-radius: 50% 50% 0 0 / 20% 20% 0 0;
    opacity: 0.2;
}

/* Border Style: inset */
.card-border-inner.border-inset {
    inset: 24px;
    border: 2px solid currentColor;
    opacity: 0.15;
    box-shadow: inset 0 0 0 4px currentColor;
}

/* Border Style: dotted */
.card-border-inner.border-dotted {
    inset: 20px;
    border: 2px dotted currentColor;
    opacity: 0.2;
}

/* ── Corner Ornaments ─────────────────────────────────────── */
.corner-ornament {
    position: absolute;
    z-index: 5;
    width: 60px;
    height: 60px;
    pointer-events: none;
}

#cornTL {
    top: 12px;
    left: 12px;
}

#cornTR {
    top: 12px;
    right: 12px;
}

#cornBL {
    bottom: 12px;
    left: 12px;
}

#cornBR {
    bottom: 12px;
    right: 12px;
}

/* ── Content Area ─────────────────────────────────────────── */
.card-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 60px 50px;
    box-sizing: border-box;
    text-align: center;
}

/* ── Bismillah ────────────────────────────────────────────── */
.card-bismillah {
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 12px;
    opacity: 0.7;
}

.card-bismillah.hidden {
    display: none;
}

/* ── Top Ornament ─────────────────────────────────────────── */
.card-ornament-top {
    margin-bottom: 16px;
    opacity: 0.5;
    line-height: 0;
}

.card-ornament-top:empty {
    display: none;
}

/* ── Narrator Prefix ──────────────────────────────────────── */
.card-narrator {
    font-size: 0.85em;
    font-style: italic;
    opacity: 0.75;
    margin-bottom: 8px;
    line-height: 1.5;
}

/* ── Card Text ────────────────────────────────────────────── */
.card-text {
    font-size: 1.12rem;
    line-height: 1.85;
    letter-spacing: 0.01em;
    word-spacing: 0.04em;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Text Size Variants */
.card-text.text-small {
    font-size: 0.92rem;
    line-height: 1.75;
}

.card-text.text-medium {
    font-size: 1.12rem;
    line-height: 1.85;
}

.card-text.text-large {
    font-size: 1.32rem;
    line-height: 1.75;
}

/* Text Alignment */
.card-text.align-center {
    text-align: center;
}

.card-text.align-left {
    text-align: left;
}

.card-text.align-right {
    text-align: right;
}

.card-text.align-justify {
    text-align: justify;
}

/* ── Divider ──────────────────────────────────────────────── */
.card-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 20px 0 16px;
    width: 60%;
    max-width: 200px;
}

.card-divider .line {
    flex: 1;
    height: 1px;
    background: currentColor;
    opacity: 0.25;
}

.card-divider .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
}

/* ── Reference ────────────────────────────────────────────── */
.card-ref {
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.55;
    margin-top: 4px;
}

/* ── Layout: Classic (default) ────────────────────────────── */
/* Default styles above handle classic layout */

/* ── Layout: Minimal ──────────────────────────────────────── */
.hadith-card.layout-minimal .card-bismillah {
    display: none;
}

.hadith-card.layout-minimal .card-ornament-top {
    display: none;
}

.hadith-card.layout-minimal .card-divider .dot {
    display: none;
}

.hadith-card.layout-minimal .card-divider {
    width: 40%;
}

.hadith-card.layout-minimal .corner-ornament {
    display: none;
}

/* ── Layout: Ornate ───────────────────────────────────────── */
.hadith-card.layout-ornate .card-content {
    padding: 70px 55px;
}

.hadith-card.layout-ornate .card-bismillah {
    font-size: 2.2rem;
    margin-bottom: 16px;
}

.hadith-card.layout-ornate .card-text {
    font-style: italic;
}

.hadith-card.layout-ornate .card-divider {
    width: 70%;
    max-width: 250px;
}

/* ── Layout: Drop Cap ─────────────────────────────────────── */
.hadith-card.layout-dropcap .card-text {
    text-align: left;
}

.hadith-card.layout-dropcap .card-text .drop-cap {
    float: left;
    font-size: 3.2em;
    line-height: 0.8;
    padding-right: 8px;
    padding-top: 4px;
    font-weight: 600;
}

.hadith-card.layout-dropcap .card-content {
    align-items: flex-start;
}

.hadith-card.layout-dropcap .card-divider {
    margin-left: 0;
    justify-content: flex-start;
}

.hadith-card.layout-dropcap .card-ref {
    align-self: flex-start;
}

/* ── Aspect Ratio Adjustments ─────────────────────────────── */

/* 1:1 (720×720) */
.hadith-card.ratio-1-1 {
    width: 720px;
    height: 720px;
}

.hadith-card.ratio-1-1 .card-content {
    padding: 50px 45px;
}

/* 16:9 (720×405) */
.hadith-card.ratio-16-9 {
    width: 720px;
    height: 405px;
}

.hadith-card.ratio-16-9 .card-content {
    padding: 30px 60px;
}

.hadith-card.ratio-16-9 .card-bismillah {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.hadith-card.ratio-16-9 .card-text.text-large {
    font-size: 1.1rem;
}

.hadith-card.ratio-16-9 .card-divider {
    margin: 12px 0 10px;
}

.hadith-card.ratio-16-9 .corner-ornament {
    width: 40px;
    height: 40px;
}

/* 9:16 (405×720) */
.hadith-card.ratio-9-16 {
    width: 405px;
    height: 720px;
}

.hadith-card.ratio-9-16 .card-content {
    padding: 50px 30px;
}

.hadith-card.ratio-9-16 .card-text.text-large {
    font-size: 1.15rem;
}

.hadith-card.ratio-9-16 .corner-ornament {
    width: 45px;
    height: 45px;
}
