/* ============================================================
   FAKHRUDDIN & SONS — MOBILE SHOP
   App-shell stylesheet. Loaded together with assets/css/style.css,
   which supplies the design tokens (:root), fonts, fabric textures
   (.swatch / .tx-*) and several components reused as-is below:
   .btn, .field, .faq*, .steps-bar, .summary, .order-card, .pill,
   .info-card, .empty-state, .pay-methods/.pay-opt, .qty,
   .auth-tabs, .pdp-facts, .sizes button.
   ------------------------------------------------------------
   01 Shell & scaffolding
   02 App bar (top)
   03 Tab bar (bottom)
   04 Section labels & rails
   05 Hero banner
   06 Category tile
   07 Product card
   08 Segmented control (Him / Her)
   09 Search
   10 Product detail
   11 Cart line
   12 Account — wishlist row
   13 Chips
   14 Responsive
   ============================================================ */

:root {
  --app-bar-h: 56px;
  --app-tab-h: 64px;
}

/* several components below set display:flex unconditionally, which — being
   an author rule — outranks the UA stylesheet's [hidden]{display:none} by
   cascade origin even at equal specificity. Restate it here so JS toggling
   .hidden always wins. */
[hidden] { display: none !important; }

/* an invisible ≥44px doughnut centred on a visually smaller icon button —
   keeps the design's exact icon sizes (32px add-circle, 36px wishlist heart,
   22px cart remove, 30px search clear) while meeting the touch tap-target
   minimum. No layout impact; the pseudo-element doesn't affect box flow. */
.tap44 { position: relative; }
.tap44::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: max(44px, 100%);
  height: max(44px, 100%);
  transform: translate(-50%, -50%);
}

/* ---------- 01 Shell & scaffolding ---------- */
.app-body {
  margin: 0;
  background: var(--linen);
  font-family: var(--sans);
  font-weight: 300;
  color: var(--ink-soft);
}

.app-shell {
  max-width: 480px;
  margin-inline: auto;
  height: 100svh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--ivory);
  position: relative;
  box-shadow: var(--shadow-lg);
}

.app-screen {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  background: var(--ivory);
  scrollbar-width: none;
}
.app-screen::-webkit-scrollbar { display: none; }
.app-screen:focus { outline: none; }

.app-pad { padding: 16px 16px 28px; }

/* ---------- 02 App bar (top) ---------- */
.app-bar {
  height: calc(var(--app-bar-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  box-sizing: border-box;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 6px;
  border-bottom: 1px solid var(--hair-soft);
  background: var(--ivory);
  position: sticky;
  top: 0;
  z-index: 30;
}
.app-bar-side {
  flex: none;
  min-width: 44px;
  display: flex;
  align-items: center;
}
.app-bar-side.is-end { justify-content: flex-end; }
.app-bar-back, .app-bar-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  transition: background .3s var(--ease);
}
.app-bar-back:active, .app-bar-icon:active,
.app-bar-back:hover, .app-bar-icon:hover { background: var(--cream); }
.app-bar-mid {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.app-bar-brand { display: flex; align-items: center; gap: 8px; }
.app-bar-brand .mark {
  width: 30px; height: 30px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: .72rem;
  color: var(--gold-deep);
  flex: none;
}
.app-bar-brand .name { font-family: var(--display); font-size: 1.05rem; color: var(--ink); white-space: nowrap; }
.app-bar-title {
  font-family: var(--display);
  font-size: 1.1rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 15px; height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--gold);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: .55rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 03 Tab bar (bottom) ---------- */
.app-tabbar {
  height: calc(var(--app-tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
  flex: none;
  display: flex;
  border-top: 1px solid var(--hair-soft);
  background: var(--ivory);
  position: sticky;
  bottom: 0;
  z-index: 30;
}
.app-tab {
  position: relative;
  flex: 1;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--ink-mute);
  cursor: pointer;
  transition: color .3s var(--ease);
}
.app-tab svg { width: 21px; height: 21px; }
.app-tab span {
  font-family: var(--sans);
  font-size: .55rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.app-tab.is-active { color: var(--gold-deep); }
.app-tab .app-badge { top: 2px; right: calc(50% - 21px); min-width: 14px; height: 14px; font-size: .5rem; }

/* ---------- 04 Section labels & rails ---------- */
.app-sec-label {
  font-size: .6rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 12px;
}
.app-rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin: 0 -16px 24px;
  padding: 0 16px 6px;
  scrollbar-width: none;
}
.app-rail::-webkit-scrollbar { display: none; }
.app-rail > * { flex: 0 0 190px; }
.app-rail.is-tiles { gap: 10px; margin-bottom: 26px; }
.app-rail.is-tiles > * { flex: 0 0 138px; }

/* ---------- 05 Hero banner ---------- */
.app-hero { display: block; position: relative; border-radius: 3px; overflow: hidden; margin-bottom: 24px; }
.app-hero .cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px;
  background: linear-gradient(0deg, rgba(255, 252, 247, .95), rgba(255, 252, 247, 0));
}
.app-hero .kicker { font-size: .6rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 6px; }
.app-hero h1 { font-family: var(--display); font-weight: 300; font-size: 1.5rem; color: var(--ink); line-height: 1.15; margin: 0; }

/* ---------- 06 Category tile ---------- */
.mtile {
  position: relative;
  height: 118px;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
}
.mtile .swatch { position: absolute; inset: 0; border-radius: 0; }
.mtile .cap {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  background: linear-gradient(180deg, rgba(74, 65, 55, 0) 42%, rgba(74, 65, 55, .58) 100%);
}
.mtile b { font-family: var(--display); font-weight: 400; font-size: 1rem; color: var(--ivory); }
.mtile small { display: block; font-size: .56rem; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 252, 247, .88); margin-top: 3px; }

/* ---------- 07 Product card ---------- */
.mcard {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--ivory);
  border: 1px solid var(--hair-soft);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .35s var(--ease), transform .35s var(--ease);
}
.mcard:active { transform: translateY(1px); }
.mcard .swatch { aspect-ratio: 1/1; }
.mcard .body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.mcard .school { margin: 0; font-size: .56rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep); }
.mcard h3 {
  font-family: var(--display); font-weight: 300; font-size: 1.05rem; color: var(--ink); margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mcard .cloth {
  margin: 0 0 4px; font-size: .72rem; color: var(--ink-mute); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mcard .price { font-family: var(--display); font-size: 1.05rem; color: var(--gold-deep); margin-top: auto; padding-top: 4px; }
.mcard .price::first-letter { font-family: var(--sans); font-size: .72em; }
.mcard .price small { font-family: var(--sans); font-size: .56rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-mute); }
.mcard .rule { height: 1px; background: var(--hair-soft); margin: 10px 0; }
.mcard .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mcard .size-range { flex: 1; min-width: 0; font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard .add-circle {
  flex: none; width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: none;
  color: var(--gold-deep);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .3s var(--ease), color .3s var(--ease);
}
.mcard .add-circle:hover, .mcard .add-circle:active { background: var(--gold); color: var(--ivory); }

.mgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* ---------- 08 Segmented control ---------- */
.seg { display: flex; gap: 3px; padding: 3px; background: var(--cream); border-radius: 40px; margin-bottom: 18px; }
.seg button {
  flex: 1; padding: 11px 0; border: none; border-radius: 40px;
  font-family: var(--sans); font-size: .66rem; font-weight: 400; letter-spacing: .16em; text-transform: uppercase;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  transition: background .3s var(--ease), color .3s var(--ease);
}
.seg button.is-active { background: var(--gold); color: var(--ivory); box-shadow: var(--shadow-sm); }

/* ---------- 09 Search ---------- */
.app-search-field { position: relative; }
.app-search-field svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-mute); pointer-events: none; }
.app-search-field input { padding-left: 44px; }
.app-search-field .clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%; background: none; border: none;
  display: none; align-items: center; justify-content: center; color: var(--ink-mute); cursor: pointer;
}
.app-search-field.has-value .clear { display: flex; }

/* ---------- 10 Product detail ---------- */
.pd-hero { position: relative; margin-bottom: 10px; }
.pd-hero .swatch { aspect-ratio: 4/5; border-radius: 3px; }
.wish-btn {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255, 252, 247, .92);
  border: 1px solid var(--hair-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.wish-btn svg { width: 18px; height: 18px; }

.thumb-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 22px; }
.thumb-grid button {
  padding: 0; border: 1px solid var(--hair-soft); border-radius: 2px; overflow: hidden;
  background: none; cursor: pointer; transition: border-color .3s var(--ease);
}
.thumb-grid button.is-active { border-color: var(--gold); }
.thumb-grid .swatch { aspect-ratio: 1/1; }

.pd-price { font-family: var(--display); font-size: 1.5rem; color: var(--gold-deep); margin-bottom: 20px; }
.pd-price::first-letter { font-family: var(--sans); font-size: .68em; }
.pd-price small { display: block; font-family: var(--sans); font-size: .55rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-mute); margin-top: 4px; }

.pd-buy { display: flex; gap: 12px; margin: 20px 0 10px; }
.pd-buy .qty { flex: none; }
.pd-buy .btn { flex: 1; }
.added-flash { font-size: .75rem; color: var(--gold-deep); margin-bottom: 12px; }

/* ---------- 11 Cart line ---------- */
.mline { display: flex; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--hair-soft); }
.mline .thumb { width: 64px; height: 64px; flex: none; }
.mline .thumb .swatch { width: 100%; height: 100%; }
.mline .info { flex: 1; min-width: 0; }
.mline .info .name { font-family: var(--display); font-size: .98rem; color: var(--ink); }
.mline .info .meta { font-size: .68rem; color: var(--ink-mute); margin: 2px 0 8px; }
.mline .end { text-align: right; flex: none; }
.mline .end .line-total { font-family: var(--display); color: var(--gold-deep); font-size: 1rem; margin-bottom: 10px; }
.mline .end .rm { background: none; border: none; color: var(--ink-mute); cursor: pointer; padding: 4px; }
.mline .end .rm:hover, .mline .end .rm:active { color: var(--gold-deep); }

/* ---------- 12 Account — wishlist row ---------- */
.wrow { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--hair-soft); }
.wrow .thumb { width: 58px; height: 58px; flex: none; cursor: pointer; }
.wrow .thumb .swatch { width: 100%; height: 100%; }
.wrow .info { flex: 1; min-width: 0; cursor: pointer; }
.wrow .info .name { font-family: var(--display); font-size: .95rem; color: var(--ink); }
.wrow .info .price { font-size: .7rem; color: var(--gold-deep); margin-top: 4px; }
.wrow .rm { background: none; border: none; color: var(--ink-mute); cursor: pointer; padding: 6px; }
.wrow .rm:hover, .wrow .rm:active { color: var(--gold-deep); }

/* account tab row — a dedicated class rather than reusing style.css's
   .auth-tabs, whose max-width:560px rule stacks it vertically for the
   desktop site's own narrow view; this shell is always that narrow, so
   borrowing it would always stack these three tabs instead of a row. */
.acct-tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.acct-tabs button {
  flex: 1;
  padding: 13px 6px;
  border: 1px solid var(--hair-soft);
  border-radius: 2px;
  font-family: var(--sans);
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: none;
  cursor: pointer;
  transition: background .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}
.acct-tabs button.is-on { background: var(--gold); border-color: var(--gold); color: var(--ivory); }

/* ---------- 13 Chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.chip {
  padding: 12px 16px; border: 1px solid var(--hair-soft); border-radius: 40px;
  font-family: var(--sans); font-size: .68rem; letter-spacing: .1em; color: var(--ink-soft);
  background: none; cursor: pointer; transition: border-color .3s var(--ease), color .3s var(--ease);
}
.chip:hover, .chip:active { border-color: var(--gold); color: var(--gold-deep); }

.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* order card compact rows, no dividers */
.order-card .lines { margin-top: 4px; }
.order-card .lines .row {
  display: flex; justify-content: space-between; gap: 12px;
  padding-block: 5px; font-size: .82rem; color: var(--ink-soft);
}
.order-card .lines .row b { color: var(--ink); font-weight: 400; }

/* ---------- 14 Responsive ---------- */
@media (max-width: 480px) {
  .app-shell { box-shadow: none; }
}

.app-shell .currency { font-family: var(--sans); font-size: .75em; }
.app-shell .btn { min-height: 44px; padding: 13px 16px; font-size: .62rem; letter-spacing: .16em; white-space: normal; text-align: center; }
.app-shell .btn:disabled { opacity: .45; cursor: not-allowed; }
.app-shell .qty button { width: 44px; height: 44px; }
.app-shell .qty > span { min-width: 22px; }
.app-shell .sizes { flex-wrap: wrap; }
.app-shell .sizes button { min-width: 44px; min-height: 44px; }
.app-shell .wish-btn { width: 44px; height: 44px; }
.app-shell .rm { width: 44px; height: 44px; }
.app-shell .seg button { min-height: 44px; }
.app-shell .acct-tabs button { min-width: 0; min-height: 44px; letter-spacing: .08em; }
.app-shell .field input,
.app-shell .field textarea { font-size: 16px; }
.app-shell .field textarea { min-height: 90px; }
.app-shell .chip-row { justify-content: flex-start; }
.app-shell .chip { min-height: 44px; padding: 10px 14px; text-transform: none; letter-spacing: .06em; }
.app-shell .summary { padding: 20px 16px; }
.app-shell .summary h3 { font-size: 1.2rem; }
.app-shell .steps-bar { gap: 8px; justify-content: space-between; margin-bottom: 24px; }
.app-shell .steps-bar span { gap: 5px; font-size: .55rem; letter-spacing: .04em; }
.app-shell .steps-bar em { flex: 1; width: auto; }
.app-shell .pdp-facts > div { gap: 12px; }
.app-shell .pdp-facts dd { overflow-wrap: anywhere; }
.app-shell .app-search-field input { padding-right: 48px; }
.app-shell .app-search-field .clear { width: 44px; height: 44px; right: 2px; }
.app-shell .app-search-field .clear svg { left: 50%; transform: translate(-50%, -50%); }
.app-shell .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.app-shell .tile-grid .cap { padding: 8px; }
.app-shell .tile-grid small { font-size: .5rem; letter-spacing: .03em; }
.app-shell .app-bar-side { min-width: 44px; }
.app-shell .app-bar-mid { overflow: hidden; }
.app-shell .app-bar-brand { gap: 5px; }
.app-shell .app-bar-brand .name { white-space: normal; line-height: 1.05; text-align: center; }
.app-heading { font-size: 1.55rem; margin-bottom: 20px; }
.app-category-list { display: grid; gap: 12px; }
.app-category-list .mtile { height: 150px; }
.app-house-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; font-size: .68rem; letter-spacing: .12em; color: var(--gold-deep); }
.app-note { margin: 14px 0; font-size: .76rem; line-height: 1.6; color: var(--ink-mute); }
.app-shell [data-address-form] .field { margin-bottom: 14px; }
.app-shell :focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }
.app-shell .mcard:focus-visible { outline-offset: -3px; }
.app-shell .added-flash { min-height: 20px; }
.app-shell .order-card header { flex-wrap: wrap; gap: 10px; }
.app-shell .pay-opt { padding: 16px 12px; }
.app-body { padding-bottom: 0; }
@media (prefers-reduced-motion: reduce) {
  .app-shell *, .app-shell *::before, .app-shell *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
