/* Expensive Downtime — Global Stylesheet */

:root {
  --bg-primary: #fff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #e2e8f0;
  --bg-dark: #0f172a;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-amber: #b45309;
  --accent-green: #16a34a;
  --accent-red: #dc2626;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --max-width: 1100px;
  --max-width-article: 760px;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-stack);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--accent-blue-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* Typography */

h1, h2, h3, h4 { color: var(--text-primary); line-height: 1.25; margin-bottom: 0.75rem; }
h1 { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 1.75rem; font-weight: 700; margin-top: 2.5rem; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin-bottom: 1rem; }
.text-muted { color: var(--text-secondary); }
.text-amber { color: var(--accent-amber); font-weight: 600; }

/* Layout */

.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }
.container--narrow { max-width: var(--max-width-article); }
main { flex: 1; }
section { padding: 4rem 0; }
section + section { border-top: 1px solid var(--bg-tertiary); }

/* Header */

.site-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--bg-tertiary);
  padding: 0.875rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.site-logo { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); text-decoration: none; letter-spacing: -0.01em; }
.site-logo:hover { color: var(--text-primary); text-decoration: none; }
.site-logo .logo-accent { color: var(--accent-amber); }

.site-nav { display: flex; align-items: center; gap: 2rem; }
.site-nav a { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; transition: color 0.15s; }
.site-nav a:hover { color: var(--text-primary); text-decoration: none; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

/* Footer */

.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--bg-tertiary);
  padding: 2rem 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.site-footer a { color: var(--text-secondary); }
.site-footer a:hover { color: var(--text-primary); }
.footer-links { margin-top: 0.75rem; display: flex; justify-content: center; gap: 1.5rem; }

/* Buttons */

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s;
}

.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: var(--accent-blue-hover); color: #fff; }
.btn-large { padding: 0.875rem 2rem; font-size: 1.05rem; }

/* Cards */

.card {
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin: 2rem 0; }

/* Stat Cards */

.stat-card { text-align: center; padding: 2rem 1.5rem; }
.stat-number { font-size: 2rem; font-weight: 700; color: var(--accent-amber); line-height: 1.2; margin-bottom: 0.5rem; }
.stat-desc { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; }

/* Problem Cards (dark section) */

.section--dark { background: var(--bg-dark); }
.section--dark h2 { color: #f1f5f9; margin-top: 0; }
.section--dark + section { border-top: none; }

.problem-card {
  background: #1e293b;
  border-color: #334155;
  padding: 2rem 1.5rem;
}
.problem-card h3 { color: #f1f5f9; font-size: 1.1rem; margin-bottom: 0.75rem; }
.problem-card p { color: #94a3b8; font-size: 0.9rem; line-height: 1.6; margin-bottom: 0; }

/* Hero */

.hero { padding: 4.5rem 0 3.5rem; text-align: center; }
.hero p { color: var(--text-secondary); font-size: 1.125rem; max-width: 600px; margin: 1rem auto 2rem; line-height: 1.7; }
/* Hero dark variant (homepage) */

.hero--dark { background: var(--bg-dark); padding: 5rem 0 4rem; }
.hero--dark h1 { color: #f1f5f9; }
.hero--dark p { color: #94a3b8; }

/* Email Capture */

.email-section {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  margin: 2rem 0;
}

.email-section h2 { margin-top: 0; }
.email-section p { color: var(--text-secondary); margin-bottom: 1.5rem; }

.email-form-row { display: flex; gap: 0.5rem; max-width: 440px; margin: 0 auto; }
.email-form-row input[type="email"] {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--bg-tertiary);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-stack);
}
.email-form-row input[type="email"]::placeholder { color: var(--text-secondary); }
.email-form-row input[type="email"]:focus { border-color: var(--accent-blue); outline: 2px solid transparent; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25); }
.email-form-row input[type="email"]:focus:not(:focus-visible) { box-shadow: none; }
.email-form-row button[type="submit"] { white-space: nowrap; }

.form-message { margin-top: 0.75rem; font-size: 0.9rem; min-height: 1.5em; }
.form-message--success { color: var(--accent-green); }
.form-message--error { color: var(--accent-red); }

/* Calculator */
.calc-form { display: grid; gap: 1.25rem; margin: 2rem 0; }
.calc-form label { display: block; font-weight: 500; margin-bottom: 0.35rem; font-size: 0.95rem; }

/* Operating hours toggle */
.calc-toggle { display: flex; border: 1px solid var(--bg-tertiary); border-radius: var(--radius); overflow: hidden; }
.calc-toggle-btn {
  flex: 1;
  padding: 0.6rem 1.25rem;
  background: var(--bg-primary);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: var(--font-stack);
  transition: background 0.2s, color 0.2s;
  text-align: center;
  line-height: 1.4;
  -webkit-appearance: none;
  touch-action: manipulation;
}
.calc-toggle-btn + .calc-toggle-btn { border-left: 1px solid var(--bg-tertiary); }
.calc-toggle-btn.active { background: var(--text-primary); color: #fff; }
.calc-toggle-sub { display: block; font-size: 0.7rem; font-weight: 400; opacity: 0.6; margin-top: 0.1rem; }

/* Calculator button row */
.calc-btn-row { display: flex; gap: 1rem; align-items: center; margin-top: 0.5rem; }
.calc-btn-row .btn { flex: 1; text-align: center; }
.calc-reset-btn {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-stack);
  padding: 0.75rem 1.5rem;
  transition: background 0.15s, color 0.15s;
  text-align: center;
}
.calc-reset-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.calc-form select,
.calc-form input[type="text"] {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--bg-tertiary);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-stack);
}

.calc-form select:focus,
.calc-form input[type="text"]:focus { border-color: var(--accent-blue); outline: 2px solid transparent; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25); }
.calc-form select:focus:not(:focus-visible),
.calc-form input[type="text"]:focus:not(:focus-visible) { box-shadow: none; }
.calc-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.calc-results { margin-top: 2rem; display: none; }
.calc-results.visible { display: block; }
.calc-total { text-align: center; margin-bottom: 2rem; }
.calc-total-label { font-size: 1rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.calc-total-number { font-size: 3rem; font-weight: 700; color: var(--accent-amber); line-height: 1.2; }
.calc-total-context { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.5rem; }
.calc-breakdown { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 2rem; }
.calc-breakdown-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.calc-breakdown-card { text-align: center; padding: 1.25rem; }
.calc-breakdown-label { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.calc-breakdown-value { font-size: 1.5rem; font-weight: 700; color: var(--accent-amber); }
.calc-hidden { display: none; }
.calc-ctas { margin-top: 2.5rem; display: none; }
.calc-ctas.visible { display: block; }

/* Article List */

.article-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 2rem; }

.article-card {
  display: block;
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  transition: border-color 0.15s;
}
.article-card:hover { border-color: var(--accent-blue); text-decoration: none; }
.article-card__title { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin-top: 0; margin-bottom: 0.25rem; }
.article-card__meta { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 0.5rem; }
.article-card__summary { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 0; line-height: 1.6; }

/* Article */

.article-content { max-width: var(--max-width-article); margin: 0 auto; }
.article-content h2 { margin-top: 3rem; }
.article-content p { max-width: 65ch; }
.article-content ul, .article-content ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.article-content li { margin-bottom: 0.5rem; }
.article-meta { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 2rem; }
.article-sources { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--bg-tertiary); color: var(--text-secondary); font-size: 0.9rem; }

/* Checklist Preview */

.checklist-preview { list-style: none; padding: 0; margin: 1.5rem 0; }
.checklist-preview li {
  padding: 0.75rem 0 0.75rem 1.75rem;
  border-bottom: 1px solid var(--bg-tertiary);
  position: relative;
}
.checklist-preview li::before { content: "\2610"; position: absolute; left: 0; color: var(--accent-blue); }

/* About */

.about-section { margin-bottom: 2.5rem; }
.about-section h2 { margin-top: 0; }

/* Utilities */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.text-small { font-size: 0.85rem; }
.text-center { text-align: center; }

/* Responsive */

@media (max-width: 768px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.35rem; }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--bg-tertiary);
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 1rem;
  }
  .site-nav.open { display: flex; }
  .nav-toggle { display: block; }
  .card-grid { grid-template-columns: 1fr; }
  .calc-toggle-btn { padding: 0.65rem 0.75rem; font-size: 0.8rem; }
  .calc-toggle-sub { font-size: 0.65rem; }
  .calc-form-grid { grid-template-columns: 1fr; }
  .calc-btn-row { flex-direction: column; gap: 0.5rem; }
  .calc-btn-row .btn,
  .calc-btn-row .calc-reset-btn { width: 100%; }
  .calc-breakdown { grid-template-columns: 1fr; }
  .calc-total-number { font-size: 2.25rem; }
  section { padding: 3rem 0; }
  .hero { padding: 3rem 0 2.5rem; }
  .hero--dark { padding: 3.5rem 0 3rem; }
  .hero p { font-size: 1rem; }
  .email-form-row { flex-direction: column; }
  .email-form-row button[type="submit"] { width: 100%; }
  .stat-number { font-size: 1.75rem; }
}
