/*
 * Esimarket Widgets — B2 section styles
 * Header · Footer · Hero
 *
 * All values are lifted directly from the design tokens in README §1 and
 * tailwind.config.js. NO freestyle colours or radii.
 *
 * BEM blocks:
 *   .esi-header   — sticky site header
 *   .esi-footer   — site footer
 *   .esi-hero     — landing hero section
 */

/* ============================================================
   DESIGN TOKEN VARIABLES
   (mirrors tailwind.config.js — change both together)
   ============================================================ */
:root {
  --esi-primary:       #4550e5;
  --esi-primary-tint:  #eef0fb;
  --esi-primary-mid:   #b8bdf3;
  --esi-primary-soft:  #9aa4f5;
  --esi-ink:           #171b2e;
  --esi-ink-hover:     #262b45;
  --esi-ink-border:    #3a405c;
  --esi-body:          #3c4258;
  --esi-body-light:    #5b6178;
  --esi-muted:         #7a8099;
  --esi-muted-2:       #8a90ad;
  --esi-page:          #f7f8fc;
  --esi-card:          #ffffff;
  --esi-chip:          #f2f3fa;
  --esi-line:          #e8eaf3;
  --esi-line-input:    #dde1f0;
  --esi-line-chip:     #e3e6f2;
  --esi-success:       #22b07d;
  --esi-success-tint:  #e9f8f1;
  --esi-mint:          #5fe0b5;
  --esi-telegram:      #2aa5e0;
  --esi-telegram-tint: #eaf5fc;

  --esi-r-btn:         11px;
  --esi-r-field:       12px;
  --esi-r-card:        14px;
  --esi-r-card-md:     16px;
  --esi-r-card-lg:     18px;
  --esi-r-card-xl:     20px;
  --esi-r-panel:       22px;
  --esi-r-hero:        28px;
  --esi-r-pill:        99px;

  --esi-shadow-card:   0 10px 26px -14px rgba(69,80,229,.35);
  --esi-shadow-search: 0 12px 34px -18px rgba(69,80,229,.35);
  --esi-shadow-sheet:  0 30px 44px -24px rgba(23,27,46,.35);
  --esi-shadow-dropdown: 0 20px 44px -18px rgba(23,27,46,.25);

  --esi-font: IRANSans, IRANSansX, Vazirmatn, system-ui, sans-serif;
  --esi-font-mono: ui-monospace, monospace;

  /* Single breakpoint: 760 px */
  --esi-bp: 760px;
}

/* ============================================================
   KEYFRAMES  (same as standalone + tailwind.config.js)
   ============================================================ */
@keyframes em-caret {
  0%,49%  { opacity: 1; }
  50%,100%{ opacity: 0; }
}
@keyframes em-spin {
  to { transform: rotate(360deg); }
}
@keyframes em-pop {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ============================================================
   HEADER
   ============================================================ */
.esi-header-widget {
  font-family: var(--esi-font);
  direction: rtl;
}

/* Sticky bar */
.esi-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 48px;
  height: 64px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--esi-line);
}

/* Logo lockup */
.esi-header__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.esi-header__logo img,
.esi-header__logo svg {
  flex-shrink: 0;
}
.esi-header__wordmark {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.esi-header__name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--esi-ink);
  line-height: 1.2;
}
.esi-header__domain {
  font-size: 9.5px;
  color: var(--esi-muted-2);
  letter-spacing: 1.5px;
  font-family: var(--esi-font-mono);
  line-height: 1;
}

/* Desktop nav */
.esi-header__nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}
.esi-header__nav-link {
  background: transparent;
  color: var(--esi-body);
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.esi-header__nav-link:hover,
.esi-header__nav-link.is-active {
  background: var(--esi-primary-tint);
  color: var(--esi-primary);
}

/* Actions (auth + hamburger) */
.esi-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.esi-header__auth {
  display: flex;
  align-items: center;
  gap: 10px;
}
.esi-header__btn-login {
  background: transparent;
  border: none;
  font-size: 14px;
  color: var(--esi-primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  padding: 4px 0;
  font-family: var(--esi-font);
}
.esi-header__btn-signup {
  background: var(--esi-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--esi-r-field);  /* 12px from tokens */
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--esi-font);
  transition: opacity .15s;
}
.esi-header__btn-signup:hover {
  opacity: .88;
  color: #fff;
}

/* Hamburger button */
.esi-header__hamburger {
  background: #fff;
  border: 1.5px solid var(--esi-line-input);
  border-radius: 10px;
  width: 42px;
  height: 42px;
  display: none;          /* shown on mobile via media query */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--esi-ink);
  padding: 0;
}

/* Mobile sheet */
.esi-header__sheet {
  position: fixed;
  top: 63px;
  left: 0;
  right: 0;
  z-index: 49;
  background: #fff;
  border-bottom: 1px solid var(--esi-line);
  box-shadow: var(--esi-shadow-sheet);
  padding: 6px 16px 18px;
  display: flex;
  flex-direction: column;
  animation: em-pop .2s ease;
}
.esi-header__sheet-link {
  background: none;
  border: none;
  text-align: right;
  padding: 13px 8px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--esi-ink);
  border-bottom: 1px solid var(--esi-chip);
  cursor: pointer;
  text-decoration: none;
  font-family: var(--esi-font);
  display: block;
}
.esi-header__sheet-link:hover {
  color: var(--esi-primary);
}
.esi-header__sheet-auth {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.esi-header__sheet-btn {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  padding: 13px;
  border-radius: var(--esi-r-btn);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-family: var(--esi-font);
}
.esi-header__sheet-btn--outline {
  background: #fff;
  color: var(--esi-primary);
  border: 1.5px solid var(--esi-line-input);
}
.esi-header__sheet-btn--primary {
  background: var(--esi-primary);
  color: #fff;
  border: none;
}

/* Alpine transition helpers for the sheet */
.esi-sheet-enter        { transition: opacity .2s ease, transform .2s ease; }
.esi-sheet-enter-start  { opacity: 0; transform: translateY(-8px); }
.esi-sheet-enter-end    { opacity: 1; transform: translateY(0); }
.esi-sheet-leave        { transition: opacity .15s ease, transform .15s ease; }
.esi-sheet-leave-start  { opacity: 1; transform: translateY(0); }
.esi-sheet-leave-end    { opacity: 0; transform: translateY(-8px); }

/* ---- Responsive: below 760 px ---- */
@media (max-width: 759px) {
  .esi-header {
    padding: 0 16px;
  }
  .esi-header__nav,
  .esi-header__auth {
    display: none;
  }
  .esi-header__hamburger {
    display: flex;
  }
}


/* ============================================================
   FOOTER
   ============================================================ */
.esi-footer {
  border-top: 1px solid var(--esi-line);
  background: #fff;
  padding: 56px 48px 32px;
  font-family: var(--esi-font);
  direction: rtl;
}

.esi-footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 36px;
  max-width: 1240px;
  margin: 0 auto;
}

/* Brand column */
.esi-footer__col--brand {}

.esi-footer__logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.esi-footer__brand-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--esi-ink);
}
.esi-footer__desc {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: var(--esi-muted);
  line-height: 2.1;
  max-width: 280px;
}
.esi-footer__tg-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--esi-telegram-tint);
  color: var(--esi-telegram);
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
}
.esi-footer__tg-chip:hover { opacity: .85; color: var(--esi-telegram); }
.esi-footer__tg-handle {
  font-family: var(--esi-font-mono);
  font-size: 11.5px;
}

/* Link columns */
.esi-footer__col-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--esi-ink);
  margin-bottom: 14px;
}
.esi-footer__link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.esi-footer__link {
  font-size: 12.5px;
  color: var(--esi-muted);
  text-decoration: none;
}
.esi-footer__link:hover { color: var(--esi-primary); }

/* App store column */
.esi-footer__app-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 190px;
}
.esi-footer__app-btn {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--esi-ink);
  color: #fff;
  border-radius: 11px;
  padding: 9px 18px;
  text-decoration: none;
  transition: opacity .15s;
}
.esi-footer__app-btn:hover { opacity: .85; color: #fff; }
.esi-footer__app-sub {
  font-size: 10px;
  color: var(--esi-muted-2);
}
.esi-footer__app-store {
  font-size: 13.5px;
  font-weight: 800;
}

/* Bottom bar */
.esi-footer__bottom {
  max-width: 1240px;
  margin: 28px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--esi-chip);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--esi-muted-2);
  flex-wrap: wrap;
  gap: 10px;
}
.esi-footer__email {
  font-family: var(--esi-font-mono);
  font-size: 11px;
}

/* ---- Responsive ---- */
@media (max-width: 759px) {
  .esi-footer {
    padding: 36px 20px 24px;
  }
  .esi-footer__inner {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .esi-footer__desc { max-width: 100%; }
  .esi-footer__app-btns { max-width: 100%; flex-direction: row; }
}


/* ============================================================
   HERO
   ============================================================ */
.esi-hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 44px;
  align-items: center;
  padding: 56px 48px 64px;
  background: linear-gradient(180deg, #ffffff 0%, var(--esi-page) 100%);
  font-family: var(--esi-font);
  direction: rtl;
}

/* ---- Copy column ---- */
.esi-hero__copy {}

/* Eyebrow pill */
.esi-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--esi-primary-tint);
  color: var(--esi-primary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: var(--esi-r-pill);
  margin-bottom: 22px;
}
.esi-hero__eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--esi-success);
  flex-shrink: 0;
}

/* H1 */
.esi-hero__h1 {
  margin: 0 0 14px;
  font-size: 44px;
  font-weight: 900;
  line-height: 1.4;
  color: var(--esi-ink);
}

/* Subheadline */
.esi-hero__sub {
  margin: 0 0 32px;
  max-width: 480px;
  font-size: 16px;
  line-height: 2;
  color: var(--esi-body-light);
}

/* Search box */
.esi-hero__search-wrap {
  position: relative;
  max-width: 520px;
}
.esi-hero__search-box {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid var(--esi-line-input);
  border-radius: var(--esi-r-card-md);
  padding: 8px;
  box-shadow: var(--esi-shadow-search);
  transition: border-color .15s, box-shadow .15s;
}
.esi-hero__search-box:focus-within {
  border-color: var(--esi-primary-mid);
  box-shadow: var(--esi-shadow-search), 0 0 0 2px rgba(184,189,243,.3);
}
.esi-hero__search-icon {
  display: flex;
  align-items: center;
  padding: 0 14px;
  flex-shrink: 0;
}
.esi-hero__input-wrap {
  position: relative;
  flex: 1;
}
.esi-hero__input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--esi-ink);
  padding: 6px 0;
  text-align: right;
  font-family: var(--esi-font);
  outline: none;
}
.esi-hero__input::-webkit-search-cancel-button { display: none; }
.esi-hero__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
  font-size: 15px;
  color: var(--esi-muted);
  white-space: nowrap;
  overflow: hidden;
}
.esi-hero__typed {
  color: var(--esi-primary);
  font-weight: 700;
  margin-right: 5px;
}
.esi-hero__caret {
  display: inline-block;
  width: 2px;
  height: 15px;
  background: var(--esi-primary);
  margin-right: 3px;
  animation: em-caret 1s steps(2) infinite;
  vertical-align: middle;
}
.esi-hero__search-btn {
  background: var(--esi-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 13px 28px;
  border-radius: var(--esi-r-btn);
  border: none;
  cursor: pointer;
  font-family: var(--esi-font);
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity .15s;
}
.esi-hero__search-btn:hover { opacity: .88; color: #fff; }

/* Dropdown */
.esi-hero__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  background: #fff;
  border: 1px solid var(--esi-line);
  border-radius: var(--esi-r-card);
  box-shadow: var(--esi-shadow-dropdown);
  overflow: hidden;
  z-index: 20;
  animation: em-pop .2s ease;
}
.esi-hero__result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--esi-chip);
}
.esi-hero__result-row:last-child { border-bottom: none; }
.esi-hero__result-row:hover { background: var(--esi-page); }
.esi-hero__result-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}
.esi-hero__result-flag { font-size: 20px; }
.esi-hero__result-name { color: var(--esi-ink); }
.esi-hero__result-name--primary { color: var(--esi-primary); }
.esi-hero__result-price {
  font-size: 12px;
  color: var(--esi-muted);
}

/* Alpine pop transition */
.esi-pop-enter        { transition: opacity .2s ease, transform .2s ease; }
.esi-pop-enter-start  { opacity: 0; transform: translateY(6px); }
.esi-pop-enter-end    { opacity: 1; transform: translateY(0); }

/* Quick chips — now <button> elements that drive the slide */
.esi-hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.esi-hero__chip {
  background: #fff;
  border: 1.5px solid var(--esi-line-chip);
  border-radius: var(--esi-r-pill);
  padding: 8px 18px;
  color: var(--esi-body);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--esi-font);
  transition: background .15s, border-color .15s, color .15s;
}
.esi-hero__chip:hover,
.esi-hero__chip.is-active {
  background: var(--esi-primary-tint);
  border-color: var(--esi-primary);
  color: var(--esi-primary);
}

/* ---- Stack column ---- */
.esi-hero__stack-wrap {
  position: relative;
}
/* Outer box: clips the slides + anchors floating cards */
.esi-hero__stack-outer {
  position: relative;
  height: 400px;
  border-radius: var(--esi-r-hero);
  overflow: visible; /* float cards extend outside */
}

/* 3-D perspective container — matches Hero.tsx [perspective:1400px] */
.esi-hero__stack {
  position: absolute;
  inset: 0;
  border-radius: var(--esi-r-hero);
  overflow: hidden;
  border: 1px solid var(--esi-line-input);
  perspective: 1400px;
}

/* Individual slides */
.esi-hero__slide {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--esi-primary) 0%, var(--esi-ink) 100%);
  background-size: cover;
  background-position: center;
  transform-origin: left center;
  /* off-screen: slid right + rotated — mirrors Hero.tsx translateX(115%) rotateY(9deg) */
  transform: translateX(115%) rotateY(9deg);
  transition: none;
  z-index: 1;
  pointer-events: none;
}
.esi-hero__slide.is-prev {
  transform: translateX(0%) rotateY(0deg);
  transition: none;
  z-index: 2;
  box-shadow: none;
  pointer-events: none;
}
.esi-hero__slide.is-active {
  transform: translateX(0%) rotateY(0deg);
  transition: transform 1s cubic-bezier(.25,.6,.25,1);
  z-index: 3;
  box-shadow: -26px 0 46px rgba(23,27,46,.28);
  pointer-events: auto;
}

/* Floating overlay card — top-left, white, rotate-3 */
.esi-hero__float-card {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  border-radius: var(--esi-r-card-md);
  transition: opacity 450ms ease-in-out;
}
.esi-hero__float-card--light {
  top: 26px;
  left: 26px;
  background: #fff;
  border: 1px solid var(--esi-line);
  box-shadow: 0 8px 24px rgba(23,27,46,.12);
  padding: 14px 18px;
  transform: rotate(3deg);
}
.esi-hero__float-city {
  font-size: 11px;
  color: var(--esi-muted);
  margin-bottom: 4px;
}
.esi-hero__float-status {
  font-size: 15px;
  font-weight: 900;
  color: var(--esi-ink);
  white-space: nowrap;
}
.esi-hero__float-speed {
  color: var(--esi-success);
  white-space: nowrap;
}

/* Floating overlay card — bottom-right, dark, -rotate-3 */
.esi-hero__float-card--dark {
  bottom: -18px;
  right: 30px;
  background: var(--esi-ink);
  box-shadow: 0 8px 28px rgba(23,27,46,.35);
  padding: 14px 20px;
  transform: rotate(-3deg);
  color: #fff;
}
.esi-hero__float-region {
  font-size: 11px;
  color: var(--esi-primary-soft);
  margin-bottom: 3px;
}
.esi-hero__float-plan {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

/* ---- Responsive hero ---- */
@media (max-width: 759px) {
  .esi-hero {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 32px 20px 48px;
  }
  .esi-hero__h1 { font-size: 30px; }
  .esi-hero__sub { font-size: 14px; max-width: 100%; margin-bottom: 24px; }
  .esi-hero__search-wrap { max-width: 100%; }
  .esi-hero__stack-wrap { order: -1; }
  .esi-hero__stack-outer { height: 260px; }
  .esi-hero__float-card--light { top: 16px; left: 16px; padding: 10px 14px; }
  .esi-hero__float-card--dark  { bottom: -14px; right: 20px; padding: 10px 16px; }
}

