/* ================================================
   Human Benchmark - Custom Styles
================================================ */

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Hero - pure CSS gradient background, no image dependency */
.hero-bg {
  position: relative;
  background: linear-gradient(135deg, #020d06 0%, #031a0c 20%, #042b15 45%, #064e3b 75%, #065f46 100%);
}
.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
    rgba(3,20,10,0.97) 0%,
    rgba(5,35,18,0.93) 40%,
    rgba(8,50,25,0.80) 70%,
    rgba(12,65,32,0.60) 100%
  );
  pointer-events: none;
}
.hero-bg .hero-content {
  position: relative;
  z-index: 1;
}
.hero-heading {
  text-shadow: 0 2px 20px rgba(0,0,0,0.6), 0 1px 4px rgba(0,0,0,0.5);
}
.hero-sub {
  text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}

/* Smooth dropdown transition */
.nav-dropdown {
  transform: translateY(-4px);
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
}
.group:hover .nav-dropdown {
  transform: translateY(0);
}

/* Test area styles */
.test-stage {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 1.5rem;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

/* Reaction time states */
.test-stage.waiting   { background: #1e40af; }
.test-stage.ready     { background: #dc2626; }
.test-stage.go        { background: #16a34a; }
.test-stage.too-soon  { background: #ea580c; }
.test-stage.result    { background: #f8fafc; border: 2px solid #e2e8f0; }

/* Progress bar */
.reading-progress {
  position: fixed;
  top: 64px;
  left: 0;
  width: 0%;
  height: 3px;
  background: #2563eb;
  z-index: 40;
  transition: width 0.1s linear;
}

/* Leaderboard rank badges */
.rank-gold   { color: #f59e0b; }
.rank-silver { color: #9ca3af; }
.rank-bronze { color: #f97316; }

/* Scrollbar (Webkit) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Focus visible rings */
*:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Stat number animation */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stat-animate {
  animation: countUp 0.5s ease forwards;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #1e293b;
  color: white;
  padding: 0.875rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 9999;
  animation: slideInToast 0.3s ease;
}
@keyframes slideInToast {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Mobile nav - checkbox toggle, no JS required */
#hb-menu-check { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
#mobile-menu   { display: none; }
#hb-menu-check:checked ~ #mobile-menu {
  display: block;
  position: fixed;
  top: 64px; left: 0; right: 0;
  z-index: 9000;
  background: #ffffff;
  border-top: 1px solid #f3f4f6;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  overflow-y: auto;
  max-height: calc(100vh - 64px);
}

/* Playwire ad unit sizing - fixed height prevents CLS */
.pw-leaderboard-footer,
.pw-leaderboard-btf {
  min-height: 100px;
  max-height: 100px;
}
.pw-medrect-atf,
.pw-medrect-btf {
  min-height: 250px;
  max-height: 250px;
}

/* Top leaderboard - hard-limited to one creative size: 300x50 on mobile,
   728x90 on desktop. Anything larger is clipped. (Matches typingtest.now.) */
.pw-leaderboard-atf {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 300px;
  height: 50px !important;
  min-height: 50px;
  max-height: 50px !important;
  margin: 0 auto;
  overflow: hidden !important;
}
@media (min-width: 768px) {
  .pw-leaderboard-atf {
    max-width: 728px;
    height: 90px !important;
    min-height: 90px;
    max-height: 90px !important;
  }
  .pw-leaderboard-footer {
    min-height: 250px;
    max-height: 250px;
  }
}
/* Playwire's .pw-tag wrapper adds 10px margins + padding around the
   creative - zero it so the creative fits the slot exactly. */
.pw-leaderboard-atf .pw-tag { margin: 0 !important; padding: 0 !important; }
.pw-leaderboard-atf > div { max-width: 100%; }

/* No "Advertisement"/report-ad label - the slot is creative height only. */
.pw_report_ad_container,
[class*="report_ad"],
[class*="report-ad"] {
  display: none !important;
}

/* Playwire in-content placeholder ads - RAMP fills these. Height is reserved
   and hard-capped (280px desktop / 250px mobile) so fills cause no CLS and
   oversized creatives are clipped rather than pushing content. (Matches
   typingtest.now's .ad-in-content.) */
.pw-placeholder-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 728px;
  height: 280px;
  max-height: 280px;
  overflow: hidden;
  margin: 1.5rem auto;
  background: transparent;
  clear: both;
}
@media (max-width: 767px) {
  .pw-placeholder-container {
    height: 250px;
    max-height: 250px;
  }
}
.pw-placeholder-container .pw-tag { margin: 0 !important; padding: 0 !important; }
.pw-placeholder-container > div { max-width: 100%; }

/* Desktop featured-tool promos occupy the space already reserved for Playwire. The paid
   slot is absolutely layered above them and becomes interactive only after a
   creative is detected. Mobile keeps the original Playwire-only layout. */
.hb-featured-tools { display: none; }

@media (min-width: 768px) {
  .hb-promo-stack {
    position: relative;
    width: 100%;
    max-width: 728px;
    margin-left: auto;
    margin-right: auto;
  }
  .hb-promo-stack--in-content {
    height: 280px;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
  }
  .hb-promo-stack--footer { height: 250px; }
  .hb-promo-stack > .pw-placeholder-container,
  .hb-promo-stack > .pw-leaderboard-footer {
    position: absolute;
    z-index: 2;
    inset: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    pointer-events: none;
  }
  .hb-promo-stack.has-playwire-fill > .pw-placeholder-container,
  .hb-promo-stack.has-playwire-fill > .pw-leaderboard-footer {
    pointer-events: auto;
  }
  .hb-featured-tools {
    display: block;
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 0;
    width: 100%;
    height: 250px;
    transform: translateY(-50%);
  }
  .hb-featured-tool {
    position: absolute;
    inset: 0;
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 16px;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .45s ease, visibility 0s linear .45s, transform .2s ease, box-shadow .2s ease;
  }
  .hb-featured-tool.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }
  .hb-featured-tool:hover {
    transform: translateY(-2px);
  }
  .hb-featured-tool:focus-visible {
    outline: 3px solid #22c55e;
    outline-offset: 3px;
  }
  .hb-featured-tool > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .hb-promo-stack.has-playwire-fill .hb-featured-tools {
    opacity: 0;
    visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hb-featured-tool { transition: none; }
}

/* Bottom Rail clearance - RAMP anchors a sticky rail (#pw-oop-bottom_rail) to
   the viewport bottom (desktop 728x90/970x90 + label, mobile up to 320x100 +
   label), which otherwise overlaps the footer links. Reserve room below. */
.page-footer {
  padding-bottom: 120px;
}

/* Card links: only the title is the <a> (anchor text = the title, not title +
   description). Its ::after covers the card, which is position: relative, so
   the whole card stays clickable. Other links/buttons inside a card need
   position: relative; z-index: 2. */
a.stretched-link { color: inherit; text-decoration: none; }
.stretched-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.stretched-link:focus-visible { outline: none; }
.stretched-link:focus-visible::after { outline: 2px solid currentColor; outline-offset: 2px; border-radius: inherit; }
.hb-test-start-cta:focus-visible,
.hb-test-page button:focus-visible,
.hb-test-page [tabindex]:focus-visible{outline:3px solid #22c55e;outline-offset:3px}
[data-hb-test-zone]{scroll-margin-top:5.5rem}
@media (max-width:639px){
  body.hb-test-page main>section:first-child>div{padding-top:1.75rem!important;padding-bottom:1.75rem!important}
  body.hb-test-page main>section:first-child h1{font-size:2rem!important;line-height:1.12!important;margin-bottom:.75rem!important}
  body.hb-test-page main>section:first-child h1+p{font-size:1rem!important;line-height:1.55!important;margin-bottom:1rem!important}
  body.hb-test-page .hb-test-intro{margin-bottom:.5rem!important}
  body.hb-test-page main>section:first-child .grid{gap:.5rem!important}
  body.hb-test-page main>section:first-child .grid>div{padding:.65rem!important}
}
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto!important}
  .hb-test-page *, .hb-test-page *::before, .hb-test-page *::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}
