/* ============================================================================
   TERRA FIRMA — INSTAGRAM PHONE-FRAME FEED
   Self-contained, namespaced .tf-ig-*. Inherits the site tokens (--ink etc).
   The phone screen itself is genuine Instagram styling on purpose.
   ============================================================================ */

/* ---- section layout (matches the editorial two-column pattern) --------- */
.insta-sec .insta-wrap{
  display:grid; grid-template-columns:repeat(12,1fr);
  gap:clamp(16px,3vw,48px); align-items:center;
}
.insta-copy{ grid-column:1 / span 5; }
.insta-copy h2{ font-size:clamp(34px,4.6vw,76px); margin-top:18px; line-height:1.02; }
.insta-copy .body-col{ margin-top:22px; }
.insta-handle{
  display:inline-flex; align-items:center; gap:10px; margin-top:26px;
  font:500 14px/1 var(--font-m); letter-spacing:.02em; color:var(--bone);
}
.insta-handle .ig-glyph{
  width:26px; height:26px; display:inline-grid; place-items:center;
  border:1px solid var(--line-bone); border-radius:8px; color:var(--bone);
}
.insta-handle .ig-glyph svg{ width:15px; height:15px; }
.insta-stage{ grid-column:7 / span 6; display:flex; justify-content:center; }

/* ---- phone shell ------------------------------------------------------- */
#tf-ig{
  --w: clamp(280px, 30vw, 340px);
  width:var(--w);
  aspect-ratio: 9 / 19.5;
  position:relative;
  border-radius: 44px;
  padding: 11px;
  background: linear-gradient(150deg,#2a2a2e,#0c0c0e 60%);
  box-shadow:
    0 2px 0 rgba(255,255,255,.06) inset,
    0 50px 90px -30px rgba(0,0,0,.7),
    0 0 0 2px rgba(0,0,0,.5);
}
#tf-ig::before{ /* side buttons */
  content:""; position:absolute; left:-3px; top:23%; width:3px; height:8%;
  border-radius:3px 0 0 3px; background:#1a1a1d;
  box-shadow:0 14% 0 #1a1a1d, 0 0 0 #1a1a1d;
}

/* ---- screen ------------------------------------------------------------ */
.tf-ig-screen{
  position:relative; width:100%; height:100%; overflow:hidden;
  border-radius: 34px; background:#fff; color:#000;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  display:flex; flex-direction:column;
  isolation:isolate;
}

/* status bar */
.tf-ig-statusbar{
  flex:0 0 auto; height:34px; padding:0 20px 0 24px;
  display:flex; align-items:center; justify-content:space-between;
  font-size:13px; font-weight:600; color:#000;
}
/* iOS-style status icons — proper SVG signal/wifi + HTML battery with % inside */
.tf-ig-statusbar .tf-ig-sysicons{ display:inline-flex; gap:5px; align-items:center; color:#000; }
.tf-ig-sig, .tf-ig-wifi{ fill:#000; display:block; }
.tf-ig-sig{ width:17px; height:11px; }
.tf-ig-wifi{ width:15px; height:11px; margin-top:1px; }

/* Battery — solid black pill with bold white "86" inside, black tip */
.tf-ig-batt{ display:inline-flex; align-items:center; gap:1.4px; margin-left:1px; }
.tf-ig-batt-body{
  position:relative; width:28px; height:14px;
  background:#000;
  border:1.4px solid #000; border-radius:4.5px;
  box-sizing:border-box; overflow:hidden;
}
.tf-ig-batt-fill{ display:none; }
.tf-ig-batt-pct{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  font:700 9px/1 -apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",sans-serif;
  font-variant-numeric:tabular-nums; letter-spacing:-.02em;
  color:#fff;
}
.tf-ig-batt-tip{
  width:2px; height:6px;
  background:#000; border-radius:0 2px 2px 0;
}

/* app top bar */
.tf-ig-topbar{
  flex:0 0 auto; height:44px; padding:0 14px;
  display:flex; align-items:center; justify-content:space-between;
  border-bottom:1px solid #efefef;
}
.tf-ig-tb-user{ font-size:17px; font-weight:700; display:inline-flex; align-items:center; gap:5px; }
.tf-ig-ver{ width:13px; height:13px; border-radius:50%; background:#3897f0; display:inline-block;
  -webkit-mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z' fill='black'/></svg>") center/120% no-repeat;
  mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z' fill='black'/></svg>") center/120% no-repeat; }
.tf-ig-tb-actions svg{ width:22px; height:22px; }

/* scroll area */
.tf-ig-scroll{
  flex:1 1 auto; overflow-y:auto; overflow-x:hidden;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.tf-ig-scroll::-webkit-scrollbar{ width:0; height:0; }

/* profile header */
.tf-ig-profile{ padding:16px 16px 6px; }
.tf-ig-prow{ display:flex; align-items:center; gap:20px; }
.tf-ig-avatar{ position:relative; width:74px; height:74px; flex:0 0 auto; }
.tf-ig-avatar .tf-ig-ring{
  position:absolute; inset:-3px; border-radius:50%;
  background:conic-gradient(from 20deg,#f9ce34,#ee2a7b,#6228d7,#f9ce34);
}
.tf-ig-avatar img{
  position:absolute; inset:0; width:100%; height:100%; border-radius:50%;
  object-fit:cover; border:3px solid #fff;
}
.tf-ig-counts{ flex:1 1 auto; display:flex; justify-content:space-around; text-align:center; }
.tf-ig-counts div{ display:flex; flex-direction:column; gap:1px; }
.tf-ig-counts b{ font-size:16px; font-weight:700; }
.tf-ig-counts span{ font-size:12.5px; color:#262626; }

.tf-ig-bio{ margin-top:11px; font-size:13px; line-height:1.45; color:#262626; }
.tf-ig-fullname{ font-weight:700; }
.tf-ig-bio > div + div{ margin-top:0; }
.tf-ig-link{ color:#00376b; text-decoration:none; font-weight:500; }
.tf-ig-link:hover{ text-decoration:underline; }

.tf-ig-cta{ display:flex; gap:7px; margin-top:14px; }
.tf-ig-cta a{
  flex:1 1 auto; text-align:center; padding:7px 0; border-radius:9px;
  font-size:14px; font-weight:600; text-decoration:none; cursor:pointer;
}
.tf-ig-follow{ background:#0095f6; color:#fff; }
.tf-ig-follow:hover{ background:#1aa0f7; }
.tf-ig-msg{ background:#efefef; color:#000; }
.tf-ig-msg:hover{ background:#e3e3e3; }

/* tabs */
.tf-ig-tabs{
  display:flex; margin-top:14px; border-top:1px solid #dbdbdb;
}
.tf-ig-tabs span{
  flex:1; display:grid; place-items:center; height:42px; color:#8e8e8e;
  border-top:1px solid transparent; margin-top:-1px; cursor:pointer;
  transition:color .15s;
}
.tf-ig-tabs span:hover{ color:#262626; }
.tf-ig-tabs span.is-on{ color:#000; border-top-color:#000; }
.tf-ig-tabs svg{ width:22px; height:22px; }

/* grid */
.tf-ig-grid{
  display:grid; grid-template-columns:repeat(3,1fr); gap:2px;
  padding-bottom:8px;
}
.tf-ig-cell{
  position:relative; aspect-ratio:1/1; padding:0; border:0; cursor:pointer;
  background:#f0f0f0; overflow:hidden;
}
.tf-ig-cell img{ width:100%; height:100%; object-fit:cover; display:block;
  transition:transform .45s cubic-bezier(.2,.7,.2,1); }
.tf-ig-cell:hover img{ transform:scale(1.06); }
.tf-ig-cell-poster{ display:none; }   /* shown only on the reels tab */

/* ---- Reels tab: 9:16 portrait cells, reels only ----------------------- */
.tf-ig-grid.is-reels .tf-ig-cell{ aspect-ratio:9/16; }
.tf-ig-grid.is-reels .tf-ig-cell:not(.is-reel){ display:none; }
.tf-ig-grid.is-reels .tf-ig-cell-thumb{ display:none; }
.tf-ig-grid.is-reels .tf-ig-cell-poster{ display:block; width:100%; height:100%; object-fit:cover; }
/* In reels mode, hide the pin badge (IG doesn't show pin on reels tab) but keep the play badge */
.tf-ig-grid.is-reels .tf-ig-pin{ display:none; }
.tf-ig-badge{ position:absolute; top:6px; right:6px; filter:drop-shadow(0 1px 2px rgba(0,0,0,.5)); pointer-events:none; }
.tf-ig-badge svg{ width:18px; height:18px; }
.tf-ig-pin{ position:absolute; top:6px; left:6px; width:18px; height:18px; display:grid; place-items:center;
  filter:drop-shadow(0 1px 2px rgba(0,0,0,.55)); pointer-events:none; }
.tf-ig-pin svg{ width:16px; height:16px; }

/* reel view count — bottom-left of the tile, only on the Reels tab (IG style) */
.tf-ig-views{
  position:absolute; left:7px; bottom:6px; display:none; align-items:center; gap:3px;
  color:#fff; font-size:12px; font-weight:600; letter-spacing:.01em;
  text-shadow:0 1px 3px rgba(0,0,0,.55); pointer-events:none; z-index:2;
}
.tf-ig-views svg{ width:13px; height:13px; filter:drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.tf-ig-grid.is-reels .tf-ig-cell.is-reel .tf-ig-views{ display:flex; }

/* "visit the profile" footer under the grid */
.tf-ig-more{
  display:flex; align-items:center; justify-content:center; gap:7px;
  padding:18px 16px 26px; text-decoration:none;
  font-size:13px; font-weight:600; color:#0095f6;
  border-top:1px solid #efefef; margin-top:2px;
}
.tf-ig-more span{ font-weight:400; }
.tf-ig-more:hover{ color:#1aa0f7; }

/* hover hint */
.tf-ig-hint{
  position:absolute; left:50%; bottom:10px; transform:translateX(-50%);
  background:rgba(0,0,0,.62); color:#fff; font-size:11px; letter-spacing:.02em;
  padding:5px 11px; border-radius:20px; pointer-events:none; z-index:5;
  opacity:0; transition:opacity .3s; white-space:nowrap; backdrop-filter:blur(4px);
}
#tf-ig:hover .tf-ig-hint{ opacity:1; }
.tf-ig-viewer.is-open ~ .tf-ig-hint, .tf-ig-screen:has(.tf-ig-viewer.is-open) .tf-ig-hint{ opacity:0; }

/* ---- post viewer (overlays the screen) -------------------------------- */
.tf-ig-viewer{
  position:absolute; inset:0; z-index:10; background:#fff; color:#000;
  display:flex; flex-direction:column;
  transform:translateX(100%); transition:transform .32s cubic-bezier(.2,.7,.2,1);
  visibility:hidden;
}
.tf-ig-viewer.is-open{ transform:none; visibility:visible; }

.tf-ig-vhead{
  flex:0 0 auto; height:48px; padding:0 8px; display:flex; align-items:center;
  gap:8px; border-bottom:1px solid #efefef;
}
.tf-ig-vhead button{ background:none; border:0; padding:6px; cursor:pointer; color:#000; display:grid; place-items:center; }
.tf-ig-vhead svg{ width:22px; height:22px; }
.tf-ig-vclose{ margin-left:auto; }
.tf-ig-vuser{ display:flex; align-items:center; gap:9px; font-size:14px; font-weight:600; }
.tf-ig-vuser img{ width:30px; height:30px; border-radius:50%; object-fit:cover; }

.tf-ig-vmedia{
  position:relative; width:100%; background:#000; flex:0 0 auto;
  aspect-ratio:var(--ar,1/1); max-height:64%; overflow:hidden;
}
.tf-ig-slides{ width:100%; height:100%; }
.tf-ig-slide{
  position:absolute; inset:0; width:100%; height:100%; object-fit:cover;
  opacity:0; transition:opacity .25s;
}
.tf-ig-slide.is-on{ opacity:1; }
.tf-ig-video{ width:100%; height:100%; object-fit:cover; background:#000; }

.tf-ig-reelph{ position:relative; width:100%; height:100%; }
.tf-ig-reelph img{ width:100%; height:100%; object-fit:cover; filter:brightness(.72); }
.tf-ig-playbig{ position:absolute; inset:0; margin:auto; width:62px; height:62px;
  display:grid; place-items:center; color:#fff; }
.tf-ig-playbig svg{ width:46px; height:46px; filter:drop-shadow(0 2px 8px rgba(0,0,0,.6)); }
.tf-ig-reelnote{ position:absolute; left:0; right:0; bottom:14px; text-align:center;
  color:#fff; font-size:11px; letter-spacing:.03em; opacity:.85; }

/* carousel nav */
.tf-ig-nav{
  position:absolute; top:50%; transform:translateY(-50%); width:30px; height:30px;
  border:0; border-radius:50%; background:rgba(255,255,255,.85); cursor:pointer;
  display:grid; place-items:center; color:#222; box-shadow:0 1px 4px rgba(0,0,0,.25);
  transition:opacity .2s;
}
.tf-ig-nav svg{ width:16px; height:16px; }
.tf-ig-nav.prev{ left:8px; }
.tf-ig-nav.next{ right:8px; }
.tf-ig-nav.next svg{ transform:scaleX(-1); }
.tf-ig-nav.is-hidden{ opacity:0; pointer-events:none; }
.tf-ig-dots{ position:absolute; left:0; right:0; bottom:10px; display:flex; justify-content:center; gap:5px; }
.tf-ig-dots i{ width:6px; height:6px; border-radius:50%; background:rgba(255,255,255,.55); transition:background .2s,transform .2s; }
.tf-ig-dots i.is-on{ background:#0095f6; transform:scale(1.15); }
.tf-ig-count{ position:absolute; top:10px; right:10px; background:rgba(0,0,0,.6); color:#fff;
  font-size:12px; font-weight:600; padding:3px 9px; border-radius:14px; }

/* double-tap heart pop */
.tf-ig-vmedia.tf-ig-pop::after{
  content:""; position:absolute; inset:0; margin:auto; width:84px; height:84px;
  background:#fff;
  -webkit-mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 21 3 12.3a5 5 0 1 1 7.1-7L12 7l1.9-1.7a5 5 0 1 1 7.1 7z' fill='black'/></svg>") center/contain no-repeat;
  mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 21 3 12.3a5 5 0 1 1 7.1-7L12 7l1.9-1.7a5 5 0 1 1 7.1 7z' fill='black'/></svg>") center/contain no-repeat;
  opacity:0; animation:tfIgPop .9s ease;
  filter:drop-shadow(0 3px 8px rgba(0,0,0,.4));
}
@keyframes tfIgPop{ 0%{opacity:0;transform:scale(.3)} 15%{opacity:.95;transform:scale(1.1)} 30%{transform:scale(.95)} 45%{transform:scale(1)} 80%{opacity:.95} 100%{opacity:0;transform:scale(1)} }

/* viewer actions + body */
.tf-ig-vactions{
  flex:0 0 auto; display:flex; align-items:center; gap:14px; padding:11px 14px 4px; color:#000;
}
.tf-ig-vactions span{ cursor:pointer; display:grid; place-items:center; }
.tf-ig-vactions svg{ width:24px; height:24px; }
.tf-ig-vactions .tf-ig-vsave{ margin-left:auto; }
.tf-ig-vactions span:first-child:active svg{ fill:#ed4956; stroke:#ed4956; }

.tf-ig-vbody{ flex:1 1 auto; overflow-y:auto; padding:2px 14px 16px; font-size:13.5px; line-height:1.5; color:#000; scrollbar-width:none; }
.tf-ig-vbody::-webkit-scrollbar{ width:0; }
.tf-ig-vviews{ font-weight:600; margin-bottom:3px; }
.tf-ig-vlikes{ font-weight:600; margin-bottom:4px; }
.tf-ig-vcap b{ font-weight:600; margin-right:4px; }
.tf-ig-vdate{ margin-top:8px; font-size:11px; letter-spacing:.04em; text-transform:uppercase; color:#8e8e8e; }
.tf-ig-vlink{ display:inline-block; margin-top:10px; color:#0095f6; font-weight:600; text-decoration:none; font-size:13px; }
.tf-ig-vlink:hover{ text-decoration:underline; }

/* ---- responsive: stack on narrow screens ------------------------------ */
@media (max-width: 900px){
  .insta-sec .insta-wrap{ grid-template-columns:1fr; gap:40px; }
  .insta-copy{ grid-column:1 / -1; }
  .insta-stage{ grid-column:1 / -1; }
  #tf-ig{ --w: min(320px, 78vw); }
}

@media (hover:none){
  .tf-ig-hint{ opacity:1; }
}
