/* PE-Calc shared styles. Engineering-blueprint feel: cool grays, technical
   monospace accents, subdued blue. Print-friendly so engineers can save calc
   results from the browser. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #f5f6f8; color: #1c2330; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; line-height: 1.55; }

a { color: #2a5b8e; text-decoration: none; }
a:hover { color: #14406b; text-decoration: underline; }
code, .mono { font-family: 'SF Mono', Menlo, Consolas, monospace; }

/* Top header / nav */
.site-head { background: #1c2942; color: #f0f2f5; padding: 14px 24px; border-bottom: 3px solid #2a5b8e; }
.site-head .wrap { max-width: 1100px; margin: 0 auto; display: flex; align-items: baseline; gap: 22px; flex-wrap: wrap; }
.site-head a.logo { color: #f0f2f5; font-weight: 700; font-size: 1.25em; letter-spacing: 1.5px; text-decoration: none; }
.site-head a.logo span { color: #6fa8dc; }
.site-head nav a { color: #c0d0e8; font-size: 0.88em; margin-left: 2px; }
.site-head nav a:hover { color: #ffffff; text-decoration: none; }

/* Layout */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
main.wrap { padding-top: 28px; padding-bottom: 60px; }
h1 { font-size: 1.7em; color: #1c2942; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 1.15em; color: #1c2942; margin: 28px 0 10px; border-bottom: 1px solid #d6dce5; padding-bottom: 6px; }
.lede { color: #4a5568; font-size: 1.02em; margin: 0 0 22px; }

/* Calculator card */
.calc { background: #ffffff; border: 1px solid #d6dce5; border-radius: 6px; padding: 20px 22px; box-shadow: 0 1px 3px rgba(20,30,50,0.06); margin: 18px 0; }
.calc .row { display: grid; grid-template-columns: 220px 1fr 80px; gap: 12px; align-items: center; padding: 6px 0; }
.calc .row label { color: #1c2942; font-weight: 500; font-size: 0.95em; }
.calc .row input, .calc .row select { padding: 7px 10px; border: 1px solid #c4cbd6; border-radius: 4px; font-family: inherit; font-size: 0.95em; background: #fafbfc; }
.calc .row input:focus, .calc .row select:focus { outline: 2px solid #2a5b8e; outline-offset: -1px; background: #ffffff; }
.calc .row .unit { color: #6b7280; font-size: 0.86em; }
.calc .out-row { background: #eaf2fb; border-top: 1px dashed #2a5b8e; margin-top: 10px; padding-top: 14px; }
.calc .out-row label { color: #14406b; font-weight: 700; }
.calc .out-row .out-val { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 1.15em; color: #14406b; font-weight: 700; }
.calc .out-row .out-val.bad { color: #b03a2e; }
.calc .note { color: #6b7280; font-size: 0.84em; font-style: italic; margin-top: 6px; }
.calc .formula { background: #fafbfc; border: 1px solid #e0e4ec; border-radius: 4px; padding: 14px 18px; margin: 14px 0 0; overflow-x: auto; }
.calc .formula .vars { color: #4a5568; font-size: 0.86em; margin-top: 10px; line-height: 1.7; }
.calc .formula .vars b { color: #1c2942; font-family: 'SF Mono', Menlo, Consolas, monospace; }

/* Tool grid (landing) */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 18px 0 30px; }
.tool-card { display: block; background: #ffffff; border: 1px solid #d6dce5; border-left: 3px solid #2a5b8e; border-radius: 4px; padding: 14px 16px; text-decoration: none; transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s; }
.tool-card:hover { border-left-color: #14406b; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(20,30,50,0.08); text-decoration: none; }
.tool-card .t-name { color: #1c2942; font-weight: 700; font-size: 1.05em; margin: 0 0 4px; }
.tool-card .t-sub { color: #4a5568; font-size: 0.86em; line-height: 1.45; }
.tool-grid .category { grid-column: 1 / -1; color: #4a5568; font-size: 0.78em; letter-spacing: 3px; text-transform: uppercase; padding: 14px 0 4px; border-bottom: 1px solid #d6dce5; margin-bottom: 4px; }

/* Explanation prose under calc */
.prose { max-width: 760px; }
.prose p { margin: 12px 0; color: #2d3748; }
.prose ul { color: #2d3748; padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose .ref { color: #6b7280; font-size: 0.86em; font-style: italic; border-left: 3px solid #d6dce5; padding: 2px 12px; margin: 18px 0 0; }

/* Ad slot — clearly demarcated for AdSense policy compliance */
.ad-slot { margin: 24px 0; min-height: 90px; display: flex; align-items: center; justify-content: center; background: #ffffff; border: 1px dashed #d6dce5; border-radius: 4px; padding: 6px; position: relative; }
.ad-slot::before { content: 'Advertisement'; position: absolute; top: -8px; left: 14px; background: #f5f6f8; padding: 0 6px; color: #9aa3b0; font-size: 0.66em; letter-spacing: 2px; }
.ad-slot ins { display: block !important; }

/* Newsletter signup CTA — appears before the footer on every page */
.newsletter-cta { background: #1c2942; color: #f0f2f5; padding: 40px 24px; text-align: center; }
.newsletter-cta .wrap { max-width: 640px; }
.newsletter-cta h2 { color: #f0d89c; border-bottom: none; margin: 0 0 10px; font-size: 1.25em; letter-spacing: -0.005em; }
.newsletter-cta p { color: #c0d0e8; margin: 0 0 18px; font-size: 0.95em; line-height: 1.55; }
.newsletter-form { display: flex; gap: 0; max-width: 460px; margin: 4px auto; }
.newsletter-form input[type=email] { flex: 1; padding: 11px 14px; border: 1px solid #4a6788; border-right: none; border-radius: 4px 0 0 4px; background: #ffffff; font-size: 0.95em; font-family: inherit; }
.newsletter-form input[type=email]:focus { outline: 2px solid #6fa8dc; outline-offset: -1px; }
.newsletter-form button { padding: 11px 22px; background: #6fa8dc; color: #1c2942; border: 1px solid #6fa8dc; border-radius: 0 4px 4px 0; font-weight: 700; cursor: pointer; font-size: 0.95em; font-family: inherit; }
.newsletter-form button:hover { background: #94c3e8; border-color: #94c3e8; }
.newsletter-cta .micro { font-size: 0.78em; color: #8caac8; margin-top: 14px; }
.newsletter-cta .micro a { color: #b0c8e0; }
@media (max-width: 540px) {
  .newsletter-form { flex-direction: column; }
  .newsletter-form input[type=email] { border-right: 1px solid #4a6788; border-radius: 4px; margin-bottom: 6px; }
  .newsletter-form button { border-radius: 4px; }
}

/* Footer */
footer.site-foot { border-top: 1px solid #d6dce5; padding: 24px; text-align: center; color: #6b7280; font-size: 0.86em; background: #ffffff; }
footer.site-foot .related-sites { max-width: 760px; margin: 0 auto 14px; padding-bottom: 14px; border-bottom: 1px dashed #e0e4ec; font-size: 0.88em; line-height: 1.6; }
footer.site-foot .related-sites a { color: #2a5b8e; }
footer.site-foot .related-sites b { color: #1c2942; font-weight: 600; }
footer.site-foot a { color: #4a5568; }
footer.site-foot .disclosure { max-width: 700px; margin: 0 auto 14px; font-style: italic; font-size: 0.82em; line-height: 1.6; }

@media (max-width: 700px) {
  .calc .row { grid-template-columns: 1fr; gap: 4px; }
  .calc .row .unit { padding-left: 4px; }
}

/* Back-to-tools link, sits above the H1 on each tool page */
.back-link { display: inline-flex; align-items: center; gap: 6px; margin: 18px 0 14px; color: #4a5568; font-size: 0.88em; text-decoration: none; padding: 4px 10px 4px 6px; border: 1px solid transparent; border-radius: 4px; transition: color 0.12s, background 0.12s, border-color 0.12s; }
.back-link:hover { color: #14406b; background: #eaf2fb; border-color: #b8ceea; text-decoration: none; }
.back-link::before { content: '←'; font-size: 1.05em; line-height: 1; }

/* Print-only watermark — shown on every printed page in the bottom-right.
   Hidden during normal screen viewing. */
.print-watermark { display: none; }

/* ===== PRINT STYLES ===== */
@media print {
  @page { size: letter portrait; margin: 0.5in 0.5in 0.7in 0.5in; }
  body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  .site-head, footer.site-foot, .newsletter-cta, .ad-slot, .back-link { display: none !important; }
  main.wrap { padding: 0 !important; max-width: none !important; }
  h1 { font-size: 18pt; margin-bottom: 8px; }
  h2 { font-size: 13pt; margin: 14px 0 6px; }
  .lede { font-size: 11pt; margin-bottom: 14px; }
  .calc, .formula { box-shadow: none !important; border: 1px solid #888 !important; page-break-inside: avoid; }
  .calc .row { gap: 6px; padding: 3px 0; }
  .calc .out-row { background: #f3f3f3 !important; }
  .calc input, .calc select { border: 1px solid #999 !important; background: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .prose { max-width: none !important; }
  .prose .ref { font-size: 9pt; }
  ul, ol { page-break-inside: avoid; }
  a { color: #000 !important; text-decoration: none !important; }
  a[href^="http"]::after, a[href^="/"]::after { content: ''; }
  /* Watermark — fixed bottom-right of each printed page (browser-dependent;
     Chrome/Edge/Firefox render fixed elements once on the last page; Safari
     repeats per page. Acceptable in either case for short calculation sheets.) */
  .print-watermark {
    display: block !important;
    position: fixed;
    bottom: 0.25in;
    right: 0.5in;
    font-size: 8pt;
    color: #999;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    letter-spacing: 0.04em;
  }
}
