/*
  Direção visual: Armazém Editorial Mineiro.
  Este arquivo combina papel marfim, carvão, terracota de mudança e azul-petróleo
  para transformar uma listagem de usados em um inventário acolhedor e legível.
*/

/* ===== Base, tokens e acessibilidade ===== */
:root {
  --paper: #f4f0e8;
  --paper-deep: #e8e1d5;
  --ink: #252624;
  --ink-soft: #686761;
  --line: #d4ccbf;
  --terracotta: #b6533b;
  --terracotta-deep: #913c2d;
  --petrol: #1f5b5d;
  --white: #fffdf8;
  --image-placeholder: #e6e3dc;
  --shadow-card: 0 12px 28px rgba(55, 43, 32, 0.08);
  --shadow-card-hover: 0 18px 34px rgba(55, 43, 32, 0.15);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.22;
  background-image: radial-gradient(rgba(86, 72, 54, 0.11) 0.7px, transparent 0.7px);
  background-size: 8px 8px;
}

body.is-modal-open {
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--petrol);
  outline-offset: 4px;
}

.shell {
  width: min(100% - 32px, 1280px);
  margin: 0 auto;
}

.eyebrow {
  margin: 0;
  color: var(--terracotta-deep);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.3;
  text-transform: uppercase;
}

/* ===== Cabeçalho ===== */
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 232, 0.91);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand__mark {
  width: 48px;
  height: 48px;
  margin-right: 12px;
  object-fit: contain;
}

.brand__words {
  display: flex;
  flex-direction: column;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 0.95;
}

.brand__words span:last-child {
  color: var(--terracotta);
  font-style: italic;
}

.header-note {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 5px;
  text-align: right;
}

.header-note__line {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

/* ===== Abertura editorial e imagem hero ===== */
.intro {
  padding: 68px 0 82px;
  overflow: hidden;
}

.intro__grid {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 0.87fr) minmax(0, 1.13fr);
  gap: clamp(36px, 7vw, 112px);
}

.intro__copy {
  position: relative;
  z-index: 1;
  padding-left: clamp(0px, 4vw, 54px);
}

.intro__kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 24px;
}

.eyebrow__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--terracotta);
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: "Fraunces", Georgia, serif;
  letter-spacing: -0.045em;
}

h1 {
  max-width: 650px;
  margin-bottom: 26px;
  font-size: clamp(3.25rem, 7vw, 5.55rem);
  font-weight: 600;
  line-height: 0.92;
}

h1 em,
h2 em {
  color: var(--terracotta);
  font-style: italic;
  font-weight: 600;
}

.intro__lead {
  max-width: 400px;
  margin-bottom: 28px;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 1.5vw, 1.23rem);
  line-height: 1.42;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--petrol);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: color 180ms var(--ease-out), gap 180ms var(--ease-out);
}

.text-link:hover {
  color: var(--terracotta-deep);
  gap: 16px;
}

.image-frame {
  position: relative;
  overflow: hidden;
  background-color: var(--image-placeholder);
}

.intro__image {
  min-height: 420px;
  margin: 0;
  transform: rotate(1.2deg);
  box-shadow: var(--shadow-card);
}

.intro__image img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: cover;
}

.image-frame__wash {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(100deg, rgba(28, 42, 36, 0.12), transparent 48%);
  mix-blend-mode: multiply;
}

.intro__image figcaption {
  position: absolute;
  z-index: 2;
  right: 14px;
  bottom: 13px;
  left: 14px;
  display: flex;
  justify-content: space-between;
  color: var(--white);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.4);
  text-transform: uppercase;
}

/* ===== Filtro de categorias ===== */
.category-bar {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper-deep);
}

.category-bar__inner {
  display: flex;
  align-items: center;
  gap: 30px;
  min-height: 86px;
}

.category-intro {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 16px;
}

.category-intro__rule {
  display: block;
  width: 30px;
  height: 1px;
  background: var(--terracotta);
}

.category-nav {
  display: flex;
  flex: 1 1 auto;
  gap: 8px;
  overflow-x: auto;
  padding: 7px 0;
  scrollbar-width: thin;
}

.category-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.91rem;
  transition: border-color 180ms var(--ease-out), background 180ms var(--ease-out), color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.category-button:hover,
.category-button.is-active {
  border-color: var(--terracotta);
  background: var(--white);
  color: var(--terracotta-deep);
}

.category-button:active,
.load-more:active,
.whatsapp-button:active,
.back-to-top:active {
  transform: scale(0.97);
}

/* ===== Cabeçalho do inventário e grid ===== */
.inventory {
  padding-top: 77px;
  padding-bottom: 96px;
}

.inventory__heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}

.inventory__heading h2 {
  max-width: 520px;
  margin: 7px 0 0;
  font-size: clamp(1.85rem, 3.5vw, 3rem);
  font-weight: 600;
  line-height: 1.03;
}

.inventory__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.inventory__meta-rule {
  width: 25px;
  height: 1px;
  background: var(--line);
}

.catalog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* ===== Cards compactos do catálogo ===== */
.item-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 0 2px 0 rgba(55, 43, 32, 0.02);
  animation: card-in 300ms var(--ease-out) both;
  animation-delay: var(--card-delay);
  transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.item-card:hover,
.item-card:focus-within {
  border-color: rgba(182, 83, 59, 0.6);
  box-shadow: var(--shadow-card);
  transform: translateY(-3px);
}

.item-card__main {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.item-card__image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: var(--image-placeholder);
}

.item-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 420ms var(--ease-out);
}

.item-card:hover .item-card__image img,
.item-card:focus-within .item-card__image img {
  transform: scale(1.045);
}

.item-card__badge {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 4px 7px;
  background: var(--white);
  color: var(--terracotta-deep);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.item-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 12px 2px 2px;
}

.item-card__price {
  margin: 0 0 7px;
  color: var(--terracotta-deep);
  font-size: 1.24rem;
  font-weight: 700;
  line-height: 1.1;
}

.item-card__description {
  display: -webkit-box;
  min-height: 2.75em;
  margin: 0 0 11px;
  overflow: hidden;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.item-card__detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(212, 204, 191, 0.72);
  color: var(--terracotta-deep);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.item-card__detail span:last-child {
  font-size: 1rem;
}

.item-card__contact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 10px;
  padding: 5px 8px;
  border: 1px solid rgba(182, 83, 59, 0.5);
  color: var(--terracotta-deep);
  font-size: 0.79rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 180ms var(--ease-out), color 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.item-card__contact:hover {
  border-color: var(--terracotta);
  background: var(--terracotta);
  color: var(--white);
}

/* ===== Estado vazio e carregamento ===== */
.catalog-empty {
  max-width: 520px;
  padding: 34px 0;
  color: var(--ink-soft);
}

.catalog-empty p:last-child {
  margin: 9px 0 0;
  font-size: 1.05rem;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding-top: 32px;
}

.load-more {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  min-height: 48px;
  padding: 10px 16px 10px 19px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.91rem;
  font-weight: 700;
  transition: background 180ms var(--ease-out), color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.load-more:hover {
  background: var(--ink);
  color: var(--paper);
}

.load-more span:last-child {
  color: var(--terracotta);
  font-size: 1.25rem;
  line-height: 0.7;
}

/* ===== Rodapé ===== */
.site-footer {
  border-top: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.site-footer__top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  padding-top: 58px;
  padding-bottom: 65px;
}

.site-footer .eyebrow {
  color: #e7957d;
}

.site-footer h2 {
  margin: 10px 0 0;
  font-size: clamp(2rem, 4.5vw, 4rem);
  font-weight: 600;
  line-height: 0.98;
}

.site-footer h2 em {
  color: #e7957d;
}

.site-footer__contact {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 10px;
}

.site-footer__contact a {
  color: var(--paper);
  font-size: 1.03rem;
  text-underline-offset: 4px;
}

.site-footer__contact a:hover {
  color: #e7957d;
}

.site-footer__bottom {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 17px;
  padding-bottom: 20px;
  border-top: 1px solid rgba(244, 240, 232, 0.2);
  color: #bcb8ae;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-stamp span {
  color: #e7957d;
  font-size: 0.8rem;
}

/* ===== Botão flutuante de retorno ===== */
.back-to-top {
  position: fixed;
  z-index: 10;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--terracotta);
  border-radius: 50%;
  background: var(--terracotta);
  color: var(--white);
  font-size: 1.35rem;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), background 180ms var(--ease-out);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--terracotta-deep);
  background: var(--terracotta-deep);
}

/* ===== Lightbox/modal ===== */
.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  overflow: auto;
  padding: 24px;
  place-items: center;
}

.lightbox__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 25, 23, 0.78);
  animation: fade-in 180ms ease-out both;
}

.lightbox__panel {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 960px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  grid-template-columns: minmax(0, 1.12fr) minmax(250px, 0.88fr);
  background: var(--paper);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.32);
  animation: modal-in 220ms var(--ease-out) both;
}

.lightbox__close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(37, 38, 36, 0.24);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1;
}

.lightbox__close:hover {
  border-color: var(--terracotta);
  color: var(--terracotta-deep);
}

.lightbox__image {
  min-height: 360px;
}

.lightbox__image img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 600px;
  object-fit: cover;
}

.lightbox__content {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 4vw, 52px);
}

.lightbox__content h2 {
  margin: 9px 0 12px;
  font-size: clamp(1.9rem, 3.7vw, 3.2rem);
  line-height: 1;
}

.lightbox__price {
  margin-bottom: 15px;
  color: var(--terracotta-deep);
  font-size: 1.35rem;
  font-weight: 700;
}

.lightbox__content > p:last-of-type {
  margin-bottom: 25px;
  color: var(--ink-soft);
  font-size: 1.03rem;
}

.whatsapp-button {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  padding: 12px 15px;
  background: var(--petrol);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.whatsapp-button:hover {
  background: #164446;
}

/* ===== Movimento reduzido e breakpoints responsivos ===== */
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 640px) {
  .shell {
    width: min(100% - 48px, 1280px);
  }
}

@media (min-width: 768px) {
  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .shell {
    width: min(100% - 64px, 1280px);
  }

  .catalog-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .site-header__inner {
    min-height: 76px;
  }

  .header-note__line {
    max-width: 120px;
    font-size: 0.72rem;
    line-height: 1.15;
  }

  .intro {
    padding: 51px 0 62px;
  }

  .intro__grid {
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .intro__copy {
    padding-left: 0;
  }

  .intro__image,
  .intro__image img {
    min-height: 0;
  }

  .intro__image {
    width: calc(100% - 6px);
    margin-left: 6px;
  }

  .category-bar__inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding-top: 18px;
    padding-bottom: 14px;
  }

  .category-nav {
    width: 100%;
  }

  .inventory {
    padding-top: 56px;
    padding-bottom: 70px;
  }

  .inventory__heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .site-footer__top {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 45px;
    padding-bottom: 48px;
  }

  .site-footer__contact {
    align-items: flex-start;
  }

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

  .lightbox {
    padding: 12px;
  }

  .lightbox__panel {
    max-height: calc(100vh - 24px);
    grid-template-columns: 1fr;
  }

  .lightbox__image {
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .lightbox__image img {
    max-height: none;
  }

  .lightbox__content {
    padding: 24px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
