/* GalleryGap — Styles */

/* ═══════════════ RESET & CUSTOM PROPERTIES ═══════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Warm DIY palette */
    --bg-cream:        #FAF6F1;
    --bg-linen:        #F2ECE4;
    --bg-warm-white:   #FFFBF7;
    --charcoal:        #2D2A26;
    --charcoal-soft:   #4A4540;
    --charcoal-muted:  #7A7470;
    --terracotta:      #C65D3E;
    --terracotta-dark: #A94E34;
    --terracotta-glow: rgba(198, 93, 62, 0.15);
    --terracotta-soft: #E8A08A;
    --warm-sand:       #E6D5C3;
    --warm-gold:       #D4A96A;
    --wood-brown:      #8B7355;
    --glass-bg:        rgba(255, 251, 247, 0.72);
    --glass-border:    rgba(198, 93, 62, 0.12);
    --glass-shadow:    rgba(45, 42, 38, 0.08);
    --input-bg:        rgba(255, 255, 255, 0.85);
    --input-border:    rgba(198, 93, 62, 0.2);
    --input-focus:     rgba(198, 93, 62, 0.45);
    --radius-sm:       8px;
    --radius-md:       14px;
    --radius-lg:       20px;
    --shadow-sm:       0 2px 8px rgba(45, 42, 38, 0.06);
    --shadow-md:       0 4px 20px rgba(45, 42, 38, 0.1);
    --shadow-lg:       0 8px 40px rgba(45, 42, 38, 0.12);
    --transition-fast: 0.2s ease;
    --transition-med:  0.35s ease;

    /* SVG diagram colors */
    --svg-wall:        #E6DDD3;
    --svg-wall-stroke: #C4B9AA;
    --svg-frame:       #D4A96A;
    --svg-frame-stroke:#A48245;
    --svg-nail:        #C65D3E;
    --svg-ruler:       #8B7355;
    --svg-gap-line:    #C65D3E;
    --svg-dim-text:    #4A4540;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-cream);
    color: var(--charcoal);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.mono {
    font-family: 'Space Mono', 'Courier New', monospace;
}

.accent {
    color: var(--terracotta);
}

/* ═══════════════ HEADER ═══════════════ */
#site-header {
    background: linear-gradient(135deg, var(--charcoal) 0%, #3D3530 100%);
    color: var(--bg-cream);
    padding: 1.25rem 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(0,0,0,0.18);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.6rem;
}

.logo h1 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.logo .accent {
    color: var(--terracotta-soft);
}

.tagline {
    font-size: 0.85rem;
    color: var(--warm-sand);
    margin-top: 0.15rem;
    letter-spacing: 0.04em;
}

/* ═══════════════ MAIN ═══════════════ */
#main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
}

.section {
    margin-bottom: 1.5rem;
}

/* ═══════════════ AD SLOTS ═══════════════ */
.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--warm-sand);
    color: var(--charcoal-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: var(--bg-linen);
    border-radius: var(--radius-sm);
    margin: 1rem auto;
}

.ad-mobile {
    width: 320px;
    height: 50px;
    max-width: 100%;
}

.ad-desktop {
    display: none;
    width: 728px;
    height: 90px;
    max-width: 100%;
}

/* ═══════════════ GLASS CARD ═══════════════ */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition-med);
}

.glass-card:hover {
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--charcoal);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ═══════════════ SVG PREVIEW CARD ═══════════════ */
.preview-card {
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.preview-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.preview-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--terracotta);
    background: var(--terracotta-glow);
    border: 1px solid var(--terracotta-soft);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--terracotta);
    color: #fff;
    border-color: var(--terracotta);
}

.btn-secondary:active {
    transform: scale(0.97);
}

.btn-icon-sm {
    font-size: 1rem;
    line-height: 1;
}

.preview-container {
    min-height: 180px;
    background: var(--bg-linen);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: min-height var(--transition-med);
}

.preview-placeholder {
    color: var(--charcoal-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 2rem 1rem;
    line-height: 1.5;
}

.preview-container svg {
    width: 100%;
    height: auto;
    max-height: 380px;
    display: block;
}

/* ═══════════════ CALCULATOR LAYOUT ═══════════════ */
.calc-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ═══════════════ INPUT PANEL ═══════════════ */
.input-panel {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.input-group {
    margin-bottom: 0.75rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--charcoal-soft);
    margin-bottom: 0.3rem;
}

.input-hint {
    font-size: 0.75rem;
    color: var(--charcoal-muted);
    margin-bottom: 0.3rem;
}

.input-row {
    display: flex;
    gap: 0.5rem;
}

.input-row .input-wrapper {
    flex: 1;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    font-family: 'Space Mono', monospace;
    font-size: 0.95rem;
    padding: 0.6rem 0.75rem;
    padding-right: 2.5rem;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    color: var(--charcoal);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.input-wrapper select {
    padding-right: 0.75rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.select-wrapper::after {
    content: '▾';
    position: absolute;
    right: 0.75rem;
    color: var(--charcoal-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: var(--terracotta);
    box-shadow: 0 0 0 3px var(--terracotta-glow);
}

.input-unit {
    position: absolute;
    right: 0.75rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    color: var(--charcoal-muted);
    pointer-events: none;
}

.divider {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 0.75rem 0;
}

/* ═══════════════ FRAME ROWS ═══════════════ */
.frame-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(212, 169, 106, 0.08);
    border: 1px solid rgba(212, 169, 106, 0.18);
    border-radius: var(--radius-md);
    margin-bottom: 0.6rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.frame-row.removing {
    animation: slideOut 0.25s ease forwards;
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 120px;
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
        max-height: 0;
        margin-bottom: 0;
        padding: 0 0.75rem;
    }
}

.frame-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--terracotta);
    white-space: nowrap;
    min-width: 1.5rem;
    padding-bottom: 0.6rem;
}

.frame-inputs {
    display: flex;
    gap: 0.4rem;
    flex: 1;
}

.frame-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.frame-input-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--charcoal-muted);
    margin-bottom: 0.2rem;
}

.frame-input-group .input-wrapper input {
    font-size: 0.85rem;
    padding: 0.45rem 0.6rem;
    padding-right: 2rem;
}

.frame-input-group .input-unit {
    font-size: 0.7rem;
    right: 0.5rem;
}

.btn-remove-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-bottom: 0.15rem;
    background: rgba(198, 93, 62, 0.1);
    border: 1px solid rgba(198, 93, 62, 0.25);
    border-radius: var(--radius-sm);
    color: var(--terracotta);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    font-family: 'DM Sans', sans-serif;
    line-height: 1;
}

.btn-remove-frame:hover {
    background: var(--terracotta);
    color: #fff;
    border-color: var(--terracotta);
}

/* ═══════════════ BUTTONS ═══════════════ */
.btn-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.55rem 1rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--terracotta);
    background: transparent;
    border: 2px dashed var(--terracotta-soft);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 1rem;
}

.btn-add:hover {
    background: var(--terracotta-glow);
    border-color: var(--terracotta);
}

#calculate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1.25rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--terracotta) 0%, var(--terracotta-dark) 100%);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(198, 93, 62, 0.35);
    transition: all var(--transition-fast);
}

#calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(198, 93, 62, 0.45);
}

#calculate-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.1rem;
    transition: transform var(--transition-fast);
}

#calculate-btn:hover .btn-icon {
    transform: translateX(3px);
}

/* ═══════════════ RESULTS PANEL ═══════════════ */
.results-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Summary card */
.summary-card {
    text-align: center;
    padding: 1.25rem;
}

.summary-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.summary-text {
    font-size: 0.9rem;
    color: var(--charcoal-soft);
    line-height: 1.5;
}

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.stat-card {
    text-align: center;
    padding: 1rem 0.75rem;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--charcoal-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.stat-value {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--terracotta);
}

/* Nails card */
.nails-card {
    overflow-x: auto;
}

.nails-subtitle {
    font-size: 0.8rem;
    color: var(--charcoal-muted);
    margin-top: -0.6rem;
    margin-bottom: 0.75rem;
}

.nails-placeholder {
    color: var(--charcoal-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
}

.nails-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.nails-table th {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--charcoal-muted);
    padding: 0.5rem 0.6rem;
    text-align: left;
    border-bottom: 2px solid var(--warm-sand);
}

.nails-table td {
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid rgba(198, 93, 62, 0.08);
    color: var(--charcoal-soft);
}

.nails-table tr:last-child td {
    border-bottom: none;
}

.nails-table .nail-pos {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: var(--terracotta);
    font-size: 0.95rem;
}

.nails-table .frame-dim {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
}

/* ═══════════════ EXPLAINER SECTION ═══════════════ */
.explainer-card {
    padding: 2rem 1.5rem;
}

.explainer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.explainer-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.explainer-icon {
    font-size: 1.6rem;
    margin-bottom: 0.15rem;
}

.explainer-item h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--charcoal);
}

.explainer-item p {
    font-size: 0.88rem;
    color: var(--charcoal-soft);
    line-height: 1.55;
}

/* ═══════════════ FOOTER ═══════════════ */
#site-footer {
    background: var(--charcoal);
    color: var(--warm-sand);
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.8rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-disclaimer {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--charcoal-muted);
}

/* ═══════════════ TOAST NOTIFICATION ═══════════════ */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    background: var(--charcoal);
    color: var(--bg-cream);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ═══════════════ ERROR STATE ═══════════════ */
.input-error {
    border-color: #D44 !important;
    box-shadow: 0 0 0 3px rgba(221, 68, 68, 0.15) !important;
}

.error-message {
    font-size: 0.78rem;
    color: #C44;
    margin-top: 0.25rem;
    animation: slideIn 0.2s ease;
}

/* ═══════════════ RESPONSIVE — TABLET + ═══════════════ */
@media (min-width: 640px) {
    .stats-row {
        grid-template-columns: repeat(4, 1fr);
    }

    .explainer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ═══════════════ RESPONSIVE — DESKTOP ═══════════════ */
@media (min-width: 900px) {
    #site-header {
        padding: 1.5rem 2rem;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .tagline {
        font-size: 0.95rem;
    }

    #main-content {
        padding: 2rem 2rem 3rem;
    }

    .section {
        margin-bottom: 2rem;
    }

    .calc-layout {
        flex-direction: row;
        align-items: flex-start;
    }

    .input-panel {
        width: 380px;
        flex-shrink: 0;
        position: sticky;
        top: 100px;
    }

    .results-panel {
        flex: 1;
        min-width: 0;
    }

    .ad-mobile {
        display: none;
    }

    .ad-desktop {
        display: flex;
    }

    .preview-container {
        min-height: 250px;
    }

    .explainer-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .glass-card {
        padding: 1.75rem;
    }
}

/* ═══════════════ COPY BUTTON STATES ═══════════════ */
.btn-secondary.copied {
    background: #3A8;
    color: #fff;
    border-color: #3A8;
}

/* ═══════════════ MICRO-ANIMATIONS ═══════════════ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-panel .glass-card {
    animation: fadeInUp 0.4s ease both;
}

.results-panel .stat-card:nth-child(2) { animation-delay: 0.06s; }
.results-panel .stat-card:nth-child(3) { animation-delay: 0.12s; }
.results-panel .stat-card:nth-child(4) { animation-delay: 0.18s; }
