/*
Theme Name: My Square Foot Calculator
Theme URI: https://mysquarefootcalculator.com/
Author: F-Tech Developers
Author URI: https://mysquarefootcalculator.com/
Description: Custom lightweight theme for My Square Foot Calculator — free square footage calculators, converters and guides. Mobile-first, vanilla JavaScript, no page builder, no jQuery.
Version: 1.0
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: msfc
*/

/* ============ TOKENS (locked palette) ============ */
:root {
  --indigo: #4338CA;
  --violet: #7C3AED;
  --gold: #F59E0B;
  --gold-dark: #B45309;
  --tint: #EEF2FF;
  --border: #E0E7FF;
  --ink: #1E1B2E;
  --muted: #5B5B6B;
  --white: #FFFFFF;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(67, 56, 202, .14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ============ BASE (mobile-first, 360px) ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink);
  background: var(--white); font-size: 17px; line-height: 1.6;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; color: var(--ink); }
h1 { font-size: 1.9rem; margin: .4em 0 .5em; }
h2 { font-size: 1.45rem; margin-top: 2em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.content { max-width: 760px; margin: 0 auto; }
.skip-link { position: absolute; left: -9999px; }

/* ============ HEADER ============ */
.site-header {
  background: linear-gradient(90deg, var(--indigo), var(--violet));
  color: var(--white); position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 12px rgba(30, 27, 46, .18);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; min-height: 58px; }
.site-brand { display: flex; align-items: center; gap: 10px; color: var(--white); font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.site-brand:hover { text-decoration: none; }
.site-brand .brand-icon {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 9px;
  background: var(--white); color: var(--indigo);
  display: inline-flex; align-items: center; justify-content: center;
}
.site-brand .brand-icon svg { width: 22px; height: 22px; }
.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
  color: var(--white); font-size: .92rem; font-weight: 600;
  padding: 8px 10px; border-radius: 8px; display: block; white-space: nowrap;
}
.main-nav a:hover { background: rgba(255, 255, 255, .16); text-decoration: none; }
@media (max-width: 640px) {
  .site-header .wrap { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .main-nav { margin-left: 0; width: 100%; }
  .main-nav ul { gap: 2px; }
  .main-nav a { padding: 6px 8px; font-size: .88rem; }
}

/* ============ HERO (homepage) ============ */
.hero {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--violet) 100%);
  color: var(--white); padding: 34px 0 90px; text-align: center;
}
.hero h1 { color: var(--white); font-size: 2.1rem; margin: 0 0 .3em; }
.hero .hero-sub { color: #E6E4FF; font-size: 1.05rem; margin: 0 auto 1.2em; max-width: 640px; }
.hero-card-wrap { margin-top: -70px; position: relative; z-index: 2; }

/* ============ CALCULATOR CARD ============ */
.calc-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 18px; margin: 0 auto 28px; max-width: 860px; text-align: left;
}
.calc-card h2 { margin: 0 0 12px; font-size: 1.25rem; }
.calc-card .calc-hint { color: var(--muted); font-size: .92rem; margin: -6px 0 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 5px; }
.field input[type="number"], .field input[type="text"], .field select {
  width: 100%; min-height: 46px; padding: 10px 12px;
  font-size: 16px; /* 16px stops iOS auto-zoom */
  font-family: var(--font); color: var(--ink);
  border: 1.5px solid #C7D2FE; border-radius: 10px; background: var(--white);
}
.field input:focus, .field select:focus { outline: 2px solid var(--violet); border-color: var(--violet); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 480px) {
  .field-row-3 { grid-template-columns: 1fr 1fr; }
  .field-row-3 .field:last-child { grid-column: 1 / -1; }
}
.room-row {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px; background: #FBFAFF;
}
.room-row .room-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.room-row .room-head input[type="text"] { flex: 1; min-height: 40px; font-size: 16px; border: 1.5px solid #C7D2FE; border-radius: 8px; padding: 8px 10px; }
.btn-remove {
  flex: 0 0 auto; min-width: 44px; min-height: 44px;
  border: 1px solid #FECACA; background: #FEF2F2; color: #B91C1C;
  border-radius: 9px; font-size: 1.1rem; cursor: pointer;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border: none; border-radius: 10px;
  font-size: 1rem; font-weight: 700; font-family: var(--font); cursor: pointer;
  background: linear-gradient(90deg, var(--indigo), var(--violet)); color: var(--white);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn-gold { background: var(--gold); color: #1E1B2E; }
.btn-ghost { background: var(--white); color: var(--indigo); border: 1.5px solid #C7D2FE; }
.btn-sm { min-height: 44px; padding: 9px 14px; font-size: .95rem; }
.calc-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* waste chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-width: 44px; min-height: 44px; padding: 10px 16px;
  border: 1.5px solid #C7D2FE; border-radius: 999px; background: var(--white);
  font-weight: 700; font-size: .95rem; font-family: var(--font);
  color: var(--indigo); cursor: pointer;
}
.chip[aria-pressed="true"], .chip.active {
  background: var(--gold); border-color: var(--gold); color: #1E1B2E;
}

/* ============ RESULT PANEL ============ */
.result-panel {
  margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--tint); padding: 16px;
}
.result-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.result-main .result-num {
  font-size: 2.4rem; font-weight: 800; color: var(--indigo); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.result-main .result-unit { font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-top: 12px; }
.result-grid .r-item { font-size: .95rem; }
.result-grid .r-item b { display: block; font-size: 1.08rem; color: var(--ink); }
.result-grid .r-item span { color: var(--muted); font-size: .85rem; }
.result-note { color: var(--muted); font-size: .88rem; margin: 10px 0 0; }
.result-error { color: #B91C1C; font-weight: 600; }

/* sticky mobile result bar */
.sticky-result {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--gold); color: #1E1B2E;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  font-weight: 800; font-size: 1.05rem; text-align: center;
  box-shadow: 0 -4px 16px rgba(30, 27, 46, .2);
}
.sticky-result .sr-small { font-weight: 600; font-size: .85rem; display: block; }
@media (max-width: 768px) {
  body.has-sticky-result .sticky-result { display: block; }
  body.has-sticky-result .site-footer { padding-bottom: 76px; }
}

/* ============ QUICK CHIPS / CONVERSION LINKS ============ */
.quick-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 28px; }
.quick-chips a {
  background: var(--white); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 14px; font-size: .92rem; color: var(--violet); font-weight: 600;
  min-height: 40px; display: inline-flex; align-items: center;
}
.quick-chips a:hover { border-color: var(--violet); text-decoration: none; }

/* ============ TABLES ============ */
table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .97rem; }
th, td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
th { background: var(--tint); color: var(--indigo); }
tr:nth-child(even) td { background: #FAFAFF; }
.table-scroll { overflow-x: auto; }
@media (max-width: 640px) {
  .table-stack table, .table-stack thead, .table-stack tbody, .table-stack th, .table-stack td, .table-stack tr { display: block; }
  .table-stack thead { display: none; }
  .table-stack tr { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; padding: 6px; }
  .table-stack td { border: none; padding: 6px 10px; }
  .table-stack td::before { content: attr(data-label) ": "; font-weight: 700; color: var(--indigo); }
}

/* ============ FAQ ACCORDION (native details) ============ */
.faq-list { margin: 1em 0 2em; }
.faq-list details {
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 10px; background: var(--white); overflow: hidden;
}
.faq-list summary {
  cursor: pointer; padding: 14px 16px; font-weight: 700; font-size: 1rem;
  min-height: 44px; list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; color: var(--violet); font-size: 1.3rem; font-weight: 800; flex: 0 0 auto; }
.faq-list details[open ] summary::after { content: "–"; }
.faq-list details .faq-a { padding: 0 16px 16px; color: var(--ink); }
.faq-list details .faq-a p:last-child { margin-bottom: 0; }

/* ============ RELATED TOOLS GRID ============ */
.tools-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1em 0 2em;
}
@media (min-width: 700px) { .tools-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .tools-grid { grid-template-columns: repeat(4, 1fr); } }
.tool-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 14px; background: var(--white); display: block; color: var(--ink);
  min-height: 44px;
}
.tool-card:hover { border-color: var(--violet); box-shadow: var(--shadow); text-decoration: none; }
.tool-card .tool-icon {
  width: 40px; height: 40px; border-radius: 10px; margin-bottom: 10px;
  background: var(--tint); color: var(--indigo);
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.tool-card h3 { margin: 0 0 4px; font-size: 1rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .88rem; }

/* ============ TRUST STRIP ============ */
.trust-strip {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  margin: 0 0 28px; padding: 0; list-style: none;
}
.trust-strip li {
  background: var(--tint); border-radius: 999px; padding: 8px 14px;
  font-size: .9rem; font-weight: 600; color: var(--indigo);
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
}

/* ============ BREADCRUMB ============ */
.breadcrumb { font-size: .88rem; color: var(--muted); margin: 18px 0 4px; }
.breadcrumb a { color: var(--indigo); }
.breadcrumb span[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ============ APP PROMO ============ */
.app-promo {
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  border-radius: 16px; color: var(--white); padding: 26px 22px;
  display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin: 2em 0;
}
.app-promo .app-icon {
  width: 72px; height: 72px; border-radius: 16px; background: var(--white);
  color: var(--indigo); display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto; font-size: 2rem; font-weight: 800;
}
.app-promo h2 { color: var(--white); margin: 0 0 6px; font-size: 1.35rem; }
.app-promo p { color: #E6E4FF; margin: 0 0 12px; }
.app-promo .app-text { flex: 1 1 280px; }
.play-badge { display: inline-block; }
.play-badge img { height: 56px; width: auto; display: block; }

/* ============ FOOTER ============ */
.site-footer { background: #14122B; color: #C9C6E8; margin-top: 40px; padding: 34px 0 24px; }
.site-footer a { color: #E6E4FF; }
.site-footer h3 { color: var(--white); font-size: 1rem; margin: 0 0 10px; }
.footer-cols { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 700px) { .footer-cols { grid-template-columns: repeat(3, 1fr); } }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin-bottom: 7px; font-size: .93rem; }
.footer-bottom { border-top: 1px solid #2A2850; margin-top: 26px; padding-top: 18px; font-size: .88rem; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.footer-bottom .play-badge img { height: 44px; }

/* ============ ARTICLE CONTENT ============ */
.entry-content ul, .entry-content ol { padding-left: 1.3em; }
.entry-content li { margin-bottom: .4em; }
.entry-content .formula {
  background: var(--tint); border-left: 4px solid var(--gold);
  padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 1em 0; font-weight: 600;
}

/* ============ PRINT ============ */
@media print {
  .site-header, .site-footer, .sticky-result, .calc-actions, .main-nav { display: none !important; }
  body { font-size: 12pt; }
  .calc-card, .result-panel { box-shadow: none; border: 1px solid #999; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
