/* Palpedia TCG — content pages (rules, guides, news, events, deals, prices, developers).
   Shared stylesheet for the editorial side of the sub-platform: hero intros,
   sticky rule index, glossary, card-rule explorer, timelines and data tables.
   Consumes the global design tokens from index.css and the primitives from
   styles/pages/tcg-hub/chrome.css (.tcg-panel, .tcg-section, .tcg-eyebrow…). */

/* ---------- Shared content primitives ---------- */

body.tcg-hub-page .tcg-content-hero {
  margin-top: clamp(1.6rem, 3vw, 2.6rem);
  max-width: 72ch;
}

body.tcg-hub-page .tcg-content-hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3.4vw, 2.7rem);
  letter-spacing: -.015em;
  color: var(--text, #edf7f5);
}

body.tcg-hub-page .tcg-content-hero__lead {
  margin: .7rem 0 0;
  color: var(--muted, #9fb5b7);
  font-size: .98rem;
  line-height: 1.55;
}

body.tcg-hub-page .tcg-content-hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .9rem;
}

body.tcg-hub-page .tcg-content-breadcrumb {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: clamp(1.2rem, 2.4vw, 1.8rem);
  font-size: .84rem;
}

body.tcg-hub-page .tcg-content-breadcrumb a {
  color: var(--cyan, #62e7ed);
  text-decoration: none;
  font-weight: 600;
}

body.tcg-hub-page .tcg-content-breadcrumb a:hover,
body.tcg-hub-page .tcg-content-breadcrumb a:focus-visible {
  color: var(--cyan-soft, #a6fbf6);
}

body.tcg-hub-page .tcg-content-breadcrumb span[aria-current] {
  color: var(--muted, #9fb5b7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.tcg-hub-page .tcg-content-note {
  display: flex;
  gap: .8rem;
  align-items: flex-start;
  padding: .9rem 1.1rem;
  color: var(--muted, #9fb5b7);
  font-size: .88rem;
  line-height: 1.5;
}

body.tcg-hub-page .tcg-content-note::before {
  content: "";
  flex: 0 0 auto;
  width: .55rem;
  height: .55rem;
  margin-top: .3rem;
  background: var(--amber, #f2b84b);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

body.tcg-hub-page .tcg-content-note a {
  color: var(--cyan, #62e7ed);
}

body.tcg-hub-page .tcg-content-search {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .8rem;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line, rgba(166, 217, 224, .2));
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

body.tcg-hub-page .tcg-content-search svg {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  fill: var(--muted, #9fb5b7);
}

body.tcg-hub-page .tcg-content-search input {
  flex: 1 1 auto;
  min-width: 0;
  padding: .3rem 0;
  color: var(--text, #edf7f5);
  background: transparent;
  border: 0;
  font: inherit;
  font-size: .92rem;
}

body.tcg-hub-page .tcg-content-search input:focus {
  outline: none;
}

body.tcg-hub-page .tcg-content-search:focus-within {
  border-color: color-mix(in srgb, var(--cyan, #62e7ed) 55%, transparent);
}

body.tcg-hub-page .tcg-content-count {
  margin: .8rem 0 0;
  color: var(--muted, #9fb5b7);
  font-size: .8rem;
}

body.tcg-hub-page .tcg-content-empty {
  padding: 1.4rem;
  color: var(--muted, #9fb5b7);
  font-size: .9rem;
  text-align: center;
}

/* ---------- Rules: layout with sticky index ---------- */

body.tcg-hub-page .tcg-rules-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: clamp(1.2rem, 2.6vw, 2.4rem);
  align-items: start;
}

body.tcg-hub-page .tcg-rules-index {
  position: sticky;
  top: calc(var(--app-chrome-header-height, 60px) + var(--tcg-subnav-height, 46px) + 1.6rem);
  padding: .9rem 1rem;
}

body.tcg-hub-page .tcg-rules-index h2 {
  margin: 0 0 .6rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted, #9fb5b7);
}

/* The index is a <details> that only behaves as a collapsible on mobile;
   on desktop it stays open and the summary is hidden. */
body.tcg-hub-page .tcg-rules-index__collapsible summary {
  display: none;
}

body.tcg-hub-page .tcg-rules-index ol {
  display: grid;
  gap: .15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.tcg-hub-page .tcg-rules-index a {
  display: block;
  padding: .3rem .55rem;
  color: var(--muted, #9fb5b7);
  font-size: .82rem;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 160ms var(--ease-out, cubic-bezier(.22, 1, .36, 1)), border-color 160ms var(--ease-out, cubic-bezier(.22, 1, .36, 1));
}

body.tcg-hub-page .tcg-rules-index a:hover,
body.tcg-hub-page .tcg-rules-index a:focus-visible {
  color: var(--text, #edf7f5);
}

body.tcg-hub-page .tcg-rules-index a.is-active {
  color: var(--cyan, #62e7ed);
  border-left-color: var(--cyan, #62e7ed);
}

body.tcg-hub-page .tcg-rules-article {
  padding: clamp(1.1rem, 2.4vw, 1.7rem);
  scroll-margin-top: calc(var(--app-chrome-header-height, 60px) + var(--tcg-subnav-height, 46px) + 2rem);
}

body.tcg-hub-page .tcg-rules-article + .tcg-rules-article {
  margin-top: 1rem;
}

body.tcg-hub-page .tcg-rules-article > h2 {
  margin: 0;
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  color: var(--text, #edf7f5);
}

body.tcg-hub-page .tcg-rules-article > .tcg-rules-intro {
  margin: .5rem 0 0;
  color: var(--muted, #9fb5b7);
  font-size: .9rem;
  line-height: 1.55;
}

body.tcg-hub-page .tcg-rules-blocks {
  display: grid;
  gap: .85rem;
  margin-top: 1rem;
}

body.tcg-hub-page .tcg-rules-block {
  padding-left: .9rem;
  border-left: 2px solid color-mix(in srgb, var(--cyan, #62e7ed) 35%, transparent);
}

body.tcg-hub-page .tcg-rules-block h3 {
  margin: 0 0 .3rem;
  font-size: .95rem;
  color: var(--cyan-soft, #a6fbf6);
}

body.tcg-hub-page .tcg-rules-block p {
  margin: 0;
  color: var(--muted, #9fb5b7);
  font-size: .95rem;
  line-height: 1.65;
}

/* ---------- Rules: glossary ---------- */

body.tcg-hub-page .tcg-glossary-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: .8rem;
  margin-top: 1rem;
}

body.tcg-hub-page .tcg-glossary-item {
  padding: .9rem 1rem;
}

body.tcg-hub-page .tcg-glossary-item dt {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
  margin: 0 0 .35rem;
  color: var(--text, #edf7f5);
  font-size: .95rem;
  font-weight: 700;
}

body.tcg-hub-page .tcg-glossary-item dt small {
  color: var(--amber, #f2b84b);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

body.tcg-hub-page .tcg-glossary-item dd {
  margin: 0;
  color: var(--muted, #9fb5b7);
  font-size: .85rem;
  line-height: 1.55;
}

/* ---------- Rules: card-by-card explorer ---------- */

body.tcg-hub-page .tcg-cardrules-results {
  display: grid;
  gap: .7rem;
  margin-top: 1rem;
}

body.tcg-hub-page .tcg-cardrules-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: .9rem;
  align-items: center;
  padding: .7rem .9rem;
}

body.tcg-hub-page .tcg-cardrules-item > img {
  width: 54px;
  height: auto;
  border: 1px solid var(--line, rgba(166, 217, 224, .2));
}

body.tcg-hub-page .tcg-cardrules-item__meta {
  display: grid;
  gap: .2rem;
  min-width: 0;
}

body.tcg-hub-page .tcg-cardrules-item__name {
  color: var(--text, #edf7f5);
  font-size: .9rem;
  font-weight: 700;
}

body.tcg-hub-page .tcg-cardrules-item__name small {
  margin-left: .4rem;
  color: var(--muted, #9fb5b7);
  font-weight: 500;
}

body.tcg-hub-page .tcg-cardrules-item__text {
  color: var(--muted, #9fb5b7);
  font-size: .82rem;
  line-height: 1.55;
}

body.tcg-hub-page .tcg-cardrules-item__text .tcg-inline-icon {
  height: 1.05em;
  vertical-align: -.18em;
}

body.tcg-hub-page .tcg-cardrules-item__empty-text {
  color: var(--muted, #9fb5b7);
  font-size: .82rem;
  font-style: italic;
}

body.tcg-hub-page .tcg-cardrules-item > a {
  color: var(--cyan, #62e7ed);
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

body.tcg-hub-page .tcg-cardrules-item > a:hover,
body.tcg-hub-page .tcg-cardrules-item > a:focus-visible {
  color: var(--cyan-soft, #a6fbf6);
}

/* ---------- Guides index / guide article ---------- */

body.tcg-hub-page .tcg-guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1rem;
}

body.tcg-hub-page .tcg-guide-card {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  transition: transform 180ms var(--ease-out, cubic-bezier(.22, 1, .36, 1)), border-color 180ms var(--ease-out, cubic-bezier(.22, 1, .36, 1));
}

body.tcg-hub-page .tcg-guide-card:hover,
body.tcg-hub-page .tcg-guide-card:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--cyan, #62e7ed) 60%, transparent);
}

body.tcg-hub-page .tcg-guide-card__eyebrow {
  margin: 0;
  flex: 0 0 auto;
  color: var(--cyan, #62e7ed);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

body.tcg-hub-page .tcg-guide-card h3 {
  margin: 0;
  color: var(--text, #edf7f5);
  font-size: 1.02rem;
  line-height: 1.35;
}

body.tcg-hub-page .tcg-guide-card__excerpt {
  margin: 0;
  flex: 1 1 auto;
  color: var(--muted, #9fb5b7);
  font-size: .86rem;
  line-height: 1.55;
}

body.tcg-hub-page .tcg-guide-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  font-size: .76rem;
}

body.tcg-hub-page .tcg-guide-card footer small {
  color: var(--muted, #9fb5b7);
  letter-spacing: .06em;
  text-transform: uppercase;
}

body.tcg-hub-page .tcg-guide-card footer span {
  color: var(--cyan, #62e7ed);
  font-weight: 600;
}

body.tcg-hub-page .tcg-guide-article {
  max-width: 72ch;
}

body.tcg-hub-page .tcg-guide-article__header {
  padding: clamp(1.2rem, 2.6vw, 1.9rem);
}

body.tcg-hub-page .tcg-guide-article__header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
  letter-spacing: -.01em;
  color: var(--text, #edf7f5);
  line-height: 1.25;
}

body.tcg-hub-page .tcg-guide-article__header p {
  margin: .6rem 0 0;
  color: var(--muted, #9fb5b7);
  font-size: .92rem;
  line-height: 1.55;
}

body.tcg-hub-page .tcg-guide-section {
  margin-top: 1rem;
  padding: clamp(1rem, 2.2vw, 1.5rem);
  scroll-margin-top: calc(var(--app-chrome-header-height, 60px) + var(--tcg-subnav-height, 46px) + 2rem);
}

body.tcg-hub-page .tcg-guide-section h2 {
  margin: 0 0 .45rem;
  font-size: 1.05rem;
  color: var(--cyan-soft, #a6fbf6);
}

body.tcg-hub-page .tcg-guide-section p {
  margin: 0;
  color: var(--muted, #9fb5b7);
  font-size: .95rem;
  line-height: 1.65;
}

/* ---------- News timeline ---------- */

body.tcg-hub-page .tcg-news-timeline {
  display: grid;
  gap: 1rem;
}

body.tcg-hub-page .tcg-news-item {
  display: grid;
  grid-template-columns: minmax(96px, auto) minmax(0, 1fr);
  gap: 1.1rem;
  padding: 1.1rem 1.2rem;
}

body.tcg-hub-page .tcg-news-item__date {
  display: grid;
  gap: .35rem;
  align-content: start;
  justify-items: start;
}

body.tcg-hub-page .tcg-news-item__date time {
  color: var(--cyan, #62e7ed);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .04em;
}

body.tcg-hub-page .tcg-news-item__body h3 {
  margin: 0 0 .4rem;
  color: var(--text, #edf7f5);
  font-size: 1.02rem;
  line-height: 1.35;
}

body.tcg-hub-page .tcg-news-item__body p {
  margin: 0;
  color: var(--muted, #9fb5b7);
  font-size: .88rem;
  line-height: 1.6;
}

/* ---------- Events ---------- */

body.tcg-hub-page .tcg-events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1rem;
}

body.tcg-hub-page .tcg-event-card {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding: 1.1rem 1.2rem;
}

body.tcg-hub-page .tcg-event-card h3 {
  margin: 0;
  color: var(--text, #edf7f5);
  font-size: 1.02rem;
  line-height: 1.35;
}

body.tcg-hub-page .tcg-event-card dl {
  display: grid;
  gap: .35rem;
  margin: 0;
  flex: 1 1 auto;
}

body.tcg-hub-page .tcg-event-card dl div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: .6rem;
  font-size: .84rem;
}

body.tcg-hub-page .tcg-event-card dt {
  color: var(--muted, #9fb5b7);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: .68rem;
  font-weight: 700;
  padding-top: .15rem;
}

body.tcg-hub-page .tcg-event-card dd {
  margin: 0;
  color: var(--text, #edf7f5);
}

body.tcg-hub-page .tcg-event-card a.tcg-event-card__link {
  color: var(--cyan, #62e7ed);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
}

body.tcg-hub-page .tcg-event-card a.tcg-event-card__link:hover,
body.tcg-hub-page .tcg-event-card a.tcg-event-card__link:focus-visible {
  color: var(--cyan-soft, #a6fbf6);
}

/* ---------- Deals ---------- */

body.tcg-hub-page .tcg-deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
}

body.tcg-hub-page .tcg-deal-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.tcg-hub-page .tcg-deal-card > img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  display: block;
  padding: .7rem;
  background: linear-gradient(180deg, rgba(6, 16, 24, .55), rgba(6, 16, 24, .8));
}

body.tcg-hub-page .tcg-deal-card__body {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1 1 auto;
  padding: 1rem 1.1rem 1.1rem;
}

body.tcg-hub-page .tcg-deal-card__body h3 {
  margin: 0;
  color: var(--text, #edf7f5);
  font-size: .98rem;
  line-height: 1.35;
}

body.tcg-hub-page .tcg-deal-card__body p {
  margin: 0;
  flex: 1 1 auto;
  color: var(--muted, #9fb5b7);
  font-size: .84rem;
  line-height: 1.55;
}

body.tcg-hub-page .tcg-deal-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  font-size: .8rem;
}

body.tcg-hub-page .tcg-deal-card__links a {
  color: var(--cyan, #62e7ed);
  font-weight: 600;
  text-decoration: none;
}

body.tcg-hub-page .tcg-deal-card__links a:hover,
body.tcg-hub-page .tcg-deal-card__links a:focus-visible {
  color: var(--cyan-soft, #a6fbf6);
}

/* ---------- Prices ---------- */

body.tcg-hub-page .tcg-prices-table-wrap {
  overflow-x: auto;
}

body.tcg-hub-page .tcg-prices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
}

body.tcg-hub-page .tcg-prices-table th,
body.tcg-hub-page .tcg-prices-table td {
  padding: .6rem .9rem;
  text-align: left;
  border-bottom: 1px solid var(--line, rgba(166, 217, 224, .2));
}

body.tcg-hub-page .tcg-prices-table th {
  color: var(--muted, #9fb5b7);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

body.tcg-hub-page .tcg-prices-table td {
  color: var(--text, #edf7f5);
}

body.tcg-hub-page .tcg-prices-table tbody td[colspan] {
  padding: 1.6rem;
  color: var(--muted, #9fb5b7);
  text-align: center;
}

/* ---------- Developers ---------- */

body.tcg-hub-page .tcg-dev-grid {
  display: grid;
  gap: 1rem;
}

body.tcg-hub-page .tcg-dev-doc {
  padding: clamp(1rem, 2.2vw, 1.5rem);
  overflow-x: auto;
}

body.tcg-hub-page .tcg-dev-doc h3 {
  margin: 0 0 .5rem;
  color: var(--text, #edf7f5);
  font-size: 1.02rem;
}

body.tcg-hub-page .tcg-dev-doc p {
  margin: 0 0 .7rem;
  color: var(--muted, #9fb5b7);
  font-size: .88rem;
  line-height: 1.6;
}

body.tcg-hub-page .tcg-dev-doc p:last-child {
  margin-bottom: 0;
}

body.tcg-hub-page .tcg-dev-doc code {
  padding: .1rem .35rem;
  color: var(--cyan-soft, #a6fbf6);
  background: rgba(98, 231, 237, .08);
  border: 1px solid color-mix(in srgb, var(--cyan, #62e7ed) 25%, transparent);
  font-size: .8em;
}

body.tcg-hub-page .tcg-dev-doc pre {
  margin: .6rem 0 0;
  padding: .8rem 1rem;
  overflow-x: auto;
  color: var(--text, #edf7f5);
  background: var(--ink, #061018);
  border: 1px solid var(--line, rgba(166, 217, 224, .2));
  font-size: .8rem;
  line-height: 1.55;
}

body.tcg-hub-page .tcg-dev-doc table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: .82rem;
}

body.tcg-hub-page .tcg-dev-doc th,
body.tcg-hub-page .tcg-dev-doc td {
  padding: .45rem .7rem;
  text-align: left;
  border-bottom: 1px solid var(--line, rgba(166, 217, 224, .2));
  vertical-align: top;
}

body.tcg-hub-page .tcg-dev-doc th {
  color: var(--muted, #9fb5b7);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

body.tcg-hub-page .tcg-dev-doc td {
  color: var(--text, #edf7f5);
}

body.tcg-hub-page .tcg-dev-doc td:first-child {
  color: var(--cyan-soft, #a6fbf6);
  font-family: ui-monospace, monospace;
  white-space: nowrap;
}

body.tcg-hub-page .tcg-dev-doc a {
  color: var(--cyan, #62e7ed);
}

body.tcg-hub-page .tcg-dev-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .7rem;
}

/* ---------- Page states (loading / error) ---------- */

body.tcg-hub-page .tcg-content-state {
  margin-top: clamp(1.4rem, 3vw, 2.2rem);
  color: var(--muted, #9fb5b7);
  font-size: .95rem;
}

body.tcg-hub-page .tcg-content-state--error {
  padding: 1.2rem 1.4rem;
  color: var(--danger, #ff827c);
}

body.tcg-hub-page .tcg-content-state--error a {
  display: inline-block;
  margin-left: .8rem;
  color: var(--cyan, #62e7ed);
  font-weight: 600;
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  body.tcg-hub-page .tcg-rules-layout {
    grid-template-columns: 1fr;
  }

  body.tcg-hub-page .tcg-rules-index {
    position: static;
  }

  body.tcg-hub-page .tcg-rules-index h2 {
    display: none;
  }

  body.tcg-hub-page .tcg-rules-index__collapsible summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    cursor: pointer;
    color: var(--muted, #9fb5b7);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    list-style: none;
  }

  body.tcg-hub-page .tcg-rules-index__collapsible summary::-webkit-details-marker {
    display: none;
  }

  body.tcg-hub-page .tcg-rules-index__collapsible summary::after {
    content: "";
    flex: 0 0 auto;
    width: .5rem;
    height: .5rem;
    border-right: 2px solid var(--cyan, #62e7ed);
    border-bottom: 2px solid var(--cyan, #62e7ed);
    transform: rotate(45deg);
    transition: transform 160ms var(--ease-out, cubic-bezier(.22, 1, .36, 1));
  }

  body.tcg-hub-page .tcg-rules-index__collapsible[open] summary {
    margin-bottom: .6rem;
  }

  body.tcg-hub-page .tcg-rules-index__collapsible[open] summary::after {
    transform: rotate(225deg);
  }

  body.tcg-hub-page .tcg-rules-index ol {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .1rem .6rem;
  }
}

@media (max-width: 640px) {
  body.tcg-hub-page .tcg-cardrules-item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  body.tcg-hub-page .tcg-cardrules-item > a {
    grid-column: 2;
    justify-self: start;
  }

  body.tcg-hub-page .tcg-news-item {
    grid-template-columns: 1fr;
    gap: .5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.tcg-hub-page .tcg-guide-card,
  body.tcg-hub-page .tcg-rules-index a,
  body.tcg-hub-page .tcg-rules-index__collapsible summary::after {
    transition: none;
  }
}
