/* MGA product catalogue (category + product pages, homepage categories).
   Uses the site's theme variables from the Next.js build: --accent, --page-bg, --border, ... */

.mgc-root { background: #fff; color: var(--primary-text, #15191c); width: 100%; }
.mgc-wrap { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .mgc-wrap { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .mgc-wrap { padding: 0 2rem; } }
@media (min-width: 1280px) { .mgc-wrap { max-width: 1400px; } }

/* ---------- hero band */
.mgc-hero { background: var(--page-bg-alt, #101f36); border-bottom: 1px solid rgba(255, 255, 255, .1); color: #fff; padding: 2rem 0 2.25rem; }
@media (min-width: 1024px) { .mgc-hero { padding: 3rem 0; } }
.mgc-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-size: .8125rem; color: #cbd5e1; margin-bottom: .9rem; }
.mgc-crumbs a { color: #cbd5e1; text-decoration: none; }
.mgc-crumbs a:hover, .mgc-crumbs a:focus-visible { color: var(--accent, #0088d1); }
.mgc-crumbs [aria-current] { color: #fff; font-weight: 700; }
.mgc-crumb-sep { color: #64748b; }
.mgc-eyebrow { display: flex; align-items: center; gap: .75rem; margin: 0 0 .6rem; font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent, #0088d1); }
.mgc-eyebrow::before { content: ""; width: 1.5rem; height: 2px; background: var(--accent, #0088d1); }
.mgc-hero .mgc-eyebrow { color: #7cc8f0; }
.mgc-h1 { margin: 0; font-size: 1.65rem; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; color: #fff; }
@media (min-width: 640px) { .mgc-h1 { font-size: 2.25rem; } }
.mgc-lead { margin: .75rem 0 0; max-width: 46rem; color: #cbd5e1; font-size: .95rem; line-height: 1.6; }
@media (min-width: 640px) { .mgc-lead { font-size: 1.05rem; } }

/* ---------- headings / text */
.mgc-h2 { margin: 0 0 1.1rem; font-size: 1.3rem; line-height: 1.25; font-weight: 800; color: var(--primary-text, #15191c); letter-spacing: -.01em; }
@media (min-width: 640px) { .mgc-h2 { font-size: 1.55rem; } }
.mgc-h2-light { color: #fff; }
.mgc-p { margin: 0 0 1rem; line-height: 1.75; color: #334155; font-size: .975rem; }
.mgc-p:last-child { margin-bottom: 0; }
.mgc-body { padding-top: .5rem; padding-bottom: 3rem; }
.mgc-sec { padding: 2rem 0; border-bottom: 1px solid var(--border, #e5e9ec); }
.mgc-sec:last-child { border-bottom: 0; }
.mgc-empty { text-align: left; }

/* ---------- buttons */
.mgc-ctas { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.25rem; }
.mgc-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.9rem; padding: .7rem 1.25rem; border-radius: .375rem; font-size: .9rem; font-weight: 700; text-decoration: none; border: 1px solid transparent; transition: background-color .2s, border-color .2s, color .2s; }
.mgc-btn:focus-visible { outline: 3px solid #7cc8f0; outline-offset: 2px; }
.mgc-btn-primary { background: var(--accent, #0088d1); color: #fff; }
.mgc-btn-primary:hover { background: var(--accent-dark, #075b82); }
.mgc-btn-wa { background: #25d366; color: #fff; }
.mgc-btn-wa:hover { background: #1fb457; }
.mgc-btn-ghost { background: #fff; color: var(--primary-text, #15191c); border-color: #cbd5e1; }
.mgc-btn-ghost:hover { border-color: var(--accent, #0088d1); color: var(--accent, #0088d1); }
@media (max-width: 479px) { .mgc-ctas .mgc-btn { flex: 1 1 100%; } }

/* ---------- cards */
.mgc-grid-cards { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 640px) { .mgc-grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .mgc-grid-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.75rem; } }
.mgc-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid #e2e8f0; border-radius: .85rem; background: #fff; color: inherit; text-decoration: none; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); transition: transform .25s, box-shadow .25s, border-color .25s; }
.mgc-card:hover { transform: translateY(-3px); border-color: rgba(0, 136, 209, .45); box-shadow: 0 14px 30px rgba(15, 23, 42, .12); }
.mgc-card:focus-visible { outline: 3px solid var(--accent, #0088d1); outline-offset: 3px; }
.mgc-card-media { position: relative; aspect-ratio: 4 / 3; background: #f1f5f9; border-bottom: 1px solid #eef2f6; overflow: hidden; }
.mgc-card-media > img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.mgc-card:hover .mgc-card-media > img { transform: scale(1.03); }
.mgc-card-body { display: flex; flex: 1; flex-direction: column; padding: 1.15rem 1.2rem 1.25rem; }
.mgc-card-title { margin: 0 0 .45rem; font-size: 1.05rem; line-height: 1.3; font-weight: 800; color: var(--primary-text, #15191c); transition: color .2s; }
.mgc-card:hover .mgc-card-title { color: var(--accent, #0088d1); }
.mgc-card-text { margin: 0 0 1rem; font-size: .875rem; line-height: 1.6; color: var(--secondary-text, #667078); }
.mgc-card-list { margin: -.25rem 0 1rem; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; }
.mgc-card-list li { font-size: .72rem; font-weight: 600; color: #334155; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 999px; padding: .2rem .6rem; }
.mgc-card-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem; }
.mgc-card-spec { display: flex; flex-direction: column; min-width: 0; font-size: .9rem; font-weight: 800; color: var(--primary-text, #15191c); }
.mgc-card-spec small { font-size: .65rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--secondary-text, #667078); }
.mgc-card-go { flex-shrink: 0; display: inline-flex; align-items: center; gap: .35rem; background: var(--accent, #0088d1); color: #fff; font-size: .8rem; font-weight: 700; padding: .55rem .9rem; border-radius: .375rem; transition: background-color .2s; }
.mgc-card:hover .mgc-card-go { background: var(--accent-dark, #075b82); }
.mgc-chip { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #334155; background: #fff; border: 1px solid #e2e8f0; border-radius: 999px; padding: .3rem .75rem; }
.mgc-card-media .mgc-chip { position: absolute; top: .75rem; left: .75rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.mgc-chip-link { text-decoration: none; color: var(--accent-dark, #075b82); background: var(--accent-light, #eaf6fc); border-color: #bfe3f6; }
.mgc-chip-link:hover { border-color: var(--accent, #0088d1); }

.mgc-noimg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; width: 100%; height: 100%; min-height: 12rem; background: linear-gradient(135deg, #f1f5f9, #e2e8f0); color: #64748b; font-size: .8rem; font-weight: 600; }
.mgc-noimg img { width: 9rem; height: auto; opacity: .55; filter: grayscale(.3); }

/* ---------- product detail top */
.mgc-detail { display: grid; grid-template-columns: 1fr; gap: 1.75rem; padding-top: 1.75rem; padding-bottom: 1rem; }
@media (min-width: 1024px) { .mgc-detail { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 3rem; padding-top: 2.5rem; } }
.mgc-gallery { min-width: 0; }
.mgc-gallery > .mgc-noimg { aspect-ratio: 4 / 3; border-radius: .85rem; border: 1px solid #e2e8f0; }
.mgc-gallery-main { display: block; width: 100%; padding: 0; border: 1px solid #e2e8f0; border-radius: .85rem; background: #f1f5f9; overflow: hidden; cursor: zoom-in; aspect-ratio: 3 / 2; }
.mgc-gallery-main img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mgc-gallery-main:focus-visible { outline: 3px solid var(--accent, #0088d1); outline-offset: 3px; }
.mgc-thumbs { display: flex; gap: .6rem; margin-top: .75rem; overflow-x: auto; padding-bottom: .25rem; }
.mgc-thumb { flex: 0 0 auto; width: 5.25rem; aspect-ratio: 3 / 2; padding: 0; border: 2px solid transparent; border-radius: .5rem; overflow: hidden; background: #f1f5f9; cursor: pointer; opacity: .75; transition: opacity .2s, border-color .2s; }
.mgc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mgc-thumb:hover, .mgc-thumb.is-active { opacity: 1; border-color: var(--accent, #0088d1); }
.mgc-thumb:focus-visible { outline: 3px solid var(--accent, #0088d1); outline-offset: 2px; }
@media (min-width: 640px) { .mgc-thumb { width: 6.5rem; } }
.mgc-summary { min-width: 0; }
.mgc-summary-text { margin: 1rem 0 1.25rem; font-size: 1.02rem; line-height: 1.7; color: #334155; }
.mgc-kspecs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.mgc-kspec { border: 1px solid #e2e8f0; border-radius: .6rem; background: var(--off-white, #f7f9fa); padding: .75rem .85rem; }
.mgc-kspec small { display: block; font-size: .65rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--secondary-text, #667078); margin-bottom: .2rem; }
.mgc-kspec strong { display: block; font-size: .95rem; line-height: 1.35; color: var(--primary-text, #15191c); }

/* ---------- content blocks */
.mgc-features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: .85rem; }
@media (min-width: 768px) { .mgc-features { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mgc-features > li { border: 1px solid #e2e8f0; border-left: 3px solid var(--accent, #0088d1); border-radius: .5rem; padding: .9rem 1rem; background: #fff; }
.mgc-features strong { display: block; font-size: .95rem; color: var(--primary-text, #15191c); margin-bottom: .25rem; }
.mgc-features span { display: block; font-size: .9rem; line-height: 1.65; color: #475569; }
.mgc-sublist { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .5rem; }
.mgc-sublist li { background: var(--off-white, #f7f9fa); border-radius: .375rem; padding: .5rem .7rem; }
.mgc-sublist strong { font-size: .85rem; margin: 0; }
.mgc-sublist span { font-size: .85rem; }
.mgc-table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: .6rem; }
.mgc-specs, .mgc-grid { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mgc-specs th, .mgc-specs td, .mgc-grid th, .mgc-grid td { text-align: left; vertical-align: top; padding: .75rem 1rem; border-bottom: 1px solid #edf1f5; line-height: 1.55; }
.mgc-specs tr:last-child th, .mgc-specs tr:last-child td, .mgc-grid tr:last-child td { border-bottom: 0; }
.mgc-specs th { width: 38%; background: var(--off-white, #f7f9fa); font-weight: 700; color: var(--primary-text, #15191c); }
.mgc-specs td { color: #334155; }
.mgc-grid thead th { background: var(--page-bg-alt, #101f36); color: #fff; font-weight: 700; white-space: nowrap; }
.mgc-grid tbody tr:nth-child(even) td { background: var(--off-white, #f7f9fa); }
.mgc-grid td { color: #334155; min-width: 6rem; }
@media (max-width: 639px) {
  .mgc-specs th, .mgc-specs td { display: block; width: auto; }
  .mgc-specs th { border-bottom: 0; padding-bottom: .15rem; }
  .mgc-specs td { padding-top: .15rem; }
}
.mgc-checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: .55rem 1.5rem; }
@media (min-width: 768px) { .mgc-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mgc-checks li { position: relative; padding-left: 1.6rem; line-height: 1.6; color: #334155; font-size: .93rem; }
.mgc-checks li::before { content: ""; position: absolute; left: .1rem; top: .45rem; width: .8rem; height: .45rem; border-left: 2px solid var(--accent, #0088d1); border-bottom: 2px solid var(--accent, #0088d1); transform: rotate(-45deg); }
.mgc-steps { list-style: none; margin: 0; padding: 0; counter-reset: mgc-step; display: grid; gap: .75rem; }
.mgc-steps li { counter-increment: mgc-step; position: relative; padding: .85rem 1rem .85rem 3.4rem; border: 1px solid #e2e8f0; border-radius: .6rem; }
.mgc-steps li::before { content: counter(mgc-step); position: absolute; left: .9rem; top: .8rem; width: 1.75rem; height: 1.75rem; border-radius: 999px; background: var(--accent, #0088d1); color: #fff; font-size: .8rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.mgc-steps strong { display: block; font-size: .95rem; margin-bottom: .2rem; }
.mgc-steps span { display: block; font-size: .9rem; line-height: 1.6; color: #475569; }
.mgc-note { margin: 1rem 0 0; padding: .85rem 1rem; border-radius: .5rem; background: #fff7ed; border: 1px solid #fed7aa; color: #7c2d12; font-size: .9rem; line-height: 1.6; }
.mgc-pills { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.mgc-pills a { display: inline-flex; padding: .55rem 1rem; border-radius: 999px; border: 1px solid #cbd5e1; font-size: .85rem; font-weight: 600; color: #334155; text-decoration: none; transition: border-color .2s, color .2s; }
.mgc-pills a:hover, .mgc-pills a:focus-visible { border-color: var(--accent, #0088d1); color: var(--accent, #0088d1); }

.mgc-related { background: var(--off-white, #f7f9fa); border-top: 1px solid var(--border, #e5e9ec); padding: 2.5rem 0 3rem; }

/* ---------- CTA band */
.mgc-band { background: var(--page-bg, #0b1528); color: #cbd5e1; padding: 2.5rem 0; }
.mgc-band-inner { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 1024px) { .mgc-band-inner { flex-direction: row; align-items: center; justify-content: space-between; gap: 2rem; } }
.mgc-band p { margin: 0; line-height: 1.6; }
.mgc-band .mgc-h2 { margin-bottom: .4rem; }
.mgc-band .mgc-ctas { margin-top: 0; flex-shrink: 0; }
.mgc-band .mgc-btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.mgc-band .mgc-btn-ghost:hover { border-color: #fff; color: #fff; }

/* ---------- homepage categories section */
.mgc-home-cats { background: var(--secondary-bg, #f7f9fa); border-bottom: 1px solid var(--border, #e5e9ec); padding: 4rem 0; overflow: hidden; }
@media (min-width: 1024px) { .mgc-home-cats { padding: 6rem 0; } }
.mgc-home-cats .mgc-wrap { padding: 0 1.5rem; }
@media (min-width: 1024px) { .mgc-home-cats .mgc-wrap { padding: 0 2rem; } }
.mgc-home-head { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2.5rem; }
@media (min-width: 768px) { .mgc-home-head { flex-direction: row; align-items: flex-end; justify-content: space-between; } }
.mgc-home-title { margin: 0; font-size: 1.875rem; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; color: var(--primary-text, #15191c); }
@media (min-width: 768px) { .mgc-home-title { font-size: 3rem; } }
.mgc-home-lead { margin: 1rem 0 0; max-width: 36rem; color: var(--secondary-text, #667078); }
.mgc-home-all { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--primary-text, #15191c); text-decoration: none; white-space: nowrap; }
.mgc-home-all:hover, .mgc-home-all:focus-visible { color: var(--accent, #0088d1); }

/* ---------- lightbox */
.mgc-lightbox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(5, 10, 20, .92); padding: 3.5rem .75rem; }
.mgc-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: .5rem; background: #fff; }
.mgc-lightbox button { position: absolute; display: flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.mgc-lightbox button:hover, .mgc-lightbox button:focus-visible { background: var(--accent, #0088d1); outline: none; }
.mgc-lb-close { top: .75rem; right: .75rem; }
.mgc-lb-prev { left: .75rem; top: 50%; transform: translateY(-50%); }
.mgc-lb-next { right: .75rem; top: 50%; transform: translateY(-50%); }
.mgc-lb-count { position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); color: #cbd5e1; font-size: .85rem; }

/* ---------- homepage "About MGA Electronics" section (placed below the hero in index.html).
   Same layout values that styleCompanyIntro() in mga-enhancements.js used to set inline. */
[data-mga-company-intro] .grid { display: block; gap: 2.5rem; align-items: center; grid-template-columns: none; }
[data-mga-company-intro] .grid > :first-child { max-width: 42rem; }
[data-mga-company-intro] .grid > :nth-child(2) { width: 90%; max-width: 440px; margin-left: auto; margin-right: auto; padding: 1rem; }
[data-mga-company-intro] .grid > :nth-child(2) > :first-child { width: 100%; height: min(240px, 60vw); aspect-ratio: auto; overflow: hidden; }
[data-mga-company-intro] .grid > :nth-child(2) img { width: 100%; height: 100%; object-fit: contain; }
@media (min-width: 1024px) {
  [data-mga-company-intro] .grid { display: grid; gap: 4rem; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); }
  [data-mga-company-intro] .grid > :first-child { max-width: none; }
  [data-mga-company-intro] .grid > :nth-child(2) { width: 100%; padding: 1.75rem; }
  [data-mga-company-intro] .grid > :nth-child(2) > :first-child { height: 240px; }
}

@media (max-width: 1023px) {
  /* the 2.5rem gap above was meant to separate the stacked text and image card */
  [data-mga-company-intro] .grid > :nth-child(2) { margin-top: 2.5rem; }
}

/* ---------- justified long-form copy (site-wide). Single-line text is unaffected by justify;
   centred blocks, card summaries and truncated one-liners keep their alignment. */
main p:not(.text-center):not([class*="line-clamp"]):not(.truncate):not(.mgc-card-text),
[data-mga-company-intro] p,
footer p.leading-relaxed,
.mgc-features span,
.mgc-sublist span,
.mgc-steps span,
.mgc-note span {
  text-align: justify;
  text-justify: inter-word;
  -webkit-hyphens: auto;
  hyphens: auto;
  overflow-wrap: break-word;
}
main .text-center p:not(.text-left) { text-align: center; }
main .mgc-band p { text-align: left; }
/* Phone columns are too narrow for even word spacing (wide gaps between short words), so
   long-form copy falls back to normal left alignment below 480px. */
@media (max-width: 479px) {
  main p:not(.text-center):not([class*="line-clamp"]):not(.truncate):not(.mgc-card-text),
  [data-mga-company-intro] p,
  footer p.leading-relaxed,
  .mgc-features span,
  .mgc-sublist span,
  .mgc-steps span,
  .mgc-note span { text-align: left; }
  main .text-center p:not(.text-left) { text-align: center; }
}

.mgc-band-links { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .6rem !important; font-size: .875rem; }
.mgc-band-links a { color: #7cc8f0; font-weight: 600; text-decoration: none; }
.mgc-band-links a:hover, .mgc-band-links a:focus-visible { color: #fff; text-decoration: underline; }
.mgc-band-links span { color: #64748b; }
.mgc-band p + p { margin-top: .35rem; }

/* ---------- small phones: fit logo, language selector and menu button in the header row */
@media (max-width: 459px) {
  header > div:first-child { padding-left: 1rem; padding-right: 1rem; }
}

/* ---------- language switcher (mga-i18n.js) */
html.mga-i18n-pending body { opacity: 0; }
body { transition: opacity .15s ease; }

@media (prefers-reduced-motion: reduce) {
  .mgc-card, .mgc-card-media > img, .mgc-btn, .mgc-thumb { transition: none; }
  .mgc-card:hover { transform: none; }
}
