/* ============================================================
   BALGINI — home: header, hero, carousels, banner, footer, tabbar
   ============================================================ */

/* ---------- header ---------- */

.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.header__inner {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.header__left {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-self: start;
}

.header__center {
  justify-self: center;
}

.header__right {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-self: end;
}

.header__logo {
  display: inline-flex;
  align-items: center;
  height: 42px;
  transition: opacity var(--dur) var(--ease);
}

.header__logo img {
  display: block;
  height: 100%;
  width: auto;
}

.header__logo:hover {
  opacity: 0.7;
}

.header__logo--mark {
  display: none;
  height: 36px;
}

.header__logo--mark img {
  height: 36px;
}

/* state: scrolled / solid */
.header.is-solid {
  background: var(--surface);
  border-bottom-color: var(--border);
}

.header.is-solid .header__logo--word {
  display: none;
}

.header.is-solid .header__logo--mark {
  display: inline-flex;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  height: 100vh;
  min-height: 560px;
  overflow: hidden;
}

.hero__track {
  display: flex;
  height: 100%;
  transition: transform 0.62s var(--ease);
}

.hero__slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.hero__media {
  position: relative;
  overflow: hidden;
  background: var(--surface-alt);
}

.hero__slide--left .hero__media {
  order: 2;
}

.hero__slide--left .hero__caption {
  order: 1;
}

.hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  transform: scale(1.04);
  transition: transform 1.1s var(--ease);
}

.hero__slide.is-active .hero__img {
  transform: scale(1);
}

.hero__caption {
  display: flex;
  align-items: center;
  padding: calc(var(--header-h) + 40px) clamp(40px, 7vw, 120px) 80px;
  background: var(--bg);
}

.hero__caption-inner {
  max-width: 420px;
}

.hero__title {
  margin: 18px 0 22px;
  color: var(--text);
}

.hero__progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.hero__progress-line {
  position: relative;
  width: 64px;
  height: 1px;
  background: var(--border-strong);
  overflow: hidden;
}

.hero__progress-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-100%);
  transition: transform 0.62s var(--ease);
}

.hero__slide.is-active .hero__progress-line::after {
  transform: translateX(0);
}

.hero__progress-count {
  font-size: var(--fs-small);
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.hero__dots {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero__dot {
  width: 10px;
  height: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.hero__dot.is-active {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.15);
}

.hero__arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 46px;
  height: 46px;
  margin-top: -23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  backdrop-filter: blur(4px);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.hero__arrow:hover {
  background: var(--surface);
  color: var(--accent);
}

.hero__arrow--prev {
  right: calc(50% + 18px);
}

.hero__arrow--next {
  left: calc(50% + 18px);
}

/* ---------- carousels ---------- */

.rail {
  position: relative;
}

.rail__head {
  padding: 0 var(--gutter);
  max-width: var(--container);
  margin: 0 auto 26px;
}

.rail__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rail__arrow {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
}

.rail__arrow:hover:not(:disabled) {
  border-color: var(--text);
  color: var(--accent);
}

.rail__arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.rail__viewport {
  overflow: hidden;
}

.rail__track {
  display: flex;
  gap: 16px;
  padding: 0 var(--gutter);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rail__track::-webkit-scrollbar {
  display: none;
}

/* product card — placeholder for now */
.card {
  position: relative;
  flex: 0 0 clamp(260px, 30vw, 380px);
  scroll-snap-align: start;
}

/* standalone card in a normal block flow (not a rail) */
.card--feature {
  flex: none;
  width: min(100%, 400px);
}

.card__media {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}

.card__body {
  padding: 14px 2px 0;
}

.card__title {
  font-size: var(--fs-base);
  line-height: 1.4;
}

.card__price {
  margin-top: 6px;
  font-size: var(--fs-base);
  color: var(--text-muted);
}

/* story card — placeholder */
.story {
  position: relative;
  flex: 0 0 clamp(240px, 26vw, 330px);
  aspect-ratio: 4 / 5;
  scroll-snap-align: start;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.story__caption {
  width: 100%;
  padding: 22px;
  background: linear-gradient(to top, rgba(23, 18, 15, 0.5), rgba(23, 18, 15, 0));
  color: #fff;
}

.story__title {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.2;
}

/* ---------- banner ---------- */

.banner {
  position: relative;
  margin-top: 96px;
  height: min(78vh, 720px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.banner__inner {
  padding: 0 var(--gutter);
  max-width: 640px;
}

.banner__title {
  margin: 16px 0 20px;
}

/* ---------- footer ---------- */

.footer {
  margin-top: 96px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.footer__cols {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 48px;
  padding: 72px var(--gutter) 56px;
  max-width: var(--container);
  margin: 0 auto;
}

.footer__logo {
  height: 54px;
  width: auto;
  margin-bottom: 18px;
}

.footer__tagline {
  max-width: 280px;
  font-size: var(--fs-base);
  color: var(--text-muted);
}

.footer__socials {
  display: flex;
  gap: 6px;
  margin-top: 22px;
}

.footer__title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.footer__links li + li {
  margin-top: 11px;
}

.footer__links a {
  font-size: var(--fs-base);
  color: var(--text);
  transition: color var(--dur) var(--ease);
}

.footer__links a:hover {
  color: var(--accent);
}

.footer__form {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.footer__form .field {
  flex: 1 1 auto;
  min-height: 48px;
  padding-top: 16px;
}

.footer__form .btn {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 20px;
}

.footer__note {
  margin-top: 12px;
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px var(--gutter);
  max-width: var(--container);
  margin: 0 auto;
  border-top: 1px solid var(--border);
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.footer__lang {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer__lang button {
  font-size: var(--fs-small);
  color: var(--text-muted);
  transition: color var(--dur) var(--ease);
}

.footer__lang button.is-active {
  color: var(--text);
  font-weight: 500;
}

/* ---------- mobile tabbar ---------- */

.tabbar {
  display: none;
}

/* ============================================================
   responsive
   ============================================================ */

@media (max-width: 1024px) {
  /* header switches to mark + tabbar */
  .header {
    background: var(--surface);
    border-bottom-color: var(--border);
  }

  .header__logo--word {
    display: none;
  }

  .header__logo--mark {
    display: inline-flex;
  }

  .header__logo {
    height: 34px;
  }

  .header__logo--mark,
  .header__logo--mark img {
    height: 32px;
  }

  .header .icon-btn[data-optional] {
    display: none;
  }

  /* hero: photo on top (60%), caption below */
  .hero {
    height: auto;
    min-height: 0;
    padding-top: var(--header-h);
  }

  .hero__track {
    display: block;
    height: auto;
    transform: none !important;
  }

  .hero__slide {
    display: none;
    grid-template-columns: none;
    height: auto;
  }

  .hero__slide.is-active {
    display: block;
  }

  .hero__slide--left .hero__media,
  .hero__slide--left .hero__caption {
    order: 0;
  }

  .hero__media {
    height: 60vh;
    min-height: 380px;
  }

  .hero__caption {
    padding: 30px var(--gutter) 34px;
  }

  .hero__caption-inner {
    max-width: none;
  }

  .hero__title {
    margin: 12px 0 18px;
  }

  .hero__dots {
    left: auto;
    right: 16px;
    top: calc(var(--header-h) + 28px);
    transform: none;
    flex-direction: row;
  }

  .hero__arrow {
    display: none;
  }

  /* rails: peek next card */
  .card {
    flex-basis: 72vw;
  }

  .story {
    flex-basis: 62vw;
  }

  .banner {
    margin-top: 52px;
    height: 62vh;
  }

  .footer__cols {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 48px var(--gutter) 40px;
  }

  .footer {
    margin-top: 52px;
    padding-bottom: calc(var(--tabbar-h) + 8px);
  }

  .footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* tabbar */
  .tabbar {
    position: fixed;
    inset: auto 0 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    height: var(--tabbar-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
  }

  .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    color: var(--text-muted);
    font-size: 9px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .tab--logo .tab__logo {
    height: 26px;
    width: auto;
  }

  .tab.is-active {
    color: var(--text);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}