/* =============================================================
   Qom Hockey v4.5 — responsive header + adaptive motion layer
   ============================================================= */

html,body{max-width:100%;overflow-x:hidden}
@supports(overflow:clip){html,body{overflow-x:clip}}

/* ---------- Header redesign ---------- */
.brand-stripe{height:2px;grid-template-columns:1fr 2.2fr 1fr}
.site-header{
  top:0;
  background:color-mix(in srgb,var(--surface) 88%,transparent)!important;
  border-bottom:1px solid color-mix(in srgb,var(--border) 86%,transparent)!important;
  backdrop-filter:saturate(150%) blur(18px)!important;
  -webkit-backdrop-filter:saturate(150%) blur(18px)!important;
  transition:background-color var(--motion-base) var(--motion-ease),border-color var(--motion-base) var(--motion-ease),box-shadow var(--motion-base) var(--motion-ease);
}
.site-header.is-scrolled{background:color-mix(in srgb,var(--surface) 96%,transparent)!important;box-shadow:0 10px 30px rgba(16,35,63,.055)!important}
.header-row{
  height:74px!important;min-height:74px!important;
  display:grid!important;grid-template-columns:minmax(240px,1fr) auto minmax(190px,1fr);
  align-items:center;gap:18px!important;
}
.brand{min-width:0!important;width:max-content;max-width:100%;gap:10px!important}
.brand img{width:48px!important;height:48px!important;border:1px solid var(--border)!important;background:var(--surface);box-shadow:none!important}
.brand-copy{min-width:0}
.brand-copy strong{font-size:14px!important;line-height:1.45;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-copy small{font-size:10.5px!important;line-height:1.45;margin-top:1px!important}
.desktop-nav{
  flex:none!important;justify-self:center;display:flex;align-items:center;gap:2px!important;
  padding:4px;border:1px solid var(--border);border-radius:14px;
  background:color-mix(in srgb,var(--surface-2) 84%,var(--surface));
}
.desktop-nav a{
  min-height:40px!important;padding:7px 12px!important;border:0!important;border-radius:10px!important;
  color:var(--ink-2);font-size:13px!important;font-weight:700!important;background:transparent!important;
  transition:background-color var(--motion-base) var(--motion-ease),color var(--motion-base) var(--motion-ease),box-shadow var(--motion-base) var(--motion-ease),transform var(--motion-fast) var(--motion-ease)!important;
}
.desktop-nav a::after{display:none!important}
.desktop-nav a:hover{background:color-mix(in srgb,var(--brand) 6%,var(--surface))!important;color:var(--brand)!important}
.desktop-nav a.active{
  color:var(--brand)!important;background:var(--surface)!important;
  box-shadow:0 0 0 1px color-mix(in srgb,var(--brand) 14%,var(--border)),0 3px 10px rgba(16,35,63,.045);
}
.desktop-nav a:active{transform:scale(.975)}
.header-actions{justify-self:end;gap:7px!important}
.header-actions .btn{min-height:44px;border-radius:12px!important;padding-inline:14px}
.header-actions .icon-btn{border-radius:12px!important;background:var(--surface)}

/* Drawer no longer exposes a hard edge/strip on narrow viewports. */
.mobile-menu-backdrop{background:rgba(7,17,31,.44)!important;backdrop-filter:blur(3px)!important;-webkit-backdrop-filter:blur(3px)!important}
.mobile-menu{
  top:10px!important;bottom:10px!important;right:10px!important;left:auto!important;
  width:min(360px,calc(100vw - 20px))!important;padding:12px!important;
  border:1px solid var(--border)!important;border-radius:22px!important;
  background:var(--surface)!important;box-shadow:0 26px 70px rgba(7,17,31,.18)!important;
  transform:translate3d(calc(100% + 24px),0,0)!important;
}
.mobile-menu.open{transform:translate3d(0,0,0)!important}
.mobile-menu-head{height:auto!important;min-height:58px;margin:0 0 8px!important;padding:3px 3px 11px;border-bottom:1px solid var(--border)!important;gap:10px}
.mobile-menu-brand{display:flex;align-items:center;gap:9px;min-width:0;text-decoration:none;color:var(--ink)}
.mobile-menu-brand img{width:38px;height:38px;border-radius:50%;border:1px solid var(--border);object-fit:cover;background:var(--surface)}
.mobile-menu-brand span{display:grid;min-width:0}
.mobile-menu-brand strong{font-size:12.5px;line-height:1.45;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mobile-menu-brand small{font-size:9.5px;color:var(--muted);line-height:1.45;margin-top:1px}
.mobile-menu nav{display:grid!important;gap:4px!important}
.mobile-menu nav a{
  min-height:50px!important;border:0!important;border-radius:13px!important;padding:9px 11px!important;
  display:flex;align-items:center;gap:10px;color:var(--ink-2)!important;background:transparent;
}
.mobile-menu nav a .icon{width:20px;height:20px;color:var(--muted)}
.mobile-menu nav a:hover{background:var(--surface-2)!important;color:var(--brand)!important}
.mobile-menu nav a.active{background:color-mix(in srgb,var(--brand) 8%,var(--surface))!important;color:var(--brand)!important;font-weight:800}
.mobile-menu nav a.active .icon{color:var(--brand)}

/* ---------- Home layout repairs ---------- */
.home-intro{scroll-margin-top:90px;padding-top:32px!important}
.home-intro-row{min-width:0}
.home-intro h1{max-width:100%;overflow-wrap:anywhere;text-wrap:balance}
.home-intro p{line-height:1.85}

.editorial-grid.is-single{grid-template-columns:minmax(0,1fr)!important}
.editorial-grid.is-single .lead-story{min-height:460px;max-height:620px}
.lead-rail.is-compact{grid-template-rows:auto auto!important;align-content:start}
.lead-story.is-fallback-media{background:linear-gradient(145deg,var(--brand-900),var(--brand))}
.lead-story.is-fallback-media>img{object-fit:contain!important;padding:clamp(52px,8vw,108px);opacity:.22}
.lead-story.is-fallback-media::after{background:linear-gradient(180deg,rgba(2,16,38,.06) 10%,rgba(2,16,38,.90) 100%)!important}

/* The shared .news-meta rule uses space-between on archive cards; the stream must stay grouped. */
.stream-copy .news-meta{justify-content:flex-start!important;flex-wrap:wrap;row-gap:4px}
.stream-story{align-items:center}
.stream-media{min-width:0}
.stream-media img{display:block}

/* Access cards: denser on mobile/tablet without turning into four huge rows. */
.quick-card{min-width:0;overflow:hidden}
.quick-card>span:nth-child(2){min-width:0}
.quick-card strong,.quick-card small{overflow:hidden;text-overflow:ellipsis}

/* Prevent media/cards from causing accidental horizontal scrolling. */
.lead-story,.rail-story,.stream-story,.quick-card,.sidebar-card,.media-tile,.news-card,.person-card{max-width:100%}

/* ---------- Page + scroll motion ---------- */
@keyframes qh-page-arrive{from{opacity:.86}to{opacity:1}}
body.public-site main{animation:qh-page-arrive 240ms var(--motion-ease) both}

/* JS only applies this to below-the-fold elements, avoiding flash/hide above the fold. */
.qh-reveal{
  opacity:0;transform:translate3d(0,14px,0);
  transition:opacity 390ms var(--motion-ease),transform 460ms var(--motion-ease)!important;
  transition-delay:var(--reveal-delay,0ms)!important;
}
.qh-reveal.is-visible{opacity:1;transform:translate3d(0,0,0)}
.qh-stagger-enter{animation:none!important}

/* Lightweight mode for constrained devices / Save-Data. */
html.motion-lite .site-header{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;background:var(--surface)!important}
html.motion-lite .mobile-menu-backdrop{backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
html.motion-lite .qh-reveal{transform:translate3d(0,6px,0);transition-duration:150ms,180ms!important;transition-delay:0ms!important}
html.motion-lite body.public-site main{animation-duration:150ms}
html.motion-lite :where(.news-card,.person-card,.quick-card,.rail-story,.media-tile):hover{transform:none!important}

html[data-theme="dark"] .desktop-nav{background:color-mix(in srgb,var(--surface-2) 76%,var(--surface));border-color:var(--border)}
html[data-theme="dark"] .desktop-nav a.active{background:var(--surface-3)!important;color:#a9c7ff!important;box-shadow:0 0 0 1px var(--border)}
html[data-theme="dark"] .site-header.is-scrolled{box-shadow:0 12px 34px rgba(0,0,0,.16)!important}

@media(max-width:1120px){
  .header-row{grid-template-columns:minmax(0,1fr) auto!important;height:70px!important;min-height:70px!important}
  .desktop-nav{display:none!important}
  .brand{width:auto!important}
  .header-actions{justify-self:end}
}

@media(max-width:1040px){
  .editorial-grid:not(.is-single){grid-template-columns:1fr!important}
  .lead-rail{grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:auto!important}
  .lead-rail .rail-brand-card{grid-column:1/-1}
}

@media(max-width:720px){
  .header-row{height:64px!important;min-height:64px!important;gap:8px!important}
  .brand img{width:42px!important;height:42px!important}
  .brand-copy strong{font-size:12.5px!important}
  .header-actions{gap:5px!important}
  .header-actions .icon-btn,.mobile-menu-btn{width:42px!important;height:42px!important;min-width:42px!important}
  .home-intro{padding-top:24px!important}
  .home-intro-actions{display:grid!important;grid-template-columns:1fr 1fr;gap:8px!important}
  .home-intro-actions .btn{width:100%}
  .lead-story,.editorial-grid.is-single .lead-story{min-height:360px;max-height:none}
  .lead-story.is-fallback-media>img{padding:48px;opacity:.20}
  .lead-rail{grid-template-columns:1fr!important}
  .quick-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .quick-card{min-height:88px!important;padding:12px!important;border:1px solid var(--border)!important;border-radius:15px!important;gap:10px!important}
  .quick-card:first-child{border:1px solid var(--border)!important}
  .quick-icon{width:42px!important;height:42px!important;min-width:42px;border-radius:11px!important}
  .quick-card strong{font-size:12.5px;white-space:normal;line-height:1.55}
  .quick-card small{font-size:10.5px;white-space:normal;line-height:1.55;display:block!important}
  .stream-story{grid-template-columns:112px minmax(0,1fr)!important;gap:12px!important;padding-block:15px!important}
  .stream-copy h3{font-size:14.5px!important;line-height:1.65!important}
}

@media(max-width:520px){
  :root{--container:min(100% - 20px,1240px)}
  .brand-copy small{display:none!important}
  .home-intro-actions{grid-template-columns:1fr}
  .quick-grid{grid-template-columns:1fr!important;gap:8px!important}
  .quick-card{min-height:76px!important;grid-template-columns:42px minmax(0,1fr) 24px!important;padding:10px 11px!important}
  .quick-card small{font-size:10px;white-space:nowrap}
  .lead-story,.editorial-grid.is-single .lead-story{min-height:340px}
  .lead-story-overlay{padding:17px!important}
  .lead-story-overlay h2{font-size:clamp(21px,7.8vw,29px)!important;line-height:1.55!important}
  .mobile-menu{top:8px!important;bottom:8px!important;right:8px!important;width:calc(100vw - 16px)!important}
}

@media(prefers-reduced-motion:reduce){
  body.public-site main{animation:none!important}
  .qh-reveal,.qh-reveal.is-visible{opacity:1!important;transform:none!important;transition:none!important}
  .site-header,.mobile-menu,.mobile-menu-backdrop,.admin-sidebar,.admin-backdrop,.qh-dialog,.qh-dialog-backdrop,.qh-select-menu,.block-inserter,.smart-modal,.smart-modal-backdrop{transition:none!important;animation:none!important}
}
