/*
 * Social Engine 2.1 · Social Studio
 *
 * Colours follow where the surface lives:
 *  - PWA apps use the app's own design settings (--nps-*).
 *  - Widget Boards use the board bridge (--awt-*: admin scheme in WordPress,
 *    app colours inside a PWA).
 *  - Plain site pages keep the Social Engine palette (--atn-social-*).
 * Reels and the story viewer are always dark, like the apps they mimic.
 */
.atn-studio,
.atn-studio-empty,
.atn-studio-overlay,
.atn-studio-toast {
	--ss-accent: var(--nps-theme, var(--atn-social-pink, #b72b6b));
	--ss-on-accent: var(--nps-on-theme, #ffffff);
	--ss-ink: var(--nps-app-text, var(--atn-social-ink, #251923));
	--ss-muted: var(--nps-muted, var(--atn-social-muted, #756a72));
	--ss-line: var(--nps-border, var(--atn-social-line, #eadfe6));
	--ss-card: var(--nps-surface, var(--atn-social-card, #ffffff));
	--ss-radius: var(--nps-surface-radius, 18px);
	--ss-radius-sm: var(--nps-control-radius, 12px);
	--ss-font: var(--nps-app-font, inherit);
	--ss-soft: color-mix(in srgb, var(--ss-accent) 8%, var(--ss-card));
	--ss-reel-h: min(78vh, 720px);
}
.activatewidgetarea :is(.atn-studio, .atn-studio-empty),
[data-awwa-standalone-widget] :is(.atn-studio, .atn-studio-empty) {
	--ss-accent: var(--awt-brand, var(--nps-theme, #b72b6b));
	--ss-on-accent: var(--awt-on-brand, #ffffff);
	--ss-ink: var(--awt-ink, #251923);
	--ss-muted: var(--awt-muted, #756a72);
	--ss-line: var(--awt-line, #eadfe6);
	--ss-card: var(--awt-surface, #ffffff);
	--ss-radius: var(--awt-radius-lg, 16px);
	--ss-radius-sm: var(--awt-radius, 10px);
}

.atn-studio { box-sizing: border-box; font-family: var(--ss-font); color: var(--ss-ink); }
.atn-studio *, .atn-studio-overlay * { box-sizing: border-box; }
.atn-studio :focus-visible,
.atn-studio-overlay :focus-visible,
.atn-story-viewer :focus-visible { outline: 3px solid var(--ss-accent, #b72b6b); outline-offset: 2px; }
.atn-studio__title { margin: 0 0 10px; font-size: 17px; font-weight: 800; letter-spacing: -.01em; color: var(--ss-ink); }

.atn-studio-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-height: 40px; padding: 8px 14px;
	border: 1px solid var(--ss-line); border-radius: 999px;
	background: var(--ss-card); color: var(--ss-ink);
	font: inherit; font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.atn-studio-btn:hover { border-color: var(--ss-accent); }
.atn-studio-btn.is-primary { background: var(--ss-accent); border-color: var(--ss-accent); color: var(--ss-on-accent); }
.atn-studio-btn[aria-pressed="true"] { background: var(--ss-soft); border-color: var(--ss-accent); color: var(--ss-accent); }
.atn-studio-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.atn-studio-more { display: block; margin: 12px auto 0; min-height: 40px; padding: 8px 18px; border: 1px solid var(--ss-line); border-radius: 999px; background: var(--ss-card); color: var(--ss-ink); font: inherit; font-weight: 700; cursor: pointer; }
.atn-studio-loading { padding: 28px 12px; text-align: center; color: var(--ss-muted); font-weight: 600; }

.atn-studio-empty {
	display: grid; justify-items: center; gap: 6px;
	padding: 26px 16px; border: 1px dashed var(--ss-line); border-radius: var(--ss-radius);
	background: var(--ss-soft); color: var(--ss-muted); text-align: center;
}
.atn-studio-empty > span { font-size: 28px; line-height: 1; }
.atn-studio-empty p { margin: 0; font-weight: 700; color: var(--ss-ink); }
.atn-studio-empty__why { max-width: 46ch; font-size: 12px; line-height: 1.45; color: var(--ss-muted); }

/* ------------------------------------------------------------- Hub */
.atn-hub { display: grid; gap: 10px; }
.atn-hub .atn-story-rail-wrap { margin: 0; }
.atn-hub__tabs {
	position: sticky; top: 0; z-index: 3;
	display: flex; gap: 4px; padding: 4px;
	border: 1px solid var(--ss-line); border-radius: 999px;
	background: color-mix(in srgb, var(--ss-card) 92%, transparent);
	backdrop-filter: blur(10px);
	overflow-x: auto;
}
.atn-hub__tabs button {
	flex: 1 0 auto; min-height: 38px; padding: 6px 14px;
	border: 0; border-radius: 999px; background: transparent; color: var(--ss-muted);
	font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.atn-hub__tabs button[aria-selected="true"] { background: var(--ss-accent); color: var(--ss-on-accent); }
.atn-hub__panel[hidden] { display: none !important; }

/* ----------------------------------------------------------- Reels */
.atn-reels { display: grid; gap: 10px; }
.atn-reels__track { position: relative; }
.atn-reels.is-large .atn-reels__track,
.atn-reels.is-overlay .atn-reels__track {
	height: var(--ss-reel-h);
	overflow-y: auto; overscroll-behavior: contain;
	scroll-snap-type: y mandatory;
	border-radius: var(--ss-radius);
	background: #000;
	scrollbar-width: none;
}
.atn-reels__track::-webkit-scrollbar { display: none; }
.atn-reel { position: relative; overflow: hidden; background: #000; color: #fff; }
.atn-reels.is-large .atn-reel,
.atn-reels.is-overlay .atn-reel { height: 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.atn-reel__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.atn-reel__shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.28) 0, transparent 22%, transparent 55%, rgba(0,0,0,.7) 100%); }
.atn-reel__tap { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; width: 100%; border: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.atn-reel__state { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(0,0,0,.42); color: #fff; font-size: 24px; opacity: 1; transition: opacity .2s ease; }
.atn-reel.is-playing .atn-reel__state { opacity: 0; }
.atn-reel__burst { position: absolute; z-index: 2; left: 50%; top: 45%; color: #ff3b6b; font-size: 96px; line-height: 1; opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(.4); text-shadow: 0 6px 30px rgba(0,0,0,.35); }
.atn-reel__burst.is-on { animation: atn-reel-burst .8s ease-out forwards; }
@keyframes atn-reel-burst { 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 30% { transform: translate(-50%, -50%) scale(.95); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%) scale(1); } }
.atn-reel__rail { position: absolute; z-index: 3; right: 8px; bottom: 82px; display: grid; justify-items: center; gap: 12px; }
.atn-reel__avatar img { display: block; width: 44px; height: 44px; border: 2px solid #fff; border-radius: 50%; object-fit: cover; }
.atn-reel__action {
	display: grid; justify-items: center; gap: 2px; min-width: 48px; min-height: 48px; padding: 4px;
	border: 0; background: transparent; color: #fff; text-decoration: none; cursor: pointer;
	font: inherit; text-shadow: 0 1px 6px rgba(0,0,0,.55);
}
.atn-reel__action span { font-size: 26px; line-height: 1; }
.atn-reel__action b { font-size: 11px; font-weight: 800; }
.atn-reel__action[data-studio-like][aria-pressed="true"] span { color: #ff3b6b; }
.atn-reel__action[data-studio-save][aria-pressed="true"] span { filter: drop-shadow(0 0 6px rgba(255,255,255,.7)); }
.atn-reel__meta { position: absolute; z-index: 3; left: 14px; right: 74px; bottom: 16px; font-size: 14px; line-height: 1.4; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.atn-reel__meta a { color: #fff; text-decoration: none; }
.atn-reel__meta small { opacity: .8; }
.atn-reel__meta p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; margin: 4px 0 0; overflow: hidden; }

/* Small reels: a swipeable strip of 9:16 thumbnails that opens full screen. */
.atn-reels.is-small .atn-reels__track { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(104px, 31%); gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.atn-reels.is-small .atn-reel { aspect-ratio: 9 / 16; border-radius: var(--ss-radius-sm); scroll-snap-align: start; }
.atn-reels.is-small .atn-reel__rail,
.atn-reels.is-small .atn-reel__meta p,
.atn-reels.is-small .atn-reel__meta small { display: none; }
.atn-reels.is-small .atn-reel__meta { left: 8px; right: 8px; bottom: 8px; font-size: 11px; }
.atn-reels.is-small .atn-reel__state { width: 40px; height: 40px; font-size: 16px; }
.atn-reels.is-small > .atn-studio-more { display: none; }

/* Inside a Widget Board the reels fill the widget height. */
.awwa-widget-stage > .atn-reels.is-large { display: flex; flex-direction: column; height: 100%; padding: 8px; }
.awwa-widget-stage > .atn-reels.is-large .atn-reels__track { flex: 1 1 auto; height: auto; min-height: 260px; }
.atn-studio-pwa .atn-reels.is-large { --ss-reel-h: min(calc(100dvh - 190px), 760px); }

/* -------------------------------------------------------- Overlays */
body.atn-studio-locked { overflow: hidden; }
.atn-studio-overlay { position: fixed; inset: 0; z-index: 1000001; }
.atn-reels-overlay { background: #000; }
.atn-reels-overlay .atn-reels { position: relative; width: min(100%, calc(100dvh * 9 / 16 + 120px)); height: 100%; margin: 0 auto; gap: 0; }
.atn-reels-overlay .atn-reels.is-overlay .atn-reels__track { height: 100dvh; border-radius: 0; }
.atn-reels-overlay .atn-studio-more { display: none; } /* loads automatically at the last reel */
.atn-studio-overlay__close {
	position: absolute; z-index: 6; top: max(10px, env(safe-area-inset-top)); left: 10px;
	display: grid; place-items: center; width: 44px; height: 44px;
	border: 0; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}
.atn-studio-sheet { display: grid; place-items: end center; background: rgba(12,8,12,.6); backdrop-filter: blur(8px); }
.atn-studio-sheet__panel { position: relative; width: min(760px, 100%); max-height: 92dvh; overflow: auto; padding: 60px 14px 18px; border-radius: 22px 22px 0 0; background: var(--ss-card); color: var(--ss-ink); }
.atn-studio-sheet__panel .atn-studio-overlay__close { left: auto; right: 10px; background: var(--ss-soft); color: var(--ss-ink); }

/* --------------------------------------------------------- Explore */
.atn-explore { display: grid; gap: 10px; }
.atn-explore__search .atn-social-search { margin: 0; }
.atn-explore__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: dense; gap: 3px; border-radius: var(--ss-radius-sm); overflow: hidden; }
.atn-explore__tile { position: relative; display: block; aspect-ratio: 1; padding: 0; border: 0; background: color-mix(in srgb, var(--ss-ink) 8%, var(--ss-card)); overflow: hidden; cursor: pointer; }
.atn-explore__tile img, .atn-explore__tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; transition: transform .25s ease; }
.atn-explore__tile:hover img, .atn-explore__tile:hover video { transform: scale(1.04); }
.atn-explore.is-large .atn-explore__tile:nth-child(10n + 3),
.atn-explore.is-large .atn-explore__tile:nth-child(10n + 6) { grid-row: span 2; aspect-ratio: auto; }
.atn-explore__badge { position: absolute; top: 6px; right: 6px; color: #fff; font-size: 14px; font-style: normal; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.atn-explore__stats { position: absolute; inset: auto 0 0 0; padding: 18px 6px 6px; background: linear-gradient(transparent, rgba(0,0,0,.6)); color: #fff; font-size: 11px; font-weight: 800; opacity: 0; transition: opacity .2s ease; }
.atn-explore__tile:hover .atn-explore__stats, .atn-explore__tile:focus-visible .atn-explore__stats { opacity: 1; }
.atn-explore.is-small .atn-explore__grid { gap: 2px; }

.atn-explore-lightbox { display: grid; place-items: center; padding: 16px; }
.atn-explore-lightbox__backdrop { position: absolute; inset: 0; background: rgba(12,8,12,.82); backdrop-filter: blur(10px); }
.atn-explore-lightbox__card { position: relative; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); width: min(1000px, 100%); max-height: calc(100dvh - 32px); overflow: hidden; border-radius: 20px; background: var(--ss-card); color: var(--ss-ink); }
.atn-explore-lightbox__card > .atn-studio-overlay__close { left: auto; right: 10px; }
.atn-explore-lightbox__media { display: grid; place-items: center; min-height: 0; background: #000; }
.atn-explore-lightbox__media img, .atn-explore-lightbox__media video { display: block; width: 100%; max-height: calc(100dvh - 32px); object-fit: contain; }
.atn-explore-lightbox__info { display: grid; align-content: start; gap: 12px; padding: 60px 18px 18px; overflow: auto; }
.atn-explore-lightbox__info p { margin: 0; white-space: pre-wrap; line-height: 1.5; }
.atn-explore-lightbox__author { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.atn-explore-lightbox__author img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.atn-explore-lightbox__author span { display: grid; }
.atn-explore-lightbox__author small { color: var(--ss-muted); }
.atn-explore-lightbox__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.atn-explore-lightbox__actions [data-studio-like][aria-pressed="true"] { color: #e11d48; }
.atn-explore-lightbox__nav { position: absolute; top: 50%; z-index: 4; display: grid; place-items: center; width: 44px; height: 44px; margin-top: -22px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); color: #111; font-size: 28px; cursor: pointer; }
.atn-explore-lightbox__nav.is-prev { left: 10px; }
.atn-explore-lightbox__nav.is-next { right: calc(min(1000px, 100%) * .42 + 10px); }
.atn-explore-lightbox__nav:disabled { opacity: .3; cursor: default; }
@media (max-width: 781px) {
	.atn-explore-lightbox { padding: 0; }
	.atn-explore-lightbox__card { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 100dvh; max-height: none; border-radius: 0; }
	.atn-explore-lightbox__media img, .atn-explore-lightbox__media video { max-height: 62dvh; }
	.atn-explore-lightbox__info { padding-top: 14px; }
	.atn-explore-lightbox__nav { top: 31dvh; }
	.atn-explore-lightbox__nav.is-next { right: 10px; }
	.atn-explore-lightbox__card > .atn-studio-overlay__close { left: 10px; right: auto; background: rgba(0,0,0,.45); color: #fff; }
}

/* ---------------------------------------------- Story bubbles (small) */
.atn-studio-stories.is-small .atn-story-rail-wrap { margin: 0; padding: 8px; border-radius: var(--ss-radius-sm); }
.atn-studio-stories.is-small .atn-story-rail { gap: 10px; }
.atn-studio-stories.is-small .atn-story-create,
.atn-studio-stories.is-small .atn-story-card { flex-basis: 62px; }
.atn-studio-stories.is-small .atn-story-card__ring { width: 54px; height: 54px; }
.atn-studio-stories.is-small .atn-story-card__ring > span { width: 48px; height: 48px; }
.atn-studio-stories.is-small .atn-story-create__avatar { width: 54px !important; height: 54px !important; }
.atn-studio-stories.is-small .atn-story-create__avatar img { width: 48px; height: 48px; }
.atn-studio-stories.is-small .atn-story-create strong,
.atn-studio-stories.is-small .atn-story-card strong { width: 62px; font-size: 10px; }

/* ----------------------------------------------------------- Streak */
.atn-streak { padding: 14px; border: 1px solid var(--ss-line); border-radius: var(--ss-radius); background: var(--ss-card); }
.atn-streak__main { display: flex; align-items: center; gap: 12px; }
.atn-streak__flame { font-size: 40px; line-height: 1; filter: grayscale(.85); opacity: .6; }
.atn-streak.is-today .atn-streak__flame { filter: none; opacity: 1; }
.atn-streak__main strong { display: block; font-size: 26px; font-weight: 900; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.atn-streak__main small { color: var(--ss-muted); font-weight: 700; }
.atn-streak__week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 12px 0 0; padding: 0; list-style: none; }
.atn-streak__week li { display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: var(--ss-radius-sm); background: color-mix(in srgb, var(--ss-ink) 5%, var(--ss-card)); color: var(--ss-muted); }
.atn-streak__week li.is-on { background: var(--ss-soft); color: var(--ss-ink); }
.atn-streak__week i { font-style: normal; font-size: 16px; line-height: 1.2; }
.atn-streak__week small { font-size: 10px; font-weight: 800; text-transform: uppercase; }
.atn-streak__hint { margin: 10px 0 0; font-size: 13px; color: var(--ss-muted); }

/* ------------------------------------------------------------ Pulse */
.atn-pulse { padding: 14px; border: 1px solid var(--ss-line); border-radius: var(--ss-radius); background: var(--ss-card); }
.atn-pulse__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.atn-pulse__tile { display: grid; gap: 2px; padding: 10px; border-radius: var(--ss-radius-sm); background: var(--ss-soft); color: var(--ss-ink); text-decoration: none; }
.atn-pulse__tile span { font-size: 18px; line-height: 1; }
.atn-pulse__tile b { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.atn-pulse__tile small { color: var(--ss-muted); font-size: 11px; font-weight: 700; }
a.atn-pulse__tile:hover { outline: 1px solid var(--ss-accent); }

/* ------------------------------------------- Feed save + story extras */
.atn-feed-save { min-width: 40px; min-height: 40px; border: 0; background: transparent; font-size: 18px; filter: grayscale(1); opacity: .6; cursor: pointer; }
.atn-feed-save[aria-pressed="true"] { filter: none; opacity: 1; }

.atn-story-viewer footer { flex-wrap: wrap; align-items: center; }
.atn-story-head-actions { display: inline-flex; align-items: center; gap: 2px; }
.atn-story-viewer header .atn-story-head-actions button { min-width: 40px; min-height: 40px; font-size: 22px; }
.atn-story-viewer header .atn-story-head-actions button[data-story-close] { font-size: 29px; }
.atn-story-quick { display: flex; flex: 1 1 100%; justify-content: space-between; gap: 4px; }
.atn-story-viewer footer .atn-story-quick button { flex: 1 1 0; min-height: 40px; padding: 4px; border: 0; background: rgba(255,255,255,.14); font-size: 20px; line-height: 1; }
.atn-story-viewer footer .atn-story-quick button.is-sent { animation: atn-story-pop .5s ease; }
@keyframes atn-story-pop { 40% { transform: scale(1.35); } }
.atn-story-reply { display: flex; flex: 1 1 100%; gap: 6px; }
.atn-story-reply input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 10px 14px; border: 1px solid rgba(255,255,255,.6); border-radius: 999px; background: rgba(0,0,0,.25); color: #fff; font: inherit; font-size: 14px; }
.atn-story-reply input::placeholder { color: rgba(255,255,255,.75); }
.atn-story-viewer footer .atn-story-reply button { flex: 0 0 44px; min-height: 44px; padding: 0; font-size: 18px; }
.atn-story-viewer footer .atn-story-views { background: rgba(255,255,255,.18); }
.atn-story-toast { position: absolute; left: 50%; bottom: 100%; margin-bottom: 8px; transform: translateX(-50%); padding: 7px 12px; border-radius: 999px; background: rgba(0,0,0,.72); color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; }
.atn-story-toast.is-error { background: #b42318; }
.atn-story-viewer footer { position: relative; }
.atn-story-paused { position: absolute; z-index: 5; left: 50%; top: 50%; display: none; place-items: center; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: rgba(0,0,0,.4); color: #fff; font-size: 20px; pointer-events: none; }
.atn-story-viewer.is-paused .atn-story-paused { display: grid; }
.atn-story-viewer.is-paused .atn-story-progress__segment i.is-current { animation-play-state: paused; }
.atn-story-sheet { position: absolute; z-index: 9; inset: auto 0 0 0; max-height: 70%; overflow: auto; padding: 14px; border-radius: 20px 20px 0 0; background: #fff; color: #1d1720; }
.atn-story-sheet header { display: flex; align-items: center; justify-content: space-between; padding: 0 0 8px !important; background: none !important; }
.atn-story-sheet header button { color: #1d1720 !important; }
.atn-story-sheet__list { display: grid; gap: 6px; }
.atn-story-sheet__list a { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.atn-story-sheet__list img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.atn-story-sheet__list span { display: grid; }
.atn-story-sheet__list small { color: #6b6170; }

/* ------------------------------------------------------------ Toast */
.atn-studio-toast { position: fixed; z-index: 1000002; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); padding: 10px 16px; border-radius: 999px; background: #1d1720; color: #fff; font: 700 14px/1.2 system-ui, sans-serif; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.atn-studio-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.atn-studio-toast.is-error { background: #b42318; }

/* Narrow widgets and phones. */
@container (max-width: 360px) {
	.atn-reel__rail { right: 4px; gap: 8px; }
	.atn-reel__action span { font-size: 22px; }
	.atn-hub__tabs button { padding: 6px 10px; }
}
@media (max-width: 781px) {
	.atn-reels.is-large { --ss-reel-h: min(calc(100dvh - 170px), 720px); }
}
@media (prefers-reduced-motion: reduce) {
	.atn-reel__state, .atn-explore__tile img, .atn-explore__tile video, .atn-explore__stats, .atn-studio-toast { transition: none; }
	.atn-reel__burst.is-on, .atn-story-viewer footer .atn-story-quick button.is-sent { animation: none; }
	.atn-reels__track { scroll-behavior: auto; }
}
