/* The homepage lightbox (inc/feed-modal.php, assets/js/feed-modal.js): an Instagram post or the Education
   intro lesson shown large and borderless on a dimmed page, the caption and the buttons beside or below it.
   On a phone the post fills the screen, like Instagram. */

html.fmodal-open,html.fmodal-open body{overflow:hidden;}

.fmodal{position:fixed;inset:0;z-index:2000;display:grid;place-items:center;color:#fff;}
.fmodal[hidden]{display:none;}
.fmodal__backdrop{position:absolute;inset:0;background:rgba(8,11,30,.88);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);animation:fmodal-fade .22s ease both;}
.fmodal__panel{position:relative;display:grid;grid-template-columns:auto minmax(0,380px);align-items:end;column-gap:clamp(20px,3vw,40px);max-width:94vw;max-height:94vh;animation:fmodal-in .28s var(--ease,ease) both;}

/* The post: the reel (or its image) at its own 9:16, no frame, no rounded corners. */
.fmodal__media{position:relative;height:min(90vh,900px);aspect-ratio:9/16;background:#000;overflow:hidden;}
.fmodal__media video,.fmodal__media img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;}
.fmodal__media iframe{position:absolute;inset:0;width:100%;height:100%;border:0;}
.fmodal__sound{position:absolute;right:12px;bottom:12px;z-index:3;display:grid;place-items:center;width:44px;height:44px;border:0;border-radius:50%;background:rgba(10,13,34,.62);color:#fff;cursor:pointer;}
.fmodal__sound[hidden]{display:none;}
.fmodal__sound:hover{background:rgba(10,13,34,.8);}

.fmodal__info{display:flex;flex-direction:column;gap:12px;min-height:0;max-height:min(90vh,900px);padding:0 0 4px;}
.fmodal__meta{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;margin:0;font-size:14px;letter-spacing:.04em;}
.fmodal__cat{display:inline-flex;align-items:center;padding:4px 12px;border-radius:999px;background:rgba(255,255,255,.14);font-weight:600;text-transform:uppercase;letter-spacing:.12em;font-size:12px;}
.fmodal__date{opacity:.78;}
.fmodal__title{margin:0;font-size:clamp(20px,2vw,26px);line-height:1.22;font-weight:600;color:inherit;}
.fmodal__title:empty{display:none;}
.fmodal__text{min-height:0;overflow:auto;overscroll-behavior:contain;font-size:16px;line-height:1.55;color:rgba(255,255,255,.92);padding-right:6px;}
.fmodal__text p{margin:0 0 .85em;}
.fmodal__text a{color:#fff;text-decoration:underline;text-underline-offset:3px;}
.fmodal__tag{opacity:.82;}
.fmodal__tags{font-size:14px;opacity:.82;}
.fmodal__actions{display:flex;flex-wrap:wrap;align-items:center;gap:12px 20px;margin-top:6px;}
.fmodal__actions [hidden]{display:none;}
.fmodal__secondary{color:#fff;font-weight:600;text-decoration:underline;text-underline-offset:4px;}
.fmodal__secondary:hover{opacity:.85;}
.fmodal__primary{text-decoration:none;}

.fmodal__close,.fmodal__nav{position:fixed;z-index:5;display:grid;place-items:center;width:46px;height:46px;border:0;border-radius:50%;background:rgba(255,255,255,.14);color:#fff;cursor:pointer;transition:background .2s;}
.fmodal__close:hover,.fmodal__nav:hover{background:rgba(255,255,255,.28);}
.fmodal__close{top:18px;right:18px;}
.fmodal__nav{top:50%;margin-top:-23px;}
.fmodal__nav--prev{left:clamp(10px,2.4vw,32px);}
.fmodal__nav--prev svg{transform:rotate(180deg);}
.fmodal__nav--next{right:clamp(10px,2.4vw,32px);}
.fmodal__nav[hidden]{display:none;}
.fmodal :focus-visible{outline:3px solid #fff;outline-offset:3px;}

/* The Education intro: the Education look, cream ground and a cyan rule, the player wide above the words. */
.fmodal--edu .fmodal__panel{grid-template-columns:minmax(0,1fr);width:min(920px,94vw);align-items:start;row-gap:0;max-height:94vh;overflow:auto;background:var(--edu-cream,#F5F2EB);color:var(--navy);border-top:4px solid var(--edu-accent,#0D98C9);}
.fmodal--edu .fmodal__media{height:auto;width:100%;aspect-ratio:16/9;}
.fmodal--edu .fmodal__info{max-height:none;padding:clamp(20px,3vw,32px);color:var(--navy);}
.fmodal--edu .fmodal__cat{background:#fff;color:var(--navy);border:1px solid var(--line,#dfe6ec);}
.fmodal--edu .fmodal__text{color:rgba(25,30,75,.86);overflow:visible;}
.fmodal--edu .fmodal__secondary{color:var(--blue,#146EA0);}
.fmodal--edu .fmodal__close{background:rgba(25,30,75,.55);}
.fmodal--edu .fmodal__nav{display:none;}

@keyframes fmodal-fade{from{opacity:0;}to{opacity:1;}}
@keyframes fmodal-in{from{opacity:0;transform:translateY(14px) scale(.985);}to{opacity:1;transform:none;}}

/* A phone: the post fills the screen, the words lie over its lower part, swipe up or down for the next one. */
@media (max-width:760px){
  .fmodal__panel{display:block;position:fixed;inset:0;max-width:none;max-height:none;}
  .fmodal__media{position:absolute;inset:0;height:100%;aspect-ratio:auto;}
  .fmodal__info{position:absolute;left:0;right:0;bottom:0;max-height:52%;padding:56px 18px calc(18px + env(safe-area-inset-bottom));gap:10px;background:linear-gradient(180deg,rgba(8,11,30,0) 0,rgba(8,11,30,.78) 38%,rgba(8,11,30,.92) 100%);}
  .fmodal__sound{bottom:auto;top:18px;right:72px;}
  .fmodal__nav{display:none;}
  .fmodal__close{top:max(14px,env(safe-area-inset-top));right:14px;background:rgba(10,13,34,.55);}
  .fmodal__primary{width:100%;}
  .fmodal--edu .fmodal__panel{position:relative;inset:auto;display:grid;width:100vw;max-height:94vh;align-self:end;}
  .fmodal--edu .fmodal__media{position:relative;height:auto;aspect-ratio:16/9;}
  .fmodal--edu .fmodal__info{position:static;max-height:none;padding:18px 18px calc(22px + env(safe-area-inset-bottom));background:none;}
  .fmodal--edu .fmodal__close{top:12px;}
}

@media (prefers-reduced-motion:reduce){
  .fmodal__backdrop,.fmodal__panel{animation:none;}
  .fmodal__close,.fmodal__nav{transition:none;}
}

/* The small Instagram glyph on a tile's category badge says where the post came from. */
.ftile__src{display:inline-flex;margin-right:.55em;opacity:.9;}
.ftile__src svg{width:1.05em;height:1.05em;}
