/* Import Inter for a highly legible, modern geometric sans-serif aesthetic */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* High contrast accessible color palette */
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --text: #0f172a;
  /* Slate 900 for high text contrast */
  --dark-bg: #0f172a;
  /* Unified dark background for branding elements */
  --text-muted: #475569;
  /* Slate 600, passes WCAG AA on #f8fafc */
  --border: #cbd5e1;
  --primary: #2563eb;
  /* Blue 600, high contrast */
  --primary-hover: #1d4ed8;
  --positive: #15803d;
  /* Green 700, high contrast */
  --negative: #b91c1c;
  /* Red 700, high contrast */
  --accent: #f59e0b;
  --widget-bg: #ffffff;
  --input-bg: #f8fafc;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --focus-ring: 0 0 0 4px rgba(37, 99, 235, 0.3);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  /* Accessible 16px base font size for mobile screens */
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 768px) {
  body {
    font-size: 18px;
    /* Clean, slightly larger 18px base for desktop readability */
  }
}

/* Typography Hierarchy */
h1,
h2,
h3 {
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.025em;
  /* Modern tight tracking for headings */
}

h1 {
  font-size: 2.75rem;
  font-weight: 800;
  margin: 0 0 1rem;
}

h2 {
  font-size: 2rem;
  font-weight: 700;
  margin: 3rem 0 1.25rem;
}

h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

p {
  margin: 0 0 1.25rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.25rem;
  font-weight: 400;
}

/* Accessible Default Links */
a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-hover);
}

a:focus-visible {
  outline: 4px solid var(--primary);
  outline-offset: 2px;
  border-radius: 0;
}

/* Wider, More Breathable Layout */
.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.converter-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
}

/* --- Widgets --- */
.converter-widget,
.metal-widget {
  background: var(--widget-bg);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 3rem;
  margin: 2.5rem 0 4rem;
  box-shadow: var(--shadow);
}

.price-banner {
  font-size: 2.25rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.last-updated {
  text-align: center;
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.change {
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 0;
}

.change.positive {
  color: var(--positive);
  background: #dcfce7;
}

.change.negative {
  color: var(--negative);
  background: #fee2e2;
}

/* Inputs */
.converter-inputs {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.input-group {
  flex: 1;
}

.input-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
  color: var(--text);
}

.input-label-icon {
  font-size: 1.25rem;
}

.input-group input {
  width: 100%;
  padding: 1.25rem 1.75rem;
  font-size: 1.85rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
  background: var(--widget-bg);
}

.swap-icon {
  font-size: 2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding-top: 2.25rem;
  user-select: none;
  transition: transform 0.2s ease, color 0.2s ease;
}

.swap-icon:hover {
  color: var(--primary);
  transform: scale(1.1);
}

.swap-icon:focus-visible {
  outline: 4px solid var(--primary);
  outline-offset: 6px;
  border-radius: 0;
}

@media (max-width: 768px) {
  .converter-inputs {
    flex-direction: column;
    gap: 1rem;
  }

  .converter-widget,
  .metal-widget {
    padding: 1.5rem;
  }

  .swap-icon {
    padding-top: 0;
    transform: rotate(90deg);
  }

  .swap-icon:hover {
    transform: rotate(90deg) scale(1.1);
  }

  h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.75rem;
  }
}

/* --- Table --- */
.conversion-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 1.15rem;
}

.conversion-table th {
  text-align: left;
  padding: 1.25rem 1.5rem;
  background: var(--dark-bg);
  color: #fff;
  font-weight: 600;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 0;
}

.conversion-table td {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.conversion-table tr:nth-child(even) {
  background: var(--bg-alt);
}

.conversion-table tr:last-child td {
  border-bottom: none;
}

.conversion-table tr:hover td {
  background: #f1f5f9;
}

/* --- Links (Buttons) --- */
.popular-links,
.cross-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0 3rem;
}

.popular-links a,
.cross-links a,
.converter-page>a {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  background: var(--bg-alt);
  border: 2px solid var(--border);
  border-radius: 0;
  color: var(--primary);
  font-size: 1.15rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.converter-page>a {
  margin-bottom: 1rem;
  margin-right: 0.75rem;
}

.popular-links a:hover,
.cross-links a:hover,
.converter-page>a:hover {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary-hover);
}

.popular-links a:focus-visible,
.cross-links a:focus-visible,
.converter-page>a:focus-visible {
  outline: 4px solid var(--primary);
  outline-offset: 4px;
}

/* --- Header Nav --- */
.site-nav {
  padding: 1.5rem 0;
  border-bottom: 1px solid #1e293b;
  background: var(--dark-bg);
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: #fff;
  text-decoration: none !important;
}

.site-logo img {
  object-fit: contain;
}

.site-logo span {
  color: #fff;
  margin-left: 0.75rem;
  letter-spacing: -0.03em;
}

.site-logo:hover,
.site-logo:focus-visible {
  color: #fff;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: #cbd5e1;
  /* Slate 300 */
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 600;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: #fff;
  text-decoration: none;
}

/* --- Footer --- */
.site-footer {
  margin-top: 6rem;
  padding-top: 5rem;
  padding-bottom: 3rem;
  background: var(--dark-bg);
  color: #f1f5f9;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 4rem;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

.footer-brand .site-logo {
  margin-bottom: 1.25rem;
  display: inline-flex;
  align-items: center;
}

.footer-desc {
  color: #94a3b8;
  line-height: 1.6;
  font-size: 1.05rem;
  max-width: 320px;
  margin: 0;
}

.footer-links-group {
  display: flex;
  flex-direction: column;
}

.footer-heading {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-links a {
  color: #cbd5e1;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.05rem;
  transition: color 0.15s ease-in-out;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: #fff;
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

.footer-bottom p {
  margin: 0;
}

.copyright {
  color: #64748b;
  font-size: 0.95rem;
}

.disclaimer {
  font-size: 0.85rem !important;
  line-height: 1.6;
  color: #64748b !important;
  max-width: 800px;
  text-align: center;
}

/* --- Metals specific --- */
.unit-prices {
  margin: 2rem 0;
}

.unit-row {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 1.25rem;
}

.unit-row:last-child {
  border-bottom: none;
}

.calc-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.calc-row input {
  width: 160px;
  padding: 1rem 1.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 0;
  box-sizing: border-box;
}

.calc-row input:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
  outline: none;
}

.calc-unit {
  font-weight: 600;
  color: var(--text-muted);
}

.calc-equals {
  font-size: 1.75rem;
  color: var(--text-muted);
}

.calc-result {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--positive);
}

/* =========================================================================
   MONETIZATION AD STYLES
   ========================================================================= */

/* Single CTA Ad */
.converter-page a.nooxli-ad {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-radius: 0px;
  text-decoration: none;
  margin: 1.5rem 0 3rem 0;
  transition: transform 0.1s, box-shadow 0.15s;
}

.converter-page a.nooxli-ad:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.converter-page a.nooxli-ad--primary {
  background: var(--bg-alt);
  color: var(--primary);
  border: 1px solid var(--border);
}

.converter-page a.nooxli-ad--primary:hover {
  background: #eff6ff;
  color: var(--primary-hover);
  border: 1px solid var(--primary);
}

.nooxli-ad__content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nooxli-ad__headline {
  font-size: 1rem;
  font-weight: 700;
  color: inherit;
}

.nooxli-ad__subtext {
  font-size: 0.85rem;
  opacity: 0.9;
  color: inherit;
}

.nooxli-ad__cta {
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 0px;
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
}

/* Comparison Grid */
.nooxli-compare {
  margin: 1.5rem 0 3rem 0;
  border: 1px solid var(--border);
  border-radius: 0px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.nooxli-compare__title {
  padding: 0.75rem 1rem;
  background: var(--nav-bg);
  color: var(--white);
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
}

.nooxli-compare__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  background: var(--bg);
}

.nooxli-compare-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  border-right: 1px solid var(--border);
  transition: background 0.15s;
}

.nooxli-compare-card:last-child {
  border-right: none;
}

.nooxli-compare-card:hover {
  background: var(--bg-hover);
}

.compare-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.compare-cta {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue);
  margin-top: auto;
}

/* Mobile stacking */
@media (max-width: 500px) {
  .nooxli-ad {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }

  .nooxli-compare__grid {
    grid-template-columns: 1fr;
  }

  .nooxli-compare-card {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .nooxli-compare-card:last-child {
    border-bottom: none;
  }
}