/* The feed.

   The only dark, full-bleed, edge-to-edge screen in a game made of warm paper
   and drawn scenes — on purpose. It is a phone inside the phone, and it should
   feel like she picked up a different device. Everything paper-coloured in
   here belongs to the door, which is still part of the game; everything past
   the door is black.

   Loaded after hub.css so it can take back the padding .screen adds. */

/* ---------------------------------------------------------------- the door */

.screen.tt-gate-screen {
  padding: max(18px, var(--safe-top, 0px)) 18px max(18px, var(--safe-bottom, 0px));
  align-items: flex-start;
}

.tt-gate {
  width: min(30rem, 100%);
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.tt-gate-head { display: flex; justify-content: flex-start; }

.tt-gate-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 30px 24px 26px;
  border: 1.5px solid rgba(69, 48, 38, .2);
  border-radius: 20px;
  background: linear-gradient(180deg, #fffaf0, #f3e4c6);
  box-shadow: var(--shadow-card);
  text-align: center;
}
.tt-gate-card h1 { margin: 0; font-size: 1.5rem; }
.tt-gate-lede { margin: 0; color: var(--ink-soft); font-size: .94rem; }
.tt-gate-kicker { margin: 0; color: var(--seal); }

.tt-gate-lock { width: 42px; height: 42px; opacity: .8; }
.tt-gate-lock .pot-icon { width: 100%; height: 100%; }

.tt-key {
  width: min(15rem, 100%);
  margin-top: 6px;
  padding: 12px 16px;
  border: 1.5px solid rgba(69, 48, 38, .28);
  border-radius: 999px;
  background: #fffdf6;
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.15rem;
  letter-spacing: .3em;
  text-align: center;
}
.tt-key:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.tt-gate-hint { margin: 0; color: var(--ink-soft); opacity: .8; }
.tt-gate-message { margin: 0; min-height: 1.3em; color: var(--seal); }

.tt-gate-card.wrong { animation: ttShake .42s ease; }
@keyframes ttShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  45% { transform: translateX(7px); }
  70% { transform: translateX(-4px); }
}
.tt-gate-card.opening { transition: transform .6s ease, opacity .6s ease; transform: scale(1.04); opacity: 0; }

/* ---------------------------------------------------------------- the feed */

.screen.tt-screen { padding: 0; align-items: stretch; justify-content: stretch; }
body.feed-mode #mute,
body.feed-mode #musicBtn { display: none; }

.tt-page {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
}

.tt-head {
  position: absolute;
  z-index: 6;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(10px, var(--safe-top, 0px)) 14px 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .55), transparent);
  pointer-events: none;
}
.tt-head .nav-back { pointer-events: auto; }

.tt-tabs { display: flex; gap: 16px; margin-left: auto; margin-right: 4px; }
.tt-tab {
  color: rgba(255, 255, 255, .55);
  font-family: var(--body);
  font-size: .95rem;
  font-weight: 600;
  padding-bottom: 4px;
}
.tt-tab.is-on { color: #fff; border-bottom: 2px solid #fff; }

/* the scroller: one post per screen, snapping */
.tt-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tt-feed::-webkit-scrollbar { display: none; }
.tt-feed:focus-visible { outline: 3px solid var(--amber); outline-offset: -3px; }

.tt-slide {
  position: relative;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #000;
}

.tt-media { position: absolute; inset: 0; }
.tt-poster,
.tt-video,
.tt-blur {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
/* Phone-shaped: fill the screen and lose the edges. Anything else: show the
   whole picture, with a blurred copy of it filling in behind. */
.tt-media.is-cover .tt-poster,
.tt-media.is-cover .tt-video { object-fit: cover; }
.tt-media.is-contain .tt-poster,
.tt-media.is-contain .tt-video { object-fit: contain; }
.tt-blur {
  object-fit: cover;
  filter: blur(26px) saturate(1.3) brightness(.72);
  transform: scale(1.16);
}
/* The clip covers its own poster once it is running, so the swap is invisible
   rather than a flash of black between the two. */
.tt-video { opacity: 0; transition: opacity .25s ease; }
.tt-slide.is-playing .tt-video { opacity: 1; }

.tt-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .42) 0%, transparent 22%),
    linear-gradient(0deg, rgba(0, 0, 0, .62) 0%, transparent 34%);
}

/* --- the words along the bottom --- */

.tt-meta {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 4;
  width: min(74%, 30rem);
  padding: 0 14px max(18px, var(--safe-bottom, 0px)) max(16px, var(--safe-left, 0px));
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}
.tt-handle { margin: 0 0 5px; font-family: var(--body); font-weight: 700; font-size: 1.02rem; }
.tt-caption { margin: 0 0 8px; font-size: .95rem; line-height: 1.4; }
.tt-track {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .84rem;
  opacity: .9;
  white-space: nowrap;
  overflow: hidden;
}
.tt-track .pot-icon-inline { width: 1em; height: 1em; margin: 0; flex: none; }
.tt-track-text { overflow: hidden; text-overflow: ellipsis; }

/* --- the rail down the right --- */

.tt-rail {
  position: absolute;
  right: max(8px, var(--safe-right, 0px));
  bottom: max(22px, var(--safe-bottom, 0px));
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.tt-avatar,
.tt-comment-face {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--tint, #c71f45);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
.tt-avatar .pot-icon { width: 26px; height: 26px; }

.tt-act {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: none;
  background: none;
  color: #fff;
  font-family: var(--body);
  cursor: pointer;
}
.tt-act-mark { display: block; width: 34px; height: 34px; filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .5)); }
.tt-act-mark .pot-icon { width: 100%; height: 100%; }
.tt-count { font-size: .78rem; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }

.tt-like .tt-act-mark { color: #fff; transition: transform .18s ease; }
.tt-like .tt-act-mark .pot-icon path { fill: rgba(255, 255, 255, .92); }
.tt-like.is-liked .tt-act-mark .pot-icon path { fill: #e8265c; }
.tt-like.is-liked .tt-act-mark { animation: ttThump .42s ease; }
@keyframes ttThump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.tt-comment .tt-act-mark { color: #fff; }

.tt-disc {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #4a4a4a 0 26%, #141414 27%, #2a2a2a 100%);
  border: 1px solid rgba(255, 255, 255, .18);
  animation: ttSpin 4.5s linear infinite;
}
.tt-disc .pot-icon { width: 18px; height: 18px; color: #fff; }
@keyframes ttSpin { to { transform: rotate(360deg); } }

.tt-sound {
  position: absolute;
  z-index: 5;
  right: max(12px, var(--safe-right, 0px));
  top: max(64px, calc(var(--safe-top, 0px) + 58px));
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  cursor: pointer;
}
.tt-sound .pot-icon { width: 20px; height: 20px; }

/* the heart that lands where she tapped */
.tt-pop {
  position: fixed;
  z-index: 90;
  width: 96px;
  height: 96px;
  margin: -48px 0 0 -48px;
  pointer-events: none;
  color: #e8265c;
  animation: ttPop .9s cubic-bezier(.2, .9, .3, 1) forwards;
}
.tt-pop .pot-icon { width: 100%; height: 100%; }
.tt-pop .pot-icon path { fill: #e8265c; }
@keyframes ttPop {
  0% { transform: scale(.3) rotate(-14deg); opacity: 0; }
  35% { transform: scale(1.15) rotate(6deg); opacity: 1; }
  100% { transform: scale(1.5) translateY(-40px) rotate(10deg); opacity: 0; }
}

.tt-empty {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 32px;
  color: rgba(255, 255, 255, .7);
  text-align: center;
}

/* ------------------------------------------------------------ the comments */

.tt-veil {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, .45);
  opacity: 0;
  transition: opacity .28s ease;
}
.tt-veil.show { opacity: 1; }

.tt-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 74%;
  display: flex;
  flex-direction: column;
  border-radius: 18px 18px 0 0;
  background: #16151a;
  color: #fff;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2, .8, .3, 1);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .5);
}
.tt-veil.show .tt-sheet { transform: translateY(0); }

.tt-sheet-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.tt-sheet-head h2 { margin: 0; font-size: .98rem; font-weight: 600; }
.tt-sheet-grab {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 38px;
  height: 4px;
  margin-left: -19px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .28);
}
.tt-sheet-close {
  position: absolute;
  right: 10px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.tt-comment-list {
  flex: 1;
  min-height: 5rem;
  overflow-y: auto;
  padding: 14px 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tt-comment-empty { margin: 12px 0; color: rgba(255, 255, 255, .55); text-align: center; }

.tt-comment-row { position: relative; display: flex; gap: 10px; align-items: flex-start; }
.tt-comment-face { width: 34px; height: 34px; border-width: 1.5px; flex: none; }
.tt-comment-face .pot-icon { width: 19px; height: 19px; }
.tt-comment-body { flex: 1; min-width: 0; }
.tt-comment-who { margin: 0 0 2px; font-size: .78rem; color: rgba(255, 255, 255, .55); font-weight: 600; }
.tt-comment-text { margin: 0; font-size: .95rem; line-height: 1.4; overflow-wrap: anywhere; }
.tt-comment-drop {
  flex: none;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, .35);
  cursor: pointer;
}
.tt-comment-drop:hover { color: #e8265c; background: rgba(255, 255, 255, .07); }

.tt-comment-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px max(12px, var(--safe-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, .1);
}
.tt-comment-input {
  flex: 1;
  min-width: 0;
  padding: 11px 15px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-family: var(--body);
  font-size: 1rem;
}
.tt-comment-input::placeholder { color: rgba(255, 255, 255, .4); }
.tt-comment-input:focus-visible { outline: 2px solid var(--amber); }
.tt-comment-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: #e8265c;
  color: #fff;
  cursor: pointer;
}
.tt-comment-send .pot-icon { width: 21px; height: 21px; }

/* ----------------------------------------------------------- the hub's way in */

.hub-feed {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 18px 9px 11px;
  border: 1.5px solid rgba(69, 48, 38, .2);
  border-radius: 999px;
  background: linear-gradient(180deg, #1f1d24, #35313d);
  color: #fff6e2;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, box-shadow .18s ease;
}
.hub-feed:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.hub-feed-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: #e8265c;
}
.hub-feed-icon .pot-icon { width: 20px; height: 20px; color: #fff; }
.hub-feed strong { display: block; font-size: .98rem; }
.hub-feed small { display: block; color: rgba(255, 246, 226, .62); font-size: .74rem; }

/* --------------------------------------------------------------- narrower */

@media (max-width: 560px) {
  .tt-meta { width: min(70%, 24rem); }
  .tt-avatar { width: 42px; height: 42px; }
  .tt-rail { gap: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .tt-disc { animation: none; }
  .tt-pop { animation-duration: .5s; }
  .tt-like.is-liked .tt-act-mark { animation: none; }
  .tt-sheet { transition: none; }
}
