/*
  Pet profile (resources/views/pets/profile.blade.php) in the look of the
  IAGD SuperApp profile: the pet's own photo blurred behind the top, the
  round photo, the name, the registration line and the actions, then the
  facts and flat sections under plain headings. A phone gets the About and
  Health tabs. From 1024px the top runs as a full-width band and the
  sections sit in two columns, with no tabs.

  The facility profile (resources/views/animal_facilities/profile.blade.php)
  takes the same parts; iagd-facility.css adds its logo and its roster.

  The LoVe ring, the health groups, the tiles, the records, the notices and
  the sheets keep their pp- rules in iagd-pet-profile.css.
  Prefix: pv-.
*/

/* ---- Top ------------------------------------------------------------- */

.pv-top {
  position: relative;
  overflow: hidden;
  padding: 12px 16px 28px;
}

/* The theme colours every bare link (.iagd-app a:not(...) in iagd-theme.css).
   These links keep the white of the app; the id in :is() only lifts the
   specificity, and no element carries it. */
.pv :is(.pv-bar .pp-back, a.pv-act, a.pv-cta, .pv-kind a, .pv-facts dd a, #pv-own-colour) {
  color: var(--color-text-on-dark);
}

/* The pet's photo, blurred, so each profile takes the colours of its pet.
   It fades out at the bottom into the page. */
.pv-wash {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent);
  mask-image: linear-gradient(to bottom, #000 62%, transparent);
}
.pv-wash img {
  position: absolute;
  top: -20%;
  left: -30%;
  width: 160%;
  height: 140%;
  max-width: none;
  object-fit: cover;
  opacity: 0.85;
  filter: blur(48px) saturate(1.35);
}
.pv-wash img.is-rip { filter: blur(48px) grayscale(1); }
.pv-wash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 16, 47, 0.2) 0%, rgba(20, 16, 47, 0.55) 75%);
}

.pv-top__in {
  position: relative;
  max-width: 640px;
  margin-inline: auto;
}

.pv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 20px;
}
.pv-bar__acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
/* Glass chips on the blurred photo. */
.pv-bar .pp-chip {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.pv-bar .pp-chip:hover { background: rgba(255, 255, 255, 0.16); }
.pv-bar .pp-chip--go { color: var(--color-text-on-dark); }

.pv-id { text-align: center; }

.pv-face {
  display: block;
  width: 164px;
  height: 164px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  overflow: hidden;
  background: var(--color-layer-soft);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.92), 0 18px 40px rgba(10, 5, 30, 0.5);
  cursor: zoom-in;
}
.pv-face__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 32%;
}

.pv-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  margin-top: 20px;
}
.pv-id--plain .pv-name-row { margin-top: 8px; }
.pv-name {
  min-width: 0;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--color-text-on-dark);
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.pv-rip {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-dim-1);
}
.pv-kind {
  margin-top: 8px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  text-wrap: balance;
}
.pv-kind a { border-bottom: 1px solid rgba(255, 255, 255, 0.3); }
.pv-kind a:hover { border-bottom-color: currentColor; }

/* The number is the product, so it reads at full size under the name. */
.pv-no {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 16px;
  margin-top: 12px;
}
.pv-no__iagd {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text-on-dark);
}
.pv-no__iagd--none {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--color-dim-1);
}
.pv-no .pp-mark { font-size: 13px; }
.pv-no .pp-mark svg { width: 16px; height: 16px; }

.pv-love { margin-top: 12px; }
.pv-love .pp-love__toggle {
  display: flex;
  width: fit-content;
  margin: -8px auto;
}
.pv-love .pp-love__panel { text-align: left; }

.pv-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-dim-1);
}

/* The pet's own actions, as glass squares on the blurred photo. */
.pv-acts {
  display: grid;
  grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}
.pv-act {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 82px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-on-dark);
  cursor: pointer;
  transition: transform 420ms var(--ease-spring), background-color 180ms var(--ease-fluent);
}
.pv-act:hover { background: rgba(255, 255, 255, 0.16); }
.pv-act:active {
  transform: scale(0.95);
  transition-duration: 120ms;
}
.pv-act svg { width: 26px; height: 26px; }

/* ---- Facts, notices and tabs ---------------------------------------- */

.pv-wrap {
  max-width: 640px;
  margin-inline: auto;
  padding: 0 16px 48px;
}

.pv-facts {
  display: grid;
  grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
  margin: 0 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-layer-stroke);
  text-align: center;
}
.pv-facts > div {
  min-width: 0;
  padding: 0 4px;
}
.pv-facts > div + div { border-left: 1px solid var(--color-layer-stroke); }
.pv-facts dt {
  font-size: 13px;
  color: var(--color-dim-1);
}
.pv-facts dd {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-on-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv-facts dd a { border-bottom: 1px solid rgba(196, 168, 255, 0.35); }
.pv-facts dd a:hover { border-bottom-color: currentColor; }

.pv-notes {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}
.pv-notes:not(:has(> *)) { display: none; }
.pv-notes > .pp-pending,
.pv-notes > .pp-note {
  max-width: none;
  margin: 0;
}

.pv-tabs {
  position: relative;
  display: flex;
  gap: 28px;
  margin-bottom: 20px;
  padding: 0 4px;
  border-bottom: 1px solid var(--color-layer-stroke);
}
.pv-tab {
  min-height: 44px;
  padding: 4px 0 12px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: var(--color-dim-1);
  cursor: pointer;
  transition: color 150ms var(--ease-fluent);
}
.pv-tab[aria-selected="true"] { color: var(--color-text-on-dark); }
.pv-tabs__line {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 3px;
  border-radius: 9999px;
  background: var(--color-accent-text);
  transition: left 420ms var(--ease-spring), width 420ms var(--ease-spring);
}

/* ---- Sections -------------------------------------------------------- */

/* One column on a phone: the two column wrappers step aside and each
   section takes its place in the app's order. */
.pv-body {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.pv-main,
.pv-side { display: contents; }
.pv-sec {
  order: var(--o, 0);
  min-width: 0;
  scroll-margin-top: 88px;
}
@media (max-width: 1023px) {
  .pv-body[data-tab-active="about"] [data-tab="health"],
  .pv-body[data-tab-active="health"] [data-tab="about"] { display: none; }
  /* The tab already names the Health section. */
  .pv-body.has-tabs [data-tab="health"] .pv-sec__head { display: none; }
}

.pv-sec__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}
.pv-sec__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text-on-dark);
  text-wrap: balance;
}
.pv-sec__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  margin: -12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent-text);
  white-space: nowrap;
}
.pv-sec__link:hover { text-decoration: underline; }
.pv-sec__count {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-dim-1);
}

/* One flat row: the label on the left, the value on the right. */
.pv-rows { margin: 4px 0 0; }
.pv-rows > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--color-layer-stroke);
}
.pv-rows > div:last-child { border-bottom: 0; }
.pv-rows dt {
  flex: 0 0 auto;
  font-size: 15px;
  color: var(--color-dim-1);
}
.pv-rows dd {
  min-width: 0;
  margin: 0;
  text-align: right;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-on-dark);
  overflow-wrap: anywhere;
}
.pv-rows dd a { color: var(--color-accent-text); }
.pv-rows dd a:hover { text-decoration: underline; }
.pv-rows__aside,
.pv-rows__private {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 400;
  color: var(--color-dim-2);
}
.pv-rows__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 18px;
}

/* ---- Parents --------------------------------------------------------- */

.pv-parents {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.pv-parent {
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--color-layer-alt);
  color: inherit;
  transition: transform 420ms var(--ease-spring);
}
a.pv-parent:active {
  transform: scale(0.97);
  transition-duration: 120ms;
}
/* One shape at every width, so a wide card shows the face and not the ears. */
.pv-parent__photo {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 13 / 10;
}
.pv-parent__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 25%;
}
.pv-parent__initial {
  font-size: 30px;
  font-weight: 700;
  color: var(--color-accent-text);
  opacity: 0.7;
}
.pv-parent.is-empty .pv-parent__initial { color: var(--color-dim-2); }
.pv-parent__text {
  display: block;
  min-width: 0;
  padding: 10px 12px 12px;
}
.pv-parent__role {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--color-accent-text);
}
.pv-parent__name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-top: 2px;
}
.pv-parent__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-on-dark);
}
.pv-parent__name.is-dim { color: var(--color-dim-1); }
/* The mark sits bare on the card. */
.pv-parent .pp-sex {
  width: auto;
  height: auto;
  background: none;
}
.pv-parent .pp-sex svg {
  width: 16px;
  height: 16px;
}
.pv-parent__detail,
.pv-parent__breeder {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--color-dim-2);
}
.pv-parent__detail--no {
  font-family: var(--font-mono);
  color: var(--color-dim-1);
}
.pv-parent__breeder { color: var(--color-dim-1); }
.pv-parent__source {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent-text);
}
.pv-parent--compact .pv-parent__text { padding: 8px 10px 10px; }
.pv-parent--compact .pv-parent__role { font-size: 11px; }
.pv-parent--compact .pv-parent__name { font-size: 15px; }

/* A pet with no parent on file gets one row into the tree. */
.pv-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--color-layer-stroke);
  background: rgba(255, 255, 255, 0.03);
  font-size: 15px;
  font-weight: 600;
  transition: background-color 180ms var(--ease-fluent), transform 420ms var(--ease-spring);
}
.pv-cta:hover { background: rgba(255, 255, 255, 0.06); }
.pv-cta:active {
  transform: scale(0.98);
  transition-duration: 120ms;
}
.pv-cta__lead {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.pv-cta__lead svg { color: var(--color-accent-text); }
.pv-cta > svg { color: var(--color-dim-1); }

.pv-gp { margin-top: 8px; }
.pv-gp__toggle {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 4px;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent-text);
  cursor: pointer;
}
.pv-gp__toggle::-webkit-details-marker { display: none; }
.pv-gp__hide { display: none; }
.pv-gp[open] .pv-gp__show { display: none; }
.pv-gp[open] .pv-gp__hide { display: inline; }
.pv-gp__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}
.pv-gp__row > li { min-width: 0; }
@media (min-width: 640px) {
  .pv-gp__row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---- Photos, eyes, achievements, health, files ------------------------ */

.pv-sec .pp-strip {
  margin: 12px -16px 0;
  padding: 0 16px 4px;
}
.pv-sec .pp-eyes { margin-top: 12px; }
.pv-sec .pp-eyes__side {
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-dim-1);
}

.pv-sec .pp-wins { margin-top: 4px; }
.pv-sec .pp-wins > li,
.pv-sec .pp-wins > li:first-child {
  padding: 14px 4px;
  border-bottom-color: var(--color-layer-stroke);
}
.pv-sec .pp-wins > li:last-child { border-bottom: 0; }
.pv-sec .pp-wins__title,
.pv-sec .pp-wins__place { font-size: 16px; }
.pv-sec .pp-wins__event { font-size: 14px; }

.pv-sec .pp-health {
  gap: 0;
  margin-top: 12px;
}
.pv-sec .pp-group + .pp-group {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--color-layer-stroke);
}
.pv-sec .pp-group__title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-text-on-dark);
}
.pv-sec .pp-group__title svg {
  width: 20px;
  height: 20px;
  color: var(--color-accent-text);
}
/* The group's link reads like a section link, not a capsule. */
.pv-sec .pp-chip--sm {
  height: auto;
  min-height: 40px;
  margin: -10px 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-accent-text);
}
.pv-sec .pp-chip--sm:hover {
  background: none;
  text-decoration: underline;
}
.pv-sec .pp-chip__n {
  font-family: inherit;
  font-size: 14px;
  color: var(--color-dim-1);
}
.pv-sec .pp-record { border-bottom-color: var(--color-layer-stroke); }
.pv-sec .pp-record__reason { font-size: 16px; }
.pv-sec .pp-record__dx { font-size: 14px; }
.pv-sec .pp-empty {
  padding: 0 4px;
  font-size: 15px;
}

.pv-sec .pp-tiles { margin-top: 12px; }
.pv-sec .pp-files { margin-top: 4px; }
.pv-sec .pp-files li { border-bottom-color: var(--color-layer-stroke); }
.pv-sec .pp-files a {
  padding: 14px 4px;
  font-size: 16px;
}

/* ---- Tablet and desktop ---------------------------------------------- */

@media (min-width: 641px) {
  .pv-top { padding: 16px 24px 32px; }
  .pv-top__in,
  .pv-wrap { max-width: 680px; }
  .pv-wrap { padding: 0 24px 72px; }
}

@media (min-width: 1024px) {
  .pv-top { padding: 16px 32px 40px; }
  .pv-top__in,
  .pv-wrap { max-width: 1120px; }
  .pv-wrap { padding: 0 32px 80px; }

  .pv-id {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    align-items: center;
    gap: 40px;
    text-align: left;
  }
  .pv-id--plain { grid-template-columns: minmax(0, 1fr); }
  .pv-face {
    width: 200px;
    height: 200px;
    margin: 0;
  }
  .pv-name-row,
  .pv-id--plain .pv-name-row {
    justify-content: flex-start;
    margin-top: 0;
  }
  .pv-name { font-size: 44px; }
  .pv-no,
  .pv-count { justify-content: flex-start; }
  .pv-love .pp-love__toggle { margin-left: 0; }
  .pv-acts {
    grid-template-columns: repeat(var(--n, 3), 116px);
    margin-top: 20px;
  }

  .pv-facts {
    margin-bottom: 28px;
    padding: 4px 0 20px;
  }

  .pv-tabs { display: none; }
  .pv-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
    gap: 56px;
  }
  .pv-main,
  .pv-side {
    display: flex;
    flex-direction: column;
    gap: 36px;
    min-width: 0;
  }

  .pv-sec .pp-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    margin: 12px 0 0;
    padding: 0;
    overflow: visible;
  }
  .pv-sec .pp-strip .pp-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }
}

/* ---- Entrance --------------------------------------------------------- */

@keyframes pvFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pvRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pvPop { from { opacity: 0; transform: scale(0.86); } to { opacity: 1; transform: none; } }

.pv-wash { animation: pvFade 900ms var(--ease-fluent-out) backwards; }
.pv-face { animation: pvPop 560ms var(--ease-spring) 60ms backwards; }
.pv-name-row { animation: pvRise 520ms var(--ease-fluent) 160ms backwards; }
.pv-kind,
.pv-no { animation: pvRise 440ms var(--ease-fluent-out) 240ms backwards; }
.pv-act { animation: pvRise 480ms var(--ease-spring) calc(300ms + var(--i, 0) * 60ms) backwards; }
.pv-facts,
.pv-tabs { animation: pvFade 400ms var(--ease-fluent-out) 460ms backwards; }

@media (prefers-reduced-motion: reduce) {
  .pv-wash, .pv-face, .pv-name-row, .pv-kind, .pv-no, .pv-act, .pv-facts, .pv-tabs { animation: none; }
  .pv-act, .pv-parent, .pv-tabs__line, .pv-tab { transition: none; }
}
