/* ClockIn: assets/achievements/achievements.css. Part of what was style.css (split in 1.42.2, rules moved as is). The load order in index.html matters: see CLAUDE.md */
/* ============================================================
   ACHIEVEMENTS (1.35.0)
   Settings > Achievements (drawn by assets/achievements.js) and the
   achievement toasts. Badges are square boxes of --ach-size; locked ones
   are the same art in grayscale.
   ============================================================ */
[data-achievements-ui].hidden { display: none !important; }

/* 1.35.1: cards and the Platinum share one bigger corner radius. */
.achievements-root { --ach-radius: 20px; }

.ach-badge {
  flex: none;
  display: inline-flex;
  width: var(--ach-size, 56px);
  height: var(--ach-size, 56px);
}
.ach-badge .ach-svg { width: 100%; height: 100%; display: block; object-fit: contain; }
.ach-badge.is-locked { opacity: 0.4; } /* Ghost (1.35.3): faint outline in the category color */
.ach-badge.lab-grey { filter: grayscale(1); opacity: 0.5; }

.achievements-root { margin-top: var(--space-5); }

.ach-summary { margin-bottom: var(--space-5); }
.ach-summary-count { font-size: var(--font-size-lg); margin-bottom: var(--space-2); }
.ach-summary-count strong { font-weight: var(--weight-bold); }
.ach-summary-dlc { margin-top: var(--space-2); font-size: var(--font-size-sm); color: var(--text-muted); }

.ach-progress {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--paper-raised);
  border: 1px solid var(--line);
  overflow: hidden;
  margin-top: var(--space-2);
}
.ach-progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.ach-progress-lg { height: 12px; }
.ach-progress-text { margin-top: var(--space-1); font-size: var(--font-size-xs); color: var(--text-muted); }

.ach-platinum {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--ach-radius);
  background: var(--surface);
  color: var(--ink);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease;
}
/* 1.35.2: the same raised card as the entry rows. Theme builder names:
   Card (--surface), Line (--line), Raised (--paper-raised) and Line raised
   (--line-raised) on hover, Text (--ink) and Muted text (--text-muted). */
.ach-platinum:hover {
  background: var(--paper-raised);
  border-color: var(--line-raised, var(--ink-light));
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}
.ach-label { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

/* Category headings (1.35.3): the app's normal h2, a divider line above
   (.settings-divider), the count on the right in muted text. */
.ach-cat-head { display: flex; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-2); }
.ach-cat-head h2 { margin: 0; display: flex; align-items: center; gap: var(--space-2); }
.ach-cat-count { margin-left: auto; font-size: var(--font-size-sm); color: var(--text-muted); }
.ach-dlc {
  font-size: var(--font-size-xs);
  font-weight: var(--weight-bold);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: #D81E2C;
  color: #fff;
  letter-spacing: 0.04em;
}
.ach-secret-tag { background: var(--ink-light); }

.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.ach-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--ach-radius);
  background: var(--surface);
  color: var(--ink);
  min-width: 0;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease;
}
.ach-card:hover {
  position: relative;
  z-index: 1;
  background: var(--paper-raised);
  border-color: var(--line-raised, var(--ink-light));
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}
.ach-card.is-new { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ach-card-body { min-width: 0; flex: 1; }
.ach-name { font-weight: var(--weight-bold); line-height: var(--line-height-heading); color: var(--ink); }
.ach-card.is-locked .ach-name { color: var(--text-muted); }
.ach-desc { margin-top: var(--space-1); font-size: var(--font-size-sm); color: var(--text-muted); overflow-wrap: anywhere; }
.ach-hint { font-weight: var(--weight-bold); }
.ach-date { margin-top: var(--space-1); font-size: var(--font-size-xs); color: var(--text-muted); }
.ach-new {
  display: inline-block;
  margin-left: var(--space-1);
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--font-size-xs);
  font-weight: var(--weight-bold);
  vertical-align: 2px;
}

/* Layout bar and layouts (1.35.1). The root carries data-ach-layout
   (1, 2, 3 or 4 columns); badge sizes are set in achievements.js
   (84, 72, 64, 56px). Narrow windows drop columns so text never squeezes. */
.ach-layout-bar {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  margin-bottom: var(--space-5);
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.ach-layout-label { padding: 0 var(--space-3) 0 var(--space-2); font-size: var(--font-size-sm); color: var(--text-muted); }
.ach-layout-btn {
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  cursor: pointer;
}
.ach-layout-btn:hover { color: var(--ink); }
.ach-layout-btn.is-active { background: var(--accent); color: var(--on-accent-strong); }
.ach-layout-btn:focus-visible { outline: 2px solid var(--focus-ring, var(--ink)); outline-offset: 1px; }

.achievements-root[data-ach-layout="1"] .ach-grid { grid-template-columns: minmax(0, 1fr); }
.achievements-root[data-ach-layout="2"] .ach-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.achievements-root[data-ach-layout="3"] .ach-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.achievements-root[data-ach-layout="4"] .ach-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* 1 and 2 columns look like the Platinum: centered, roomier. */
.achievements-root[data-ach-layout="1"] .ach-card,
.achievements-root[data-ach-layout="2"] .ach-card { align-items: center; gap: var(--space-5); padding: var(--space-5); }
.achievements-root[data-ach-layout="1"] .ach-name { font-size: var(--font-size-lg); }
/* 3 and 4 columns (1.35.2): badges are Platinum size, so the badge sits
   on top and the text is centered under it. */
.achievements-root[data-ach-layout="3"] .ach-card,
.achievements-root[data-ach-layout="4"] .ach-card { flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); padding: var(--space-5) var(--space-4); }
.achievements-root[data-ach-layout="3"] .ach-card-body,
.achievements-root[data-ach-layout="4"] .ach-card-body { width: 100%; }
@media (max-width: 1200px) {
  .achievements-root[data-ach-layout="4"] .ach-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .achievements-root[data-ach-layout="3"] .ach-grid,
  .achievements-root[data-ach-layout="4"] .ach-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .achievements-root .ach-grid { grid-template-columns: minmax(0, 1fr) !important; }
  /* 2.0.4: always one column here, so the column choice is hidden. The
     cards keep the style of the layout picked on a wider screen. */
  .ach-layout-bar { display: none !important; }
}
/* A phone (1.45.0): the layout buttons share the screen's width and the
   "Layout" label goes, so the bar never runs off the edge. The columns are
   always one there, but the choice still sets the card style. */
@media (max-width: 700px) {
  .ach-layout-bar { display: flex; max-width: 100%; }
  .ach-layout-label { display: none; }
  .ach-layout-btn { flex: 1 1 0; min-width: 0; padding: var(--space-2) var(--space-1); }
}

/* Confetti and fireworks behind achievement toasts (1.35.7). The layer
   sits just under the toast stack (z-index 1000), so pieces come out from
   behind the toast. achievements.js sets the position, color and the
   --dx/--up/--down/--rot and --sx/--sy distances on each piece. */
#ach-fx-layer { position: fixed; inset: 0; z-index: 999; pointer-events: none; overflow: hidden; }
.ach-confetti {
  position: fixed;
  width: 7px;
  height: 12px;
  border-radius: 2px;
  opacity: 0;
  animation: ach-confetti 1.6s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
.ach-confetti.is-round { width: 8px; height: 8px; border-radius: 50%; }
@keyframes ach-confetti {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  45%  { opacity: 1; transform: translate(calc(var(--dx) * 0.7), var(--up)) rotate(calc(var(--rot) * 0.5)); }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--up) + var(--down))) rotate(var(--rot)); }
}
.ach-spark {
  position: fixed;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 6px 1px currentColor;
  animation: ach-spark 900ms ease-out forwards;
}
@keyframes ach-spark {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(0.4); }
}
@media (prefers-reduced-motion: reduce) { #ach-fx-layer { display: none; } }

/* Trophies under the Platinum (1.35.8): same card, a little less space
   between them. Testing bar (1.35.8, temporary). */
.ach-platinum.ach-trophy { margin-top: calc(var(--space-6) * -0.5); }
.ach-test-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px dashed var(--line-raised, var(--line));
  border-radius: var(--radius-md);
}
.ach-test-label { font-size: var(--font-size-sm); font-weight: var(--weight-bold); color: var(--text-muted); margin-right: var(--space-2); }
.ach-test-bar .btn-secondary[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ach-test-status { flex-basis: 100%; font-size: var(--font-size-xs); color: var(--text-muted); }
[data-ach-card] { cursor: default; }

/* Red Pill / Blue Pill (1.35.6): the Show Secret Achievements choice on
   the Red Pill card. */
.ach-pills { display: inline-flex; gap: var(--space-2); margin-top: var(--space-3); }
.ach-pill {
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--weight-bold);
  cursor: pointer;
}
.ach-pill:hover { color: var(--ink); border-color: var(--line-raised, var(--ink-light)); }
.ach-pill-red.is-active { background: #8B1A1A; border-color: #8B1A1A; color: #fff; }
.ach-pill-blue.is-active { background: #1E7A3C; border-color: #1E7A3C; color: #fff; } /* green, like the movie's color grade (1.35.8) */
.ach-pill:focus-visible { outline: 2px solid var(--focus-ring, var(--ink)); outline-offset: 1px; }

/* Badge Styles lab (Settings > Dev, 1.35.2). Comparing only. */
.ach-lab-title { margin-top: var(--space-5); }
.ach-lab-row {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4);
  margin-top: var(--space-3);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}
.ach-lab-badges { display: flex; flex-wrap: wrap; gap: var(--space-3); }
@media (max-width: 800px) { .ach-lab-row { grid-template-columns: minmax(0, 1fr); } }
.ach-badge.lab-silhouette { filter: grayscale(1) brightness(0.55); opacity: 0.35; }
.ach-badge.lab-blur { filter: grayscale(1) blur(2.5px); opacity: 0.6; }
.ach-badge.lab-ghost { opacity: 0.4; }

/* Effects */
.ach-fx { position: relative; border-radius: 50%; transition: transform 220ms ease, filter 220ms ease; }
.ach-fx.fx-lift:hover { transform: translateY(-4px); filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.22)); }
.ach-fx.fx-shine { overflow: hidden; }
.ach-fx.fx-shine::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  transform: translateX(-120%);
  pointer-events: none;
}
.ach-fx.fx-shine:hover::after,
.ach-card:hover .ach-fx.fx-shine::after,
.ach-platinum:hover .ach-fx.fx-shine::after { transition: transform 700ms ease; transform: translateX(120%); }
.ach-fx.fx-tilt:hover { transform: perspective(300px) rotateX(10deg) rotateY(-14deg) scale(1.05); }
.ach-fx.fx-glow:hover { filter: drop-shadow(0 0 8px rgba(110, 198, 245, 0.85)); }
.ach-fx.fx-spin:hover { transition: transform 700ms ease; transform: perspective(300px) rotateY(360deg); }
.ach-fx.fx-pulse { animation: ach-pulse 2.4s ease-in-out infinite; }
@keyframes ach-pulse { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) {
  .ach-fx, .ach-fx::after { transition: none !important; animation: none !important; }
}

/* Toasts: same box as every notification, the badge in place of the icon. */
.toast.ach-toast { --toast-color: #E0A91B; cursor: pointer; align-items: center; }
.toast.ach-toast.ach-roast { --toast-color: #7A1020; }
.ach-toast-badges { display: flex; flex: none; }
.ach-toast-badges.is-group .ach-badge + .ach-badge { margin-left: -14px; }
.ach-toast-label { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 2px; }
.ach-cat-count, .ach-dlc { text-transform: none; }
