/* ============================================
   BuildRight — DIY Calculator Hub
   Main Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,400&display=swap');

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

:root {
  --orange: #E8530A;
  --orange-hover: #c94608;
  --orange-light: #FFF0E8;
  --orange-mid: #F97C3C;
  --navy: #1A1F2E;
  --navy-mid: #2D3347;
  --slate: #6B7280;
  --border: #E5E7EB;
  --border-dark: #D1D5DB;
  --bg: #F9F7F4;
  --white: #FFFFFF;
  --green: #1A6B3A;
  --green-light: #E8F5EE;
  --green-border: #A7D7BC;
  --amber: #7A5A00;
  --amber-light: #FFF8E6;
  --amber-border: #F7C75A;
  --text: #111827;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --max-width: 1140px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- TYPOGRAPHY ---- */
h1, h2, h3, h4 { font-family: 'Syne', sans-serif; line-height: 1.2; }
h1 { font-size: clamp(28px, 5vw, 52px); font-weight: 800; letter-spacing: -1.5px; }
h2 { font-size: clamp(22px, 3vw, 32px); font-weight: 700; letter-spacing: -0.5px; }
h3 { font-size: 18px; font-weight: 700; }
p { line-height: 1.7; }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- HEADER ---- */
.site-header {
  background: var(--navy);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.header-inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: white;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo:hover { text-decoration: none; opacity: 0.9; }
.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--orange);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.logo span { color: var(--orange-mid); }
.header-nav { display: flex; align-items: center; gap: 6px; }
.header-nav a {
  color: rgba(255,255,255,0.65);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all 0.15s;
  text-decoration: none;
}
.header-nav a:hover { color: white; background: rgba(255,255,255,0.1); }
.header-nav a.active { color: white; background: rgba(255,255,255,0.12); }
.header-cta {
  background: var(--orange) !important;
  color: white !important;
  border-radius: 8px !important;
  padding: 7px 16px !important;
}
.header-cta:hover { background: var(--orange-hover) !important; }

/* ---- BREADCRUMB ---- */
.breadcrumb-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 10px 2rem;
  font-size: 13px;
  color: var(--text-muted);
}
.breadcrumb-inner { max-width: var(--max-width); margin: 0 auto; display: flex; align-items: center; gap: 6px; }
.breadcrumb-bar a { color: var(--text-muted); text-decoration: none; }
.breadcrumb-bar a:hover { color: var(--orange); }
.breadcrumb-bar span { color: var(--text-light); }

/* ---- CONTAINERS ---- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 2rem; }
.page-wrap { padding: 2.5rem 2rem; max-width: var(--max-width); margin: 0 auto; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
}
.btn-primary { background: var(--orange); color: white; }
.btn-primary:hover { background: var(--orange-hover); color: white; text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,83,10,0.3); }
.btn-secondary { background: transparent; color: var(--text); border: 1.5px solid var(--border-dark); }
.btn-secondary:hover { border-color: var(--orange); color: var(--orange); text-decoration: none; }
.btn-lg { padding: 15px 32px; font-size: 16px; border-radius: var(--radius); }
.btn-full { width: 100%; justify-content: center; }

/* ---- CALCULATOR CARD ---- */
.calc-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}
.calc-card:hover {
  border-color: var(--orange);
  box-shadow: 0 4px 16px rgba(232,83,10,0.1);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.calc-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.calc-card:hover .calc-card-icon { background: var(--orange-light); }
.calc-card-body {}
.calc-card-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 3px;
  line-height: 1.3;
}
.calc-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.calc-card-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 6px;
  background: var(--orange-light);
  color: var(--orange);
}

/* ---- GRID ---- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

/* ---- FORM ELEMENTS ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.field input,
.field select,
.field textarea {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}
.field input:focus,
.field select:focus { border-color: var(--orange); background: white; box-shadow: 0 0 0 3px rgba(232,83,10,0.08); }
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.input-row.triple { grid-template-columns: 1fr 1fr 1fr; }
.input-row.solo { grid-template-columns: 1fr; }
.input-row.quad { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* ---- RESULT COMPONENTS ---- */
.result-primary {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.result-primary::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,0.03);
  border-radius: 50%;
}
.result-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.45); margin-bottom: 4px; font-weight: 500; }
.result-value {
  font-family: 'Syne', sans-serif;
  font-size: 38px;
  font-weight: 800;
  color: white;
  letter-spacing: -1.5px;
  line-height: 1;
}
.result-unit { font-size: 18px; font-weight: 400; color: rgba(255,255,255,0.5); margin-left: 6px; }
.result-sub { font-size: 13px; color: rgba(255,255,255,0.45); margin-top: 6px; }

.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.result-grid.triple { grid-template-columns: 1fr 1fr 1fr; }
.result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
}
.result-card .result-label { color: var(--text-muted); }
.result-card .result-value { font-size: 22px; color: var(--text); }

/* ---- CALLOUT BOXES ---- */
.tip-box {
  background: var(--green-light);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--green);
  margin-bottom: 10px;
}
.tip-box strong { font-weight: 600; display: block; margin-bottom: 4px; font-size: 13px; }

.warn-box {
  background: var(--amber-light);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--amber);
  margin-bottom: 10px;
}
.warn-box strong { font-weight: 600; display: block; margin-bottom: 4px; }

.info-box {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-size: 13.5px;
  line-height: 1.65;
  color: #1E40AF;
  margin-bottom: 10px;
}

/* ---- RESULTS ANIMATION ---- */
.results { display: none; margin-top: 1.5rem; animation: slideUp 0.22s ease; }
.results.show { display: block; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- SECTION LABELS ---- */
.section-label {
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- TAGS / BADGES ---- */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-gray { background: #F3F4F6; color: #374151; }
.badge-navy { background: var(--navy); color: white; }

/* ---- DIVIDERS ---- */
.divider { height: 1px; background: var(--border); margin: 2rem 0; }

/* ---- FAQ ---- */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-question {
  padding: 1.1rem 0;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  user-select: none;
}
.faq-question::after { content: '+'; font-size: 20px; color: var(--text-muted); font-weight: 400; flex-shrink: 0; transition: transform 0.2s; }
.faq-item.open .faq-question::after { content: '−'; }
.faq-answer { display: none; padding: 0 0 1.1rem; font-size: 14px; color: var(--text-muted); line-height: 1.7; }
.faq-item.open .faq-answer { display: block; }

/* ---- RELATED TOOLS ---- */
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }

/* ---- FORMULA BOX ---- */
.formula-box {
  background: var(--navy);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.5rem;
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  line-height: 1.8;
  margin: 1rem 0;
}
.formula-box .comment { color: rgba(255,255,255,0.35); }
.formula-highlight { color: var(--orange-mid); font-weight: 600; }

/* ---- STICKY SIDEBAR ---- */
.page-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2.5rem;
  align-items: start;
}
.sticky-sidebar { position: sticky; top: 84px; }
.sidebar-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.sidebar-card h3 {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

/* ---- QUICK REF TABLE ---- */
.qr-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.qr-row:last-child { border-bottom: none; }
.qr-from { color: var(--text-muted); }
.qr-arrow { color: var(--orange); font-size: 11px; font-weight: 600; }
.qr-to { font-weight: 500; color: var(--text); }

/* ---- FOOTER ---- */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.5);
  padding: 3rem 2rem 2rem;
  margin-top: 4rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}
.footer-brand p { font-size: 13px; line-height: 1.7; color: rgba(255,255,255,0.4); margin-top: 0.75rem; max-width: 240px; }
.footer-col h4 {
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 1rem;
  font-weight: 700;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { color: rgba(255,255,255,0.45); font-size: 13px; text-decoration: none; transition: color 0.15s; }
.footer-col ul li a:hover { color: white; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  max-width: var(--max-width);
  margin: 0 auto;
}
.footer-disclaimer { font-size: 11px; color: rgba(255,255,255,0.25); max-width: 500px; line-height: 1.6; }

/* ---- PRINT STYLES ---- */
@media print {
  .site-header, .site-footer, .sidebar-card .btn, .breadcrumb-bar { display: none; }
  .page-layout { grid-template-columns: 1fr; }
  .sticky-sidebar { position: static; }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .page-layout { grid-template-columns: 1fr; }
  .sticky-sidebar { position: static; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
@media (max-width: 640px) {
  .header-nav { display: none; }
  .input-row { grid-template-columns: 1fr; }
  .input-row.triple { grid-template-columns: 1fr 1fr; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .result-grid.triple { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 1rem; text-align: center; }
  .page-wrap { padding: 1.5rem 1rem; }
  .result-value { font-size: 30px; }
}
