/* Shared styles for every page on 2x4calculator.com */

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

:root {
  --bg: #1a1a1a;
  --surface: #242424;
  --surface2: #2e2e2e;
  --border: #3a3a3a;
  --accent: #e8a838;
  --accent2: #c47f1a;
  --text: #e8e8e8;
  --text-muted: #8f8f8f;
  --danger: #e05252;
  --success: #52c77a;
  --radius: 8px;
  --header-h: 56px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

a {
  color: var(--accent);
}

/* ─── Header + nav ─────────────────────────────────────────────── */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.brand h1,
.brand .brand-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.tagline {
  color: var(--text-muted);
  font-size: 13px;
}

.site-nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface2);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--surface2);
}

/* ─── Form controls ───────────────────────────────────────────── */

label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
}

input.invalid {
  border-color: var(--danger) !important;
}

input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  transition:
    opacity 0.15s,
    background 0.15s;
}
.btn:hover {
  opacity: 0.85;
}
.btn:active {
  opacity: 0.7;
}
.btn-primary {
  background: var(--accent);
  color: #1a1a1a;
}
.btn-ghost {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: none;
  padding: 4px 8px;
  font-size: 16px;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.seg-toggle {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}
.seg-toggle button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.seg-toggle button[aria-pressed="true"] {
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
}

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* ─── Toast ───────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: #000;
  color: #fff;
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  z-index: 100;
  max-width: calc(100vw - 32px);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ─── Guide content (SEO text below the tool) ─────────────────── */

.content {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 48px 24px;
}

.content-inner {
  max-width: 820px;
  margin: 0 auto;
  line-height: 1.7;
  font-size: 15px;
  color: #cfcfcf;
}

.content h2 {
  font-size: 22px;
  color: var(--text);
  margin: 40px 0 12px;
  line-height: 1.3;
}
.content h2:first-child {
  margin-top: 0;
}
.content h3 {
  font-size: 17px;
  color: var(--text);
  margin: 24px 0 8px;
}
.content p {
  margin-bottom: 14px;
}
.content ul,
.content ol {
  margin: 0 0 14px 22px;
}
.content li {
  margin-bottom: 6px;
}
.content strong {
  color: var(--text);
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 18px;
  font-size: 14px;
}
.content th,
.content td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.content th {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.content td.num,
.content th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.table-scroll {
  overflow-x: auto;
}

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 18px;
}

.faq details {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: "+";
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}
.faq details[open] summary::after {
  content: "−";
}
.faq details p {
  margin: 10px 0 0;
}

.tool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.tool-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}
.tool-card:hover {
  border-color: var(--accent);
}
.tool-card strong {
  display: block;
  color: var(--accent);
  margin-bottom: 4px;
  font-size: 15px;
}
.tool-card span {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── Recommended products ────────────────────────────────────── */

.products {
  background: #1e1e1e;
  border-top: 1px solid #2e2e2e;
  padding: 40px 24px;
}
.products-inner {
  max-width: 960px;
  margin: 0 auto;
}
.products-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.products-head h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.products-head span {
  font-size: 11px;
  color: #777;
}
.products-sub {
  font-size: 13px;
  color: #777;
  margin-bottom: 24px;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px;
}
.product {
  display: flex;
  flex-direction: column;
  background: #242424;
  border: 1px solid #333;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}
.product:hover {
  border-color: var(--accent);
}
.product-img {
  background: #fff;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
}
.product-img img {
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
}
.product-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.product-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.product-desc {
  font-size: 11px;
  color: #777;
  flex: 1;
}
.product-cta {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 4px;
}

/* ─── Footer ──────────────────────────────────────────────────── */

.site-footer {
  background: #111;
  border-top: 1px solid #2a2a2a;
  padding: 32px 24px;
  color: #777;
  font-size: 13px;
  line-height: 1.7;
}
.site-footer .footer-inner {
  max-width: 860px;
  margin: 0 auto;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 12px;
}
.footer-links a {
  color: #aaa;
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--accent);
}
.site-footer small {
  display: block;
  color: #555;
  font-size: 11px;
}

/* scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

@media (max-width: 768px) {
  .site-header {
    padding: 10px 16px;
  }
  .site-nav {
    margin-left: 0;
    width: 100%;
  }
  .tagline {
    display: none;
  }
  .content,
  .products,
  .site-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media print {
  .toast {
    display: none !important;
  }
}

.content code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.9em;
  color: var(--text);
  white-space: nowrap;
}

/* Let inputs and grid children shrink on narrow screens */
input,
select,
button {
  min-width: 0;
}
