/* EasyBuildTools shared styles */
:root {
  --primary: #1F5F4A;
  --primary-dark: #174738;
  --accent: #E6A83B;
  --bg: #F7F8F6;
  --surface: #FFFFFF;
  --surface-2: #F0F3F0;
  --text: #1F2933;
  --muted: #5F6B76;
  --border: #D9E0DC;
  --error: #B42318;
  --success: #18794E;
  --shadow: 0 1px 2px rgba(31,41,51,.06), 0 4px 16px rgba(31,41,51,.06);
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 72rem;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  --primary: #4FB491;
  --primary-dark: #3C9A79;
  --accent: #F0BC5C;
  --bg: #12181A;
  --surface: #1A2225;
  --surface-2: #212B2F;
  --text: #E7ECEA;
  --muted: #9AA7A6;
  --border: #2C393D;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { line-height: 1.2; color: var(--text); font-weight: 700; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: .2em 0 .4em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 1.6em 0 .5em; }
h3 { font-size: 1.15rem; margin: 1.2em 0 .4em; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 56rem; }

/* Accessibility */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1000;
  background: var(--primary); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand svg { width: 30px; height: 30px; }
.brand-name span { color: var(--primary); }
.brand-logo { height: 64px; width: auto; display: block; }
.site-footer .brand-logo { height: 40px; }
@media (max-width: 600px) {
  .brand-logo { height: 44px; }
}
/* Header brand pinned to the upper left, large and prominent */
.site-header { min-height: 88px; }
.header-inner { min-height: 88px; }
.header-inner .brand { order: 1; margin-left: 0; margin-right: 1.5rem; flex-shrink: 0; }
.header-inner .main-nav { order: 2; }
.header-inner .header-actions { order: 3; }
.main-nav { display: flex; gap: .25rem; margin-left: 0; }
.main-nav a { padding: .5rem .75rem; border-radius: var(--radius-sm); color: var(--text); font-weight: 500; }
.main-nav a:hover { background: var(--surface-2); text-decoration: none; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
@media (max-width: 600px) {
  .site-header { min-height: 68px; }
  .header-inner { min-height: 68px; }
  .header-inner .brand { margin-right: .75rem; }
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; min-width: 44px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); border-radius: var(--radius-sm); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.nav-toggle { display: none; }

.mobile-nav { display: none; border-top: 1px solid var(--border); background: var(--surface); }
.mobile-nav.open { display: block; }
.mobile-nav a { display: block; padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); color: var(--text); font-weight: 500; }

@media (max-width: 820px) {
  .main-nav { display: none; }
  .nav-toggle { display: inline-flex; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.15rem; min-height: 44px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 1rem; cursor: pointer; border: 1px solid transparent;
  background: var(--primary); color: #fff; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover { background: var(--border); }

/* Search */
.search-form { display: flex; gap: .5rem; position: relative; }
.search-form input {
  flex: 1; padding: .75rem 1rem; min-height: 48px; font-size: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.search-results {
  position: absolute; top: calc(100% + .4rem); left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); max-height: 340px; overflow-y: auto; display: none;
}
.search-results.show { display: block; }
.search-results a { display: block; padding: .7rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a:focus { background: var(--surface-2); text-decoration: none; }
.search-results .res-cat { color: var(--muted); font-size: .8rem; }
.search-results .no-res { padding: .9rem 1rem; color: var(--muted); }

/* Hero */
.hero { padding: 3.5rem 0 2.5rem; background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); border-bottom: 1px solid var(--border); }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 42rem; }
.hero .search-form { max-width: 40rem; margin: 1.5rem 0 1rem; }
.pill-links { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.pill-links a {
  padding: .4rem .85rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; font-size: .9rem; color: var(--text); font-weight: 500;
}
.pill-links a:hover { border-color: var(--primary); text-decoration: none; }

/* Sections */
section.block { padding: 2.75rem 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.section-head p { color: var(--muted); margin: 0; }

/* Card grids */
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 820px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }
@media (min-width: 560px) and (max-width: 820px) { .grid-3 { grid-template-columns: repeat(2,1fr); } }

.tool-card {
  display: flex; flex-direction: column; gap: .35rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); transition: transform .12s, border-color .12s;
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--primary); text-decoration: none; }
.tool-card .cat { font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--primary); font-weight: 700; }
.tool-card h3 { margin: 0; font-size: 1.1rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.tool-card.disabled { opacity: .7; }
.badge { display: inline-block; font-size: .7rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.soon { background: var(--accent); color: #3a2a00; }

/* Feature list */
.features { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.25rem; }
@media (max-width: 820px){ .features { grid-template-columns: 1fr; } }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.feature h3 { margin-top: 0; }
.feature .fi { width: 34px; height: 34px; color: var(--primary); margin-bottom: .4rem; }

/* Breadcrumbs */
.breadcrumbs { font-size: .9rem; color: var(--muted); padding: 1rem 0 0; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; }
.breadcrumbs li::after { content: "/"; margin-left: .4rem; color: var(--border); }
.breadcrumbs li:last-child::after { content: ""; }

/* Calculator */
.calc-layout { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.5rem; align-items: start; }
@media (max-width: 900px){ .calc-layout { grid-template-columns: 1fr; } }
.calc-panel, .results-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.results-panel { position: sticky; top: 80px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .4rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field .hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
.field input, .field select {
  width: 100%; padding: .65rem .75rem; min-height: 44px; font-size: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.input-error { color: var(--error); font-size: .85rem; margin-top: .25rem; display: none; }
.field.invalid input { border-color: var(--error); }
.field.invalid .input-error { display: block; }
.row-inline { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 480px){ .row-inline, .field.two { grid-template-columns: 1fr; } }
.check-row { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.check-row input { width: 20px; height: 20px; min-height: 20px; }
.calc-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .5rem; }

.results-panel h2 { margin-top: 0; }
.result-summary { font-size: 1.05rem; }
.result-summary strong { color: var(--primary); font-size: 1.3rem; }
.result-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.result-table th, .result-table td { text-align: left; padding: .5rem .25rem; border-bottom: 1px solid var(--border); }
.result-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.result-note { font-size: .9rem; color: var(--muted); }
.result-empty { color: var(--muted); }

/* Ad placeholders */
.ad-slot {
  margin: 2rem 0; min-height: 120px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius);
  color: var(--muted); font-size: .85rem; text-align: center; padding: 1rem;
}

/* Fixed right-side ad rail — only shown where page margins leave room */
.side-ad { display: none; }
@media (min-width: 1500px) {
  .side-ad {
    display: block; position: fixed; top: 50%; transform: translateY(-50%);
    right: max(1rem, calc((100vw - var(--maxw)) / 2 - 190px));
    width: 160px; z-index: 30;
  }
  .side-ad .ad-slot { margin: 0; min-height: 480px; writing-mode: initial; }
}

/* Ad slots stay tidy on small screens */
@media (max-width: 560px) {
  .ad-slot { margin: 1.5rem 0; min-height: 90px; font-size: .8rem; padding: .75rem; }
}

/* Content prose */
.prose h2 { border-bottom: 1px solid var(--border); padding-bottom: .3rem; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin-bottom: .4rem; }
.worked-example { background: var(--surface); border-left: 4px solid var(--primary); border-radius: var(--radius-sm); padding: 1rem 1.25rem; }

/* FAQ accordion */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: .6rem; }
.faq summary { padding: 1rem 1.1rem; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--primary); }
.faq details[open] summary::after { content: "\2212"; }
.faq .faq-body { padding: 0 1.1rem 1rem; color: var(--muted); }

/* Disclaimer / callouts */
.callout { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.25rem; font-size: .95rem; }
.callout.warn { border-color: var(--accent); }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 3rem; padding: 2.5rem 0 1.5rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
@media (max-width: 820px){ .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h4 { margin: 0 0 .6rem; font-size: .95rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: .35rem; }
.footer-grid a { color: var(--muted); }
.footer-bottom { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

/* Contact form */
.form-grid { display: grid; gap: 1rem; max-width: 40rem; }

/* Filter bar */
.filter-bar { margin: 1rem 0 1.5rem; }
.filter-bar input { width: 100%; max-width: 30rem; padding: .7rem .9rem; min-height: 44px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 1rem; }
.no-match { color: var(--muted); padding: 1rem 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Print */
@media print {
  .site-header, .mobile-nav, .site-footer, .ad-slot, .side-ad, .calc-actions, .search-form,
  .breadcrumbs, .related, .prose, .faq, .skip-link, .filter-bar, nav { display: none !important; }
  body { background: #fff; color: #000; }
  .calc-layout { grid-template-columns: 1fr; }
  .results-panel { position: static; border: 1px solid #000; box-shadow: none; }
  .print-only { display: block !important; }
  a { color: #000; text-decoration: none; }
}
.print-only { display: none; }
