/* Match the NAPLAN dropdown highlight across every VIPTest page. */
:root {
  --vip-interaction-accent: #cb1351; /* legibility: passes 4.5:1 as text on the pale pink/lilac/blue tints */
}

/* Compact brand accent, aligned to the upper left of the existing wordmark.
   Em units keep the approved proportions on desktop and mobile. */
.study-masthead .brand {
  position: relative;
  padding-inline-start: .55em;
}
.study-masthead .brand::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: .12em;
  width: .4em;
  height: .4em;
  background: url("./viptest-check-mark.svg") center / contain no-repeat;
  pointer-events: none;
}

/* Important declarations in this layer take priority over legacy page-specific
   important styles, including the mobile menu and the Home pill. */
@layer vip-interaction {
  /* Extend each reward card's existing link over the complete card. Native
     links preserve keyboard activation, anchor scrolling and open-in-new-tab. */
  .rw-photo-card {
    position: relative;
    cursor: pointer;
    transition: background-color 160ms ease;
  }
  .rw-photo-card a[href] { position: static; }
  .rw-photo-card a[href]::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
  }
  .rw-photo-card:is(:hover, :focus-within) {
    background: #fff2f6 !important;
  }
  @media (prefers-reduced-motion: reduce) {
    .rw-photo-card { transition: none; }
  }
  .vip-file-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
  }
  .vip-file-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    max-width: 100%;
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
    color: #202b43;
  }
  .vip-file-choose {
    flex-shrink: 0;
    padding: 6px 12px;
    border: 1px solid #202b43;
    border-radius: 999px;
    background: #fff;
    font-weight: 700;
  }
  .vip-file-picker [data-file-name-for] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  label:has(.vip-file-native:focus-visible) {
    outline: 3px solid #202b43 !important;
    outline-offset: 3px !important;
  }
  /* Keep the Selective shortcut beside the introductory copy, not stretched
     down the full assessment outline. */
  #overview.ref-intro > .compact-practice-entry {
    align-self: start !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 16px !important;
    display: flex !important;
    flex-direction: column;
    justify-content: flex-start !important;
    gap: 8px !important;
  }
  #overview.ref-intro > .compact-practice-entry > .eyebrow {
    margin: 0 !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
  }
  #overview.ref-intro > .compact-practice-entry > .thinking-exam-direct {
    margin: 0 !important;
    min-height: 32px !important;
    height: auto !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
  }
  #overview.ref-intro > .compact-practice-entry > .thinking-exam-detail {
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
  }
  /* The same card feedback follows scholarship and exam pathways everywhere. */
  .ref-course,
  .exam-start {
    box-sizing: border-box;
    border: 1px solid #dfe3ea !important;
  }
  .exam-start {
    border: 0 !important;
  }
  /* Keep the four NAPLAN subject panels distinct from product cards. */
  .np-domains > article {
    box-sizing: border-box;
    border: 3px solid #202b43 !important;
  }
  .site-home .screenshot-trial .trial-invitation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
  }
  .site-home .screenshot-trial .trial-invitation > :is(strong, p, a) {
    margin: 0 !important;
  }
  .ref-course,
  .ref-course-copy,
  .exam-start,
  .exam-card {
    transition: background-color 160ms ease, border-color 160ms ease;
  }
  .exam-start,
  .exam-card {
    cursor: pointer;
  }
  .site-home #catalog .testcard,
  .site-products #pathways .card[data-product],
  .ref-course {
    box-sizing: border-box;
    border: 1px solid #dfe3ea !important;
  }
  .ref-course:is(:hover, :focus-within),
  .exam-start:is(:hover, :focus-within),
  .exam-card:is(:hover, :focus-within) {
    background: #fff2f6 !important;
  }
  .ref-course:is(:hover, :focus-within) .ref-course-copy {
    background: #fff2f6 !important;
  }
  @media (prefers-reduced-motion: reduce) {
    .ref-course,
    .ref-course-copy,
    .exam-start,
    .exam-card {
      transition: none;
    }
  }

  /* Every writing year and planner shares these persistent field headings. */
  .vip-studio #planner-fields .planner-field-title {
    color: var(--vip-interaction-accent);
  }

  /* Keep the product picker's affordance visible even when it is closed. */
  #study-pathway {
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23202b43' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 7 5 5 5-5'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 13px center !important;
    background-size: 18px 18px !important;
    padding-inline: 12px 42px !important;
    text-align: left !important;
    cursor: pointer;
  }

  /* Clearer labels for practice, paper and other single-choice menus. */
  select:not([multiple]):not([size]),
  select:not([multiple]):not([size]) :is(option, optgroup) {
    font-size: 17px !important;
  }

  /* Keep the writing selections consistent with other dropdowns. */
  html[data-studio="writing"] :is(#year, #genre, #mode, #response) {
    color: var(--vip-dropdown-color) !important;
    font-weight: 800 !important;
  }

  /* Retain bold labels in the shared dropdown colour. */
  .thinking-home-theme #start-form select {
    color: var(--vip-dropdown-color) !important;
    font-weight: 800 !important;
    cursor: pointer;
    transition: background-color 160ms ease;
  }
  .thinking-home-theme #start-form select:is(:hover, :focus, :open) {
    background-color: #fff2f6 !important;
  }
  @media (prefers-reduced-motion: reduce) {
    .thinking-home-theme #start-form select {
      transition: none;
    }
  }

  @supports (appearance: base-select) {
    @media (hover: hover) and (pointer: fine) {
      #study-pathway { appearance: base-select !important; }
      #study-pathway::picker-icon { display: none; }
    }
  }

  /* Highlight full practice, membership, account and resource cards. */
  :is(.card, .plan-card, .sel-price, .np-price):has(a[data-membership-term]),
  .resource-grid > .resource-card,
  .site-products #pathways .card[data-product],
  .site-home #catalog .testcard,
  .site-home .mock-callout {
    cursor: pointer;
  }
  :is(.card, .plan-card, .sel-price, .np-price):has([data-membership-term]),
  .ac-balances > .ac-card,
  .ac-hover-card,
  .ac-admin-section,
  .vip-studio .method-cards > article,
  .vip-studio .import-row,
  .resource-page #scope .year-example,
  .resource-grid > .resource-card,
  .site-products #pathways .card[data-product],
  .site-home #catalog .testcard,
  .site-home .mock-callout {
    transition: background-color 160ms ease;
  }
  :is(.card, .plan-card, .sel-price, .np-price):has([data-membership-term]):is(:hover, :focus-within),
  .ac-balances > .ac-card:is(:hover, :focus-within),
  .ac-hover-card:is(:hover, :focus-within),
  .ac-admin-section:is(:hover, :focus-within),
  .vip-studio .method-cards > article:is(:hover, :focus-within),
  .vip-studio .import-row:is(:hover, :focus-within),
  .resource-page #scope .year-example:is(:hover, :focus-within),
  .resource-grid > .resource-card:is(:hover, :focus-within),
  .site-products #pathways .card[data-product]:is(:hover, :focus-within),
  .site-home #catalog .testcard:is(:hover, :focus-within),
  .site-home .mock-callout:is(:hover, :focus-within) {
    background: #fff2f6 !important;
  }
  @media (prefers-reduced-motion: reduce) {
    :is(.card, .plan-card, .sel-price, .np-price):has([data-membership-term]),
    .ac-balances > .ac-card,
    .ac-hover-card,
    .ac-admin-section,
    .vip-studio .method-cards > article,
    .vip-studio .import-row,
    .resource-page #scope .year-example,
    .resource-grid > .resource-card,
    .site-products #pathways .card[data-product],
    .site-home #catalog .testcard,
    .site-home .mock-callout {
      transition: none;
    }
  }

  /* Highlight the full membership coverage table, including its header. */
  .resource-page #scope > .plan-table,
  .resource-page #scope > .plan-table :is(th, td) {
    transition: background-color 160ms ease, color 160ms ease;
  }
  .resource-page #scope > .plan-table:is(:hover, :focus-within),
  .resource-page #scope > .plan-table:is(:hover, :focus-within) :is(th, td) {
    background: #fff2f6 !important;
    color: #202b43 !important;
  }
  @media (prefers-reduced-motion: reduce) {
    .resource-page #scope > .plan-table,
    .resource-page #scope > .plan-table :is(th, td) {
      transition: none;
    }
  }

  a[href]:not([aria-disabled="true"]):is(:hover, :focus-visible, :active),
  summary:is(:hover, :focus-visible, :active) {
    color: var(--vip-interaction-accent) !important;
    filter: none !important;
  }

  a[href]:is(:hover, :focus-visible, :active) :is(h1, h2, h3, h4, strong, b) {
    color: inherit !important;
  }

  button:not(:disabled):not([aria-disabled="true"]):is(:hover, :focus-visible, :active),
  input:is([type="button"], [type="submit"], [type="reset"]):not(:disabled):is(:hover, :focus-visible, :active),
  a[href]:is(.btn, .sel-btn, .button, .resource-button, .resource-gold-btn,
    .studio-nav-cta, .ac-button, .ac-pink, .resource-back, .rw-outline,
    .thinking-exam-direct, .study-home-link, .growth-start, .growth-cta, .icas-start, .view-plans):not([aria-disabled="true"]):is(:hover, :focus-visible, :active),
  nav[aria-label="Main navigation"] a:is([href="index.html"], [href="../index.html"],
    [href="/website/index.html"], [href="/website/"]):is(:hover, :focus-visible, :active),
  :is(.year-links, .sel-contents, .np-jump, .np-years) > a[href]:is(:hover, :focus-visible, :active) {
    background: var(--vip-interaction-accent) !important;
    border-color: var(--vip-interaction-accent) !important;
    color: #fff !important;
    filter: none !important;
  }

  /* Keep child labels legible when their filled control changes colour. */
  button:not(:disabled):is(:hover, :focus-visible, :active) :is(span, strong, b),
  a[href]:is(.btn, .sel-btn, .button, .resource-button, .resource-gold-btn,
    .studio-nav-cta, .ac-button, .ac-pink, .resource-back, .rw-outline):is(:hover, :focus-visible, :active) :is(span, strong, b),
  .np-years > a[href]:is(:hover, :focus-visible, :active) > :is(strong, span) {
    color: inherit !important;
  }

  /* The Contents panel already has a magenta background. */
  .resource-toc a[href]:is(:hover, :focus-visible, :active) {
    background: #fff !important;
    color: var(--vip-interaction-accent) !important;
  }
  .resource-toc a[href]:is(:hover, :focus-visible, :active) span {
    color: inherit !important;
  }

  :is(a[href], button, summary, input[type="button"], input[type="submit"], input[type="reset"]):focus-visible {
    outline: 3px solid var(--vip-interaction-accent) !important;
    outline-offset: 3px !important;
  }

  /* Requested CTA emphasis: red fill, bold black text and a small visual
     enlargement that does not move neighbouring content. */
  :is(#study-go, #typing-start, nav a[href$="vip-rewards.html"], .mock-callout > .btn,
    .trial-invitation > .btn, a[data-membership-term]) {
    transition: scale 160ms ease, color 160ms ease, box-shadow 160ms ease;
    transform-origin: center;
  }
  :is(#study-go, #typing-start, nav a[href$="vip-rewards.html"], .mock-callout > .btn,
    .trial-invitation > .btn, a[data-membership-term]):not(:disabled):not([aria-disabled="true"]):is(:hover, :focus-visible, :active) {
    background: var(--vip-interaction-accent) !important;
    border-color: var(--vip-interaction-accent) !important;
    color: #000 !important;
    font-weight: 800 !important;
    scale: 1.03;
    box-shadow: 0 4px 12px #202b4329 !important;
    filter: none !important;
  }
  @media (prefers-reduced-motion: reduce) {
    :is(#study-go, #typing-start, nav a[href$="vip-rewards.html"], .mock-callout > .btn,
      .trial-invitation > .btn, a[data-membership-term]) {
      transition: none !important;
      scale: none !important;
    }
  }

  /* Practice entry buttons keep white labels while gaining hover emphasis. */
  .vip-studio .ps-year-card:not(:disabled):is(:hover, :focus-visible, :active) > small {
    color: #000 !important;
    font-weight: 700 !important;
  }

  :is(#ps-start, .site-home #catalog .testcard > .btn) {
    transition: scale 160ms ease, box-shadow 160ms ease;
    transform-origin: center;
  }
  :is(#ps-start, .site-home #catalog .testcard > .btn):not(:disabled):not([aria-disabled="true"]):is(:hover, :focus-visible, :active) {
    color: #fff !important;
    font-weight: 800 !important;
    scale: 1.04;
    box-shadow: 0 4px 12px #202b4329 !important;
  }
  @media (prefers-reduced-motion: reduce) {
    :is(#ps-start, .site-home #catalog .testcard > .btn) {
      transition: none !important;
      scale: none !important;
    }
  }

  /* Highlight only the answer row under the pointer. Native labels make the
     whole row clickable; checked and locked answer states remain intact. */
  :is(label.ps-option, label.option, label.choice):has(input[type="radio"]:not(:disabled)),
  button.answer:not(:disabled):not([aria-disabled="true"]) {
    transition: background-color 160ms ease;
  }
  :is(label.ps-option, label.option, label.choice):has(input[type="radio"]:not(:disabled)):is(:hover, :focus-within),
  button.answer:not(:disabled):not([aria-disabled="true"]):is(:hover, :focus-visible, :active) {
    background: #fff2f6 !important;
    color: #202b43 !important;
  }
  :is(label.ps-option, label.option, label.choice):has(input[type="radio"]:focus-visible) {
    outline: 3px solid var(--vip-interaction-accent);
    outline-offset: 3px;
  }
  @media (prefers-reduced-motion: reduce) {
    :is(label.ps-option, label.option, label.choice), button.answer {
      transition: none !important;
    }
  }
}
