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

:root {
  --color-bg: #f5f7fb;
  --color-text: #122030;
  --color-primary: #0d3c66;
  --color-accent: #3bb0ff;
  --color-card: #fff;
  --color-muted: #5b6a7b;
  --color-border: rgba(15, 35, 52, 0.06);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark mode */
body.dark-mode {
  --color-bg: #0f1419;
  --color-text: #e6edf3;
  --color-primary: #1a4d7a;
  --color-accent: #58c4ff;
  --color-card: #1c2128;
  --color-muted: #8b949e;
  --color-border: rgba(240, 246, 252, 0.1);
}

body.dark-mode .site-header {
  background: #0a0e13;
  border-bottom: 1px solid rgba(240, 246, 252, 0.1);
}

body.dark-mode .hero {
  background: linear-gradient(135deg, #0a1929, #1a3a52);
}

body.dark-mode .section-alt {
  background: #161b22;
}

body.dark-mode .calc-results {
  background: #1a3a52;
}

body.dark-mode .site-footer {
  background: #0a0e13;
  border-top: 1px solid rgba(240, 246, 252, 0.1);
}

/* Skip to content */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-accent);
  color: #000;
  padding: 0.5rem 1rem;
  z-index: 100;
  border-radius: 0 0 0.5rem 0;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #0d3c66;
  color: #fff;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 2px solid #3bb0ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.brand-text .accent {
  color: #3bb0ff;
}

.nav {
  display: flex;
  gap: 1rem;
  font-size: 0.95rem;
}

.nav a {
  opacity: 0.9;
}

.nav a.active,
.nav a:hover {
  opacity: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  border: none;
  background: #3bb0ff;
  color: #0b2237;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn:hover {
  background: #1890dd;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #ffffff;
  color: #0d3c66;
  font-weight: 600;
}

.btn-ghost:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

/* Hero */

.hero {
  background: linear-gradient(135deg, #0d3c66, #11578f);
  color: #fff;
  padding: 3.5rem 0 3rem;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 2.5rem;
  align-items: center;
}

.hero h1 {
  font-size: 2.4rem;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.hero p {
  max-width: 32rem;
  font-size: 1.02rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.hero-card {
  background: rgba(11, 34, 55, 0.85);
  border-radius: 1.2rem;
  padding: 1.5rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

.hero-card h2 {
  font-size: 1.1rem;
  margin-top: 0;
}

.hero-metric {
  font-size: 1.05rem;
  margin: 0.35rem 0;
}

.hero-metric span {
  opacity: 0.85;
}

/* Generic sections */

.section {
  padding: 2.5rem 0;
}

.section-alt {
  background: #e9f0f9;
  padding: 2.5rem 0;
}

.section h2 {
  margin-top: 0;
}

.section-split .split-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2.5rem;
}

/* Tools grid */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.tool-card {
  background: var(--color-card);
  border-radius: 0.9rem;
  padding: 1.1rem 1rem;
  box-shadow: 0 8px 20px var(--color-border);
  border: 1px solid var(--color-border);
  transition: transform 0.08s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.tool-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
}

.tool-card p {
  margin: 0;
  font-size: 0.92rem;
  color: #3d4852;
}

body.dark-mode .tool-card p {
  color: #b8c5d0;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: #3bb0ff;
  box-shadow: 0 14px 30px rgba(15, 35, 52, 0.12);
}

/* Templates */

.template-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.template-item {
  background: var(--color-card);
  border-radius: 0.7rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.93rem;
  box-shadow: 0 6px 16px rgba(15, 35, 52, 0.05);
  border: 1px solid var(--color-border);
}

/* Newsletter */

.newsletter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.newsletter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.newsletter-form input[type="email"] {
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #c3d1e4;
  min-width: 220px;
  font-size: 0.95rem;
}

/* Calculator layout */

.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr);
  gap: 1.75rem;
  margin-top: 1.5rem;
}

.calc-form {
  background: var(--color-card);
  border-radius: 1rem;
  padding: 1.2rem 1.3rem;
  box-shadow: 0 10px 25px rgba(15, 35, 52, 0.08);
}

.field {
  margin-bottom: 0.85rem;
  position: relative;
}

.field label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.field input,
.field select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 0.55rem;
  border: 1px solid #c3d1e4;
  font-size: 0.95rem;
  background: var(--color-card);
  color: var(--color-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(59, 176, 255, 0.1);
}

.field small {
  color: #5a6c7d;
}

body.dark-mode .field small {
  color: #9ca3af;
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
  margin-left: 0.25rem;
  cursor: help;
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  z-index: 10;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  white-space: nowrap;
  max-width: 250px;
  white-space: normal;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip:hover .tooltip-text,
.tooltip:focus .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1a1a1a;
}

.calc-results {
  background: #0d3c66;
  color: #fff;
  border-radius: 1rem;
  padding: 1.3rem 1.4rem;
  box-shadow: 0 10px 25px rgba(3, 15, 30, 0.4);
}

.calc-results h2 {
  margin-top: 0;
}

.calc-results .muted {
  opacity: 1;
  font-size: 0.94rem;
  color: rgba(255, 255, 255, 0.9);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.result-card {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 0.6rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.92rem;
}

.result-card .label {
  opacity: 0.95;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.result-card .value {
  font-weight: 600;
  font-size: 1.02rem;
}

/* Footer */

.site-footer {
  background: #0b2237;
  color: #cbd6e6;
  padding: 1rem 0;
  margin-top: 1rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  gap: 0.75rem;
}

.footer-links a {
  opacity: 0.85;
}

.footer-links a:hover {
  opacity: 1;
}

/* Utilities */

.section-small {
  margin-top: 1.5rem;
}

ul {
  padding-left: 1.1rem;
}

.muted {
  color: #4a5568;
  font-size: 0.95rem;
}

/* Better contrast for muted text in dark mode */
body.dark-mode .muted {
  color: #a0aec0;
}

/* Responsive */

@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-card {
    margin-top: 1.5rem;
  }
  .calc-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .hero {
    padding: 2.5rem 0 2.25rem;
  }
  .hero h1 {
    font-size: 1.9rem;
  }
  .tool-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Better focus states for accessibility */
a:focus,
button:focus,
input:focus,
select:focus,
.tool-card:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Dark mode toggle */
.dark-mode-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 50;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--color-accent);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  transition: transform 0.2s ease, background 0.2s ease;
}

.dark-mode-toggle:hover {
  transform: scale(1.1);
}

.dark-mode-toggle:active {
  transform: scale(0.95);
}

/* Button group */
.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-accent);
  color: var(--color-accent);
  font-weight: 600;
}

.btn-secondary:hover {
  background: var(--color-accent);
  color: #fff;
}

/* Better contrast for secondary buttons in dark results panel */
.calc-results .btn-secondary {
  border-color: rgba(255, 255, 255, 0.8);
  color: rgba(255, 255, 255, 0.95);
}

.calc-results .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
  color: #fff;
}

/* Print styles */
@media print {
  .site-header,
  .site-footer,
  .nav,
  .dark-mode-toggle,
  .btn,
  .calc-form,
  .newsletter,
  .hero-actions {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .calc-results {
    background: white !important;
    color: black !important;
    border: 2px solid #000;
    page-break-inside: avoid;
  }

  .result-card {
    border: 1px solid #333;
    background: white !important;
    color: black !important;
  }

  .result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .hero {
    background: white;
    color: black;
    padding: 1rem 0;
  }

  a[href]:after {
    content: none;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }
}

/* Loading state */
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error and success messages */
.message {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.message-error {
  background: #fee;
  color: #c33;
  border-left: 4px solid #c33;
}

.message-success {
  background: #efe;
  color: #3c3;
  border-left: 4px solid #3c3;
}

.message-info {
  background: #eef;
  color: #33c;
  border-left: 4px solid #33c;
}

/* Noscript warning */
noscript {
  display: block;
  background: #ffeaa7;
  color: #2d3436;
  padding: 1rem;
  text-align: center;
  font-weight: 600;
}

/* Improved mobile touch targets */
@media (max-width: 768px) {
  .nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .field input,
  .field select {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Blog styles */

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.blog-card {
  background: var(--color-card);
  border-radius: 0.9rem;
  padding: 1.3rem;
  box-shadow: 0 8px 20px var(--color-border);
  border: 1px solid var(--color-border);
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.12s ease;
}

.blog-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-accent);
  box-shadow: 0 14px 30px rgba(15, 35, 52, 0.15);
}

.blog-meta {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.blog-category {
  background: var(--color-accent);
  color: #fff;
  padding: 0.25rem 0.6rem;
  border-radius: 0.4rem;
  font-weight: 600;
  font-size: 0.8rem;
}

.blog-date {
  color: var(--color-muted);
  align-self: center;
}

.blog-card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
  line-height: 1.4;
}

.blog-card h3 a {
  color: var(--color-text);
  transition: color 0.2s ease;
}

.blog-card h3 a:hover {
  color: var(--color-accent);
}

.blog-card p {
  margin: 0 0 0.85rem;
  color: #3d4852;
  font-size: 0.93rem;
  line-height: 1.55;
}

body.dark-mode .blog-card p {
  color: #b8c5d0;
}

.blog-read-more {
  color: var(--color-accent);
  font-weight: 600;
  font-size: 0.9rem;
  transition: opacity 0.2s ease;
}

.blog-read-more:hover {
  opacity: 0.8;
}

/* Individual blog post styles */

.blog-container {
  max-width: 820px;
}

.blog-header {
  margin-bottom: 2.5rem;
}

.blog-header .blog-meta {
  margin-bottom: 1rem;
}

.blog-header h1 {
  margin: 0 0 0.8rem;
  font-size: 2.2rem;
  line-height: 1.25;
}

.blog-subtitle {
  font-size: 1.15rem;
  color: #4a5568;
  margin: 0;
  line-height: 1.5;
}

body.dark-mode .blog-subtitle {
  color: #a0aec0;
}

.blog-content {
  font-size: 1.02rem;
  line-height: 1.7;
}

.blog-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-size: 1.7rem;
  color: var(--color-primary);
}

body.dark-mode .blog-content h2 {
  color: var(--color-accent);
}

.blog-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.35rem;
}

.blog-content h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  font-size: 1.1rem;
}

.blog-content p {
  margin-bottom: 1.25rem;
}

.blog-content ul,
.blog-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.blog-content li {
  margin-bottom: 0.5rem;
  line-height: 1.65;
}

.blog-content strong {
  font-weight: 600;
  color: var(--color-text);
}

.blog-cta {
  background: var(--color-primary);
  color: #fff;
  padding: 1.75rem;
  border-radius: 0.9rem;
  margin: 2.5rem 0;
  text-align: center;
}

body.dark-mode .blog-cta {
  background: #1a3a52;
}

.blog-cta h3 {
  margin: 0 0 0.6rem;
  color: #fff;
}

.blog-cta p {
  margin: 0 0 1.25rem;
  color: rgba(255, 255, 255, 0.9);
}

.blog-cta .btn {
  background: #fff;
  color: var(--color-primary);
  font-weight: 600;
}

.blog-cta .btn:hover {
  background: rgba(255, 255, 255, 0.9);
}

.blog-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }

  .blog-header h1 {
    font-size: 1.75rem;
  }

  .blog-subtitle {
    font-size: 1rem;
  }

  .blog-content {
    font-size: 1rem;
  }

  .blog-content h2 {
    font-size: 1.5rem;
  }

  .blog-content h3 {
    font-size: 1.2rem;
  }
}

/* Contact page */

.contact-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.contact-card {
  background: var(--color-card);
  padding: 1.5rem;
  border-radius: 0.9rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 8px 20px var(--color-border);
}

.contact-card h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.contact-card ul {
  margin-bottom: 0;
}

/* Cookie consent banner */

.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-card);
  border-top: 2px solid var(--color-accent);
  padding: 1rem;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
  display: none;
}

.cookie-consent.show {
  display: block;
}

.cookie-consent-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.cookie-consent p {
  margin: 0;
  font-size: 0.9rem;
  flex: 1;
  min-width: 250px;
}

.cookie-consent-actions {
  display: flex;
  gap: 0.5rem;
}

@media (max-width: 768px) {
  .cookie-consent-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .cookie-consent-actions {
    width: 100%;
  }

  .cookie-consent-actions .btn {
    flex: 1;
  }
}
