/* ========================================
   TaxFind - Reverse Sales Tax Calculator
   Style Sheet — Updated with all SEO fixes
   ======================================== */

:root {
    --color-bg: #faf9f7;
    --color-surface: #ffffff;
    --color-surface-alt: #f4f2ef;
    --color-primary: #1a5f3a;
    --color-primary-light: #e8f5ec;
    --color-primary-dark: #0e3d24;
    --color-accent: #d4a017;
    --color-accent-light: #fef8e7;
    --color-text: #1c1917;
    --color-text-secondary: #57534e;
    --color-text-muted: #a8a29e;
    --color-border: #e7e5e4;
    --color-border-strong: #d6d3d1;
    --color-error: #dc2626;
    --color-success: #16a34a;
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { font-family: var(--font-body); background: var(--color-bg); color: var(--color-text); line-height: 1.65; font-size: 16px; -webkit-font-smoothing: antialiased; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; color: var(--color-text); }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); font-weight: 600; letter-spacing: -0.01em; margin-bottom: 12px; }
h3 { font-size: clamp(1.05rem, 2.5vw, 1.4rem); font-weight: 600; }
a { color: var(--color-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-primary-dark); }

/* --- Breadcrumb --- */
.breadcrumb { padding: 12px 0; font-size: 0.85rem; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border); }
.breadcrumb a { color: var(--color-text-secondary); }
.breadcrumb span { margin: 0 4px; }

/* --- Article Meta (dates & author) --- */
.article-meta { padding: 16px 0 0; font-size: 0.85rem; color: var(--color-text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.article-meta .meta-sep { margin: 0 6px; }
.article-meta .author-link { color: var(--color-primary); font-weight: 500; }
.article-meta time { font-weight: 500; color: var(--color-text-secondary); }

/* --- Header --- */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(250,249,247,0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--color-border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--color-text); }
.logo-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--color-primary); color: white; font-weight: 700; font-size: 18px; font-family: var(--font-display); }
.logo-text { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.logo-accent { color: var(--color-primary); }
.main-nav { display: flex; gap: 8px; }
.nav-link { padding: 8px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 500; color: var(--color-text-secondary); transition: all 0.2s; }
.nav-link:hover, .nav-link.active { background: var(--color-primary-light); color: var(--color-primary); }
.mobile-menu-btn { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; }
.mobile-menu-btn span { width: 22px; height: 2px; background: var(--color-text); border-radius: 2px; transition: all 0.3s; }

/* --- Hero Section --- */
.hero-section { padding: 32px 0 64px; background: linear-gradient(180deg, var(--color-primary-light) 0%, var(--color-bg) 100%); }
.hero-content { text-align: center; max-width: 680px; margin: 0 auto 24px; }
.badge { display: inline-block; padding: 6px 16px; background: var(--color-accent-light); color: var(--color-accent); border: 1px solid rgba(212,160,23,0.2); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; border-radius: 100px; margin-bottom: 16px; }
.hero-subtitle { font-size: 1.1rem; color: var(--color-text-secondary); margin-top: 12px; line-height: 1.7; }

/* --- Images --- */
.hero-image, .content-image { max-width: 800px; margin: 0 auto 32px; }
.hero-image img, .content-image img { width: 100%; height: auto; border-radius: var(--radius-md); }

/* --- Calculator Card --- */
.calculator-card { max-width: 720px; margin: 0 auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.calc-header { padding: 28px 32px 0; }
.calc-header h2 { font-size: 1.3rem; margin-bottom: 4px; }
.calc-header p { color: var(--color-text-muted); font-size: 0.92rem; }
.calc-body { padding: 24px 32px 28px; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.input-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 8px; }
.input-with-prefix, .input-with-suffix { position: relative; display: flex; align-items: center; }
.currency-select { position: absolute; left: 0; top: 0; height: 100%; width: 90px; border: none; background: var(--color-surface-alt); border-right: 1px solid var(--color-border); border-radius: var(--radius-md) 0 0 var(--radius-md); padding: 0 8px 0 12px; font-family: var(--font-body); font-size: 0.85rem; font-weight: 600; color: var(--color-text); cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2357534e' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.input-with-prefix input { width: 100%; padding: 14px 16px 14px 100px; }
.input-with-suffix input { width: 100%; padding: 14px 48px 14px 16px; }
.suffix { position: absolute; right: 16px; color: var(--color-text-muted); font-weight: 600; font-size: 0.95rem; pointer-events: none; }
input[type="number"] { width: 100%; padding: 14px 16px; border: 1.5px solid var(--color-border); border-radius: var(--radius-md); font-family: var(--font-body); font-size: 1.05rem; font-weight: 500; color: var(--color-text); background: var(--color-surface); transition: all 0.2s; outline: none; -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"]:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(26,95,58,0.1); }
.quick-rates { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.quick-label { font-size: 0.75rem; color: var(--color-text-muted); font-weight: 500; }
.quick-rate { padding: 4px 10px; border: 1px solid var(--color-border); border-radius: 100px; background: var(--color-surface); font-family: var(--font-body); font-size: 0.75rem; font-weight: 500; color: var(--color-text-secondary); cursor: pointer; transition: all 0.15s; }
.quick-rate:hover { border-color: var(--color-primary); background: var(--color-primary-light); color: var(--color-primary); }
.calc-btn { width: 100%; padding: 16px 24px; background: var(--color-primary); color: white; border: none; border-radius: var(--radius-md); font-family: var(--font-body); font-size: 1.05rem; font-weight: 600; cursor: pointer; transition: all 0.25s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.calc-btn:hover { background: var(--color-primary-dark); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(26,95,58,0.3); }
.reset-btn { width: 100%; padding: 10px; background: transparent; border: none; font-family: var(--font-body); font-size: 0.88rem; font-weight: 500; color: var(--color-text-muted); cursor: pointer; margin-top: 8px; transition: color 0.2s; }
.reset-btn:hover { color: var(--color-error); }

/* --- Results --- */
.calc-results { border-top: 1px solid var(--color-border); padding: 28px 32px 32px; background: var(--color-surface-alt); animation: slideDown 0.35s ease-out; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.results-header h3 { font-size: 1.1rem; margin-bottom: 16px; }
.results-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.result-card { padding: 16px 20px; border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-surface); }
.result-card.primary { background: var(--color-primary); border-color: var(--color-primary); }
.result-card.primary .result-label { color: rgba(255,255,255,0.8); }
.result-card.primary .result-value { color: white; }
.result-card.accent { background: var(--color-accent-light); border-color: rgba(212,160,23,0.25); }
.result-label { display: block; font-size: 0.78rem; font-weight: 500; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.result-value { display: block; font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; color: var(--color-text); letter-spacing: -0.01em; }
.solution-box { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 20px 24px; margin-bottom: 20px; }
.solution-box h3 { font-size: 0.95rem; margin-bottom: 12px; color: var(--color-primary); }
.solution-steps { font-family: 'Courier New', monospace; font-size: 0.88rem; line-height: 1.8; color: var(--color-text-secondary); }
.solution-steps .step-line { padding: 2px 0; }
.solution-steps .step-line.highlight { color: var(--color-primary); font-weight: 600; }
.bar-chart .bar-label { font-size: 0.8rem; font-weight: 600; color: var(--color-text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.bar-track { display: flex; height: 40px; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-border); }
.bar-fill { display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 600; color: white; transition: width 0.6s ease-out; min-width: 0; overflow: hidden; }
.bar-fill.pretax { background: var(--color-primary); }
.bar-fill.tax { background: var(--color-accent); color: var(--color-text); }

/* --- Sections --- */
.section { padding: 64px 0; }
.section-intro { font-size: 1.05rem; color: var(--color-text-secondary); max-width: 720px; margin-bottom: 32px; line-height: 1.7; }

/* --- Definition Section --- */
.definition-section { background: var(--color-surface); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.definition-section p { color: var(--color-text-secondary); line-height: 1.75; margin-bottom: 16px; max-width: 800px; }
.definition-list { max-width: 800px; margin-bottom: 24px; }
.definition-list dt { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; color: var(--color-primary-dark); margin-bottom: 6px; margin-top: 20px; }
.definition-list dt:first-child { margin-top: 0; }
.definition-list dt dfn { font-style: normal; }
.definition-list dd { color: var(--color-text-secondary); line-height: 1.75; margin-left: 0; padding-left: 20px; border-left: 3px solid var(--color-primary-light); margin-bottom: 8px; }
.definition-list dd code { background: var(--color-surface-alt); padding: 2px 8px; border-radius: 4px; font-size: 0.9rem; color: var(--color-primary); }

/* --- How It Works --- */
.how-section { background: var(--color-bg); }
.formula-card { background: var(--color-primary-light); border: 1px solid rgba(26,95,58,0.15); border-radius: var(--radius-lg); padding: 28px 32px; margin-bottom: 36px; }
.formula-card h3 { margin-bottom: 16px; color: var(--color-primary-dark); }
.formula { margin-bottom: 8px; }
.formula code { display: inline-block; background: var(--color-surface); padding: 10px 20px; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 600; color: var(--color-primary); border: 1px solid rgba(26,95,58,0.1); }

/* FIX #12: OL/UL Lists */
.steps-list, .use-cases-list { max-width: 800px; margin-bottom: 36px; padding-left: 24px; }
.steps-list li, .use-cases-list li { padding: 8px 0; font-size: 1rem; color: var(--color-text-secondary); line-height: 1.7; }
.steps-list li { margin-bottom: 4px; }
.steps-list li strong { color: var(--color-text); }

.example-card { background: var(--color-accent-light); border: 1px solid rgba(212,160,23,0.2); border-radius: var(--radius-lg); padding: 28px 32px; margin-bottom: 36px; }
.example-card h3 { margin-bottom: 12px; color: #8b6914; }
.example-math { background: var(--color-surface); border-radius: var(--radius-sm); padding: 16px 20px; margin: 16px 0; font-size: 0.95rem; }
.example-math p { padding: 4px 0; color: var(--color-text-secondary); }
.example-math strong { color: var(--color-text); }
.example-tip { font-size: 0.92rem; color: #8b6914; margin-top: 12px; }

/* --- Video Section --- */
.video-section { background: var(--color-surface); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 720px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; border-radius: var(--radius-md); }

/* --- Comparison Box (Common Mistake) --- */
.mistake-section { background: var(--color-bg); }
.mistake-section p { max-width: 800px; color: var(--color-text-secondary); line-height: 1.75; margin-bottom: 16px; }
.comparison-box { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0; max-width: 800px; }
.wrong-way, .right-way { padding: 24px; border-radius: var(--radius-md); }
.wrong-way { background: #fef2f2; border: 1px solid #fecaca; }
.wrong-way h3 { color: var(--color-error); margin-bottom: 8px; font-size: 1.1rem; }
.right-way { background: #f0fdf4; border: 1px solid #bbf7d0; }
.right-way h3 { color: var(--color-success); margin-bottom: 8px; font-size: 1.1rem; }
.comparison-box code { display: block; background: var(--color-surface); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 8px; }
.comparison-box p { font-size: 0.9rem; color: var(--color-text-secondary); margin: 0; }

/* --- Formulas Grid --- */
.calculations-section { background: var(--color-surface); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.formulas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.formula-item { padding: 24px; background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.formula-item h3 { margin-bottom: 12px; color: var(--color-primary-dark); font-size: 1.05rem; }
.formula-item code { display: block; background: var(--color-surface); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 500; color: var(--color-primary); margin-bottom: 8px; word-break: break-word; }
.formula-item p { font-size: 0.88rem; color: var(--color-text-muted); }

/* --- Tax Rates Table --- */
.rates-section { background: var(--color-bg); }
.table-wrapper { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: 16px; }
.tax-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tax-table th { background: var(--color-surface-alt); padding: 12px 16px; text-align: left; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-secondary); border-bottom: 1px solid var(--color-border); }
.tax-table td { padding: 10px 16px; border-bottom: 1px solid var(--color-border); color: var(--color-text-secondary); }
.tax-table tr:last-child td { border-bottom: none; }
.tax-table tr:hover td { background: var(--color-primary-light); }
.use-rate-btn { padding: 4px 12px; border: 1px solid var(--color-primary); border-radius: 100px; background: transparent; font-family: var(--font-body); font-size: 0.75rem; font-weight: 600; color: var(--color-primary); cursor: pointer; transition: all 0.15s; }
.use-rate-btn:hover { background: var(--color-primary); color: white; }
.table-note { font-size: 0.85rem; color: var(--color-text-muted); font-style: italic; }

/* --- FAQ Section --- */
.faq-section { background: var(--color-surface); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.faq-list { max-width: 800px; }
.faq-item { border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: 8px; background: var(--color-surface-alt); overflow: hidden; transition: border-color 0.2s; }
.faq-item:hover { border-color: var(--color-border-strong); }
.faq-question { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; background: none; border: none; font-family: var(--font-body); font-size: 1rem; font-weight: 600; color: var(--color-text); cursor: pointer; text-align: left; gap: 16px; }
.faq-icon { flex-shrink: 0; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--color-surface); font-size: 1.2rem; color: var(--color-text-muted); transition: all 0.25s; }
.faq-item.open .faq-icon { background: var(--color-primary); color: white; transform: rotate(45deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.35s ease-out, padding 0.35s ease-out; }
.faq-item.open .faq-answer { max-height: 600px; padding: 0 24px 20px; }
.faq-answer p { font-size: 0.95rem; color: var(--color-text-secondary); margin-bottom: 8px; line-height: 1.7; }
.faq-answer code { background: var(--color-surface); padding: 2px 8px; border-radius: 4px; font-size: 0.88rem; }

/* --- Share Buttons --- */
.share-section { background: var(--color-bg); }
.share-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.share-btn { display: inline-flex; align-items: center; padding: 10px 20px; border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 600; color: white; text-decoration: none; transition: all 0.2s; }
.share-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: white; }
.share-fb { background: #1877f2; }
.share-tw { background: #0f1419; }
.share-li { background: #0a66c2; }
.share-pi { background: #e60023; }
.share-em { background: var(--color-text-secondary); }

/* --- Author Section --- */
.author-section { background: var(--color-surface); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.author-card { display: flex; align-items: flex-start; gap: 20px; max-width: 700px; padding: 24px; background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-top: 16px; }
.author-avatar { flex-shrink: 0; width: 60px; height: 60px; border-radius: 50%; background: var(--color-primary); color: white; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.author-info h3 { margin-bottom: 8px; }
.author-info h3 a { color: var(--color-primary); }
.author-info p { font-size: 0.92rem; color: var(--color-text-secondary); line-height: 1.7; }

/* --- Sources Section --- */
.sources-section { background: var(--color-bg); }
.sources-list { padding-left: 20px; max-width: 800px; }
.sources-list li { padding: 6px 0; font-size: 0.92rem; color: var(--color-text-secondary); }
.sources-list a { color: var(--color-primary); text-decoration: underline; text-underline-offset: 3px; }

/* --- Footer --- */
.site-footer { background: var(--color-text); color: rgba(255,255,255,0.7); padding: 48px 0 32px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 40px; margin-bottom: 32px; }
.footer-brand p { margin-top: 12px; font-size: 0.88rem; line-height: 1.7; }
.footer-brand .logo { color: white; }
.footer-brand .logo-accent { color: var(--color-accent); }
.footer-links h3 { color: white; font-size: 0.9rem; margin-bottom: 16px; }
.footer-links a { display: block; color: rgba(255,255,255,0.6); font-size: 0.88rem; padding: 4px 0; transition: color 0.2s; }
.footer-links a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 24px; }
.footer-bottom p { font-size: 0.8rem; color: rgba(255,255,255,0.4); }

/* --- Responsive --- */
@media (max-width: 768px) {
    .main-nav { display: none; }
    .mobile-menu-btn { display: flex; }
    .main-nav.open { display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--color-surface); border-bottom: 1px solid var(--color-border); padding: 16px 24px; box-shadow: var(--shadow-lg); }
    .hero-section { padding: 24px 0 48px; }
    .input-row { grid-template-columns: 1fr; gap: 16px; }
    .calc-body { padding: 20px; }
    .calc-results { padding: 20px; }
    .calc-header { padding: 20px 20px 0; }
    .results-grid { grid-template-columns: 1fr; gap: 8px; }
    .formulas-grid { grid-template-columns: 1fr; }
    .comparison-box { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .tax-table th:nth-child(3), .tax-table td:nth-child(3), .tax-table th:nth-child(6), .tax-table td:nth-child(6) { display: none; }
    .formula code { font-size: 0.85rem; padding: 8px 12px; }
    .section { padding: 40px 0; }
    .author-card { flex-direction: column; align-items: center; text-align: center; }
    .article-meta { justify-content: center; }
}

@media (max-width: 480px) {
    .quick-rates { gap: 4px; }
    .quick-rate { padding: 3px 8px; font-size: 0.7rem; }
    .result-value { font-size: 1.15rem; }
    .calculator-card { border-radius: var(--radius-lg); }
    .share-buttons { flex-direction: column; }
    .share-btn { justify-content: center; }
}

@media print {
    .site-header, .site-footer, .calc-btn, .reset-btn, .quick-rates, .use-rate-btn, .share-section, .video-section { display: none; }
    .calc-results { display: block !important; }
    body { background: white; }
}