/* =============================================================
   NestNooks — calculator.css
   Loaded only on page-calculator.php (Tool / Calculator template).
   Mobile-first. All layout enhancements via min-width queries.
   v1.0.0
============================================================= */


/* ═══════════════════════════════════════════════════════════
   TOOL HERO
═══════════════════════════════════════════════════════════ */

.tool-hero {
    background: var(--cream);
    padding: calc(var(--nav-h) + 32px) 0 clamp(32px, 5vw, 56px);
    border-bottom: 1px solid var(--border);
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: clamp(20px, 3vw, 32px);
}

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted-2);
}

.breadcrumb a {
    color: var(--muted);
    text-decoration: none;
    transition: color var(--dur-fast);
}
.breadcrumb a:hover { color: var(--terra); }

.breadcrumb [aria-current="page"] {
    color: var(--text-2);
    font-weight: 600;
}

/* Hero inner layout */
.tool-hero-inner {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: flex-start;
}

@media (min-width: 640px) {
    .tool-hero-inner {
        flex-direction: row;
        align-items: center;
        gap: 24px;
    }
}

/* Icon */
.tool-hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(56px, 10vw, 72px);
    height: clamp(56px, 10vw, 72px);
    background: var(--terra-soft);
    border: 1.5px solid var(--terra-border);
    border-radius: var(--r-xl);
    color: var(--terra);
    flex-shrink: 0;
}

.tool-hero-icon svg {
    width: clamp(24px, 4.5vw, 32px);
    height: clamp(24px, 4.5vw, 32px);
}

/* Content */
.tool-hero-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-hero-title {
    font-size: clamp(1.5rem, 3.5vw, 2.4rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0;
}

.tool-hero-desc {
    font-size: clamp(0.9rem, 1.7vw, 1.05rem);
    color: var(--muted);
    line-height: 1.65;
    max-width: 60ch;
    margin: 0;
}

/* Stats row */
.tool-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    margin-top: 4px;
}

.tool-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
}

.tool-stat svg { flex-shrink: 0; }

.tool-stat--free {
    color: var(--green);
}
.tool-stat--free svg { color: var(--green); }


/* ═══════════════════════════════════════════════════════════
   TOOL BODY LAYOUT
═══════════════════════════════════════════════════════════ */

.tool-body {
    padding: clamp(32px, 5vw, 60px) 0 var(--section-pad);
    background: var(--warm-white);
}

.tool-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(28px, 4vw, 48px);
    align-items: start;
}

@media (min-width: 1024px) {
    .tool-layout {
        grid-template-columns: 1fr 340px;
    }
}

@media (min-width: 1200px) {
    .tool-layout {
        grid-template-columns: 1fr 380px;
    }
}


/* ═══════════════════════════════════════════════════════════
   UNIT TOGGLE
═══════════════════════════════════════════════════════════ */

.unit-toggle {
    display: inline-flex;
    background: var(--cream-2);
    border: 1.5px solid var(--border-2);
    border-radius: var(--r-pill);
    padding: 3px;
    gap: 2px;
    margin-bottom: 20px;
}

.unit-btn {
    padding: 6px 18px;
    border-radius: var(--r-pill);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background var(--dur-fast), color var(--dur-fast);
    -webkit-tap-highlight-color: transparent;
}

.unit-btn.is-active {
    background: var(--card);
    color: var(--text);
    box-shadow: 0 1px 4px rgba(30, 26, 21, 0.10);
}


/* ═══════════════════════════════════════════════════════════
   CALCULATOR CARD
═══════════════════════════════════════════════════════════ */

.calc-card {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--r-2xl);
    overflow: hidden;
    box-shadow: var(--shadow);
}


/* ── Step Progress Bar ─── */
.calc-steps {
    display: flex;
    align-items: center;
    padding: 20px clamp(20px, 4vw, 32px);
    border-bottom: 1px solid var(--border);
    gap: 0;
    background: var(--cream);
    overflow-x: auto;
    scrollbar-width: none;
}
.calc-steps::-webkit-scrollbar { display: none; }

.calc-step {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.step-indicator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    background: var(--cream-2);
    border: 1.5px solid var(--border-2);
    color: var(--muted);
    flex-shrink: 0;
    transition: background var(--dur-base), color var(--dur-base), border-color var(--dur-base);
}

.calc-step.is-active .step-indicator {
    background: var(--terra);
    border-color: var(--terra);
    color: #fff;
}

.calc-step.is-done .step-indicator {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.step-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted-2);
    white-space: nowrap;
    transition: color var(--dur-fast);
}

.calc-step.is-active .step-label { color: var(--text); }
.calc-step.is-done  .step-label { color: var(--green); }

.step-connector {
    flex: 1;
    min-width: 20px;
    height: 1.5px;
    background: var(--border-2);
    margin: 0 8px;
}


/* ── Calculator Form Area ─── */
.calc-form {
    padding: clamp(20px, 4vw, 36px);
}

.calc-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 24px 0;
}

/* Section within the form */
.calc-section {
    margin-bottom: clamp(24px, 4vw, 36px);
}

.calc-section:last-child {
    margin-bottom: 0;
}

.calc-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--terra);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.calc-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--terra-border);
    border-radius: 1px;
}

/* Dimension row: width × height */
.dimension-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
}

.dimension-x {
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--muted-2);
}

/* Wall entry (repeatable) */
.wall-entries {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wall-entry {
    background: var(--cream);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    padding: 16px;
    position: relative;
}

.wall-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.wall-entry-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-2);
}

.wall-entry-remove {
    width: 28px;
    height: 28px;
    border-radius: var(--r);
    background: transparent;
    border: 1px solid var(--border-2);
    color: var(--muted-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
    font-size: 1rem;
    line-height: 1;
}
.wall-entry-remove:hover {
    background: var(--red-soft);
    color: var(--red);
    border-color: var(--red-border);
}

/* Add wall button */
.add-wall-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--terra);
    background: var(--terra-soft);
    border: 1.5px dashed var(--terra-border);
    border-radius: var(--r-lg);
    padding: 12px 18px;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    transition: background var(--dur-fast), border-color var(--dur-fast);
    margin-top: 8px;
}
.add-wall-btn:hover {
    background: rgba(196, 113, 74, 0.14);
    border-color: var(--terra);
}

/* Options grid (checkboxes / radio rows) */
.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 480px) {
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.option-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--cream);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    cursor: pointer;
    transition: border-color var(--dur-fast), background var(--dur-fast);
    -webkit-tap-highlight-color: transparent;
}

.option-chip input[type="radio"],
.option-chip input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--terra);
    flex-shrink: 0;
    cursor: pointer;
}

.option-chip:has(input:checked) {
    border-color: var(--terra);
    background: var(--terra-soft);
}

.option-chip-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
}
.option-chip:has(input:checked) .option-chip-label {
    color: var(--terra);
}

/* Number input with label */
.labeled-input {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.labeled-input label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-2);
}

/* Inline number input pair (width + height) */
.input-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}


/* ── Navigation buttons between steps ─── */
.calc-nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    margin-top: 28px;
    flex-wrap: wrap;
}

.calc-nav-row .btn { min-width: 120px; }


/* ═══════════════════════════════════════════════════════════
   RESULTS PANEL
═══════════════════════════════════════════════════════════ */

.calc-results {
    padding: clamp(20px, 4vw, 36px);
    border-top: 1.5px solid var(--border);
    background: linear-gradient(to bottom, var(--cream), var(--warm-white));
    display: none;
}

.calc-results.is-ready {
    display: block;
    animation: fadeUp 0.4s var(--ease-out) forwards;
}

/* Results header */
.results-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.results-icon {
    width: 44px;
    height: 44px;
    background: var(--green-soft);
    border: 1.5px solid var(--green-border);
    border-radius: var(--r-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--green);
    flex-shrink: 0;
}

.results-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.results-subtitle {
    font-size: 0.82rem;
    color: var(--muted);
}

/* Key metric highlight */
.results-primary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

@media (min-width: 480px) {
    .results-primary {
        grid-template-columns: repeat(3, 1fr);
    }
}

.result-metric {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    padding: clamp(12px, 2vw, 18px);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.result-metric.is-primary {
    border-color: var(--terra-border);
    background: var(--terra-soft);
    grid-column: span 2;
}

@media (min-width: 480px) {
    .result-metric.is-primary { grid-column: span 1; }
}

.result-metric-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-2);
    margin-bottom: 6px;
}

.result-metric.is-primary .result-metric-label {
    color: var(--terra-mid);
}

.result-metric-value {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 600;
    color: var(--text);
    line-height: 1;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.result-metric.is-primary .result-metric-value {
    color: var(--terra);
}

.result-metric-unit {
    font-size: 0.75rem;
    color: var(--muted-2);
    font-weight: 500;
}

/* Results breakdown list */
.results-breakdown {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 20px;
}

.breakdown-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    gap: 12px;
}
.breakdown-row:last-child { border-bottom: none; }

.breakdown-label {
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 500;
}

.breakdown-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    text-align: right;
    flex-shrink: 0;
}

/* Cost estimate */
.results-cost {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--ink);
    border-radius: var(--r-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.cost-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--on-dark-muted);
}

.cost-tiers {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.cost-tier {
    text-align: center;
}

.cost-tier-name {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--on-dark-muted);
    margin-bottom: 4px;
}

.cost-tier-range {
    font-family: var(--font-display);
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 600;
    color: var(--on-dark);
    letter-spacing: -0.01em;
}

/* Pro tip inside results */
.results-pro-tip {
    display: flex;
    gap: 12px;
    background: var(--amber-soft);
    border: 1px solid var(--amber);
    border-radius: var(--r-lg);
    padding: 14px 16px;
    font-size: 0.875rem;
    color: var(--text-2);
    line-height: 1.6;
}

.results-pro-tip svg { flex-shrink: 0; margin-top: 2px; color: var(--amber); }


/* ── Action buttons below calculator ─── */
.calc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}


/* ── How-to guide ─── */
.calc-guide {
    margin-top: clamp(40px, 6vw, 64px);
    padding: clamp(24px, 4vw, 40px);
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--r-2xl);
}

.calc-guide h2 {
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    color: var(--text);
    margin-bottom: 20px;
}

.calc-guide p {
    font-size: 0.95rem;
    color: var(--text-2);
    line-height: 1.75;
    margin-bottom: 16px;
}

.calc-guide ul,
.calc-guide ol {
    list-style: auto;
    padding-left: 24px;
    margin-bottom: 16px;
}

.calc-guide li {
    font-size: 0.95rem;
    color: var(--text-2);
    line-height: 1.7;
    margin-bottom: 8px;
}

/* Entry content in WP */
.entry-content a {
    color: var(--terra);
    text-decoration: underline;
    text-decoration-color: var(--terra-border);
    text-underline-offset: 3px;
    transition: text-decoration-color var(--dur-fast);
}
.entry-content a:hover { text-decoration-color: var(--terra); }


/* ═══════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════ */

.tool-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Sidebar cards */
.sidebar-card {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--r-xl);
    padding: clamp(18px, 3vw, 24px);
    position: sticky;
    top: calc(var(--nav-h) + 20px);
}

.sidebar-card + .sidebar-card {
    position: static; /* Only first sticks */
}

.sidebar-card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-card-title svg { color: var(--terra); flex-shrink: 0; }

/* Tips list */
.tips-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.tips-list li {
    font-size: 0.85rem;
    color: var(--text-2);
    line-height: 1.6;
    padding-left: 20px;
    position: relative;
}

.tips-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--terra);
    font-size: 0.75rem;
    top: 2px;
}

.sidebar-note {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.sidebar-empty {
    font-size: 0.85rem;
    color: var(--muted-2);
    font-style: italic;
    text-align: center;
    padding: 12px 0;
}

/* Product recommendations */
.product-recs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-rec-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none;
    transition: color var(--dur-fast);
    color: inherit;
}
.product-rec-item:last-child { border-bottom: none; padding-bottom: 0; }

.product-rec-img {
    width: 48px;
    height: 48px;
    border-radius: var(--r);
    background: var(--cream-2);
    flex-shrink: 0;
    overflow: hidden;
}
.product-rec-img img { width: 100%; height: 100%; object-fit: cover; }

.product-rec-info { flex: 1; min-width: 0; }
.product-rec-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.product-rec-price {
    font-size: 0.78rem;
    color: var(--terra);
    font-weight: 700;
}

.product-rec-arrow {
    color: var(--muted-2);
    flex-shrink: 0;
}

/* Related posts sidebar */
.sidebar-posts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-post-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: color var(--dur-fast);
}
.sidebar-post-link:hover { color: var(--terra); }

.sidebar-post-img {
    width: 52px;
    height: 42px;
    border-radius: var(--r);
    background: var(--cream-2);
    overflow: hidden;
    flex-shrink: 0;
}
.sidebar-post-img img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-post-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-2);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--dur-fast);
}
.sidebar-post-link:hover .sidebar-post-title { color: var(--terra); }


/* ═══════════════════════════════════════════════════════════
   RELATED TOOLS SECTION
═══════════════════════════════════════════════════════════ */

.related-tools {
    padding: var(--section-pad) 0;
    background: var(--cream);
    border-top: 1px solid var(--border);
}

.related-tools-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--card-gap);
}

@media (min-width: 640px) {
    .related-tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .related-tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.related-tool-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--r-xl);
    padding: clamp(16px, 3vw, 22px);
    text-decoration: none;
    transition: border-color var(--dur-base),
                box-shadow var(--dur-base),
                transform var(--dur-base) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.related-tool-card:hover {
    border-color: var(--terra-border);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.related-tool-card .tool-icon {
    flex-shrink: 0;
}

.related-tool-body { flex: 1; min-width: 0; }

.related-tool-name {
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.3;
}

.related-tool-desc {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-tool-arrow {
    color: var(--muted-2);
    flex-shrink: 0;
    transition: color var(--dur-fast), transform var(--dur-fast);
}
.related-tool-card:hover .related-tool-arrow {
    color: var(--terra);
    transform: translateX(3px);
}
