/* Scoped visual refinements; original content, control state and application
   behaviour are preserved in each source page. */

/* Hall of Hacks: the archive's inputs and record hierarchy. */
html[data-page="hack-wallet"] body .hw-workbench {
  background: var(--pd-ui-surface);
  border-color: var(--pd-ui-line);
  border-radius: var(--pd-ui-radius-card);
  padding: 20px;
  box-shadow: 0 14px 32px -26px #030b10;
}
html[data-page="hack-wallet"] body .hw-workbench :is(input, select, button) {
  min-height: 48px;
  border-color: var(--pd-ui-control-line);
  border-radius: var(--pd-ui-radius-control);
  background: var(--pd-ui-bg);
  color: var(--pd-ui-text);
  font-weight: 500;
}
html[data-page="hack-wallet"] body .hw-workbench label > span {
  color: var(--pd-ui-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .025em;
}
html[data-page="hack-wallet"] body .hw-period-controls button.active {
  border-color: rgba(62, 230, 181, .4);
  background: rgba(62, 230, 181, .08);
  color: var(--pd-ui-action);
}
html[data-page="hack-wallet"] body .hw-ledger .hw-incident {
  background: var(--pd-ui-surface) !important;
  border-bottom-color: var(--pd-ui-line);
  padding: 26px 24px;
}
html[data-page="hack-wallet"] body .hw-incident__identity h3 {
  font: 600 19px/1.35 var(--pd-ui-display);
  letter-spacing: -.02em;
}
html[data-page="hack-wallet"] body :is(.hw-incident__meta, .hw-incident__chains, .hw-incident__returned) {
  color: var(--pd-ui-muted);
  font-size: 13px;
  line-height: 1.65;
}
html[data-page="hack-wallet"] body .hw-incident__method .hw-incident__label {
  color: var(--pd-ui-secondary);
  font-size: 11px;
  letter-spacing: .06em;
}
html[data-page="hack-wallet"] body .hw-incident__method > p:last-child {
  color: var(--pd-ui-secondary);
  font-size: 14px;
  line-height: 1.65;
}
html[data-page="hack-wallet"] body .hw-incident__impact .hw-incident__amount {
  color: var(--pd-ui-text);
  font: 500 17px/1.4 var(--pd-ui-mono);
  font-variant-numeric: tabular-nums;
}
html[data-page="hack-wallet"] body .hw-ledger-head {
  padding-inline: 24px;
  color: var(--pd-ui-muted);
  border-color: var(--pd-ui-line);
  font-size: 11px;
}
html[data-page="hack-wallet"] body .hw-results-status {
  color: var(--pd-ui-secondary);
}
html[data-page="hack-wallet"] body :is(.hw-workbench, .hw-period-controls) :focus-visible {
  outline: 2px solid var(--pd-ui-action);
  outline-offset: 3px;
}

/* Analytics: consistent status surfaces and readable report controls. */
html[data-page="analytics"] body .hero-badge {
  color: var(--pd-ui-action);
}
html[data-page="analytics"] body .pd-period-picker > a.active {
  color: var(--pd-ui-action);
  border-color: rgba(62, 230, 181, .35);
  background: rgba(62, 230, 181, .07);
  box-shadow: none;
}
html[data-page="analytics"] body :is(.analytics-month, .analytics-method) {
  border-color: var(--pd-ui-line);
}
html[data-page="analytics"] body .analytics-month {
  background: var(--pd-ui-surface);
}
html[data-page="analytics"] body .analytics-month-value small {
  color: var(--pd-ui-secondary);
  font-size: 12px;
  line-height: 1.6;
}
html[data-page="analytics"] body .analytics-month-toggle {
  width: 34px;
  height: 34px;
  color: var(--pd-ui-action);
  border-color: var(--pd-ui-control-line);
}
html[data-page="analytics"] body .analytics-month[open] {
  border-color: rgba(62, 230, 181, .42);
}
html[data-page="analytics"] body .analytics-month-body {
  background: var(--pd-ui-bg);
}
html[data-page="analytics"] body .analytics-month .btn-link {
  color: var(--pd-ui-action);
  border-color: var(--pd-ui-control-line);
  background: var(--pd-ui-surface);
}
html[data-page="analytics"] body #pd-period {
  min-height: 48px;
  border-color: var(--pd-ui-control-line);
  border-radius: var(--pd-ui-radius-control);
  color: var(--pd-ui-text);
  background: var(--pd-ui-surface);
  font-size: 15px;
}
html[data-page="analytics"] body .rank-table {
  font-variant-numeric: tabular-nums;
}
html[data-page="analytics"] body .rank-table :is(th, td) {
  padding-block: 14px;
  border-color: var(--pd-ui-line);
}
html[data-page="analytics"] body .rank-table th {
  color: var(--pd-ui-muted);
  font-weight: 500;
}

/* Domain-age methodology: retain the two original blocks in reading order. */
body.daf-page .daf-hero {
  background: var(--pd-ui-bg);
}
body.daf-page .daf-hero .daf-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .42fr);
  align-items: center;
  gap: 48px;
}
body.daf-page .daf-hero .daf-hero-visual {
  width: 100%;
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 30px;
  border: 1px solid var(--pd-ui-line);
  border-radius: var(--pd-ui-radius-panel);
  background: radial-gradient(ellipse at top right, rgba(62, 230, 181, .06), transparent 72%), var(--pd-ui-surface);
  box-shadow: 0 18px 48px -34px #030b10;
}
body.daf-page .daf-hero .daf-hero-core {
  position: relative;
  inset: auto;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: start;
}
body.daf-page .daf-hero .daf-hero-core strong {
  font: 500 clamp(38px, 4vw, 54px)/1.02 var(--pd-ui-display);
  letter-spacing: -.045em;
  color: var(--pd-ui-text);
}
body.daf-page .daf-hero .daf-hero-core > span {
  color: var(--pd-ui-action);
  font-size: 10px;
  line-height: 1.7;
  letter-spacing: .08em;
}
body.daf-page .daf-hero .daf-hero-core small {
  margin-top: 18px;
  max-width: none;
  color: var(--pd-ui-secondary);
  font: 400 14px/1.75 var(--pd-ui-font);
}
body.daf-page .daf-table :is(th, td) {
  border-color: var(--pd-ui-line);
  line-height: 1.7;
}

/* Seed research: use the original DOM order with a spanning copy column. */
html[data-pd-research="seed-security-score"] body .pes-hero-grid {
  align-items: start !important;
  gap: 24px 48px !important;
  grid-template-rows: auto 1fr;
}
html[data-pd-research="seed-security-score"] body .pes-hero-copy {
  grid-row: span 2;
}
html[data-pd-research="seed-security-score"] body .pes-hero-grid > .pd-contents {
  width: 100%;
  min-width: 0;
  margin: 0 !important;
  align-self: start;
}
html[data-pd-research="seed-security-score"] body .pes-hero-console {
  align-self: start;
  margin: 0;
  border-color: var(--pd-ui-line);
  border-radius: var(--pd-ui-radius-panel);
  background: var(--pd-ui-surface);
}
html[data-pd-research="seed-security-score"] body .pes-hero-copy h1 em {
  color: var(--pd-ui-action) !important;
}
html[data-pd-research="seed-security-score"] body .pes-button--primary {
  color: var(--pd-ui-on-action) !important;
  background: var(--pd-ui-action) !important;
  border-color: var(--pd-ui-action) !important;
}
html[data-pd-research="seed-security-score"] body .pes-hero-console :is(small, .pes-console-bar, .pes-console-foot > span) {
  color: var(--pd-ui-muted);
  font-size: 12px;
  line-height: 1.7;
}
html[data-pd-research="seed-security-score"] body .pes-trace strong {
  color: var(--pd-ui-text);
  font-size: 13px;
}
html[data-pd-research="seed-security-score"] body .pes-case-presets button {
  border-color: var(--pd-ui-line);
  border-radius: var(--pd-ui-radius-control);
  background: var(--pd-ui-surface);
}
html[data-pd-research="seed-security-score"] body .pes-case-presets button.is-active {
  border-color: var(--pd-ui-action);
  background: rgba(62, 230, 181, .08);
}
html[data-pd-research="seed-security-score"] body .pes-case-presets button span {
  color: var(--pd-ui-secondary);
  line-height: 1.5;
}
html[data-pd-research="seed-security-score"] body .pes-range {
  accent-color: var(--pd-ui-action);
}
html[data-pd-research="seed-security-score"] body .pes-checker select {
  min-height: 48px;
  border-color: var(--pd-ui-control-line);
  border-radius: var(--pd-ui-radius-control);
  background: var(--pd-ui-bg);
  color: var(--pd-ui-text);
  font-size: 15px;
}
html[data-pd-research="seed-security-score"] body .pes-ledger :is(th, td) {
  padding-block: 18px;
  border-color: var(--pd-ui-line);
  line-height: 1.65;
}

/* Editorial comparison cards: less cramped prose and clearer small labels. */
html[data-review="we-are-no-longer-volunteers"] body .man-ref .tag {
  color: var(--pd-ui-secondary);
  border-color: var(--pd-ui-line);
  background: var(--pd-ui-surface);
  padding: 5px 8px;
  font: 500 11px/1.5 var(--pd-ui-mono);
  letter-spacing: .025em;
}
html[data-review="we-are-no-longer-volunteers"] body .man-ref p {
  font-size: 16px !important;
  line-height: 1.8 !important;
}

@layer pd-quality {
  html[data-page="hack-wallet"] body #hack-workbench #hack-search::placeholder {
    color: var(--pd-ui-placeholder) !important;
    opacity: 1 !important;
  }
  body.daf-page .daf-hero .daf-hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(280px, .42fr) !important;
    gap: 48px !important;
    align-items: center !important;
  }
  body.daf-page .daf-hero .pd-story-masthead {
    padding-block: 34px !important;
  }
  body.daf-page .daf-hero .pd-page-h1 {
    font-size: clamp(38px, 4.6vw, 62px) !important;
    max-width: 18ch !important;
    line-height: 1.08 !important;
  }
  html[data-page="analytics"] body .analytics-platform .stat-pill {
    text-align: start !important;
    align-items: flex-start !important;
  }
}

@media (hover: hover) and (pointer: fine) {
  html[data-page="hack-wallet"] body .hw-ledger .hw-incident:hover {
    background: var(--pd-ui-raised) !important;
  }
  html[data-page="hack-wallet"] body .hw-workbench button:hover {
    color: var(--pd-ui-action);
    border-color: var(--pd-ui-action);
  }
  html[data-pd-research="seed-security-score"] body .pes-button--primary:hover {
    background: var(--pd-ui-action-hover) !important;
    border-color: var(--pd-ui-action-hover) !important;
  }
  html[data-page="analytics"] body .analytics-month .btn-link:hover {
    color: var(--pd-ui-action-hover);
    border-color: var(--pd-ui-action);
    background: rgba(62, 230, 181, .06);
  }
}

@media (max-width: 900px) {
  body.daf-page .daf-hero .daf-hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
  body.daf-page .daf-hero .daf-hero-visual {
    padding: 26px;
  }
  @layer pd-quality {
    body.daf-page .daf-hero .daf-hero-grid {
      grid-template-columns: minmax(0, 1fr) !important;
      gap: 28px !important;
    }
    body.daf-page .daf-hero .pd-story-masthead {
      padding-block: 24px 0 !important;
    }
  }
}
@media (max-width: 767px) {
  html[data-page="hack-wallet"] body .hw-workbench {
    padding: 16px;
  }
  html[data-page="hack-wallet"] body .hw-ledger .hw-incident {
    padding: 24px 18px;
  }
  html[data-pd-research="seed-security-score"] body .pes-hero-copy {
    grid-row: auto;
  }
  html[data-pd-research="seed-security-score"] body .pes-hero-grid {
    gap: 26px !important;
    grid-template-rows: none;
  }
  html[data-page="analytics"] body .analytics-month-toggle {
    width: 30px;
    height: 30px;
  }
  html[data-pd-research="seed-security-score"] body .pes-checker select {
    font-size: 16px;
  }
}
@media (max-width: 600px) {
  body.daf-page .daf-hero .daf-hero-core {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  body.daf-page .daf-hero .daf-hero-core small {
    margin-top: 0;
  }
}
@media (max-width: 380px) {
  html[data-pd-research="seed-security-score"] body .pes-case-presets button {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    padding: 10px 8px;
  }
}
