/* Akademik Retina 5.7.1 — contrast + no-horizontal-scroll + responsive refinement */

/* Never allow accidental horizontal scroll */
html,body{
  max-width:100%;
  overflow-x:hidden;
}
body{color:#334E60!important;background:#FFFFFF!important}
*,*::before,*::after{box-sizing:border-box}
img,svg,video,iframe,canvas{max-width:100%;height:auto}

/* Make header container the positioning context for large mega menus */
.ar5-header-inner{position:relative!important;min-width:0}
.ar5-desktop-nav{min-width:0}
.ar5-desktop-nav .ar5-mega{position:static!important}
.ar5-mega-panel,.ar55-mega-panel{
  position:absolute!important;
  top:calc(100% - 1px)!important;
  left:50%!important;
  right:auto!important;
  transform:translate(-50%,12px)!important;
  width:min(1120px,calc(100vw - 32px))!important;
  max-width:calc(100vw - 32px)!important;
}
.ar5-mega.is-open .ar5-mega-panel,
.ar5-mega:hover .ar5-mega-panel,
.ar5-mega:focus-within .ar5-mega-panel{
  transform:translate(-50%,0)!important;
}
.ar55-mega-academic .ar55-mega-panel{width:min(900px,calc(100vw - 32px))!important;max-width:calc(100vw - 32px)!important}
.ar55-mega-links,
.ar55-mega-featured{min-width:0!important}
.ar55-mega-links a,
.ar55-mega-featured a{min-width:0!important}
.ar55-mega-links a span,
.ar55-mega-featured strong{overflow-wrap:anywhere}

/* Global readability boost */
body,
.kn-main,
main,
.ar5-prose,
.ar5-prose p,
.ar-article,
.ar-article-body,
.ar-article-head p,
.kn-section-title p,
.ar5-section-head p,
.ar5-authority-copy p,
.ar5-publication-list p,
.ar5-pub-rail dd,
.ar5-related-card p,
.ar5-sidecard p,
.ar5-blog-card p,
.ar5-social-card p,
.ar5-home-dictionary-copy p,
.ar56-academic-preview-grid a span,
.kn-image-copy p,
.kn-paper p,
.kn-paper-meta span,
.kn-metrics span,
.ar5-faq-answer p,
.ar562-lead-copy p,
.ar562-lead-form>small,
.kn-footer-brand p,
.kn-footer-bottom,
.ar5-footer-col a{
  color:#425B6B!important;
}

h1,h2,h3,h4,h5,h6,
.kn-section-title h2,
.ar5-section-head h2,
.ar5-authority-copy h2,
.ar-feed-header h1,
.ar-feed-header h2,
.ar5-publication-head h1,
.ar-article-head h1,
.ar-author-hero h1,
.ar5-prose h1,
.ar5-prose h2,
.ar5-prose h3,
.ar-article-body h2,
.ar-article-body h3,
.kn-topic-row h3,
.kn-image-copy h3,
.kn-paper h3,
.ar5-cluster-card h3,
.ar5-publication-list h2,
.ar5-blog-card h2,
.ar5-related-card h3,
.ar5-social-card h3,
.ar5-sidecard h3,
.ar56-academic-preview-grid a strong{
  color:#102A43!important;
}

.kn-section-title>span,
.kn-block-head>span,
.ar5-section-head>span,
.ar5-eyebrow,
.ar562-lead-copy>span,
.kn-image-copy small,
.ar5-cluster-card small,
.ar5-publication-list small,
.kn-topic-index,
.kn-indexgrid>a span,
.ar5-entry-grid small,
.kn-search-open,
.ar55-mega-links a b,
.ar55-mega-featured b{
  color:#005EB8!important;
}

/* Hero side panel: make it truly readable */
.ar5-home-hero .kn-feature-note{
  background:rgba(255,255,255,.92)!important;
  border:1px solid rgba(255,255,255,.78)!important;
  border-left:4px solid #7EB6DB!important;
  padding:26px 22px 24px 24px!important;
  box-shadow:0 12px 30px rgba(8,29,52,.18)!important;
}
.ar5-home-hero .kn-note-no{color:#4F6677!important;margin-bottom:24px!important}
.ar5-home-hero .kn-note-tag{
  background:#EAF3FA!important;
  border:1px solid #B8D2E5!important;
  color:#005EB8!important;
}
.ar5-home-hero .kn-feature-note h2{color:#102A43!important;font-size:28px!important;line-height:1.2!important}
.ar5-home-hero .kn-feature-note p{color:#425B6B!important;font-size:15px!important;line-height:1.65!important}
.ar5-home-hero .kn-feature-note>a{color:#005EB8!important;text-decoration:none!important;font-weight:800!important}
.ar5-home-hero .kn-feature-note>a:hover{text-decoration:underline!important}

/* Search and hero text */
.ar5-home-hero .kn-hero-main>p{color:#F0F6FA!important}
.kn-search input,
.ar5-search-page-form input,
.ar5-contact-form input,
.ar5-contact-form textarea,
.ar562-lead-fields input,
.ar5-publication-toolbar input{color:#102A43!important}
.kn-search input::placeholder,
.ar5-search-page-form input::placeholder,
.ar5-contact-form input::placeholder,
.ar5-contact-form textarea::placeholder,
.ar562-lead-fields input::placeholder,
.ar5-publication-toolbar input::placeholder{color:#5B6B79!important}

/* Topic and paper rows more legible */
.kn-topic-row{min-height:118px!important;padding-top:22px!important;padding-bottom:22px!important}
.kn-topic-row small{color:#5D7181!important;font-size:11px!important}
.kn-topic-row h3{font-size:28px!important;line-height:1.18!important}
.kn-topic-row p{color:#51687A!important}
.kn-paper{grid-template-columns:140px minmax(0,1fr) 220px 58px!important}
.kn-paper-meta span,
.kn-paper p{font-size:13px!important;line-height:1.6!important}
.kn-paper h3{font-size:28px!important;line-height:1.2!important}
.kn-paper .kn-read{font-size:13px!important;font-weight:800!important}

/* Publications / archive / FAQ and CTA surfaces */
.kn-stream-wrap,.ar5-publication-section,.ar5-authority,
.ar5-gallery-preview,.ar56-academic-preview,.ar5-related-section,
.ar5-faq-section,.ar562-lead-band{
  border-color:#D7E1E8!important;
}
.kn-paper:hover,
.ar5-related-card:hover,.ar5-blog-card:hover,.ar5-social-card:hover,.ar56-academic-preview-grid a:hover,
.ar5-dictionary-category:hover,.ar5-dictionary-mini-groups a:hover,.ar5-home-dictionary-grid a:hover,
.ar5-alpha-term:hover{
  background:#F2F7FB!important;
}

/* Footer/pre-footer contrast */
.ar562-lead-band{background:#EAF3FA!important}
.ar562-lead-copy h2{color:#102A43!important}
.ar562-lead-form{box-shadow:0 10px 26px rgba(18,43,73,.08)!important}
.kn-footer,.ar5-footer{background:#12385B!important}
.kn-footer-brand strong,.ar5-footer-col>span{color:#FFFFFF!important}
.kn-footer-brand p,.kn-footer-bottom,.ar5-footer-col a{color:#D8E6F0!important}

/* Eliminate overflow risks across grids and cards */
.container,
.kn-header-inner,
.ar5-header-inner,
.kn-hero-grid,
.ar5-home-hero-grid,
.kn-dashboard,
.kn-stream-grid,
.ar5-authority,
.ar5-gallery-preview-grid,
.ar56-academic-preview-grid,
.ar5-cluster-grid,
.ar5-content-layout,
.ar5-academic-layout,
.ar5-publication-single-grid,
.ar5-video-layout,
.ar55-mega-head,
.ar55-mega-links,
.ar55-mega-featured,
.kn-indexgrid,
.ar5-entry-grid,
.ar562-lead-grid,
.ar562-lead-fields{
  min-width:0!important;
}

.kn-indexgrid>div,.kn-indexgrid>a,
.ar5-entry-grid>a,
.ar5-cluster-card,
.ar56-academic-preview-grid a,
.ar5-related-card,
.ar5-blog-card,
.ar5-social-card,
.kn-image-card,
.kn-paper,
.ar5-alpha-term,
.ar5-dictionary-category,
.ar5-dictionary-mini-groups a,
.ar5-home-dictionary-grid a{
  overflow:hidden;
}

/* Responsive polish */
@media (max-width:1240px){
  .ar55-mega-links{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media (max-width:1020px){
  .kn-paper{grid-template-columns:110px minmax(0,1fr) 160px 40px!important}
  .kn-paper h3{font-size:24px!important}
}
@media (max-width:760px){
  html,body{overflow-x:hidden!important}
  .container{width:min(var(--ar-max),calc(100% - 24px))!important}
  .kn-indexgrid,
  .ar5-entry-grid,
  .ar5-cluster-grid,
  .ar56-academic-preview-grid,
  .ar5-gallery-preview-grid,
  .ar55-mega-featured,
  .ar55-mega-links,
  .ar562-lead-fields{
    grid-template-columns:1fr!important;
  }
  .ar5-home-hero-grid{gap:26px!important;padding-top:64px!important;padding-bottom:52px!important}
  .ar5-home-hero h1{font-size:42px!important;line-height:1.04!important}
  .ar5-home-hero .kn-feature-note{padding:18px!important}
  .ar5-home-hero .kn-feature-note h2{font-size:22px!important}
  .kn-topic-row{grid-template-columns:34px minmax(0,1fr) 18px!important;min-height:104px!important}
  .kn-topic-row h3{font-size:23px!important}
  .kn-paper{grid-template-columns:60px minmax(0,1fr) 28px!important}
  .kn-paper h3{font-size:21px!important}
  .kn-paper p,
  .kn-paper-meta span:nth-child(2){display:none!important}
  .ar55-mega-panel,.ar5-mega-panel{
    width:min(100vw - 20px, 1000px)!important;
    max-width:calc(100vw - 20px)!important;
  }
}
