/* 教育情報站 home hero (templates/portal/_hub_hero.html), the teachers' twin of the 學生・家長版 hero; the motion,
   day previews and pointer light below serve both (.fam-hero in templates/portal/family/home.html).
   Cooler colours, a search box instead of the grade picker, live counts, and a month calendar that also
   carries 資助, 公開試 and SBA deadlines, with a preview of each busy day. shader-fx.js paints a flowing
   gradient behind it when WebGPU is available; the CSS gradient below is the fallback. Loaded in
   base.html late_head; dark values are set by hand (this file is not in build_theme.py). */
.hub-hero{position:relative;isolation:isolate;display:grid;grid-template-columns:minmax(0,1.45fr) minmax(0,1fr);gap:2.2rem;align-items:center;
  padding:clamp(1.6rem,4vw,3rem);margin:.4rem 0 2rem;border-radius:1.8rem;overflow:hidden;
  background:radial-gradient(60% 90% at 0% 0%,#d6e6ff,transparent 62%),radial-gradient(50% 80% at 100% 100%,#ffe6c7,transparent 62%),
             radial-gradient(45% 70% at 72% 8%,#d6f4ec,transparent 62%),#f2f5fa}
:root[data-theme=dark] .hub-hero{background:radial-gradient(60% 90% at 0% 0%,#17304f,transparent 62%),radial-gradient(50% 80% at 100% 100%,#3a2914,transparent 62%),
             radial-gradient(45% 70% at 72% 8%,#103631,transparent 62%),#11151b}
.hub-hero.sfx-on{background:none}
html:not(.reduceMotion) .page-shell>:is(.hub-hero,.fam-hero){animation:none}   /* its parts have their own entrance */
:is(.hub-hero,.fam-hero)>:not(.sfx-canvas){position:relative;z-index:1}
.fam-hero{isolation:isolate}
/* a soft light follows the pointer (hub-hero.js sets --mx / --my) */
:is(.hub-hero,.fam-hero)::after{content:"";position:absolute;inset:0;z-index:0;pointer-events:none;border-radius:inherit;opacity:0;transition:opacity .4s ease;
  background:radial-gradient(26rem 26rem at var(--mx,30%) var(--my,30%),rgb(255 255 255 / .45),transparent 70%)}
:root[data-theme=dark] :is(.hub-hero,.fam-hero)::after{background:radial-gradient(26rem 26rem at var(--mx,30%) var(--my,30%),rgb(140 180 255 / .14),transparent 70%)}
:is(.hub-hero,.fam-hero):hover::after{opacity:1}

.hub-hero h1{font-size:clamp(1.9rem,4.2vw,3rem);line-height:1.22;letter-spacing:-.01em;margin:.35rem 0 .8rem}
.hub-lead{max-width:36rem;margin:0 0 1.3rem;font-size:1.05rem;line-height:1.85;color:var(--muted)}
.hub-hero .hero-search{max-width:40rem;margin:0}
.hub-hero .search-suggestions{margin-top:.8rem}
.hub-stats{display:flex;flex-wrap:wrap;align-items:center;gap:.7rem 1.6rem;margin-top:1.5rem}
.hub-stats>a:not(.text-link){display:flex;align-items:baseline;gap:.45rem;color:var(--ink);text-decoration:none}
.hub-stats strong{font-size:2.1rem;font-weight:800;line-height:1;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.hub-stats>a:first-child strong{background:linear-gradient(135deg,#2f74e0,#0d9488);-webkit-background-clip:text;background-clip:text;color:transparent}
.hub-stats>a:nth-child(2) strong{background:linear-gradient(135deg,#e8552f,#b7791f);-webkit-background-clip:text;background-clip:text;color:transparent}
:root[data-theme=dark] .hub-stats>a:first-child strong{background-image:linear-gradient(135deg,#8db8ff,#5fd4c4)}
:root[data-theme=dark] .hub-stats>a:nth-child(2) strong{background-image:linear-gradient(135deg,#ff9a7d,#f2c46b)}
.hub-stats span{font-size:.86rem;color:var(--muted)}
.hub-stats .hub-stat-label{display:grid;gap:.1rem;color:var(--ink);font-weight:600;line-height:1.3}
.hub-stats .hub-stat-label small{font-size:.74rem;font-weight:500;color:var(--muted)}
.hub-stats .preference-link{font-size:.85rem}

/* the calendar card: glass over the moving gradient */
.hub-mini{justify-self:end}
.hub-hero.sfx-on .hub-mini{background:color-mix(in srgb,var(--surface,#fff) 78%,transparent);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
.hub-mini .mini-cal-day.has-events{cursor:pointer}
.hub-mini-empty{margin:.8rem 0 0;font-size:.8rem;color:var(--muted)}
.hub-legend{display:flex;flex-wrap:wrap;gap:.25rem .8rem;margin:.8rem 0 0;font-size:.7rem;color:var(--muted)}
.hub-legend span::before{content:"";display:inline-block;width:.45rem;height:.45rem;margin-right:.3rem;border-radius:50%;background:var(--t);vertical-align:.05em}

/* preview of a busy day: opens below the day, towards the middle of the card */
.mini-tip{position:absolute;top:calc(100% + .3rem);left:50%;z-index:5;display:grid;gap:.22rem;width:max-content;max-width:15.5rem;padding:.6rem .75rem;border-radius:.85rem;
  background:var(--ink);color:var(--bg);font-size:.72rem;font-weight:500;line-height:1.45;text-align:left;box-shadow:0 14px 34px -12px rgb(0 0 0 / .5);
  opacity:0;transform:translate(-50%,-6px) scale(.96);transform-origin:top center;pointer-events:none;transition:opacity .18s ease,transform .25s cubic-bezier(.2,.9,.3,1.2)}
.mini-tip strong{font-size:.76rem}
.mini-tip em{position:relative;display:block;overflow:hidden;padding-left:.75rem;font-style:normal;text-overflow:ellipsis;white-space:nowrap}
.mini-tip em::before{content:"";position:absolute;left:0;top:.48em;width:.42rem;height:.42rem;border-radius:50%;background:var(--t)}
.mini-tip small{font-size:.68rem;opacity:.75}
.hub-mini .c0 .mini-tip,.hub-mini .c1 .mini-tip,.hub-mini .c2 .mini-tip{left:0;transform:translate(0,-6px) scale(.96);transform-origin:top left}
.hub-mini .c4 .mini-tip,.hub-mini .c5 .mini-tip,.hub-mini .c6 .mini-tip{left:auto;right:0;transform:translate(0,-6px) scale(.96);transform-origin:top right}
.hub-mini .mini-cal-day:hover .mini-tip,.hub-mini .mini-cal-day:focus-visible .mini-tip{opacity:1;transform:translate(-50%,0) scale(1)}
.hub-mini .c0:hover .mini-tip,.hub-mini .c1:hover .mini-tip,.hub-mini .c2:hover .mini-tip,.hub-mini .c4:hover .mini-tip,.hub-mini .c5:hover .mini-tip,.hub-mini .c6:hover .mini-tip,
.hub-mini .c0:focus-visible .mini-tip,.hub-mini .c1:focus-visible .mini-tip,.hub-mini .c2:focus-visible .mini-tip,.hub-mini .c4:focus-visible .mini-tip,.hub-mini .c5:focus-visible .mini-tip,.hub-mini .c6:focus-visible .mini-tip{transform:none}
.hub-mini .mini-cal-day:hover{z-index:6}
@media (hover:none){.mini-tip{display:none}}

/* ---------- motion: once, on arrival ---------- */
@media (prefers-reduced-motion:no-preference){
  :root:not(.reduceMotion) :is(.hub-hero-text,.fam-hero-text)>*{animation:hub-rise .6s cubic-bezier(.2,.8,.2,1) backwards}
  :root:not(.reduceMotion) :is(.hub-hero-text,.fam-hero-text)>:nth-child(2){animation-delay:.05s}
  :root:not(.reduceMotion) :is(.hub-hero-text,.fam-hero-text)>:nth-child(3){animation-delay:.1s}
  :root:not(.reduceMotion) :is(.hub-hero-text,.fam-hero-text)>:nth-child(4){animation-delay:.15s}
  :root:not(.reduceMotion) :is(.hub-hero-text,.fam-hero-text)>:nth-child(5){animation-delay:.2s}
  :root:not(.reduceMotion) :is(.hub-hero-text,.fam-hero-text)>:nth-child(n+6){animation-delay:.25s}
  :root:not(.reduceMotion) .hub-mini{animation:hub-card .8s cubic-bezier(.2,.8,.2,1) .08s backwards}
  /* the coloured dots pop in across the month, one day after another */
  :root:not(.reduceMotion) .hub-mini .mini-dots b{animation:hub-dot .5s cubic-bezier(.3,1.7,.5,1) backwards;animation-delay:calc(var(--d,0) * 16ms + .35s)}
  :root:not(.reduceMotion) .hub-mini .mini-cal-day.is-today>span:first-child{animation:hub-today 1.6s ease-out .7s 2}
  :root:not(.reduceMotion) .hub-mini .mini-cal-next li{animation:hub-slide .55s cubic-bezier(.2,.8,.2,1) backwards;animation-delay:calc(var(--n,0) * 70ms + .6s)}
  :root:not(.reduceMotion) .hub-legend{animation:hub-fade .6s ease 1s backwards}
}
@keyframes hub-rise{from{opacity:0;transform:translateY(12px)}}
@keyframes hub-card{from{opacity:0;transform:translateY(18px) rotate(1.2deg) scale(.97)}}
@keyframes hub-dot{from{opacity:0;transform:scale(0)}}
@keyframes hub-today{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--ink) 45%,transparent)}100%{box-shadow:0 0 0 .7rem transparent}}
@keyframes hub-slide{from{opacity:0;transform:translateX(14px)}}
@keyframes hub-fade{from{opacity:0}}

@media (max-width:900px){
  .hub-hero{grid-template-columns:1fr;gap:1.6rem}
  .hub-mini{justify-self:stretch;width:100%}
}
@media (max-width:720px){
  .hub-hero{padding:1.3rem 1.1rem;border-radius:1.3rem}
  .hub-stats strong{font-size:1.7rem}
}
