:root {
  --navy: #1b2559; --navy-2: #121a42; --red: #c4161c; --ink: #141b3d; --muted: #5d6789; --line: #dfe4ee; --line-2: #c9d1e2;
  --bg: #f5f7fb; --card: #fff; --radius: 6px; --shadow: 0 8px 24px rgba(20, 27, 61, .08);
  --mono: "IBM Plex Mono", "IBM Plex Sans Arabic", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.locked { overflow: hidden; }
body { margin: 0; font-family: "IBM Plex Sans Arabic", system-ui, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.6; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
bdi[dir="ltr"] { font-family: var(--mono); }
.wrap { width: min(1240px, 100% - 32px); margin-inline: auto; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 3px solid var(--red); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 68px; }
.brand { display: flex; align-items: center; gap: var(--space-3); font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.brand img { width: 44px; height: 44px; object-fit: contain; }
.top-nav { display: flex; align-items: center; gap: var(--space-1); }
.top-nav a { padding: var(--space-2) var(--space-3); border-radius: var(--radius); font-weight: 600; color: var(--muted); transition: color .2s, background .2s; }
.top-nav a:hover { background: var(--bg); color: var(--ink); }
.request-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--radius); background: var(--navy); color: #fff; cursor: pointer; }
.request-btn svg { width: 22px; height: 22px; }
.request-btn span { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--red); color: #fff; font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.request-btn span[hidden] { display: none; }

/* Hero */
.hero { position: relative; overflow: hidden; padding: 64px 0 72px; background: var(--navy); color: #fff; }
.hero::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px); background-size: 32px 32px; }
.hero::after { content: ""; position: absolute; inset-inline-start: 0; bottom: 0; width: 120px; height: 4px; background: var(--red); }
.hero .wrap { position: relative; }
.hero h1 { margin: 0 0 var(--space-3); font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.2; letter-spacing: -.01em; }
.hero p { margin: 0 0 var(--space-5); max-width: 640px; color: rgba(255, 255, 255, .82); font-size: 1.08rem; white-space: pre-line; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 46px; padding: 0 var(--space-5); border: 0; border-radius: var(--radius); font: inherit; font-weight: 700; cursor: pointer; background: var(--navy); color: #fff; transition: background .2s, box-shadow .2s; }
.btn:hover { box-shadow: var(--shadow); }
.btn.light { background: #fff; color: var(--navy); }
.btn.outline { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); }
.btn.outline:hover { background: var(--navy); color: #fff; }
.btn.wa { background: #1f8f4c; color: #fff; }
.btn.wa:hover { background: #1a7a41; }

/* Sections */
.section { padding: var(--space-6) 0; }
.section h2 { margin: 0 0 var(--space-4); font-size: 1.35rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); padding-inline-start: var(--space-3); border-inline-start: 4px solid var(--red); }
.section-head h2 { margin: 0; }
.section-head a { color: var(--red); font-weight: 700; }

/* Tiles and compact cards */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--space-3); }
.tile, .card { display: flex; flex-direction: column; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .2s, box-shadow .2s; }
.tile:hover, .card:hover { border-color: var(--navy); box-shadow: var(--shadow); }
.tile .media { aspect-ratio: 4 / 3; background: #fff; border-bottom: 1px solid var(--line); }
.tile .media img { width: 100%; height: 100%; object-fit: contain; padding: var(--space-3); }
.tile strong { padding: var(--space-3) var(--space-3) 0; }
.tile small { padding: 0 var(--space-3) var(--space-3); color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); }
.card[hidden], .sheet-card[hidden] { display: none; }
.card-media { display: block; aspect-ratio: 1; background: #fff; border-bottom: 1px solid var(--line); }
.card-media img { width: 100%; height: 100%; object-fit: contain; padding: var(--space-3); }
.noimg { display: grid; place-items: center; width: 100%; height: 100%; min-height: 160px; }
.noimg img { width: 40%; height: auto; opacity: .2; object-fit: contain; }
.card-body { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3) var(--space-4) var(--space-4); }
.card-body strong { font-size: .98rem; line-height: 1.45; }
.card-body small { color: var(--muted); }
.badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.in { background: #e6f4ea; color: #146c35; }
.badge.out { background: #fdecea; color: #a11218; }

/* Technical sheet cards */
.sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.sheet-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; transition: box-shadow .2s, border-color .2s; }
.sheet-card:hover { border-color: var(--navy); box-shadow: var(--shadow); }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-4); background: var(--navy); color: #fff; font-size: .85rem; font-weight: 600; }
.sheet-bar span:last-child { color: rgba(255, 255, 255, .75); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.sheet-code bdi { font-weight: 600; letter-spacing: .02em; }
.sheet-body { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); flex: 1; }
.sheet-media { display: grid; place-items: center; padding: var(--space-4); background: #fff; border-inline-end: 1px solid var(--line); }
.sheet-media img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.sheet-info { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); min-width: 0; }
.sheet-info h3 { margin: 0; font-size: 1rem; line-height: 1.45; }
.sheet-info h3 a:hover { color: var(--red); }
.spec-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px var(--space-3); margin: 0; font-size: .86rem; }
.spec-list dt { color: var(--muted); font-weight: 700; text-transform: uppercase; }
.spec-list dd { margin: 0; display: flex; flex-direction: column; font-weight: 500; overflow-wrap: anywhere; }
.spec-list dd span, .spec-table td span { font-family: var(--mono); }
.spec-note { margin: 0; padding: 4px 8px; border-inline-start: 3px solid var(--red); background: #fdf3f3; font-size: .78rem; font-weight: 600; text-transform: uppercase; }
.spec-note span { font-family: var(--mono); }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: auto; padding-top: var(--space-2); border-top: 1px dashed var(--line); }
.sheet-foot .badge { margin: 0; }
.sheet-link { margin-inline-start: auto; color: var(--red); font-weight: 700; font-size: .88rem; }
.sheet-link:hover { text-decoration: underline; }

/* Page heads and filters */
.page-head { padding: var(--space-6) 0 0; }
.page-title { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3); padding-inline-start: var(--space-3); border-inline-start: 4px solid var(--red); }
.page-head h1 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.25; }
.page-head p { margin: var(--space-1) 0 0; color: var(--muted); }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-3); color: var(--muted); font-size: .88rem; }
.crumbs a:hover { color: var(--ink); }
.page-crumbs { padding-top: var(--space-5); }
.filters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-5) 0 0; padding: var(--space-3); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.filters input, .filters select { flex: 1 1 200px; min-height: 46px; padding: 0 var(--space-3); border: 1px solid var(--line-2); border-radius: var(--radius); font: inherit; background: #fff; color: var(--ink); }
.filters input { flex-basis: 320px; }
.empty-note { padding: var(--space-7) 0; text-align: center; color: var(--muted); }
.print-head, .print-foot { display: none; }

/* Product datasheet */
.product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-6); padding: var(--space-4) 0 var(--space-6); }
.gallery { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border: 1px solid var(--line-2); border-radius: var(--radius); background: #fff; scrollbar-width: none; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track button, .gallery-track .noimg { flex: 0 0 100%; aspect-ratio: 1; padding: var(--space-5); border: 0; background: #fff; scroll-snap-align: center; cursor: zoom-in; }
.gallery-track img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: var(--space-2); overflow-x: auto; }
.thumbs button { flex: 0 0 72px; height: 72px; padding: 4px; overflow: hidden; border: 1px solid var(--line-2); border-radius: var(--radius); background: #fff; cursor: pointer; }
.thumbs button.on { border: 2px solid var(--red); }
.thumbs img { width: 100%; height: 100%; object-fit: contain; }
.info { min-width: 0; }
.info .sheet-bar { border-radius: var(--radius) var(--radius) 0 0; }
.info h1 { margin: var(--space-4) 0 var(--space-2); font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.3; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); }
.chips a { padding: 4px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; font-size: .85rem; font-weight: 600; }
.chips a:hover { border-color: var(--navy); }
.chips .badge { margin: 0; }
.spec-table { width: 100%; margin: 0 0 var(--space-5); border-collapse: collapse; background: #fff; border: 1px solid var(--line-2); font-size: .92rem; }
.spec-table caption { padding: var(--space-2) var(--space-3); text-align: start; background: #eef1f7; border: 1px solid var(--line-2); border-bottom: 0; font-weight: 700; }
.spec-table th, .spec-table td { padding: var(--space-2) var(--space-3); border-top: 1px solid var(--line); vertical-align: top; text-align: start; }
.spec-table th { width: 32%; color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: .82rem; }
.spec-table td { font-weight: 500; }
.spec-table td span { display: block; }
.spec-table td.spec-note { border-inline-start: 3px solid var(--red); background: #fdf3f3; }
.desc { color: #2e3a63; }
.desc p { margin: 0 0 var(--space-3); }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-5); }
.actions .btn { flex: 1 1 200px; }

/* Footer */
.contact { margin-top: var(--space-6); background: #fff; border-top: 3px solid var(--navy); }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); }
.contact-grid a, .contact-grid div { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius); }
.contact-grid a:hover { border-color: var(--navy); }
.contact-grid small { color: var(--muted); }
.foot { padding: var(--space-5) 0; color: var(--muted); font-size: .85rem; text-align: center; border-top: 1px solid var(--line); }

/* Request list */
.request { position: fixed; inset: 0; z-index: 40; display: flex; justify-content: flex-end; background: rgba(18, 26, 66, .5); }
.request[hidden] { display: none; }
.request-card { display: flex; flex-direction: column; gap: var(--space-3); width: min(420px, 100%); height: 100%; padding: var(--space-5); background: #fff; box-shadow: var(--shadow); }
.request-card header { display: flex; align-items: center; justify-content: space-between; padding-bottom: var(--space-3); border-bottom: 3px solid var(--red); }
.request-card h2 { margin: 0; font-size: 1.2rem; }
.request-card header button { width: 40px; height: 40px; border: 0; border-radius: var(--radius); background: var(--bg); font-size: 1.4rem; cursor: pointer; }
.request ul { display: flex; flex: 1; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; overflow: auto; list-style: none; }
.request li { display: grid; grid-template-columns: 1fr 72px 36px; gap: var(--space-2); align-items: center; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); }
.request li span { display: flex; flex-direction: column; }
.request li small { color: var(--muted); }
.request li input { min-height: 40px; border: 1px solid var(--line-2); border-radius: var(--radius); text-align: center; font: inherit; }
.request li button { height: 36px; border: 0; border-radius: var(--radius); background: #fdecea; color: #a11218; font-size: 1.1rem; cursor: pointer; }
.request li.empty { display: block; color: var(--muted); text-align: center; border-style: dashed; }
.request .btn[hidden] { display: none; }
#zoom { max-width: min(96vw, 1400px); max-height: 94vh; padding: 0; border: 0; background: transparent; }
#zoom::backdrop { background: rgba(18, 26, 66, .88); }
#zoom img { width: auto; max-height: 94vh; margin: auto; border-radius: var(--radius); background: #fff; }

@media (max-width: 960px) {
  .sheet-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .product { grid-template-columns: 1fr; gap: var(--space-5); }
  .top-row { min-height: 60px; }
  .brand span { display: none; }
  .hero { padding: 44px 0 52px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .card-body { padding: var(--space-3); }
  .card-body strong { font-size: .9rem; }
}
@media (max-width: 520px) {
  .sheet-body { grid-template-columns: 1fr; }
  .sheet-media { border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .sheet-media img { max-width: 240px; }
  .print-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Print: A4 catalog sheets */
@page { size: A4; margin: 12mm; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; font-size: 10.5pt; }
  .top, .filters, .crumbs, .print-btn, .request, #zoom, .contact, .sheet-link, .empty-note, .hero-actions, .actions { display: none !important; }
  .wrap { width: 100%; }
  .print-head { display: flex; align-items: center; gap: 12px; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 3px solid var(--red); }
  .print-head img { width: 48px; height: 48px; object-fit: contain; }
  .print-head div { display: flex; flex-direction: column; }
  .print-head strong { font-size: 14pt; color: var(--navy); }
  .print-head span { font-size: 11pt; font-weight: 700; color: #fff; background: var(--navy); padding: 2px 10px; margin-top: 4px; align-self: flex-start; }
  .page-head { padding: 0 0 6px; }
  .page-title { border: 0; padding: 0; }
  .page-head h1 { display: none; }
  .section { padding: 0; }
  .sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sheet-card { break-inside: avoid; page-break-inside: avoid; box-shadow: none; border-color: #9aa3bd; }
  .sheet-card[hidden] { display: flex !important; }
  .sheet-body { grid-template-columns: 42% 1fr; }
  .sheet-media { padding: 6px; }
  .sheet-media img { max-width: 52mm; }
  .sheet-info { padding: 8px; gap: 6px; }
  .spec-list { font-size: 8.5pt; }
  .print-foot { display: block; margin-top: 10px; padding-top: 6px; border-top: 2px solid var(--navy); font-size: 8.5pt; text-align: center; color: var(--ink); }
  a[href]::after { content: none; }
}
