/* ==========================================================================
   Arianmehr (AMGOB) — shared stylesheet
   Serves BOTH index-en.html (LTR) and index-fa.html (RTL).

   Design notes
   -----------
   • All spacing, line-heights and font-size metrics are defined ONCE here
     and are identical in both languages (fonts differ, metrics do not).
   • Mirroring is done with CSS logical properties (inset-inline-*,
     margin-inline-*, padding-inline-*, text-align: start/end), so the same
     rules automatically flip for dir="rtl".
   • Palette derived from the logo:
       blue  #223f99 (main)   red #ff0000 (accent, used sparingly)
       grey  #a5a5a5 (stylized name image)
   ========================================================================== */

/* ---------- 1. Design tokens & reset ------------------------------------ */
:root{
  /* brand palette */
  --blue:#223f99;          /* main blue of the logo            */
  --blue-dark:#1a2f78;     /* hover / darker surfaces          */
  --blue-darker:#101c4d;   /* footer background                */
  --red:#ff0000;           /* accent red from the logo         */
  --red-dark:#d60000;      /* red hover                        */

  /* neutrals */
  --ink:#2c3140;           /* primary text                     */
  --body-2:#4c5266;        /* secondary paragraph text         */
  --muted:#7b8296;         /* captions, sub-links              */
  --line:#e5e8f0;          /* hairlines / borders              */
  --bg-soft:#f6f7fb;       /* alternating section background   */
  --white:#ffffff;

  /* shared spacing scale — identical in EN and FA */
  --sp-1:4px;  --sp-2:8px;  --sp-3:16px; --sp-4:24px;
  --sp-5:32px; --sp-6:48px; --sp-7:72px;

  /* shared metrics — identical in EN and FA */
  --nav-h:64px;            /* sticky nav bar height            */
  --lh-body:1.8;           /* body line-height                 */
  --lh-head:1.3;           /* heading line-height              */
  --radius:6px;
  --shadow-sm:0 2px 8px rgba(16,28,77,.08);
  --shadow-md:0 10px 28px rgba(16,28,77,.14);
}

*{margin:0;padding:0;box-sizing:border-box}

html{
  font-size:16px; /* fixed base size for both languages */
  scroll-behavior:smooth;
  scroll-padding-top:calc(var(--nav-h) + var(--sp-2)); /* anchors clear the sticky nav */
}

body{
  color:var(--ink);
  line-height:var(--lh-body);
  background:var(--white);
  -webkit-font-smoothing:antialiased;
}

/* Fonts per direction — sizes & line-heights stay identical */
[dir="ltr"] body{font-family:'Inter','Segoe UI',Tahoma,Arial,sans-serif}
[dir="rtl"] body{font-family:'Vazirmatn','Segoe UI',Tahoma,Arial,sans-serif}

img{max-width:100%;display:block}
a{color:inherit;text-decoration:none}
ul,ol{list-style:none}
h1,h2,h3,h4{line-height:var(--lh-head);font-weight:700;color:var(--blue)}
button{font:inherit;cursor:pointer}

:focus-visible{outline:2px solid var(--red);outline-offset:2px}
::selection{background:var(--blue);color:#fff}

/* ---------- 2. Layout utilities ------------------------------------------ */
.container{max-width:1200px;margin-inline:auto;padding-inline:var(--sp-4)}
.section{padding-block:var(--sp-7)}
.section--soft{background:var(--bg-soft)}

.section-head{
  display:flex;flex-direction:column;align-items:center;text-align:center;
  gap:var(--sp-3);margin-bottom:var(--sp-6);
}
.section-head h2{font-size:2rem}
.section-head p{color:var(--muted);max-width:64ch;font-size:1.05rem}

/* small red accent bar (echoes the red in the logo) */
.accent-bar{display:inline-block;width:56px;height:3px;background:var(--red);border-radius:2px}

/* buttons */
.btn{
  display:inline-block;padding:12px 28px;border-radius:var(--radius);
  font-weight:600;font-size:.95rem;line-height:1.4;border:1px solid transparent;
  transition:background .2s,color .2s,border-color .2s,transform .2s;
}
.btn:hover{transform:translateY(-2px)}
.btn-red{background:var(--red);color:#fff}
.btn-red:hover{background:var(--red-dark)}
.btn-ghost{border-color:rgba(255,255,255,.65);color:#fff}
.btn-ghost:hover{background:#fff;color:var(--blue)}

/* ---------- 3. Top bar : solid-white logo / name / slogan strip ---------- */
.topbar{background:var(--white);border-bottom:1px solid var(--line)}
.topbar .container{
  display:flex;align-items:center;gap:var(--sp-5);
  padding-block:var(--sp-4); /* same vertical rhythm in both languages */
}
.brand-logo{flex:0 0 auto;line-height:0}
.brand-logo img{width:150px;height:150px}   /* exact 150×150 logo slot */
.brand-text{display:flex;flex-direction:column;justify-content:center;gap:var(--sp-2)}
.brand-name{height:auto;width:auto;max-width:340px} /* stylized name PNG (600×250) */
.brand-slogan{color:var(--muted);font-size:1rem;line-height:var(--lh-body);text-align:start}

/* ---------- 4. Sticky horizontal nav bar --------------------------------- */
.navbar{
  position:sticky;top:0;z-index:1000;
  background:var(--blue);
  transition:box-shadow .2s;
}
.navbar.is-stuck{box-shadow:0 4px 16px rgba(16,28,77,.35)}
.nav-inner{display:flex;align-items:center;height:var(--nav-h)}

.nav-menu{display:flex;align-items:center;gap:var(--sp-1)}
.nav-item{position:relative}
.nav-link{
  display:block;padding-inline:var(--sp-4);
  line-height:var(--nav-h); /* full-height hit area, identical both langs */
  color:#fff;font-weight:500;font-size:.98rem;white-space:nowrap;
  position:relative;
}
/* red underline on hover / active (brand accent) */
.nav-link::after{
  content:"";position:absolute;bottom:0;inset-inline-start:var(--sp-4);
  width:calc(100% - 2*var(--sp-4));height:3px;background:var(--red);
  transform:scaleX(0);transition:transform .2s;
}
.nav-link:hover::after,
.nav-item.active>.nav-link::after{transform:scaleX(1)}

/* caret (CSS triangle — direction independent, points down in both) */
.nav-caret{
  display:inline-block;width:0;height:0;margin-inline-start:6px;vertical-align:middle;
  border-left:5px solid transparent;border-right:5px solid transparent;
  border-top:5px solid currentColor;transition:transform .2s;
}

/* Products mega-dropdown : opens on hover (desktop) / tap (touch) */
.dropdown{
  position:absolute;top:100%;
  left:50%; /* physical centering → identical geometry in LTR & RTL */
  transform:translateX(-50%) translateY(8px);
  min-width:640px;max-width:min(720px,92vw);
  background:#fff;border-top:3px solid var(--red);border-radius:0 0 var(--radius) var(--radius);
  box-shadow:var(--shadow-md);padding:var(--sp-4) var(--sp-5);
  display:flex;gap:var(--sp-5);
  opacity:0;visibility:hidden;
  transition:opacity .2s,transform .2s,visibility .2s;
}
.nav-item:hover>.dropdown,
.nav-item:focus-within>.dropdown,
.nav-item.open>.dropdown{
  opacity:1;visibility:visible;
  transform:translateX(-50%) translateY(0);
}

.dd-col{flex:1;min-width:0}
.dd-col h4{font-size:1rem;color:var(--blue);margin-bottom:var(--sp-2);padding-bottom:var(--sp-2);border-bottom:1px solid var(--line)}
.dd-sub a{
  display:block;font-size:.8rem; /* smaller gray sub-links, per spec */
  color:var(--muted);padding-block:3px;line-height:1.5;
}
.dd-sub a:hover{color:var(--blue)}

/* language switch — pushed to the inline-end of the nav bar */
.lang-switch{margin-inline-start:auto;display:flex;align-items:center;height:var(--nav-h)}
.lang-btn{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:52px;height:36px;padding-inline:14px;
  border:1px solid rgba(255,255,255,.7);border-radius:999px;
  color:#fff;font-weight:700;font-size:.85rem;letter-spacing:.08em;
  transition:background .2s,color .2s,border-color .2s;
}
.lang-btn:hover{background:#fff;color:var(--blue);border-color:#fff}
[dir="rtl"] .lang-btn{letter-spacing:0} /* no letter-spacing for Persian */

/* hamburger (mobile only) */
.nav-toggle{
  display:none;background:none;border:0;width:44px;height:44px;position:relative;z-index:1100;
}
.nav-toggle span{
  display:block;width:24px;height:2px;background:#fff;margin-block:5px;
  transition:transform .3s,opacity .3s;
}

/* ---------- 5. Hero / banner --------------------------------------------- */
.hero{
  position:relative;overflow:hidden;color:#fff;padding-block:var(--sp-7);
  background:linear-gradient(135deg,var(--blue) 0%,var(--blue-dark) 55%,var(--blue-darker) 100%);
}
.hero::before{
  content:"";position:absolute;inset:0;
  background:
    radial-gradient(circle at 85% 15%,rgba(255,255,255,.10),transparent 45%),
    radial-gradient(circle at 8% 95%,rgba(255,0,0,.14),transparent 40%);
}
.hero .container{position:relative;z-index:1}
.hero h1{color:#fff;font-size:2.6rem;max-width:24ch}
.hero p{margin-top:var(--sp-4);font-size:1.1rem;color:rgba(255,255,255,.85);max-width:62ch;line-height:var(--lh-body)}
.hero-actions{margin-top:var(--sp-5);display:flex;gap:var(--sp-3);flex-wrap:wrap}

/* ---------- 6. About ------------------------------------------------------ */
.about-grid{display:grid;grid-template-columns:1.15fr .85fr;gap:var(--sp-6);align-items:center}
.about-text h3{font-size:1.4rem;margin-bottom:var(--sp-4)}
.about-text p{color:var(--body-2);margin-bottom:var(--sp-3)}

.stats{display:flex;gap:var(--sp-4);margin-top:var(--sp-5)}
.stat{
  flex:1;background:#fff;border:1px solid var(--line);border-top:3px solid var(--blue);
  border-radius:var(--radius);padding:var(--sp-4) var(--sp-3);text-align:center;
}
.stat b{display:block;font-size:2rem;color:var(--blue);line-height:1.2}
.stat span{font-size:.9rem;color:var(--muted)}

/* generic image placeholder box */
.placeholder-box{
  background:linear-gradient(135deg,#eef0f7,#dfe3ee);
  border:1px dashed #c4cade;border-radius:var(--radius);
  display:flex;align-items:center;justify-content:center;
  color:var(--muted);font-size:.95rem;text-align:center;padding:var(--sp-4);
}
.about-figure{min-height:320px}
.map-placeholder{min-height:320px}

/* ---------- 7. Products --------------------------------------------------- */
.products-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:var(--sp-4)}
.product-card{
  background:#fff;border:1px solid var(--line);border-top:3px solid var(--blue);
  border-radius:var(--radius);padding:var(--sp-4);
  transition:transform .2s,box-shadow .2s;
}
.product-card:hover{transform:translateY(-4px);box-shadow:var(--shadow-md)}
.product-card h3{font-size:1.25rem;margin-bottom:var(--sp-2)}
.card-sub{display:block;font-size:.85rem;color:var(--muted);margin-bottom:var(--sp-3);line-height:var(--lh-body)}
.sub-list a{
  display:flex;align-items:center;gap:var(--sp-2);
  font-size:.85rem;color:var(--muted);padding-block:4px;
}
.sub-list a::before{
  content:"";width:6px;height:6px;border-radius:50%;
  background:#c9cedd;flex:0 0 auto;
}
.sub-list a:hover{color:var(--blue)}

/* ---------- 8. Certificates ----------------------------------------------- */
.cert-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--sp-4)}
.cert-tile{
  aspect-ratio:4/3;background:#fff;border:1px dashed #c4cade;border-radius:var(--radius);
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:var(--sp-2);color:var(--muted);text-align:center;padding:var(--sp-3);
}
.cert-badge{
  width:56px;height:56px;border-radius:50%;
  background:var(--bg-soft);border:2px solid var(--blue);
  color:var(--blue);font-weight:700;font-size:1.4rem;
  display:flex;align-items:center;justify-content:center;
}

/* ---------- 9. Contact ----------------------------------------------------- */
.contact-grid{display:grid;grid-template-columns:1fr 1fr;gap:var(--sp-6);align-items:stretch}
.contact-list li{
  display:flex;gap:var(--sp-3);align-items:center;
  padding-block:var(--sp-3);border-bottom:1px solid var(--line);
}
.contact-list li:last-child{border-bottom:0}
.contact-ico{
  width:42px;height:42px;flex:0 0 auto;border-radius:50%;
  background:rgba(34,63,153,.08);color:var(--blue);
  display:flex;align-items:center;justify-content:center;
  font-weight:700;font-size:1.05rem;
}
.contact-list b{display:block;color:var(--ink)}
.contact-list .val{color:var(--body-2);font-size:.95rem}

/* ---------- 10. Footer ------------------------------------------------------ */
.footer{background:var(--blue-darker);color:#b9c0da;font-size:.95rem}
.footer-grid{
  display:grid;grid-template-columns:1.3fr 1fr 1fr 1.2fr;
  gap:var(--sp-6);padding-block:var(--sp-7) var(--sp-6);
}
.footer h4{
  color:#fff;font-size:1rem;margin-bottom:var(--sp-3);
  position:relative;padding-bottom:var(--sp-2);
}
.footer h4::after{
  content:"";position:absolute;bottom:0;inset-inline-start:0;
  width:32px;height:2px;background:var(--red);
}
.footer p{color:#9aa3c7}
.footer li{padding-block:5px}
.footer a{color:#b9c0da}
.footer a:hover{color:#fff}

.footer-bottom{
  border-top:1px solid rgba(255,255,255,.12);
  padding-block:var(--sp-3);
  display:flex;justify-content:space-between;align-items:center;
  gap:var(--sp-3);flex-wrap:wrap;font-size:.85rem;color:#8d96bd;
}

/* ---------- 11. Responsive -------------------------------------------------- */
@media (max-width:1080px){
  .products-grid{grid-template-columns:repeat(2,1fr)}
}

@media (max-width:920px){
  /* nav collapses to a panel under the bar */
  .nav-toggle{display:block}
  .nav-menu{
    position:absolute;top:var(--nav-h);inset-inline:0;
    background:var(--blue-dark);
    flex-direction:column;align-items:stretch;
    padding-block:var(--sp-2);
    display:none;
  }
  .navbar.menu-open .nav-menu{display:flex}
  .nav-link{line-height:2.6;border-top:1px solid rgba(255,255,255,.08)}

  /* dropdown becomes an in-flow accordion */
  .dropdown{
    position:static;transform:none;opacity:1;visibility:visible;
    min-width:0;max-width:none;box-shadow:none;border-top:0;border-radius:0;
    background:rgba(0,0,0,.22);
    flex-direction:column;gap:var(--sp-3);
    padding:var(--sp-3) var(--sp-4) var(--sp-4);
    display:none;
  }
  .nav-item.open>.dropdown{display:flex}
  .dd-col h4{border-bottom-color:rgba(255,255,255,.2);color:#fff}
  .nav-item.open .nav-caret{transform:rotate(180deg)}

  /* hamburger → X */
  .navbar.menu-open .nav-toggle span:nth-child(1){transform:translateY(7px) rotate(45deg)}
  .navbar.menu-open .nav-toggle span:nth-child(2){opacity:0}
  .navbar.menu-open .nav-toggle span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}

  /* layout */
  .topbar .container{gap:var(--sp-4)}
  .brand-logo img{width:110px;height:110px}
  .brand-name{height:70px}
  .hero h1{font-size:2rem}
  .about-grid,.contact-grid{grid-template-columns:1fr}
  .cert-grid{grid-template-columns:repeat(2,1fr)}
  .footer-grid{grid-template-columns:1fr 1fr}
}

@media (max-width:560px){
  .products-grid,.cert-grid,.footer-grid{grid-template-columns:1fr}
  .brand-logo img{width:84px;height:84px}
  .brand-name{height:56px}
  .stats{flex-direction:column}
  .hero h1{font-size:1.7rem}
}

/* ---------- 12. Reduced motion --------------------------------------------- */
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *,*::before,*::after{transition:none!important}
}