/* Storefront layout: header, hero and collection (toolbar, grid, product
   card): everything near the fold. Tokens, buttons, pills and keyframes live in
   base.css; how-to-buy and footer in store-info.css; the dialogs in
   store-dialogs.css and store-cart.css. Mobile first. The whole store sits on
   the hero's lead grey (--bg); sections are told apart by hairlines and air. */

html { scroll-padding-top: calc(var(--header-h) + var(--space-5)); }

/* A modal dialog keeps the page behind it still. */
html:has(dialog[open]) { overflow: hidden; }

/* The logo animation sits on black: the circular mask and the screen blend drop
   the black, so the chrome mark floats on the lead (chumbo) ground. */
.logo-video {
  flex: none;
  object-fit: cover;
  -webkit-mask-image: radial-gradient(circle, #000 55%, transparent 72%);
  mask-image: radial-gradient(circle, #000 55%, transparent 72%);
  mix-blend-mode: screen;
  pointer-events: none;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  backdrop-filter: blur(12px) saturate(1.15);
}

/* Weak devices: a re-blurred backdrop on a fixed bar is the biggest scroll
   cost, so it becomes a solid, nearly opaque bar instead. */
html.lite .site-header {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: #16100f;
  background: color-mix(in srgb, var(--bg) 92%, #000);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  height: 100%;
}

.site-header__actions { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.brand { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; }

.brand__name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.24em;
}

/* Narrow screens: the name stacks on two short lines to leave room for the buttons. */
@media (max-width: 639.98px) {
  .brand__name {
    width: min-content;
    font-size: 0.875rem;
    line-height: 1.15;
    letter-spacing: 0.2em;
  }
}

@media (max-width: 379.98px) {
  .brand__name { letter-spacing: 0.14em; }
  .header-link { letter-spacing: 0.08em; }
}

.cart-button {
  min-height: 44px;
  padding: 10px 14px;
  border-color: var(--border-strong);
  color: var(--text);
  font-size: var(--fs-2xs);
  letter-spacing: 0.16em;
  white-space: nowrap;
}

.cart-button [data-cart-count] { font-variant-numeric: tabular-nums; }
.cart-button.is-bumped { animation: bump var(--dur-base) var(--ease-out-soft); }

.header-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--space-1);
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 500;
  line-height: 1.25;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  transition: color var(--dur-fast) var(--ease-out-soft);
}

.header-link:hover { color: var(--text); }

@media (min-width: 640px) {
  .site-header__actions { gap: var(--space-6); }
  .cart-button { padding: 10px 20px; font-size: var(--fs-xs); letter-spacing: var(--tracking-label); }
  .header-link { font-size: var(--fs-xs); letter-spacing: var(--tracking-label); }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: calc(var(--header-h) + var(--space-8)) 0 var(--space-9);
  text-align: center;
}

/* The space loop sits full-bleed behind the hero. On a weak device main.js
   swaps the <video> for its poster <img>; both keep this class. */
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000; /* shown until the first frame paints */
  pointer-events: none;
}

/* A veil over the stars so the copy stays readable, with a soft glow behind
   the seal. */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(60% 50% at 50% 34%, rgba(244, 241, 236, 0.08), transparent 70%),
    radial-gradient(135% 100% at 50% 30%, transparent 44%, rgba(0, 0, 0, 0.62) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.hero__inner { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }
.hero__logo { width: 260px; height: 260px; margin-bottom: var(--space-5); }

.hero__subtitle { margin-top: var(--space-5); padding-left: 0.5em; font-size: var(--fs-sm); letter-spacing: 0.5em; }
.hero__shipping { margin-top: var(--space-4); color: var(--accent); font-size: 0.75rem; letter-spacing: 0.12em; }

.hero__cta {
  margin-top: var(--space-7);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-strong);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  transition: border-color var(--dur-base) var(--ease-out-soft), letter-spacing var(--dur-slow) var(--ease-out-soft);
}

.hero__cta:hover { border-color: var(--text); letter-spacing: 0.36em; }

@media (min-width: 768px) {
  .hero { padding: calc(var(--header-h) + var(--space-9)) 0 var(--space-10); }
  .hero__logo { width: 380px; height: 380px; margin-bottom: var(--space-6); }
  .hero__subtitle { margin-top: var(--space-6); font-size: 0.9375rem; }
  .hero__shipping { font-size: var(--fs-sm); }
}

/* ---------- Sections ---------- */

.section { padding-block: var(--section-y); }
.section-head { margin-bottom: var(--space-7); }
.section-head__eyebrow { margin-bottom: var(--space-4); }
.section-head--center { text-align: center; }
.section-head--center .rule { margin-inline: auto; }

.section-title { font-size: var(--fs-2xl); font-weight: 400; line-height: 1; letter-spacing: -0.005em; }

@media (min-width: 768px) {
  .section-head { margin-bottom: var(--space-8); }
}

/* ---------- Collection toolbar: search + category tabs ---------- */

.catalog-toolbar {
  display: grid;
  gap: var(--space-5);
  margin-bottom: var(--space-7);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.search-field { position: relative; display: flex; align-items: center; color: var(--muted); }

.search-field__icon { position: absolute; left: 0; pointer-events: none; transition: color var(--dur-fast) ease; }
.search-field:focus-within .search-field__icon { color: var(--text); }

/* 16px text: iOS zooms into smaller inputs on focus. */
.search-field__input {
  width: 100%;
  min-height: 48px;
  padding: 0 0 0 30px;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur-base) var(--ease-out-soft);
}

.search-field__input::placeholder { color: var(--muted); opacity: 1; }
.search-field__input:focus { border-color: var(--text); outline: none; }
.search-field__input:focus-visible { outline: none; }
.search-field__input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

/* Category tabs: plain words with a hairline that grows under the active one.
   They scroll sideways on phones, bleeding to the screen edge with a soft fade. */
.filters {
  display: flex;
  gap: var(--space-6);
  min-height: 44px;
  margin-inline: calc(-1 * var(--gutter));
  padding-inline: var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - 40px), transparent);
}

.filters::-webkit-scrollbar { display: none; }

.filters .pill {
  position: relative;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  letter-spacing: var(--tracking-label);
}

.filters .pill::after {
  content: '';
  position: absolute;
  inset: auto 0 6px;
  height: 1px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-slow) var(--ease-out-soft);
}

.filters .pill:hover { color: var(--text); }
.filters .pill[aria-pressed='true'] { background: none; color: var(--text); }
.filters .pill[aria-pressed='true']::after { transform: scaleX(1); }

@media (min-width: 900px) {
  .catalog-toolbar { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); align-items: end; gap: var(--space-7); }
  .search-field { grid-column: 2; grid-row: 1; }
  .filters { grid-column: 1; grid-row: 1; flex-wrap: wrap; row-gap: 0; margin-inline: 0; padding-inline: 0; overflow: visible; -webkit-mask-image: none; mask-image: none; }
}

/* ---------- Catalog grid and states ---------- */

.catalog-status { color: var(--muted); font-size: var(--fs-sm); }

.catalog-status:not(:empty) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  padding-block: var(--space-9);
  text-align: center;
}

.catalog-status__message,
.catalog-status:not(:has(*)) {
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-style: italic;
}

.catalog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-8) var(--space-4); }

/* Before the store script runs, hold the room the skeletons will take, so the
   sections below do not jump when they appear. */
.catalog-grid[aria-busy='true']:empty { min-height: 150vh; }

@media (min-width: 900px) {
  .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-10) var(--space-6); }
  .catalog-grid[aria-busy='true']:empty { min-height: 140vh; }
}

@media (min-width: 1600px) {
  .catalog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.product-card--skeleton { pointer-events: none; }

.skeleton {
  display: block;
  background: linear-gradient(90deg, var(--bg-2) 0%, var(--surface-2) 50%, var(--bg-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 2.4s var(--ease-out-soft) infinite;
}

.skeleton--media { aspect-ratio: 3 / 4; }
.skeleton--kind { width: 30%; height: 8px; margin-top: var(--space-5); }
.skeleton--name { width: 78%; height: 14px; margin-top: var(--space-3); }
.skeleton--price { width: 26%; height: 10px; margin-top: var(--space-3); }

/* ---------- Product card ---------- */

.product-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  min-width: 0;
}

/* One column only: the overlay action shares row 1 with the photo, and an
   explicit column keeps auto-placement from opening a second one. */
.product-card > * { grid-column: 1; }

.product-card__media {
  position: relative;
  grid-row: 1;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: radial-gradient(70% 55% at 50% 42%, rgba(244, 241, 236, 0.07), transparent 75%), var(--media-bg);
  cursor: pointer;
}

/* Photos are cut out (transparent): show the whole piece, with air around it,
   floating on the lead frame instead of cropped to the frame. */
.product-card__media img {
  width: 100%;
  height: 100%;
  padding: 7%;
  object-fit: contain;
  transition: transform var(--dur-zoom) var(--ease-out-soft), opacity var(--dur-slow) var(--ease-out-soft), filter var(--dur-slow) ease;
}

.product-card:hover .product-card__media img { transform: scale(1.025); }
.product-card__media:has(.tag--soldout) img { opacity: 0.55; filter: grayscale(0.4); }

@media (prefers-reduced-motion: reduce) {
  .product-card:hover .product-card__media img { transform: none; }
}

/* No photo, or a photo that failed to load: a darker surface tile (it must not
   melt into the page) with the chrome "CS" mark and a quiet "Foto em breve". It
   fills the frame, so the grid keeps its rhythm. Shared by cards, gallery and cart rows (photo-fallback.js). */
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 50% 42%, rgba(244, 241, 236, 0.08), transparent 70%),
    var(--surface);
  text-align: center;
}

.photo-placeholder__mark {
  padding-left: var(--tracking-wide);
  background: linear-gradient(180deg, #fbfaf8 0%, #d6ccbc 55%, #a89b88 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 3.25rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: var(--tracking-wide);
}

.photo-placeholder__note {
  padding-left: var(--tracking-label);
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
}

.tag {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  padding: 5px 10px;
  background: var(--text);
  color: var(--lead-900);
  font-size: var(--fs-2xs);
  font-weight: 500;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

/* "Novo" is an off-white chip; "Esgotado" a dark one with a hairline, in the bottom corner. */
.tag--soldout { top: auto; bottom: var(--space-3); box-shadow: inset 0 0 0 1px var(--border-strong); background: var(--surface); color: var(--text); }

.product-card__kind {
  margin-top: var(--space-5);
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
}

/* Product names read in the display serif, in their own case. */
.product-card__name {
  margin-top: var(--space-2);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 500;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.product-card__media + .product-card__name { margin-top: var(--space-5); }

.product-card__price {
  margin-top: var(--space-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.product-card__sizes { margin-top: var(--space-1); color: var(--muted); font-size: var(--fs-xs); letter-spacing: 0.1em; }

/* Touch screens: the action sits under the text, quiet until needed. */
.product-card__add {
  margin-top: var(--space-4);
  min-height: 44px;
  padding: 10px 8px;
  border-color: var(--border);
  font-size: var(--fs-2xs);
  letter-spacing: 0.14em;
  text-wrap: balance;
}

.product-card__add:hover:not(:disabled) { border-color: var(--text); background: var(--text); color: var(--bg); }

/* Mouse and trackpad: the action is revealed over the photo on hover or focus. */
@media (hover: hover) and (pointer: fine) {
  .product-card__add {
    grid-row: 1;
    align-self: end;
    z-index: 1;
    margin: var(--space-3);
    border-color: var(--border);
    background: var(--glass);
    color: var(--text);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(6px);
    transition:
      opacity 0.6s var(--ease-out-soft),
      transform 0.6s var(--ease-out-soft),
      background-color var(--dur-fast) ease,
      color var(--dur-fast) ease;
  }

  .product-card:hover .product-card__add,
  .product-card:focus-within .product-card__add { opacity: 1; transform: none; }

  .product-card__media:has(.tag--soldout) ~ .product-card__add { margin-bottom: 44px; }
}
