/* =========================================================
   Tokens
   ========================================================= */
:root {
  --bg: #f4ece1;
  --surface: #eadfcf;
  --surface-2: #dfcfb9;
  --border: #ddcdb7;
  --text: #2e2018;
  --text-2: #4a3628;
  --muted: #6f5a4b;
  --link: #9a4f2c;
  --accent: #3b2416;
  --accent-hover: #533423;
  --on-accent: #f7efe4;
  --heart: #d6334a;
  --espresso: #1d140e;
  --brand: linear-gradient(45deg, #d39a4a 0%, #b5503c 50%, #6b2d4a 100%);
  --pink: #b5503c;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-img: 16px;
  --shadow-soft: 0 6px 20px rgb(59 36 22 / 0.12);
  --shadow: 0 12px 40px rgb(59 36 22 / 0.22);
  --container: 935px;
  --gutter: 16px;

  color-scheme: light;
}

/* =========================================================
   Base
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  fill: currentColor;
  flex: none;
}

.icon--flip {
  transform: scaleX(-1);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: var(--gutter);
}

.noscript {
  text-align: center;
  color: var(--muted);
}

img.is-broken {
  visibility: hidden;
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  isolation: isolate;
  padding: clamp(56px, 12vw, 120px) var(--gutter) clamp(32px, 6vw, 56px);
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(40% 60% at 25% 30%, rgb(211 154 74 / 0.28), transparent 70%),
    radial-gradient(40% 60% at 75% 40%, rgb(181 80 60 / 0.18), transparent 70%),
    radial-gradient(30% 40% at 50% 90%, rgb(107 45 74 / 0.12), transparent 70%);
  filter: blur(20px);
}

.hero__title {
  margin: 0;
  padding: 0 0.08em 0.08em;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  font-size: clamp(3.2rem, 13vw, 8.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  background: var(--brand);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 8s ease-in-out infinite alternate;
}

.hero__sub {
  margin: 18px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(1.1rem, 3.4vw, 1.75rem);
  color: var(--muted);
}

@keyframes shimmer {
  to {
    background-position: 100% 100%;
  }
}

/* =========================================================
   Layout
   ========================================================= */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* =========================================================
   Profile
   ========================================================= */
.profile {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px 40px;
  max-width: 700px;
  margin: 0 auto;
}

.profile__avatar {
  position: relative;
  padding-top: 24px;
}

.note {
  position: absolute;
  top: -6px;
  left: 50%;
  z-index: 1;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 11px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgb(59 36 22 / 0.15);
}

.note::after {
  content: "";
  position: absolute;
  left: 22px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface-2);
}

.avatar-ring {
  --size: 150px;
  --pad: 4px;
  width: var(--size);
  height: var(--size);
  padding: var(--pad);
  border-radius: 50%;
  background: var(--brand);
}

.avatar-ring > * {
  width: 100%;
  height: 100%;
  border: var(--pad) solid var(--bg);
  border-radius: 50%;
  object-fit: cover;
}

.avatar-ring__fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6b4430, #3b2416);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  font-size: calc(var(--size) * 0.27);
}

.profile__name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile__name h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.icon--verified {
  width: 20px;
  height: 20px;
}

.profile__handle {
  margin: 4px 0 12px;
}

.stats {
  display: flex;
  gap: 20px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  font-size: 15px;
}

.bio {
  margin: 0;
  color: var(--text-2);
}

.profile__actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 600;
  transition:
    background-color 0.15s,
    transform 0.1s;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn .icon {
  width: 16px;
  height: 16px;
}

/* =========================================================
   Highlights
   ========================================================= */
.highlights {
  display: flex;
  justify-content: safe center;
  gap: 18px;
  padding: 40px 4px 28px;
  overflow-x: auto;
  scrollbar-width: none;
}

.highlights::-webkit-scrollbar {
  display: none;
}

.highlight {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 12px;
  font-weight: 600;
}

.highlight__ring {
  width: 84px;
  height: 84px;
  padding: 3px;
  border-radius: 50%;
  background: var(--surface-2);
  transition: transform 0.2s;
}

.highlight:hover .highlight__ring,
.highlight:focus-visible .highlight__ring {
  transform: scale(1.06);
  background: var(--brand);
}

.highlight img {
  width: 100%;
  height: 100%;
  border: 3px solid var(--bg);
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
}

/* =========================================================
   Tabs
   ========================================================= */
.tabs {
  display: flex;
  justify-content: center;
  gap: 60px;
  border-top: 1px solid var(--border);
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: -1px;
  padding: 16px 4px;
  border: 0;
  border-top: 1px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tab .icon {
  width: 14px;
  height: 14px;
}

.tab[aria-selected="true"] {
  color: var(--text);
  border-top-color: var(--text);
}

/* =========================================================
   Feed
   ========================================================= */
.category {
  padding: 28px 0 8px;
  scroll-margin-top: var(--gutter);
}

.category__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.category__thumb {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--pink);
}

.category__title {
  margin: 0;
  font-size: 18px;
}

.category__desc {
  margin: 2px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.tile {
  position: relative;
  aspect-ratio: 4 / 5;
  padding: 0;
  border: 0;
  border-radius: var(--radius-img);
  overflow: hidden;
  isolation: isolate; /* garante o recorte arredondado durante o zoom (Safari) */
  box-shadow: var(--shadow-soft);
  transition:
    box-shadow 0.3s,
    transform 0.3s;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgb(59 36 22 / 0.18);
}

.tile:hover img {
  transform: scale(1.04);
}

.tile__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgb(29 20 14 / 0.4);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s;
}

.tile:hover .tile__overlay,
.tile:focus-visible .tile__overlay {
  opacity: 1;
}

.liked-by {
  margin: 10px 0 0;
  font-size: 13px;
}

/* =========================================================
   Playlist
   ========================================================= */
.songs {
  margin: 0;
  padding: 20px 0;
  list-style: none;
  counter-reset: song;
}

.songs li {
  counter-increment: song;
}

.song {
  display: grid;
  grid-template-columns: 28px 48px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text);
}

.song::before {
  content: counter(song);
  color: var(--muted);
  text-align: right;
}

.song:hover {
  background: var(--surface);
  text-decoration: none;
}

.song__cover {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  object-fit: cover;
  background: var(--surface);
}

.song__cover--empty {
  display: grid;
  place-items: center;
  background: var(--brand);
  color: var(--on-accent);
}

.song__cover--empty .icon {
  width: 20px;
  height: 20px;
}

.song__meta strong {
  display: block;
}

.song__meta small {
  color: var(--muted);
}

.song__play {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #146c39;
  font-size: 12px;
  font-weight: 600;
}

.song__play .icon {
  width: 14px;
  height: 14px;
}

/* =========================================================
   Footer
   ========================================================= */
.footer {
  padding: 64px var(--gutter) 120px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.credits {
  margin-top: 12px;
}

.credits summary {
  cursor: pointer;
}

.credits ul {
  max-width: 700px;
  margin: 12px auto 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
  line-height: 1.7;
  text-align: left;
}

/* =========================================================
   Mini avatar
   ========================================================= */
.mini-avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #6b4430, #3b2416);
  color: var(--on-accent);
  font-weight: 700;
  object-fit: cover;
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--pink);
}

/* =========================================================
   Direct message
   ========================================================= */
.dm {
  position: fixed;
  right: var(--gutter);
  bottom: var(--gutter);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  font-size: 15px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.dm:hover {
  background: var(--surface-2);
}

.dm .icon {
  width: 22px;
  height: 22px;
}

.dm__badge {
  position: absolute;
  top: -4px;
  right: -2px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--heart);
  color: #fff;
  font-size: 11px;
}

.dm-card {
  position: fixed;
  right: var(--gutter);
  bottom: 84px;
  z-index: 20;
  width: min(320px, calc(100vw - 2 * var(--gutter)));
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: rise 0.25s ease;
}

.dm-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.dm-card__head time {
  margin-left: auto;
}

.bubble {
  width: fit-content;
  max-width: 90%;
  margin: 6px 0 0;
  padding: 10px 14px;
  border-radius: 18px 18px 18px 4px;
  background: var(--surface-2);
}

.bubble--accent {
  background: linear-gradient(135deg, #9a4f2c, #6b2d4a);
  color: var(--on-accent);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* =========================================================
   Modal
   ========================================================= */
.modal {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.modal[open] {
  display: grid;
  place-items: center;
}

.modal::backdrop {
  background: rgb(29 20 14 / 0.82);
}

.post {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  width: min(1000px, calc(100vw - 120px));
  max-height: calc(100vh - 80px);
  overflow: hidden;
  border-radius: 20px;
  background: var(--bg);
  box-shadow: var(--shadow);
  animation: rise 0.2s ease;
}

.post__media {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--espresso);
  user-select: none;
}

.post__media img {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 80px);
  object-fit: contain;
}

.post__pop {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 110px;
  height: 110px;
  margin: -55px 0 0 -55px;
  fill: #fff;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 20px rgb(0 0 0 / 0.4));
}

.post__pop.is-playing {
  animation: pop 0.8s ease;
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  15% {
    opacity: 0.95;
    transform: scale(1.2);
  }
  30% {
    transform: scale(0.95);
  }
  45%,
  80% {
    opacity: 0.95;
    transform: scale(1);
  }
  100% {
    opacity: 0;
  }
}

.post__side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--border);
}

.post__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.post__head .muted::before {
  content: "• ";
}

.post__caption {
  flex: 1;
  margin: 0;
  padding: 16px;
  overflow-y: auto;
}

.post__actions {
  padding: 8px 16px 16px;
  border-top: 1px solid var(--border);
}

.post__actions p {
  margin: 4px 0 0;
}

.like {
  padding: 6px 0;
  border: 0;
  background: none;
}

.like .icon {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--text);
  stroke-width: 1.8;
}

.like[aria-pressed="true"] .icon {
  fill: var(--heart);
  stroke: var(--heart);
  animation: beat 0.35s ease;
}

@keyframes beat {
  50% {
    transform: scale(1.25);
  }
}

.modal__close,
.modal__nav {
  position: fixed;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 0;
}

.modal__close {
  top: 14px;
  right: 18px;
  padding: 6px;
  background: none;
  color: #fff;
}

.modal__close .icon {
  width: 26px;
  height: 26px;
}

.modal__nav {
  top: 50%;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgb(247 239 228 / 0.9);
  color: var(--accent);
  transform: translateY(-50%);
}

.modal__nav .icon {
  width: 18px;
  height: 18px;
}

.modal__nav--prev {
  left: 20px;
}

.modal__nav--next {
  right: 20px;
}

/* =========================================================
   "Curtir tudo" burst
   ========================================================= */
.fly {
  position: fixed;
  bottom: -40px;
  z-index: 50;
  width: var(--size, 28px);
  height: var(--size, 28px);
  fill: var(--heart);
  pointer-events: none;
  animation: fly 2.4s ease-in forwards;
}

.fly:nth-child(3n) {
  fill: #d39a4a;
}

.fly:nth-child(3n + 1) {
  fill: var(--pink);
}

@keyframes fly {
  to {
    transform: translate(var(--dx), -110vh) rotate(var(--rot));
    opacity: 0;
  }
}

/* =========================================================
   Brilhos de fundo
   ========================================================= */
.sparkles {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  width: var(--size);
  height: var(--size);
  fill: var(--tone);
  opacity: 0;
  animation: twinkle var(--duration) ease-in-out var(--delay) infinite;
}

.sparkle--dot {
  border-radius: 50%;
  background: var(--tone);
  filter: blur(1px);
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.4) rotate(0deg);
  }
  50% {
    opacity: var(--opacity);
    transform: scale(1) rotate(25deg);
  }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 735px) {
  .profile {
    gap: 8px 20px;
  }

  .avatar-ring {
    --size: 88px;
    --pad: 3px;
  }

  .profile__name h2 {
    font-size: 18px;
  }

  .stats {
    gap: 14px;
    font-size: 14px;
  }

  .highlights {
    justify-content: flex-start;
    gap: 14px;
    padding-top: 28px;
  }

  .highlight__ring {
    width: 66px;
    height: 66px;
  }

  .grid {
    gap: 6px;
  }

  :root {
    --radius-img: 12px;
  }

  .tabs {
    justify-content: space-around;
    gap: 0;
  }

  .tab__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .tab .icon {
    width: 22px;
    height: 22px;
  }

  .post {
    grid-template-columns: 1fr;
    width: 100vw;
    max-height: 100dvh;
    overflow-y: auto;
    border-radius: 0;
  }

  .post__media img {
    max-height: 70vh;
  }

  .post__side {
    border-left: 0;
  }

  .modal__nav {
    top: auto;
    bottom: 18px;
    transform: none;
  }

  .dm {
    padding: 12px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .sparkle {
    opacity: calc(var(--opacity) * 0.6);
  }
}
