.shell:has(.pet-overview) { background: var(--white); }
.shell:has(.pet-overview) .sidebar { display: none; }
.shell:has(.pet-overview) main { padding-top: max(.875rem, env(safe-area-inset-top)); }

.pet-overview {
  --pet-profile-surface: var(--white);
  --pet-profile-title: #202219;
  --pet-profile-olive: #526f10;
  --pet-profile-blob: #f0f0e7;
  --pet-profile-chip: #f9f8ec;
  --pet-profile-accent: #a9ef00;
  color: var(--pet-profile-title);
}

:root[data-theme="dark"] .pet-overview {
  --pet-profile-surface: var(--paper);
  --pet-profile-title: var(--ink);
  --pet-profile-olive: var(--olive);
  --pet-profile-blob: #3d4731;
  --pet-profile-chip: var(--tab-paper);
  --pet-profile-accent: var(--lime);
}

.pet-overview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pet-overview-action {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.pet-overview-action:hover { background: var(--pet-profile-chip); text-decoration: none; }
.pet-overview-back { margin-inline-start: -.35rem; font-weight: 500; }
.pet-overview-menu { position: relative; margin-inline-end: -.35rem; z-index: 1; }
.pet-overview-menu summary { list-style: none; }
.pet-overview-menu summary::-webkit-details-marker { display: none; }
.pet-overview-menu-links {
  position: absolute;
  inset-block-start: calc(100% + .2rem);
  inset-inline-end: 0;
  width: max-content;
  max-width: 15rem;
  padding: .25rem;
  background: var(--pet-profile-surface);
  border: 1px solid var(--line);
  border-radius: .85rem;
  box-shadow: 0 6px 20px #171d1524;
}
.pet-overview-menu-links a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: .45rem .75rem;
  border-radius: .65rem;
  color: inherit;
  font-size: .9rem;
}
.pet-overview-menu-links a:hover { background: var(--pet-profile-chip); text-decoration: none; }

.pet-overview-hero {
  display: grid;
  justify-items: center;
  padding: clamp(.85rem, 4.8vw, 1.35rem) 0 clamp(1.75rem, 9vw, 2.8rem);
  text-align: center;
}

.pet-overview-portrait {
  position: relative;
  isolation: isolate;
  width: min(65vw, 17.25rem);
  max-width: calc(100% - 3rem);
  aspect-ratio: 1;
  margin: 0 0 clamp(1.15rem, 6vw, 1.75rem);
}

.pet-overview-portrait::before {
  position: absolute;
  z-index: -1;
  inset: .32rem -.72rem -.82rem .37rem;
  border-radius: 50%;
  background: var(--pet-profile-accent);
  box-shadow: 0 12px 22px #26341715;
  content: "";
}
.pet-overview-portrait::after {
  position: absolute;
  top: 77%;
  left: calc(100% + 1.25rem);
  width: .52rem;
  height: .52rem;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.pet-overview-photo {
  display: block;
  width: 100%;
  height: 100%;
  border: 4px solid var(--pet-profile-surface);
  border-radius: 50%;
  background: var(--pet-profile-blob);
  object-fit: cover;
}
.pet-overview-placeholder { display: grid; place-items: center; }
.pet-overview-placeholder .icon { width: 32%; height: auto; }
.pet-overview-star {
  position: absolute;
  top: 51%;
  right: -.78rem;
  font-size: clamp(1.6rem, 6vw, 2.25rem);
  line-height: 1;
}

.pet-overview-hero h1 {
  max-width: 100%;
  font-size: clamp(1.9rem, 9.4vw, 2.55rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -.06em;
}
.pet-overview-intro {
  display: -webkit-box;
  max-width: 31ch;
  margin-top: .6rem;
  overflow: hidden;
  color: var(--pet-profile-olive);
  font-size: clamp(.9rem, 4.2vw, 1.2rem);
  font-weight: 650;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.pet-overview-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .4rem .55rem;
  margin-top: 1rem;
}
.pet-overview-badges span {
  padding: .38rem .9rem;
  border-radius: 999px;
  font-size: clamp(.7rem, 3.3vw, .9rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: .045em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.pet-overview-breed { background: var(--pet-profile-chip); }
.pet-overview-age { color: #672008; background: #ff784e; }

.pet-overview-info {
  padding: clamp(1.05rem, 5.5vw, 1.6rem);
  border-radius: 1rem;
  background:
    radial-gradient(circle 4.4rem at 91% 15%, var(--pet-profile-blob) 98%, transparent),
    radial-gradient(ellipse at 5% 104%, var(--mint-soft) 1%, transparent 42%),
    var(--pet-profile-surface);
  box-shadow: 0 7px 24px #26341713;
}
.pet-overview-info h2 {
  display: flex;
  align-items: center;
  gap: .52rem;
  color: var(--pet-profile-olive);
  font-size: clamp(1.2rem, 5.6vw, 1.5rem);
  line-height: 1.15;
}
.pet-overview-info h2 span {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: .9rem;
}
.pet-overview-info dl {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem .85rem;
  margin: .85rem 0 0;
}
.pet-overview-info dt {
  margin-bottom: .12rem;
  font-size: .75rem;
  font-weight: 750;
  letter-spacing: .065em;
  text-transform: uppercase;
}
.pet-overview-info dd {
  font-size: clamp(.9rem, 4.4vw, 1.15rem);
  line-height: 1.35;
}
.pet-overview-chip { grid-column: 1 / -1; }
.pet-overview-chip dd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  min-height: 44px;
  padding-inline: .7rem .12rem;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: var(--pet-profile-chip);
  font-variant-numeric: tabular-nums;
}
.pet-overview-chip dd > span { min-width: 0; }
.pet-overview-copy {
  position: relative;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pet-profile-olive);
}
.pet-overview-copy:hover { background: var(--pet-profile-blob); }
.pet-overview-copy::before,
.pet-overview-copy::after {
  position: absolute;
  width: .59rem;
  height: .72rem;
  border: 1.5px solid currentColor;
  border-radius: .13rem;
  content: "";
}
.pet-overview-copy::before { top: .94rem; left: .82rem; }
.pet-overview-copy::after { top: .73rem; left: 1.03rem; background: var(--pet-profile-chip); }
.pet-overview-details, .profile-page .pet-overview + .profile-stats { margin-top: 1.15rem; }

.profile-page {
  --profile-ink: #1b1c15;
  --profile-coral: #ff7b55;
  --profile-cream: var(--tab-paper);
  --profile-shadow: #1b1c15;
  --profile-swoop: #d9dad6;
  --profile-saved: #e9e8dc;
  --profile-saved-ink: #273100;
  --profile-saved-label: #414732;
  --profile-setting-hover: #f3f2e4;
  --profile-logout-ink: #b82c1c;
  --profile-logout-surface: #fffef9;
  color: var(--profile-ink);
  padding: .2rem 2px 0;
}

:root[data-theme="dark"] .profile-page {
  --profile-ink: var(--ink);
  --profile-shadow: #100f0d;
  --profile-swoop: #606157;
  --profile-saved: var(--white);
  --profile-saved-ink: var(--ink);
  --profile-saved-label: var(--muted);
  --profile-setting-hover: var(--white);
  --profile-logout-ink: var(--danger);
  --profile-logout-surface: var(--white);
}

.profile-card {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 8rem;
  gap: .28rem;
  overflow: hidden;
  padding: .85rem 1rem;
  border: 1.5px solid var(--profile-ink);
  border-radius: 1.16rem 1.72rem 1.55rem 1.32rem;
  background: var(--white);
  box-shadow: 1.5px 3px 0 var(--profile-shadow);
  text-align: center;
}

.profile-card::before,
.profile-card::after {
  position: absolute;
  z-index: -1;
  border: 2px solid transparent;
  border-top-color: var(--profile-swoop);
  border-radius: 50%;
  transform: rotate(28deg);
  content: "";
  pointer-events: none;
}

.profile-card::before {
  top: .65rem;
  right: -.8rem;
  width: 4.8rem;
  height: 3.5rem;
}

.profile-card::after {
  top: 1.55rem;
  right: 1.2rem;
  width: 2.55rem;
  height: 1.9rem;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: .28rem;
  padding: .16rem;
  border: 1.5px solid var(--profile-ink);
  border-radius: 50%;
  outline: 1px dashed #79a700;
  outline-offset: .23rem;
  background: var(--lime);
  object-fit: cover;
}

.profile-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }

.profile-name {
  max-width: 100%;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  min-height: .95rem;
  padding: 0 .38rem;
  border: 1px solid #69210a;
  border-radius: 999px;
  background: var(--profile-coral);
  color: #69210a;
  font-size: .59rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .085em;
  text-transform: uppercase;
}

.profile-badge img { width: .65rem; height: .65rem; object-fit: contain; }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem .52rem;
  margin-top: .62rem;
}

.profile-stat {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 3.35rem;
  padding: .31rem .52rem .36rem;
  border: 1.5px solid var(--profile-ink);
  border-radius: 1.2rem 1.2rem 1.02rem 1.02rem;
  color: #273100;
  box-shadow: 1.5px 2.5px 0 var(--profile-shadow);
}

.profile-stat-diary { background: var(--lime); }
.profile-stat-saved {
  background: var(--profile-saved);
  color: var(--profile-saved-ink);
}

.profile-stat-milestones {
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  min-height: 2.5rem;
  padding: .27rem .62rem;
  border-radius: 1.06rem 1.95rem 1.34rem .94rem;
  background: var(--profile-coral);
}

:root[data-theme="dark"] :is(.profile-stat-diary, .profile-stat-milestones) {
  border-color: var(--profile-shadow);
}

.profile-stat-icon {
  display: block;
  width: .75rem;
  height: .75rem;
  object-fit: contain;
}

.profile-stat-value {
  font-size: 1.26rem;
  font-weight: 500;
  line-height: .97;
  font-variant-numeric: tabular-nums;
}

.profile-stat-label {
  margin-top: .15rem;
  color: #414732;
  font-size: .68rem;
  font-weight: 500;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.profile-stat-saved .profile-stat-label { color: var(--profile-saved-label); }
:root[data-theme="dark"] .profile-stat-saved .profile-stat-icon { filter: brightness(0) invert(.85); }
.profile-stat-milestones .profile-stat-icon { grid-row: 1; grid-column: 1; }
.profile-stat-milestones .profile-stat-value { grid-row: 2; grid-column: 1; }
.profile-stat-milestones .profile-stat-label {
  grid-row: 1 / -1;
  grid-column: 2;
  align-self: end;
  justify-self: end;
  margin: 0 .45rem .1rem .55rem;
  color: #6b1f00;
  text-align: end;
}

.profile-settings { margin-top: .85rem; }
.profile-settings > h2 {
  margin: 0 .12rem .26rem;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
}

.profile-settings-list {
  display: grid;
  gap: .36rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-setting {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .46rem;
  width: 100%;
  min-height: 2.125rem;
  padding: .23rem .52rem .23rem .26rem;
  border: 1px solid var(--profile-ink);
  border-radius: 999px;
  background: var(--profile-cream);
  color: var(--profile-ink);
  box-shadow: 1px 1.5px 0 var(--profile-shadow);
  font-size: .85rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: start;
  text-decoration: none;
}

:is(a, button, summary).profile-setting:hover { background: var(--profile-setting-hover); text-decoration: none; }
:is(a, button, summary).profile-setting:active {
  transform: translateY(1px);
  box-shadow: none;
}

.profile-setting-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid #66715b;
  border-radius: 50%;
  background: #e6f4dc;
  object-fit: contain;
}

.profile-setting-icon img { width: .8rem; height: .8rem; object-fit: contain; }
img.profile-setting-icon { padding: .21rem; }
.profile-setting-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.profile-setting-tail { flex: none; font-size: 1.16rem; font-weight: 400; line-height: 1; }

.profile-theme {
  display: inline-flex;
  flex: none;
  gap: 1px;
  padding: 1px;
  border: 1px solid var(--profile-ink);
  border-radius: 999px;
  background: var(--white);
}

.profile-theme-option {
  position: relative;
  min-width: 2.05rem;
  min-height: .95rem;
  padding: .08rem .24rem;
  border: 0;
  background: #fbfaee;
  color: #1b1c15;
  font-size: .62rem;
  font-weight: 750;
  line-height: 1.15;
}

.profile-theme-option::after {
  position: absolute;
  inset: -.5rem 0;
  content: "";
}

.profile-theme-option:is([data-theme="dark"], [value="dark"]) {
  background: #1b1c15;
  color: #fbfaee;
}

.profile-theme-option[aria-pressed="true"] {
  background: var(--lime);
  color: #1b1c15;
}

.profile-logout {
  width: 100%;
  min-height: 2.1rem;
  margin-top: 1rem;
  padding: .3rem .65rem;
  border: 1.5px solid #ef4933;
  background: var(--profile-logout-surface);
  color: var(--profile-logout-ink);
  box-shadow: 1px 2px 0 #ef4933;
  font-size: .69rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.profile-logout:active { transform: translateY(1px); box-shadow: none; }
