/* Achievements: /achievements (the catalogue), /achievements/hall (the Hall of Fame and the newest deeds) and the
   Achievements section of the character sheet. Tokens live in site.css; the category tints come from chapters.css
   (data-tint sets --element and --tint-rgb); the tally band and the chips from features.css. */

/* ---------- Glyphs (Pages/Shared/_AchIcons.cshtml) ---------- */

.ach-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ach-glyph { flex: none; width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ach-icon {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  color: var(--element, var(--lilac)); background: rgb(var(--tint-rgb, 183 163 240) / 0.13); border: 1px solid rgb(var(--tint-rgb, 183 163 240) / 0.32);
}
.ach-icon .ach-glyph { width: 24px; height: 24px; }
.ach-icon-sm { width: 30px; height: 30px; border-radius: 9px; }
.ach-icon-sm .ach-glyph { width: 17px; height: 17px; }
.fl-chip .ach-glyph { width: 14px; height: 14px; color: var(--element, var(--lilac)); }

/* ---------- Rarity ---------- */

[data-rarity] { --rarity: var(--ash); }
[data-rarity="common"] { --rarity: #b9b2d6; }
[data-rarity="uncommon"] { --rarity: #86d6a2; }
[data-rarity="rare"] { --rarity: #77aeeb; }
[data-rarity="epic"] { --rarity: #c99bf5; }
[data-rarity="legendary"] { --rarity: var(--crystal); }
.ach-rarity { display: grid; gap: 5px; }
.ach-rarity .bar { height: 4px; --bar: var(--rarity); }
.ach-rarity-text strong { color: var(--rarity); font-weight: 600; }
.ach-rarity-tag { font: 600 0.6875rem/1.2 var(--font-ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--rarity, var(--ash)); white-space: nowrap; }

/* ---------- Points ---------- */

.ach-points {
  flex: none; display: inline-flex; align-items: baseline; gap: 3px; padding: 4px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid rgb(243 199 106 / 0.38); color: var(--crystal); font-size: 0.9375rem; line-height: 1.2;
}
.ach-points-unit { margin-left: 3px; font: 600 0.625rem/1 var(--font-ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ash); }

/* ---------- The catalogue ---------- */

.ach-closed { padding: clamp(56px, 8vw, 96px) 0; }
.ach-closed-panel { padding: clamp(24px, 4vw, 40px); display: grid; gap: 14px; border-style: dashed; }

.ach-tools { display: grid; gap: 10px; padding-top: 28px; scroll-margin-top: 140px; }
.ach-search { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ach-search .input { height: 44px; flex: 1 1 260px; min-width: 0; }
.ach-search .ach-sort { flex: 0 1 220px; }
.ach-found { font-size: 0.9375rem; }

.ach-cat { padding: clamp(40px, 6vw, 80px) 0; border-bottom: 1px solid var(--ash-15); scroll-margin-top: 120px; background: radial-gradient(60% 40% at 0% 0%, rgb(var(--tint-rgb, 183 163 240) / 0.07), transparent 70%); }
.ach-cat-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: start; max-width: 780px; margin-bottom: clamp(24px, 4vw, 40px); }
.ach-cat-head > div { display: grid; gap: 8px; }
.ach-cat-icon { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; color: var(--element); background: rgb(var(--tint-rgb) / 0.12); border: 1px solid rgb(var(--tint-rgb) / 0.35); box-shadow: 0 0 40px -12px rgb(var(--tint-rgb) / 0.6); }
.ach-cat-icon .ach-glyph { width: 32px; height: 32px; }

.ach-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: start; }
.ach-card {
  display: grid; gap: 14px; align-content: start; padding: 18px 18px 16px; border-radius: 16px; scroll-margin-top: 140px;
  border: 1px solid var(--ash-20); background: linear-gradient(165deg, rgb(var(--tint-rgb, 183 163 240) / 0.1), rgb(27 21 51 / 0.82) 45%);
}
.ach-card:target, .ach-tier:target { border-color: rgb(243 199 106 / 0.7); box-shadow: 0 0 0 1px rgb(243 199 106 / 0.35); }
.ach-card-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.ach-card-title { display: grid; gap: 3px; min-width: 0; }
.ach-kicker { font: 600 0.6875rem/1.3 var(--font-ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--element, var(--petal)); }
.ach-name { font: 600 1.0625rem/1.3 var(--font-ui); color: var(--mist); overflow-wrap: anywhere; }
.ach-card-body { display: grid; gap: 10px; }
.ach-text { color: var(--mist-80); font-size: 0.9375rem; line-height: 1.5; }
.ach-secret { font-family: var(--font-inscription); letter-spacing: 0.2em; color: var(--petal); }
.ach-reward, .ach-first { line-height: 1.45; }
.ach-reward { color: var(--mist); }
.ach-tag { border-color: rgb(183 163 240 / 0.45); color: var(--lilac); }
.ach-card.is-secret { border-style: dashed; background: linear-gradient(165deg, rgb(154 140 196 / 0.1), rgb(27 21 51 / 0.82) 45%); }
.ach-card.is-secret .ach-name { font-family: var(--font-inscription); letter-spacing: 0.2em; color: var(--petal); }

.ach-tiers { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--ash-15); }
.ach-tier { display: grid; grid-template-columns: 2.4em minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; padding: 12px 6px 12px 0; border-bottom: 1px solid var(--ash-15); border-radius: 8px; scroll-margin-top: 140px; }
.ach-tier:last-child { border-bottom: 0; padding-bottom: 2px; }
.ach-roman { padding-top: 2px; color: var(--element, var(--lilac)); font-size: 0.8125rem; text-align: center; }
.ach-tier-body { display: grid; gap: 7px; min-width: 0; }
.ach-tier-title { font-weight: 600; color: var(--mist); line-height: 1.35; }
.ach-tier .ach-points { font-size: 0.8125rem; padding: 3px 8px; }

/* ---------- The Hall of Fame ---------- */

.ach-hall { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; padding: clamp(40px, 6vw, 80px) 0; }
@media (max-width: 900px) { .ach-hall { grid-template-columns: 1fr; } }
.ach-hall-panel { padding: clamp(20px, 3vw, 28px); display: grid; gap: 16px; }
.ach-hall-head { display: grid; gap: 6px; }
.ach-fame { list-style: none; margin: 0; padding: 0; display: grid; }
.ach-fame-row { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--ash-15); }
.ach-fame-row:last-child { border-bottom: 0; }
.ach-place { color: var(--ash); font-size: 1.05rem; text-align: right; }
.ach-fame-row.is-top .ach-place { color: var(--crystal); font-size: 1.4rem; text-shadow: 0 0 18px rgb(243 199 106 / 0.5); }
.ach-fame-who { display: grid; gap: 1px; min-width: 0; }
.ach-fame-name { font-family: var(--font-inscription); font-size: 1.3rem; line-height: 1.2; color: var(--mist); text-decoration: none; overflow-wrap: anywhere; }
.ach-fame-name:hover { color: var(--lilac); }
.ach-honor { font-family: var(--font-story); font-style: italic; font-size: 1.05rem; line-height: 1.3; color: var(--crystal); }
.ach-fame-points { display: inline-flex; align-items: baseline; gap: 2px; white-space: nowrap; }
.ach-fame-points .mono { font-size: 1.3rem; color: var(--crystal); }
.ach-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ach-feed-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; font-size: 0.9375rem; line-height: 1.4; }
.ach-feed-row .ach-icon { color: var(--rarity); border-color: color-mix(in srgb, var(--rarity) 40%, transparent); background: color-mix(in srgb, var(--rarity) 12%, transparent); }
.ach-feed-text { min-width: 0; }
.ach-feed-deed { color: var(--mist); font-weight: 600; text-decoration: none; }
.ach-feed-deed:hover { color: var(--lilac); }
.ach-feed-row time { white-space: nowrap; }

/* ---------- The character sheet's Achievements ---------- */

.sheet-achievements { display: grid; gap: 18px; margin-top: 18px; }
.sheet-achievements .tally-headline { grid-template-columns: repeat(4, auto); }
/* Cards in columns, each as tall as it needs (as the tally's). */
.ach-sheet-grid { columns: 3 320px; column-gap: 18px; }
.ach-sheet-grid > article { break-inside: avoid; margin-bottom: 18px; }
.ach-ranks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; font-size: 0.8125rem; }
.ach-ranks li { display: flex; justify-content: space-between; gap: 6px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--ash-15); color: var(--ash); }
.ach-ranks li.is-on { color: var(--mist); border-color: rgb(243 199 106 / 0.4); background: rgb(243 199 106 / 0.06); }
.ach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ach-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; font-size: 0.9rem; line-height: 1.35; }
.ach-list-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.ach-list-text strong { font-weight: 600; color: var(--mist); }
.ach-list-meta { color: var(--crystal); font-size: 0.875rem; white-space: nowrap; }
.ach-list time { white-space: nowrap; }
.ach-cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.ach-cat-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 0.9rem; line-height: 1.3; }
.ach-cat-list .bar { grid-column: 1 / -1; height: 4px; --bar: var(--element); }
.ach-cat-name { display: inline-flex; align-items: center; gap: 8px; }
.ach-cat-name .ach-glyph { width: 16px; height: 16px; color: var(--element); }
.ach-cat-list li.is-done .ach-cat-name { color: var(--crystal); }
.ach-progress { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ach-progress li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 0.9rem; line-height: 1.35; }
.ach-progress .bar { grid-column: 1 / -1; height: 5px; --bar: var(--crystal); }
@media (max-width: 640px) {
  .sheet-achievements .tally-headline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ach-list li { grid-template-columns: auto minmax(0, 1fr) auto; }
  .ach-list time { grid-column: 2 / -1; }
}
