/* Shared pieces for inner pages in the new black theme (body.page-v2).
   Loads after css/home.css, which already provides the --h-* tokens, the
   clock header + Tools mega menu, background layers and footer. This file
   adds what content pages need on top: page heading, panels, pill buttons,
   and re-skins of style.css's shared widgets (hero chips, search bar,
   element filters, tier headers, loading spinner, page-switch menu). */

.page-v2 .page-main {
  position: relative; z-index: 10;
  max-width: 1180px; margin: 0 auto;
  padding: 130px clamp(16px, 4vw, 48px) 90px;
  min-height: 70vh;
}

/* Loading screen (style.css .home-status) — same as index.html's TDERM
   preloader (css/home.css .preloader-word / .preloader-bar): the letters of
   LOADING rise in one after another, a 1px line runs underneath, and the
   page's own Thai status text sits below as the caption. js/home-fx.js
   adds the word + line to every .home-status, so no page markup changes;
   the old ring from style.css is switched off. The line keeps sweeping
   (instead of filling once like index's) since load time is unknown. */
.page-v2 .home-status {
  gap: 22px; padding: 140px 0;
  color: var(--h-muted); font: 500 13px 'Anuphan', sans-serif; letter-spacing: .02em;
}
.page-v2 .home-status::before { content: none; }
.page-v2 .home-status .preloader-word { color: var(--h-fg); font-family: 'Inter', sans-serif; line-height: 1.1; }
.page-v2 .home-status .preloader-bar i { width: 40%; animation: v2-load-sweep 1.3s cubic-bezier(.65, 0, .35, 1) infinite .45s; transform: translateX(-100%); }
@keyframes v2-load-sweep { to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) {
  .page-v2 .home-status .preloader-word span { animation: none; transform: none; }
  .page-v2 .home-status .preloader-bar i { animation: none; transform: none; width: 100%; opacity: .5; }
}
/* Infinity Castle collab (html.collab-ic, through 28 Oct): a faint 無限城
   over the word and the running line lit amber like the biwa strings in
   js/page-transition.js. The word itself stays as is. */
html.collab-ic .page-v2 .home-status::before {
  content: '無限城'; width: auto; height: auto; border: 0; border-radius: 0; animation: none;
  margin-bottom: -10px; color: rgba(255,200,150,.45); letter-spacing: .5em; padding-left: .5em;
  font: 700 13px/1 'Yu Mincho', 'Hiragino Mincho ProN', 'Noto Serif JP', serif;
}
html.collab-ic .page-v2 .home-status .preloader-bar { background: rgba(255,170,100,.18); box-shadow: 0 0 10px rgba(255,110,60,.25); }
html.collab-ic .page-v2 .home-status .preloader-bar i {
  background: linear-gradient(90deg, rgba(255,190,120,0), rgba(255,210,160,.95), rgba(255,190,120,0));
}

/* Page heading */
.page-head { margin-bottom: 36px; }
.page-head-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 40px; }
.page-kicker { display: block; margin-bottom: 12px; }
.page-guild { color: var(--h-lime); letter-spacing: .12em; }
.page-title {
  margin: 0; font-family: 'Anuphan', 'Inter', sans-serif; font-weight: 800;
  font-size: clamp(2.2rem, 5.2vw, 4.4rem); line-height: 1.1; letter-spacing: -.02em; color: var(--h-fg);
}
/* Title text in <span class="shiny"> gets the same slow light sweep as
   index.html's giant headline (home.css .shiny). Padding + equal negative
   margin so the gradient box covers Thai marks above/below the line
   instead of slicing them. */
.page-title .shiny { display: inline-block; padding: .2em .12em .12em; margin: -.2em -.12em -.12em; }
/* One short line under the title (it wraps only on narrow screens) — keep
   the wording tight rather than explaining the whole page here. */
.page-hint { margin: 16px 0 0; max-width: 64rem; font: 500 14px/1.75 'Anuphan', sans-serif; color: var(--h-muted); }
.page-hint b { color: var(--h-fg); }

/* Pill buttons — same language as the reference portfolio's CTAs: fully
   round, no outline, a slight grow on hover and squash on press, a trailing
   arrow that nudges toward where it goes (.pb-arrow-l/-r/-ur), and a light
   sweep across the solid one while hovered.
   .solid = white primary · .ghost = muted grey secondary · .danger = rose */
.pill-btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 24px; border: 0; border-radius: 999px;
  font: 700 13.5px 'Anuphan', sans-serif; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .3s cubic-bezier(.23, 1, .32, 1), background .25s, color .25s, box-shadow .3s, opacity .2s;
}
.pill-btn:hover:not(:disabled) { transform: scale(1.05); }
.pill-btn:active:not(:disabled) { transform: scale(.95); }
.pill-btn:focus-visible { outline: 2px solid var(--h-lime); outline-offset: 3px; }
.pill-btn:disabled { opacity: .4; cursor: not-allowed; }
.pill-btn svg { flex-shrink: 0; transition: transform .3s cubic-bezier(.23, 1, .32, 1); }
.pill-btn:hover:not(:disabled) .pb-arrow-r { transform: translateX(4px); }
.pill-btn:hover:not(:disabled) .pb-arrow-l { transform: translateX(-4px); }
.pill-btn:hover:not(:disabled) .pb-arrow-ur { transform: translate(3px, -3px); }

.pill-btn.solid { background: var(--h-pill-bg); color: var(--h-pill-fg) !important; box-shadow: 0 18px 40px rgba(0, 0, 0, .4); }
.pill-btn.solid::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .1), transparent);
  transform: translateX(-100%);
}
.pill-btn.solid:hover:not(:disabled)::after { animation: pill-sweep 1.5s infinite; }
@keyframes pill-sweep { to { transform: translateX(100%); } }

.pill-btn.ghost { background: #1f1f1f; color: var(--h-fg) !important; }
.pill-btn.ghost:hover:not(:disabled) { background: #2b2b2b; }

.pill-btn.danger { background: rgba(244, 63, 94, .12); color: #fb7185 !important; }
.pill-btn.danger:hover:not(:disabled) { background: rgba(244, 63, 94, .22); }

/* Panels */
.panel {
  position: relative; margin-bottom: 24px; padding: clamp(18px, 2.4vw, 28px);
  background: var(--h-card); border: 1px solid var(--h-line); border-radius: 26px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.panel-title { margin: 0; font: 800 22px 'Anuphan', sans-serif; color: var(--h-fg); }

/* Hero chips (style.css .hero-chip) */
.page-v2 .hero-chip {
  border-radius: 14px; padding: 6px 4px;
  transition: background .2s, transform .25s cubic-bezier(.23, 1, .32, 1);
}
.page-v2 .hero-chip:hover { background: var(--h-card-hover); transform: translateY(-2px); }
.page-v2 .hero-chip img { border: 1px solid var(--h-line); border-radius: 12px; background: var(--h-mcard-bg); }
.page-v2 .hero-chip span { color: var(--h-muted); font-family: 'Anuphan', sans-serif; }

/* Hero library grid (style.css .hero-grid) */
.page-v2 .hero-grid {
  background: transparent; border: 0; border-radius: 0; padding: 4px 2px; gap: 10px;
  scrollbar-width: thin; scrollbar-color: var(--h-line) transparent;
}

/* Search bar (style.css .search-bar) */
.page-v2 .search-bar {
  background: var(--h-mcard-bg); border: 1px solid var(--h-line); border-radius: 999px;
  box-shadow: none; padding: 11px 18px; transition: border-color .2s;
}
.page-v2 .search-bar:focus-within { border-color: var(--h-fg); }
.page-v2 .search-bar input { color: var(--h-fg); font-family: 'Anuphan', sans-serif; }
.page-v2 .search-bar .search-icon { color: var(--h-muted); display: grid; place-items: center; }

/* Element filter buttons (style.css .hero-element-btn) */
.page-v2 .hero-element-filter-row { gap: 8px; margin-bottom: 0; }
.page-v2 .hero-element-btn {
  width: 40px; height: 40px; padding: 7px; border-radius: 50%;
  background: var(--h-mcard-bg); border: 1px solid var(--h-line);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.page-v2 .hero-element-btn:hover { border-color: var(--h-fg); transform: translateY(-1px); }
.page-v2 .hero-element-btn.active { border-color: var(--h-lime); background: var(--h-mcard-hover); box-shadow: 0 0 0 3px rgba(190, 242, 100, .15); }

/* Tier headers inside hero libraries (style.css .palette-tier-*) — same
   per-tier colours, just pill-shaped with the theme's label typography. */
.page-v2 .palette-tier-header {
  border-radius: 999px; padding: 6px 14px; margin-top: 12px;
  font: 700 11px 'Inter', 'Anuphan', sans-serif; letter-spacing: .15em;
}

/* Icon motion — Hugeicons (21st.dev) split so one meaningful part moves
   while its button is hovered or keyboard-focused: the bin lid lifts, the
   upload arrow shoots up, the inbox arrow drops in, the pen writes, the
   shield's check redraws, + and × turn, the flask swirls, the dice rolls, the sync arrows turn, the eye blinks / its slash redraws.
   Individual transform properties (rotate/translate/scale) so the motion
   never fights the button's own transform. Static under reduced motion. */
@keyframes ico-draw { from { stroke-dashoffset: 1; } }
.ico-bin-lid, .ico-edit-pen, .ico-flask-body, .ico-flask-spark { transform-box: fill-box; }
.ico-bin-lid { transform-origin: 0% 100%; transition: rotate .35s cubic-bezier(.34, 1.56, .64, 1), translate .35s cubic-bezier(.34, 1.56, .64, 1); }
:is(.pill-btn, .btn, .draft-icon-btn):is(:hover, :focus-visible) .ico-bin-lid { rotate: -16deg; translate: -1px -1.5px; }
:is(.pill-btn, .btn):is(:hover, :focus-visible) .ico-upload-arrow { animation: ico-arrow-up .9s cubic-bezier(.65, 0, .35, 1) infinite; }
@keyframes ico-arrow-up { 0% { translate: 0 0; opacity: 1; } 45% { translate: 0 -5px; opacity: 0; } 46% { translate: 0 5px; opacity: 0; } 100% { translate: 0 0; opacity: 1; } }
:is(.pill-btn, .draft-deploy-btn2):is(:hover, :focus-visible) .ico-inbox-arrow { animation: ico-arrow-down .9s cubic-bezier(.65, 0, .35, 1) infinite; }
@keyframes ico-arrow-down { 0% { translate: 0 0; opacity: 1; } 45% { translate: 0 4px; opacity: 0; } 46% { translate: 0 -4px; opacity: 0; } 100% { translate: 0 0; opacity: 1; } }
.ico-edit-pen { transform-origin: 0% 100%; }
.ico-edit-line { stroke-dasharray: 1; stroke-dashoffset: 0; }
:is(.btn, .draft-icon-btn):is(:hover, :focus-visible) .ico-edit-pen { animation: ico-write .7s ease-in-out; }
:is(.btn, .draft-icon-btn):is(:hover, :focus-visible) .ico-edit-line { animation: ico-draw .7s cubic-bezier(.23, 1, .32, 1); }
@keyframes ico-write { 30% { rotate: -10deg; translate: -1px 0; } 60% { rotate: 6deg; translate: 1px 0; } }
.ico-shield-check { stroke-dasharray: 1; stroke-dashoffset: 0; }
.draft-chip:is(:hover, :focus-visible) .ico-shield-check { animation: ico-draw .6s cubic-bezier(.23, 1, .32, 1); }
.ico-plus, .ico-x { transition: rotate .45s cubic-bezier(.23, 1, .32, 1); }
.pill-btn:is(:hover, :focus-visible) .ico-plus { rotate: 90deg; }
.slot-remove:is(:hover, :focus-visible) .ico-x { rotate: 90deg; }
.ico-flask-body { transform-origin: 50% 100%; }
.ico-flask-spark { transform-origin: 50% 50%; }
.pill-btn:is(:hover, :focus-visible) .ico-flask-body { animation: ico-swirl .9s ease-in-out; }
.pill-btn:is(:hover, :focus-visible) .ico-flask-spark { animation: ico-twinkle 1.2s ease-in-out infinite; }
@keyframes ico-swirl { 25% { rotate: -12deg; } 55% { rotate: 9deg; } 80% { rotate: -4deg; } }
@keyframes ico-twinkle { 50% { scale: .55; rotate: 45deg; opacity: .6; } }
.ico-dice { transition: rotate .6s cubic-bezier(.34, 1.56, .64, 1); }
.castle-mock-btn:is(:hover, :focus-visible) .ico-dice { rotate: 180deg; }
.ico-sync { transition: rotate .7s cubic-bezier(.34, 1.56, .64, 1); }
.castle-mock-btn:is(:hover, :focus-visible) .ico-sync { rotate: 180deg; }
.ico-eye, .ico-eye-pupil { transform-box: fill-box; transform-origin: 50% 50%; }
.ico-eye-slash { stroke-dasharray: 1; stroke-dashoffset: 0; }
.castle-hide-toggle:is(:hover, :focus-visible) .ico-eye { animation: ico-blink .55s ease-in-out; }
.castle-hide-toggle:is(:hover, :focus-visible) .ico-eye-pupil { animation: ico-glance 1.1s ease-in-out .55s; }
.castle-hide-toggle:is(:hover, :focus-visible) .ico-eye-slash { animation: ico-draw .5s cubic-bezier(.23, 1, .32, 1); }
@keyframes ico-blink { 40% { scale: 1 .1; } }
@keyframes ico-glance { 25% { translate: -2px 0; } 65% { translate: 2px 0; } }
@media (prefers-reduced-motion: reduce) {
  .ico-upload-arrow, .ico-inbox-arrow, .ico-edit-pen, .ico-edit-line, .ico-shield-check, .ico-flask-body, .ico-flask-spark, .ico-eye, .ico-eye-pupil, .ico-eye-slash { animation: none !important; }
  .ico-bin-lid, .ico-plus, .ico-x, .ico-dice, .ico-sync { transition: none; rotate: none !important; translate: none !important; }
}

/* Page-switch menu (js/guild-nav.js) — only shown on phones, where the
   Tools mega menu is hidden; opens leftward from the header's right side. */
.topbar #guildNavBtn { display: none !important; }
.page-v2 .guild-nav-menu {
  left: auto; right: 0; top: calc(100% + 10px); min-width: 220px; padding: 6px;
  background: var(--h-mega-bg); border: 1px solid var(--h-line); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.page-v2 .guild-nav-item { color: var(--h-fg); font-family: 'Anuphan', sans-serif; border-radius: 10px; }
.page-v2 .guild-nav-item:hover { background: var(--h-nav-active); }
.page-v2 .guild-nav-item.active { color: var(--h-lime); background: var(--h-mcard-hover); }
.page-v2 .guild-nav-divider { background: var(--h-line); }

@media (max-width: 680px) {
  .topbar #guildNavBtn { display: flex !important; }
  .page-v2 .page-main { padding-top: 100px; }
  .page-head-actions { margin-bottom: 28px; }
  .pill-btn { padding: 10px 16px; font-size: 13px; }
}

/* Collab heroes (Demon Slayer: ทันจิโร่ / เซนอิทซึ / ชิโนบุ / กิยู Awake) carry a small red 滅
   seal top-left on their portrait wherever a hero chip is drawn (คลัง,
   drafts, teams, tier list). Keyed off the portrait file so every page's
   chip markup picks it up without touching each renderer; stays after the
   collab ends since it marks the hero, not the event. Top-left because the
   game art already has the Awake star top-right and the element badge
   bottom-left. */
.chip-art:has(> img[src$="/ทันจิโร่ Awake.webp"], > img[src$="/เซนอิทซึ Awake.webp"], > img[src$="/ชิโนบุ Awake.webp"], > img[src$="/กิยู Awake.webp"])::before {
  content: '滅'; position: absolute; z-index: 2; top: 6%; left: 6%;
  display: grid; place-items: center; width: 26%; aspect-ratio: 1; max-width: 22px; min-width: 14px;
  border-radius: 4px; background: #c41e3a; color: #fff; pointer-events: none;
  font: 700 clamp(9px, 1.6vw, 13px)/1 'Yu Mincho', 'Hiragino Mincho ProN', 'Noto Serif JP', serif;
  box-shadow: 0 0 0 1px rgba(255, 220, 200, .35), 0 2px 6px rgba(0, 0, 0, .55);
  transform: rotate(-8deg);
}
