/* MatrixQR Design System — Modern Minimal Tech */
:root {
  color-scheme: light;
  --mq-page: #f6f8fa;
  --mq-surface: #ffffff;
  --mq-surface-soft: #eef2f5;
  --mq-ink: #1b2b40;
  --mq-muted: #627184;
  --mq-border: #dce3e9;
  --mq-accent: #287f78;
  --mq-accent-hover: #216c66;
  --mq-accent-soft: #e7f3f1;
  --mq-navy: #172b45;
  --mq-focus: rgba(40, 127, 120, .22);
}
html { color-scheme: light; background: var(--mq-page); }
body { background: var(--mq-page) !important; color: var(--mq-ink) !important; background-image: none !important; }
body > div.absolute { display: none !important; }
body > header { background: rgba(255,255,255,.96) !important; border-color: var(--mq-border) !important; box-shadow: 0 1px 3px rgba(23,43,69,.04); backdrop-filter: blur(14px); }
body > header a, body > header span { color: var(--mq-ink) !important; }
body > header a span span { color: var(--mq-accent) !important; }
body > header a:hover { color: var(--mq-accent) !important; }
body > header .bg-gradient-to-tr { background: var(--mq-navy) !important; box-shadow: none !important; }
body > header .bg-gradient-to-tr i { color: #fff !important; }
body > header .bg-gradient-to-r { background: none !important; }
body > header select { background: var(--mq-surface) !important; color: var(--mq-ink) !important; border-color: var(--mq-border) !important; }
body > header nav a[class*="bg-slate-800"] { background: var(--mq-accent) !important; color: #fff !important; border-color: var(--mq-accent) !important; }

/* Generator navigation and work surfaces */
[aria-label="QR Code Generator Navigation"] > div { background: #e9eef2 !important; border: 1px solid var(--mq-border) !important; border-radius: 14px !important; box-shadow: none !important; }
[aria-label="QR Code Generator Navigation"] button, [aria-label="QR Code Generator Navigation"] a { border-radius: 10px !important; box-shadow: none !important; }
[aria-label="QR Code Generator Navigation"] button.bg-slate-800 { background: var(--mq-surface) !important; color: var(--mq-accent) !important; border-color: var(--mq-border) !important; }
[aria-label="QR Code Generator Navigation"] button:not(.bg-slate-800) { color: var(--mq-muted) !important; }
[aria-label="QR Code Generator Navigation"] button:hover { background: var(--mq-surface) !important; color: var(--mq-accent) !important; }
[aria-label="QR Code Generator Navigation"] #nav-menu { color: #287f78 !important; background: #e7f3f1 !important; border-color: #c8e2dd !important; }
[aria-label="QR Code Generator Navigation"] button[onclick="openProModal()"] { color: #8b632b !important; background: #fbf4e8 !important; border-color: #ead9b8 !important; }
main > div:first-child, #preview-card { background: var(--mq-surface) !important; border: 1px solid var(--mq-border) !important; border-radius: 18px !important; box-shadow: 0 10px 30px rgba(23,43,69,.06) !important; backdrop-filter: none !important; }
main > div:first-child label, main > div:first-child .text-slate-300, main > div:first-child .text-slate-200, main > div:first-child .text-slate-400, #preview-card .text-slate-200, #preview-card .text-slate-300, #preview-card .text-slate-400 { color: var(--mq-muted) !important; }
main > div:first-child .text-cyan-400, #preview-card .text-cyan-400 { color: var(--mq-accent) !important; }
main > div:first-child input:not([type="checkbox"]):not([type="color"]):not([type="file"]), main > div:first-child select, main > div:first-child textarea { background: #fbfcfd !important; color: var(--mq-ink) !important; border-color: var(--mq-border) !important; border-radius: 10px !important; }
main > div:first-child input::placeholder { color: #96a2ae !important; }
main > div:first-child input:focus, main > div:first-child select:focus, main > div:first-child textarea:focus { border-color: var(--mq-accent) !important; box-shadow: 0 0 0 3px var(--mq-focus) !important; }
main > div:first-child [class*="border-slate-800"], main > div:first-child [class*="border-slate-700"], #preview-card [class*="border-slate-800"] { border-color: var(--mq-border) !important; }
main > div:first-child .bg-slate-950, main > div:first-child .bg-slate-900, main > div:first-child .bg-slate-800, main > div:first-child [class*="bg-[#0d1527"] { background: var(--mq-surface-soft) !important; }
main > div:first-child button:not([onclick="generateTechQR()"]):not(#logo-remove-btn) { background: #f1f4f6 !important; color: var(--mq-ink) !important; border-color: var(--mq-border) !important; box-shadow: none !important; }
main > div:first-child button:hover:not([onclick="generateTechQR()"]) { background: #e7edf0 !important; }
main > div:first-child button[onclick="generateTechQR()"] { background: var(--mq-accent) !important; color: #fff !important; border: 1px solid var(--mq-accent) !important; box-shadow: 0 5px 14px rgba(40,127,120,.18) !important; }
main > div:first-child button[onclick="generateTechQR()"]:hover { background: var(--mq-accent-hover) !important; }
#logo-preview-box { background: #f7f9fa !important; border-color: #cbd5dc !important; }
#logo-preview-box i { color: #82909e !important; }
#preview-card { color: var(--mq-ink) !important; }
#preview-card .text-emerald-400 { color: var(--mq-accent) !important; }
#preview-card .bg-emerald-400 { background: var(--mq-accent) !important; }
#preview-card > div:first-child { color: var(--mq-muted) !important; }
#preview-card > div:nth-of-type(2) { background: #f1f4f6 !important; border-color: var(--mq-border) !important; box-shadow: none !important; }
#preview-card #idle-state .matrix-bg { opacity: .035 !important; }
#preview-card #idle-state p { color: var(--mq-muted) !important; }
#preview-card #qr-result { background: #fff !important; }

/* About page */
body > section:not([aria-label="QR Code Generator Navigation"]) { background: #f0f4f6 !important; border-color: var(--mq-border) !important; }
body > section:not([aria-label="QR Code Generator Navigation"]) h1,
body > section:not([aria-label="QR Code Generator Navigation"]) h2,
body > section:not([aria-label="QR Code Generator Navigation"]) h3 { color: var(--mq-ink) !important; }
body > section:not([aria-label="QR Code Generator Navigation"]) p { color: var(--mq-muted) !important; }
body > section:not([aria-label="QR Code Generator Navigation"]) .bg-gradient-to-r { background: none !important; color: var(--mq-accent) !important; -webkit-text-fill-color: var(--mq-accent) !important; }
body > section:not([aria-label="QR Code Generator Navigation"]) .bg-cyan-500\/10 { background: var(--mq-accent-soft) !important; border-color: #c8e2dd !important; color: var(--mq-accent) !important; }
body > main h2, body > main h3 { color: var(--mq-ink) !important; }
body > main p, body > main li { color: var(--mq-muted) !important; }
body > main .text-cyan-400, body > main .text-indigo-400, body > main .text-emerald-400 { color: var(--mq-accent) !important; }
body > main [class*="bg-slate-900"], body > main [class*="bg-gradient-to-r"] { background: var(--mq-surface) !important; border-color: var(--mq-border) !important; }
body > main [class*="bg-cyan-500"], body > main [class*="bg-indigo-500"], body > main [class*="bg-emerald-500"] { background: var(--mq-accent-soft) !important; border-color: #c8e2dd !important; }
body > main a { color: var(--mq-accent) !important; }
body > main a:hover { color: var(--mq-accent-hover) !important; }
body > footer { background: #edf1f4 !important; border-color: var(--mq-border) !important; color: var(--mq-muted) !important; }
body > footer a { color: var(--mq-accent) !important; }
:focus-visible { outline: 3px solid var(--mq-focus); outline-offset: 2px; }
@media (max-width: 640px) {
  [aria-label="QR Code Generator Navigation"] > div { gap: 6px !important; }
  [aria-label="QR Code Generator Navigation"] button, [aria-label="QR Code Generator Navigation"] a { min-height: 44px; padding-inline: 8px !important; }
  main > div:first-child { padding: 18px !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* Contrast repair: legacy light-text utilities on newly light surfaces */
body :is(.text-white,.text-slate-100,.text-slate-200,.text-slate-300,.text-gray-100,.text-gray-200,.text-zinc-100,.text-zinc-200) {
  color: var(--mq-ink) !important;
}
body :is(.text-slate-400,.text-slate-500,.text-gray-400,.text-gray-500,.text-zinc-400,.text-zinc-500) {
  color: var(--mq-muted) !important;
}
/* Keep intentionally dark/code and primary-action surfaces legible */
body pre, body pre *, body code[class*="language-"], body code[class*="language-"] * {
  color: #eef3f7 !important;
}
body > header nav a[class*="bg-slate-800"],
body > header nav a[class*="bg-slate-800"] *,
main > div:first-child button[onclick="generateTechQR()"],
main > div:first-child button[onclick="generateTechQR()"] * {
  color: #ffffff !important;
}


/* Stronger overall typography: darker body copy and secondary labels */
:root {
  --mq-ink: #14263b;
  --mq-muted: #46576a;
  --mq-reading: #26394d;
}
body { color: #26394d !important; }
body :is(p,li,label,small,figcaption,summary) { color: #34475b; }
body :is(.text-slate-400,.text-slate-500,.text-gray-400,.text-gray-500,.text-zinc-400,.text-zinc-500) {
  color: #46576a !important;
}
body > header a, body > header span { color: #14263b !important; }
body > footer { color: #46576a !important; }
main > div:first-child label,
main > div:first-child .text-slate-300,
main > div:first-child .text-slate-200,
main > div:first-child .text-slate-400,
#preview-card .text-slate-200,
#preview-card .text-slate-300,
#preview-card .text-slate-400 { color: #46576a !important; }
body > main p, body > main li { color: #34475b !important; }


/* Final main-site contrast tuning: prioritize readable labels and supporting copy */
:root {
  --mq-ink: #10243a;
  --mq-muted: #33465a;
  --mq-reading: #25384d;
}
body,
body :is(p, li, label, small, figcaption, summary, dt, dd, span) {
  color: #25384d;
}
body :is(.text-slate-400,.text-slate-500,.text-gray-400,.text-gray-500,.text-zinc-400,.text-zinc-500) {
  color: #33465a !important;
}
body :is(.text-slate-300,.text-slate-200,.text-gray-300,.text-gray-200,.text-zinc-300,.text-zinc-200) {
  color: #25384d !important;
}
body > header a,
body > header span,
[aria-label="QR Code Generator Navigation"] button:not(.bg-slate-800) {
  color: #10243a !important;
}
main > div:first-child label,
main > div:first-child .text-slate-300,
main > div:first-child .text-slate-200,
main > div:first-child .text-slate-400,
main > div:first-child .text-cyan-400,
#preview-card .text-slate-200,
#preview-card .text-slate-300,
#preview-card .text-slate-400,
#preview-card #idle-state p {
  color: #33465a !important;
}
main > div:first-child input::placeholder,
main > div:first-child textarea::placeholder {
  color: #68798b !important;
  opacity: 1 !important;
}
main > div:first-child .text-xs,
#preview-card .text-xs {
  text-shadow: none;
}
body > main p,
body > main li,
body > section p,
body > section dd,
body > section summary {
  color: #25384d !important;
}
body > footer,
body > footer a {
  color: #33465a !important;
}
/* Keep white text only on intentionally dark/brand action surfaces */
body > header nav a[class*="bg-slate-800"],
body > header nav a[class*="bg-slate-800"] *,
main > div:first-child button[onclick="generateTechQR()"],
main > div:first-child button[onclick="generateTechQR()"] *,
body pre,
body pre *,
body code[class*="language-"],
body code[class*="language-"] * {
  color: #ffffff !important;
}


/* Accessibility audit follow-up: homepage lower content and export controls */
#preview-card #export-format {
  background: #ffffff !important;
  color: #10243a !important;
  border-color: #cbd5df !important;
}
#preview-card #export-format option {
  background: #ffffff;
  color: #10243a;
}
#preview-card #download-btn {
  background: #287f78 !important;
  color: #ffffff !important;
  border: 1px solid #287f78 !important;
}
#preview-card #download-btn:hover {
  background: #216c66 !important;
  border-color: #216c66 !important;
}
#preview-card #download-btn *,
#preview-card #download-btn [data-i18n] {
  color: #ffffff !important;
}

/* The explanatory / GEO section is a body-level section, not inside main.
   Convert its legacy dark cards to light surfaces and keep all copy readable. */
body > section:not([aria-label="QR Code Generator Navigation"]) {
  color: #25384d !important;
}
body > section:not([aria-label="QR Code Generator Navigation"]) :is(
  [class*="bg-slate-950"],
  [class*="bg-slate-900"],
  [class*="bg-slate-800"]
) {
  background: #ffffff !important;
  border-color: #dce3e9 !important;
  box-shadow: 0 6px 20px rgba(23,43,69,.045) !important;
}
body > section:not([aria-label="QR Code Generator Navigation"]) :is(
  .text-slate-100,.text-slate-200,.text-slate-300,.text-slate-400,
  .text-cyan-400,.text-emerald-400,.text-amber-400
) {
  color: #25384d !important;
}
body > section:not([aria-label="QR Code Generator Navigation"]) :is(dt, h2, h3, summary) {
  color: #10243a !important;
}
body > section:not([aria-label="QR Code Generator Navigation"]) dt {
  font-weight: 700;
}
body > section:not([aria-label="QR Code Generator Navigation"]) a {
  color: #216c66 !important;
}
body > section:not([aria-label="QR Code Generator Navigation"]) details,
body > section:not([aria-label="QR Code Generator Navigation"]) details[open] {
  background: #ffffff !important;
  border-color: #dce3e9 !important;
}
body > section:not([aria-label="QR Code Generator Navigation"]) details p,
body > section:not([aria-label="QR Code Generator Navigation"]) dd {
  color: #33465a !important;
}
body > section:not([aria-label="QR Code Generator Navigation"]) .bg-emerald-500\/10,
body > section:not([aria-label="QR Code Generator Navigation"]) .bg-cyan-500\/10 {
  background: #e7f3f1 !important;
  border-color: #c8e2dd !important;
}


/* Contrast-safe semantic colors on light comparison tables and footer badges */
body > section:not([aria-label="QR Code Generator Navigation"]) .text-rose-400 {
  color: #a12d3b !important;
}
body > section:not([aria-label="QR Code Generator Navigation"]) :is(.text-indigo-400,.text-cyan-400,.text-emerald-400,.text-amber-400) {
  color: #216c66 !important;
}
body > footer :is(.text-cyan-400,.text-emerald-400,.text-amber-400) {
  color: #216c66 !important;
}
body > footer [class*="bg-emerald-500"] {
  background: #e7f3f1 !important;
  border-color: #c8e2dd !important;
}
body > footer [class*="bg-cyan-500"] {
  background: #e7f3f1 !important;
  border-color: #c8e2dd !important;
}


/* Preserve the dark QR preview surface while restoring high-contrast controls and copy */
#preview-card {
  background: #0d1527 !important;
  color: #e2e8f0 !important;
}
#preview-card :is(p, span, label, small, dt, dd, figcaption) {
  color: #cbd5e1;
}
#preview-card :is(h1,h2,h3,h4,strong,b) {
  color: #f8fafc;
}
#preview-card #export-format {
  background: #070c18 !important;
  color: #e2e8f0 !important;
  border-color: #64748b !important;
}
#preview-card #export-format option {
  background: #070c18 !important;
  color: #e2e8f0 !important;
}
#preview-card #download-btn {
  background: #287f78 !important;
  color: #ffffff !important;
}
#preview-card #download-btn * {
  color: #ffffff !important;
}

/* Footer is a light-theme surface; avoid dark text on its legacy dark background */
body > footer {
  background: #ffffff !important;
  border-color: #dce3e9 !important;
  color: #33465a !important;
}
body > footer :is(p,span,a,small,strong) {
  color: #33465a;
}
body > footer a {
  color: #216c66 !important;
}


/* Header brand mark: Lucide replaces the source <i> with an <svg>.
   Target the rendered SVG so the QR strokes stay white against the navy tile. */
body > header .bg-gradient-to-tr {
  background: #172b45 !important;
  background-image: none !important;
  border: 1px solid #29435f !important;
}
body > header .bg-gradient-to-tr svg {
  color: #ffd166 !important;
  stroke: #ffd166 !important;
  stroke-width: 2.5 !important;
  opacity: 1 !important;
}
