/*
  Merf — styles.css
  - Moderno, accessibile, responsive
  - Nessun font esterno (stack di sistema)
*/

:root {
  --bg: #0b0f14;
  --panel: #0f1620;
  --text: #e9eef5;
  --muted: #a7b1c2;
  --brand: #3ea6ff;
  --brand-600: #2589db;
  --accent: #6cffc8;
  --ok: #42d392;
  --warn: #ffcc66;
  --err: #ff6b6b;
  --shadow: 0 10px 30px rgba(0,0,0,.25);
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
/* Prevent horizontal overflow in RTL or with decorative pseudo elements */
html, body { overflow-x: hidden; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 10% -10%, #0f202f 0%, transparent 60%),
              radial-gradient(1000px 700px at 110% 0%, #141d29 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Solid background for Contact page */
.page-contact {
  background: var(--panel) !important;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
  left: 20px; top: 10px; width: auto; height: auto; padding: 8px 12px; background: #000; color: #fff; border-radius: 6px;
}

.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(11,15,20, .8);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: 0.5px; }
.logo-mark { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--accent)); box-shadow: 0 0 16px rgba(110,255,200,.4); }
.logo-img { width: 45px; height: 45px; display: inline-block; object-fit: contain; border-radius: 0; box-shadow: none; background: transparent; }
.logo-text { font-size: 1.125rem; }
.lang-switch { margin-left: 8px; height: var(--nav-item-h); padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.lang-switch:hover { background: rgba(255,255,255,.1); }

/* Flag icon in language switch */
.lang-switch .flag { height: 14px; width: auto; display: inline-block; border-radius: 2px; vertical-align: middle; box-shadow: 0 0 0 1px rgba(0,0,0,.2) inset; }

/* Mobile-only language toggle (hidden by default) */
.lang-switch--mobile { display: none; }

.primary-nav ul { display: flex; gap: 18px; list-style: none; margin: 0; padding: 0; align-items: center; }
.primary-nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px; white-space: nowrap; }
.primary-nav a:hover, .primary-nav a:focus { color: var(--text); background: rgba(255,255,255,.06); }
/* Make nav container flex to host language switch */
.primary-nav { display: flex; align-items: center; gap: 10px; }
/* Nav CTA — compact and aligned */
:root { --nav-item-h: 36px; }
.primary-nav .nav-cta {
  display: inline-flex; align-items: center; justify-content: center;
  height: var(--nav-item-h); line-height: 1; padding: 0 12px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; letter-spacing: .3px; text-transform: uppercase;
  color: var(--text); background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.16);
}
.primary-nav .nav-cta:hover, .primary-nav .nav-cta:focus-visible { background: rgba(255,255,255,.08); }

.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; border-radius: 8px; }
.nav-toggle .bar { display: block; width: 24px; height: 2px; background: var(--text); margin: 5px 0; border-radius: 2px; }

.hero { padding: 64px 0 40px; }
.grid-2 { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: center; }
.hero h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.15; margin: 0 0 12px; }
.hero p { margin: 0 0 16px; color: var(--muted); }
.cta-row { display: flex; gap: 12px; margin-top: 12px; }

/* Centered hero with animated background */
.hero-centered { position: relative; padding: 96px 0; overflow: hidden; min-height: 70vh; }
.hero-centered .hero-container { position: relative; z-index: 4; text-align: center; max-width: 900px; margin: 0 auto; }
.hero-centered .hero-container { display: grid; place-items: center; gap: 16px; }
.brand-title { font-size: clamp(42px, 8vw, 96px); line-height: 1.05; letter-spacing: .08em; margin: 0 0 8px; font-weight: 800; }
.hero-centered .hero-container .lead { font-size: 1.1rem; }
.hero-centered .hero-container .lead { color: var(--text); }
.hero-centered .cta-row { justify-content: center; }
.hero-centered .hero-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.hero-centered .hero-bg .tint { position: absolute; inset: 0; z-index: 3; background:
  linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.55)),
  linear-gradient(135deg, rgba(62,166,255,.18), rgba(108,255,200,.12)); }
/* removed scrolling icon rows */

/* Background photo slideshow (under icons, under overlay) */
.hero-centered .hero-bg .hero-photos { position: absolute; inset: 0; z-index: 1; }
.hero-centered .hero-bg .hero-photos .photo {
  position: absolute; inset: 0; opacity: 0; background-position: center; background-size: cover; background-repeat: no-repeat;
  animation: hero-fade 28s linear infinite;
}
.hero-centered .hero-bg .hero-photos .p1 {
  animation-delay: 0s;
  background-image:
    url('../img/hero/photos/hero-1.webp'),
    url('../img/hero/photos/hero-1.jpg'),
    url('../img/hero/photos/hero-1.png');
}
.hero-centered .hero-bg .hero-photos .p2 {
  animation-delay: 7s;
  background-image:
    url('../img/hero/photos/hero-2.webp'),
    url('../img/hero/photos/hero-2.jpg'),
    url('../img/hero/photos/hero-2.png');
}
.hero-centered .hero-bg .hero-photos .p3 {
  animation-delay: 14s;
  background-image:
    url('../img/hero/photos/hero-3.webp'),
    url('../img/hero/photos/hero-3.jpg'),
    url('../img/hero/photos/hero-3.png');
}
.hero-centered .hero-bg .hero-photos .p4 {
  animation-delay: 21s;
  background-image:
    url('../img/hero/photos/hero-4.webp'),
    url('../img/hero/photos/hero-4.jpg'),
    url('../img/hero/photos/hero-4.png');
}

@keyframes hero-fade {
  0%, 18% { opacity: 1; }
  25%, 100% { opacity: 0; }
}

/* removed scroll-left animation */

.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); color: var(--text); text-decoration: none; transition: transform .06s ease, background .3s ease, box-shadow .3s ease; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-600)); box-shadow: var(--shadow); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: rgba(255,255,255,.06); }
.btn.ghost:hover { background: rgba(255,255,255,.1); }

.hero-visual { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.card { background: var(--panel); border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); }

.section { padding: 56px 0; }
.section { position: relative; }
.section.alt { background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0)); border-top: 1px solid rgba(255,255,255,.06); border-bottom: 1px solid rgba(255,255,255,.06); }
.section h2 { margin-top: 0; font-size: clamp(22px, 3vw, 32px); }
/* Split block with illustration */
.feature-split .copy { align-self: center; }
.feature-split .media { display: flex; justify-content: center; align-items: center; }
.feature-split .illu { width: 100%; max-width: 520px; height: auto; border-radius: 16px; border: 1px solid rgba(255,255,255,.08); box-shadow: var(--shadow); }
.feature-split .copy-card { background: var(--panel); border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius); padding: 18px 18px; box-shadow: var(--shadow); }
.feature-split .copy-card p { color: var(--text); }
@media (max-width: 720px) { .feature-split .copy-card { margin-bottom: 12px; } }

/* Alternating sections and diagonal separators */
.section.alt2 { background: linear-gradient(180deg, rgba(0,0,0,.14), rgba(0,0,0,0)); border-top: 1px solid rgba(255,255,255,.05); border-bottom: 1px solid rgba(255,255,255,.05); }
.diagonal-top { position: relative; z-index: 0; overflow: hidden; }
.diagonal-top::before { content:""; position:absolute; left:0; right:0; top:0; height:60px; background: var(--panel); transform: skewY(-2.2deg); transform-origin: 0 0; opacity:.7; z-index:-1; pointer-events:none; }
.diagonal-bottom { position: relative; z-index: 0; overflow: hidden; }
.diagonal-bottom::after { content:""; position:absolute; left:0; right:0; bottom:0; height:60px; background: var(--panel); transform: skewY(2.2deg); transform-origin: 0 100%; opacity:.7; z-index:-1; pointer-events:none; }

@media (max-width: 720px) {
  .diagonal-top::before, .diagonal-bottom::after { height: 36px; }
}

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cards .card { min-height: 130px; }

/* Subtle decorative icons for service cards (no HTML change) */
.cards .card { position: relative; padding-top: 18px; }
.cards .card::before {
  content: ""; position: absolute; right: 12px; top: 12px; width: 48px; height: 48px; opacity: .18; filter: drop-shadow(0 6px 20px rgba(0,0,0,.25)); border-radius: 12px;
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
.cards .card:nth-child(1)::before { background-image: url('../img/hero/beaker.svg'); }
.cards .card:nth-child(2)::before { background-image: url('../img/hero/molecule.svg'); }
.cards .card:nth-child(3)::before { background-image: url('../img/hero/globe-trade.svg'); }
.cards .card:nth-child(4)::before { background-image: url('../img/hero/capsule.svg'); }

/* Stats strip */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { background: var(--panel); border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow); }
.stat .num { font-size: clamp(28px, 5vw, 40px); font-weight: 800; letter-spacing: .02em; background: linear-gradient(135deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .label { color: var(--muted); margin-top: 6px; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { background: var(--panel); border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius); padding: 16px; position: relative; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; top: -12px; left: -12px; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--brand)); color: #001018; display: grid; place-items: center; font-weight: 700; box-shadow: var(--shadow); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag { background: rgba(255,255,255,.06); color: var(--text); border: 1px solid rgba(255,255,255,.09); border-radius: 999px; padding: 6px 10px; font-size: .95rem; }

.note { color: var(--muted); font-size: .95rem; }

.site-footer { border-top: 1px solid rgba(255,255,255,.06); padding: 28px 0; color: var(--muted); }
.text-link { color: var(--brand); text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* Responsiveness */
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  /* Header alignment so mobile lang sits immediately left of hamburger */
  .nav { justify-content: flex-start; }
  /* Push the lang switch to the far right; hamburger follows with tiny gap */
  .lang-switch--mobile { display: inline-flex; height: 24px; padding: 0 6px; font-size: .75rem; gap: 4px; margin-left: auto; }
  .nav .nav-toggle { margin-left: 6px; }
  .lang-switch--mobile .flag { height: 10px; width: auto; }
  /* Hide desktop lang button inside the panel on mobile */
  .primary-nav .lang-switch { display: none; }
  .primary-nav { position: absolute; inset: 64px 0 auto 0; background: rgba(11,15,20,.95); border-bottom: 1px solid rgba(255,255,255,.06); transform: translateY(-12px); opacity: 0; pointer-events: none; transition: transform .2s ease, opacity .2s ease; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 14px; border-radius: 0 0 12px 12px; }
  .primary-nav.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  /* Vertical list, light separators */
  .primary-nav ul { display: flex; flex-direction: column; gap: 0; padding: 0; margin: 0; overflow: visible; border-top: 1px solid rgba(255,255,255,.06); }
  .primary-nav ul li { list-style: none; }
  .primary-nav ul li + li { border-top: 1px solid rgba(255,255,255,.06); }
  .primary-nav ul::-webkit-scrollbar { display: none; }
  .primary-nav a { display: block; width: 100%; font-size: .95rem; padding: 12px 6px; border-radius: 6px; background: transparent; border: 0; }
  .primary-nav .nav-cta { display: block; width: 100%; font-size: .95rem; padding: 12px 14px; letter-spacing: .2px; margin-top: 8px; }
  .lang-switch .flag { height: 12px; width: auto; }
  /* Ensure RTL also stacks vertically on mobile */
  .rtl .primary-nav ul { flex-direction: column !important; }
  .nav-toggle { display: inline-block; }
  .hero-visual { grid-template-columns: 1fr; }
  .hero-centered { padding: 72px 0; }
  .hero-centered .hero-bg .row .tile { width: 120px; height: 120px; }
  .stats { grid-template-columns: 1fr; }
  /* Hide diagonal separators on small screens to avoid overlap artifacts */
  .diagonal-top::before, .diagonal-bottom::after { display: none; }
}

/* (highlights removed) */

/* Focus visible */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Forms */
form { display: grid; gap: 14px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.field { display: grid; gap: 8px; }
input[type="text"], input[type="email"], textarea { width: 100%; padding: 12px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.04); color: var(--text); }
textarea { min-height: 140px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 720px) { .form-row { grid-template-columns: 1fr; } }
.helper { color: var(--muted); font-size: .95rem; }
.error { color: var(--err); font-size: .95rem; }
/* Form card wrapper */
.form-card { max-width: 720px; margin: 0 auto; }
.form-actions { display: flex; gap: 10px; }

/* CTA band */
.cta-band { background: linear-gradient(135deg, rgba(62,166,255,.18), rgba(108,255,200,.14)); border-top: 1px solid rgba(255,255,255,.06); border-bottom: 1px solid rgba(255,255,255,.06); }
.cta-band .inner { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; align-items: center; }
.cta-band h3 { margin: 0 0 6px; font-size: clamp(20px, 3vw, 28px); }
.cta-band p { margin: 0; color: var(--muted); }
.cta-actions { display: flex; gap: 12px; justify-content: flex-end; align-items: center; }
.social-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06); }
.social-link:hover { background: rgba(255,255,255,.1); }
.icon-24 { width: 20px; height: 20px; display: inline-block; }

/* utilities */
.mt-20 { margin-top: 20px; }
/* i18n helpers */
.intl-ar-only { display: none; }
body.rtl .intl-ar-only { display: block; }
body.rtl h3[data-i18n="services.due"] + p { display: none; }

/* RTL adjustments */
/* Activate RTL text, but keep scrollbars on the right */
.rtl { direction: rtl; }
body.rtl { direction: ltr; }
/* Make content read RTL inside standard containers */
.rtl .container { direction: rtl; }
/* Keep header layout LTR so the nav stays on the right */
.rtl .nav { direction: ltr; }
/* But render nav text RTL for Arabic */
.rtl .primary-nav { direction: rtl; }
.rtl .primary-nav ul { flex-direction: row; }
.rtl .cta-row { flex-direction: row-reverse; }
.rtl .steps li::before { left: auto; right: -12px; }

/* Mobile refinements */
.cta-actions { flex-wrap: wrap; }
@media (max-width: 720px) {
  .section { padding: 40px 0; }
  .hero-centered { padding: 56px 0; }
  .hero-centered .hero-container .lead { font-size: 1rem; }
  .brand-title { font-size: clamp(32px, 9vw, 64px); letter-spacing: .06em; }
  .cards { grid-template-columns: 1fr; }
  .cta-band .inner { grid-template-columns: 1fr; gap: 12px; }
  .cta-actions { justify-content: flex-start; }
}

/* Mobile nav overrides: unify Contact and improve language position */
@media (max-width: 720px) {
  /* Make Contact Us look like other links */
  .primary-nav .nav-cta {
    background: transparent;
    border: 0;
    text-transform: none;
    font-weight: inherit;
    color: var(--muted);
    padding: 12px 6px;
    letter-spacing: 0;
    margin: 0;
    width: 100%;
    display: block;
  }
  /* Place language switch at the top-right of the panel */
  #lang-toggle.lang-switch {
    order: -1;
    align-self: flex-end;
    height: auto;
    padding: 6px 8px;
    font-size: .85rem;
    gap: 6px;
    width: auto;
  }
}
