/* ==========================================================================
   The Pet Market — design system

   Monochrome by rule, not by preference. The photographs are the only colour
   on any page. Every UI element that competes with a photo of an animal is a
   design bug.

   Hairline borders, not shadows. Shadows read as cheap template; 1px rules
   read as editorial. This is most of the difference between "classifieds
   site" and "premium marketplace".
   ========================================================================== */

:root {
  --ink:        #0a0a0a;
  --ink-2:      #3d3d3d;
  --ink-3:      #6b6b6b;
  --ink-4:      #9a9a9a;
  --rule:       #e4e4e4;
  --rule-2:     #f0f0f0;
  --paper:      #ffffff;
  --paper-2:    #fafafa;

  --radius:     3px;
  --tap:        44px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1320px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f4f4f4; --ink-2: #c8c8c8; --ink-3: #909090; --ink-4: #6a6a6a;
    --rule: #2a2a2a; --rule-2: #1e1e1e;
    --paper: #0c0c0c; --paper-2: #141414;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
img { max-width: 100%; display: block; }

h1, h2, h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.021em;   /* tight tracking is most of the "premium" read */
  line-height: 1.18;
}
h1 { font-size: clamp(23px, 3.4vw, 33px); }
h2 { font-size: clamp(18px, 2.2vw, 22px); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* --- Header --------------------------------------------------------------- */

.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }
.masthead__bar {
  display: flex; align-items: center; gap: 28px;
  height: 66px;
}
.logo {
  font-size: 19px; font-weight: 750; letter-spacing: -0.035em;
  white-space: nowrap;
}
.logo:hover { text-decoration: none; }
.logo em { font-style: normal; color: var(--ink-4); }

.nav { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  font-size: 14px; color: var(--ink-2); white-space: nowrap;
  padding: 6px 0; border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }

.masthead__actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 0 16px;
  font: inherit; font-size: 14px; font-weight: 550;
  border: 1px solid var(--ink); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
  cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; background: var(--paper-2); }
.btn--solid { background: var(--ink); color: var(--paper); }
.btn--solid:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn--quiet { border-color: var(--rule); color: var(--ink-2); }
.btn--lg { min-height: var(--tap); padding: 0 22px; font-size: 15px; }

/* --- Listing grid --------------------------------------------------------- */

.grid {
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
}
/* Hairlines come from a 1px ring on each card, NOT from a coloured container
   showing through the gaps. The container trick leaves a dead slab wherever
   the last row is short — which it almost always is. Adjacent rings meet in
   the 1px gap and read as a single continuous rule. */

.card {
  background: var(--paper); display: flex; flex-direction: column;
  box-shadow: 0 0 0 1px var(--rule);
}
.card:hover { text-decoration: none; }
.card:hover .card__title { text-decoration: underline; text-underline-offset: 2px; }

.card__media {
  aspect-ratio: 4 / 3; background: var(--paper-2);
  position: relative; overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__media--empty {
  display: grid; place-items: center;
  color: var(--ink-4); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
}
.card__body { padding: 11px 13px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card__title {
  font-size: 14px; font-weight: 600; line-height: 1.32;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__meta { font-size: 12.5px; color: var(--ink-3); }
.card__price { margin-top: auto; padding-top: 7px; font-size: 15px; font-weight: 650; }
.card__price--free { font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }

/* --- Badges --------------------------------------------------------------- */
/* Verification is the product. It gets the strongest mark on the page —
   which in a monochrome system means solid black, and nothing else is. */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 650;
  letter-spacing: 0.055em; text-transform: uppercase;
  padding: 2.5px 7px; border-radius: 2px;
  border: 1px solid var(--rule); color: var(--ink-3);
}
.badge--verified { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.badge--licensed { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.badge--adopt    { border-color: var(--ink-2); color: var(--ink); }
.badge--sold     { background: var(--ink-3); color: var(--paper); border-color: var(--ink-3); }
.badge--featured { border-style: dashed; color: var(--ink-2); }

.badge-row { display: flex; flex-wrap: wrap; gap: 5px; }

/* --- Browse layout -------------------------------------------------------- */

.browse { display: grid; grid-template-columns: 232px 1fr; gap: 34px; align-items: start; }
@media (max-width: 900px) { .browse { grid-template-columns: 1fr; } }

.facets { position: sticky; top: 18px; font-size: 14px; }
.facets__group { padding: 15px 0; border-bottom: 1px solid var(--rule); }
.facets__group:first-child { padding-top: 0; }
.facets__label {
  font-size: 11px; font-weight: 650; letter-spacing: 0.075em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 9px;
}
.facets ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.facets a { color: var(--ink-2); }
.facets a:hover { color: var(--ink); }
.facets .count { color: var(--ink-4); font-size: 12.5px; }

.page-head { padding: 26px 0 18px; border-bottom: 1px solid var(--rule); margin-bottom: 22px; }
.page-head p { margin: 8px 0 0; color: var(--ink-3); max-width: 62ch; }

.crumbs { font-size: 12.5px; color: var(--ink-3); padding: 14px 0 0; }
.crumbs a { color: var(--ink-3); }
.crumbs span { margin: 0 6px; color: var(--ink-4); }

.toolbar {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 14px; font-size: 13.5px; color: var(--ink-3);
}
.toolbar select {
  font: inherit; font-size: 13.5px; padding: 6px 9px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper); color: var(--ink); margin-left: auto;
}

/* --- Listing detail ------------------------------------------------------- */

.detail { display: grid; grid-template-columns: 1fr 348px; gap: 42px; padding: 24px 0 60px; align-items: start; }
@media (max-width: 940px) { .detail { grid-template-columns: 1fr; gap: 28px; } }

.gallery__main {
  aspect-ratio: 4 / 3; background: var(--paper-2);
  border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
}
.gallery__main img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.gallery__thumbs img {
  width: 78px; height: 60px; object-fit: cover; flex: none;
  border: 1px solid var(--rule); border-radius: 2px; cursor: pointer;
}

.spec { width: 100%; border-collapse: collapse; margin-top: 20px; font-size: 14px; }
.spec th, .spec td { text-align: left; padding: 9px 0; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
.spec th { font-weight: 500; color: var(--ink-3); width: 38%; }

.aside { border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; }
.aside__price { font-size: 27px; font-weight: 700; letter-spacing: -0.025em; }
.aside__actions { display: grid; gap: 8px; margin: 16px 0; }

.seller { border-top: 1px solid var(--rule); padding-top: 15px; margin-top: 4px; font-size: 14px; }
.seller__name { font-weight: 600; }
.seller__line { color: var(--ink-3); font-size: 13px; margin-top: 3px; }

.notice {
  border: 1px solid var(--rule); border-left: 3px solid var(--ink);
  padding: 13px 15px; font-size: 13.5px; color: var(--ink-2);
  border-radius: var(--radius); margin: 18px 0;
}
.notice strong { color: var(--ink); }

/* --- Home ----------------------------------------------------------------- */

.hero { padding: 62px 0 46px; border-bottom: 1px solid var(--rule); text-align: center; }
.hero h1 { font-size: clamp(30px, 5.2vw, 50px); letter-spacing: -0.033em; }
.hero p { margin: 15px auto 0; max-width: 54ch; color: var(--ink-3); font-size: 16px; }

.cats {
  display: grid; gap: 1px; margin: 34px 0;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.cat {
  background: var(--paper); padding: 19px 15px; text-align: center;
  box-shadow: 0 0 0 1px var(--rule);
}
.cat:hover { background: var(--paper-2); text-decoration: none; }
.cat__name { font-weight: 600; font-size: 15px; }
.cat__count { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

.section-head {
  display: flex; align-items: baseline; gap: 14px;
  margin: 46px 0 16px; padding-bottom: 11px; border-bottom: 1px solid var(--rule);
}
.section-head a { margin-left: auto; font-size: 13.5px; color: var(--ink-3); }

/* --- Footer --------------------------------------------------------------- */

.foot { border-top: 1px solid var(--rule); margin-top: 66px; padding: 38px 0 52px; font-size: 13.5px; color: var(--ink-3); }
.foot__cols { display: grid; gap: 30px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.foot h3 { font-size: 11px; letter-spacing: 0.075em; text-transform: uppercase; color: var(--ink-4); margin-bottom: 10px; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.foot__legal { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--ink-4); }

/* --- Pagination ----------------------------------------------------------- */

.pager { display: flex; gap: 7px; justify-content: center; align-items: center; margin: 34px 0; font-size: 14px; }
.pager a, .pager span {
  min-width: 38px; min-height: 38px; padding: 0 11px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule); border-radius: var(--radius); color: var(--ink-2);
}
.pager a:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }
.pager [aria-current] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.empty { padding: 62px 20px; text-align: center; color: var(--ink-3); border: 1px dashed var(--rule); border-radius: var(--radius); }
.empty h2 { color: var(--ink); margin-bottom: 8px; }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
