:root {
    --gold-50: var(--p-blue-50);
    --gold-100: var(--p-blue-100);
    --gold-200: var(--p-blue-200);
    --gold-300: var(--p-blue-300);
    --gold-400: var(--p-blue-400);
    --gold-500: var(--p-blue-500);
    --gold-600: var(--p-blue-600);
    --gold-700: var(--p-blue-700);
    --slate-50: var(--p-blue-50);
    --slate-100: var(--p-blue-50);
    --slate-200: var(--p-blue-100);
    --slate-300: var(--p-blue-200);
    --slate-400: var(--p-blue-400);
    --slate-500: var(--p-blue-500);
    --slate-600: var(--p-blue-700);
    --slate-700: var(--p-blue-800);
    --slate-800: var(--p-blue-900);
    --slate-900: var(--p-blue-900);

    --bg-primary: var(--p-white);
    --bg-secondary: var(--slate-50);
    --bg-card: var(--p-white);
    --text-primary: var(--slate-900);
    --text-secondary: var(--slate-600);
    --text-muted: var(--slate-400);
    --border-color: var(--slate-200);
    --input-bg: var(--p-white);
    --primary: var(--gold-500);
    --primary-hover: var(--gold-600);
    --shadow-color: rgba(0,0,0,0.1);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: var(--p-radius-lg);
    --radius-lg: var(--p-radius-lg);
    --transition: 200ms ease;
}

[data-theme="dark"] {
    --bg-primary: var(--p-ink);
    --bg-secondary: var(--p-ink);
    --bg-card: var(--p-ink);
    --text-primary: var(--p-paper-2);
    --text-secondary: var(--p-line-strong);
    --text-muted: var(--p-muted);
    --border-color: var(--p-ink-2);
    --input-bg: var(--p-ink);
    --shadow-color: rgba(0,0,0,0.4);
}

[data-theme="dark"] select.form-control option,
[data-theme="dark"] .precision-control select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] input,
[data-theme="dark"] select {
    background-color: var(--input-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.theme-toggle:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Hero */
.hero {
    text-align: center;
    padding: 12px 24px 16px;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.hero-title {
    font-size: var(--p-text-4xl);
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.hero-title span { color: var(--primary); }

.hero-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 20px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.hero-stat {
    text-align: center;
}

.hero-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.hero-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Main */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px 48px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--p-radius);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 2px 8px var(--shadow-color);
}

/* Calculator Grid */
.calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Cards */
.calc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition);
}

.calc-card:hover {
    box-shadow: 0 8px 32px var(--shadow-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
}

.card-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Precision Control */
.precision-control {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border-radius: var(--p-radius);
    font-size: 12px;
}

.precision-control label {
    color: var(--text-muted);
}

.precision-control select {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
}

/* Form Elements */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--p-radius);
    color: var(--text-primary);
    transition: all var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(210, 123, 69, 0.15);
}

.input-large {
    font-size: 28px;
    font-weight: 600;
    text-align: right;
    padding: 16px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 36px;
}

/* Category Pills */
.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.category-pill {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.category-pill:hover,
.category-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Unit Row */
.unit-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.unit-row select { flex: 1; }

.swap-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.swap-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: rotate(180deg);
}

/* Result */
.result-box {
    background: linear-gradient(135deg, var(--gold-50), var(--gold-100));
    border: 1px solid var(--gold-200);
    border-radius: var(--radius);
    padding: 20px;
    text-align: right;
    margin-top: 16px;
}

[data-theme="dark"] .result-box {
    background: linear-gradient(135deg, rgba(210,123,69,0.1), rgba(210,123,69,0.05));
    border-color: rgba(210,123,69,0.3);
}

.result-value {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--primary);
    word-break: break-word;
    font-variant-numeric: tabular-nums;
}

.result-scientific {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Buttons */
.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: var(--p-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all var(--transition);
}

.btn .material-icons { font-size: 18px; }

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

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

/* Show All Panel */
.show-all-panel {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    display: none;
}

.show-all-panel.active { display: block; }

.show-all-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.show-all-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.show-all-item {
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--p-radius);
    cursor: pointer;
    transition: all var(--transition);
}

.show-all-item:hover {
    border-color: var(--primary);
}

.show-all-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.show-all-unit {
    font-size: 11px;
    color: var(--text-muted);
}

/* Stress Calculator */
.input-with-suffix {
    position: relative;
}

.input-with-suffix input {
    padding-right: 50px;
}

.input-suffix {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.area-row {
    display: grid;
    grid-template-columns: 1fr 100px;
    gap: 10px;
}

/* Presets */
.presets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 16px;
}

.preset-btn {
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: var(--p-radius);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.preset-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Formula */
.formula-box {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg-secondary);
    border-radius: var(--p-radius);
}

.formula-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.formula-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* History */
.history-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.history-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.history-list {
    max-height: 150px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border-radius: var(--p-radius);
    margin-bottom: 6px;
    font-size: 13px;
}

.history-item button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
}

.history-item button:hover { color: var(--p-blue-500); }

/* Keyboard hint */
.keyboard-hint {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 16px;
}

.kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--p-radius-sm);
    font-family: monospace;
    font-size: 10px;
}

/* Responsive */
@media (max-width: 900px) {
    .calc-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .header { padding: 10px 16px; }
    .hero { padding: 32px 16px 24px; }
    .calc-card { padding: 16px; }
    .input-large { font-size: 22px; padding: 12px; }
    .presets-grid { grid-template-columns: repeat(2, 1fr); }
    .unit-row { flex-direction: column; }
    .swap-btn { align-self: center; }
    .area-row { grid-template-columns: 1fr; }
    .show-all-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: var(--p-radius-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.calc-card { animation: fadeIn 0.4s ease; }

/* ============================================================
   COPPER NEUTRALIZER — audit fix 2026-07-09
   The live calculator page carries an inline <style> in WP content that
   defines a copper accent scale (--gold-500: #d27b45 etc.) on :root.
   This file loads only on calculator routes; the !important custom
   properties below beat the later inline declarations and recolor the
   whole tool to the indigo system without touching page content.
   ============================================================ */
:root {
    --gold-50:  var(--p-blue-50)  !important;
    --gold-100: var(--p-blue-100) !important;
    --gold-200: var(--p-blue-200) !important;
    --gold-300: var(--p-blue-300) !important;
    --gold-400: var(--p-blue-500) !important;
    --gold-500: var(--p-blue-600) !important;
    --gold-600: var(--p-blue-700) !important;
    --gold-700: var(--p-blue-800) !important;
}

/* ============================================================
   AUDIT FIX 2026-07-13 (v74.3.0)
   1. WP core ships `html :where([style*=border-color]) { border-style:solid }`;
      it matched the Quick Reference box's legacy inline
      `border-top:1px solid var(--border-color)` and painted 3px currentColor
      borders on the other three sides (the "black line"). Content now uses
      .quick-ref; the guard below disarms legacy inline styles still in WP.
   2. The in-page calculator header (FITCO Calculator logo + theme toggle)
      duplicated the site header. Content drops it; legacy content gets it
      hidden here, and unit-converter.js relocates the dark-mode toggle into
      .calc-toolbar above the calculator grid.
   3. Formula box lost its blue border-left accent (stray line next to card).
   ============================================================ */

/* legacy content: hide the pasted in-page header (site header already exists) */
body.fitco-unit-converter-page header.header {
    display: none !important;
}

/* legacy content: cancel WP-forced borders on inline var(--border-color) styles */
body.fitco-unit-converter-page .calc-card [style*="border-color"] {
    border-right-style: none !important;
    border-bottom-style: none !important;
    border-left-style: none !important;
}

/* Dark-mode toggle now lives above the calculator grid */
.calc-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

/* Quick Reference box (replaces the inline-styled wrapper) */
.quick-ref {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.quick-ref-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* UX polish: cleaner numeric inputs (no native spinners) */
.calc-card input[type="number"]::-webkit-outer-spin-button,
.calc-card input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.calc-card input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
    font-variant-numeric: tabular-nums;
}

/* UX polish: visible keyboard focus on all interactive controls */
.btn:focus-visible,
.theme-toggle:focus-visible,
.swap-btn:focus-visible,
.category-pill:focus-visible,
.preset-btn:focus-visible,
.show-all-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
