/* Photo-feed layout for ig.<domain>. Loaded after style.css only on that host (server.js: IG_HTML); every rule is scoped
   to html[data-ui="ig"]. Same colours as the main site (style.css :root). Desktop: left sidebar (icons + labels,
   icons only on medium screens). Mobile: top bar + bottom tab bar. The sidebar applies only when logged in (html.igauth,
   set by nav() in app.js); logged-out pages keep the normal top bar. */
html[data-ui="ig"] { --side: 245px; }
html[data-ui="ig"] .igtop, html[data-ui="ig"] .igbottom { display: none; }

/* ---------- sidebar (desktop) ---------- */
html[data-ui="ig"].igauth #nav { position: fixed; top: 0; bottom: 0; left: 0; width: var(--side); height: auto; z-index: 30;
  background: var(--bg); backdrop-filter: none; border-bottom: 0; border-right: 1px solid var(--line); }
html[data-ui="ig"].igauth body { padding-left: var(--side); }
html[data-ui="ig"] .igside { height: 100%; box-sizing: border-box; padding: 22px 12px 18px; display: flex; flex-direction: column; gap: 14px; }
html[data-ui="ig"] .iglogo { display: flex; align-items: center; gap: 8px; padding: 6px 12px 10px; color: var(--text); text-decoration: none;
  font-family: Fraunces, serif; font-style: italic; font-size: 26px; }
html[data-ui="ig"] .iglogo svg { width: 30px; height: 30px; flex: none; }
html[data-ui="ig"] .igside .qs { width: auto; margin: 0 4px 4px; }
html[data-ui="ig"] .igside .qs .dd { left: 0; right: auto; }
html[data-ui="ig"] .ignav { display: flex; flex-direction: column; gap: 2px; }
html[data-ui="ig"] .igfoot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
html[data-ui="ig"] .igwrap { position: relative; }
html[data-ui="ig"] .igi { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; box-sizing: border-box; padding: 10px 12px;
  border-radius: 10px; color: var(--text); background: none; border: 0; font: inherit; font-size: 15px; text-align: left; cursor: pointer; text-decoration: none; }
html[data-ui="ig"] .igi:hover { background: var(--card); text-decoration: none; }
html[data-ui="ig"] .igi.on { font-weight: 700; }
html[data-ui="ig"] .igi.on .ic svg { stroke-width: 2.6; }
html[data-ui="ig"] .igi .ic { width: 26px; height: 26px; display: grid; place-items: center; flex: none; }
html[data-ui="ig"] .igi .ic .avatar { width: 26px; height: 26px; font-size: 11px; }
html[data-ui="ig"] .igi.on .ic .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
html[data-ui="ig"] .igi .badge { position: absolute; top: 4px; left: 28px; margin: 0; }
html[data-ui="ig"] .igside .dd.pop { top: 0; left: calc(100% + 10px); right: auto; }
html[data-ui="ig"] .igside .igfoot .dd.pop { top: auto; bottom: 0; }

/* medium screens: icons-only rail */
@media (max-width: 1260px) and (min-width: 861px) {
  html[data-ui="ig"] { --side: 76px; }
  html[data-ui="ig"] .igside { padding: 22px 10px 18px; align-items: center; }
  html[data-ui="ig"] .igside .lbl, html[data-ui="ig"] .iglogo span, html[data-ui="ig"] .igside .qs { display: none; }
  html[data-ui="ig"] .iglogo { padding: 6px 0 12px; }
  html[data-ui="ig"] .igi { width: 50px; justify-content: center; padding: 12px 0; }
  html[data-ui="ig"] .igi .badge { left: 26px; }
}

/* ---------- mobile: top bar + bottom tab bar ---------- */
@media (max-width: 860px) {
  html[data-ui="ig"].igauth body { padding-left: 0; }
  /* no backdrop-filter here: it would make #nav the containing block of the fixed bottom bar and pull the bar up into it */
  html[data-ui="ig"].igauth #nav { position: sticky; bottom: auto; width: auto; height: 54px; border-right: 0; border-bottom: 1px solid var(--line);
    background: var(--bg); backdrop-filter: none; }
  html[data-ui="ig"] .igside { display: none; }
  html[data-ui="ig"] .igtop { display: flex; align-items: center; height: 100%; padding: 0 6px 0 4px; }
  html[data-ui="ig"] .igtop .iglogo { padding: 0 10px; font-size: 25px; }
  html[data-ui="ig"] .igtop .igi, html[data-ui="ig"] .igbottom .igi { width: 46px; height: 46px; padding: 0; justify-content: center; }
  html[data-ui="ig"] .igtop .igwrap, html[data-ui="ig"] .igbottom .igwrap { position: static; }
  html[data-ui="ig"] .igtop .lbl, html[data-ui="ig"] .igbottom .lbl { display: none; }
  html[data-ui="ig"] .igtop .badge { left: 26px; top: 6px; }
  html[data-ui="ig"] .igbottom { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); justify-items: center; align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: 54px; padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg); border-top: 1px solid var(--line); }
  html[data-ui="ig"] .igbottom .igi:hover, html[data-ui="ig"] .igtop .igi:hover { background: none; }
  html[data-ui="ig"] .igtop .dd.pop { top: 56px; right: 8px; left: auto; }
  html[data-ui="ig"] .igbottom .dd.pop { top: auto; bottom: 62px; left: 8px; right: 8px; width: auto; }
  html[data-ui="ig"] .dd.wide { width: auto; max-width: calc(100vw - 16px); }
  html[data-ui="ig"] main { padding: 0 0 80px; }
  html[data-ui="ig"] .heads { bottom: 70px; }
  html[data-ui="ig"] .minichat { bottom: 70px; }
}

/* ---------- feed layout ---------- */
html[data-ui="ig"] main { max-width: 1020px; }
html[data-ui="ig"] .l3.ig3 { grid-template-columns: minmax(0, 470px) 320px; gap: 64px; justify-content: center; }
html[data-ui="ig"] .l3.ig3 > .right { display: block; padding-top: 18px; }
@media (max-width: 1160px) {
  html[data-ui="ig"] .l3.ig3 { grid-template-columns: minmax(0, 470px); }
  html[data-ui="ig"] .l3.ig3 > .right { display: none; }
}
html[data-ui="ig"] .feedtabs { margin-bottom: 8px; }

/* right column: flat, like a suggestions list */
html[data-ui="ig"] .ig3 .right .card, html[data-ui="ig"] .ig3 .right .promo { background: none; border: 0; box-shadow: none; padding: 4px 0; }
html[data-ui="ig"] .ig3 .right .card.mini h4 { color: var(--muted); font-size: 14px; font-weight: 600; text-transform: none; letter-spacing: 0; }

/* ---------- stories ---------- */
html[data-ui="ig"] .igstories { gap: 14px; margin: 14px 0 10px; padding: 4px 2px 10px; }
html[data-ui="ig"] .igst { position: relative; flex: 0 0 72px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0;
  background: none; border: 0; color: var(--text); cursor: pointer; }
html[data-ui="ig"] .igring { display: inline-grid; padding: 3px; border-radius: 50%; background: var(--ring); }
html[data-ui="ig"] .igring .avatar { width: 60px; height: 60px; font-size: 22px; box-shadow: 0 0 0 3px var(--bg); }
html[data-ui="ig"] .igst.seen .igring, html[data-ui="ig"] .igring.off { background: var(--line2); }
html[data-ui="ig"] .igst.featured .igring { background: var(--gold); }
html[data-ui="ig"] .igst .lb { font-size: 12px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-ui="ig"] .igst.seen .lb { color: var(--muted); }
html[data-ui="ig"] .igst .plus { position: absolute; top: 46px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent);
  border: 3px solid var(--bg); color: #fff; font-weight: 700; font-size: 15px; line-height: 16px; display: grid; place-items: center; }

/* ---------- posts ---------- */
html[data-ui="ig"] .igcard { background: none; border: 0; border-radius: 0; overflow: visible; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
html[data-ui="ig"] #feed.stack > * + * { margin-top: 18px; }
html[data-ui="ig"] .igcard > header { padding: 6px 0 10px; gap: 10px; }
html[data-ui="ig"] .igcard .who { font-size: 14px; }
html[data-ui="ig"] .igcard .who .when { font-size: 14px; }
html[data-ui="ig"] .igcard .carousel { border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
html[data-ui="ig"] .igcard .carousel .slide { max-height: 585px; object-fit: cover; }
html[data-ui="ig"] .igtext { border-radius: 6px; padding: 22px; background: radial-gradient(ellipse at 25% 15%, var(--wine), #1a0a12 70%); border: 1px solid var(--line); }
html[data-ui="ig"] .igquote { min-height: 180px; display: grid; place-items: center; text-align: center; font-family: Fraunces, serif; font-size: 22px;
  line-height: 1.35; white-space: pre-wrap; word-wrap: break-word; }
html[data-ui="ig"] .igtext .wtitle { padding: 0; }
html[data-ui="ig"] .igtext .wbody { padding: 0; }
html[data-ui="ig"] .igacts { display: flex; align-items: center; gap: 2px; margin: 6px 0 2px -8px; }
html[data-ui="ig"] .igacts button { width: 42px; height: 42px; padding: 0; display: grid; place-items: center; background: none; border: 0; color: var(--text); cursor: pointer; border-radius: 50%; }
html[data-ui="ig"] .igacts button svg { width: 25px; height: 25px; }
html[data-ui="ig"] .igacts button:hover { color: var(--muted); background: none; }
html[data-ui="ig"] .igacts button.on { color: var(--accent2); }
html[data-ui="ig"] .igmeta { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; font-size: 14px; line-height: 1.4; }
html[data-ui="ig"] .igcap { white-space: pre-wrap; word-wrap: break-word; }
html[data-ui="ig"] .igcap .uname { font-weight: 700; color: var(--text); }
html[data-ui="ig"] .igmore { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
html[data-ui="ig"] .igcard .comments { margin-top: 10px; border-radius: 10px; border: 1px solid var(--line); }
@media (max-width: 860px) {
  html[data-ui="ig"] .ig3 #center { padding: 0 12px; }
  html[data-ui="ig"] .igcard .carousel, html[data-ui="ig"] .igtext { margin: 0 -12px; border-radius: 0; border-left: 0; border-right: 0; }
}

/* ---------- profile ---------- */
html[data-ui="ig"] .phero { background: none; border: 0; border-radius: 0; overflow: visible; max-width: 935px; margin: 0 auto; }
html[data-ui="ig"] .phero .banner { display: none; }
html[data-ui="ig"] .phero .inner { margin-top: 0; padding: 26px 16px 18px; align-items: center; gap: 28px 64px; }
html[data-ui="ig"] .phero .inner > .ring .avatar.xl, html[data-ui="ig"] .phero .inner > .avatar.xl { width: 150px; height: 150px; }
html[data-ui="ig"] .phero h1 { font-family: Inter, sans-serif; font-size: 20px; font-weight: 400; margin-bottom: 8px; }
html[data-ui="ig"] .phero .counts { display: flex; flex-wrap: wrap; gap: 8px 30px; margin-top: 12px; font-size: 15px; }
html[data-ui="ig"] .phero .counts span, html[data-ui="ig"] .phero .counts a { cursor: pointer; }
html[data-ui="ig"] .tabs { max-width: 935px; margin: 8px auto 0; justify-content: center; gap: 40px; border-bottom: 0; border-top: 1px solid var(--line); }
html[data-ui="ig"] .tabs a { border-bottom: 0; border-top: 1px solid transparent; margin-top: -1px; padding: 14px 2px; font-size: 12px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; }
html[data-ui="ig"] .tabs a.on { border-top-color: var(--text); }
html[data-ui="ig"] #tab { max-width: 935px; margin: 0 auto; }
html[data-ui="ig"] .photos.iggrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
html[data-ui="ig"] .photos.iggrid .ph { aspect-ratio: 1 / 1; border-radius: 0; }
html[data-ui="ig"] .photos.iggrid .meta { inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); font-size: 15px; font-weight: 700; opacity: 0; transition: opacity .15s; }
html[data-ui="ig"] .photos.iggrid .ph:hover .meta { opacity: 1; }
@media (max-width: 860px) {
  html[data-ui="ig"] .phero .inner { gap: 18px 24px; padding: 18px 16px 12px; }
  html[data-ui="ig"] .phero .inner > .ring .avatar.xl, html[data-ui="ig"] .phero .inner > .avatar.xl { width: 86px; height: 86px; font-size: 34px; }
  html[data-ui="ig"] .tabs { gap: 22px; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; padding: 0 12px; }
  html[data-ui="ig"] .tabs a { white-space: nowrap; flex: none; }
  html[data-ui="ig"] .photos.iggrid { gap: 2px; }
  html[data-ui="ig"] #tab .l2, html[data-ui="ig"] #tab > .stack, html[data-ui="ig"] #tab > .grid { padding: 12px; }
}

