/* ============================================================
   Software Studio — Design tokens (LIGHT / BUSINESS)
   Theme: corporate navy on paper. White and cool-grey surfaces,
   a navy-blue primary for actions, a steel blue for linework and
   figures, and a muted amber kept for tags and warnings only.

   Drop-in replacement for the dark "engineering blueprint" sheet:
   every class name, selector and breakpoint is unchanged, so no
   template edits are required. Only values moved.

   Contrast: every text token is >= 4.5:1 on the surface it sits on.
   RTL-safe: all directional properties stay logical (inline/block).
   ============================================================ */
:root {
  /* --- surfaces (light) --- */
  --paper: #ffffff;        /* page ground                      */
  --paper-2: #f6f9fc;      /* raised bands, panels, footer     */
  --paper-3: #eaf0f7;      /* sunken / hover fill              */

  /* --- text --- */
  --ink: #0f1b2d;          /* headings                         */
  --ink-2: #3d4f66;        /* body copy                        */
  --ink-3: #5f7189;        /* captions, meta                   */

  /* --- lines --- */
  --line: #dce4ee;         /* borders, dividers                */
  --line-soft: #e9eff6;    /* blueprint grid, hairlines        */

  /* --- brand --- */
  --primary: #1b4dd1;      /* buttons, active state            */
  --primary-hi: #1740ae;   /* hover                            */
  --primary-ink: #ffffff;  /* text on primary                  */
  --primary-soft: #eef3ff; /* tinted background                */
  --accent: #0f6fb8;       /* eyebrows, links, figures         */
  --signal: #a85b04;       /* tags, errors — sparing           */
  --signal-soft: #fdf5ea;

  /* --- legacy aliases -----------------------------------------
     Kept so any template, partial or inline style that still names
     a token from the dark sheet keeps resolving. Safe to delete
     once nothing references them. -------------------------------- */
  --ink-soft: var(--paper-2);
  --ink-softer: var(--paper-3);
  --blueprint: var(--accent);
  --signal-ink: var(--primary-ink);

  --radius: 6px;
  --container: 1180px;

  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.05);
  --shadow: 0 1px 3px rgba(15, 27, 45, 0.06), 0 6px 20px rgba(15, 27, 45, 0.05);
  --shadow-lift: 0 2px 6px rgba(15, 27, 45, 0.07), 0 14px 32px rgba(15, 27, 45, 0.09);

  --font-display-en: 'Space Grotesk', 'Cairo', sans-serif;
  --font-display-ar: 'Cairo', 'Space Grotesk', sans-serif;
  --font-body-en: 'Inter', 'Cairo', sans-serif;
  --font-body-ar: 'Cairo', 'Inter', sans-serif;

  --font-display: var(--font-display-en);
  --font-body: var(--font-body-en);
}

html[dir='rtl'] {
  --font-display: var(--font-display-ar);
  --font-body: var(--font-body-ar);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
}

p {
  margin: 0;
  color: var(--ink-2);
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

::selection {
  background: var(--primary-soft);
  color: var(--ink);
}

/* ---------- layout helpers ---------- */
.wrap {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

.section {
  padding-block: 88px;
}

.section-head {
  max-width: 640px;
  margin-block-end: 48px;
}

.section-head h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  margin-block-end: 12px;
}

.section-head p {
  font-size: 1.02rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-block-end: 14px;
}

.eyebrow::before {
  content: '';
  width: 18px;
  height: 2px;
  background: var(--accent);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease,
              border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

/* primary action — the class name is kept from the dark sheet,
   where "signal" was the one accent allowed on buttons */
.btn-signal {
  background: var(--primary);
  color: var(--primary-ink);
  box-shadow: var(--shadow-sm);
}

.btn-signal:hover,
.btn-signal:focus-visible,
.btn-signal:active {
  background: var(--primary-hi);
  /* Explicit, not inherited: Bootstrap's `a:hover` (loaded for the account
     pages) out-specifies the base `.btn-signal` colour and turned the label
     dark blue on hover. */
  color: var(--primary-ink);
  box-shadow: var(--shadow);
}

.btn-outline {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ---------- shared blocks ---------- */
.rule {
  height: 1px;
  background: var(--line);
  border: none;
}

.grid-bg {
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 34px 34px;
}

/* corner-bracket motif: reserved for spec/values/direct panels */
.bracketed {
  position: relative;
}

.bracketed::before,
.bracketed::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
}

.bracketed::before {
  top: -2px;
  inset-inline-start: -2px;
  border-inline-end: none;
  border-block-end: none;
  border-start-start-radius: calc(var(--radius) + 1px);
}

.bracketed::after {
  bottom: -2px;
  inset-inline-end: -2px;
  border-inline-start: none;
  border-block-start: none;
  border-end-end-radius: calc(var(--radius) + 1px);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 720px) {
  .section {
    padding-block: 60px;
  }
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border-block-end: 1px solid var(--line);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  flex-shrink: 0;
}

.logo-mark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--primary);
  border-radius: 2px;
  position: relative;
  flex-shrink: 0;
}

.logo-mark::after {
  content: '';
  position: absolute;
  inset: 5px;
  background: var(--signal);
}

.logo-word em {
  font-style: normal;
  color: var(--primary);
}

/* The child combinator is load-bearing. `.primary-nav ul` also matched the
   nested .dropdown-menu, with two consequences: the dropdown became a flex row
   whose labels wrapped onto two lines, and under 900px its (0,1,1) specificity
   beat the (0,1,0) `display: none` in the mobile block, leaving the services
   list permanently expanded inside the burger menu. */
.primary-nav > ul {
  display: flex;
  align-items: center;
  gap: 6px;
}

.primary-nav a,
.dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--ink-2);
  border-radius: var(--radius);
  background: transparent;
  border: none;
}

.primary-nav a:hover,
.dropdown-trigger:hover {
  color: var(--ink);
  background: var(--paper-3);
}

.primary-nav a.active,
.dropdown-trigger.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.has-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  display: flex;
  gap: 2px;
  /* Centred on the trigger, not anchored to its left edge: the panel is one
     wide row now, and left-anchoring pushed it past the right of the viewport
     on narrower desktops. Centring uses the standalone `translate` property so
     it composes with, rather than fights, the open/close `transform` below. */
  inset-inline-start: 50%;
  translate: -50% 0;
  width: max-content;
  max-width: min(720px, calc(100vw - 32px));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

html[dir='rtl'] .dropdown-menu {
  translate: 50% 0;
}

.has-dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: 9px 12px;
  font-size: 0.9rem;
  color: var(--ink-2);
  border-radius: var(--radius);
  /* Keeps each service label on one line — this is what stops "Web
     Applications" breaking across two rows. */
  white-space: nowrap;
}

.dropdown-menu a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper);
}

.lang-switch a {
  display: inline-block;
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 7px 13px;
}

.lang-switch a:hover {
  color: var(--ink);
}

.lang-switch a.active {
  background: var(--primary);
  color: var(--primary-ink);
}

.burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  padding: 8px;
}

.burger span {
  width: 20px;
  height: 2px;
  background: var(--ink);
}

@media (max-width: 900px) {
  .cta-desktop {
    display: none;
  }

  .burger {
    display: flex;
  }

  .primary-nav {
    position: fixed;
    inset-block-start: 65px;
    inset-inline: 0;
    background: var(--paper);
    border-block-end: 1px solid var(--line);
    box-shadow: var(--shadow);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
  }

  .primary-nav.open {
    max-height: 480px;
    overflow-y: auto;
  }

  .primary-nav > ul {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 2px;
  }

  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    /* Undo the desktop centring and the open/close offset: inside the stacked
       burger menu the panel is a plain block in the flow. */
    translate: none;
    transform: none;
    width: auto;
    max-width: none;
    display: none;
    flex-direction: column;
    border: none;
    box-shadow: none;
    background: var(--paper-2);
    margin-block-start: 4px;
  }

  html[dir='rtl'] .dropdown-menu {
    translate: none;
  }

  /* `transform` has to be reset here too: the desktop open rule is (0,3,0) and
     would otherwise beat the (0,1,0) reset above and shift the panel. */
  .has-dropdown.open .dropdown-menu {
    display: flex;
    transform: none;
  }
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--paper-2);
  border-block-start: 1px solid var(--line);
  padding-block-start: 64px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 32px;
  padding-block-end: 40px;
}

.col h4 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-block-end: 16px;
}

.col ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.col a {
  color: var(--ink-2);
  font-size: 0.92rem;
}

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

.brand-col .logo-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
}

.brand-col .logo-word em {
  font-style: normal;
  color: var(--primary);
}

.brand-col p {
  margin-block: 14px 18px;
  max-width: 32ch;
  font-size: 0.92rem;
  color: var(--ink-3);
}

.socials {
  flex-direction: row !important;
  gap: 18px !important;
}

.contact-list li {
  color: var(--ink-2);
  font-size: 0.92rem;
}

.bottom-bar {
  display: flex;
  justify-content: center;
  padding-block: 22px;
  font-size: 0.85rem;
  color: var(--ink-3);
}

@media (max-width: 800px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Site messages (Django messages framework)
   ============================================================ */
.site-messages {
  padding-block-start: 20px;
}

.site-alert {
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--ink);
  font-size: 0.94rem;
  margin-block-end: 12px;
}

.site-alert-success {
  border-inline-start-color: var(--primary);
  background: var(--primary-soft);
}

.site-alert-error {
  border-inline-start-color: var(--signal);
  background: var(--signal-soft);
}

/* ============================================================
   Trust strip
   ============================================================ */
.trust-strip {
  border-block-end: 1px solid var(--line);
  background: var(--paper-2);
}

.trust-strip .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 36px;
  padding-block: 20px;
}

.trust-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--ink-3);
}

.trust-item strong {
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.trust-sep {
  width: 1px;
  height: 14px;
  background: var(--line);
}

@media (max-width: 700px) {
  .trust-sep {
    display: none;
  }
}

/* ============================================================
   Home: hero
   ============================================================ */
.hero {
  padding-block: 90px 100px;
  border-block-end: 1px solid var(--line);
  background-color: var(--paper);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 56px;
  align-items: center;
}

.hero-copy h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.1rem);
  letter-spacing: -0.025em;
  margin-block-end: 20px;
}

.hero-subtitle {
  font-size: 1.08rem;
  max-width: 52ch;
  margin-block-end: 32px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.spec-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-block: 12px;
  gap: 12px;
}

.spec-label {
  color: var(--ink-3);
  font-size: 0.9rem;
}

.spec-value {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- services grid (home) ---------- */
/* Flex, not grid, and deliberately so: there are five services in a
   three-across layout, and a grid leaves the sixth cell empty — which, with
   the old 1px-gap hairline treatment, rendered as a grey block in the corner.
   Wrapped flex items have no cells to leave empty, and `justify-content:
   center` centres the short last row instead of stranding it on one side. */
.services-grid {
  --services-gap: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--services-gap);
}

.service-card {
  /* Three per row: each card takes a third of the width once the two gaps
     between them are removed from the total. */
  flex: 0 1 calc((100% - 2 * var(--services-gap)) / 3);
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 32px 28px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.service-card:hover {
  border-color: #c3d3e6;
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.service-card svg {
  color: var(--primary);
  margin-block-end: 18px;
}

.service-card h3 {
  font-size: 1.05rem;
  margin-block-end: 10px;
}

.service-card p {
  font-size: 0.94rem;
  margin-block-end: 16px;
}

.service-card .card-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
}

.service-card .card-link:hover {
  text-decoration: underline;
}

/* ---------- process ---------- */
.process-section {
  background: var(--paper-2);
  border-block: 1px solid var(--line);
}

.process-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  position: relative;
}

.process-track::before {
  content: '';
  position: absolute;
  top: 11px;
  inset-inline: 4%;
  height: 1px;
  background: var(--line);
}

.process-step {
  position: relative;
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--paper);
  margin-block-end: 18px;
  position: relative;
  z-index: 1;
}

.process-step h3 {
  font-size: 1rem;
  margin-block-end: 8px;
}

.process-step p {
  font-size: 0.92rem;
}

/* ---------- work preview (home) ---------- */
.work-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-block-end: 40px;
}

.work-head h2,
.work-head p {
  margin: 0;
}

.view-all {
  flex-shrink: 0;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.work-card {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.work-card:hover {
  border-color: #c3d3e6;
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.work-tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--signal);
  background: var(--signal-soft);
  border-radius: 999px;
  padding: 4px 10px;
  margin-block-end: 12px;
}

.work-card h3 {
  font-size: 1.15rem;
  margin-block-end: 8px;
}

.work-card p {
  font-size: 0.93rem;
}

/* ---------- stats ---------- */
.stats-band {
  background: var(--paper-2);
  border-block: 1px solid var(--line);
}

.stats-grid {
  display: grid;
  /* auto-fit rather than a fixed 4 columns: the Stat rows are admin-editable,
     so the band has to sit right at 3 or 5 figures as well as 4. */
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  padding-block: 48px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-inline: 20px;
  border-inline-start: 1px solid var(--line);
  text-align: center;
}

.stat:first-child {
  border-inline-start: none;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--ink-3);
}

/* ---------- cta ---------- */
.cta-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.cta-box h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.cta-box p {
  max-width: 46ch;
}

.cta-box .rule {
  width: 100%;
}

.cta-micro {
  font-size: 0.85rem;
  color: var(--ink-3);
  margin-block-start: -10px;
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .service-card {
    flex-basis: calc((100% - var(--services-gap)) / 2);
  }

  .process-track {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 36px;
  }

  .process-track::before {
    display: none;
  }

  .work-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 24px;
  }

  .stat:nth-child(3) {
    border-inline-start: none;
  }
}

@media (max-width: 600px) {
  .service-card {
    flex-basis: 100%;
  }

  .work-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   Shared inner-page hero (about / services / work / contact)
   ============================================================ */
.page-hero {
  padding-block: 70px 60px;
  border-block-end: 1px solid var(--line);
  background-color: var(--paper-2);
}

.page-hero h1 {
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  margin-block: 14px 14px;
}

.page-hero p {
  max-width: 56ch;
  font-size: 1.05rem;
}

/* ============================================================
   About
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: start;
}

.about-copy p {
  font-size: 1.02rem;
  margin-block-end: 22px;
  max-width: 58ch;
}

.values-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px;
}

.values-panel h3 {
  font-size: 1.1rem;
  margin-block-end: 20px;
}

.value-row {
  padding-block: 14px;
}

.value-row h4 {
  font-size: 0.98rem;
  margin-block-end: 6px;
}

.value-row p {
  font-size: 0.9rem;
}

@media (max-width: 850px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Services (tabbed detail page)
   ============================================================ */
.service-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-block-end: 40px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink-2);
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.tab-btn svg {
  color: var(--ink-3);
}

.tab-btn:hover {
  color: var(--ink);
  border-color: #c3d3e6;
}

.tab-btn.active {
  color: var(--primary-ink);
  background: var(--primary);
  border-color: var(--primary);
}

.tab-btn.active svg {
  color: var(--primary-ink);
}

.service-cta-line {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--primary);
  margin-block-start: 4px;
}

.service-cta-line a:hover {
  text-decoration: underline;
}

.service-detail {
  padding-block: 40px;
  scroll-margin-block-start: 90px;
}

.service-detail:first-child {
  padding-block-start: 0;
}

.service-detail:not(.active) {
  display: none;
}

.service-detail-head h2 {
  font-size: 1.5rem;
  margin-block-end: 10px;
}

.service-detail-head p {
  max-width: 60ch;
  font-size: 1rem;
  margin-block-end: 24px;
}

.service-points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.service-points li {
  border-inline-start: 2px solid var(--primary);
  padding-inline-start: 14px;
  font-size: 0.94rem;
  color: var(--ink-2);
}

.service-detail .rule {
  margin-block-start: 40px;
}

@media (max-width: 700px) {
  .service-points {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Work (list page)
   ============================================================ */
.work-list {
  display: flex;
  flex-direction: column;
}

.work-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 34px;
  border-block-end: 1px solid var(--line);
}

.work-row:first-child {
  padding-block-start: 0;
}

.work-row-info {
  max-width: 62ch;
}

.work-row-info h2 {
  font-size: 1.4rem;
  margin-block-end: 8px;
}

.work-row-info p {
  font-size: 0.96rem;
}

.work-row .btn {
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .work-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- mid-list CTA banner ---------- */
.cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--primary-soft);
  border: 1px solid #d6e2fb;
  border-inline-start: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 26px 30px;
  margin-block: 8px 34px;
}

.cta-banner h3 {
  font-size: 1.05rem;
  margin-block-end: 4px;
}

.cta-banner p {
  font-size: 0.9rem;
}

.cta-banner .btn {
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .cta-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- compact stats strip ---------- */
.stats-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  padding: 22px 24px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stats-mini .stat {
  border-inline-start: 1px solid var(--line);
  padding-inline: 20px 0;
  text-align: start;
}

.stats-mini .stat:first-child {
  border-inline-start: none;
  padding-inline-start: 0;
}

@media (max-width: 700px) {
  .stats-mini {
    flex-direction: column;
    gap: 16px;
  }

  .stats-mini .stat {
    border-inline-start: none;
    padding-inline-start: 0;
  }
}

/* ============================================================
   Contact
   ============================================================ */
.contact-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 48px;
  align-items: start;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.field-row {
  display: flex;
  gap: 20px;
}

label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-2);
}

input,
textarea {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.96rem;
  resize: vertical;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: #9aa9bc;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}

.contact-form .btn {
  align-self: flex-start;
  margin-block-start: 4px;
}

.field-error {
  color: var(--signal);
  font-size: 0.84rem;
  margin: 0;
}

.success-msg {
  color: var(--primary);
  font-size: 0.92rem;
}

.form-note {
  font-size: 0.85rem;
  color: var(--ink-3);
}

.success-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 34px;
  background: var(--primary-soft);
  border: 1px solid #d6e2fb;
  border-radius: var(--radius);
}

.success-panel h3 {
  color: var(--primary);
  font-size: 1.15rem;
}

.direct-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.direct-panel h3 {
  font-size: 1.05rem;
  margin-block-end: 4px;
}

.direct-link {
  color: var(--primary);
  font-size: 0.96rem;
  font-weight: 500;
}

.direct-link:hover {
  text-decoration: underline;
}

@media (max-width: 800px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    flex-direction: column;
  }
}

/* ============================================================
   Client logo strip ("worked with") — single-line marquee
   Rendered by templates/partials/client_logos.html, which hides the
   whole section when no Client rows are published.
   ============================================================ */
.clients-strip {
  background: var(--paper);
  border-block-end: 1px solid var(--line);
  padding-block: 44px;
  overflow: hidden;
}

.clients-title {
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-block-end: 28px;
}

/* The marquee viewport. The mask fades both ends into the page background so
   logos enter and leave instead of being chopped off at a hard edge. */
.clients-marquee {
  display: flex;
  width: 100%;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

/* Two identical tracks translating in lockstep — see the comment in
   partials/client_logos.html for why. flex-shrink must stay 0, or the tracks
   compress to fit the viewport instead of overflowing it and nothing moves. */
.clients-logos {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-around;
  gap: 32px;
  padding-inline-end: 32px;
  /* min-width is what makes two tracks provably enough at any screen size.
     The loop is seamless only while each track is at least as wide as the
     viewport — otherwise the second track runs out before the first has
     scrolled clear and a gap opens. Pinning each track to >= 100% of the
     viewport guarantees it regardless of how many clients are published; with
     only a handful, space-around spreads them instead of clustering them at
     the start. */
  min-width: 100%;
  animation: clients-scroll 46s linear infinite;
  will-change: transform;
}

html[dir='rtl'] .clients-logos {
  animation-name: clients-scroll-rtl;
}

.clients-marquee:hover .clients-logos,
.clients-marquee:focus-within .clients-logos {
  animation-play-state: paused;
}

.clients-logos img {
  /* Every logo file is normalised to the same 3:1 transparent canvas with the
     mark centred inside it, so a fixed box here gives every partner an
     identical slot regardless of the mark's own shape. `contain` is a safety
     net for logos uploaded later through the admin at some other ratio. */
  width: 150px;
  height: 50px;
  object-fit: contain;
  object-position: center;
  /* Full colour, at each brand's own values. The radius is for logos that
     carry their own background (a square tile rather than a wordmark) so they
     read as a badge instead of a raw block; it is invisible on transparent
     wordmarks. */
  border-radius: 4px;
}

.clients-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 4px 10px;
  /* Reserved height: the line swaps between entries of different lengths, and
     without this the whole page below it shifts on every change. */
  min-height: 1.5rem;
  margin-block-start: 26px;
  text-align: center;
  transition: opacity 0.18s ease;
}

.clients-caption.is-swapping {
  opacity: 0;
}

.clients-caption-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.clients-caption-desc {
  font-size: 0.92rem;
  color: var(--ink-3);
}

.clients-caption-desc:not(:empty)::before {
  content: '\2014';
  margin-inline-end: 8px;
}

@media (max-width: 700px) {
  .clients-caption {
    margin-block-start: 20px;
  }

  .clients-caption-name,
  .clients-caption-desc {
    font-size: 0.86rem;
  }
}

@keyframes clients-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

@keyframes clients-scroll-rtl {
  from { transform: translateX(0); }
  to   { transform: translateX(100%); }
}

/* The global reduce-motion rule collapses animation-duration to 0.001ms, which
   would spin an infinite marquee rather than stop it. Stop it properly, drop
   the duplicate track, and let the row be scrolled by hand instead. */
@media (prefers-reduced-motion: reduce) {
  .clients-logos {
    animation: none !important;
  }

  .clients-logos[aria-hidden='true'] {
    display: none;
  }

  .clients-marquee {
    overflow-x: auto;
    -webkit-mask-image: none;
    mask-image: none;
  }
}

@media (max-width: 700px) {
  .clients-logos {
    gap: 20px;
    padding-inline-end: 20px;
    animation-duration: 30s;
  }

  .clients-logos img {
    width: 120px;
    height: 40px;
  }
}

/* ============================================================
   RTL typography guard
   Arabic is cursive: letter-spacing breaks the joins between letters and
   negative tracking makes it worse, while `text-transform` is a no-op that
   only risks odd font fallbacks. The Latin display treatment is undone here
   rather than being conditionally applied in a dozen places.
   ============================================================ */
html[dir='rtl'] h1,
html[dir='rtl'] h2,
html[dir='rtl'] h3,
html[dir='rtl'] h4,
html[dir='rtl'] .hero-copy h1,
html[dir='rtl'] .eyebrow,
html[dir='rtl'] .col h4,
html[dir='rtl'] .clients-title,
html[dir='rtl'] .work-tag {
  letter-spacing: normal;
  text-transform: none;
}

/* ============================================================
   Live demos — /demos/ page and the home-page teaser
   Rendered by templates/pages/demos.html and the #demos section of
   templates/pages/home.html. Tabs are wired up by initDemoTabs() in site.js.
   ============================================================ */
.demo-tab-row {
  display: flex;
  justify-content: center;
  margin-block-end: 36px;
}

.demo-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper-2);
}

.demo-tab {
  padding: 9px 22px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.demo-tab:hover {
  color: var(--ink);
}

.demo-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.demo-tab[aria-selected='true'] {
  background: var(--primary);
  color: var(--primary-ink);
  box-shadow: var(--shadow-sm);
}

.demo-panel[hidden] {
  display: none;
}

.demo-layout {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.demo-info h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  margin-block: 12px 14px;
}

.demo-points {
  display: grid;
  gap: 10px;
  margin-block: 20px 26px;
}

.demo-points li {
  position: relative;
  padding-inline-start: 22px;
  font-size: 0.95rem;
  color: var(--ink-2);
}

.demo-points li::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0.5em;
  width: 8px;
  height: 8px;
  border: 2px solid var(--primary);
  border-radius: 2px;
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.demo-note {
  margin-block-start: 16px;
  font-size: 0.85rem;
  color: var(--ink-3);
}

.demo-frame {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow-lift);
}

.demo-frame-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  border-block-end: 1px solid var(--line);
  background: var(--paper-2);
}

.demo-frame-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}

.demo-frame iframe {
  display: block;
  width: 100%;
  height: 660px;
  border: 0;
  background: var(--paper-2);
}

/* Home-page teaser cards */
.demo-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.demo-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.demo-card:hover {
  color: inherit;
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lift);
}

.demo-card-shot {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-block-end: 1px solid var(--line);
  background: var(--paper-2);
}

.demo-card-shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.demo-card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 20px 22px;
}

.demo-card-body h3 {
  font-size: 1.15rem;
  margin: 4px 0 0;
}

.demo-card-body p {
  font-size: 0.95rem;
}

@media (max-width: 980px) {
  .demo-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .demo-frame iframe {
    height: 540px;
  }
}

@media (max-width: 1100px) {
  .demo-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .demo-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .demo-tab {
    padding: 8px 14px;
    font-size: 0.85rem;
  }
}

html[dir='rtl'] .demo-card-body .work-tag {
  letter-spacing: normal;
  text-transform: none;
}

/* ============================================================
   Brand lockup — the "M" mark tile + name (partials/brand.html)
   Sits at the end of the sheet so it wins over the older `.logo-word`
   and `.brand-col .logo-word` rules without editing them.
   ============================================================ */
.logo-tile {
  display: inline-flex;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-sm);
}

.logo-tile img {
  display: block;
  width: 100%;
  height: 100%;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1;
}

.logo .logo-word {
  font-family: var(--font-display-en);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

.logo .logo-word em {
  font-style: normal;
  color: var(--primary);
}

.logo-sub {
  font-family: var(--font-display-en);
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.brand-col .logo {
  margin-block-end: 6px;
}

@media (max-width: 420px) {
  .logo .logo-word {
    font-size: 0.9rem;
  }

  .logo-sub {
    letter-spacing: 0.28em;
  }
}
