/* ===========================================================
   PREP LIKE NOAH — TRUSTED BRANDS
   Requires pln-base.css (tokens, top bar, masthead, footer,
   detail-modal shell).
   =========================================================== */

.brand-intro { max-width: 60ch; margin: 0 auto 10px; text-align: center; color: var(--text); font-size: 16.5px; }

.brand-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  max-width: 1180px; margin: 0 auto; padding: 26px 24px 0;
}
@media (max-width: 1100px) { .brand-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .brand-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px)  { .brand-grid { grid-template-columns: 1fr; } }

.brand-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-box);
  overflow: hidden; display: flex; flex-direction: column; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
  text-align: left; font: inherit; color: inherit; padding: 0;
}
.brand-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.brand-card:focus-visible { outline: 2px solid var(--select); outline-offset: 2px; }
.brand-card, .brand-card *, .brand-card:hover * { text-decoration: none; }

.brand-logo {
  position: relative; width: 100%; aspect-ratio: 16 / 9; background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand-logo img { position: absolute; inset: 18px; width: calc(100% - 36px); height: calc(100% - 36px); object-fit: contain; }
.brand-logo.is-empty { background: var(--page); }
.brand-logo.is-empty::after {
  content: attr(data-initial); position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--disp); font-size: 34px; color: var(--line-strong);
}

.brand-body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.brand-name {
  font-family: var(--body); font-weight: 700; font-size: 17px; line-height: 1.3;
  color: var(--head);
}
.brand-excerpt {
  color: var(--text); font-size: 15px; line-height: 1.5;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.brand-tag {
  margin-top: auto; padding-top: 10px;
  font-size: 12.5px; font-weight: 700; color: var(--select);
}
.brand-tag:empty { display: none; }

/* ——— brand modal: ARK's listing header ———
   Fixed-height cover, logo badge overlapping its bottom edge on the
   left, name and domain set beside the badge. */
#brand-modal .imodal { grid-template-columns: minmax(0, 1fr); width: min(620px, 100%); }
#brand-modal .imodal-body { padding: 0 0 24px; max-height: 88vh; }

.brand-head { position: relative; }
.brand-cover {
  width: 100%; height: 168px; object-fit: cover; display: block;
  background: var(--page); border-bottom: 1px solid var(--line);
}
.brand-cover[hidden] { display: none; }
.brand-id {
  display: flex; align-items: flex-end; gap: 14px;
  padding: 0 26px; margin-top: -34px; position: relative; z-index: 1;
}
.brand-badge {
  flex: none; width: 84px; height: 84px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(51,47,40,.18);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
/* [hidden] is only display:none at the UA default, which an img rule like
   this one outranks. A brand with no logo file kept rendering the
   element, so the browser drew its broken-image placeholder, still
   carrying the previous brand's alt text. */
.brand-badge img[hidden] { display: none; }
.brand-badge img { width: 100%; height: 100%; object-fit: contain; padding: 9px; }
.brand-badge.is-empty::after {
  content: attr(data-initial); font-family: var(--disp);
  font-size: 32px; color: var(--line-strong);
}
.brand-id-text { min-width: 0; padding-bottom: 4px; }
.brand-id-text .imodal-cat { margin-bottom: 2px; }
.brand-id-text h2 { font-family: var(--body); font-weight: 700; font-size: 25px; line-height: 1.2; color: var(--head); }

#brand-modal .imodal-inner { padding: 18px 26px 0; }

.brand-visit {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 6px;
  background: var(--rust); color: #fff; text-decoration: none;
  font-size: 15px; font-weight: 700; padding: 10px 18px; border-radius: var(--radius-field);
  transition: background .14s ease;
}
.brand-visit:hover { background: var(--rust-deep); }
.brand-gearlist { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.brand-gearlist li {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  background: var(--page); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px;
}

@media (max-width: 760px) {
  .brand-cover { height: 132px; }
  .brand-id { padding: 0 18px; margin-top: -28px; gap: 12px; }
  .brand-badge { width: 68px; height: 68px; }
  .brand-id-text h2 { font-size: 22px; }
  #brand-modal .imodal-inner { padding: 16px 18px 0; }
}

/* ——— the strip that rides on the Gear page ——— */
.brand-strip { padding: 22px 0 2px; }
.brand-strip-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 4px; }
.brand-strip-head h2 {
  font-family: var(--disp); font-weight: 600; font-size: 24px;
  text-transform: uppercase; letter-spacing: .02em; color: var(--head);
}
.brand-strip-head a { margin-left: auto; font-size: 14px; font-weight: 700; color: var(--rust); text-decoration: none; white-space: nowrap; }
.brand-strip-head a:hover { text-decoration: underline; }
.brand-strip p.sub { color: var(--text); font-size: 15px; margin-bottom: 12px; max-width: 62ch; }
.brand-rail-wrap { position: relative; }
.rail-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; padding: 0;
  background: var(--card); border: 1px solid var(--line); color: var(--head);
  box-shadow: 0 2px 12px rgba(51,47,40,.22);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2; transition: background .14s ease, color .14s ease;
}
.rail-nav:hover { background: var(--head); color: #fff; border-color: var(--head); }
/* The glyph must never be its own hover target — let every pointer
   event (and therefore the cursor) resolve to the button itself. */
.rail-nav svg { width: 20px; height: 20px; pointer-events: none; }
.brand-rail-wrap .rail-nav, .brand-rail-wrap .rail-nav * { cursor: pointer; }
.rail-nav[hidden] { display: none; }
/* half the button sits over the rail, half outside it */
.rail-prev { left: -22px; }
.rail-next { right: -22px; }
@media (max-width: 700px) { .rail-prev { left: -14px; } .rail-next { right: -14px; } }

.brand-rail {
  display: flex; gap: 10px; overflow-x: auto; padding: 3px 2px 12px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.brand-rail::-webkit-scrollbar { height: 8px; }
.brand-rail::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
/* One white card, no separate logo plate: the plate's own background and
   hairline made a seam and cost vertical space for nothing. The mark now
   fills more of a shorter band, and the name is given a fixed two-line
   box so every tile ends at the same height — the stretch to the tallest
   card was what left ~30px dead under the shorter ones. */
/* The logo band flexes, so when a neighbouring tile is taller the slack is
   absorbed ABOVE the mark instead of being left dead under the text. The
   text block stays snug at the bottom of every tile. */
/* No drop shadow in the rail: at a 10px gap the shadows of adjacent
   cards overlap and pool into a dark band that reads as a background. */
.brand-rail .brand-card {
  flex: 0 0 196px; scroll-snap-align: start; background: #fff;
  display: flex; flex-direction: column; box-shadow: none;
}
.brand-rail .brand-card:hover { box-shadow: var(--shadow); }
.brand-rail .brand-logo {
  flex: 1 1 auto; min-height: 86px; aspect-ratio: auto;
  background: transparent; border-bottom: 0;
}
.brand-rail .brand-logo img { inset: 14px 12px 6px; width: calc(100% - 24px); height: calc(100% - 20px); }
.brand-rail .brand-logo.is-empty::after { font-size: 30px; }
.brand-rail .brand-body { flex: 0 0 auto; padding: 0 13px 12px; gap: 3px; }
.brand-rail .brand-name { font-size: 16.5px; line-height: 1.25; }
.brand-rail .brand-excerpt { -webkit-line-clamp: 2; font-size: 14.5px; line-height: 1.4; }

/* ——— contact details in the brand pop-up ——— */
.brand-contact { margin: 16px 0 4px; display: flex; flex-direction: column; gap: 9px; }
.brand-contact > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.brand-contact dt {
  font-size: 13px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.brand-contact dd { font-size: 16px; color: var(--text); word-break: break-word; }
.brand-contact a { color: var(--rust); font-weight: 600; text-decoration: none; }
.brand-contact a:hover { text-decoration: underline; }
@media (max-width: 520px) {
  .brand-contact > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

.brand-hours { margin: 12px 0 4px; }
.brand-hours summary {
  cursor: pointer; font-size: 15px; font-weight: 700; color: var(--head);
  padding: 8px 0; list-style: none;
}
.brand-hours summary::-webkit-details-marker { display: none; }
.brand-hours summary::before { content: '▸ '; color: var(--rust); }
.brand-hours[open] summary::before { content: '▾ '; }
.brand-hours dl { display: flex; flex-direction: column; gap: 5px; padding: 4px 0 6px; }
.brand-hours dl > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; }
.brand-hours dt { font-size: 15px; font-weight: 600; color: var(--muted); }
.brand-hours dd { font-size: 15px; color: var(--text); }

/* ——— localhost-only editor ——— */
/* One footer row: the action a visitor wants on the left, the editing
   controls after it. mountEditButton() replaces the editbar's contents, so
   the visit link has to be its sibling rather than its child. */
.brand-foot {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
}
.brand-editbar { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.brand-editbar:empty { display: none; }
.brand-edit-btn, .brand-save-btn {
  font: inherit; font-weight: 700; font-size: 15px; padding: 10px 16px;
  border-radius: var(--radius-field); border: 1px solid var(--line);
  background: var(--page); color: var(--ink); cursor: pointer;
}
.brand-edit-btn:hover { border-color: var(--muted); }
.brand-save-btn { background: var(--head); border-color: var(--head); color: #fff; }
.brand-save-btn:hover { background: var(--select); border-color: var(--select); }

.brand-edit-form { display: flex; flex-direction: column; gap: 12px; padding-bottom: 6px; }
.bf { display: block; }
.bf > span {
  display: block; font-size: 13px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 5px;
}
.bf input, .bf textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-field);
  background: var(--page); color: var(--ink);
}
.bf textarea { font-family: ui-monospace, Menlo, monospace; font-size: 14px; line-height: 1.5; resize: vertical; }
.bf input:focus, .bf textarea:focus { outline: 2px solid var(--rust-ring); outline-offset: -1px; border-color: var(--rust); }
.bf-err { color: var(--rust); font-weight: 700; font-size: 15px; }
.bf-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.bf-cancel {
  font: inherit; font-weight: 700; font-size: 15px; padding: 10px 18px;
  border-radius: var(--radius-field); border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer;
}
.bf-cancel:hover { border-color: var(--muted); }
