/* Shared focus paint. Outlines do not change the element's box dimensions. */
:root {
  --hanok-focus-color: #c40000;
  --hanok-focus-underlay: inset 0 0 0 7px #fff;
}
a:focus, button:focus, input:focus, select:focus, textarea:focus,
[role="button"]:focus, [tabindex]:focus,
.contents_area .contents_tab .tab_ul a:focus,
.contents_area .contents_tab .tab_ul_exp a:focus,
a.youtube-video-link:focus, a.youtube-video-card-link:focus,
.check_box input:focus + label,
.youtube-wrap .youtube-cp:has(a:focus),
.youtube-wrap .story-card:has(a:focus) {
  outline: 5px dashed var(--hanok-focus-color) !important;
  outline-offset: -5px !important;
  /* White between the dashes and inside the ring keeps it visible on dark fills. */
  box-shadow: var(--hanok-focus-underlay) !important;
  /* Keep outline changes immediate while retaining existing color and transform effects. */
  transition-property: color, background-color, border-color, transform, opacity !important;
}

/* The visible label represents an operable, visually hidden native control. */
.check_box input:focus + label::before { outline: none !important; }

/* One ring around the existing focus-highlighted card is sufficient. */
.youtube-wrap .youtube-cp:has(a:focus) a:focus,
.youtube-wrap .story-card:has(a:focus) a:focus { outline: none !important; box-shadow: none !important; }

/* Retain image geometry instead of adding a layout-affecting focus border. */
.story_area .img_list_ul li a:focus { border-width: 0; }

/* Paint over absolutely positioned thumbnails, within the existing link box. */
a.youtube-video-link:focus::after,
.slide-02-swiper a.youtube-video-link:focus::after {
  content: '';
  position: absolute; inset: 0; z-index: 2;
  box-sizing: border-box;
  border: 5px dashed var(--hanok-focus-color) !important;
  box-shadow: inset 0 0 0 2px #fff;
  pointer-events: none;
  transition: none;
}

@media (forced-colors: active) {
  :root { --hanok-focus-color: Highlight; --hanok-focus-underlay: none; }
  a.youtube-video-link:focus::after,
  .slide-02-swiper a.youtube-video-link:focus::after { box-shadow: none; }
}
