/* ============================================================================
   MEKOZZA · ADOPT — the directory
   ----------------------------------------------------------------------------
   Styles the browse page only. Its own prefix, .mkad, and its own file,
   because adoption.css and the .mka- prefix are shared by five pages —
   adopt_pet, adopt_hub, adopt_post and adopt_chat read the same rules, and
   restyling them here would restyle all of those too.

   What this replaces: a page that spent its whole first screen on words. A
   two-line display headline, a three-line paragraph, a four-line membership
   panel and a filter bar came to roughly 800px before the first animal, on a
   page whose entire job is to show animals. The copy is not deleted — it is
   said in the fewest words that still say it, and the pet is the thing.

   The card is the design: a photograph that fills it, the name written on the
   photograph, and the facts underneath. Nothing is lost from the old card —
   status, photo count, name, breed, age, gender, city and what membership
   opens are all still on it.
   ========================================================================= */

.mkad {
  --ink:    #14202c;
  --ink-2:  #5a6b7b;
  --ink-3:  #8795a3;

  --brand:  #ff6b35;
  --brand-d:#e2542a;
  --brand-s:#fff2ec;

  --ok:     #0a7c3f;
  --ok-s:   #e7f6ed;
  --warn:   #9a5b00;
  --warn-s: #fff4e2;

  --paper:  #ffffff;
  --ground: #f6f7f9;
  --line:   rgba(20,32,44,.09);
  --line-2: rgba(20,32,44,.16);

  --sh:     0 1px 2px rgba(20,32,44,.05), 0 8px 20px -14px rgba(20,32,44,.3);
  --sh-up:  0 2px 6px rgba(20,32,44,.07), 0 18px 34px -20px rgba(20,32,44,.4);

  --ease:   cubic-bezier(.22,.61,.36,1);
  --pad:    14px;

  display: block;
  background: var(--ground);
  color: var(--ink);
  font-family: 'Open Sans', system-ui, sans-serif;
  padding-bottom: 26px;
}

.mkad *, .mkad *::before, .mkad *::after { box-sizing: border-box; }

.mkad__wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--pad);
}


/* ==========================================================================
   1 · THE HEAD
   One row: the title with the count beside it, and the actions opposite.
   Nothing else. The paragraph that used to sit under it said three things
   the directory itself says better — how many pets there are is the count,
   that listing is free is on the button that does it, and how you reach an
   owner is on the pet's own page, where you reach them.
   ====================================================================== */
.mkad__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 13px;
}

.mkad__h1 {
  margin: 0;
  min-width: 0;
  font-family: 'Poppins', sans-serif;
  font-size: clamp(24px, 7vw, 32px);
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
}
/* The count, set as a quiet companion to the word rather than a second
   heading: same baseline, a third of the size, brand-tinted. */
.mkad__h1 em {
  flex: 0 0 auto;
  font-style: normal;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .005em;
  color: var(--brand-d);
  background: var(--brand-s);
  border: 1px solid #ffdcc9;
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
}

.mkad__acts {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* "My adoption" is the icon it already had, without the word. It is a
   returning user's shortcut, not a thing to teach a first-time visitor,
   so it does not need to be as loud as the one action that grows the
   directory. */
.mkad-ico {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper);
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-size: 13.5px;
  text-decoration: none;
  transition: transform .18s var(--ease), background .18s var(--ease);
}
.mkad-ico:active { transform: scale(.92); }


/* ---- buttons ---------------------------------------------------------- */
.mkad-btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  font: 700 13.5px/1 'Poppins', sans-serif;
  letter-spacing: -.01em;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease),
              background .18s var(--ease);
}
.mkad-btn:active { transform: scale(.96); }
.mkad-btn i { font-size: 12px; }

.mkad-btn--go {
  background: linear-gradient(135deg, var(--brand), #ff8a5c);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px -7px rgba(255,107,53,.85);
}
.mkad-btn--sm { padding: 8px 13px; font-size: 12.5px; }


/* ==========================================================================
   2 · THE BAR
   Species, then filters. Sticky, because on a directory the controls are
   what you come back to between pets.
   ====================================================================== */
/* No panel, no band, no border. The controls sit on the page's own ground.

   (Not sticky, and deliberately: mobile.css sets `overflow-x: hidden
   !important` on body for every page, which makes body a scroll container,
   and a scroll container that never scrolls silently disables
   position:sticky for everything inside it. Moving that guard up to <html>
   — how index.php solves the same problem — makes sticky work and uncovers
   the header's off-canvas menu, measured at 320px PAST the right edge of a
   390px screen. A page that scrolls sideways is the worse bug.) */
.mkad__bar {
  position: relative;
  z-index: 2;
  padding: 0 0 2px;
}

/* the species rail -------------------------------------------------- */
.mkad__chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  /* The rail bleeds to both page edges so the last chip does not look
     clipped by a gutter, and the gutter is restored as padding. */
  margin: 0 calc(var(--pad) * -1);
  padding: 2px var(--pad) 2px;
  scroll-snap-type: x proximity;
}
.mkad__chips::-webkit-scrollbar { display: none; }

.mkad-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--paper);
  color: var(--ink);
  font: 700 12.5px/1 'Poppins', sans-serif;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .18s var(--ease), background .18s var(--ease),
              color .18s var(--ease), border-color .18s var(--ease);
}
.mkad-chip i { font-size: 11.5px; opacity: .72; }
.mkad-chip:active { transform: scale(.95); }
.mkad-chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.mkad-chip.is-on i { opacity: 1; color: #ff9a6e; }


/* ==========================================================================
   3 · FILTERS
   The same six fields and the same form. Folded on a phone, open from
   720px, and forced open when something is already applied — a hidden
   control that is silently changing the results is how people conclude a
   site is broken.
   ====================================================================== */
.mkad-filters { margin: 9px 0 0; }

.mkad-fold {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--sh);
  overflow: hidden;
}
.mkad-fold > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  font: 700 13px/1 'Poppins', sans-serif;
  letter-spacing: -.01em;
  color: var(--ink);
  user-select: none;
}
.mkad-fold > summary::-webkit-details-marker { display: none; }
.mkad-fold > summary > span:first-child {
  display: inline-flex; align-items: center; gap: 7px;
}
.mkad-fold > summary i.fa-sliders { color: var(--brand); font-size: 13px; }

.mkad-badge {
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  font-size: 10.5px;
  display: inline-grid;
  place-items: center;
}

.mkad-count {
  margin-left: auto;
  font: 600 12px/1 'Open Sans', sans-serif;
  color: var(--ink-3);
  white-space: nowrap;
}

.mkad-fold-x {
  color: var(--ink-3);
  font-size: 12px;
  transition: transform .22s var(--ease);
}
.mkad-fold[open] .mkad-fold-x { transform: rotate(180deg); }

.mkad-fgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  padding: 2px 13px 11px;
  border-top: 1px solid var(--line);
  margin-top: -1px;
}
.mkad-f { min-width: 0; display: grid; gap: 4px; }
.mkad-f label {
  font: 700 10.5px/1 'Poppins', sans-serif;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.mkad-f input,
.mkad-f select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fbfcfd;
  padding: 9px 10px;
  font: 600 13px/1.2 'Open Sans', sans-serif;
  color: var(--ink);
  /* 13px, not 16px: iOS zooms the viewport on focus below 16px. The page
     sets maximum-scale free, so the zoom is reversible — and a 16px filter
     field makes the grid two rows taller than it needs to be. */
  -webkit-appearance: none;
  appearance: none;
}
.mkad-f select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.5L6 8.5L10 4.5' fill='none' stroke='%238795a3' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 12px;
  padding-right: 26px;
}
.mkad-f input:focus,
.mkad-f select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(255,107,53,.16);
}

.mkad-frow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px 12px;
}
.mkad-frow .mkad-count { margin-left: 0; margin-right: auto; }


/* ==========================================================================
   4 · THE MEMBERSHIP LINE
   A line of text with a padlock and an arrow — not a card. It is a
   disclosure, which has to be read once and then got out of the way; it
   was a bordered, tinted, three-line panel louder than anything else
   between the controls and the first animal.
   ====================================================================== */
.mkad-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 11px 0 0;
  padding: 2px 0;
  font: 600 11.6px/1.35 'Open Sans', sans-serif;
  color: var(--ink-2);
  text-decoration: none;
  transition: color .18s var(--ease);
}
.mkad-note > i:first-child {
  flex: 0 0 auto;
  width: 19px; height: 19px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-s);
  color: var(--brand-d);
  font-size: 9px;
}
.mkad-note span { min-width: 0; }
/* Next to the sentence, not pushed to the far edge. An arrow alone at the
   right margin of a 390px screen reads as a separate control pointing at
   nothing; beside the words it is plainly the end of the link. */
.mkad-note__go {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--brand-d);
  transition: transform .2s var(--ease);
}
.mkad-note:active { color: var(--ink); }
.mkad-note:active .mkad-note__go { transform: translateX(2px); }
@media (hover: hover) {
  .mkad-note:hover { color: var(--ink); }
  .mkad-note:hover .mkad-note__go { transform: translateX(3px); }
}


/* ==========================================================================
   5 · THE GRID
   Two across on a phone. A pet directory read one-per-row makes a visitor
   scroll past six animals to see six animals.
   ====================================================================== */
.mkad-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  margin: 12px 0 0;
}

.mkad-card {
  position: relative;
  display: block;
  border-radius: 16px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--sh);
  text-decoration: none;
  color: inherit;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.mkad-card:active { transform: scale(.975); }
@media (hover: hover) {
  .mkad-card:hover { transform: translateY(-3px); box-shadow: var(--sh-up); }
  .mkad-card:hover .mkad-card__img { transform: scale(1.05); }
}

/* ---- the photograph ---- */
.mkad-card__shot {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  background: #e9edf1;
  overflow: hidden;
}
.mkad-card__img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .45s var(--ease);
}
.mkad-card__none {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  color: #b9c4cd;
  font-size: 34px;
  background: linear-gradient(160deg, #eef1f4, #e3e8ed);
}

/* The name is written ON the photograph, over a scrim that only darkens
   the bottom third — a flat overlay on the whole picture turns every
   animal grey. */
.mkad-card__scrim {
  position: absolute;
  inset: auto 0 0 0;
  height: 62%;
  background: linear-gradient(to top,
              rgba(8,14,20,.86) 0%,
              rgba(8,14,20,.55) 38%,
              rgba(8,14,20,0) 100%);
  pointer-events: none;
}
.mkad-card__say {
  position: absolute;
  inset: auto 9px 8px 9px;
  color: #fff;
  display: grid;
  gap: 1px;
  pointer-events: none;
}
.mkad-card__name {
  margin: 0;
  font: 800 15px/1.15 'Poppins', sans-serif;
  letter-spacing: -.03em;
  text-shadow: 0 1px 4px rgba(6,10,14,.5);
  /* Names run from "Bo" to "Maharaja Singh"; one line, and the rest of the
     card does not move because of it. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mkad-card__meta {
  font-size: 10.8px;
  font-weight: 600;
  line-height: 1.3;
  color: rgba(255,255,255,.84);
  text-shadow: 0 1px 3px rgba(6,10,14,.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- the two badges on the picture ---- */
.mkad-pill {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  border-radius: 999px;
  padding: 4px 9px;
  font: 700 10px/1 'Poppins', sans-serif;
  letter-spacing: .01em;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 3px 10px -4px rgba(8,14,20,.55);
}
.mkad-pill.is-ok    { background: var(--ok-s);    color: var(--ok); }
.mkad-pill.is-brand { background: var(--brand-s); color: var(--brand-d); }
.mkad-pill.is-warn  { background: var(--warn-s);  color: var(--warn); }
.mkad-pill.is-muted { background: #eef1f4;        color: var(--ink-2); }

.mkad-shots {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 8px;
  font: 700 10px/1 'Poppins', sans-serif;
  background: rgba(8,14,20,.58);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
}
.mkad-shots i { font-size: 9px; }

/* ---- the strip under the picture ---- */
.mkad-card__foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 9px;
  min-width: 0;
}
.mkad-where {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  /* flex-basis 0 so it gives way to the lock chip rather than pushing it
     off the card, and min-width 0 so it is allowed to shrink at all. */
  flex: 1 1 0;
  min-width: 0;
  font: 600 11px/1.2 'Open Sans', sans-serif;
  color: var(--ink-2);
}
.mkad-where i { color: var(--brand); font-size: 10px; flex: 0 0 auto; }
/* The ellipsis lives on the text, not on the flex row: text-overflow does
   nothing to a flex container's children. */
.mkad-where b {
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mkad-lock {
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 8px;
  font: 700 10px/1 'Poppins', sans-serif;
  background: #f1f4f7;
  color: var(--ink-3);
}
.mkad-lock i { font-size: 8.5px; }
.mkad-lock b { font-weight: 700; }

/* Below 375px the card is 141px wide and the labelled chip took half of it.
   The padlock alone still says "there is more behind this", and the city —
   which is the one fact on the foot that differs between pets — gets the
   room. The full list stays in the chip's title. */
@media (max-width: 374px) {
  .mkad-lock { padding: 4px 6px; }
  .mkad-lock b { display: none; }
}


/* ==========================================================================
   6 · EMPTY, AND THE PAGER
   ====================================================================== */
.mkad-empty {
  margin: 16px 0 0;
  padding: 30px 20px;
  border-radius: 18px;
  background: var(--paper);
  border: 1px dashed var(--line-2);
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 7px;
}
.mkad-empty > i {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-s);
  color: var(--brand);
  font-size: 18px;
  margin-bottom: 2px;
}
.mkad-empty h3 {
  margin: 0;
  font: 700 17px/1.2 'Poppins', sans-serif;
  letter-spacing: -.025em;
}
.mkad-empty p { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); }

.mkad-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 18px 0 0;
  flex-wrap: wrap;
}
.mkad-pager a,
.mkad-pager span {
  min-width: 34px;
  height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  font: 700 12.5px/1 'Poppins', sans-serif;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
}
.mkad-pager span.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.mkad-pager a:active { transform: scale(.95); }


/* ==========================================================================
   7 · THE REVEAL
   Cards fade up as they arrive. CSS hides them ONLY once the script has
   marked the page, so a browser with no JavaScript — and a crawler — sees
   every pet.
   ====================================================================== */
[data-mkad-reveal] .mkad-r {
  opacity: 0;
  transform: translate3d(0, 12px, 0);
}
[data-mkad-reveal] .mkad-r.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .5s var(--ease) var(--d, 0ms),
              transform .5s var(--ease) var(--d, 0ms);
}


/* ==========================================================================
   8 · WIDER
   ====================================================================== */
@media (min-width: 560px) {
  .mkad-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mkad-fgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 720px) {
  .mkad { --pad: 22px; }
  .mkad__top { padding: 24px 0 16px; }

  /* There is room for the filters at this width, so they are not a fold. */
  .mkad-fold > summary { cursor: default; }
  .mkad-fold-x { display: none; }
  .mkad-fgrid { display: grid !important; }

  /* With the fields always open, the summary is a label rather than a
     control, and the note can sit on the same line as the chips' right
     edge without crowding anything. */
  .mkad-note { font-size: 12.3px; }
}

@media (min-width: 960px) {
  .mkad-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mkad-fgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}


/* ==========================================================================
   9 · REDUCED MOTION
   Everything that moves, stops. The reveal still ENDS visible, because a
   fade that never runs would otherwise leave the directory blank.
   ====================================================================== */
@media (prefers-reduced-motion: reduce) {
  .mkad *,
  .mkad *::before,
  .mkad *::after {
    animation: none !important;
    transition: none !important;
  }
  [data-mkad-reveal] .mkad-r { opacity: 1; transform: none; }
}
