/* Horse & person profiles, photo / video gallery and albums. Uses the app.css tokens (light / dark, RTL-safe). */

/* ---------------- profile header */
.pf-head { position: relative; overflow: hidden; }
.pf-head.has-cover { padding-top: 0; }
.pf-cover { height: 170px; margin: -16px -18px 12px; background: var(--green) center / cover no-repeat; border-radius: var(--r) var(--r) 0 0; position: relative; }
.pf-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 40%, rgba(13, 23, 18, .45)); }
.pf-head.has-cover .hp-back { position: absolute; inset-block-start: 12px; inset-inline-start: 14px; z-index: 2; background: color-mix(in srgb, var(--panel) 85%, transparent); padding: 4px 10px; border-radius: 99px; }
.pf-head.has-cover .hp-id { position: relative; z-index: 1; align-items: flex-start; }
.pf-head.has-cover .hp-photo { margin-top: -64px; box-shadow: 0 0 0 4px var(--panel); }
.pf-ph, .hcard-ph { display: grid; place-items: center; width: 100%; height: 100%; color: var(--mute); }
.pf-ph .ico-horse, .hcard-ph .ico-horse { width: 58%; height: 58%; }
.hp-photo .pf-ph { background: var(--panel2); }
.hp-acts .btn span, .pp-contact .btn span { white-space: nowrap; }
.pf-rest { background: var(--straw-bg); border-color: var(--straw); color: var(--straw-ink); }
.pf-owe { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.pf-strip { display: flex; gap: 6px; overflow-x: auto; margin: 10px 0 4px; scrollbar-width: thin; }
.pf-strip:empty { display: none; }
.pf-strip button { flex: none; width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 14px 14px 6px 6px; overflow: hidden; padding: 0; cursor: pointer; background: var(--panel2); color: var(--ink); font: 700 13px var(--f-mono); }
.pf-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pp-contact { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pp-photo span { font: 700 26px var(--f-head); color: var(--ink); }

/* ---------------- tabs: one scrollable row with counts (the column may never grow wider than the screen) */
.pf .hp-main > *, .pf .hp-col, .pf .hp-body { min-width: 0; max-width: 100%; }
.pf .hp-two > *, .pf .hp-ov > *, .pf .stack > *, .pf .card { min-width: 0; max-width: 100%; } .pf .tbl-wrap { max-width: 100%; overflow-x: auto; }
.pf .row-link > span { min-width: 0; overflow-wrap: anywhere; } .pf .row-link > small { flex: none; }
.pf-tabs { display: flex; gap: 2px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.pf-tabs button { flex: none; white-space: nowrap; }
.pf-tabs button em { font: 600 10px var(--f-mono); font-style: normal; background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; margin-inline-start: 4px; }
.pf-tabs button.on em { background: var(--clay); color: var(--green); border-color: var(--clay); }

/* ---------------- cards inside tabs */
.pf-wide { grid-column: 1 / -1; }
.pf-facts .dl { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.dl.one { grid-template-columns: 1fr; gap: 8px; }
.pf-kpis { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin-bottom: 12px; }
.pf-kpis .kpi b { font-size: 22px; }
.pf-actions { margin-bottom: 12px; }
.pf-bal { font-size: 15px; margin: 4px 0 10px; } .pf-bal b { font-size: 26px; }
.row-link.more { justify-content: center; color: var(--tack); font-weight: 700; }
.hp-card-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pf-newlink { margin-top: 12px; padding: 12px; border: 1.5px dashed var(--clay); border-radius: 12px; display: flex; flex-direction: column; gap: 8px; }
.pf-newlink input { font-family: var(--f-mono); font-size: 13px; }

/* preventive care matrix */
.pf-mx { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.pf-mx-c { display: flex; flex-direction: column; gap: 2px; padding: 10px 10px 8px; border-radius: 16px 16px 6px 6px; border: 1.5px solid var(--line2); background: var(--panel); text-decoration: none; color: var(--ink); min-width: 0; }
.pf-mx-c small { font: 600 10px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-mx-c b { font-size: 17px; } .pf-mx-c em { font: 500 11px var(--f-mono); font-style: normal; color: var(--mute); }
.pf-mx-c.ok { background: var(--ok-bg); border-color: transparent; } .pf-mx-c.warn { background: var(--straw-bg); border-color: var(--straw); } .pf-mx-c.bad { background: var(--bad-bg); border-color: var(--bad); }
.pf-mx-c.none { border-style: dashed; background: transparent; }

/* charts */
.pf-line { width: 100%; height: auto; display: block; overflow: visible; }
.pf-path { fill: none; stroke: var(--clay); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.pf-dot { fill: var(--panel); stroke: var(--clay); stroke-width: 2; }
.pf-target { stroke: var(--sage); stroke-width: 1.5; stroke-dasharray: 5 4; }
.pf-lbl { font: 500 9.5px var(--f-mono); fill: var(--mute); }

/* cameras tab */
.pf-cam { display: grid; grid-template-columns: 96px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.pf-cam-v { width: 96px; height: 60px; border-radius: 12px 12px 4px 4px; overflow: hidden; background: var(--green); display: grid; place-items: center; color: #8FA596; }
.pf-cam-v img { width: 100%; height: 100%; object-fit: cover; }
.pf-cam span small { display: block; color: var(--mute); font-size: 12.5px; }

/* digital card */
.pf-card-box { display: flex; justify-content: center; margin: 6px 0 12px; max-width: 100%; overflow: hidden; }

/* person: horses grid */
.pf-horses { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pf-hcard { display: flex; flex-direction: column; gap: 4px; padding: 0 0 10px; border: 1px solid var(--line); border-radius: 18px 18px 8px 8px; overflow: hidden; text-decoration: none; color: var(--ink); background: var(--panel); }
.pf-hcard img, .pf-hcard .pf-ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--panel2); }
.pf-hcard b, .pf-hcard small, .pf-hcard .b { margin-inline: 10px; } .pf-hcard small { color: var(--mute); font-size: 12.5px; } .pf-hcard .b { align-self: flex-start; }

/* ---------------- media gallery */
.mg > header { flex-wrap: wrap; }
.mg-kind { margin-inline-end: 4px; }
.mg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.mg.compact .mg-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.mg-empty { grid-column: 1 / -1; }
.mg-item { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 14px 14px 6px 6px; overflow: hidden; background: var(--panel2); cursor: pointer; display: block; }
.mg-item img, .mg-item video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.mg-item:hover img, .mg-item:hover video { transform: scale(1.03); transition: transform .2s; }
.mg-item.sel { outline: 3px solid var(--clay); outline-offset: -3px; }
.mg-play { position: absolute; inset: 0; margin: auto; width: 38px; height: 38px; border-radius: 50%; background: rgba(13, 23, 18, .6); color: #fff; display: grid; place-items: center; font-style: normal; }
.mg-dur { position: absolute; inset-block-end: 6px; inset-inline-end: 6px; background: rgba(13, 23, 18, .7); color: #fff; font-size: 10.5px; padding: 1px 6px; border-radius: 99px; }
.mg-shared { position: absolute; inset-block-start: 6px; inset-inline-end: 6px; background: var(--sage); color: var(--green); border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; font-style: normal; }
.mg-shared .ico { width: 14px; height: 14px; }
.mg-check { position: absolute; inset-block-start: 6px; inset-inline-start: 6px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(13, 23, 18, .35); color: transparent; display: grid; place-items: center; font-style: normal; }
.mg-item.sel .mg-check { background: var(--clay); border-color: var(--clay); color: var(--green); }
.mg-check .ico { width: 14px; height: 14px; }
.mg-cap { position: absolute; inset-inline: 0; inset-block-end: 0; padding: 14px 8px 6px; background: linear-gradient(transparent, rgba(13, 23, 18, .75)); color: #fff; font-size: 12px; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-bulk { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); }
.mg-bulk b { margin-inline-end: 6px; }
.mg-drop { border: 2px dashed var(--clay); border-radius: 12px; padding: 18px; text-align: center; color: var(--tack); font-weight: 700; margin-bottom: 10px; display: flex; gap: 8px; justify-content: center; align-items: center; }
.mg-progress:empty { display: none; } .mg-progress { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.mg-up { display: grid; grid-template-columns: minmax(0, 1fr) 120px 60px; gap: 8px; align-items: center; font-size: 13px; }
.mg-up span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-up > i { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; display: block; } .mg-up > i > i { display: block; height: 100%; width: 0; background: var(--clay); transition: width .2s; }
.mg-up.err { color: var(--bad); grid-template-columns: minmax(0, 1fr) 0 minmax(0, 2fr); }
.mg-lb .modal-body { padding: 0; }
.mg-view { position: relative; background: #0D1712; display: grid; place-items: center; min-height: 240px; max-height: 70vh; }
.mg-view img, .mg-view video { max-width: 100%; max-height: 70vh; display: block; }
.mg-nav { position: absolute; inset-block-start: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(243, 239, 230, .85); color: #12201A; cursor: pointer; display: grid; place-items: center; }
.mg-nav.prev { inset-inline-start: 10px; } .mg-nav.next { inset-inline-end: 10px; } .mg-nav:disabled { opacity: .25; cursor: default; }
[dir="rtl"] .mg-nav .ico { transform: scaleX(-1); }
.mg-meta { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.mg-meta .ref-tags { margin: 4px 0; }
.mg-albums-pick { display: flex; flex-direction: column; margin-bottom: 10px; }

/* ---------------- gallery page & albums */
.gal-albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.gal-hint { grid-column: 1 / -1; }
.gal-album { display: flex; flex-direction: column; gap: 3px; text-decoration: none; color: var(--ink); min-width: 0; }
.gal-cover { position: relative; aspect-ratio: 4 / 3; border-radius: 22px 22px 8px 8px; overflow: hidden; background: var(--green); display: grid; place-items: center; color: #8FA596; }
.gal-cover img { width: 100%; height: 100%; object-fit: cover; }
.gal-cover em { position: absolute; inset-block-end: 8px; inset-inline-end: 8px; background: var(--clay); color: var(--green); font-size: 11px; font-style: normal; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.gal-album b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gal-album small { color: var(--mute); font-size: 12.5px; }
.gal-album:hover .gal-cover { outline: 2px solid var(--clay); }

/* ---------------- phones */
@media (max-width: 760px) {
  .pf-cover { height: 120px; margin: -14px -14px 10px; }
  .pf-head.has-cover .hp-photo { margin-top: -48px; }
  .hp-acts .btn span, .pp-contact .btn span { display: none; }
  .mg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .mg-item { border-radius: 8px; }
  .mg > header .btn span { display: none; }
  .mg-up { grid-template-columns: minmax(0, 1fr) 70px 44px; }
  .pf-cam { grid-template-columns: 72px 1fr auto; } .pf-cam .b:last-child { display: none; } .pf-cam-v { width: 72px; height: 48px; }
  .gal-albums { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pf-mx { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
