/*
 * common.css — PERF-006
 * Shared styles extracted from all pages of myusfinance.
 * Inline <style> blocks are kept for page-specific overrides;
 * this file provides the base layer so browsers can cache it.
 */

/* ===== CSS Reset / Box-Sizing ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

/* ===== :root variables ===== */
:root {
  --bg: #fbfbff;
  --surface: #ffffff;
  --muted: #6b7280;
  --text: #081124;
  --glass: rgba(9, 16, 28, 0.04);
  --border: rgba(9, 16, 28, 0.06);
  --radius-lg: 18px;
  --radius-md: 12px;
  --card-padding: 16px;
  --shadow-1: 0 6px 28px rgba(7, 12, 20, 0.08);
  --shadow-2: 0 10px 40px rgba(7, 12, 20, 0.06);

  /* Rainbow gradient stops */
  --rainbow-1: #ff5f6d;
  --rainbow-2: #ffc371;
  --rainbow-3: #ffd66b;
  --rainbow-4: #7be495;
  --rainbow-5: #66d9ff;
  --rainbow-6: #a18bfa;

  --rainbow-grad: linear-gradient(90deg, var(--rainbow-1), var(--rainbow-2) 18%, var(--rainbow-4) 36%, var(--rainbow-5) 60%, var(--rainbow-6) 84%);
  --accent: linear-gradient(135deg, rgba(255, 95, 109, 0.95), rgba(161, 139, 250, 0.95));

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
  color: var(--text);
  font-size: 16px;
}

/* ===== Body base styles ===== */
body {
  margin: 0;
  background:
    radial-gradient(800px 400px at 10% 10%, rgba(161, 139, 250, 0.07), transparent 8%),
    radial-gradient(700px 300px at 90% 90%, rgba(102, 217, 255, 0.06), transparent 6%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.55;
  padding: 28px;
}

/* ===== Layout ===== */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== Header ===== */
header.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
  box-shadow: var(--shadow-1);
  flex: 0 0 56px;
}

.brand h1 {
  font-size: 18px;
  margin: 0;
}

.brand .tag {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ===== Top navigation ===== */
nav.top-nav {
  display: flex;
  gap: 12px;
  align-items: center;
}

nav.top-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 600;
}

nav.top-nav a:hover {
  color: var(--text);
  background: var(--glass);
}

.btn-primary {
  background: var(--accent);
  background-image: var(--rainbow-grad);
  color: white;
  padding: 10px 14px;
  border-radius: 12px;
  border: 0;
  font-weight: 700;
  box-shadow: 0 8px 30px rgba(12, 18, 32, 0.12);
  text-decoration: none;
  display: inline-block;
}

.btn-primary:active {
  transform: translateY(1px);
}

/* ===== Hero section (calculator pages) ===== */
.hero {
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.9));
  box-shadow: var(--shadow-2);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -10%;
  top: -30%;
  width: 60%;
  height: 180%;
  background: linear-gradient(120deg, rgba(255, 95, 109, 0.06), rgba(255, 195, 113, 0.06), rgba(161, 139, 250, 0.06));
  transform: rotate(20deg);
  pointer-events: none;
}

.hero .eyebrow {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.hero h2 {
  font-size: 22px;
  margin: 0 0 8px;
  letter-spacing: -0.2px;
}

/* ===== Skip navigation (accessibility) ===== */
.skip-nav {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 9999;
}

.skip-nav:focus {
  position: fixed;
  top: 10px;
  left: 10px;
  width: auto;
  height: auto;
  padding: 10px 20px;
  background: #081124;
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  text-decoration: none;
  z-index: 9999;
}

/* ===== Footer ===== */
footer.site-footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

footer .footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

footer a {
  color: var(--muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--text);
}

/* ===== Breadcrumb navigation ===== */
.breadcrumb-nav {
  font-size: 0.85rem;
  margin-bottom: 16px;
  padding: 8px 0;
}

.breadcrumb-nav a {
  color: var(--muted, #6b7280);
  text-decoration: none;
}

.breadcrumb-nav span {
  color: var(--muted, #6b7280);
}

/* ===== Financial disclaimer ===== */
.financial-disclaimer {
  background: #fff8f0;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.82rem;
  color: #92400e;
  line-height: 1.5;
}

.financial-disclaimer strong {
  color: #b45309;
}

.financial-disclaimer a {
  color: #b45309;
  text-decoration: underline;
}

/* ===== Cookie consent banner ===== */
#cookie-consent {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #081124;
  color: #fff;
  padding: 16px 24px;
  z-index: 10000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  font-size: 0.88rem;
  line-height: 1.5;
}

#cookie-consent a {
  color: #66d9ff;
  text-decoration: underline;
}

/* ===== Accessibility focus ===== */
a:focus,
button:focus,
input:focus {
  outline: 3px solid rgba(16, 124, 255, 0.12);
  outline-offset: 3px;
}

/* ===== Responsive: small screens ===== */
@media (max-width: 720px) {
  body {
    padding: 16px;
  }

  nav.top-nav a:not(.btn-primary) {
    display: none;
  }
}

@media (max-width: 420px) {
  body {
    padding: 16px;
  }

  .logo {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
  }
}

/* ===== Print stylesheet ===== */
@media print {
  header,
  footer,
  .cookie-consent,
  #cookie-consent,
  .share-buttons,
  .sidebar,
  .breadcrumb-nav,
  .skip-nav,
  .freshness-badge,
  .author-byline,
  nav,
  .toc-container,
  .financial-disclaimer,
  button,
  .ad-container {
    display: none !important;
  }

  body {
    padding: 0;
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  .wrap,
  main,
  .blog-layout,
  .blog-content {
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  .blog-layout {
    display: block;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }

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

  img {
    max-width: 100%;
  }

  .blog-hero {
    background: none !important;
    padding: 20px 0 !important;
  }

  .blog-hero-title {
    color: #000 !important;
    font-size: 1.5em;
  }
}
