/* ============================================================================
   Rent Comps Tracker — photos.css
   The comp-editor Photos card. Pairs with photos.js; the two files ARE the
   feature, and deleting both removes it cleanly.

   🔴 EVERYTHING HERE IS SCOPED UNDER #ph-card, AND THAT IS NOT STYLE PEDANTRY.
   The comp EDITOR and the tab-2 LIST cards both carry `.comp-card`, and a
   `.comp-card > .card-body` rule written for the editor once collapsed every
   list card's content into a single 58px grid track — an 806px card rendering
   58px of content (fixed in 16c9e88). Any selector here that is not anchored to
   #ph-card can reach cards this feature has never heard of. Do not unscope one
   "because it reads cleaner".

   Phone-first, like the rest of the app: the base rules are the phone layout and
   the ≥900px block only refines it. Tap targets stay at 38px+ because the primary
   user is photographing a leasing office on a phone, not dragging files at a desk.
   ========================================================================= */

/* ------------------------------------------------------------ section headers */
#ph-card .ph-sub {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
  margin: 12px 0 7px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
#ph-card .ph-sub:first-child { margin-top: 2px; padding-top: 0; border-top: 0; }
#ph-card .ph-sub-t {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: .03em;
}
#ph-card .ph-sub-n {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 6px;
}
#ph-card .ph-sub-h {
  flex: 1 1 100%;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
}
#ph-card .ph-sub-h code {
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 3px;
}

/* ------------------------------------------------------------------- the tiles */
/* A single row of four on a phone would be 90px each and useless, so the strip
   wraps two-up and the ≥900px block takes it to four. */
#ph-card .ph-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#ph-card .ph-tile {
  position: relative;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  -webkit-tap-highlight-color: transparent;
}
#ph-card .ph-tile.has { border-style: solid; background: var(--card); }
#ph-card .ph-tile:hover { border-color: var(--direct); }

/* The drag state has to be unmistakable — a dashed grey border going slightly
   less grey is not feedback. */
#ph-card .ph-tile.over {
  border-color: var(--direct);
  border-style: solid;
  background: #eff6ff;
  box-shadow: inset 0 0 0 2px var(--direct);
}
#ph-card .ph-tile.busy { cursor: progress; opacity: .72; }

#ph-card .ph-shot {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Fixed aspect rather than a fixed height: a portrait phone photo and a
     landscape exterior then occupy the same tile and the strip stays a grid. */
  aspect-ratio: 4 / 3;
  min-height: 92px;
  background: #eef1f5;
}
#ph-card .ph-tile.small .ph-shot { min-height: 78px; }
#ph-card .ph-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#ph-card .ph-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  padding: 4px;
  line-height: 1.3;
}
#ph-card .ph-plus { font-size: 19px; line-height: 1; color: var(--direct); }

#ph-card .ph-cap {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  min-height: 26px;
  border-top: 1px solid var(--line);
  background: var(--card);
}
#ph-card .ph-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 38px of tappable area from a 20px glyph, via padding rather than a bigger ✕ —
   the same trick the unit-mix row actions use. */
#ph-card .ph-x {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  padding: 9px 7px;
  margin: -9px -5px -9px 0;
  cursor: pointer;
  border-radius: 5px;
}
#ph-card .ph-x:hover { color: var(--err); background: var(--err-bg); }

/* ------------------------------------------------------------- plan galleries */
#ph-card .ph-plan {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--card);
  overflow: hidden;
}
#ph-card .ph-plan-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  /* Same convention as the comps button row: scroll sideways rather than wrap to
     a second line, so a long plan name cannot double the header's height. */
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
#ph-card .ph-plan-head::-webkit-scrollbar { display: none; }
#ph-card .ph-plan-name { font-weight: 600; font-size: 12.5px; color: var(--ink); }
#ph-card .ph-count {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 6px;
}
#ph-card .ph-path {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
#ph-card .ph-warn {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--warn);
  background: var(--warn-bg);
  border-radius: 9px;
  padding: 1px 6px;
}

#ph-card .ph-plan-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 8px;
}

/* ------------------------------------------------------------ empty / error */
#ph-card .ph-empty {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  line-height: 1.45;
}
#ph-card .ph-empty.err {
  color: var(--err);
  background: var(--err-bg);
  border-color: #fca5a5;
  border-style: solid;
}
#ph-card .ph-empty code {
  font-size: 11px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 3px;
}

/* ------------------------------------------------------------------- desktop */
@media (min-width: 900px) {
  /* Four across, matching the Screener's photo strip so the two screens read as
     the same set of pictures. */
  #ph-card .ph-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }

  /* auto-fill, not a fixed count: a plan with two photos should not leave four
     empty tracks, and one with nine should not force a horizontal scroll. */
  #ph-card .ph-plan-body {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 8px;
  }
  #ph-card .ph-tile.small .ph-shot { min-height: 88px; }
  #ph-card .ph-sub-h { flex: 1 1 auto; text-align: right; }
}
