/* ============================================================================
   "See HackerRank in action" — landing page
   ----------------------------------------------------------------------------
   Layout follows the Figma proposal (node 71-2735). All colour, radius, shadow,
   type and font VALUES are sourced from the hr-design (HRDS) design tokens
   vendored in styles/hrds/tokens.css + theme.css — this stylesheet only
   references --* tokens, never raw hex.

   The demo form renders inline on the light page (no card surface); fields use
   the default light HRDS tokens.
   ============================================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  /* Soft Chakra-colours glow: three blurred blobs (cyan / mint / lavender)
     anchored at the top, exactly as the Figma frame (node 129:390) — just the
     blobs on white, no extra overlay, so the glow reads at full strength. */
  background-color: var(--background);
  background-image: url("../assets/bg-gradient.svg");
  background-repeat: no-repeat;
  background-position: center -220px;
  background-size: 105% 820px;
  color: var(--foreground);
  font-family: var(--font-ds);
  font-size: var(--hrds-text-body-lg);
  line-height: var(--hrds-text-body-lg-lh);
  letter-spacing: 0.16px;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ===================== Header / Nav ===================== */
/* Transparent + in-flow so the page's top glow bleeds through the nav with no
   seam (a translucent header bg would wash the gradient out over the header). */
.site-header {
  position: relative;
  z-index: 100;
  height: 64px;
  background: transparent;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 43px;
  gap: 24px;
}

.nav__logo {
  flex-shrink: 0;
}

.nav__logo img {
  width: 153px;
  height: 16px;
}

/* Outlined "Login" pill (top-right), per node 129:281. */
.nav__login {
  flex-shrink: 0;
  border-radius: var(--hrds-radius-sm);
}

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ds);
  font-size: var(--hrds-text-subtitle-md);
  line-height: var(--hrds-text-subtitle-md-lh);
  font-weight: 500;
  border-radius: var(--hrds-radius-xs);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn--outline {
  height: 39px;
  padding: 0 16px;
  border-color: var(--outline-border);
  color: var(--outline-foreground);
  background: transparent;
}

.btn--outline:hover {
  border-color: var(--outline-border-hover);
}

.btn--dark {
  height: 39px;
  padding: 0 16px;
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.btn--dark:hover {
  background: var(--secondary-hover);
}

.btn--submit {
  width: 100%;
  height: 46px;
  margin-top: 4px;
  font-size: var(--hrds-text-subtitle-md);
  line-height: var(--hrds-text-subtitle-md-lh);
  color: var(--primary-foreground);
  background: var(--primary);
}

.btn--submit:hover {
  background: var(--primary-hover);
}

.btn--submit:active {
  background: var(--primary-active);
}

/* ===================== Hero layout (centered) ===================== */
.hero {
  padding: 120px 24px 48px;
}

.hero__inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ---- V2 left hero column (hidden by default / in V1) ---- */
.stage__left {
  display: none;
  flex-direction: column;
  text-align: left;
}

.stage__title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 56px;
  line-height: 1.2;
  letter-spacing: -1px;
  color: var(--foreground);
}

.stage__lead {
  margin: 24px 0 0;
  max-width: 520px;
  font-size: var(--hrds-text-subtitle-lg);
  line-height: var(--hrds-text-subtitle-lg-lh);
  color: var(--foreground);
}

/* ===================== Selector + inline form ===================== */
.form-card {
  position: relative;
  width: 100%;
  max-width: 608px;
  color: var(--foreground);
}

/* ---- Step 1: product selector cards ---- */
.product-select {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.product-select__legend {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: 12px;
  text-align: center;
  font-family: var(--font-heading);
  font-size: var(--hrds-text-display-md);
  line-height: var(--hrds-text-display-md-lh);
  font-weight: 400;
  color: var(--foreground);
}

.product-select__subline {
  width: 100%;
  max-width: 520px;
  margin: 0 auto 32px;
  text-align: center;
  font-size: var(--hrds-text-subtitle-lg);
  line-height: var(--hrds-text-subtitle-lg-lh);
  color: var(--muted-foreground);
}

/* Tabs separate the hiring and developer journeys at every breakpoint. */
.product-select__groups {
  display: block;
}

.hiring-selector {
  min-width: 0;
}

.product-group--main {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.product-group[hidden] {
  display: none;
}

.product-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  margin-bottom: 16px;
  padding: 4px;
  background: var(--tab-container);
  border: 0;
  border-radius: var(--radius);
  isolation: isolate;
}

.product-tabs__indicator {
  position: absolute;
  z-index: 0;
  top: 4px;
  left: 4px;
  width: calc((100% - 8px) / 2);
  height: 32px;
  background: var(--tab-selected);
  border-radius: var(--hrds-radius-sm);
  box-shadow: var(--card-shadow);
  pointer-events: none;
  transition: transform 200ms ease-in-out;
}

.product-tabs[data-active-tab="developers"] .product-tabs__indicator {
  transform: translateX(100%);
}

.product-tabs__tab {
  position: relative;
  z-index: 1;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  font-family: var(--font-ds);
  font-size: 13px;
  line-height: 13px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted-foreground);
  background: transparent;
  border: 0;
  border-radius: var(--hrds-radius-sm);
  cursor: pointer;
  transition: color 150ms ease;
}

.product-tabs__tab:hover,
.product-tabs__tab.is-active {
  color: var(--foreground);
}

.product-tabs__tab:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--ring) 50%, transparent);
  outline-offset: 1px;
}

.product-card {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  column-gap: 12px;
  row-gap: 4px;
  padding: 14px;
  min-height: 100px;
  /* Frosted glass: translucent fill + blur lets the page glow show through,
     with a subtle border and inner highlight for the glassy sheen. */
  background: color-mix(in srgb, var(--background) 55%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-alpha);
  border-radius: var(--hrds-radius-lg);
  box-shadow: 0 1px 2px rgba(20, 20, 25, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.product-card__heading {
  display: contents;
}

.product-card:hover {
  border-color: var(--border-heavy-alpha);
  background: color-mix(in srgb, var(--background) 68%, transparent);
}

/* radio kept in the DOM (focusable) but visually hidden */
.product-card__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* selected state — solid white card with a 2px lime border (node 129:299) */
.product-card:has(.product-card__input:checked) {
  background: var(--background);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

/* selected card: description reads at full contrast (node 129:308) */
.product-card:has(.product-card__input:checked) .product-card__desc {
  color: var(--foreground);
}

/* keyboard focus ring */
.product-card:has(.product-card__input:focus-visible) {
  box-shadow: 0 0 0 2px var(--ring);
}

.product-card__media {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
  height: 30px;
  width: 30px;
}

.product-card__media img {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.product-card__label {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  min-width: 0;
  font-family: var(--font-heading); /* serif (Kalice) title, per node 129:281 */
  font-size: var(--hrds-text-title-md);
  line-height: 1.2;
  font-weight: 400;
  color: var(--foreground);
}

/* Description always visible, always two lines (forced via <br>) so every card
   is exactly the same height. */
.product-card__desc {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  width: 100%;
  height: calc(var(--hrds-text-body-sm-lh) * 2);
  overflow: hidden;
  font-size: var(--hrds-text-body-sm);
  line-height: var(--hrds-text-body-sm-lh);
  color: var(--muted-foreground);
  text-align: left;
}

/* ---- Step 2: the form (revealed after a product is chosen) ---- */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* `hidden` must beat `.form { display:flex }` */
.form[hidden] {
  display: none;
}

.form.is-visible {
  opacity: 1;
  transform: none;
}


/* ===================== Fields ===================== */
.field,
.field__col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field--split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field__label {
  font-size: var(--hrds-text-subtitle-sm);
  line-height: var(--hrds-text-subtitle-sm-lh);
  font-weight: 500;
  color: var(--foreground);
}

.field__input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-family: var(--font-ds);
  font-size: var(--hrds-text-body-md);
  line-height: var(--hrds-text-body-md-lh);
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--hrds-radius-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field__input::placeholder {
  color: var(--muted-foreground);
}

.field__input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 1px var(--ring);
}

/* ===================== Select ===================== */
.select {
  position: relative;
}

.select__control {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 12px;
  font-family: var(--font-ds);
  font-size: var(--hrds-text-body-md);
  line-height: var(--hrds-text-body-md-lh);
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--hrds-radius-xs);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Placeholder option renders muted; chosen values render solid */
.select__control:required:invalid {
  color: var(--muted-foreground);
}

.select__control option {
  color: var(--foreground);
  background: var(--popover);
}

.select__control:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 1px var(--ring);
}

/* Token-driven chevron: SVG used as a mask so its colour comes from a token */
.select__arrow {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 12px;
  height: 7px;
  transform: translateY(-50%);
  pointer-events: none;
  background-color: var(--muted-foreground);
  -webkit-mask: url("../assets/select-arrow.svg") no-repeat center / contain;
  mask: url("../assets/select-arrow.svg") no-repeat center / contain;
}

/* ===================== Consent ===================== */
.form__consent {
  margin: 0;
  font-size: var(--hrds-text-body-md);
  line-height: var(--hrds-text-body-md-lh);
  color: var(--foreground);
}

/* --success-foreground reads as a green link with proper contrast on white
   (the lime --primary is too light for text on a light surface). */
.form__consent a {
  color: var(--success-foreground);
}

.form__consent a:hover {
  text-decoration: underline;
}

/* ===================== Community panel ===================== */
/* Shown instead of the demo form when the Community card is selected. */
.community-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  margin-top: 20px;
  padding: 40px 32px;
  border-radius: var(--hrds-radius-xl);
  background: color-mix(in srgb, var(--background) 60%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-alpha);
  box-shadow: 0 1px 2px rgba(20, 20, 25, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.community-panel[hidden] {
  display: none;
}

.community-panel.is-visible {
  opacity: 1;
  transform: none;
}

.community-panel__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: var(--hrds-radius-lg);
  background: var(--info-alt);
}

.community-panel__logo img {
  width: 44px;
  height: 44px;
}

.community-panel__title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: var(--hrds-text-title-lg);
  line-height: var(--hrds-text-title-lg-lh);
  color: var(--foreground);
}

.community-panel__text {
  margin: 0;
  max-width: 400px;
  font-size: var(--hrds-text-subtitle-lg);
  line-height: var(--hrds-text-subtitle-lg-lh);
  color: var(--muted-foreground);
}

.community-panel__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-top: 8px;
}

.btn--community {
  width: 100%;
  max-width: 320px;
  height: 48px;
  font-size: var(--hrds-text-subtitle-lg);
  line-height: var(--hrds-text-subtitle-lg-lh);
  color: var(--base-light);
  background: var(--info);
}

.btn--community:hover {
  background: var(--info-foreground);
}

.community-panel__link {
  font-size: var(--hrds-text-subtitle-md);
  line-height: var(--hrds-text-subtitle-md-lh);
  font-weight: 500;
  color: var(--info-foreground);
  transition: opacity 0.15s ease;
}

.community-panel__link:hover {
  opacity: 0.7;
}

/* ===================== Layout variations (V1 / V2) ===================== */

/* V2: two columns (shares the same top glow as V1). The whole view is pinned to
   the viewport height — only the right-hand column scrolls, the left hero stays
   fixed. (64px = header height.) */
body.is-v2 {
  overflow: hidden;
}

.is-v2 .hero {
  height: calc(100vh - 64px);
  padding: 0 43px;
  overflow: hidden;
}

.is-v2 .hero__inner {
  height: 100%;
  max-width: 1240px;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  column-gap: 64px;
  align-items: stretch;
  text-align: left;
}

/* Left hero: fixed, does not scroll. Heading is bottom-anchored, with clean
   padding below it so it doesn't sit flush against the bottom of the page. */
.is-v2 .stage__left {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 72px 0 80px;
  transform: translateX(-24px);
}

/* Right column: the only scrollable region. */
.is-v2 .form-card {
  max-width: none;
  height: 100%;
  overflow-y: auto;
  padding: 24px 12px 40px 0;
  scrollbar-width: thin;
}

/* In V2 the product question becomes a small left-aligned label above the
   cards (the left column carries the display heading instead). */
.is-v2 .product-select__legend {
  margin-bottom: 12px;
  text-align: left;
  font-family: var(--font-ds);
  font-size: var(--hrds-text-subtitle-md);
  line-height: var(--hrds-text-subtitle-md-lh);
  font-weight: 500;
}

.is-v2 .product-select__subline {
  display: none;
}

/* In V2 the category panels carry their own peer group headings. */
.is-v2 .product-select__legend {
  display: none;
}

/* ===================== Responsive ===================== */
/* Collapse V2 to a single stacked column on narrower screens, and restore
   normal page scrolling (drop the fixed-viewport split-scroll). */
@media (max-width: 900px) {
  body.is-v2 {
    overflow: auto;
  }

  .is-v2 .hero {
    height: auto;
    overflow: visible;
  }

  .is-v2 .hero__inner {
    height: auto;
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 48px;
    max-width: 608px;
  }

  .is-v2 .stage__left {
    min-width: 0;
    justify-content: flex-start;
    padding: 0;
    transform: none;
  }

  .is-v2 .form-card {
    min-width: 0;
    height: auto;
    overflow: visible;
    padding: 0;
  }

  .btn--submit {
    position: static;
    box-shadow: none;
  }
}

@media (max-width: 768px) {
  .nav {
    padding-inline: 24px;
  }

  .hero,
  .is-v2 .hero {
    padding: 64px 24px 24px;
  }

  .product-select__legend,
  .stage__title {
    font-size: 40px;
  }

  .is-v2 .product-select__legend {
    font-size: var(--hrds-text-subtitle-md);
  }
}

@media (max-width: 560px) {
  .nav {
    gap: 24px;
  }

  .product-group--main {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .product-group--main::-webkit-scrollbar {
    display: none;
  }

  .product-group--main .product-card {
    flex: 0 0 168px;
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: 8px;
    min-height: 100px;
    padding: 10px;
    scroll-snap-align: start;
  }

  .product-group--main .product-card__media,
  .product-group--main .product-card__media img {
    width: 36px;
    height: 36px;
  }

  .product-card {
    width: 100%;
  }

  .field--split {
    grid-template-columns: 1fr;
  }
}

/* ===================== Motion preferences ===================== */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
