/* Titles (ADR 0010): the look comes only from the structured fields on a title, drawn here as fixed classes.
   A title is a colour or gradient clipped to its text, with an optional glow and one motion.
   Class names are the enum values in App\Titles. Custom hex colours (title--x-rrggbb) are generated into
   /css/titles-custom.css from validated values only. Rarity is a label, not a style. */

.title{
  --title-c:#aab6c6;
  --title-fill:linear-gradient(var(--title-c),var(--title-c));
  display:inline-block;max-width:100%;vertical-align:bottom;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  font:var(--fw-bold) var(--fs-xs)/1.35 var(--font-display);letter-spacing:.02em;
  color:var(--title-c);
}
/* Where background-clip:text exists the fill replaces the text colour; elsewhere the plain colour above stays. */
@supports (background-clip:text) or (-webkit-background-clip:text){
  .title{background-image:var(--title-fill);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}
}

/* Named colours are bright for the dark theme; the light theme mixes them toward black so each clears 4.5:1. */
.title--c-slate{--title-base:#aab6c6}.title--c-silver{--title-base:#dfe6ee}.title--c-gold{--title-base:#e3b341}
.title--c-amber{--title-base:#ffc233}.title--c-orange{--title-base:#f0883e}.title--c-red{--title-base:#ff7b72}
.title--c-rose{--title-base:#ff8fa8}.title--c-pink{--title-base:#f778ba}.title--c-magenta{--title-base:#f04ee0}
.title--c-purple{--title-base:#bc8cff}.title--c-indigo{--title-base:#8f9bff}.title--c-blue{--title-base:#6cb2ff}
.title--c-sky{--title-base:#7fd8ff}.title--c-teal{--title-base:#3ed1c4}.title--c-mint{--title-base:#8cf0c8}
.title--c-green{--title-base:#56d68a}.title--c-lime{--title-base:#b6f23a}
.title[class*="title--c-"]{--title-c:var(--title-base)}
[data-theme="light"] .title[class*="title--c-"]:not([class*="title--g-"]){--title-c:color-mix(in srgb,var(--title-base) 52%,black)}

/* Gradients replace the colour; --title-c takes the first stop so the glow matches. Stops are darkened on the light theme. */
.title[class*="title--g-"]{--title-c:var(--g1);--title-fill:linear-gradient(90deg,var(--g1),var(--g2),var(--g3,var(--g2)))}
[data-theme="light"] .title[class*="title--g-"]{
  --title-c:color-mix(in srgb,var(--g1) 55%,black);
  --title-fill:linear-gradient(90deg,color-mix(in srgb,var(--g1) 55%,black),color-mix(in srgb,var(--g2) 55%,black),color-mix(in srgb,var(--g3,var(--g2)) 55%,black));
}
.title--g-ember{--g1:#ffb347;--g2:#ff4d4d}.title--g-fire{--g1:#ffe259;--g2:#ff8c1a;--g3:#e8322b}
.title--g-lava{--g1:#ff3d3d;--g2:#ff9a1f;--g3:#ffe14d}.title--g-sunset{--g1:#ff9a56;--g2:#ff5e8a;--g3:#a259ff}
.title--g-sunrise{--g1:#ffd86b;--g2:#ff8a5c}.title--g-gold{--g1:#fff0a0;--g2:#e3b341;--g3:#b8860b}
.title--g-rose{--g1:#ffc0d6;--g2:#ff5c8a}.title--g-candy{--g1:#ff7eb3;--g2:#7afcff}
.title--g-royal{--g1:#bc8cff;--g2:#f778ba}.title--g-galaxy{--g1:#6c5cff;--g2:#c44dff;--g3:#ff5ec4}
.title--g-aurora{--g1:#56d68a;--g2:#6cb2ff;--g3:#bc8cff}.title--g-ocean{--g1:#3ed1c4;--g2:#6cb2ff}
.title--g-ice{--g1:#e0f7ff;--g2:#6cb2ff;--g3:#3d6dff}.title--g-mint{--g1:#7bf0c0;--g2:#3ed1ff}
.title--g-forest{--g1:#a8e063;--g2:#2fa86b}.title--g-toxic{--g1:#d4ff3f;--g2:#2ee89a}
.title--g-steel{--g1:#e6edf5;--g2:#8fa3ba}

/* Glow is a drop shadow, so it follows the clipped text instead of filling the box. */
.title--glow-soft{filter:drop-shadow(0 0 .3em color-mix(in srgb,var(--title-c) 55%,transparent))}
.title--glow-strong{filter:drop-shadow(0 0 .25em color-mix(in srgb,var(--title-c) 80%,transparent)) drop-shadow(0 0 .7em color-mix(in srgb,var(--title-c) 55%,transparent))}
.title--glow-neon{filter:drop-shadow(0 0 1px var(--title-c)) drop-shadow(0 0 .35em var(--title-c)) drop-shadow(0 0 .9em color-mix(in srgb,var(--title-c) 70%,transparent))}
.title--glow-shadow{filter:drop-shadow(.06em .08em 0 color-mix(in srgb,var(--title-c) 45%,black))}
[data-theme="light"] .title--glow-soft{filter:drop-shadow(0 0 .25em color-mix(in srgb,var(--title-c) 35%,transparent))}
[data-theme="light"] .title--glow-strong{filter:drop-shadow(0 0 .2em color-mix(in srgb,var(--title-c) 50%,transparent)) drop-shadow(0 0 .5em color-mix(in srgb,var(--title-c) 30%,transparent))}
[data-theme="light"] .title--glow-neon{filter:drop-shadow(0 0 .25em color-mix(in srgb,var(--title-c) 60%,transparent)) drop-shadow(0 0 .6em color-mix(in srgb,var(--title-c) 35%,transparent))}

/* Motion: durations come from the motion tokens. */
.title--m-shimmer{
  background-image:linear-gradient(105deg,transparent 35%,rgb(255 255 255 / .9) 50%,transparent 65%),var(--title-fill);
  background-size:250% 100%,100% 100%;background-repeat:no-repeat;background-position:150% 0,0 0;
  animation:title-shimmer calc(var(--dur-pulse) * 2.5) linear infinite;
}
.title--m-pulse{animation:title-pulse var(--dur-pulse) ease-in-out infinite alternate}
.title--m-flow{background-size:220% 100%;animation:title-flow calc(var(--dur-pulse) * 2.5) ease-in-out infinite alternate}
.title--m-flicker{animation:title-flicker calc(var(--dur-pulse) * 2) steps(1,end) infinite}
.title--m-float{animation:title-float var(--dur-pulse) ease-in-out infinite alternate}
@keyframes title-shimmer{to{background-position:-50% 0,0 0}}
@keyframes title-pulse{from{opacity:1}to{opacity:.55}}
@keyframes title-flow{from{background-position:0 0}to{background-position:100% 0}}
@keyframes title-flicker{0%,100%{opacity:1}8%{opacity:.4}10%{opacity:1}55%{opacity:1}57%{opacity:.5}59%{opacity:1}}
@keyframes title-float{from{transform:translateY(0)}to{transform:translateY(-2px)}}
@media (prefers-reduced-motion:reduce){.title{animation:none}}
[data-motion="off"] .title{animation:none}

/* In a board row the title sits on a plate in the page background, in both copies of the row, so its colour or gradient
   reads whether or not the bar is behind it. The plate is the wrapper, not the title: background-clip:text does not
   survive a second background layer. Glow is off, since it would outline the plate instead of the letters. */
.lb-row .viewer__plate{display:block;width:fit-content;max-width:100%;padding:1px var(--space-1);margin-left:calc(-1*var(--space-1));background:var(--bg)}
.lb-row .title{filter:none}
@media (forced-colors:active){.title{background:none;-webkit-text-fill-color:currentColor;color:CanvasText;filter:none;animation:none}}

.viewer__title{display:block}
h1 .title{font-size:inherit}

/* Rarity is a small label in the shop and admin lists. */
.rarity{display:inline-flex;font:var(--fw-bold) 10px/1 var(--font-mono);letter-spacing:.08em;text-transform:uppercase}
.rarity--common{color:var(--text-muted)}.rarity--rare{color:var(--info)}.rarity--epic{color:var(--chart-4)}.rarity--legendary{color:var(--rank-gold)}

/* The "new" dot: a small square in the accent colour, with the words in the markup for screen readers. */
.new-dot{display:inline-block;width:8px;height:8px;background:var(--accent-text);vertical-align:middle}
.navlink .new-dot{margin-left:6px}

/* The viewer's titles page and the admin lists: ruled rows, not boxes. */
.title-list{list-style:none;margin:0;padding:0}
.title-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:var(--space-3) var(--space-5);align-items:center;padding:var(--space-4) 0;border-top:1px solid var(--border)}
.title-row:first-child{border-top:0}
.title-row__main{min-width:0;display:flex;flex-direction:column;gap:var(--space-2)}
.title-row__name{display:flex;align-items:center;gap:var(--space-3);flex-wrap:wrap}
.title-row__name .title{font-size:var(--fs-lg)}
.title-row__meta{color:var(--text-muted);font-size:var(--fs-sm)}
.title-row__action{display:flex;align-items:center;gap:var(--space-3);flex-wrap:wrap;justify-content:flex-end}
.title-row__price{font:var(--fw-bold) var(--fs-sm)/1 var(--font-mono)}
@media (max-width:600px){.title-row{grid-template-columns:1fr}.title-row__action{justify-content:flex-start}}

/* The title builder: the form's groups are ruled sections with room between fields; the preview stays in view. */
.title-form{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--space-8)}
@media (min-width:1000px){.title-form{grid-template-columns:minmax(0,1fr) minmax(0,24rem);align-items:start}.title-form__preview{position:sticky;top:var(--space-6)}}
.title-form__main{display:flex;flex-direction:column;gap:var(--space-8)}
.title-form__group{display:flex;flex-direction:column;gap:var(--space-6)}
.title-form__group>.section-title{margin-bottom:0}
.title-form .field{gap:var(--space-2)}
.title-form .field__hint{margin-top:var(--space-1)}
.title-form__pair{display:grid;grid-template-columns:repeat(auto-fit,minmax(14rem,1fr));gap:var(--space-6)}
.colour-field{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,9rem) 44px;gap:var(--space-4);align-items:end}
.colour-field input[type="color"]{width:44px;height:44px;padding:0;border:0;background:none;cursor:pointer}
@media (max-width:600px){.colour-field{grid-template-columns:minmax(0,1fr) 44px}.colour-field .colour-field__hex{grid-column:1}}

/* The live preview, on a dark and a light stage so both themes are judged at once. */
.title-preview{display:grid;grid-template-columns:1fr 1fr}
.title-preview__stage{display:flex;align-items:center;justify-content:center;min-height:7rem;padding:var(--space-5);overflow:hidden}
.title-preview__stage .title{font-size:var(--fs-2xl)}
/* Each stage carries its own data-theme, so the tokens and the title's light-theme rules apply inside it. */
.title-preview__stage{background:var(--bg);color:var(--text)}

/* Premade styles: click one to fill the style fields. */
.preset-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(10.5rem,1fr));gap:0 var(--space-4)}
.preset{appearance:none;display:flex;align-items:center;justify-content:center;min-height:52px;padding:var(--space-2) var(--space-3);color:var(--text);background:transparent;border:0;border-top:1px solid var(--border);cursor:pointer;transition:background var(--dur-fast)}
.preset:hover,.preset:focus-visible{background:var(--surface-raised)}
.preset[aria-pressed="true"]{background:var(--accent-soft)}
.preset .title{font-size:var(--fs-md);pointer-events:none}

/* The buy confirmation: the title large, then price and balances as a ruled list. */
.buy__title{display:flex;align-items:center;min-height:4rem}
.buy__title .title{font-size:var(--fs-3xl)}
.buy__facts{margin:0;display:flex;flex-direction:column}
.buy__facts>div{display:flex;justify-content:space-between;gap:var(--space-4);padding:var(--space-3) 0;border-top:1px solid var(--border)}
.buy__facts dt{color:var(--text-muted)}.buy__facts dd{margin:0;font-weight:var(--fw-bold)}

.title--lg{font-size:var(--fs-2xl)}

/* Title picker (raffle prizes): a button and a listbox of titles in their own styles. The native select stays as the
   form value and as the whole control without the script; the script adds .tpick-js to <html>. */
.tpick{position:relative}
.tpick__ui{display:none}
.tpick-js .tpick__ui{display:block}
.tpick-js .tpick__native{display:none}
.tpick__btn{width:100%;display:flex;align-items:center;text-align:left;min-height:44px;cursor:pointer}
.tpick__value{min-width:0;display:flex;align-items:center}
.tpick__value .title,.tpick__option .title{font-size:var(--fs-lg)}
.tpick__list{position:absolute;z-index:20;left:0;right:0;top:100%;margin:var(--space-1) 0 0;padding:0;list-style:none;max-height:340px;overflow-y:auto;background:var(--surface-raised);box-shadow:inset 0 0 0 1px var(--border-strong),var(--shadow-md)}
.tpick__list[hidden]{display:none}
.tpick__list:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--accent-text),var(--shadow-md)}
.tpick__option{display:flex;align-items:center;padding:var(--space-3) var(--space-4);cursor:pointer}
.tpick__option+.tpick__option{border-top:var(--border-width) solid var(--border)}
.tpick__option:hover,.tpick__option.is-active{background:var(--accent-soft)}
.tpick__option[aria-selected="true"]{box-shadow:inset 0 0 0 1px var(--accent-line)}
