/* v0.9.9 achievements (ach-web): achievements.html and the summary block on My stats (account.html).
   Same tokens as style.css. The picture stays the object alone (release/v0.9.9/achievement-pictures.md); the
   frame, tier marks and locked look are layers drawn here. With Astra's frame files (Tools round, ach/FRAMES.md)
   a picture sits in the frame of its grade; the only movement on the site is those frames' calm effects. */

/* ---- Picture frame --------------------------------------------------------------------------------- */
/* Locked: grey and dim. Some tiers: a brass-line frame. Done: a full brass frame. Hidden: a question mark. */
.ach-pic{position:relative;flex:0 0 auto;width:64px;height:64px;display:grid;place-items:center;background:var(--inset);border:1px solid var(--line-strong);border-radius:var(--radius)}
.ach-pic img{width:56px;height:56px;object-fit:contain;display:block}
.ach-pic.state-locked img,.ach-pic.state-progress img{filter:grayscale(1) brightness(.62) contrast(.9)}
.ach-pic.state-progress{border-color:var(--control)}
.ach-pic.state-tiered{border-color:var(--brass-line);background:var(--brass-bg)}
.ach-pic.state-done{border-color:var(--brass);background:var(--brass-bg);box-shadow:inset 0 0 0 1px #00000066}
.ach-pic.secret{border-style:dashed;border-color:var(--control)}
.ach-pic.secret span{font:600 30px/1 var(--serif);color:var(--faint)}
.ach-pic.big{width:104px;height:104px}
.ach-pic.big img{width:92px;height:92px}
.ach-pic.small{width:44px;height:44px}
.ach-pic.small img{width:38px;height:38px}
.ach-pic.empty{border-style:dashed;background:transparent}

/* Tier pips: one small diamond per tier along the bottom edge, filled up to the tier reached (until the gem
   files exist; then the gems below replace them). */
.ach-pips{position:absolute;left:0;right:0;bottom:-5px;display:flex;justify-content:center;gap:3px}
.ach-pips i{width:7px;height:7px;transform:rotate(45deg);background:var(--inset);border:1px solid var(--control)}
.ach-pips i.on{background:var(--brass);border-color:var(--brass-hi)}
.ach-pic.small .ach-pips i{width:5px;height:5px}

/* ---- Frames by grade (Tools round 23.11.2026, ach/FRAMES.md) ----------------------------------------- */
/* Drawn when the manifest lists scripts/achievement_frames.py's files (achievements-core.js pictureBox). Every
   layer fills the box; the dark backing and the picture are the middle 64 %. Locked or only started: the frame
   of the grade the first unlock gives, in grey, and no effect layer at all. */
.ach-pic.framed{width:92px;height:92px;display:block;background:none;border:0;border-radius:0;box-shadow:none;isolation:isolate}
.ach-pic.framed.big{width:144px;height:144px}
.ach-pic.framed.small{width:60px;height:60px}
.ach-pic.framed>img.L,.ach-pic.framed>.fx-front,.ach-pic.framed>.fx-front>img.L{position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none}
.ach-pic.framed>.ach-back{position:absolute;left:18%;top:18%;width:64%;height:64%;display:grid;place-items:center;background:#101c23}
.ach-pic.framed>.ach-back>img{width:100%;height:100%;object-fit:contain;display:block}
.ach-pic.framed>.ach-back>span{font:600 28px/1 var(--serif);color:var(--faint)}
.ach-pic.framed.big>.ach-back>span{font-size:42px}
.ach-pic.framed.small>.ach-back>span{font-size:19px}
.ach-pic.framed.state-locked>img.ach-frame,.ach-pic.framed.state-progress>img.ach-frame{filter:grayscale(1) brightness(.5)}
.ach-pic.framed.state-locked>.ach-back>img,.ach-pic.framed.state-progress>.ach-back>img{filter:grayscale(1) brightness(.62) contrast(.9)}
.ach-framed .ach-pic.big.empty{width:144px;height:144px}

/* Tier gems: one per tier under the picture, the stone of that tier's grade when reached, the empty setting when
   not. The title of each names the tier's goal and points. */
.ach-picwrap{display:flex;flex-direction:column;align-items:center;gap:4px;min-width:0}
.ach-gems{display:flex;justify-content:center}
.ach-gems img{width:18px;height:18px;display:block}
.ach-picwrap.big .ach-gems img{width:22px;height:22px}
.ach-picwrap.small .ach-gems img{width:12px;height:12px}

/* Effects (Antti asked for them; keep them calm). Bronze none; silver a glint about every 7 s; gold a glint
   every 5 s and a glow that breathes; emerald also twinkles on the crystals and its two fire pictures fading
   into each other; mythic the same, stronger, with rising violet fire and a faint copy of it in front. Only
   opacity and transform move. They run only while the box is on screen (.live), start at different phases
   (.ph0 to .ph7), and stop for prefers-reduced-motion (the frame and a still glow stay). */
.ph0{--ph:0s}.ph1{--ph:-1.3s}.ph2{--ph:-2.6s}.ph3{--ph:-3.9s}.ph4{--ph:-5.2s}.ph5{--ph:-6.5s}.ph6{--ph:-7.8s}.ph7{--ph:-9.1s}
.ach-pic.framed .fx-glint{opacity:0;animation:ach-glint7 7s linear infinite}
.ach-pic.framed.g3 .fx-glint,.ach-pic.framed.g4 .fx-glint,.ach-pic.framed.g5 .fx-glint{animation-name:ach-glint5;animation-duration:5s}
.ach-pic.framed .fx-glint.k1{animation-delay:var(--ph,0s)}
.ach-pic.framed .fx-glint.k2{animation-delay:calc(var(--ph,0s) + .17s)}
.ach-pic.framed .fx-glint.k3{animation-delay:calc(var(--ph,0s) + .34s)}
.ach-pic.framed .fx-glint.k4{animation-delay:calc(var(--ph,0s) + .51s)}
@keyframes ach-glint7{0%{opacity:0}2.5%{opacity:1}5%{opacity:0}100%{opacity:0}}
@keyframes ach-glint5{0%{opacity:0}3.5%{opacity:1}7%{opacity:0}100%{opacity:0}}
.ach-pic.framed .fx-glow{opacity:.55;animation:ach-breathe 6s ease-in-out infinite;animation-delay:var(--ph,0s)}
.ach-pic.framed.g4 .fx-glow{animation-duration:5s}
.ach-pic.framed.g5 .fx-glow{animation-duration:4s}
@keyframes ach-breathe{0%,100%{opacity:.55}50%{opacity:1}}
.ach-pic.framed.g4 .fx-aura{animation:ach-swap 9s ease-in-out infinite;animation-delay:var(--ph,0s)}
.ach-pic.framed.g4 .fx-aura.b{opacity:0;animation-delay:calc(var(--ph,0s) - 4.5s)}
@keyframes ach-swap{0%,100%{opacity:1}50%{opacity:0}}
.ach-pic.framed.g5 .fx-aura{opacity:0;animation:ach-flame 3.2s linear infinite;animation-delay:var(--ph,0s)}
.ach-pic.framed.g5 .fx-aura.b{animation-delay:calc(var(--ph,0s) - 1.6s)}
@keyframes ach-flame{0%{opacity:0;transform:translateY(1%)}18%{opacity:1}50%{opacity:1}68%{opacity:0;transform:translateY(-1.2%)}100%{opacity:0;transform:translateY(-1.2%)}}
.ach-pic.framed>.fx-front{opacity:.35}
.ach-pic.framed .fx-tw{position:absolute;width:13%;height:13%;margin:-6.5% 0 0 -6.5%;opacity:0;transform:scale(.2);pointer-events:none;
 border-radius:50%;background:radial-gradient(closest-side,#fff 0,#e6fff6b0 30%,#e6fff600 100%);animation:ach-tw 4.6s ease-in-out infinite;animation-delay:var(--ph,0s)}
.ach-pic.framed.g5 .fx-tw{background:radial-gradient(closest-side,#fff 0,#efe8ffb0 30%,#efe8ff00 100%)}
.ach-pic.framed .fx-tw::before,.ach-pic.framed .fx-tw::after{content:'';position:absolute;left:50%;top:-45%;width:10%;height:190%;margin-left:-5%;background:linear-gradient(#fff0,#fff 50%,#fff0)}
.ach-pic.framed .fx-tw::after{transform:rotate(90deg)}
.ach-pic.framed .fx-tw.t1{left:13.5%;top:13.5%}
.ach-pic.framed .fx-tw.t2{left:50%;top:9%;animation-delay:calc(var(--ph,0s) - 1.5s)}
.ach-pic.framed .fx-tw.t3{left:86.5%;top:86.5%;animation-delay:calc(var(--ph,0s) - 3.1s)}
@keyframes ach-tw{0%,62%,100%{opacity:0;transform:scale(.2) rotate(0deg)}70%{opacity:1;transform:scale(1) rotate(45deg)}80%{opacity:0;transform:scale(.3) rotate(90deg)}}
.ach-pic.framed:not(.live) .fx{animation-play-state:paused}
@media(prefers-reduced-motion:reduce){
 .ach-pic.framed .fx{animation:none}
 .ach-pic.framed .fx-glint,.ach-pic.framed .fx-tw,.ach-pic.framed .fx-aura.b{display:none}
 .ach-pic.framed .fx-glow{opacity:.8}
 .ach-pic.framed .fx-aura.a{opacity:1;transform:none}
}

/* ---- Progress ---------------------------------------------------------------------------------------- */
.ach-progress{display:inline-flex;align-items:center;gap:10px;font-size:14px;color:var(--muted);font-variant-numeric:tabular-nums}
.ach-progress progress{appearance:none;-webkit-appearance:none;width:140px;height:6px;border:0;border-radius:3px;background:var(--inset);box-shadow:inset 0 0 0 1px var(--line-strong);overflow:hidden}
.ach-progress progress::-webkit-progress-bar{background:var(--inset);border-radius:3px}
.ach-progress progress::-webkit-progress-value{background:var(--brass-lo);border-radius:3px}
.ach-progress progress::-moz-progress-bar{background:var(--brass-lo);border-radius:3px}

/* ---- Notes for signed-out and unlinked visitors -------------------------------------------------------- */
.ach-note{max-width:760px}
.ach-note h2{font-size:26px;margin-bottom:12px}
.ach-note .button{margin:4px 0 18px}

/* ---- Overview: summary tiles, showcase, closest ------------------------------------------------------ */
.ach-summary{display:flex;flex-wrap:wrap;gap:1px;margin-bottom:28px;background:var(--line);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}
.ach-tile{flex:1 1 200px;padding:18px 20px;background:var(--panel);min-width:0}
.ach-tile strong{display:block;font:600 28px/1.15 var(--serif);font-variant-numeric:lining-nums;color:var(--text);overflow-wrap:anywhere}
.ach-tile:first-child strong{color:var(--brass)}
.ach-tile span{display:block;margin-top:4px;font-size:14px;font-weight:600;color:var(--muted)}
.ach-tile small{display:block;margin-top:2px;font-size:14px;color:var(--faint)}
.ach-top{display:grid;grid-template-columns:minmax(0,7fr) minmax(0,5fr);align-items:stretch;gap:24px;margin-bottom:40px}
/* Showcase and Newest on the left share the row's height with Closest on the right; without Closest (someone
   else's page, or nothing started) the two sit side by side. */
.ach-col{display:flex;flex-direction:column;gap:24px;min-width:0}
.ach-col>.ach-box:last-child{flex:1}
.ach-top:has(>#ach-near-box[hidden]){grid-template-columns:1fr}
.ach-top:has(>#ach-near-box[hidden]) .ach-col{display:grid;grid-template-columns:minmax(0,7fr) minmax(0,5fr);align-items:stretch}
.ach-near-list small{display:block;font-size:13px;color:var(--muted)}
.ach-box{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:22px 24px}
.ach-box-head{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:10px 16px;margin-bottom:18px}
.ach-box-head h2{font-size:22px;margin:0}
.ach-box-head p{margin:4px 0 0;font-size:14px;color:var(--muted)}
.ach-pin-slots{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.ach-slot{display:flex;flex-direction:column;align-items:center;gap:12px;text-align:center;min-width:0}
.ach-slot strong{display:block;font-size:15px;line-height:1.35;color:var(--text);overflow-wrap:anywhere}
.ach-slot small{display:block;font-size:13px;line-height:1.4;color:var(--muted)}
.ach-slot.empty small{color:var(--faint)}
.ach-unpin{min-height:44px;padding:0 8px;background:none;border:0;color:var(--brass);font-size:14px;text-decoration:underline;text-underline-offset:4px}
.ach-unpin:hover{color:var(--brass-hi)}
.ach-pins .form-status{margin:16px 0 0}
.ach-near-list{list-style:none;margin:0;padding:0}
.ach-near-list li{display:flex;align-items:center;gap:14px;padding:8px 0;border-top:1px solid var(--line)}
.ach-near-list li:first-child{border-top:0;padding-top:0}
.ach-near-list li>div:not(.ach-pic):not(.ach-picwrap){min-width:0;flex:1}
.ach-near-list a{display:block;font-weight:600;font-size:15px;color:var(--text);text-decoration:none;overflow-wrap:anywhere}
.ach-near-list a:hover{color:var(--brass-hi);text-decoration:underline}
.ach-near-list .ach-progress{display:flex}
.ach-near-list progress{flex:1;width:auto;min-width:60px}

/* ---- Filters ----------------------------------------------------------------------------------------- */
.ach-filters{display:flex;flex-wrap:wrap;align-items:flex-end;gap:12px 16px;padding:16px 0;border-top:1px solid var(--brass-line);border-bottom:1px solid var(--line)}
.ach-filters label{margin:0;flex:0 1 190px;min-width:150px;font-weight:600;font-size:14px}
.ach-filters select,.ach-filters input[type=search]{margin-top:6px;min-height:44px;padding:8px 12px;font-size:15px}
.ach-filters .ach-search{flex:1 1 220px}
.ach-filters .ach-check{display:flex;align-items:center;gap:10px;flex:0 0 auto;min-width:0;min-height:44px;font-weight:400;color:var(--body);cursor:pointer}
.ach-count{margin:14px 0 8px;font-size:14px;color:var(--muted)}

/* ---- Categories and rows ------------------------------------------------------------------------------ */
.ach-cat{margin-top:28px}
.ach-cat-head{display:flex;align-items:baseline;justify-content:space-between;gap:16px;padding-bottom:10px;border-bottom:1px solid var(--brass-line)}
.ach-cat-head h2{font-size:24px;margin:0}
.ach-cat-count{font-size:14px;color:var(--muted);white-space:nowrap;font-variant-numeric:tabular-nums}
.ach-rows{list-style:none;margin:0;padding:0}
.ach-row{display:grid;grid-template-columns:minmax(64px,auto) minmax(0,1fr) auto;gap:18px;align-items:start;padding:14px 0;border-bottom:1px solid var(--line);scroll-margin-top:calc(var(--header) + 20px)}
.ach-row:target{background:var(--brass-bg);box-shadow:-12px 0 0 var(--brass-bg),12px 0 0 var(--brass-bg)}
.ach-name{font:600 17px/1.35 var(--sans);margin:2px 0 2px;color:var(--text)}
.ach-row.state-locked .ach-name,.ach-row.state-progress .ach-name{color:var(--body)}
.ach-row.secret .ach-name{color:var(--muted);font-style:italic}
.ach-desc{margin:0;font-size:15px;line-height:1.5;color:var(--body);max-width:46em}
.ach-row.secret .ach-desc{color:var(--faint)}
.ach-meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px 18px;margin-top:8px}
.ach-tier{font-size:13px;font-weight:600;letter-spacing:.03em;color:var(--brass)}
.ach-row.state-locked .ach-tier,.ach-row.state-progress .ach-tier{color:var(--muted)}
.ach-steps{font-size:13px;color:var(--faint);font-variant-numeric:tabular-nums}
.ach-foot{margin:6px 0 0;font-size:13px;line-height:1.5;color:var(--faint)}
.ach-foot:empty{display:none}
.ach-side{display:flex;flex-direction:column;align-items:flex-end;gap:8px;text-align:right;min-width:96px}
.ach-points{font-size:14px;font-weight:600;color:var(--muted);white-space:nowrap;font-variant-numeric:tabular-nums}
.ach-row.state-tiered .ach-points,.ach-row.state-done .ach-points{color:var(--brass)}
.ach-pin.button.small{min-width:76px;min-height:40px;padding:6px 12px;font-size:14px}
.ach-pin{display:none}
#ach-list.editing .ach-pin{display:inline-flex}
.ach-editbar{position:sticky;top:calc(var(--header) + 8px);z-index:5;display:flex;align-items:center;justify-content:space-between;gap:16px;margin:8px 0 4px;padding:10px 12px 10px 18px;background:var(--raised);border:1px solid var(--brass-line);border-radius:var(--radius);box-shadow:0 10px 24px #0007}
.ach-editbar span{font-size:15px;color:var(--text)}
.ach-pin[aria-pressed=true]{color:#14100a;background:var(--brass);border-color:#e6ce97}

/* ---- The lists some achievements use, and the notes -------------------------------------------------- */
.ach-lists{margin-top:40px;border-top:1px solid var(--brass-line)}
.ach-lists>div{padding-bottom:24px}
.ach-lists>div>p{max-width:46em;font-size:15px}
.ach-lists h3{font-size:18px;margin:20px 0 6px}
.ach-wr-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:20px 28px}
.ach-wr h3{margin-top:12px}
.ach-wr .fine-print{margin:0 0 8px;font-size:13px}
.ach-wr ol,.ach-wr ul{margin:0;padding-left:22px}
.ach-wr li{font-size:15px;padding:2px 0;color:var(--body)}
.ach-wr li small{margin-left:8px;color:var(--faint);font-size:13px;font-variant-numeric:tabular-nums}
.ach-notes{margin-top:32px;max-width:52em}
.ach-notes p{font-size:15px}

/* ---- My stats (account.html): the summary block ------------------------------------------------------ */
.ach-account .ach-summary{margin-bottom:20px}
.ach-account-cols{display:grid;grid-template-columns:1fr 1fr;gap:24px}
.ach-account h3{font-size:17px;margin-bottom:10px}
.ach-account .ach-near-list{margin-bottom:0}
.ach-account-more{margin:18px 0 0;font-size:15px}

/* ---- Narrow screens ---------------------------------------------------------------------------------- */
@media(max-width:960px){
 .ach-top{grid-template-columns:1fr}
 .ach-top:has(>#ach-near-box[hidden]) .ach-col{display:flex}
}
@media(max-width:760px){
 .ach-tile{flex-basis:40%;padding:14px 16px}
 .ach-tile strong{font-size:23px}
 .ach-box{padding:18px 16px}
 .ach-pin-slots{gap:10px}
 .ach-pic.big{width:84px;height:84px}
 .ach-pic.big img{width:74px;height:74px}
 .ach-slot strong{font-size:14px}
 .ach-filters{gap:10px 12px}
 .ach-filters label{flex:1 1 40%;min-width:0}
 .ach-filters .ach-search,.ach-filters .ach-check{flex:1 1 100%}
 .ach-row{grid-template-columns:minmax(56px,auto) minmax(0,1fr);gap:14px}
 .ach-row .ach-pic{width:56px;height:56px}
 .ach-row .ach-pic img{width:48px;height:48px}
 .ach-row .ach-pic.framed{width:76px;height:76px}
 .ach-row .ach-gems img{width:15px;height:15px}
 .ach-pic.framed.big,.ach-framed .ach-pic.big.empty{width:116px;height:116px}
 .ach-pin.button.small{min-height:44px}
 .ach-editbar{top:calc(var(--header) + 6px);padding:8px 8px 8px 14px}
 .ach-editbar span{font-size:14px}
 .ach-side{grid-column:2;flex-direction:row;align-items:center;justify-content:space-between;text-align:left;min-width:0}
 .ach-side:not(:has(.ach-pin)){justify-content:flex-start}
 .ach-progress progress{width:110px}
 .ach-account-cols{grid-template-columns:1fr}
 .ach-cat-head h2{font-size:21px}
}
@media(max-width:400px){
 .ach-tile strong{font-size:20px}
}
