.achievements {
  margin: 30px 0;
  padding: clamp(18px, 3vw, 32px);
  border: 1px solid #e7dcd2;
  border-radius: 20px;
  background: #fffdf9;
  color: var(--ink-plum, #392937);
  box-shadow: 0 6px 24px rgb(87 61 42 / 6%);
  scroll-margin-top: 18px;
}
.achievement-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.achievements .achievement-heading h2 { margin: 0; font-family: var(--font-display, Georgia, serif); font-size: clamp(1.65rem, 2.7vw, 2.12rem); letter-spacing: -.035em; color: var(--ink-plum, #392937); }
.achievement-heading > span { color: #705b51; font-size: .92rem; }
.achievement-heading > span strong { color: #884437; font-variant-numeric: tabular-nums; white-space: nowrap; }
.achievements .achievement-shelf {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
}
.achievement-shelf > li { min-width: 0; }
[data-badge="visits"] { --badge-ink: #42745b; --badge-tint: #edf4e9; }
[data-badge="managed"] { --badge-ink: #8c6224; --badge-tint: #fbefd7; }
[data-badge="edits"] { --badge-ink: #795b83; --badge-tint: #f5edf5; }
[data-badge="photos"] { --badge-ink: #386c7c; --badge-tint: #e8f2f3; }
.achievement summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 4px 13px;
  border-radius: 14px;
  cursor: pointer;
  list-style: none;
}
.achievement summary::-webkit-details-marker { display: none; }
.achievement summary:focus-visible { background: var(--badge-tint); }
.achievement summary:focus-visible, .badge-close:focus-visible { outline: 3px solid #4e7281; outline-offset: 2px; }
.achievement-art {
  display: grid;
  place-items: center;
  width: clamp(80px, 7.7vw, 98px);
  max-width: 100%;
  aspect-ratio: 1;
  margin: 0 auto 8px;
}
.achievement-art > * { grid-area: 1 / 1; }
.achievement-art svg { display: block; width: 100%; height: 100%; }
.achievement-art img { display: block; width: 69%; height: 69%; object-fit: contain; }
.achievement-art .ring-track, .achievement-art .ring-fill { fill: none; stroke-width: 3; }
.achievement-art .ring-track { stroke: #e6e0d8; }
.achievement-art .ring-fill { stroke: var(--badge-ink); stroke-linecap: round; }
.achievement-art .badge-field { fill: var(--badge-tint); }
.achievement-name { font-family: var(--font-display, Georgia, serif); font-size: 1.13rem; font-weight: 700; line-height: 1.3; color: var(--ink-plum, #392937); }
.achievement-state, .achievement-count { font-size: .875rem; color: #655e58; line-height: 1.55; }
.achievement-state { display: inline-flex; gap: 3px; align-items: center; }
.achievement-state .icon { width: 13px; height: 13px; }
.achievement[data-earned="true"] .achievement-state { color: var(--badge-ink); font-weight: 650; }
.achievement-count, .contribution-totals dd, .next-milestone strong { font-variant-numeric: tabular-nums; }
.contribution-totals { margin: 18px 0 0; padding: 18px 0 0; border-top: 1px solid #e8dfd5; }
.contribution-totals h3 { margin: 0; font-family: var(--font-display, Georgia, serif); font-size: 1.27rem; color: var(--ink-plum, #392937); }
.contribution-totals dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 36px; margin: 10px 0 0; }
.contribution-totals dl div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; }
.contribution-totals dt { display: flex; align-items: center; gap: 9px; font-size: .94rem; color: #514842; }
.contribution-totals dt img { width: 27px; height: 27px; object-fit: contain; flex: none; }
.contribution-totals dd { margin: 0; font-weight: 750; color: #463c38; }
@media (hover: hover) {
  .achievement summary:hover { background: #f8f3ed; }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .achievement summary { transition: background-color .16s ease; }
  .achievement-art img { transition: transform .16s ease; }
  .achievement summary:hover .achievement-art img { transform: translateY(-2px); }
}
@media (min-width: 880px) {
  .contribution-totals dl:has(> div:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 22px; }
}
.achievements .achievement-detail h3 { margin: 0; font-family: var(--font-display, Georgia, serif); font-size: 1.5rem; line-height: 1.25; }
.achievement-detail p { margin: 6px 0 16px; color: #536259; line-height: 1.5; }
.achievements .badge-milestones { padding: 0; margin: 0; list-style: none; }
.badge-milestones li { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-top: 1px solid #e1e6df; }
.milestone-mark { display: grid; place-items: center; flex: none; width: 23px; height: 23px; border-radius: 50%; background: #f1f3ef; color: #55645b; font-size: .78rem; font-weight: 650; line-height: 1; }
.milestone-mark .icon { width: 15px; height: 15px; }
.badge-milestones [data-complete="true"] .milestone-mark { background: var(--badge-tint); color: var(--badge-ink); }
.badge-milestones strong { font-size: .94rem; }
.badge-milestones small { margin-left: auto; color: #58655f; }
.next-milestone { margin-top: 16px; font-size: .84rem; color: #536259; }
.next-milestone strong { float: right; color: var(--badge-ink); }
.next-milestone progress { display: block; width: 100%; height: 7px; margin-top: 5px; accent-color: var(--badge-ink); }
.achievement-dialog {
  width: min(360px, calc(100% - 32px)); max-height: calc(100dvh - 40px);
  border: 1px solid #ddcfc1; border-radius: 20px; padding: 28px;
  color: #392e34; background: #fffdf9; box-shadow: 0 12px 45px rgb(58 40 33 / 19%);
}
.achievement-dialog::backdrop { background: rgb(49 40 42 / 44%); }
.achievement-dialog .achievement-art { width: 104px; }
.achievement-dialog .achievement-detail h3 { text-align: center; }
.achievement-dialog .achievement-detail p { text-align: center; }
.badge-close {
  position: absolute; inset: 6px 6px auto auto; display: grid; place-items: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%; color: #4d4943; background: transparent; cursor: pointer;
}
.badge-close:hover { background: #f5ede4; }
.badge-close .icon { width: 18px; height: 18px; }
.achievement[open] .achievement-detail { padding: 12px 4px; }
.achievement-shelf:has(details[open]) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
@media (max-width: 580px) {
  .achievements .achievement-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 10px; }
  .achievement-shelf:has(details[open]) > li:has(details[open]) { grid-column: 1 / -1; }
  .contribution-totals dl { grid-template-columns: 1fr; }
}
@media (forced-colors: active) {
  .achievement-art .ring-track { stroke: GrayText; }
  .achievement-art .ring-fill { stroke: Highlight; }
  .achievement-art .badge-field { fill: Canvas; }
}
