/* =====================================================
   PixPress — Global Stylesheet v2
   Web Interface Guidelines Compliant
   ===================================================== */

/* --- Design Tokens --- */
:root {
    --brand: #7C3AED;
    --brand-mid: #8B5CF6;
    --brand-light: #C4B5FD;
    --brand-dark: #5B21B6;
    --accent: #F59E0B;
    --success: #10B981;
    --bg: #0F0F13;
    --bg-card: #18181f;
    --bg-elevated: #22222c;
    --surface: rgba(255,255,255,0.04);
    --surface-hover: rgba(255,255,255,0.08);
    --text: #F4F4F8;
    --text-muted: #A1A1B5;
    --text-faint: #6B6B88;
    --border: rgba(255,255,255,0.08);
    --border-hover: rgba(124,58,237,0.5);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-brand: 0 0 40px rgba(124,58,237,0.15);
    --shadow-card: 0 4px 32px rgba(0,0,0,0.4);
    --tab-height: 52px;
    --header-height: 60px;
    --header-bg: rgba(15,15,19,0.85);
    --tabs-bg: rgba(15,15,19,0.9);
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-elevated: #F1F5F9;
    --surface: rgba(0,0,0,0.03);
    --surface-hover: rgba(0,0,0,0.06);
    --text: #0F172A;
    --text-muted: #475569;
    --text-faint: #94A3B8;
    --border: rgba(0,0,0,0.08);
    --border-hover: rgba(124,58,237,0.4);
    --shadow-card: 0 8px 32px rgba(0,0,0,0.06);
    --header-bg: rgba(255,255,255,0.85);
    --tabs-bg: rgba(248,250,252,0.9);
    color-scheme: light;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }

/* --- Accessibility --- */
:focus-visible {
    outline: 2px solid var(--brand-mid);
    outline-offset: 3px;
    border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* Skip link */
.skip-link {
    position: absolute;
    transform: translateY(-100%);
    left: 16px;
    top: 16px;
    background: var(--brand);
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 700;
    z-index: 9999;
    transition: transform 0.2s;
}
.skip-link:focus { transform: translateY(0); }

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Site Wrapper --- */
.site-wrapper { display: flex; flex-direction: column; min-height: 100vh; }

/* =====================================================
   HEADER
   ===================================================== */
.site-header {
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    height: var(--header-height);
}

.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    transition: opacity 0.15s;
}
.logo:hover { opacity: 0.85; }
.logo span {
    background: linear-gradient(135deg, var(--brand-mid), var(--brand-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-nav { display: flex; gap: 6px; align-items: center; }
.site-nav a {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}
.site-nav a:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.lang-text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s;
    padding: 4px 2px;
}
.lang-text-btn:hover { color: var(--text); }

/* =====================================================
   TOOL TABS
   ===================================================== */
.tool-tabs {
    background: var(--tabs-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow-x: auto;
    scrollbar-width: none;
}
.tool-tabs::-webkit-scrollbar { display: none; }

.tabs-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: center;
    gap: 2px;
}

.tab-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 22px;
    height: var(--tab-height);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.tab-link:hover { color: var(--text); }
.tab-link.active {
    color: var(--brand-mid);
    border-bottom-color: var(--brand-mid);
    font-weight: 700;
}

/* =====================================================
   AD SLOTS & INTERNAL BANNERS
   ===================================================== */
.ad-slot {
    max-width: 1000px;
    margin: 12px auto;
    width: calc(100% - 48px);
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-faint);
    font-size: 0.75rem;
}
.ad-top { height: 90px; }
.ad-bottom { height: 250px; margin-top: 0; margin-bottom: 24px; }

/* Internal Promo Banner */
.ad-top-wrapper {
    max-width: 1000px;
    margin: 32px auto 0;
    width: calc(100% - 48px);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}

.internal-banner {
    display: block;
    width: 100%;
    min-height: 140px;
    background-size: cover;
    background-position: right center;
    background-repeat: no-repeat;
    position: relative;
    text-decoration: none;
    color: #ffffff !important;
}

.internal-banner .banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(15,15,19,0.95) 0%, rgba(15,15,19,0.85) 45%, transparent 100%);
    z-index: 1;
    transition: background 0.25s ease;
}
.internal-banner:hover .banner-overlay {
    background: linear-gradient(90deg, rgba(20,10,30,0.95) 0%, rgba(20,10,30,0.85) 50%, transparent 100%);
}

.banner-content {
    position: relative;
    z-index: 2;
    padding: 24px 32px;
    max-width: 70%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    transform: translateY(0);
    transition: transform 0.2s ease;
}
.internal-banner:hover .banner-content { transform: translateY(-2px); }

.banner-content h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: 6px; line-height: 1.4; word-break: keep-all; text-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.banner-content p { font-size: 0.95rem; opacity: 0.9; margin-bottom: 12px; word-break: keep-all; }
.banner-cta {
    display: inline-block;
    align-self: flex-start;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
    color: #fff;
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 14px rgba(124,58,237,0.4);
}

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.site-main {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    padding: 32px 24px;
}

/* =====================================================
   HOME PAGE
   ===================================================== */
.home-hero {
    text-align: center;
    padding: 120px 0 96px;
    position: relative;
}

.home-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 50% at 50% -10%, rgba(124,58,237,0.22), transparent);
    pointer-events: none;
}

.home-hero h1 {
    font-size: clamp(2.4rem, 5.5vw, 3.6rem);
    font-weight: 800;
    letter-spacing: -1.5px;
    color: var(--text);
    margin-bottom: 24px;
    text-wrap: balance;
    line-height: 1.25;
}

.home-hero h1 span {
    background: linear-gradient(135deg, var(--brand-mid) 0%, var(--brand-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.home-hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 540px;
    margin: 0 auto;
    line-height: 1.8;
}

/* Tool Cards */
.tool-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 52px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(124,58,237,0.08) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-brand);
}
.tool-card:hover::before { opacity: 1; }
.tool-card:active { transform: translateY(-2px); }

.card-icon {
    font-size: 2.5rem;
    line-height: 1;
    display: block;
}

.tool-card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    text-wrap: balance;
}

.tool-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.card-btn {
    margin-top: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--brand-mid);
    transition: color 0.15s;
}
.tool-card:hover .card-btn { color: var(--brand-light); }

/* Home Features */
.home-features { margin-bottom: 40px; }

.feature-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.feature-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}

.feature-icon { font-size: 1.8rem; display: block; margin-bottom: 10px; }
.feature-item h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; }
.feature-item p { font-size: 0.85rem; color: var(--text-muted); }

/* =====================================================
   TOOL PAGES — Hero
   ===================================================== */
.page-hero {
    text-align: center;
    padding: 100px 0 80px;
    position: relative;
}
.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 80% at 50% 0%, rgba(124,58,237,0.12), transparent);
    pointer-events: none;
}

.page-hero h1 {
    font-size: clamp(2.2rem, 4.5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 24px;
    text-wrap: balance;
    line-height: 1.2;
}
.page-hero p { color: var(--text-muted); font-size: 1.15rem; line-height: 1.8; word-break: keep-all; overflow-wrap: break-word; }

/* =====================================================
   TOOL SECTION
   ===================================================== */
.tool-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 80px 48px;
    box-shadow: var(--shadow-card);
    text-align: center;
    margin-bottom: 120px;
}

.upload-area {
    border: 2px dashed rgba(124,58,237,0.3);
    border-radius: 20px;
    padding: 96px 24px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-area:hover, .upload-area.highlight {
    border-color: var(--brand-mid);
    background: rgba(124,58,237,0.06);
}

.upload-area .icon {
    font-size: 3.5rem;
    margin-bottom: 14px;
    display: block;
}

.upload-area h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.upload-area p { color: var(--text-muted); font-size: 0.9rem; }

.buttons { margin: 22px 0 10px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
    touch-action: manipulation;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(124,58,237,0.35);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124,58,237,0.45);
}
.btn-primary:active { transform: translateY(0); opacity: 0.9; }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-hover); }

.btn-start { margin-top: 20px; min-width: 160px; }

.limit-info { font-size: 0.8rem; color: var(--text-faint); margin-top: 12px; }

/* Progress */
.status-area { padding: 24px 0; }
.status-area p { margin-bottom: 14px; color: var(--text-muted); font-size: 0.95rem; }

.progress-bar-container {
    width: 100%;
    background: var(--bg-elevated);
    border-radius: 100px;
    overflow: hidden;
    height: 8px;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand-light) 100%);
    border-radius: 100px;
    transition: width 0.4s ease;
}

/* Result */
.result-area { padding: 20px 0; }
.success-icon { font-size: 3.5rem; margin-bottom: 14px; }
.result-area h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; }
.result-area p { color: var(--text-muted); margin-bottom: 18px; font-size: 0.95rem; }

.download-button {
    display: inline-block;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
    color: #fff;
    padding: 14px 40px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(124,58,237,0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.download-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(124,58,237,0.45);
}
.download-button:active { transform: translateY(-1px); }

.reset-button {
    display: block;
    margin: 16px auto 0;
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 0.875rem;
    cursor: pointer;
    font-family: inherit;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: color 0.15s, text-decoration-color 0.15s;
}
.reset-button:hover { color: var(--text-muted); text-decoration-color: currentColor; }

/* =====================================================
   QUALITY SLIDER
   ===================================================== */
.quality-control, .resize-control {
    margin-top: 24px;
    padding: 24px 26px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-align: left;
}

.control-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}
.hint-text { font-size: 0.8rem; font-weight: 400; color: var(--text-muted); }

.quality-control label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 14px;
}
.quality-hint { font-size: 0.8rem; font-weight: 400; color: var(--text-muted); margin-left: 6px; }

.slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--brand-mid) 0%, var(--brand-mid) 75%, var(--bg-card) 75%);
    border-radius: 100px;
    outline: none;
    cursor: pointer;
    touch-action: none;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-mid), var(--brand-light));
    border: 3px solid var(--bg-elevated);
    box-shadow: 0 2px 10px rgba(124,58,237,0.5);
    cursor: pointer;
    transition: transform 0.1s ease;
}
.slider::-webkit-slider-thumb:active { transform: scale(1.2); }

.quality-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.76rem;
    color: var(--text-faint);
    margin-top: 8px;
    margin-bottom: 4px;
}

/* =====================================================
   RESIZE INPUTS
   ===================================================== */
.dimension-inputs {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 12px;
}

.dim-group { flex: 1; }
.dim-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.dim-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}
.dim-input:focus { border-color: var(--brand-mid); }
.dim-input::placeholder { color: var(--text-faint); }

.dim-separator { font-size: 1.4rem; color: var(--text-faint); padding-bottom: 10px; }
.dim-hint { font-size: 0.8rem; color: var(--accent); margin-bottom: 4px; }

/* =====================================================
   CONTENT SECTION (SEO)
   ===================================================== */
.content-section { text-align: left; }

.info-block { margin-bottom: 80px; }

.info-block h2 {
    font-size: 1.2rem;
    font-weight: 700;
    padding-bottom: 12px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.feature-item-tool {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
}
.feature-item-tool h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.feature-item-tool p { font-size: 0.875rem; color: var(--text-muted); }

.step-list { padding-left: 20px; }
.step-list li { margin-bottom: 10px; font-size: 0.95rem; color: var(--text-muted); }
.step-list li strong { color: var(--text); }

.faq-item { margin-bottom: 1.2rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.faq-item p { font-size: 0.875rem; color: var(--text-muted); }

/* =====================================================
   CONTENT PAGES (privacy, terms, contact)
   ===================================================== */
.content-text { line-height: 2.0; max-width: 760px; font-size: 1.05rem; word-break: keep-all; overflow-wrap: break-word; }
.content-text h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 24px; text-wrap: balance; }
.content-text h2 { font-size: 1.15rem; font-weight: 700; margin-top: 28px; margin-bottom: 12px; color: var(--text); }
.content-text h3 { font-size: 1rem; font-weight: 600; color: var(--text-muted); margin-top: 20px; margin-bottom: 8px; }
.content-text p, .content-text li { color: var(--text-muted); font-size: 0.95rem; }
.content-text ul, .content-text ol { padding-left: 20px; }
.content-text li { margin-bottom: 6px; }
.content-text strong { color: var(--text); }

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 28px 24px;
    text-align: center;
}

.footer-brand { font-size: 1.1rem; font-weight: 800; margin-bottom: 4px; }
.footer-brand span { color: var(--brand-mid); }
.footer-copy { font-size: 0.8rem; color: var(--text-faint); margin-bottom: 12px; }
.footer-links { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.footer-links a {
    font-size: 0.82rem;
    color: var(--text-muted);
    transition: color 0.15s;
}
.footer-links a:hover { color: var(--text); }

/* =====================================================
   MOBILE RESPONSIVE
   ===================================================== */
@media (max-width: 720px) {
    .header-inner { padding: 0 16px; }
    .site-nav { gap: 8px; }
    .site-nav a { padding: 5px 8px; font-size: 0.8rem; }
    .tabs-inner { overflow-x: auto; padding: 0 16px; scrollbar-width: none; }
    .tabs-inner::-webkit-scrollbar { display: none; }
    .tab-link { padding: 0 14px; font-size: 0.82rem; }

    .site-main { padding: 32px 16px 80px; }

    .home-hero { padding: 80px 0 64px; }
    .home-hero h1 { font-size: 1.9rem; }
    .tool-cards { grid-template-columns: 1fr; }
    .feature-row { grid-template-columns: 1fr; }

    .tool-section { padding: 56px 20px; border-radius: 16px; margin-bottom: 80px; }
    .upload-area { padding: 64px 16px; }
    .info-block { margin-bottom: 64px; }
    .page-hero { padding: 64px 0 48px; }

    .dimension-inputs { flex-direction: column; }
    .dim-separator { display: none; }
    
    .content-text, .step-list li, .faq-item p, .home-hero p, .page-hero p {
        word-break: keep-all;
        overflow-wrap: break-word;
        line-height: 1.9;
    }

    .ad-slot { width: calc(100% - 32px); }
    
    .ad-top-wrapper { width: calc(100% - 32px); margin-top: 20px; }
    .banner-content { max-width: 100%; padding: 24px 20px; }
    .internal-banner .banner-overlay { background: linear-gradient(90deg, rgba(15,15,19,0.95) 0%, rgba(15,15,19,0.90) 70%, transparent 100%); }
    .banner-content h3 { font-size: 1.15rem; }
    .banner-content p { font-size: 0.9rem; }
}
