:root {
  --bg: #fff;
  --fg: #000;
  --muted: #737373;
  --line: #dbdbdb;
  --tile: #efefef;
  --link: #00376b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --fg: #f5f5f5; --muted: #a8a8a8; --line: #262626; --tile: #1c1c1c; --link: #e0f1ff; }
}

* { box-sizing: border-box; margin: 0; }
body { background: var(--bg); color: var(--fg); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.page { max-width: 935px; margin: 0 auto; padding: 30px 20px 60px; }

/* Profile header */
.profile {
  display: grid;
  grid-template-columns: 290px 1fr;
  grid-template-areas: "avatar meta" "avatar bio";
  align-items: start;
  padding-bottom: 44px;
}
.avatar {
  grid-area: avatar; justify-self: center;
  width: 150px; height: 150px; border-radius: 50%; object-fit: cover;
  background: var(--tile); border: 1px solid var(--line);
}
.meta { grid-area: meta; }
.username { font-size: 20px; font-weight: 400; margin-bottom: 18px; }
.stats { font-size: 16px; margin-bottom: 18px; }
.bio { grid-area: bio; line-height: 1.4; }
#bio { white-space: pre-line; }
.name { font-weight: 600; }
.link { color: var(--link); font-weight: 600; text-decoration: none; }

.tabs { border-top: 1px solid var(--line); display: flex; justify-content: center; }
.tab {
  display: flex; align-items: center; gap: 6px; height: 52px; margin-top: -1px;
  font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); border-top: 1px solid transparent;
}
.tab.active { color: var(--fg); border-top-color: var(--fg); }
.tab svg { width: 12px; height: 12px; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tile {
  position: relative; container-type: inline-size; aspect-ratio: 3 / 4; overflow: hidden;
  background: var(--tile); padding: 0; display: block;
}
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile::after { content: ""; position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity .15s; }
.tile:hover::after { opacity: .15; }
/* Cover text (post "cover"), sized in container units so it scales with the tile */
.cover {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 4cqw;
  padding: 9cqw 7cqw; text-align: center;
}
.at-top { justify-content: flex-start; }
.at-center { justify-content: center; }
.at-bottom { justify-content: flex-end; }
.h-left { align-items: flex-start; text-align: left; }
.h-right { align-items: flex-end; text-align: right; }
.cover-text {
  rotate: var(--tilt); max-width: 100%; white-space: pre-line; overflow-wrap: anywhere;
  font-size: 12cqw; line-height: 1.2; color: var(--c);
}
.cover-text span { -webkit-box-decoration-break: clone; box-decoration-break: clone; }

.cover-classic .cover-text { font-weight: 700; text-shadow: 0 .5cqw 3cqw rgba(0,0,0,.5); }
.cover-modern .cover-text {
  font-family: "Oswald", sans-serif; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; text-shadow: 0 .5cqw 3cqw rgba(0,0,0,.5);
}
.cover-neon .cover-text {
  font-family: "Tilt Neon", sans-serif; font-size: 13cqw; color: #fff;
  text-shadow: 0 0 .6cqw #fff, 0 0 2cqw var(--c), 0 0 4cqw var(--c), 0 0 8cqw var(--c), 0 0 14cqw var(--c), 0 0 20cqw var(--c);
}
.cover-typewriter .cover-text { font-family: "Courier Prime", monospace; font-weight: 700; font-size: 10cqw; line-height: 1.45; }
.cover-typewriter .cover-text span { background: var(--c); color: var(--on); padding: .1em .35em; }
.cover-strong .cover-text {
  font-family: "Anton", sans-serif; text-transform: uppercase; font-size: 13cqw; line-height: 1.35;
}
.cover-strong .cover-text span { background: var(--c); color: var(--on); padding: 0 .25em; }
.cover-script .cover-text {
  font-family: "Dancing Script", cursive; font-weight: 700; font-size: 17cqw; line-height: 1.05;
  text-shadow: 0 .5cqw 3cqw rgba(0,0,0,.5);
}
.cover-label .cover-text { font-weight: 700; font-size: 10cqw; line-height: 1.55; }
.cover-label .cover-text span { background: var(--c); color: var(--on); padding: .15em .45em; border-radius: .35em; }

/* Location sticker, like the Instagram Stories one */
.cover-where {
  display: inline-flex; align-items: center; gap: .25em; max-width: 100%;
  padding: .35em .7em .35em .5em; border-radius: .45em; background: #fff; color: #c13584;
  font-weight: 800; font-size: 6.5cqw; text-transform: uppercase; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 .5cqw 2cqw rgba(0,0,0,.25);
}
.cover-where svg { width: 1.15em; height: 1.15em; flex: none; }
.cover-where span { overflow: hidden; text-overflow: ellipsis; }
.cover-where .flag { height: .95em; width: auto; flex: none; margin-left: .15em; border-radius: .12em; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }

.tile .badge { position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; color: #fff; filter: drop-shadow(0 0 2px rgba(0,0,0,.5)); z-index: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.empty:empty { display: none; }

/* Post viewer (scrollable feed) */
.viewer { position: fixed; inset: 0; background: var(--bg); z-index: 10; display: flex; flex-direction: column; }
.viewer[hidden] { display: none; }
.viewer-bar {
  flex: none; height: 44px; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  text-align: center; font-weight: 600; font-size: 16px; border-bottom: 1px solid var(--line);
}
.back { height: 44px; display: grid; place-items: center; }
.back svg { width: 24px; height: 24px; }
.feed { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

.post { max-width: 470px; margin: 0 auto 24px; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.post-head img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.post-head .who { font-weight: 600; line-height: 1.2; }
.post-head .where { font-size: 12px; }

.carousel { position: relative; background: var(--tile); }
.slides {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  aspect-ratio: 4 / 5;
}
.slides::-webkit-scrollbar { display: none; }
.slides > * { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; display: block; }
.nav {
  position: absolute; top: 50%; translate: 0 -50%; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.85); color: #000; display: grid; place-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.nav svg { width: 14px; height: 14px; }
.nav.prev { left: 10px; } .nav.next { right: 10px; }
.nav[disabled] { display: none; }
@media (hover: none) { .nav { display: none; } }
.dots { display: flex; justify-content: center; gap: 4px; padding: 12px 0 2px; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: background .2s; }
.dots span.on { background: #0095f6; }

.post-body { padding: 10px 12px 0; line-height: 1.45; }
.caption { white-space: pre-line; overflow-wrap: anywhere; }
.caption b { font-weight: 600; margin-right: 4px; }
.caption .tag { color: var(--link); }
.date { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* Phone */
@media (max-width: 735px) {
  .page { padding: 16px 0 40px; }
  .profile {
    grid-template-columns: 86px 1fr; grid-template-areas: "avatar meta" "bio bio";
    gap: 16px 24px; padding: 0 16px 20px; align-items: center;
  }
  .avatar { width: 86px; height: 86px; }
  .username { margin-bottom: 8px; }
  .stats { margin-bottom: 0; font-size: 14px; }
  .grid { gap: 2px; }
  .post { margin-bottom: 16px; }
}
