/* ==========================================================================
   Yrsvald — Components
   Buttons, panels, tooltip-cards, badges, nav, IP bar, pixel dividers.
   Zero border-radius. Hard-edged bevels. No `transition: all`.
   ========================================================================== */

/* ---- Shared bevel / texture primitives -------------------------------------- */

.bevel {
  border: var(--edge-width) solid var(--edge);
  box-shadow:
    inset 2px 2px 0 var(--bevel-light),
    inset -2px -2px 0 var(--bevel-dark);
}

/* "stone" panel texture — 4x4 two-tone checker, scaled 4x, pixelated */
.textured {
  background-color: var(--bg-panel);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='2' height='2' fill='%23ffffff' fill-opacity='0.03'/%3E%3Crect x='2' y='2' width='2' height='2' fill='%23ffffff' fill-opacity='0.03'/%3E%3Crect x='2' width='2' height='2' fill='%23000000' fill-opacity='0.03'/%3E%3Crect y='2' width='2' height='2' fill='%23000000' fill-opacity='0.03'/%3E%3C/svg%3E");
  background-size: 16px 16px;
  image-rendering: pixelated;
}

/* pixel-notched corners for featured panels (one 4px diagonal step/corner) */
.pixel-corners {
  clip-path: polygon(
    var(--notch) 0,
    calc(100% - var(--notch)) 0,
    100% var(--notch),
    100% calc(100% - var(--notch)),
    calc(100% - var(--notch)) 100%,
    var(--notch) 100%,
    0 calc(100% - var(--notch)),
    0 var(--notch)
  );
}

/* three-square pixel divider under section titles */
.pixel-divider {
  display: flex;
  gap: 6px;
  margin-block: var(--sp-2);
}

.pixel-divider span {
  width: 10px;
  height: 10px;
  background: var(--teal);
  flex: none;
}

.section-title-wrap.center .pixel-divider {
  justify-content: center;
}

/* ---- Buttons ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 44px;
  padding: 0.75em 1.5em;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap; /* a label never wraps mid-text; parents row-wrap instead */
  text-decoration: none;
  cursor: pointer;
  color: var(--ink);
  background: var(--bg-panel);
  border: var(--edge-width) solid var(--edge);
  box-shadow:
    inset 2px 2px 0 var(--bevel-light),
    inset -2px -2px 0 var(--bevel-dark),
    0 4px 0 var(--edge);
  transition: translate var(--dur-fast) linear, box-shadow var(--dur-fast) linear, filter var(--dur-fast) linear;
}

.btn:hover {
  filter: brightness(1.12);
  box-shadow:
    inset 0 0 0 1px oklch(1 0 0 / 0.6),
    inset 2px 2px 0 var(--bevel-light),
    inset -2px -2px 0 var(--bevel-dark),
    0 4px 0 var(--edge);
}

.btn:active {
  translate: 0 4px;
  box-shadow:
    inset 2px 2px 0 var(--bevel-light),
    inset -2px -2px 0 var(--bevel-dark),
    0 0 0 var(--edge);
}

.btn-primary {
  color: oklch(0.16 0.02 265);
  background: var(--grass);
  box-shadow:
    inset 2px 2px 0 var(--bevel-light),
    inset -2px -2px 0 var(--bevel-dark),
    0 4px 0 var(--grass-deep);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow:
    inset 0 0 0 1px oklch(1 0 0 / 0.6),
    inset 2px 2px 0 var(--bevel-light),
    inset -2px -2px 0 var(--bevel-dark),
    0 4px 0 var(--grass-deep);
}

.btn-primary:active {
  translate: 0 4px;
  box-shadow:
    inset 2px 2px 0 var(--bevel-light),
    inset -2px -2px 0 var(--bevel-dark),
    0 0 0 var(--grass-deep);
}

.btn-discord {
  color: var(--ink);
  background: oklch(0.5 0.14 275);
  box-shadow:
    inset 2px 2px 0 var(--bevel-light),
    inset -2px -2px 0 var(--bevel-dark),
    0 4px 0 oklch(0.36 0.12 275);
}

.btn-discord:hover {
  filter: brightness(1.1);
  box-shadow:
    inset 0 0 0 1px oklch(1 0 0 / 0.6),
    inset 2px 2px 0 var(--bevel-light),
    inset -2px -2px 0 var(--bevel-dark),
    0 4px 0 oklch(0.36 0.12 275);
}

.btn-discord:active {
  translate: 0 4px;
  box-shadow:
    inset 2px 2px 0 var(--bevel-light),
    inset -2px -2px 0 var(--bevel-dark),
    0 0 0 oklch(0.36 0.12 275);
}

.btn.is-copied {
  color: oklch(0.16 0.02 265);
  background: var(--grass);
}

/* keep the IP bar from shifting when "Copy" flips to "Copied!" */
.ip-bar .btn {
  min-width: 8.5em;
}

.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn[aria-disabled="true"]:active {
  translate: none;
}

/* ---- Badges --------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25em 0.6em;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bg-deep);
  background: var(--ink-dim);
  border: var(--edge-width) solid var(--edge);
}

.badge-soon {
  background: var(--gold);
  color: oklch(0.16 0.02 265);
}

.badge-level {
  background: var(--accent, var(--teal));
  color: oklch(0.16 0.02 265);
}

.ability-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35em 0.7em;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg-inset);
  border: 1px solid var(--edge);
}

/* ---- Panels ----------------------------------------------------------------------- */

.panel {
  background: var(--bg-panel);
  border: var(--edge-width) solid var(--edge);
  box-shadow:
    inset 2px 2px 0 var(--bevel-light),
    inset -2px -2px 0 var(--bevel-dark);
  padding: var(--sp-4);
}

.panel-inset {
  background: var(--bg-inset);
  border: var(--edge-width) solid var(--edge);
  box-shadow:
    inset -2px -2px 0 var(--bevel-light),
    inset 2px 2px 0 var(--bevel-dark);
}

/* ---- Tooltip card (MC item-tooltip homage) ------------------------------------------ */

.tip-card {
  --accent: var(--rune-tint);
  background: oklch(0.22 0.02 265 / 0.97);
  border: 2px solid var(--accent);
  padding: 20px;
  transition: translate var(--dur-med) var(--ease-out), border-color var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
}

.tip-card:hover,
.tip-card:focus-within {
  translate: 0 -4px;
  box-shadow: 0 8px 0 -4px oklch(0 0 0 / 0.35);
}

.tip-card--hearthmoor:hover { border-color: var(--region-hearthmoor); }
.tip-card--skarrow:hover    { border-color: var(--region-skarrow); }
.tip-card--duskmere:hover   { border-color: var(--region-duskmere); }
.tip-card--caelador:hover   { border-color: var(--region-caelador); }
.tip-card--class:hover      { border-color: var(--gold); }

.tip-card__emblem {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  margin-block-end: var(--sp-2);
}

.tip-card__name {
  font-size: 1.1rem;
  margin-block-end: var(--sp-1);
}

.tip-card__flavor {
  color: var(--ink-dim);
  margin-block-start: var(--sp-2);
}

.tip-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-block-start: var(--sp-2);
}

/* ---- Article cards (Chronicle) ------------------------------------------------------- */

.article-card__meta {
  display: block;
  color: var(--ink-dim);
  font-size: 0.85rem;
  margin-block-end: var(--sp-1);
}

.article-card__excerpt {
  color: var(--ink-dim);
  margin-block: var(--sp-2);
}

.article-card__link[aria-disabled="true"] {
  color: var(--ink-dim);
  text-decoration: none;
  cursor: not-allowed;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

/* ---- Nav ----------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: oklch(0.16 0.02 265 / 0.92);
  border-bottom: 2px solid transparent;
  transition: border-color var(--dur-med) linear;
}

.site-header.scrolled {
  border-bottom-color: var(--gold);
}

.nav {
  max-width: var(--content-max);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; /* narrow viewports: actions wrap under the brand row */
  row-gap: var(--sp-1);
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.6em;
  text-decoration: none;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.nav__logo {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}

/* .nav__links display is set responsively in sections.css:
   collapsed (native <details> show/hide) below 920px,
   forced flex row at 920px+. */
.nav__links {
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.nav__disclosure {
  position: relative;
}

.nav__disclosure > summary {
  cursor: pointer;
  list-style: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0.5em 0.75em;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  background: var(--bg-panel);
  border: var(--edge-width) solid var(--edge);
}

.nav__disclosure > summary::-webkit-details-marker {
  display: none;
}

.nav__disclosure[open] > .nav__links {
  display: flex;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 10;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-width: 200px;
  background: var(--bg-panel);
  border: var(--edge-width) solid var(--edge);
}

.nav__disclosure[open] > .nav__links .nav__link {
  padding: 0.75em var(--sp-2);
  width: 100%;
}

.nav__link {
  text-decoration: none;
  color: var(--ink-dim);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.5em 0;
  transition: color var(--dur-fast) linear;
}

.nav__link:hover {
  color: var(--ink);
}

.nav__link[aria-disabled="true"] {
  cursor: not-allowed;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap; /* narrow viewports: row-wrap instead of overflowing */
  justify-content: flex-end;
}

/* ---- IP bar --------------------------------------------------------------------------- */

.ip-bar {
  display: flex;
  align-items: stretch;
  gap: var(--sp-2);
  padding: var(--sp-2);
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
}

.ip-bar__value {
  flex: 1;
  min-width: 0; /* let the flex row shrink: ellipsize instead of overflowing */
  display: flex;
  align-items: center;
  padding-inline: var(--sp-2);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.02em;
  min-height: 44px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Splash accent ---------------------------------------------------------------------- */

.splash {
  display: inline-block;
  color: var(--gold);
  font-weight: 700;
  font-size: 0.95rem;
  transform: rotate(-8deg);
  animation: splash-pulse 900ms steps(2) infinite;
}

@keyframes splash-pulse {
  0%, 100% { scale: 1; }
  50% { scale: 1.04; }
}

@media (prefers-reduced-motion: reduce) {
  .splash {
    animation: none;
  }
}

/* ---- Scroll cue ------------------------------------------------------------------------- */

.scroll-cue {
  position: absolute;
  bottom: var(--sp-3);
  left: 50%;
  translate: -50% 0;
  width: 24px;
  height: 24px;
  animation: scroll-bounce 1.2s steps(4) infinite;
}

@keyframes scroll-bounce {
  0%, 100% { translate: -50% 0; }
  50% { translate: -50% 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue {
    animation: none;
  }
}

/* ---- Scroll reveal ------------------------------------------------------------------------ */

.reveal {
  opacity: 0;
  translate: 0 12px;
  transition: opacity var(--dur-reveal) var(--ease-out), translate var(--dur-reveal) var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  translate: 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    translate: 0 0;
    transition: none;
  }
}
