/* Povod's shared selection language. State styles never change control geometry. */
:root{
  --povod-highlight-edge:#dba18b;
  --povod-highlight-focus:#b66e56;
  --povod-highlight-invalid:#e88770;
  --povod-highlight-glow:#f47b5c25;
  --povod-highlight-shadow:inset 0 1px 0 #ffffffed,0 0 0 3px var(--povod-highlight-glow),0 5px 16px #e6684a1c;
  --povod-highlight-inset:inset 0 0 0 1px #dba18b99,inset 0 0 8px #f47b5c18;
}
body ::selection{background:#f47b5c40;color:#3a312b;}

/* Layered state overrides take priority over older !important focus rules.
   Keep the layer narrow: no resting surfaces, sizes, fonts or actions. */
@layer povod-highlights{
  body :where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):not([type=hidden]),textarea,select,.povod-glass-select-button):focus{
    outline:0!important;
    border-color:var(--povod-highlight-edge)!important;
    box-shadow:var(--povod-highlight-shadow)!important;
  }
  body :is(.studio-date-field,.date-time-row):focus-within{
    outline:0!important;
    border-color:var(--povod-highlight-edge)!important;
    box-shadow:var(--povod-highlight-shadow)!important;
  }
  body :is(.studio-date-field,.date-time-row) input:focus{
    outline:0!important;box-shadow:none!important;
  }
  body .wish-dialog .wish-label input:focus{
    outline:0!important;border-color:var(--povod-highlight-edge)!important;
    box-shadow:var(--povod-highlight-shadow)!important;
  }
  body :is(button,a,summary,[tabindex]):focus-visible{outline:0!important;}

  /* Visible keyboard navigation uses the same glow with a one-pixel contour. */
  html.keyboard-input body :where(button,a,summary,input,textarea,select,[tabindex]):focus-visible:where(:not(:disabled):not([tabindex='-1'])){
    outline:1px solid var(--povod-highlight-focus)!important;
    outline-offset:2px!important;
    box-shadow:var(--povod-highlight-shadow)!important;
  }
  /* Typing keeps the same soft field glow as touch and Tab focus.
     The field edge already marks focus; never add a second outer contour. */
  html.keyboard-input body :where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):not([type=hidden]),textarea,select,.povod-glass-select-button):focus-visible,
  html.keyboard-input body :is(.studio-date-field,.date-time-row):has(input:focus-visible){
    outline:0!important;
  }
  html.keyboard-input body :is(.studio-date-field,.date-time-row) input:focus{
    outline:0!important;box-shadow:none!important;
  }
  /* Inset contours stay visible inside clipped galleries, menus and crops. */
  html.keyboard-input body :is(.studio-design,.studio-photo,.studio-design-stage,.crop-stage,.studio-font-wheel,.studio-font-option,.studio-switch button,.studio-design-shape button,.povod-glass-options>button,.povod-navigation button,.event-menu-list button,.studio-wishlist-menu-panel button):focus-visible{
    outline-offset:-3px!important;
    box-shadow:var(--povod-highlight-inset),0 0 8px #f47b5c25!important;
  }
  html.keyboard-input body :is(.btn-primary,.btn-accent,.povod-pro-action,.welcome-start,.telegram-welcome-start,[data-remove-confirm]):focus-visible{
    box-shadow:inset 0 1px 1px #ffffff94,inset 0 -2px 2px #9d442c24,0 0 0 3px var(--povod-highlight-glow),0 5px 12px #b94f3529!important;
  }
  /* Small pills paint their visible 26px surface on ::before; keep the 44px target. */
  html.keyboard-input body :is(.studio-map-link,.studio-small-pill,.studio-wish-variant,[data-message-suggest],.gift-shop-link,.gift-cancel-action,.povod-rsvp-pro):focus-visible{
    outline:0!important;box-shadow:none!important;
  }
  html.keyboard-input body :is(.studio-map-link,.studio-small-pill,.studio-wish-variant,[data-message-suggest],.gift-shop-link,.gift-cancel-action,.povod-rsvp-pro):focus-visible::before{
    outline:1px solid var(--povod-highlight-focus)!important;outline-offset:2px!important;
    border-color:var(--povod-highlight-edge)!important;box-shadow:var(--povod-highlight-shadow)!important;
  }

  /* A selected artwork keeps its original transparent frame; the visible
     contour is one soft pixel outside it, rather than a solid coral frame. */
  body .studio-design[aria-pressed=true]{
    border-color:transparent!important;
    box-shadow:0 0 0 1px var(--povod-highlight-edge),0 0 0 3px var(--povod-highlight-glow),0 5px 16px #e6684a1c!important;
  }
  body :is(.color-option.is-selected,.povod-pro-packs button[aria-pressed=true],.dashboard-tabs button[aria-pressed=true]){
    border-color:var(--povod-highlight-edge)!important;
    box-shadow:var(--povod-highlight-shadow)!important;
  }
  /* Font-wheel samples stay plain; their position shows the current choice. */
  body .povod-glass-options>button[aria-selected=true]{
    box-shadow:var(--povod-highlight-inset)!important;
    background:linear-gradient(145deg,#ffffffc7,#fff4ee80)!important;
  }
  body .account-avatar[aria-current=page]{
    outline:1px solid var(--povod-highlight-edge)!important;outline-offset:2px!important;
    box-shadow:var(--povod-highlight-shadow)!important;
  }
  body :is(.studio-wishlist-card,.gift-basket-choice,.studio-guest-paper .gift-card):focus-within{
    border-color:var(--povod-highlight-edge)!important;
    box-shadow:var(--povod-highlight-shadow)!important;
  }
  body :is(.wish-shell,.wish-dialog) .studio-wishlist-card:has(.wish-check input:checked){
    border-color:var(--action,#f47b5c)!important;
    box-shadow:inset 0 1px 0 #ffffffd9,0 0 0 2px var(--povod-highlight-glow)!important;
  }
  body .studio-wish-suggestions button[aria-pressed=true]::before{
    border-color:var(--povod-highlight-edge)!important;
    box-shadow:var(--povod-highlight-shadow)!important;
  }
  body .studio-tools::after{border-color:var(--povod-highlight-edge)!important;box-shadow:var(--povod-highlight-shadow)!important;}
  body .studio-journey button{position:relative;border-bottom-width:1px;}
  body .studio-journey button[aria-current]{
    border-bottom-color:transparent!important;
    box-shadow:none!important;
  }
  body .studio-journey button[aria-current]::after{
    content:'';position:absolute;left:0;right:0;bottom:-2px;height:1px;
    background:var(--povod-highlight-edge);pointer-events:none;
  }
  body .editor-step-pill.active::after{height:1px!important;background:var(--povod-highlight-edge)!important;box-shadow:0 0 5px #f47b5c40!important;}

  /* Required controls keep their hint and use the same coral glow. */
  body :is(input,textarea,select,button)[aria-invalid=true],
  body #guestResponseForm .guest-answer-required :is(select,.povod-glass-select-button){
    border-color:var(--povod-highlight-invalid)!important;
    box-shadow:var(--povod-highlight-shadow)!important;
  }
  @media(forced-colors:active){
    html.keyboard-input body :where(button,a,summary,input,textarea,select,[tabindex]):focus-visible:where(:not(:disabled):not([tabindex='-1'])),
    html.keyboard-input body :is(.studio-date-field,.date-time-row):has(input:focus-visible){outline:2px solid Highlight!important;box-shadow:none!important;}
    body :is(.studio-design[aria-pressed=true],.color-option.is-selected,.povod-pro-packs button[aria-pressed=true],.dashboard-tabs button[aria-pressed=true]){outline:1px solid Highlight!important;outline-offset:-2px!important;}
    html.keyboard-input body :is(.studio-map-link,.studio-small-pill,.studio-wish-variant,[data-message-suggest],.gift-shop-link,.gift-cancel-action,.povod-rsvp-pro):focus-visible::before{outline:2px solid Highlight!important;box-shadow:none!important;}
  }
}
