/**
 * template-dash.css — section-based dashboard layout primitives.
 *
 * Loaded by every category dashboard page (406, 569, 570, 578, 588, 589,
 * 590, 613, 614, 615, 409), the front page, template-about.php, and
 * template-reports.php. Self-contained: these pages load only this
 * stylesheet (plus the global style.css) for shared dashboard primitives.
 *
 * Historical note: this file started as a pilot for category-578, then
 * absorbed the primitives that used to live in dashboard.css as each page
 * was migrated off the legacy stylesheet.
 *
 * @package ABTdomain
 */

/* ==========================================================================
   Page shell
   ========================================================================== */

.dash {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Section primitive
   ==========================================================================
   Every top-level block on a dashboard page is a <section class="dash-section">.
   Dividers between adjacent sections are drawn automatically — no <hr> tags.
   Rhythm: each section has uniform top and bottom padding; the first has
   less top padding so the page starts flush.
*/

.dash-section {
  padding-top: 64px;
  padding-bottom: 13px;
  text-align: center;
}

.dash-section:first-child {
  padding-top: 24px;
}

.dash-section + .dash-section {
  border-top: 1px solid var(--rule);
}

/* ---- Section title system ----
   One size per level, applied to any heading inside a section — not just
   direct children — so template parts (articles, etc.) inherit the same
   rhythm without needing their own styles. */

.dash-section h1 {
  font-size: var(--fs-28);
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 12px;
  text-align: center;
}

.dash-section h2 {
  font-size: var(--fs-22);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
  text-align: center;
}

.dash-section h3 {
  font-size: var(--fs-16);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 6px;
}

/* ---- Section lead paragraph ----
   First paragraph after a heading is the section intro: narrow column,
   centered, muted. Deeper paragraphs (inside cards/grids) are not touched. */

.dash-section > p {
  max-width: 640px;
  margin: 0 auto 24px;
  font-size: var(--fs-13);
  line-height: 1.7;
  color: var(--ink-soft);
}

.dash-section .dash-heading-accent {
  color: var(--signal);
}

/* ==========================================================================
   Stats cards row (3/4/5 columns)
   ========================================================================== */

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 2px solid var(--ink);
  padding: 28px 0;
  margin-bottom: 40px;
}

.stats-row-4 {
  grid-template-columns: repeat(4, 1fr);
}

.stats-row-5 {
  grid-template-columns: repeat(5, 1fr);
}

.stats-row-5 .stat-card {
  padding: 0 12px;
}

.stats-row-5 .stat-card-value {
  font-size: var(--fs-22);
}

.stat-card {
  text-align: center;
  padding: 0 16px;
  border-right: 1px solid var(--rule);
}

.stat-card:last-child {
  border-right: none;
}

.stat-card-label {
  font-size: var(--fs-9);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-value {
  font-family: var(--mono);
  font-size: var(--fs-28);
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-card-signal .stat-card-value {
  color: var(--signal);
}

.stat-card-blue .stat-card-value {
  color: var(--accent-blue);
}

@media (max-width: 768px) {
  .stats-row,
  .stats-row-4,
  .stats-row-5 {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 0;
  }

  .stat-card:nth-child(2n) {
    border-right: none;
  }

  .stat-card-value {
    font-size: var(--fs-22);
  }
}

@media (max-width: 480px) {
  .stats-row,
  .stats-row-4,
  .stats-row-5 {
    grid-template-columns: 1fr;
    gap: 16px 0;
  }

  .stat-card {
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 16px;
  }

  .stat-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
}

/* ==========================================================================
   Data block note (caption under stats / charts)
   ========================================================================== */

.data-block-note {
  font-size: var(--fs-11);
  color: var(--muted);
  margin-top: 8px;
}

/* ==========================================================================
   Chart container
   ========================================================================== */

.chart-wrap {
  padding: 24px 0;
  position: relative;
  min-height: 200px;
  margin-bottom: 32px;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  z-index: 2;
}

.chart-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--rule);
  border-top-color: var(--signal);
  border-radius: var(--radius-full);
  animation: dash-spin 0.8s linear infinite;
}

@keyframes dash-spin {
  to { transform: rotate(360deg); }
}

.chart-canvas {
  display: none;
}

/* ==========================================================================
   TLD selector (radio buttons as pills)
   ========================================================================== */

.tld-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 20px;
  /* fieldset reset: when used as a <fieldset> wrapper for a11y */
  border: 0;
  padding: 0;
  min-width: 0;
}

.tld-selector > legend {
  padding: 0;
}

.tld-selector label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s;
}

.tld-selector label:hover {
  border-color: var(--ink);
}

.tld-selector input[type="radio"] {
  display: none;
}

.tld-selector input[type="radio"]:checked + label,
.tld-selector label.is-active {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}

/* ==========================================================================
   Feature grid (JS-populated metric cards, filled by expired.js)
   ========================================================================== */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 0;
  border-top: 2px solid var(--ink);
  padding: 28px 0;
  margin-bottom: 40px;
}

.feature-card {
  padding: 0 16px;
  border-right: 1px solid var(--rule);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}

.feature-card dt,
.feature-card dd {
  margin: 0;
}

.feature-card:last-child {
  border-right: none;
}

.feature-label {
  order: 1;
  font-size: var(--fs-11);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.feature-value {
  order: 2;
  font-family: var(--mono);
  font-size: var(--fs-22);
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  margin-bottom: 4px;
}

/* Variant: when the value is a long string (e.g. a domain name) rather than
   a number, allow breaking and drop the font size so it fits the card. */
.feature-value-break {
  font-size: var(--fs-15);
  word-break: break-all;
}

.feature-sublabel {
  order: 3;
  font-size: var(--fs-11);
  color: var(--muted);
}

.feature-detail {
  order: 4;
  font-size: var(--fs-11);
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 24px;
  }
  .feature-card {
    border-right: none;
  }
  .feature-card:nth-child(odd) {
    border-right: 1px solid var(--rule);
  }
}

@media (max-width: 480px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .feature-card {
    border-right: none;
  }
}

/* ==========================================================================
   CTA (dashboard in-page)
   ========================================================================== */

.dash-cta {
  text-align: center;
  margin: 24px 0 0;
}

.dash-cta-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* ==========================================================================
   Intelligence callout: narrative context block inside a section
   ========================================================================== */

.intelligence-callout {
  max-width: 640px;
  margin: 0 auto 24px;
  padding: 16px 20px;
  background: var(--paper-deep);
  border-left: 3px solid var(--signal);
  border-radius: var(--radius-sm);
  text-align: left;
  font-size: var(--fs-13);
  line-height: 1.7;
  color: var(--ink-soft);
}

/* ==========================================================================
   FAQ (accordion, no icons — whole row is clickable)
   ==========================================================================
   The question is a native <button> so it is keyboard-focusable and exposes
   aria-expanded state to screen readers. No toggle symbol is drawn: hover,
   focus and the open/closed state itself are the interaction affordance.
*/

.faq-section {
  border-top: 1px solid var(--rule);
  text-align: left;
}

.faq-item + .faq-item {
  border-top: 1px solid var(--rule);
}

.faq-question {
  display: block;
  width: 100%;
  padding: 20px 24px;
  margin: 0;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--sans);
  font-size: var(--fs-15);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}

.faq-question:hover {
  color: var(--signal);
  background: var(--paper-deep);
}

.faq-question:focus {
  outline: none;
}

.faq-question:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: -2px;
}

.faq-item.is-open .faq-question {
  color: var(--signal);
}

.faq-answer {
  display: none;
  padding: 0 24px 20px;
  font-size: var(--fs-13);
  color: var(--ink-soft);
  line-height: 1.7;
}

.faq-item.is-open .faq-answer {
  display: block;
}

/* ==========================================================================
   Empty state (inside any section block)
   ========================================================================== */

.dash-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

/* ==========================================================================
   Data table (ranking / listing)
   ==========================================================================
   Used by category-406 (TLD rankings) and any future section that needs a
   compact ordered table. Wrap in .dash-table-wrap so the table is horizontally
   scrollable on narrow viewports without forcing the whole section to scroll.
*/

.dash-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 32px;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-13);
}

.dash-table thead tr {
  border-bottom: 2px solid var(--ink);
}

.dash-table th {
  padding: 14px 20px;
  text-align: center;
  font-size: var(--fs-9);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--sans);
  white-space: nowrap;
}

.dash-table td {
  padding: 12px 20px;
  text-align: center;
  font-family: var(--mono);
  font-size: var(--fs-13);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.dash-table tbody tr {
  border-bottom: 1px solid var(--rule);
}

.dash-table tbody tr:last-child {
  border-bottom: none;
}

.dash-table tbody tr:first-child {
  background: var(--paper-deep);
}

.dash-table .rank-col {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--muted);
  width: 48px;
}

.dash-table .tld-col {
  font-family: var(--sans);
  font-weight: 700;
}

.dash-table .signal-col {
  color: var(--signal);
}

/* ==========================================================================
   Data block (large number hero inside a section)
   ==========================================================================
   Used as the "headline metric" display on category dashboards: one big
   number with a label above and an optional note below. Sits inside a
   dash-section, bordered at the bottom to separate it from the content
   that follows.
*/

.data-block {
  text-align: center;
  padding: 32px 24px;
  margin-bottom: 32px;
}

.data-block-value {
  font-family: var(--mono);
  /* Display-only literal: dashboard big number (intentional exception). */
  font-size: 56px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 8px;
}

.data-block-label {
  font-size: var(--fs-11);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 768px) {
  .data-block-value {
    font-size: var(--fs-34);
  }
}

/* ==========================================================================
   Chart legend (horizontal list below a chart)
   ==========================================================================
   .chart-legend is the container. .legend-item is each row (one per series),
   which holds a .legend-color swatch and a label span.
*/

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-13);
  color: var(--ink-soft);
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* Round dot variant used by some chart legends */
.legend-color-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  display: inline-block;
}

/* ==========================================================================
   Feature grid: 4-column variant
   ==========================================================================
   Base .feature-grid is defined earlier in this file (auto-fit).
   The 4-column variant forces a fixed 4-up layout used by dashboards that
   show exactly 4 feature cards (e.g. NRD popular TLDs, active domain splits).
*/

.feature-grid-4col {
  grid-template-columns: repeat(4, 1fr);
  row-gap: 28px;
}

.feature-grid-4col .feature-card:nth-child(4n) {
  border-right: none;
}

@media (max-width: 768px) {
  .feature-grid-4col {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 24px;
  }
  .feature-grid-4col .feature-card:nth-child(4n) {
    border-right: none;
  }
}

@media (max-width: 480px) {
  .feature-grid-4col {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Trend classification legend (e.g. NRD Growth Classifications)
   ==========================================================================
   Small muted paragraph below a trend chart, explaining the color/emoji
   classification scheme. Narrow column, centered. Currently used by
   category-569; kept here so any future page with a similar legend can
   reuse it without adding another stylesheet.
*/

.trend-explanation {
  max-width: 640px;
  margin: 0 auto 24px;
  font-size: var(--fs-11);
  color: var(--muted);
  line-height: 1.6;
}

/* ==========================================================================
   Narrow chart wrapper
   ==========================================================================
   Caps width of a pie/doughnut chart so it doesn't span full section width.
   Currently used by category-570 Top-5 gTLDs distribution.
*/

.chart-narrow {
  max-width: 480px;
  margin: 0 auto;
}

/* ==========================================================================
   About page: left-aligned prose block
   ==========================================================================
   Narrow column, left-aligned (overrides .dash-section default center) for
   multi-paragraph prose that reads better flush-left than centered.
   Currently used only by template-about.php.
*/

.about-body {
  max-width: 640px;
  margin: 0 auto 24px;
  font-size: var(--fs-13);
  line-height: 1.7;
  color: var(--ink-soft);
  text-align: left;
}

.about-body p + p {
  margin-top: 1em;
}

/* ==========================================================================
   Domain Monitor: change item row + scrolling list
   ==========================================================================
   Used by category-613 Domain Monitor overview and its children (614 short,
   615 keyword). Renders a scrolling list of recent domain state changes.
   Each .change-item is a single row with the domain name on the left and a
   colored change-type chip + before/after values on the right.
*/

.changes-scroll-wrapper {
  height: 300px;
  overflow: hidden;
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.changes-scroll-wrapper-short {
  height: 180px;
}

.changes-list {
  animation: dash-scroll-up 80s linear infinite;
  padding: 12px;
  margin: 0;
  list-style: none;
}

.changes-list:hover {
  animation-play-state: paused;
}

@keyframes dash-scroll-up {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

.change-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  margin-bottom: 8px;
  font-size: var(--fs-13);
  border-bottom: 1px solid var(--rule);
}

.change-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  flex-shrink: 0;
}

.change-domain {
  font-family: var(--mono);
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--ink);
}

.change-details {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-11);
  color: var(--muted);
  flex-wrap: wrap;
}

.change-type {
  display: inline-block;
  padding: 3px 10px;
  background: var(--paper-deep);
  border-radius: var(--radius-lg);
  font-size: var(--fs-11);
  font-weight: 500;
  white-space: nowrap;
}

/* Change-type color variants, mapped to the shared status token system
   defined in style.css. Each variant pairs a soft background with a strong
   foreground color. Do not edit the hex values here — change the tokens. */
.change-type.nameserver { background: var(--status-info-bg);    color: var(--status-info-fg); }
.change-type.transfer   { background: var(--status-warning-bg); color: var(--status-warning-fg); }
.change-type.expired    { background: var(--status-danger-bg);  color: var(--status-danger-fg); }
.change-type.backorder  { background: var(--status-purple-bg);  color: var(--status-purple-fg); }
.change-type.status     { background: var(--status-indigo-bg);  color: var(--status-indigo-fg); }

.change-arrow {
  color: var(--muted);
  font-size: var(--fs-11);
  margin: 0 4px;
}

.old-value {
  color: var(--signal);
  font-weight: 500;
  font-size: var(--fs-11);
}

.new-value {
  color: var(--status-success-fg);
  font-weight: 500;
  font-size: var(--fs-11);
}

.accent-text {
  color: var(--muted);
  font-size: var(--fs-11);
}

.danger-text {
  color: var(--signal);
  font-weight: 500;
  font-size: var(--fs-11);
}

.sale-badge {
  display: inline-block;
  padding: 2px 6px;
  background: var(--status-gold-bg);
  color: var(--status-gold-fg);
  border-radius: var(--radius-lg);
  font-size: var(--fs-9);
  font-weight: 600;
  text-transform: uppercase;
}

.monitor-summary-text {
  color: var(--ink-soft);
  font-size: var(--fs-13);
  margin-bottom: 16px;
  text-align: center;
}

.monitor-empty-note {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

/* Generic utility: fully hide an element while keeping it in the DOM
   (used for JS-compatibility containers the monitor JS writes into). */
.is-hidden {
  display: none;
}

@media (max-width: 768px) {
  .change-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .change-header {
    min-width: auto;
  }
}

/* ==========================================================================
   Insight cards (JS-populated trend summary below a chart)
   ==========================================================================
   Used by category-613 Domain Monitor for the 30-day trend summary row
   (Daily Average / Peak Activity / Current Trend). A compact alternative
   to .feature-grid cards.
*/

.trend-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 240px));
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 32px;
}

.insight-card {
  background: var(--paper-deep);
  border-radius: var(--radius-md);
  padding: 16px;
}

.insight-label {
  font-size: var(--fs-11);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.insight-value {
  font-family: var(--mono);
  font-size: var(--fs-18);
  font-weight: 700;
  color: var(--ink);
}

@media (max-width: 480px) {
  .trend-summary {
    grid-template-columns: 1fr;
  }
}

