/* ─────────────────────────────────────────────────────────
   tool-hero.css — shared compact hero + playground pattern
   Used by /image-upscaler, /background-remover, /features/*
   Each page sets its own --th-accent + --th-accent-2 on .th-hero
   ───────────────────────────────────────────────────────── */

/* Reset + baseline */
.tool-page { padding: 0 0 88px; }
.th-hero html, .th-hero body { max-width: 100%; overflow-x: hidden; }
.th-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}
.th-hero img, .th-hero video { max-width: 100%; height: auto; }
@media (max-width: 960px) { .th-container { padding: 0 20px; } }
@media (max-width: 640px) { .th-container { padding: 0 16px; } }

/* ───────── Hero wrapper ───────── */
.th-hero {
    --th-accent: #2563EB;
    --th-accent-2: #4F46E5;
    --th-text: #0F172A;
    --th-text-2: #475569;
    --th-muted: #64748B;
    --th-border: #E2E8F0;
    --th-bg: #F8FAFF;
    --th-green: #10B981;

    padding: 110px 0 40px;
    background:
        radial-gradient(80% 60% at 20% 10%, rgba(99, 102, 241, 0.10) 0%, transparent 60%),
        radial-gradient(70% 50% at 90% 0%, rgba(236, 72, 153, 0.06) 0%, transparent 55%),
        var(--th-bg);
    border-bottom: 1px solid var(--th-border);
    font-family: 'DM Sans', sans-serif;
}

.th-hero-head {
    text-align: center;
    max-width: 820px;
    margin: 0 auto 28px;
}

.th-hero-head .th-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--th-accent);
    background: #EEF4FF;
    border: 1px solid #DBEAFE;
    padding: 6px 14px;
    border-radius: 100px;
    margin-bottom: 18px;
}
.th-hero-head .th-tag .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--th-accent);
    animation: th-pulse 2s infinite;
}
@keyframes th-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.th-hero h1 {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(1.7rem, 3.6vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
    color: var(--th-text);
    margin: 0 0 12px;
}
.th-hero h1 .em {
    background: linear-gradient(135deg, var(--th-accent-2), var(--th-accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.th-hero-sub {
    font-size: clamp(0.95rem, 1.6vw, 1.02rem);
    line-height: 1.6;
    color: var(--th-text-2);
    max-width: 680px;
    margin: 0 auto;
}

/* ───────── Hero grid: playground + sample ───────── */
.th-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 28px;
    align-items: center;
}
.th-hero-grid > * { min-width: 0; }

.th-card {
    background: #fff;
    border: 1px solid var(--th-border);
    border-radius: 20px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.07);
    padding: 22px;
    display: flex;
    flex-direction: column;
}

.th-card-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--th-accent);
    margin-bottom: 10px;
}

/* ───── Upload zone ───── */
.th-zone {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 340px;
    border-radius: 16px;
    border: 2px dashed #CBD5E1;
    background: #F8FAFF;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.th-zone:hover { border-color: var(--th-accent); background: #EEF4FF; }
.th-zone.has-file { border-style: solid; border-color: var(--th-border); background: #F8FAFF; cursor: default; }
.th-zone.has-file:hover { border-color: var(--th-border); background: #F8FAFF; }
.th-zone.dragover { border-color: var(--th-accent); background: #DBEAFE; }

.th-zone input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}
.th-zone.has-file input[type=file] { display: none; }

.th-zone-empty {
    text-align: center;
    padding: 24px;
    pointer-events: none;
}
.th-upload-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #EEF4FF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--th-accent);
    margin-bottom: 12px;
}
.th-upload-icon svg { width: 22px; height: 22px; }
.th-upload-title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--th-text);
    margin-bottom: 4px;
}
.th-upload-sub {
    font-size: 0.85rem;
    color: var(--th-text-2);
    margin-bottom: 10px;
}
.th-upload-hint {
    display: inline-block;
    font-size: 0.72rem;
    color: var(--th-muted);
    background: #fff;
    border: 1px solid var(--th-border);
    border-radius: 100px;
    padding: 4px 12px;
}

.th-zone-preview,
.th-zone-output {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background:
        linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
        linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    z-index: 0;
}

.th-zone-new {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    z-index: 3;
    transition: background 0.2s;
}
.th-zone-new:hover { background: rgba(15, 23, 42, 0.9); }

.th-loading {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    z-index: 3;
    flex-direction: column;
    gap: 10px;
}
.th-loading.active { display: flex; }
.th-loading-spin {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: th-spin 0.9s linear infinite;
}
@keyframes th-spin { to { transform: rotate(360deg); } }

/* ───── Prompt zone (textarea) ───── */
.th-prompt-zone {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 340px;
    border-radius: 16px;
    border: 1px solid var(--th-border);
    background: #F8FAFF;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 16px;
}
.th-prompt-input {
    width: 100%;
    flex: 1;
    border: 0;
    background: transparent;
    resize: none;
    outline: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: var(--th-text);
    line-height: 1.55;
}
.th-prompt-input::placeholder { color: #94A3B8; }
.th-prompt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.th-prompt-chip {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--th-text-2);
    background: #fff;
    border: 1px solid var(--th-border);
    padding: 5px 11px;
    border-radius: 100px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.th-prompt-chip:hover { border-color: var(--th-accent); color: var(--th-accent); }

/* ───── Actions + status ───── */
.th-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.th-btn {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 12px;
    padding: 12px 20px;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.th-btn-primary {
    flex: 1 1 auto;
    background: linear-gradient(135deg, var(--th-accent-2), var(--th-accent));
    color: #fff;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.3);
}
.th-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(79, 70, 229, 0.4); }
.th-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.th-status {
    font-size: 0.82rem;
    color: var(--th-muted);
    text-align: center;
    margin-top: 10px;
}
.th-status:empty { display: none; }

/* ───── Sample ───── */
.th-sample {
    background: #fff;
    border: 1px solid var(--th-border);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.07);
}
.th-sample-media {
    position: relative;
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: #F1F5FF;
    aspect-ratio: 4 / 3;
    max-height: 340px;
    display: block;
}
.th-sample-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ───── Stats row ───── */
.th-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 28px;
}
.th-stats > * { min-width: 0; }
.th-stat {
    background: #fff;
    border: 1px solid var(--th-border);
    border-radius: 14px;
    padding: 14px 16px;
    text-align: center;
}
.th-stat strong {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--th-accent-2);
    letter-spacing: -0.02em;
}
.th-stat span {
    display: block;
    font-size: 0.78rem;
    color: var(--th-muted);
    margin-top: 2px;
}

/* ───── Responsive ───── */
@media (max-width: 960px) {
    .th-hero-grid { grid-template-columns: 1fr; gap: 20px; }
    .th-zone,
    .th-prompt-zone,
    .th-sample-media { aspect-ratio: 16 / 10; max-height: 360px; }
}
@media (max-width: 640px) {
    .th-hero { padding: 100px 0 32px; }
    .th-card,
    .th-sample { padding: 16px; border-radius: 16px; }
    .th-sample { padding: 12px; }
    .th-zone,
    .th-prompt-zone { border-radius: 14px; aspect-ratio: 4 / 3; max-height: 280px; }
    .th-sample-media { aspect-ratio: 4 / 3; max-height: 280px; }
    .th-stats { grid-template-columns: repeat(2, 1fr); }
    .th-hero h1 { font-size: 1.55rem; line-height: 1.2; }
    .th-hero-sub { font-size: 0.92rem; }
    .th-upload-title { font-size: 0.95rem; }
    .th-upload-sub { font-size: 0.8rem; }
    .th-btn { font-size: 0.9rem; padding: 11px 16px; }
    .th-btn-primary { width: 100%; }
}
@media (max-width: 400px) {
    .th-hero { padding: 92px 0 28px; }
    .th-stat strong { font-size: 1.15rem; }
    .th-stat span { font-size: 0.72rem; }
}

/* ───── Tool content headings (under hero) ───── */
.tool-page .tool-content h2 {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(1.25rem, 2.4vw, 1.6rem);
    letter-spacing: -0.02em;
    color: var(--th-text, #0F172A);
}
.tool-page .tool-content h3 {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    letter-spacing: -0.015em;
}

/* ───── Store modal (iOS / Android) ───── */
.th-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: 'DM Sans', sans-serif;
}
.th-modal.open { display: flex; }
.th-modal-card {
    background: #fff;
    border-radius: 20px;
    max-width: 440px;
    width: 100%;
    padding: 28px 28px 24px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    position: relative;
    animation: th-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes th-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.th-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: 0;
    font-size: 1.1rem;
    cursor: pointer;
    color: #64748B;
    padding: 4px 8px;
}
.th-modal-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #4F46E5;
    background: #EEF2FF;
    border-radius: 999px;
    padding: 5px 12px;
    margin-bottom: 10px;
}
.th-modal-icon { font-size: 2rem; margin-bottom: 6px; }
.th-modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0F172A;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
}
.th-modal-sub {
    font-size: 0.92rem;
    color: #475569;
    margin: 0 0 18px;
    line-height: 1.55;
}
.th-modal-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.th-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s;
}
.th-modal-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12); }
.th-modal-btn.ios { background: #000; color: #fff; }
.th-modal-btn.android { background: #34A853; color: #fff; }
.th-modal-note { font-size: 0.78rem; color: #94A3B8; margin-top: 14px; }
@media (max-width: 480px) { .th-modal-btns { grid-template-columns: 1fr; } }
