/* ============================================================
   AlNajm AlWadih — style.css
   Monolithic / Swiss-typographic, light theme. No radius, no shadow, no blur.
   Layout uses CSS logical properties so <html dir="rtl"> flips
   the page without any RTL-specific overrides.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --c-bg:        #F4F4F4;   /* off-white page */
  --c-surface:   #E8E8E8;   /* slightly darker block colour */
  --c-accent:    #FF5A00;   /* industrial safety orange */
  --c-text-main: #0A0A0A;   /* pitch black type and rules */
  --c-text-dim:  #5C5C5C;
  --c-line:      #0A0A0A;
  --c-line-dim:  #CFCFCF;
  --c-ink-on-accent: #0A0A0A; /* text colour on orange surfaces */

  /* Dark variant (original brief):  --c-bg: #0A0A0A;  --c-surface: #141414;
     --c-text-main: #F4F4F4;  --c-text-dim: #9A9A9A;  --c-line: #F4F4F4;
     --c-line-dim: #2A2A2A;  --c-ink-on-accent: #0A0A0A;
     Logo-matched variant (emerald + gold): --c-accent: #1F6F55; keep the rest. */

  --f-en: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --f-ar: "IBM Plex Sans Arabic", "Noto Sans Arabic", Tahoma, sans-serif;

  --rule: 2px solid var(--c-line);
  --rule-dim: 2px solid var(--c-line-dim);

  --gutter: clamp(1rem, 3vw, 2.5rem);
  --block-y: clamp(3rem, 7vw, 6rem);
  --max: 1440px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
body {
  background: var(--c-bg);
  color: var(--c-text-main);
  font-family: var(--f-en);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.5;
  min-height: 100vh;
}
html[dir="rtl"] body { font-family: var(--f-ar); font-weight: 300; line-height: 1.7; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, html[dir="rtl"] summary,
html[dir="rtl"] .btn, html[dir="rtl"] th { font-weight: 800; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--c-accent); }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }

:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }

/* ---------- Type scale ---------- */
h1, h2, h3 { font-weight: 700; line-height: 1; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: clamp(2.75rem, 7.5vw, 7.5rem); }
h2 { font-size: clamp(2rem, 4.5vw, 4rem); }
h3 { font-size: clamp(1.375rem, 2.2vw, 1.875rem); letter-spacing: -0.01em; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3 { letter-spacing: 0; line-height: 1.2; }
p { max-width: 62ch; }
.lede { font-size: clamp(1.25rem, 2vw, 1.625rem); line-height: 1.35; max-width: 34ch; }
.dim { color: var(--c-text-dim); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Layout primitives ---------- */
.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.block { border-bottom: var(--rule); padding-block: var(--block-y); }
.block--tight { padding-block: clamp(1.5rem, 3vw, 2.5rem); }
.block--flush { padding-block: 0; }
.grid { display: grid; gap: var(--gutter); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-7-5 { grid-template-columns: 7fr 5fr; }
.grid-5-7 { grid-template-columns: 5fr 7fr; }
.grid-4-8 { grid-template-columns: 4fr 8fr; }
.stack > * + * { margin-block-start: 1rem; }
.stack-lg > * + * { margin-block-start: 2rem; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: var(--rule);
  position: sticky; top: 0; z-index: 20;
  background: var(--c-bg);
}
.site-header .wrap {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: stretch;
  padding-inline: 0;
}
.brand {
  display: flex; align-items: center; gap: 0.875rem;
  padding-inline: var(--gutter);
  border-inline-end: var(--rule);
  min-height: 4.5rem;
}
.brand-mark {
  width: 3rem; height: 3rem;
  background: #ffffff;
  border: 2px solid var(--c-text-main);
  display: grid; place-items: center;
  flex: none;
}
.brand-mark img { width: 2.6rem; height: 2.6rem; object-fit: contain; }
.brand-text { line-height: 1.1; }
.brand-text strong { display: block; font-size: 1.05rem; font-weight: 700; }
.brand-text span { display: block; font-size: 0.75rem; color: var(--c-text-dim); }

.site-nav { display: flex; align-items: stretch; }
.site-nav a {
  display: flex; align-items: center;
  padding-inline: clamp(0.875rem, 1.6vw, 1.5rem);
  border-inline-end: var(--rule-dim);
  font-weight: 500;
}
.site-nav a[aria-current="page"] { background: var(--c-surface); border-block-end: 4px solid var(--c-accent); }
.site-nav a:hover { background: var(--c-accent); color: var(--c-ink-on-accent); }

.lang-toggle, .nav-toggle {
  display: flex; align-items: center; justify-content: center;
  padding-inline: var(--gutter);
  border-inline-start: var(--rule);
  font-weight: 700;
  background: transparent; border-block: 0; border-inline-end: 0;
  cursor: pointer;
}
.lang-toggle:hover { background: var(--c-accent); color: var(--c-ink-on-accent); }
.lang-toggle[lang="ar"] { font-family: var(--f-ar); font-weight: 800; }
.lang-toggle[lang="en"] { font-family: var(--f-en); }
.nav-toggle { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3.25rem; padding-inline: 1.5rem;
  border: 2px solid var(--c-text-main);
  font-weight: 700;
  transition: background-color 120ms linear, color 120ms linear;
}
.btn:hover { background: var(--c-text-main); color: var(--c-bg); }
.btn--accent { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-ink-on-accent); }
.btn--accent:hover { background: var(--c-text-main); border-color: var(--c-text-main); color: var(--c-bg); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ---------- Hero ---------- */
.hero { border-bottom: var(--rule); }
.hero .wrap { display: grid; grid-template-columns: 7fr 5fr; padding-inline: 0; }
.hero-copy {
  padding: var(--block-y) var(--gutter);
  border-inline-end: var(--rule);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 1.5rem;
}
.hero-copy h1 { margin-block: 0.5rem 0.75rem; }
.kicker { color: var(--c-accent); font-weight: 700; }
.hero-figure { position: relative; min-height: 28rem; background: var(--c-surface); }

/* ---------- Image containers ---------- */
.figure {
  position: relative; overflow: hidden;
  background: var(--c-surface);
  border: var(--rule-dim);
}
.figure img, .hero-figure img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(1) contrast(1.1);
  transition: filter 200ms linear;
}
.figure::after, .hero-figure::after {
  content: ""; position: absolute; inset: 0;
  background: var(--c-accent);
  mix-blend-mode: multiply;
  opacity: 0; transition: opacity 200ms linear;
  pointer-events: none;
}
.figure:hover::after, .hero-figure:hover::after { opacity: 1; }
.figure:hover img, .hero-figure:hover img { filter: grayscale(1) contrast(1.2); }
.figure figcaption, .hero-figure figcaption {
  position: absolute; inset-block-end: 0; inset-inline-start: 0;
  background: var(--c-bg); color: var(--c-text-main);
  padding: 0.5rem 0.875rem; font-size: 0.85rem;
  border-block-start: var(--rule); border-inline-end: var(--rule);
  z-index: 1;
}
.figure--4-3 { aspect-ratio: 4 / 3; }
.figure--16-9 { aspect-ratio: 16 / 9; }
.figure--tall { aspect-ratio: 3 / 4; }

/* ---------- Section headings ---------- */
.section-head {
  display: grid; grid-template-columns: 5fr 7fr; gap: var(--gutter);
  align-items: end; margin-block-end: 2rem;
  padding-block-end: 1rem; border-bottom: var(--rule);
}
.section-head p { justify-self: start; }

/* ---------- Data tables ---------- */
.table-wrap { overflow-x: auto; border-block: var(--rule); }
.data-table th, .data-table td {
  text-align: start; vertical-align: top;
  padding: 0.875rem 1rem;
  border-bottom: var(--rule-dim);
  border-inline-end: var(--rule-dim);
}
.data-table th:last-child, .data-table td:last-child { border-inline-end: 0; }
.data-table thead th {
  font-weight: 700; border-bottom: var(--rule);
  background: var(--c-surface); white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tfoot td { font-weight: 700; border-top: var(--rule); background: var(--c-surface); }
.data-table .num { text-align: end; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.data-table td:first-child { white-space: nowrap; }
.data-table td:first-child { font-weight: 700; }

/* Strict inversion on hover */
.table--invert tbody tr { transition: background-color 60ms linear, color 60ms linear; }
.table--invert tbody tr:hover { background: var(--c-accent); color: var(--c-ink-on-accent); }
.table--invert tbody tr:hover td { border-color: var(--c-ink-on-accent); }

.metric-big { font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 700; line-height: 1; }
.status { display: inline-block; padding: 0.15rem 0.5rem; border: 2px solid currentColor; font-size: 0.85rem; font-weight: 700; }
.status--accent { color: var(--c-accent); }
.table--invert tbody tr:hover .status--accent { color: var(--c-ink-on-accent); }

/* ---------- Sector strip (home) ---------- */
.sector-strip { display: grid; grid-template-columns: repeat(5, 1fr); border: var(--rule); border-block-end: 0; }
.sector-strip > a {
  padding: 1.5rem var(--gutter) 2rem;
  border-inline-end: var(--rule); border-bottom: var(--rule);
  display: flex; flex-direction: column; gap: 1rem; min-height: 16rem;
}
.sector-strip > a:last-child { border-inline-end: 0; }
.sector-strip > a:hover { background: var(--c-accent); color: var(--c-ink-on-accent); }
.sector-strip h3 { font-size: clamp(1.5rem, 2.4vw, 2.25rem); }
.sector-strip p { margin-block-start: auto; font-size: 0.95rem; }
.sector-strip > a:hover p { color: var(--c-ink-on-accent); }

/* ---------- Catalogue accordion ---------- */
.accordion { border-top: var(--rule); }
.accordion details { border-bottom: var(--rule); }
.accordion summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: var(--gutter);
  padding: clamp(1.25rem, 2.5vw, 2rem) 0;
  font-size: clamp(1.75rem, 4vw, 3.5rem);
  font-weight: 700; line-height: 1; letter-spacing: -0.02em;
}
html[dir="rtl"] .accordion summary { letter-spacing: 0; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary:hover { color: var(--c-accent); }
.accordion summary .count { font-size: 1rem; font-weight: 500; color: var(--c-text-dim); letter-spacing: 0; }
.accordion summary .mark {
  width: 3rem; height: 3rem; border: var(--rule);
  display: grid; place-items: center; font-size: 1.75rem; line-height: 1;
  color: var(--c-text-main);
}
.accordion summary .mark::before { content: "+"; }
.accordion details[open] summary .mark::before { content: "\2212"; }
.accordion details[open] summary .mark { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-ink-on-accent); }
.accordion-body { padding-block: 0 2rem; }
.accordion-body .table-wrap { border-block-start: var(--rule-dim); }
.accordion-foot { display: flex; justify-content: flex-end; padding-block-start: 1.25rem; }

/* ---------- Procurement hub ---------- */
.rfq { display: grid; grid-template-columns: 5fr 7fr; gap: var(--gutter); }
.rfq-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: var(--rule); }
.field { display: flex; flex-direction: column; border-bottom: var(--rule-dim); border-inline-end: var(--rule-dim); }
.field:nth-child(2n) { border-inline-end: 0; }
.field--full { grid-column: 1 / -1; border-inline-end: 0; }
.field label { padding: 0.75rem 1rem 0; font-size: 0.85rem; font-weight: 700; color: var(--c-text-dim); }
.field input, .field select, .field textarea {
  background: transparent; border: 0; outline-offset: -3px;
  padding: 0.5rem 1rem 0.875rem; width: 100%;
}
.field select { appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--c-text-main) 50%), linear-gradient(135deg, var(--c-text-main) 50%, transparent 50%);
  background-position: calc(100% - 1.4rem) 55%, calc(100% - 1rem) 55%;
  background-size: 0.4rem 0.4rem; background-repeat: no-repeat;
}
html[dir="rtl"] .field select { background-position: 1.4rem 55%, 1rem 55%; }
.field select option { background: var(--c-surface); color: var(--c-text-main); }
.field textarea { min-height: 6rem; resize: vertical; }
.field:focus-within { background: var(--c-surface); }
.field:focus-within label { color: var(--c-accent); }
.rfq-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; align-items: stretch; }
.rfq-preview { padding: 0.75rem 1rem; display: flex; flex-direction: column; justify-content: center; gap: 0.25rem; }
.rfq-preview span { font-size: 0.8rem; color: var(--c-text-dim); }
.rfq-preview code { font-family: inherit; font-weight: 700; word-break: break-word; }
.rfq-actions .btn { border: 0; border-inline-start: var(--rule); min-height: 100%; }
.rfq-direct { margin-block-start: 1.25rem; }
.rfq-direct a { border-bottom: 2px solid var(--c-accent); }

/* ---------- Fact list / definition tables ---------- */
.facts { border-top: var(--rule); }
.facts div { display: grid; grid-template-columns: 1fr 2fr; gap: var(--gutter); padding-block: 1rem; border-bottom: var(--rule-dim); }
.facts dt { font-weight: 700; color: var(--c-text-dim); }
.facts dd { font-weight: 500; }

.rigid-list { border-top: var(--rule); counter-reset: item; }
.rigid-list li { display: grid; grid-template-columns: 3.5rem 1fr; gap: 1rem; padding-block: 1.125rem; border-bottom: var(--rule-dim); align-items: baseline; }
.rigid-list li::before { counter-increment: item; content: counter(item, decimal-leading-zero); font-weight: 700; color: var(--c-accent); font-size: 1.25rem; }
.rigid-list--plain li::before { content: "\2014"; }

/* ---------- Big statement blocks (about) ---------- */
.statement { display: grid; grid-template-columns: 4fr 8fr; gap: var(--gutter); padding-block: clamp(2rem, 4vw, 3.5rem); border-bottom: var(--rule-dim); }
.statement:last-child { border-bottom: 0; }
.statement h3 { font-size: clamp(1.75rem, 3.2vw, 2.75rem); }
.statement p { font-size: clamp(1.05rem, 1.5vw, 1.25rem); max-width: 56ch; }

.image-row { display: grid; grid-template-columns: 5fr 4fr 3fr; gap: 0; border: var(--rule); }
.image-row .figure { border: 0; border-inline-end: var(--rule); aspect-ratio: auto; min-height: 22rem; }
.image-row .figure:last-child { border-inline-end: 0; }

/* ---------- Footer ---------- */
.site-footer { padding-block: var(--block-y) 2rem; }
.site-footer .cols { display: grid; grid-template-columns: 5fr 2fr 2fr 3fr; gap: var(--gutter); }
.site-footer h4 { font-size: 0.9rem; font-weight: 700; color: var(--c-text-dim); margin-block-end: 0.75rem; }
.site-footer li + li { margin-block-start: 0.35rem; }
.site-footer .logo-plate { background: #ffffff; border: var(--rule); padding: 1rem; max-width: 22rem; margin-block-start: 1.5rem; }
.site-footer .legal { margin-block-start: 3rem; padding-block-start: 1rem; border-top: var(--rule-dim); font-size: 0.85rem; color: var(--c-text-dim); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .sector-strip { grid-template-columns: repeat(3, 1fr); }
  .sector-strip > a:nth-child(3n) { border-inline-end: 0; }
  .sector-strip > a:last-child { border-inline-end: var(--rule); }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .site-header .wrap { grid-template-columns: 1fr auto auto; }
  .nav-toggle { display: flex; }
  .site-nav {
    grid-column: 1 / -1; flex-direction: column;
    border-top: var(--rule); display: none;
  }
  .site-nav[data-open="true"] { display: flex; }
  .site-nav a { padding-block: 1rem; border-inline-end: 0; border-bottom: var(--rule-dim); }
  .brand { border-inline-end: 0; }

  .hero .wrap, .grid-2, .grid-7-5, .grid-5-7, .grid-4-8, .rfq, .section-head, .statement, .image-row { grid-template-columns: 1fr; }
  .hero-copy { border-inline-end: 0; border-bottom: var(--rule); }
  .hero-figure { min-height: 18rem; }
  .image-row .figure { border-inline-end: 0; border-bottom: var(--rule); min-height: 16rem; }
  .image-row .figure:last-child { border-bottom: 0; }
  .accordion summary { grid-template-columns: 1fr auto; }
  .accordion summary .count { grid-column: 1; }
  .accordion summary .mark { grid-row: 1 / span 2; }
}
@media (max-width: 640px) {
  .sector-strip { grid-template-columns: 1fr; }
  .sector-strip > a, .sector-strip > a:last-child { border-inline-end: 0; min-height: 0; }
  .rfq-fields { grid-template-columns: 1fr; }
  .field { border-inline-end: 0; }
  .rfq-actions { grid-template-columns: 1fr; }
  .rfq-actions .btn { border-inline-start: 0; border-top: var(--rule); min-height: 3.5rem; }
  .facts div { grid-template-columns: 1fr; gap: 0.25rem; }
  .site-footer .cols { grid-template-columns: 1fr; }
  .brand-text span { display: none; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; color: #000; }
  .site-header, .site-footer .logo-plate, .btn { display: none; }
  .block, .data-table th, .data-table td { border-color: #000; }
}
