/* BuyLowa homepage/page composition
   This file controls page layout and section placement.
   Reusable component styling lives in buylowa-components.css.
*/

/* ─── Department navigation ─────────────────────────────── */
.department-strip {
  background: var(--white);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.department-strip-inner {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.department-strip-inner::-webkit-scrollbar {
  display: none;
}

.department-link {
  flex: 0 0 auto;
  min-height: 42px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  padding: 0 16px;
  font-weight: 850;
  white-space: nowrap;
}

.department-link:first-child {
  border-left: 1px solid var(--line);
}

.department-link:hover,
.department-link.active {
  background: var(--ink);
  color: var(--white);
}

/* The small strip is the primary department browser. The old overview panel stays hidden. */
.department-panel {
  display: none;
}

/* ─── Shared page widths ────────────────────────────────── */
.homepage-root,
.home-market,
.collection-page,
.deal-detail-page,
.profile-page,
.live-metrics {
  width: min(1480px, calc(100% - 48px));
  margin-left: auto;
  margin-right: auto;
}

.home-market {
  padding: 34px 0 10px;
}

/* ─── Homepage intro ────────────────────────────────────── */
.market-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 30px;
  align-items: stretch;
  padding-bottom: 22px;
}

.market-intro.single {
  grid-template-columns: 1fr;
}

.market-intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(36px, 3.8vw, 60px);
  line-height: .94;
  max-width: 760px;
}

.market-intro p {
  color: var(--muted);
  max-width: 560px;
}

/* ─── Feature board composition ─────────────────────────── */
.front-grid {
  /* Feature board sizing contract.
     Change --feature-height first. The child components read the variables below so
     the board can shrink without titles, images, quick finds or vouchers breaking. */
  --feature-height: clamp(350px, 27vw, 390px);
  --feature-media-width: 38%;
  --feature-padding: clamp(18px, 1.8vw, 26px);
  --feature-content-gap: 8px;
  --feature-title-size: clamp(28px, 2.25vw, 40px);
  --feature-title-lines: 2;
  --feature-summary-size: 14px;
  --feature-summary-lines: 2;
  --feature-price-size: clamp(32px, 2.25vw, 38px);
  --feature-image-padding: clamp(16px, 1.8vw, 24px);
  --feature-image-max-w: 340px;
  --feature-image-max-h: 240px;
  --quick-image-width: 82px;
  --quick-image-height: 72px;
  --quick-title-lines: 2;
  --voucher-title-lines: 2;
  --voucher-context-lines: 1;
  --voucher-title-size: 16px;
  --voucher-body-padding: 12px 14px;
  --voucher-store-padding: 10px 14px;
  --voucher-code-size: 14px;

  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
  gap: 18px;
  align-items: stretch;
}

/* ─── Homepage sections ─────────────────────────────────── */
.voucher-market,
.store-market,
.feed-layout,
.deal-shelf {
  margin-top: 34px;
}

.store-market {
  --browse-columns: 5;
  --browse-tile-height: 118px;
}

.voucher-market {
  --voucher-columns: 4;
}

/* ─── Feed composition ──────────────────────────────────── */
.feed-market {
  background: var(--white);
  border: 1px solid var(--line);
}

.feed-headline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.feed-headline p {
  margin: 4px 0 0;
  color: var(--muted);
}

.feed-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feed-tab {
  border: 1px solid var(--line);
  background: transparent;
  padding: 9px 12px;
  font-weight: 900;
}

.feed-tab.active,
.feed-tab:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

/* ─── Secondary discovery sections ──────────────────────── */
.feed-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
  gap: 18px;
  align-items: start;
}

.feed-side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.sidebar-cat-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sidebar-cat-link {
  border: 1px solid var(--line);
  background: transparent;
  padding: 7px 12px;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
}

.sidebar-cat-link.active,
.sidebar-cat-link:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.deal-shelf {
  background: transparent;
}

/* ─── Live metrics ──────────────────────────────────────── */
.live-metrics {
  margin-top: 36px;
  border-top: 1px solid var(--line);
  padding: 16px 0 0;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 13px;
}

.live-metrics strong {
  color: var(--ink);
}

.metric-note {
  margin-left: auto;
}

/* ─── Collection/search/profile/detail page composition ────────────── */
.collection-page,
.deal-detail-page,
.profile-page {
  padding: 34px 0;
}

.collection-tabs {
  margin: 0 0 14px;
}

.active-filter {
  margin-top: 12px;
}

.back-btn {
  margin-bottom: 14px;
}

.detail-layout {
  --detail-panel-height: clamp(430px, 37vw, 540px);
  --detail-gallery-min-height: clamp(300px, 30vw, 380px);
  --detail-image-min-height: clamp(260px, 26vw, 340px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(280px, 320px);
  gap: 18px;
  align-items: stretch;
}

.detail-community {
  margin-top: 18px;
}

.profile-deals {
  margin-top: 22px;
}

.home-market .section-kicker,
.collection-page .section-kicker,
.deal-detail-page .section-kicker,
.profile-page .section-kicker {
  color: var(--color-brand);
}

/* ─── Responsive composition ────────────────────────────── */
@media (max-width: 1180px) {
  .front-grid {
    --feature-height: auto;
    grid-template-columns: 1fr;
  }

  .front-side {
    height: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto;
  }

  .side-stack-title {
    grid-column: 1 / -1;
  }

  .front-side .voucher-ticket {
    height: auto;
  }

  .feed-layout {
    grid-template-columns: 1fr;
  }

  .detail-layout {
    grid-template-columns: 1fr 1fr;
  }

  .detail-buy-box {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {

  html,
  body {
    overflow-x: hidden;
  }

  .header-main-row,
  .primary-nav,
  .department-strip-inner,
  .homepage-root,
  .home-market,
  .collection-page,
  .deal-detail-page,
  .profile-page,
  .live-metrics,
  .footer-inner {
    width: min(100% - 24px, 1480px);
  }

  .market-header {
    border-bottom-width: 3px;
  }

  .header-main-row {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 14px 0;
    gap: 12px;
  }

  .brand-lockup {
    width: fit-content;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-text {
    font-size: 26px;
  }

  .search-market {
    height: 46px;
    width: 100%;
  }

  .member-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .member-link,
  .post-link {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .primary-nav {
    padding: 0 0 12px;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid rgba(255, 255, 255, .1);
  }

  .primary-nav::-webkit-scrollbar,
  .department-strip-inner::-webkit-scrollbar,
  .voucher-strip::-webkit-scrollbar,
  .department-grid-large::-webkit-scrollbar,
  .shelf-grid::-webkit-scrollbar,
  .feed-tabs::-webkit-scrollbar {
    display: none;
  }

  .primary-nav a {
    flex: 0 0 auto;
    padding: 13px 14px 0 0;
    font-size: 13px;
  }

  .department-strip {
    position: sticky;
    top: 0;
    z-index: 18;
  }

  .department-strip-inner {
    padding: 0;
  }

  .department-link {
    min-height: 44px;
    padding: 0 14px;
    font-size: 13px;
  }

  .home-market {
    padding: 18px 0 8px;
  }

  .market-intro {
    grid-template-columns: 1fr;
    gap: 16px;
    padding-bottom: 18px;
  }

  .market-intro h1 {
    font-size: clamp(34px, 10vw, 52px);
    line-height: .98;
  }

  .market-intro p {
    font-size: 15px;
  }

  .lead-deal {
    height: auto;
    grid-template-columns: 1fr;
  }

  .lead-image {
    order: -1;
    aspect-ratio: 16 / 10;
    border-left: 0;
    border-bottom: 1px solid var(--line-dark);
  }

  .lead-copy {
    padding: 20px;
  }

  .lead-copy h1 {
    font-size: clamp(30px, 8vw, 42px);
  }

  .lead-price-row strong {
    font-size: 32px;
  }

  .lead-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
  }

  .front-side {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .spotlight-mini {
    grid-template-columns: 82px 1fr;
  }

  .section-heading,
  .section-heading.split,
  .feed-headline {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .section-heading h2,
  .module-title-line h2,
  .feed-headline h2 {
    font-size: 30px;
  }

  .voucher-market,
  .store-market,
  .feed-layout,
  .deal-shelf {
    margin-top: 24px;
  }

  .department-grid-large,
  .voucher-strip,
  .shelf-grid {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    border: 0;
    scroll-snap-type: x proximity;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .department-tile,
  .voucher-ticket,
  .shelf-item {
    flex: 0 0 min(82vw, 340px);
    border: 1px solid var(--line);
    scroll-snap-align: start;
  }

  .department-tile {
    min-height: 102px;
  }

  .feed-market {
    border-left: 0;
    border-right: 0;
    margin-left: -12px;
    margin-right: -12px;
  }

  .feed-headline {
    padding: 18px 12px;
  }

  .feed-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .feed-tab {
    flex: 0 0 auto;
  }

  .deal-row {
    --feed-image-size: 92px;
    --feed-image-height: 92px;
    --feed-title-size: 15px;
    --feed-title-lines: 2;
    --feed-price-size: 22px;
    --deal-row-padding: 14px 12px;
    grid-template-columns: var(--feed-image-size) minmax(0, 1fr);
    grid-template-areas:
      "image main"
      "image price"
      "community action";
    gap: 10px 12px;
  }

  .row-image {
    grid-area: image;
    align-self: start;
  }

  .row-image img {
    max-width: calc(var(--feed-image-size) - 10px);
    max-height: calc(var(--feed-image-height) - 10px);
  }

  .row-main {
    grid-area: main;
  }

  .row-main h3,
  .voucher-row-main h3 {
    margin-top: 2px;
  }

  .row-main p {
    display: none;
  }

  .offer-meta-line {
    gap: 5px;
    font-size: 11px;
    white-space: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .offer-meta-line::-webkit-scrollbar {
    display: none;
  }

  .poster-line {
    font-size: 11px;
  }

  .row-price {
    grid-area: price;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
  }

  .row-price strong {
    font-size: var(--feed-price-size, 22px);
  }

  .row-community {
    grid-area: community;
    justify-items: start;
    align-self: center;
    gap: 4px;
  }

  .row-action {
    grid-area: action;
    align-self: center;
    justify-self: stretch;
    padding: 10px;
  }

  .voucher-row {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
    margin: 0 12px;
    border: 1px solid var(--line-dark);
  }

  .voucher-row-store {
    border-right: 0;
    border-bottom: 2px dashed var(--gold);
    padding: 14px;
  }

  .voucher-row-main {
    padding: 14px;
  }

  .voucher-row-code {
    margin: 0 14px 14px;
    width: calc(100% - 28px);
  }

  .voucher-row .vote-unit {
    margin: 0 14px 14px;
    justify-self: start;
  }

  .compact-list-item {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .compact-list-item em {
    grid-column: 2;
    justify-self: start;
  }

  .shelf-item {
    grid-template-rows: 130px auto auto auto;
  }

  .collection-page,
  .deal-detail-page,
  .profile-page {
    padding: 18px 0;
  }

  .collection-page,
  .deal-detail-page,
  .profile-page {
    --page-card-padding: 20px;
    --detail-card-padding: 16px;
    --detail-story-gap: 10px;
    --detail-buy-gap: 8px;
    --detail-report-min-height: 36px;
    --detail-report-padding-y: 7px;
    --detail-title-size: clamp(28px, 8vw, 36px);
    --detail-title-lines: 4;
    --detail-desc-size: 14px;
    --detail-desc-lines: 5;
    --detail-price-size: 32px;
    --detail-gallery-min-height: 230px;
    --detail-image-height: 230px;
    --detail-image-min-height: 220px;
    --detail-image-padding: 16px;
  }

  .detail-layout {
    --detail-panel-height: auto;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
  }

  .detail-gallery {
    order: 1;
  }

  .detail-buy-box {
    order: 2;
  }

  .detail-story {
    order: 3;
  }

  .detail-gallery,
  .detail-story,
  .detail-buy-box,
  .detail-community {
    border-left: 0;
    border-right: 0;
  }

  .detail-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .comment-form-footer {
    display: grid;
    gap: 10px;
  }

  .btn-post-comment {
    width: 100%;
  }

  .live-metrics {
    margin-top: 24px;
    gap: 10px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 10px;
  }

  .live-metrics span {
    flex: 0 0 auto;
  }

  .metric-note {
    margin-left: 0;
  }
}

@media (max-width: 520px) {

  .header-main-row,
  .primary-nav,
  .department-strip-inner,
  .homepage-root,
  .home-market,
  .collection-page,
  .deal-detail-page,
  .profile-page,
  .live-metrics,
  .footer-inner {
    width: min(100% - 18px, 1480px);
  }

  .brand-text {
    font-size: 24px;
  }

  .member-actions {
    grid-template-columns: 1fr;
  }

  .post-link,
  .member-link {
    min-height: 42px;
  }

  .market-intro h1 {
    font-size: 34px;
  }

  .lead-actions {
    grid-template-columns: 1fr;
  }

  .lead-actions .vote-unit {
    justify-self: start;
  }

  .spotlight-mini {
    grid-template-columns: 72px 1fr;
    padding: 10px;
  }

  .deal-row {
    --feed-image-size: 78px;
    --feed-image-height: 78px;
    --feed-price-size: 21px;
    --deal-control-col: 104px;
    grid-template-columns: var(--deal-control-col) minmax(0, 1fr);
    grid-template-areas:
      "image main"
      "price price"
      "community action";
    gap: 8px 12px;
  }

  .row-image img {
    max-width: calc(var(--feed-image-size) - 8px);
    max-height: calc(var(--feed-image-height) - 8px);
  }

  .row-labels span {
    font-size: 9px;
  }

  .row-price {
    padding-top: 2px;
  }

  .row-action {
    min-width: 0;
    font-size: 13px;
    padding-inline: 8px;
  }

  .deal-row .row-community {
    min-width: 0;
    max-width: 100%;
    justify-items: start;
  }

  .deal-row .vote-unit {
    max-width: 100%;
    box-sizing: border-box;
    grid-template-columns: 22px minmax(18px, auto) 22px;
    gap: 3px;
    padding: 3px;
  }

  .deal-row .vote-number {
    min-width: 18px;
    font-size: 12px;
  }

  .deal-row .vote-arrow {
    width: 22px;
    height: 22px;
  }

  .deal-row .row-action {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .comment-count {
    font-size: 11px;
  }

  .ticket-bottom {
    display: grid;
    gap: 8px;
  }

  .ticket-code {
    width: 100%;
  }

  .section-heading h2,
  .module-title-line h2,
  .feed-headline h2 {
    font-size: 27px;
  }

  .deal-detail-page {
    --detail-stat-columns: 2;
    --detail-card-padding: 14px;
    --detail-story-gap: 9px;
    --detail-buy-gap: 7px;
    --detail-report-min-height: 34px;
    --detail-report-padding-y: 6px;
    --detail-title-size: clamp(24px, 8vw, 31px);
    --detail-price-size: 30px;
    --detail-gallery-min-height: 210px;
    --detail-image-height: 210px;
    --detail-image-min-height: 200px;
    --detail-image-padding: 12px;
  }

  .detail-stats-row {
    grid-template-columns: repeat(var(--detail-stat-columns, 2), minmax(0, 1fr));
  }
}
/* ─── SEO deal permalink pages ─────────────────────────── */
.seo-deal-page {
  min-height: 60vh;
}

.seo-deal-page .modal-secondary.wide {
  width: 100%;
  justify-content: center;
  text-align: center;
}
