:root {
  --yellow: #FFC107; --navy: #0A192F; --ink: #0F172A; --ink-2: #475569;
  --border: #E2E8F0; --bg: #F8FAFC; --white: #FFFFFF; --green: #16A34A;
  --radius: 8px; --shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.025);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
.container { max-width: 1320px; width: calc(100% - 48px); margin-left: auto; margin-right: auto; }
.main-content { padding-top: 24px; padding-bottom: 48px; }

/* HEADER */
.site-header { background: var(--navy); height: 150px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.logo { color: #fff; font-weight: 800; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.main-nav { flex: 1; display: flex; justify-content: center; }
.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a { color: #CBD5E1; font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 4px; transition: 0.2s; }
.nav-links a:hover { color: #fff; }
.chev { width: 14px; height: 14px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.btn-projects { background: var(--yellow); color: var(--navy); border: none; padding: 10px 20px; border-radius: 50px; font-size: 15px; font-weight: 700; transition: 0.2s; }
.btn-projects:hover { filter: brightness(1.05); }
.hamburger { display: none; color: #fff; font-size: 24px; }

/* LOGO IMAGE */
.logo-img { height: 130px; width: auto; object-fit: contain; display: block; }
.footer-logo .logo-img { height: 130px; width: auto; margin-bottom: 16px; }

/* HOMEPAGE HERO */
.homepage-hero { background: var(--navy); color: #fff; padding: 48px 0; text-align: center; }
.hero-inner { max-width: 800px; margin: 0 auto; }
.hero-title { font-size: 48px; font-weight: 800; line-height: 1.1; margin-bottom: 16px; letter-spacing: -1px; }
.hero-subtitle { font-size: 18px; color: #CBD5E1; margin-bottom: 32px; line-height: 1.6; }
.hero-search { display: flex; max-width: 620px; margin: 0 auto; box-shadow: 0 10px 25px rgba(0,0,0,0.2); border-radius: 50px; overflow: hidden; border: 2px solid var(--yellow); }
.hero-search input { flex: 1; border: none; padding: 18px 24px; font-size: 16px; outline: none; background: #fff; color: var(--ink); min-width: 0; }
.hero-search button { background: var(--yellow); color: var(--navy); font-weight: 700; padding: 0 20px; font-size: 16px; border: none; cursor: pointer; white-space: nowrap; }

/* CALCULATOR SPLIT */
.calc-split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; margin-bottom: 60px; align-items: stretch; }
.calc-left { display: flex; flex-direction: column; }
.calc-card { flex: 1; display: flex; flex-direction: column; }
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.calc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.calc-title { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.calc-desc { color: var(--ink-2); font-size: 15px; }
.live-badge { display: inline-flex; align-items: center; align-self: flex-start; gap: 8px; background: #DCFCE7; color: var(--green); padding: 6px 12px; border-radius: 20px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.live-badge .dots { display: inline-flex; gap: 4px; align-items: center; }
.live-badge .dots span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: dotPulse 1.4s infinite; }
.live-badge .dots span:nth-child(2) { animation-delay: 0.35s; }
@keyframes dotPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.75); } }

.calc-tabs { display: flex; gap: 8px; margin-bottom: 24px; overflow-x: auto; padding-bottom: 4px; }
.tab { padding: 10px 16px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: 0.2s; }
.tab.active { background: var(--yellow); color: var(--navy); border-color: var(--yellow); }
.tab:hover:not(.active) { border-color: var(--ink-2); }

.diagram-wrap { background: #F1F5F9; border-radius: var(--radius); padding: 16px; margin-bottom: 24px; display: flex; justify-content: center; align-items: center; max-height: 220px; }
.iso-diagram { max-height: 170px; width: auto; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.input-group { display: flex; }
.field input, .field select { height: 44px; border: 1px solid var(--border); border-radius: 6px; padding: 0 12px; font-size: 14px; color: var(--ink); background: var(--white); width: 100%; outline: none; transition: 0.2s; }
.field input:focus, .field select:focus { border-color: var(--yellow); }
.input-group input { border-right: none; border-radius: 6px 0 0 6px; }
.input-group select { width: auto; min-width: 58px; flex-shrink: 0; border-radius: 0 6px 6px 0; background: #F1F5F9; font-weight: 600; font-size: 12px; }

.btn-primary-calc { width: 100%; background: var(--yellow); color: var(--navy); font-weight: 800; font-size: 16px; padding: 16px; border-radius: 6px; margin-top: auto; margin-bottom: 0; transition: 0.2s; }
.btn-primary-calc:hover { filter: brightness(1.05); transform: translateY(-1px); }

/* RESULTS PANEL */
.sticky-results { flex: 1; display: flex; flex-direction: column; }
.res-hero { text-align: center; padding: 20px 0; border-bottom: 1px dashed var(--border); margin: 14px 0 20px; }
.res-big { font-size: 44px; font-weight: 800; line-height: 1.1; color: var(--ink); letter-spacing: -1.5px; }
.res-unit { font-size: 15px; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.res-wastage { background: #FEF3C7; color: #92400E; padding: 10px 12px; border-radius: 6px; text-align: center; font-size: 13px; font-weight: 600; margin-bottom: 20px; }
.res-section { margin-bottom: 20px; }
.res-section h4 { font-size: 12px; font-weight: 700; margin-bottom: 10px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.8px; }
.mat-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; font-size: 14px; border-radius: 6px; margin-bottom: 4px; }
.mat-row span:last-child { font-weight: 700; color: var(--ink); }
.mat-row.selected-bag { background: #FFF7E0; border: 1px solid #FFE08A; }
.mat-row.cost-row-res { background: var(--bg); border: 1px solid var(--border); margin-top: 8px; }
.cost-val { font-weight: 800; color: var(--green); font-size: 16px; }
.res-divider { height: 1px; background: var(--border); margin: 18px 0; }
.res-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; padding-top: 20px; }
.btn-yellow, .btn-outline, .btn-dark { padding: 12px; border-radius: 6px; font-size: 14px; font-weight: 700; transition: 0.2s; text-align: center; }
.btn-yellow { background: var(--yellow); color: var(--navy); }
.btn-yellow:hover { filter: brightness(1.05); }
.btn-outline { background: var(--white); border: 1px solid var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: #1E293B; }

/* AD BANNER */
.ad-banner { background: #F1F5F9; border: 1px dashed #CBD5E1; border-radius: var(--radius); height: 90px; display: flex; align-items: center; justify-content: center; color: var(--ink-2); font-size: 14px; margin: 24px 0; }

/* SECTIONS */
.section { margin-top: 48px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 24px; }
.section-title { font-size: 24px; font-weight: 800; }
.section-title.center { text-align: center; margin-bottom: 24px; }
.link-blue { color: #2563EB; font-weight: 600; font-size: 15px; }

/* POPULAR CALCULATORS */
.popular-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 24px; }
@media (max-width: 1024px) { .popular-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .popular-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .popular-grid { grid-template-columns: 1fr; } }
.pop-card { display: block; background: var(--white); border: 1px solid var(--border); border-bottom: 3px solid var(--yellow); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: 0.2s; text-align: center; }
.pop-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.pop-icon-wrap { height: 130px; display: flex; align-items: center; justify-content: center; padding: 12px; background: #F8FAFC; }
.pop-icon-wrap img { max-width: 104px; max-height: 104px; width: auto; height: auto; object-fit: contain; }
.icon-large { max-width: 140px; max-height: 140px; }
.pop-iso { max-height: 112px; width: auto; max-width: 100%; }
.pop-name { padding: 16px; font-weight: 700; font-size: 15px; }
.more-card { background: var(--white); }
.more-card .pop-icon-wrap { background: #F8FAFC; }

/* TRUST BADGES */
.trust-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.trust-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 24px; text-align: center; box-shadow: var(--shadow); }
.trust-icon { width: 40px; height: 40px; color: #3B82F6; stroke: #3B82F6; margin: 0 auto 16px; display: block; }
.trust-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.trust-card p { font-size: 14px; color: var(--ink-2); }

/* GUIDES */
.guides-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.guide-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: 0.2s; }
.guide-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.guide-card img { display: block; width: 100%; height: 200px; object-fit: contain; object-position: center; padding: 12px; box-sizing: border-box; background: #F8FAFC; }
.guide-card img.guide-img-fit { padding: 8px; }
.guide-body { padding: 24px; }
.guide-body h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.guide-body p { font-size: 14px; color: var(--ink-2); }

/* HOW IT WORKS */
.hiw-grid { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hiw-step { flex: 1; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 24px; text-align: center; box-shadow: var(--shadow); }
.hiw-circle { width: 48px; height: 48px; background: var(--yellow); color: var(--navy); font-weight: 800; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-size: 20px; }
.hiw-step h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.hiw-step p { font-size: 14px; color: var(--ink-2); }
.hiw-arrow { color: var(--yellow); font-size: 24px; font-weight: 800; flex-shrink: 0; }

/* FOOTER */
.site-footer { background: var(--navy); color: #CBD5E1; padding: 48px 0 0; margin-top: 48px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 48px; padding-bottom: 60px; }
.footer-logo { margin-bottom: 16px; }
.brand-col p { font-size: 14px; color: #94A3B8; max-width: 300px; line-height: 1.7; }
.footer-col h4 { color: #fff; font-size: 13px; font-weight: 700; margin-bottom: 20px; text-transform: uppercase; letter-spacing: 0.5px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 12px; }
.footer-col a { color: #94A3B8; font-size: 16px; transition: 0.2s; }
.footer-col a:hover { color: var(--yellow); }
.footer-bottom { border-top: 1px solid #1E293B; padding: 24px 0; text-align: left; font-size: 14px; color: #CBD5E1; }
.footer-bottom p { font-size: 14px; line-height: 1.7; }

/* MODALS */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.6); display: none; align-items: center; justify-content: center; z-index: 200; backdrop-filter: blur(4px); }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: var(--radius); width: 100%; max-width: 500px; padding: 32px; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-close { font-size: 24px; color: var(--ink-2); }

/* TOAST */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff; padding: 14px 28px; border-radius: 8px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); border-left: 4px solid var(--green); opacity: 0; visibility: hidden; transition: all 0.3s ease; z-index: 300; display: flex; align-items: center; gap: 10px; }
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.toast .toast-check { color: var(--green); font-weight: 700; font-size: 16px; }

/* RESPONSIVE */
@media (max-width: 1024px) {
  .calc-split { grid-template-columns: 1fr; }
  .hiw-grid { flex-direction: column; }
  .hiw-arrow { transform: rotate(90deg); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .brand-col { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
  .main-nav { display: none; }
  .hamburger { display: block; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .res-big { font-size: 36px; }
  .footer-grid { grid-template-columns: 1fr; }
}
/* Footer logo — dedicated sizing */
.footer-logo-img {
  height: 130px;
  width: auto;
  object-fit: contain;
  display: block;
}
/* ---- MOBILE: Fix horizontal overflow (Step 1) ---- */
@media (max-width: 768px) {
  /* Ensure every box respects its declared width */
  .calc-card,
  .results-panel,
  .card,
  .diagram-wrap,
  .form-grid-2,
  .field,
  .input-group,
  .calc-tabs,
  .res-actions {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
  }

  /* Grid/flex children must be allowed to shrink */
  .calc-split > *,
  .calc-left,
  .calc-right {
    min-width: 0;
    max-width: 100%;
  }

  /* THE PRIMARY FIX: constrain the inline SVG diagram */
  .iso-diagram {
    max-width: 100%;
    width: 100%;
    height: auto;
  }

  /* Form controls must never exceed their container */
  .field input,
  .field select,
  .input-group input,
  .input-group select {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Tabs scroll internally instead of pushing the page wider */
  .calc-tabs {
    max-width: 100%;
  }
  .tab {
    flex-shrink: 0;
  }
}
/* ---- MOBILE HEADER FIX ---- */
@media (max-width: 768px) {
  /* Reduce header height for mobile */
  .site-header {
    height: 64px;
  }

  /* Scale logo down so it doesn't dominate the mobile header */
  .logo-img {
    height: 40px;
    width: auto;
    max-width: 130px;
  }

  /* Tighten spacing between action items */
  .header-actions {
    gap: 8px;
  }

  /* Compact My Projects button */
  .btn-projects {
    padding: 7px 14px;
    font-size: 12px;
    border-radius: 20px;
  }

  /* Ensure hamburger is visible and has a comfortable tap target */
  .hamburger {
    display: block;
    font-size: 22px;
    padding: 8px;
    line-height: 1;
  }
}
/* ---- MOBILE: Scrollable tabs with hidden scrollbar ---- */
@media (max-width: 768px) {
  .calc-tabs {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    /* Hide scrollbar — Firefox */
    scrollbar-width: none;
    /* Hide scrollbar — IE/Edge legacy */
    -ms-overflow-style: none;
  }

  /* Hide scrollbar — Chrome, Safari, Opera */
  .calc-tabs::-webkit-scrollbar {
    display: none;
  }

  /* Prevent tabs from shrinking or wrapping */
  .tab {
    flex-shrink: 0;
    white-space: nowrap;
  }
}