/* /collage-templates/ — the app's Trends tab (F1) on the web: story-ring sticker rail, theme boards, story preview.
   White ground, Instrument Serif headings, the app's 3D stickers as theme identity. Loaded only on this page. */

.trend-eyebrow { color: var(--trend-label); }

/* hero: three real templates, fanned on the trend glow */
.page-art.trend-art { background: radial-gradient(60% 70% at 20% 20%, var(--glow-lilac), transparent 70%), radial-gradient(50% 60% at 85% 30%, var(--glow-pink), transparent 70%), radial-gradient(60% 60% at 60% 95%, var(--glow-peach), transparent 70%), var(--glow-ground); overflow: hidden; }
.hero-cards { position: relative; height: clamp(300px, 34vw, 430px); }
.hcard { position: absolute; top: 50%; left: 50%; width: clamp(150px, 18vw, 230px); border-radius: 18px; overflow: hidden; background: #fff; box-shadow: var(--shadow-lift); }
.hcard img { display: block; width: 100%; height: auto; }
.hcard.c1 { transform: translate(-128%, -46%) rotate(-7deg); }
.hcard.c2 { z-index: 2; width: clamp(170px, 21vw, 270px); transform: translate(-50%, -50%); }
.hcard.c3 { transform: translate(28%, -42%) rotate(6deg); }

/* sticky sticker rail (story rings) */
.rail-bar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 64px); z-index: 10; background: rgba(255,255,255,.96); border-bottom: 1px solid #efefef; box-shadow: 0 6px 12px rgba(0,0,0,.04); }
.rail-hint { margin: 0; padding-top: 10px; font-size: 13px; color: var(--ink-2); }
.rail { display: flex; gap: 14px; margin: 0; padding: 8px 2px 10px; list-style: none; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.rail::-webkit-scrollbar { display: none; }
.rail li { flex: none; scroll-snap-align: start; }
.ring { display: grid; justify-items: center; gap: 4px; width: 68px; padding: 0; border: 0; background: none; color: var(--ink-2); font: 500 12px/1.2 var(--sans); cursor: pointer; }
.ring .disc { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px var(--ink); transition: box-shadow .2s; }
.ring.seen .disc { box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px #d4d4d8; }
.ring .disc img { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0,0,0,.16)); transition: transform .2s; }
.ring:hover .disc img { transform: scale(1.08) rotate(-4deg); }
.ring .lbl { margin-top: 4px; max-width: 68px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ring[aria-current="true"] { color: var(--ink); font-weight: 700; }
.ring[aria-current="true"] .lbl::after { content: ""; display: block; width: 18px; height: 3px; margin: 3px auto 0; border-radius: 2px; background: var(--ink); }
.ring:focus-visible { outline: none; }
.ring:focus-visible .disc { box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px var(--ink), 0 0 0 7px #a000ff; }

/* moment card */
.moment { display: flex; align-items: center; gap: 14px; margin: 28px 0 8px; padding: 14px 18px; border-radius: 18px; background: #fff4e5; }
.moment-stk { width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0,0,0,.18)); }
.moment > div { flex: 1; min-width: 0; }
.moment p { margin: 0; }
.moment-t { font-weight: 700; font-size: 1.02rem; }
.moment-s { font-size: 14px; color: var(--ink-2); }
.moment-s a { color: var(--ink); }

/* theme boards: one section per theme, 2 per row on desktop */
.boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px clamp(32px, 5vw, 64px); }
.board { padding-top: 36px; scroll-margin-top: 190px; min-width: 0; }
.board.wide { grid-column: 1 / -1; }
.board-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.board-stk { width: 46px; height: 46px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0,0,0,.18)); }
.board-head > div { flex: 1; min-width: 0; }
.board-head h2 { font-size: clamp(1.7rem, 1.3rem + 1vw, 2.2rem); line-height: 1; }
.board-head p { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-2); }
.open { flex: none; padding: 6px 2px; border: 0; background: none; color: var(--ink); font: 600 14px/1 var(--sans); cursor: pointer; }
.open:hover { text-decoration: underline; text-underline-offset: 4px; }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; margin: 0; padding: 0; list-style: none; }
.board.wide .tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tile { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--cell); box-shadow: 0 2px 8px rgba(0,0,0,.08); cursor: pointer; transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s; }
.tile picture { display: contents; }
.tile img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.tile:focus-visible { outline: 3px solid #a000ff; outline-offset: 3px; }
.tile .plus { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(17,17,17,.45); color: #fff; font: 700 22px/1 var(--sans); }
.cap { margin: 8px 0 0; font-size: 13px; line-height: 1.3; }
.cap b { display: block; font-weight: 600; }
.cap span { color: var(--ink-2); font-size: 12px; }
.trends-note { margin: 40px 0 0; color: var(--ink-2); font-size: 15px; }
.trends-note .more { margin-inline-start: 6px; }
.trends-more { margin-top: 26px; }

/* story preview (native modal dialog: focus trap, Esc, inert page) */
.story { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #111; color: #fff; overflow: hidden; }
.story::backdrop { background: rgba(0,0,0,.6); }
.story-bg { position: absolute; inset: -40px; background: center / cover no-repeat; filter: blur(28px) brightness(.5); transform: scale(1.1); }
.story-in { position: relative; display: flex; flex-direction: column; gap: 12px; width: min(100%, 460px); height: 100%; margin-inline: auto; padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); box-sizing: border-box; }
.bars { display: flex; gap: 4px; }
.bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.35); }
.bars i.on { background: #fff; }
.story-head { display: flex; align-items: center; gap: 10px; }
.story-disc { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.story-disc img { width: 30px; height: 30px; object-fit: contain; }
.story-head > div { flex: 1; min-width: 0; }
.story-head p { margin: 0; }
.story-cat { font-weight: 700; font-size: 15px; }
.story-pos { font-size: 12.5px; opacity: .8; }
.story-x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255,255,255,.14); display: grid; place-items: center; cursor: pointer; }
.story-x svg, .story-prev svg, .story-next svg, .story-board svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.story-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.story-img { position: relative; width: 100%; height: 100%; }
.story-img img { position: absolute; inset: 0; margin: auto; display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,.35); }
.story-prev, .story-next { position: absolute; top: 0; bottom: 0; width: 34%; border: 0; background: none; cursor: pointer; display: flex; align-items: center; padding: 0 6px; }
.story-prev { left: 0; justify-content: flex-start; }
.story-next { right: 0; justify-content: flex-end; width: 66%; }
.story-prev svg, .story-next svg { width: 38px; height: 38px; padding: 8px; border-radius: 50%; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .2s; }
.story-prev:hover svg, .story-next:hover svg, .story-prev:focus-visible svg, .story-next:focus-visible svg { opacity: 1; }
.story-prev:focus-visible, .story-next:focus-visible { outline: none; }
.story-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.story-chips li { padding: 6px 12px; border-radius: 14px; background: rgba(255,255,255,.18); font-size: 12.5px; font-weight: 600; }
.story-actions { display: flex; gap: 10px; }
.story-use { flex: 1; display: grid; place-items: center; height: 52px; border-radius: 26px; background: #fff; color: #111; font: 700 16px/1 var(--sans); text-decoration: none; }
.story-board { width: 52px; height: 52px; border: 0; border-radius: 26px; background: rgba(255,255,255,.2); display: grid; place-items: center; cursor: pointer; }
.story-use:focus-visible, .story-board:focus-visible, .story-x:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.story-hint { margin: 0; text-align: center; font-size: 12px; color: rgba(255,255,255,.75); }
.story-hint .keys { display: none; }
@media (hover: hover) and (pointer: fine) {
  .story-hint .touch { display: none; }
  .story-hint .keys { display: inline; }
  .story-prev svg, .story-next svg { opacity: .7; }
}
@media (min-width: 900px) {
  .story-in { width: min(100%, 560px); }
  .story-prev { left: -64px; width: calc(34% + 64px); }
  .story-next { right: -64px; width: calc(66% + 64px); }
}
html:has(.story[open]) { overflow: hidden; }
/* right-to-left (ar): previous is on the right, next (the wide tap zone) on the left, chevrons mirrored; trends.js swaps the arrow keys and swipes */
[dir="rtl"] .story-prev { left: auto; right: 0; }
[dir="rtl"] .story-next { right: auto; left: 0; }
[dir="rtl"] :is(.story-prev, .story-next) svg { transform: scaleX(-1); }
@media (min-width: 900px) {
  [dir="rtl"] .story-prev { left: auto; right: -64px; }
  [dir="rtl"] .story-next { right: auto; left: -64px; }
}

@media (max-width: 960px) {
  .boards { grid-template-columns: minmax(0, 1fr); }
  .board.wide .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-cards { height: clamp(260px, 62vw, 420px); }
  .hcard { width: clamp(120px, 30vw, 220px); }
  .hcard.c2 { width: clamp(140px, 36vw, 250px); }
}
@media (max-width: 640px) {
  .tiles { gap: 14px 8px; }
  .cap span { display: none; }
  .moment { padding: 12px 14px; }
  .board { scroll-margin-top: 170px; }
}
@media (prefers-reduced-motion: reduce) {
  .tile, .ring .disc img, .story-prev svg, .story-next svg { transition: none; }
  .tile:hover { transform: none; }
  .ring:hover .disc img { transform: none; }
}

/* category pages (/collage-templates/<id>/): templates in their own ratio, uncropped (app TR12); carousels full row (D47) */
.cat-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(16px, 3vw, 32px); align-items: start; padding-block: clamp(20px, 3vw, 40px) 8px; }
.cat-stk { width: clamp(64px, 9vw, 112px); height: auto; filter: drop-shadow(0 6px 8px rgba(0,0,0,.18)); transform: rotate(-6deg); margin-top: 10px; }
.cat-hero .lede { max-width: 52ch; }
.ftiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 20px; margin: 0; padding: 0; list-style: none; align-items: start; }
.ftile.wide { grid-column: 1 / -1; }
.tile.free { aspect-ratio: auto; height: auto; }
.tile.free img { height: auto; object-fit: contain; display: block; }
.ideas { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(24px, 4vw, 48px); }
.ideas li { border-top: 1px solid var(--hairline); padding: 20px 0 24px; font-size: 1.02rem; text-wrap: pretty; }
.board-more { margin-top: 14px; }
@media (max-width: 640px) {
  .ftiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .cat-hero { grid-template-columns: minmax(0, 1fr); }
  .ideas { grid-template-columns: minmax(0, 1fr); }
}
