/* ==========================================================================
   Exile Tools — Pages
   Home, Gemplanner (entry, plan, gem list, gem info, help), About, TraXile, legal.
   ========================================================================== */

/* Shared bits --------------------------------------------------------------- */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  margin-bottom: var(--space-5);
}
.section-head h2 { font-size: var(--fs-h3); }

.empty-state {
  padding: var(--space-6) var(--space-5);
  background: var(--surface-row);
  border-radius: var(--radius-surface);
  color: var(--text-muted);
}

.back-link { margin-bottom: var(--space-5); font-size: var(--fs-ui-sm); }

/* Gem attribute colours: rows/items set --gem — the socket ring, the hover tint and the
   light behind the icon (row cards, components.css) all read it */
.gem--str { --gem: var(--gem-str); }
.gem--dex { --gem: var(--gem-dex); }
.gem--int { --gem: var(--gem-int); }
.gem--none { --gem: var(--gem-none); }
.gem-text--str { color: var(--gem-str); }
.gem-text--dex { color: var(--gem-dex); }
.gem-text--int { color: var(--gem-int); }
.gem-text--none { color: var(--text-muted); }

/* Home (hero, tool banners, league plaque) lives in art.css */

/* ==========================================================================
   Gemplanner — entry
   ========================================================================== */
.planner-entry {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-5);
  align-items: end;
  margin-bottom: var(--space-7);
}
/* the app title: the gem mark and the wordmark as one horizontal unit, sized off the title */
.planner-entry__head {
  grid-column: 1 / span 5;
  display: flex;
  align-items: center;
  gap: 0.3em;
  font-size: var(--fs-title);
}
.planner-entry__head h1 { font-size: inherit; }
.planner-entry__mark { flex: none; width: 1.05em; height: 1.05em; fill: var(--accent); }
.import-form { grid-column: 6 / -1; }
.import-form__row { display: grid; grid-template-columns: 1fr auto; gap: var(--space-3); margin-top: var(--space-1); }
.import-form .input { min-height: 50px; font-size: 17px; }
.import-form .btn { min-height: 50px; padding-inline: var(--space-6); }

/* Pre-defined guides: one row card per guide. The list is a grid and every card a
   subgrid of it, so the two actions line up in columns on desktop while long build
   names wrap freely in the first one. */
.guide-list { grid-template-columns: minmax(0, 1fr) max-content max-content; }
.guide-card {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
  column-gap: var(--space-5);
  padding: var(--space-3) var(--space-5);
}
.guide-card__name {
  font-size: var(--fs-ui);
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
  max-width: none;
}
.guide-card .btn--secondary { background: color-mix(in srgb, var(--surface-row) 60%, transparent); }
.guide-card:hover .btn--secondary { border-color: color-mix(in srgb, var(--accent) 70%, var(--border-strong)); }
.guide-card .btn--secondary:hover { border-color: var(--accent); }

/* YouTube link: the red play icon and the word, one target */
.yt-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding-inline: var(--space-1);
  color: color-mix(in srgb, var(--text) 84%, var(--bg));
  font-size: var(--fs-ui-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--motion-fast) var(--ease-ui);
}
.yt-link__icon {
  width: 20px;
  height: 20px;
  color: var(--youtube);
  transition: color var(--motion-fast) var(--ease-ui), translate var(--motion-fast) var(--ease-ui);
}
.yt-link:hover { color: var(--text); }
.yt-link:hover .yt-link__icon { color: var(--youtube-hover); translate: 2px 0; }
.yt-link .icon--stroke { width: 14px; height: 14px; color: var(--text-muted); }

@media (max-width: 900px) {
  .planner-entry__head,
  .import-form { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .planner-entry { gap: var(--space-4); margin-bottom: var(--space-6); }
  .planner-entry__head { gap: 0.25em; }
}
@media (max-width: 560px) {
  .import-form__row { grid-template-columns: 1fr; }
  /* actions move under the build name */
  .guide-list { grid-template-columns: minmax(0, 1fr); }
  .guide-card { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); padding: var(--space-4); }
  .guide-card__name { flex: 1 0 100%; }
  .guide-card .btn--sm,
  .yt-link { min-height: 44px; }
}
@media (max-width: 340px) {
  .yt-link__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .yt-link { min-width: 44px; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .yt-link:hover .yt-link__icon { translate: none; }
}

/* ==========================================================================
   Gemplanner — Gem Plan (results)
   ========================================================================== */
/* The plan header is the build hero (art.css) */
.plan-shared { margin-bottom: var(--space-6); justify-content: space-between; }

.plan-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: var(--space-7);
  align-items: start;
}
.plan-side { position: sticky; top: calc(var(--header-h-compact) + var(--space-5)); display: grid; gap: var(--space-6); }
.plan-panel { display: grid; gap: var(--row-gap); }
.plan-panel__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  line-height: 1.2;
  font-size: var(--fs-ui);
  font-family: var(--font-head);
  font-weight: 600;
}
/* a small brass facet — the gem / waypoint motif — instead of a rule */
.plan-panel__title::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  background: var(--brass);
  transform: rotate(45deg);
}
.plan-option { padding: var(--space-3) var(--space-4); background: var(--surface-row); border-radius: var(--radius-surface); }
.plan-option__hint { padding-left: 30px; margin-top: var(--space-1); }
.plan-panel .disclosure + .disclosure,
.plan-option + .disclosure { margin-top: 0; }
.plan-panel .disclosure > summary { font-size: var(--fs-ui-sm); }

.plan-list { display: grid; gap: var(--space-1); margin: 0; padding: 0; list-style: none; font-size: var(--fs-ui-sm); }
.plan-list li { padding: var(--space-2) 0; }
.plan-list li .meta { display: block; }
.plan-list--rows li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.plan-notes > summary { color: var(--status-warning); }
.plan-notes > summary:hover { color: var(--text); }

.set-tree, .set-tree ul { margin: var(--space-3) 0 0; padding: 0; list-style: none; font-size: var(--fs-ui-sm); }
.set-tree > li + li { margin-top: var(--space-4); }
.set-tree__set { font-weight: 600; }
.set-tree__groups { padding-left: 30px !important; margin-top: var(--space-2) !important; }
.set-tree__groups--flat { padding-left: 0 !important; }
.set-tree__groups li { padding: var(--space-1) 0; }
.set-tree__gems { display: block; padding-left: 30px; }
.set-tree .is-excluded > label > span { text-decoration: line-through; color: var(--text-muted); }
.set-tree .is-disabled { opacity: 0.45; }
.set-tree .is-disabled label { cursor: not-allowed; }

.plan-link { overflow-wrap: anywhere; }

/* Gem Plan table — every gem a row card (data-table, components.css). The attribute
   colour lives in the socket ring at rest; on hover it flows into the row as a faint
   tint, a light behind the socket and a coloured shadow. A new act opens with a wider
   gap and its name in brass. */
.plan-table { border-spacing: 0 6px; }
.plan-table th:nth-child(3),
.plan-table td.plan-table__level { white-space: nowrap; }
.plan-table thead th:first-child { padding-left: var(--space-4); }
.plan-table tbody tr:hover,
.plan-table tbody tr:focus-within {
  --row-bg: color-mix(in srgb, var(--gem, var(--gem-none)) var(--gem-tint), var(--surface-row-hover));
  --row-drop: var(--drop-row-hover) drop-shadow(0 6px 10px color-mix(in srgb, var(--gem, var(--gem-none)) 22%, transparent));
}
/* the gem-colour edge on the left of the row (foundation.css --gem-edge) */
.plan-table tbody tr > :first-child { box-shadow: var(--gem-edge); transition: background-color var(--motion-surface) var(--ease-ui), box-shadow var(--motion-surface) var(--ease-ui); }
.plan-table tbody tr:hover > :first-child,
.plan-table tbody tr:focus-within > :first-child { box-shadow: var(--gem-edge-hover), var(--gem-edge-light); }
.plan-table__icon { width: 1%; white-space: nowrap; padding-left: var(--space-4) !important; }
/* the gem icon sits in a small socket ringed in its attribute colour (same motif as the artwork) */
.plan-table__icon img {
  width: 42px;
  height: 42px;
  max-width: none; /* the global img { max-width: 100% } squeezed the socket into an oval in the narrow cell */
  aspect-ratio: 1;
  object-fit: contain;
  padding: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, var(--socket-hi) 0%, var(--socket-bg) 75%);
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--gem, var(--gem-none)) 65%, transparent), inset 0 2px 5px rgb(0 0 0 / 0.5);
  transition: box-shadow var(--motion-surface) var(--ease-ui);
}
.plan-table tbody tr:hover .plan-table__icon img,
.plan-table tbody tr:focus-within .plan-table__icon img { box-shadow: 0 0 0 1.5px var(--gem, var(--gem-none)), 0 0 12px color-mix(in srgb, var(--gem, var(--gem-none)) 35%, transparent), inset 0 2px 5px rgb(0 0 0 / 0.5); }

.plan-table__act { color: var(--text-muted); white-space: nowrap; }
/* an act chapter: a wider gap above the row (a transparent border — the surface is clipped
   to the padding box, the vertical corner radius grows by the gap so the visible corner stays round) */
.plan-table tbody tr.is-act-start > * {
  border-top: var(--space-5) solid transparent;
  background-clip: padding-box;
}
.plan-table tbody tr.is-act-start > :first-child { border-radius: var(--radius-surface) 0 0 var(--radius-surface) / calc(var(--radius-surface) + var(--space-5)) 0 0 var(--radius-surface); }
.plan-table tbody tr.is-act-start > :last-child { border-radius: 0 var(--radius-surface) var(--radius-surface) 0 / 0 calc(var(--radius-surface) + var(--space-5)) var(--radius-surface) 0; }
.plan-table tbody tr:first-child.is-act-start > * { border-top-width: 0; }
.plan-table tbody tr:first-child.is-act-start > :first-child { border-radius: var(--radius-surface) 0 0 var(--radius-surface); }
.plan-table tbody tr:first-child.is-act-start > :last-child { border-radius: 0 var(--radius-surface) var(--radius-surface) 0; }
.plan-table tr.is-act-start .plan-table__act { color: var(--brass-text); font-family: var(--font-head); font-weight: 600; }
.plan-table__gem { min-width: 12rem; }
.plan-table__name { display: block; font-size: var(--fs-ui); font-weight: 600; line-height: 1.35; }
.plan-table__name .gem-link { text-decoration-color: var(--gem); }
.plan-table__name .gem-link:hover { color: var(--text); text-decoration-thickness: 2px; }
.plan-table__gem .meta { display: block; margin-top: 2px; }
.plan-table__quest { min-width: 10rem; }
.plan-table__skip { width: 1%; text-align: right !important; padding-right: var(--space-2) !important; }
.acq { display: inline-flex; align-items: center; gap: var(--space-2); white-space: nowrap; }
.acq img { width: 18px; height: 18px; }
.acq .select { max-width: 240px; }
/* changed by the last choice: an accent surface — distinct from hover, visible without it */
.plan-table tbody tr.is-changed { --row-bg: var(--accent-surface); }
.plan-table tr.is-changed > td { animation: quiet-reveal var(--motion-medium) var(--ease-ui) both; }

@media (max-width: 1100px) {
  .plan-layout { grid-template-columns: 1fr; }
  .plan-side { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-5) var(--space-6); }
}

@media (max-width: 760px) {
  .plan-table thead { display: none; }
  .plan-table, .plan-table tbody { display: block; }
  .plan-table tbody { display: grid; gap: var(--row-gap); }
  .plan-table tbody tr {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: var(--space-1) var(--space-3);
    padding: var(--space-4) var(--space-2) var(--space-4) var(--space-3);
    background: var(--row-bg);
    border-radius: var(--radius-surface);
    transition: background-color var(--motion-surface) var(--ease-ui), filter var(--motion-surface) var(--ease-ui), translate var(--motion-surface) var(--ease-ui);
  }
  .plan-table tbody td,
  .plan-table tbody tr.is-act-start > * { display: block; padding: 0 !important; border: 0; border-radius: 0 !important; background: none; }
  /* the row is the surface here, so it carries the gem-colour edge */
  .plan-table tbody tr { box-shadow: var(--gem-edge); }
  .plan-table tbody tr:hover,
  .plan-table tbody tr:focus-within { box-shadow: var(--gem-edge-hover), var(--gem-edge-light); }
  .plan-table tbody tr > :first-child,
  .plan-table tbody tr:hover > :first-child,
  .plan-table tbody tr:focus-within > :first-child { box-shadow: none; }
  .plan-table__icon { grid-row: 1 / span 2; width: auto; }
  .plan-table__gem { grid-column: 2; min-width: 0; }
  .plan-table__skip { grid-column: 3; grid-row: 1; }
  .plan-table__level, .plan-table__act, .plan-table__quest, .plan-table__as {
    grid-column: 2 / -1;
    display: grid !important;
    grid-template-columns: 6rem minmax(0, 1fr);
    gap: var(--space-3);
    font-size: var(--fs-ui-sm);
  }
  .plan-table__level { margin-top: var(--space-2); }
  .plan-table td[data-label]::before { content: attr(data-label); color: var(--text-muted); font-size: var(--fs-meta); }
  .plan-table__quest { min-width: 0; }
  .plan-table tbody tr.is-act-start:not(:first-child) { margin-top: var(--space-5); }
  .plan-table__icon img { width: 40px; height: 40px; }
  .acq { white-space: normal; flex-wrap: wrap; }
  .acq .select { max-width: 100%; }
}

/* Plan mode and Play mode (docs/specs/play-mode.md) */
.plan-modebar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); margin-bottom: var(--space-6); }
.plan-modebar__reset { margin-left: auto; }
.segmented { display: inline-flex; border: var(--rule) solid var(--border-strong); border-radius: var(--radius); }
.segmented__option {
  min-height: 40px;
  min-width: 5.5rem;
  padding: 0 var(--space-4);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-ui-sm);
  cursor: pointer;
  transition: color var(--motion-fast) var(--ease-ui), background-color var(--motion-fast) var(--ease-ui);
}
.segmented__option + .segmented__option { border-left: var(--rule) solid var(--border-strong); }
.segmented__option:hover { color: var(--text); }
.segmented__option[aria-pressed="true"] { background: var(--btn-primary-bg); color: var(--on-accent); }
.play-progress { margin: 0; font-family: var(--font-head); font-weight: 600; font-variant-numeric: tabular-nums; }


.taken-tick { display: inline-flex; vertical-align: -2px; margin-left: var(--space-2); color: var(--status-success, var(--accent-text)); }
.plan-table tr.is-taken .plan-table__name .gem-link { color: var(--text-muted); }

/* large tap targets: the whole label is the target */
.play-check { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; cursor: pointer; }
.play-check input { width: 24px; height: 24px; margin: 0; accent-color: var(--accent); cursor: pointer; }

.play { display: grid; gap: var(--space-6); }
.play-act__head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; }
.play-act__title {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-3);
  min-height: 44px;
  padding: 0 var(--space-2);
  border: 0;
  background: transparent;
  color: var(--brass-text);
  font: inherit;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-ui);
  text-align: left;
}
.play-act__title:not(:disabled) { cursor: pointer; }
.play-act__title:disabled { cursor: default; }
.play-act__count { color: var(--text-muted); font-size: var(--fs-ui-sm); font-variant-numeric: tabular-nums; }
.play-act.is-collapsed .play-act__title { color: var(--text-muted); }
.play-badge { padding: 2px var(--space-2); border: var(--rule) solid var(--status-warning); border-radius: var(--radius); color: var(--status-warning); font-size: var(--fs-meta); white-space: nowrap; }

.play-quest { margin: 0 0 var(--space-4); border-left: 3px solid transparent; border-radius: 0 var(--radius-surface) var(--radius-surface) 0; }
/* next up: a state, not decoration — the accent mark and an accent surface */
.play-quest.is-next-up { padding-bottom: var(--space-2); border-left-color: var(--accent); background: var(--accent-surface); scroll-margin-top: calc(var(--header-h-compact) + var(--space-5)); }
.play-quest__head { display: flex; align-items: center; gap: var(--space-2); }
.play-quest__title { font-weight: 600; }
.play-quest.is-finished .play-quest__title { color: var(--text-muted); text-decoration: line-through; }
.play-quest__next { margin-left: auto; padding-right: var(--space-3); color: var(--accent-text); font-family: var(--font-head); font-size: var(--fs-meta); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

.play-rows { display: grid; gap: 6px; margin: 0; padding: 0 var(--space-2) 0 var(--space-6); list-style: none; }
/* each gem a row card (.row-card .row-card--live .row-card--gem, components.css) */
.play-row {
  display: grid;
  grid-template-columns: 44px 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-3) var(--space-1) 0;
}
.play-row__icon { width: 36px; height: 36px; max-width: none; object-fit: contain; }
.play-row__name { display: block; font-weight: 600; }
.play-row__gem .meta { display: block; }
.play-row__as { font-size: var(--fs-ui-sm); }
.play-row.is-taken .play-row__icon { opacity: 0.45; }
.play-row.is-taken .play-row__gem, .play-row.is-taken .play-row__as { color: var(--text-muted); text-decoration: line-through; }
.play-row.is-left-behind { background: color-mix(in srgb, var(--status-warning) 9%, var(--surface-row)); }
.play-row.is-changed { animation: quiet-reveal var(--motion-medium) var(--ease-ui) both; background: var(--accent-surface); }

@media (max-width: 560px) {
  .plan-modebar__reset { margin-left: 0; }
  .play-rows { padding-left: 0; }
  .play-row { grid-template-columns: 44px 32px minmax(0, 1fr); }
  .play-row__icon { width: 32px; height: 32px; }
  .play-row__as { grid-column: 3; }
  .play-row__as .acq { white-space: normal; flex-wrap: wrap; }
  .play-row__as .select { max-width: 100%; }
}

/* ==========================================================================
   Gemplanner — Gem list
   ========================================================================== */
.gem-filter { display: grid; gap: var(--space-5); margin-bottom: var(--space-6); }
.gem-filter[hidden] { display: none; }
.gem-filter__row { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-4) var(--space-6); }
.gem-filter__name { flex: 1 1 18rem; max-width: 28rem; }
.gem-filter__level { flex: 0 1 11rem; }
.gem-filter__group { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: var(--space-2); }
.gem-filter__group legend { padding: 0; margin-bottom: var(--space-2); }
.gem-filter__clear { margin-left: auto; }

.toggle-group { display: inline-flex; flex-wrap: wrap; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  margin-left: calc(-1 * var(--rule));
  padding: 0 var(--space-4);
  border: var(--rule) solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-ui-sm);
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 var(--gem, transparent);
  transition: background-color var(--motion-fast) var(--ease-ui);
}
.toggle:first-child { margin-left: 0; border-radius: var(--radius) 0 0 var(--radius); }
.toggle:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.toggle:hover { background: var(--surface); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.toggle[aria-pressed="true"],
.toggle:has(input:checked) { position: relative; background: var(--surface-raised); border-color: var(--text); z-index: 1; }
.toggle[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--gem, var(--accent)), inset 0 0 0 999px color-mix(in srgb, var(--gem, transparent) 14%, transparent); }
.toggle:focus-visible,
.toggle:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; z-index: 2; }

.tag-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.tag-chips[hidden] { display: none; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 32px;
  padding: 0 var(--space-2) 0 var(--space-3);
  border: var(--rule) solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-ui-sm);
  font-weight: 600;
  cursor: pointer;
}
.tag-chip:hover { border-color: var(--text); }
.tag-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tag-chip__x { font-size: 1.1em; line-height: 1; color: var(--text-muted); }
.tag-filter { margin: 0; padding: 0; border: 0; min-width: 0; }
.tag-filter legend { padding: 0; margin-bottom: var(--space-3); }
.tag-filter__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--row-gap-dense);
}
.tag-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg); /* sits in the panel (--surface-row): a recessed cell */
  border-radius: var(--radius-surface);
  font-size: var(--fs-ui-sm);
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-ui);
}
.tag-option:hover { background: var(--surface-row-hover); }
.tag-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }
.tag-option:has(input:checked) { background: var(--accent-surface); font-weight: 600; }
.tag-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.tag-option__name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tag-option__count { color: var(--text-muted); font-size: var(--fs-meta); }
.tag-option:has(input:disabled) { opacity: 0.4; cursor: not-allowed; }
.tag-option:has(input:disabled):hover { background: var(--bg); }

.gem-count { margin-bottom: var(--space-4); color: var(--text-muted); font-size: var(--fs-ui-sm); max-width: none; }
.gem-count strong { color: var(--text); }

/* Gem list: compact row cards (.row-card .row-card--live .row-card--gem, components.css).
   The whole card is the link's target; the icon gets the light in its gem colour. */
.gem-list--columns { columns: 4; column-gap: var(--space-5); }
.gem-list--columns .gem-list__item { break-inside: avoid; margin-bottom: 6px; }
.gem-list { margin: 0; padding: 0; list-style: none; }
.gem-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--fs-ui-sm);
  line-height: 1.3;
}
.gem-list__item img { width: 32px; height: 32px; flex: none; }
.gem-list__item a { text-decoration: none; }
.gem-list__item a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.gem-list__item a:hover { color: var(--text); }
.gem-list__item:hover a { text-decoration: underline; text-decoration-color: var(--gem, var(--accent)); }
.gem-list__item a:focus-visible { outline: none; }
.gem-list__item a:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 2px; }
.gem-list--inline { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px var(--space-4); }

@media (max-width: 1100px) { .gem-list--columns { columns: 2; } }
@media (max-width: 640px) {
  .gem-list--columns { columns: 1; }
  .gem-filter__name, .gem-filter__level { flex-basis: 100%; max-width: none; }
  .gem-filter__clear { margin-left: 0; }
  .tag-filter__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   Gemplanner — Gem info
   ========================================================================== */
.gem-hero {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}
.gem-hero__icon { width: 64px; height: 64px; flex: none; }
.gem-hero h1 { overflow-wrap: anywhere; }

.gem-info__layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-8);
  align-items: start;
}
.gem-info__layout .section__title,
.gem-info .section .section__title { font-size: var(--fs-h3); }
.gem-info__text { display: grid; gap: var(--space-7); }
.gem-info__layout + .section { margin-top: var(--space-8); }
.gem-info__subhead { margin: var(--space-6) 0 var(--space-3); font-size: var(--fs-ui); }

.stat-list { display: grid; gap: var(--row-gap-dense); margin: 0; }
.stat-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--surface-row);
  border-radius: var(--radius-surface);
  font-size: var(--fs-ui-sm);
}
.stat-list dt { color: var(--text-muted); }
.stat-list dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.link-list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-2); }
.link-list a { display: inline-flex; align-items: center; gap: var(--space-2); }
.link-list .icon { color: var(--text-muted); }
.link-list--large { margin-top: var(--space-4); gap: var(--space-3); font-size: var(--fs-lead); }

.mod-list { display: grid; gap: var(--row-gap-dense); margin: 0; padding: 0; list-style: none; }
.mod-list li { padding: var(--space-2) var(--space-4); background: var(--surface-row); border-radius: var(--radius-surface); }

.acq-intro { margin-bottom: var(--space-5); font-size: var(--fs-ui-sm); }
.acq-table tbody th { font-weight: 600; white-space: nowrap; width: 8rem; font-size: var(--fs-ui); }
.acq-table td { vertical-align: top; width: 45%; }
.quest-list { margin: 0; padding: 0; list-style: none; }
.quest-list li + li { margin-top: var(--space-1); }
.quest-list .meta { margin-left: var(--space-1); }
.section .notice { margin-bottom: var(--space-4); }

.progression-table th, .progression-table td { white-space: nowrap; }
.progression-table td:first-child, .progression-table th:first-child {
  position: sticky;
  left: 0;
  padding-right: var(--space-4);
}
.progression-table thead th:first-child { background: var(--bg); }

@media (max-width: 900px) {
  .gem-info__layout { grid-template-columns: 1fr; gap: var(--space-7); }
}
@media (max-width: 560px) {
  .acq-table thead { display: none; }
  .acq-table, .acq-table tbody, .acq-table tr { display: block; }
  .acq-table tbody { display: grid; gap: var(--row-gap); }
  .acq-table tr { padding: var(--space-3) var(--space-4); background: var(--surface-row); border-radius: var(--radius-surface); }
  .acq-table th, .acq-table td { display: block; width: auto !important; padding: var(--space-1) 0 !important; background: none !important; }
  .acq-table td:nth-of-type(1)::before { content: "Quest Rewards"; }
  .acq-table td:nth-of-type(2)::before { content: "Vendor Rewards"; }
  .acq-table td::before { display: block; font-size: var(--fs-meta); color: var(--text-muted); }
}

/* ==========================================================================
   Gemplanner — Help
   ========================================================================== */
.howto-steps { margin: var(--space-6) 0 0; padding: 0; list-style: none; counter-reset: step; }
.howto-step {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: var(--space-6);
  padding: var(--space-7) 0;
  counter-increment: step;
}
.howto-step__copy h3::before {
  content: counter(step);
  display: block;
  margin-bottom: var(--space-3);
  font-size: var(--fs-h2);
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}
.howto-step__copy p { margin-top: var(--space-3); color: var(--text-muted); }
.howto-step__shot { width: 100%; border-radius: var(--radius-surface); box-shadow: var(--shadow-row-hover); }
.howto-cta { margin-top: var(--space-5); }
@media (max-width: 760px) { .howto-step { grid-template-columns: 1fr; } }

/* ==========================================================================
   About
   A short artwork hero (the shared crystal in carved rings, drifting fog — art.css
   motion rules apply through data-art), then the team as carved-stone cards with
   faceted portrait frames, a support banner, and the allies as a row of cards.
   ========================================================================== */
.about-kicker {
  display: block;
  margin-bottom: var(--space-3);
  font-size: var(--fs-label);
  letter-spacing: var(--display-tracking-label);
  line-height: 1.4;
  color: var(--brass-text);
}

/* Hero */
.about-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  min-height: clamp(340px, 36vw, 460px);
  margin-bottom: var(--space-8);
  background:
    radial-gradient(ellipse 34% 80% at 76% 46%, var(--art-light) 0%, transparent 70%),
    var(--art-void);
}
.about-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: var(--grain);
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
}
.about-hero__art { position: absolute; inset: 0 0 0 30%; z-index: -6; }
.about-hero__svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.about-hero__scrim { position: absolute; inset: 0; z-index: -5; background: var(--art-scrim); }
.about-hero .fog--far { bottom: -30%; }
.about-hero .fog--near { bottom: -48%; }
.about-hero__copy {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: end;
  gap: var(--space-4);
  width: 100%;
  padding-block: calc(var(--header-h) + var(--space-6)) var(--space-7);
}
.about-hero__copy .about-kicker { margin-bottom: 0; }
.about-hero__copy h1 { font-size: var(--fs-tool); }
.about-hero__copy .lead { max-width: 46ch; color: var(--text-muted); }

/* Section heads */
.about-block + .support-banner,
.support-banner + .about-block { margin-top: var(--space-9); }
.about-block__title {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-6);
}
.about-block__title::after {
  content: "";
  width: 96px;
  height: 2px;
  margin-top: var(--space-4);
  background: var(--gradient-accent-line);
}

/* Team */
.people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
.person {
  --cut: 18px;
  position: relative;
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: center;
  padding: var(--space-6);
  background:
    radial-gradient(ellipse 60% 120% at 0% 0%, color-mix(in srgb, var(--art-light) 45%, transparent) 0%, transparent 60%),
    var(--surface);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  transition: background-color var(--motion-tactile) var(--ease-ui), translate var(--motion-tactile) var(--ease-ui);
}
/* brass hairline along the cut corner */
.person::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: var(--cut);
  height: var(--cut);
  background: linear-gradient(to top right, transparent calc(50% - 1.5px), var(--brass) calc(50% - 1px), var(--brass) 50%, transparent 50%);
  opacity: 0.8;
}
.person:hover { background-color: var(--surface-raised); translate: 0 var(--lift); }

/* Faceted portrait: a hexagon cut from the photo, set in a brass bezel with a crystal glow */
.person__frame {
  --hex: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  position: relative;
  width: 136px;
  aspect-ratio: 1 / 1.1;
  padding: 3px;
  background: linear-gradient(160deg, var(--brass) 0%, color-mix(in srgb, var(--brass) 30%, var(--socket-bg)) 55%, var(--coral-primary) 100%);
  clip-path: var(--hex);
}
.person__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  clip-path: var(--hex);
  filter: grayscale(0.35) contrast(1.05);
  transition: filter var(--motion-tactile) var(--ease-ui);
}
.person:hover .person__photo { filter: grayscale(0) contrast(1.05); }
.person__name { font-size: var(--fs-h3); }
.person__role {
  margin: var(--space-2) 0 var(--space-5);
  color: var(--text-muted);
}
.person__links { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.person__links a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--fs-ui-sm);
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  background: var(--surface-raised);
  border-radius: var(--radius);
  transition: background-color var(--motion-fast) var(--ease-ui), color var(--motion-fast) var(--ease-ui), translate var(--motion-fast) var(--ease-ui);
}
.person__links .icon { width: 16px; height: 16px; color: var(--text-muted); transition: color var(--motion-fast) var(--ease-ui); }
.person__links a:hover { background: color-mix(in srgb, var(--accent) 14%, var(--surface-raised)); color: var(--text); translate: 0 -1px; }
.person__links a:hover .icon { color: var(--accent-text); }

/* Support */
.support-banner {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-6) var(--space-8);
  align-items: center;
  padding: var(--space-8) var(--space-7);
  background: var(--gradient-accent-line) top / 100% 2px no-repeat, var(--banner-gradient);
  border-radius: var(--radius-surface);
}
.support-banner__gem {
  position: absolute;
  right: -40px;
  top: 50%;
  z-index: -1;
  width: 320px;
  height: 320px;
  translate: 0 -50%;
  fill: var(--accent);
  opacity: 0.08;
}
.support-banner h2 { display: flex; flex-direction: column; margin-bottom: var(--space-4); }
.support-banner p { color: var(--text-muted); font-size: var(--fs-lead); line-height: 1.45; max-width: 52ch; }
.support-banner__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.support-banner__actions .btn--secondary { background: color-mix(in srgb, var(--surface) 70%, transparent); }

/* Thanks */
.thanks-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}
.thanks-card {
  position: relative;
  padding: var(--space-5);
  background: var(--surface-row);
  border-radius: var(--radius-surface);
  box-shadow: var(--shadow-row);
  transition: background-color var(--motion-tactile) var(--ease-ui), box-shadow var(--motion-tactile) var(--ease-ui), translate var(--motion-tactile) var(--ease-ui);
}
.thanks-card:hover,
.thanks-card:focus-within { background: var(--surface-row-hover); box-shadow: var(--shadow-row-hover); translate: 0 var(--lift); }
.thanks-card__name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-head);
  font-size: var(--fs-h4);
  font-weight: 600;
  text-decoration: none;
}
/* the whole card is the link target */
.thanks-card__name::after { content: ""; position: absolute; inset: 0; }
.thanks-card__name .icon { width: 14px; height: 14px; color: var(--text-muted); transition: color var(--motion-fast) var(--ease-ui), transform var(--motion-fast) var(--ease-ui); }
.thanks-card:hover .icon { color: var(--accent-text); transform: translate(2px, -2px); }
.thanks-card p { margin-top: var(--space-2); color: var(--text-muted); font-size: var(--fs-ui); }

@media (max-width: 1080px) {
  .people { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .support-banner { grid-template-columns: 1fr; padding: var(--space-7) var(--space-5); }
  .thanks-grid { grid-template-columns: 1fr; }
  .about-hero__art { inset: 0 -20% 0 20%; opacity: 0.6; }
}
@media (max-width: 520px) {
  .person { grid-template-columns: 1fr; justify-items: start; padding: var(--space-5); }
  .person__frame { width: 112px; }
}
@media (prefers-reduced-motion: reduce) {
  .person:hover, .thanks-card:hover, .thanks-card:focus-within, .person__links a:hover { translate: none; }
}

/* ==========================================================================
   TraXile
   ========================================================================== */
.traxile-page { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-7); align-items: center; padding-block: var(--space-7); }
.traxile-page__logo { width: 100%; max-width: 720px; }
.traxile-page__copy .button-row { margin-top: var(--space-5); }
@media (max-width: 860px) { .traxile-page { grid-template-columns: 1fr; } }

/* ==========================================================================
   Legal
   ========================================================================== */
.legal { font-size: var(--fs-body); }
.legal p { max-width: var(--measure); }
.legal strong { font-family: var(--font-head); font-weight: 600; }
.legal a { overflow-wrap: anywhere; }

/* --------------------------------------------------------------------------
   Gem Tooltip (gemplanner/static/gemplanner/gemtip.js) — an in-game style
   information window: dark graphite with a faint grain, the gem's attribute
   colour as one light edge along the top and as a glow behind the icon. The
   hierarchy follows an item tooltip — name, type and tags; level and
   properties; requirements; description; mods; quality — separated by space,
   not by rules. One display moment (the gem type, Orbitron 12px);
   everything that is read is Instrument Sans.
   -------------------------------------------------------------------------- */
:root,
:root[data-theme="dark"] {
  --tip-bg: linear-gradient(180deg, #231E22 0%, #1A1619 46%, #171416 100%);
  --tip-ink: #F2ECE6;
  --tip-muted: #ADA5A1;
  --tip-desc: #D3CBC4;
  --tip-mod: #B4C4EA;          /* the "magic" line colour: cool, so it never competes with the coral */
  --tip-edge: rgb(242 236 230 / 0.08);
  --tip-shadow: 0 22px 48px -18px rgb(0 0 0 / 0.75), 0 2px 6px rgb(0 0 0 / 0.35);
}
:root[data-theme="light"] {
  --tip-bg: linear-gradient(180deg, #FFFCF8 0%, #FAF5EF 50%, #F5EEE6 100%);
  --tip-ink: #221B1C;
  --tip-muted: #5E5557;
  --tip-desc: #3E3537;
  --tip-mod: #2E4A80;
  --tip-edge: rgb(34 27 28 / 0.12);
  --tip-shadow: 0 22px 48px -20px rgb(60 40 30 / 0.35), 0 2px 6px rgb(60 40 30 / 0.12);
}

.gem-tip {
  --gem: var(--gem-none);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: min(380px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-4) var(--space-4) var(--space-4);
  border: 1px solid var(--tip-edge);
  border-radius: 3px;
  background:
    radial-gradient(160px 110px at 28px 22px, color-mix(in srgb, var(--gem) 16%, transparent) 0%, transparent 70%),
    var(--tip-bg);
  box-shadow: var(--tip-shadow);
  color: var(--tip-ink);
  font-size: var(--fs-ui-sm);
  line-height: 1.5;
  text-align: left;
  /* closed: invisible and inert; opening fades in and rises 5px (Tactile Response) */
  visibility: hidden;
  opacity: 0;
  translate: 0 5px;
  pointer-events: none;
  transition:
    opacity 150ms var(--ease-ui),
    translate 150ms var(--ease-ui),
    visibility 0s linear 150ms;
}
.gem-tip.is-open {
  visibility: visible;
  opacity: 1;
  translate: 0 0;
  pointer-events: auto;
  transition:
    opacity 150ms var(--ease-ui),
    translate 150ms var(--ease-ui),
    visibility 0s;
}
.gem-tip:focus { outline: none; }
/* the light edge: the attribute colour along the top, dying out towards the right */
.gem-tip::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--gem) 0%, color-mix(in srgb, var(--gem) 40%, transparent) 45%, transparent 85%);
  pointer-events: none;
}
/* film grain, very faint */
.gem-tip::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grain);
  opacity: 0.05;
  mix-blend-mode: var(--grain-blend);
  pointer-events: none;
}
.gem-tip--str { --gem: var(--gem-str); }
.gem-tip--dex { --gem: var(--gem-dex); }
.gem-tip--int { --gem: var(--gem-int); }

.gem-tip > * + * { margin-top: var(--space-3); }
.gem-tip p { max-width: none; }

.gem-tip__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
}
.gem-tip__icon {
  width: 40px;
  height: 40px;
  padding: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, var(--socket-hi) 0%, var(--socket-bg) 75%);
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--gem) 60%, transparent), 0 0 16px -4px color-mix(in srgb, var(--gem) 70%, transparent);
}
.gem-tip__title { display: grid; gap: 4px; min-width: 0; }
.gem-tip__name {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--tip-ink);
  overflow-wrap: anywhere;
}
.gem-tip__kind {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px var(--space-3);
  min-height: 16px;
  font-size: var(--fs-min);
  color: var(--tip-muted);
}
.gem-tip__type {
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: var(--display-weight);
  line-height: 1.45;
  letter-spacing: var(--display-tracking-label);
  color: color-mix(in srgb, var(--gem) 78%, var(--tip-ink));
}
.gem-tip__flag { color: var(--brass-text); }
.gem-tip__close {
  display: inline-grid;
  place-items: center;
  align-self: start;
  width: 40px;
  height: 40px;
  margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-2)) 0 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--tip-muted);
  cursor: pointer;
}
.gem-tip__close:hover { color: var(--tip-ink); background: color-mix(in srgb, var(--tip-ink) 8%, transparent); }

.gem-tip__tags { font-size: var(--fs-min); color: var(--tip-muted); letter-spacing: 0.01em; }

.gem-tip__props {
  display: grid;
  gap: 3px;
  margin-block: var(--space-4) 0;
}
.gem-tip__props div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); }
.gem-tip__props dt { color: var(--tip-muted); }
.gem-tip__props dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; color: var(--tip-ink); }

.gem-tip__req { color: var(--tip-muted); }
.gem-tip__req b { font-weight: 600; color: var(--tip-ink); font-variant-numeric: tabular-nums; }
.gem-tip__attr--str { color: var(--gem-str) !important; }
.gem-tip__attr--dex { color: var(--gem-dex) !important; }
.gem-tip__attr--int { color: var(--gem-int) !important; }

.gem-tip__desc { margin-top: var(--space-4) !important; color: var(--tip-desc); line-height: 1.5; }

.gem-tip__mods {
  display: grid;
  gap: 1px;
  line-height: 1.4;
  margin-block: var(--space-4) 0;
  padding: 0;
  list-style: none;
  color: var(--tip-mod);
  font-variant-numeric: tabular-nums;
}
.gem-tip__quality { margin-top: var(--space-4) !important; }
.gem-tip__quality .gem-tip__mods { margin-top: var(--space-1); }
.gem-tip__label {
  font-size: var(--fs-min);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--tip-muted);
}
.gem-tip__note,
.gem-tip__state { margin-top: var(--space-4) !important; font-size: var(--fs-min); color: var(--tip-muted); }
.gem-tip__more {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  margin-top: var(--space-2) !important;
  font-weight: 600;
  color: var(--accent-text);
}

/* Touch on narrow screens: a bottom sheet (the same content, closer to the thumb) */
.gem-tip.is-sheet {
  z-index: 2147483000; /* above third-party floating widgets (Buy Me a Coffee) */
  inset: auto 0 0 0 !important;
  width: 100%;
  max-height: 78svh;
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  border-width: 1px 0 0;
  border-radius: 6px 6px 0 0;
  translate: 0 16px;
  box-shadow: 0 -18px 48px -12px rgb(0 0 0 / 0.6);
}
.gem-tip.is-sheet.is-open { translate: 0 0; }

/* Gem names that open a tooltip without being links (Skipped / Unobtainable lists) */
.gem-tip-target {
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  text-underline-offset: 0.22em;
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  .gem-tip,
  .gem-tip.is-sheet { translate: none; }
}
