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

:root {
    --warm-white: #F7F3EE;
    --sand: #E7DDD1;
    --taupe: #B7AA9A;
    --charcoal: #2C2B2A;
    --espresso: #5C4635;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(44,43,42,0.08);
    --shadow-lg: 0 12px 48px rgba(44,43,42,0.14);
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Outfit', sans-serif;
    background: var(--warm-white);
    color: var(--charcoal);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ─── Header ─── */
.site-header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--sand);
    background: rgba(247,243,238,0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.brand-mark {
    font-family: 'Fraunces', serif;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--charcoal);
    letter-spacing: -0.01em;
}

.brand-tagline {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--taupe);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ─── Hero ─── */
.hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 24px 60px;
    text-align: center;
}

.hero-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 560px;
}

.hero-eyebrow {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--taupe);
}

.hero-heading {
    font-family: 'Fraunces', serif;
    font-size: clamp(2.4rem, 6vw, 3.8rem);
    font-weight: 400;
    line-height: 1.1;
    color: var(--charcoal);
    letter-spacing: -0.02em;
}

.hero-heading em {
    font-style: italic;
    color: var(--espresso);
}

.hero-sub {
    font-size: 1rem;
    font-weight: 300;
    color: var(--taupe);
    letter-spacing: 0.02em;
}

/* ─── Upload Button ─── */
.btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 16px 36px;
    background: var(--charcoal);
    color: var(--warm-white);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    border-radius: 100px;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 2px 16px rgba(44,43,42,0.18);
    user-select: none;
}

.btn-upload:hover {
    background: var(--espresso);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(92,70,53,0.28);
}

.btn-upload:active { transform: translateY(0); }

.upload-hint {
    font-size: 0.72rem;
    color: var(--taupe);
    letter-spacing: 0.05em;
}

/* ─── Processing Overlay ─── */
.processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(247,243,238,0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.processing-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    font-size: 0.9rem;
    color: var(--taupe);
    letter-spacing: 0.06em;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 2px solid var(--sand);
    border-top-color: var(--espresso);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Workspace ─── */
.workspace {
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 24px 60px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    width: 100%;
}

/* ─── Controls Bar ─── */
.controls-bar {
    display: flex;
    align-items: center;
    gap: 28px;
    flex-wrap: wrap;
}

.intensity-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 180px;
}

.wm-position-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.control-label {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--taupe);
    flex-shrink: 0;
}

/* ─── Watermark Cycle Button ─── */
.wm-cycle-btn {
    padding: 6px 13px;
    border-radius: 100px;
    border: 1.5px solid var(--sand);
    background: transparent;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--charcoal);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.wm-cycle-btn:hover {
    border-color: var(--taupe);
    background: var(--sand);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 3px;
    background: var(--sand);
    border-radius: 100px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--charcoal);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--espresso);
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--charcoal);
    border: none;
    cursor: pointer;
}

.intensity-value {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--charcoal);
    min-width: 40px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ─── Compare Slider ─── */
.preview-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Fixed height — page never reflows when images load or change */
.compare-container {
    position: relative;
    width: 100%;
    height: clamp(260px, 54dvh, 520px);
    overflow: hidden;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    background: #141310;
    cursor: col-resize;
    user-select: none;
    touch-action: none;
}

/* After: fills the entire container, always fully visible */
.compare-after {
    position: absolute;
    inset: 0;
}

.compare-after img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Before: a div that shrinks/grows in width, hiding its right side.
   The image inside is pinned to the container's full width via JS
   so it always aligns pixel-perfectly with the after image. */
.compare-before {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 50%;        /* JS overrides this with a pixel value */
    overflow: hidden;
    z-index: 2;
}

.compare-before img {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    /* width is set by JS to the container's pixel width, not 100% of this div */
    object-fit: contain;
}

.compare-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
    pointer-events: none;
}

.handle-line {
    width: 2px;
    flex: 1;
    background: rgba(247,243,238,0.9);
    box-shadow: 0 0 8px rgba(0,0,0,0.2);
}

.handle-knob {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: var(--warm-white);
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(0,0,0,0.22);
    pointer-events: all;
    cursor: col-resize;
}

.preview-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--taupe);
    padding: 0 4px;
}

/* ─── Action Bar ─── */
.action-bar {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    border: none;
}

.btn-primary {
    background: var(--charcoal);
    color: var(--warm-white);
    box-shadow: 0 2px 16px rgba(44,43,42,0.18);
}

.btn-primary:hover {
    background: var(--espresso);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(92,70,53,0.28);
}

.btn-secondary {
    background: transparent;
    color: var(--charcoal);
    border: 1.5px solid var(--sand);
}

.btn-secondary:hover {
    border-color: var(--taupe);
    background: var(--sand);
}

.btn-icon {
    padding: 11px;
}

/* ─── Utility ─── */
.hidden { display: none !important; }

/* ─── Responsive ─── */
@media (max-width: 600px) {
    .site-header { padding: 16px 20px; }
    .hero { padding: 60px 20px 40px; }
    .workspace { padding: 28px 16px 48px; gap: 20px; }
    .preset-pills { gap: 6px; }
    .preset-pill { padding: 7px 14px; font-size: 0.78rem; }
    .handle-knob { width: 34px; height: 34px; }
}
