*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --page-bg: #DDD8CE;
  --card-w: 300px;
  --tape: rgba(155, 170, 176, 0.78);
  --tape-border: rgba(125, 140, 148, 0.45);
}

body {
  background: var(--page-bg);
  min-height: 100vh;
  padding: 64px 32px 100px;
  font-family: 'DM Sans', sans-serif;
}

/* ── PAGE HEADER ── */
.page-header {
  text-align: left;
  max-width: 680px;
  margin: 0 auto 64px;
}
.page-header h1 {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 38px;
  line-height: 44px;
  font-weight: 700;
  color: #3D3530;
}
.page-header p {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 30px;
  line-height: 36px;
  font-weight: 400;
  color: #8a8279;
  margin-top: 12px;
  text-transform: none;
  letter-spacing: normal;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.page-header p.visible { opacity: 1; }

/* ── SHARE BUTTONS ── */
.share-links {
  display: flex;
  gap: 14px;
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  align-items: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.share-links.visible { opacity: 1; }

.share-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a8279;
  text-decoration: none;
  transition: color 0.2s, opacity 0.2s;
}

.share-links a:hover {
  color: #3D3530;
}

.copy-link {
  position: relative;
  cursor: pointer;
}

.copy-link .tooltip {
  display: none;
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: #3D3530;
  color: #fff;
  font-size: 12px;
  font-family: system-ui, -apple-system, sans-serif;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.copy-link.copied .tooltip {
  display: block;
}

/* ── LINK PREVIEW ── */
.lp {
  color: #3D3530;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1.5px dashed rgba(61,53,48,0.4);
  padding-bottom: 1px;
  position: relative;
}

#lp-card {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  width: 220px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(50,45,40,0.18), 0 2px 8px rgba(50,45,40,0.10);
  border: 1px solid rgba(100,90,80,0.15);
  background: #e8e3d8;
  opacity: 0;
  transform: scale(0.92) translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}
#lp-card.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}
#lp-card img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
}

/* ── MASONRY ── */
.masonry {
  columns: 3 var(--card-w);
  column-gap: 52px;
  width: 100%;
  max-width: calc(3 * var(--card-w) + 2 * 52px);
  margin: 0 auto;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.masonry.ready { opacity: 1; }

/* ── SHARED POLAROID BASE ── */
.pol {
  break-inside: avoid;
  display: inline-block;
  width: 100%;
  position: relative;
  padding: 36px 14px 44px;
  margin-bottom: 52px;
  opacity: 0;
  transition: transform 0.28s ease, box-shadow 0.28s ease, opacity 0.4s ease;
}
.pol.rendered { opacity: 1; }

.pol:hover {
  transform: rotate(0deg) translateY(-5px) scale(1.02) !important;
  z-index: 20;
  position: relative;
}

/* tape */
.pol::before {
  content: '';
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%) rotate(-0.5deg);
  width: 54px;
  height: 22px;
  background: var(--tape);
  border: 1px solid var(--tape-border);
  background-image: repeating-linear-gradient(
    108deg,
    transparent, transparent 3px,
    rgba(255,255,255,0.15) 3px,
    rgba(255,255,255,0.15) 4px
  );
  box-shadow: 0 1px 3px rgba(60,58,80,0.1), inset 0 1px 0 rgba(255,255,255,0.22);
  z-index: 10;
}

/* caption strip at bottom */
.pol__caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 5px 14px 11px;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: #aaa;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

/* ── LOADING STATE ── */
.tweet-loading {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: #bbb;
  text-transform: uppercase;
}

.tweet-error {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: #c09090;
  text-align: center;
  padding: 16px 0;
  letter-spacing: 0.06em;
}

/* ── TWITTER WIDGET CONTAINER ──
   Twitter's widget.js injects an <iframe> that sizes itself.
   We constrain it so it fits inside the card without overflowing.
── */
.tweet-widget-wrap {
  width: 100%;
}

.tweet-widget-wrap iframe {
  max-width: 100% !important;
  width: 100% !important;
  border-radius: 4px;
}

.tweet-widget-wrap .twitter-tweet {
  margin: 0 !important;
}

/* ── YOUTUBE oEmbed (16:9) ── */
.tweet-widget-wrap--youtube {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  background: #111;
}

.tweet-widget-wrap--youtube iframe {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  border: 0;
  border-radius: 4px;
}

/* ── TIKTOK oEmbed ── */
.tweet-widget-wrap--tiktok .tiktok-embed {
  margin: 0 !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.tweet-widget-wrap--tiktok iframe {
  max-width: 100% !important;
  width: 100% !important;
  border-radius: 4px;
}

/* ── CARD COLOR VARIANTS ── */
.pol--essay {
  background: #e8e3d8;
  box-shadow: 0 5px 10px -2px rgba(50,45,70,0.16), 0 16px 36px -6px rgba(50,45,70,0.12);
}

.pol--oneliner {
  background: #dde0ea;
  box-shadow: 0 4px 8px -2px rgba(50,45,70,0.14), 0 10px 24px -4px rgba(50,45,70,0.10);
}

.pol--civic {
  background: #dce2e8;
  box-shadow: 0 4px 10px -3px rgba(40,55,70,0.15), 0 14px 32px -6px rgba(40,55,70,0.10);
}

.pol--photo {
  background: #d6d8e0;
  box-shadow: 0 5px 12px -3px rgba(50,45,70,0.17), 0 18px 40px -8px rgba(50,45,70,0.12);
}

.pol--quote {
  background: #e0dcea;
  box-shadow: 0 4px 10px -3px rgba(50,40,70,0.14), 0 14px 30px -6px rgba(50,40,70,0.10);
}

.pol--toronto-warm {
  background: #e4ddd0;
  box-shadow: 0 4px 8px -2px rgba(70,55,40,0.14), 0 10px 24px -4px rgba(70,55,40,0.10);
}
.pol--toronto-warm::before { background: rgba(210,195,175,0.82); border-color: rgba(180,160,130,0.5); }

.pol--toronto-green {
  background: #cdd4d0;
  box-shadow: 0 5px 12px -3px rgba(30,50,40,0.17), 0 18px 40px -8px rgba(30,50,40,0.12);
}
.pol--toronto-green::before { background: rgba(180,200,190,0.82); border-color: rgba(140,170,155,0.5); }

.pol--toronto-blue {
  background: #dce4e8;
  box-shadow: 0 4px 10px -3px rgba(30,50,65,0.14), 0 14px 30px -6px rgba(30,50,65,0.10);
}
.pol--toronto-blue::before { background: rgba(185,205,215,0.82); border-color: rgba(150,175,190,0.5); }

/* ── TYPEWRITER CURSOR ── */
.typewriter-cursor {
  display: inline-block;
  animation: blink 0.7s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── MOBILE ── */
@media (max-width: 540px) {
  body { padding: 40px 20px 80px; }
  .page-header p {
    font-size: 20px;
    line-height: 26px;
    max-width: 100%;
  }
  #lp-card { display: none; }
  .masonry {
    columns: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .pol {
    display: block;
    margin-left: auto;
    margin-right: auto;
  }
}
