/* ==========================================================================
   Sangriha · Flash news (home strip + detail sheet)
   Mobile first. Kept short in height on purpose.
   ========================================================================== */

.sg-fl { --c: var(--sg-brand); position: relative; margin-top: 10px; margin-bottom: 14px; }
.sg-fl__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; min-height: 28px; }
.sg-fl__badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--sg-display); font-weight: 800; font-size: 17px; letter-spacing: -.01em; color: var(--sg-text); }
.sg-fl__bolt { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; color: #fff; background: linear-gradient(135deg, #ffb020, #ff5a1f 55%, var(--sg-brand)); box-shadow: 0 6px 14px -6px #ff5a1f; animation: sgFlBolt 4.5s ease-in-out infinite; }
.sg-fl__bolt svg { width: 14px; height: 14px; }
.sg-fl__live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--sg-muted); }
.sg-fl__live i { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 0 rgba(239, 68, 68, .5); animation: sgFlPing 2s infinite; }
.sg-fl__hint { margin-left: auto; font-size: 12px; color: var(--sg-muted); }
.sg-fl__nav { margin-left: auto; display: none; gap: 6px; }
.sg-fl__nav button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--sg-line); background: var(--sg-surface); color: var(--sg-text); cursor: pointer; transition: .2s var(--sg-ease); }
.sg-fl__nav button:hover:not(:disabled) { border-color: var(--sg-brand); color: var(--sg-brand); }
.sg-fl__nav button:disabled { opacity: .35; cursor: default; }
.sg-fl__nav svg { width: 16px; height: 16px; }

/* ---- Card (shared) ---- */
.sg-fl-card {
	position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; width: 100%;
	padding: 10px 12px 11px 14px; border: 1px solid var(--sg-line); border-radius: 18px; cursor: pointer;
	background:
		radial-gradient(140% 120% at 0% 0%, color-mix(in srgb, var(--c) 13%, transparent), transparent 55%),
		var(--sg-surface);
	color: var(--sg-text); font: inherit; overflow: hidden; isolation: isolate;
	box-shadow: inset 3px 0 0 var(--c), var(--sg-shadow);
	transition: transform .25s var(--sg-ease), box-shadow .25s var(--sg-ease), border-color .25s;
	-webkit-tap-highlight-color: transparent;
}
.sg-fl-card:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--sg-line)); }
.sg-fl-card:active { transform: scale(.985); }
.sg-fl-card:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.sg-fl-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; line-height: 1; }
.sg-fl-card__top time { color: var(--sg-muted); white-space: nowrap; }
.sg-fl-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--c); font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.sg-fl-tag i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.sg-fl-tag em { font-style: normal; font-size: 12px; }
.is-hot .sg-fl-tag i { animation: sgFlDot 1.8s infinite; }
.sg-fl-card__main { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.sg-fl-card__txt { display: grid; gap: 3px; min-width: 0; flex: 1; }
.sg-fl-card__title { font-family: var(--sg-display); font-size: 15.5px; font-weight: 700; line-height: 1.5; max-height: 3em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sg-fl-card__short { font-size: 13px; line-height: 1.5; max-height: 3em; color: var(--sg-muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.sg-fl-card__img { width: 58px; height: 58px; border-radius: 12px; object-fit: cover; object-position: center 35%; flex: none; background: var(--sg-surface-2); box-shadow: 0 0 0 1px var(--sg-line); }
.sg-fl-card.is-pin .sg-fl-card__top time::before { content: "📌 "; }
/* "new" dot for items this reader has not opened yet */
.sg-fl-card.is-new::after { content: ""; position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px var(--sg-surface); }
.sg-fl-card.is-new .sg-fl-card__top time { margin-right: 12px; }
/* soft light sweep on hot cards */
.sg-fl-card.is-hot::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(105deg, transparent 35%, color-mix(in srgb, var(--c) 16%, transparent) 50%, transparent 65%); transform: translateX(-100%); animation: sgFlSweep 7s ease-in-out 1.2s infinite; }

/* ---- Rail ---- */
.sg-fl-rail { display: grid; grid-auto-flow: column; grid-auto-columns: min(80vw, 300px); gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--sg-pad); margin-inline: calc(var(--sg-pad) * -1); padding: 2px var(--sg-pad) 8px; scrollbar-width: none; overscroll-behavior-x: contain; }
.sg-fl-rail::-webkit-scrollbar { display: none; }
.sg-fl-rail .sg-fl-card { scroll-snap-align: start; height: 100%; min-height: 100px; animation: sgFlIn .55s var(--sg-ease) both; animation-delay: calc(min(var(--i), 6) * 70ms); }
.sg-fl-rail .sg-fl-card.has-img .sg-fl-card__short { -webkit-line-clamp: 1; }
.sg-fl-rail .sg-fl-card:not(.has-img) .sg-fl-card__short { -webkit-line-clamp: 2; }

/* ---- Deck (stacked, swipeable) ---- */
.sg-fl-deck { position: relative; height: 122px; margin-right: 16px; touch-action: pan-y; outline: 0; }
.sg-fl-deck__card { position: absolute; inset: 0; height: auto; transform-origin: 50% 100%; transition: transform .45s var(--sg-spring), opacity .35s var(--sg-ease), box-shadow .3s; will-change: transform; }
.sg-fl-deck__card .sg-fl-card__short { -webkit-line-clamp: 2; }
.sg-fl-deck__card .sg-fl-card__main, .sg-fl-spot__card .sg-fl-card__main { flex: 1; align-items: center; }
.sg-fl-spot--deck { display: block; }
.sg-fl-deck__card[data-pos="0"] { z-index: 4; }
.sg-fl-deck__card[data-pos="1"] { z-index: 3; transform: translate(8px, -6px) scale(.965); opacity: .9; pointer-events: none; }
.sg-fl-deck__card[data-pos="2"] { z-index: 2; transform: translate(16px, -12px) scale(.93); opacity: .7; pointer-events: none; }
.sg-fl-deck__card[data-pos="x"] { z-index: 1; transform: translate(16px, -12px) scale(.93); opacity: 0; pointer-events: none; }
.sg-fl-deck__card[data-pos="out"] { z-index: 5; transition: transform .35s var(--sg-ease), opacity .35s; opacity: 0; pointer-events: none; }
.sg-fl-deck__card.is-drag { transition: none; }
.sg-fl-deck__card[data-pos="1"] *, .sg-fl-deck__card[data-pos="2"] * { visibility: visible; }
.sg-fl-dots { display: flex; justify-content: center; gap: 5px; margin-top: 8px; }
.sg-fl-dots i { width: 6px; height: 6px; border-radius: 6px; background: var(--sg-line); transition: .3s var(--sg-ease); }
.sg-fl-dots i.is-on { width: 18px; background: var(--sg-brand); }

/* ---- Spotlight (story-style segments) ---- */
.sg-fl-spot { display: grid; gap: 12px; }
.sg-fl-spot__stage { position: relative; height: 118px; }
.sg-fl-segs { position: absolute; z-index: 6; left: 14px; right: 14px; top: 7px; display: flex; gap: 4px; pointer-events: none; }
.sg-fl-segs i { flex: 1; height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--sg-text) 12%, transparent); overflow: hidden; }
.sg-fl-segs b { display: block; height: 100%; width: 0; background: var(--sg-brand); border-radius: inherit; }
.sg-fl-segs i.is-done b { width: 100%; }
.sg-fl-segs i.is-run b { animation: sgFlSeg var(--dur, 5.5s) linear forwards; }
.sg-fl-spot.is-paused .sg-fl-segs i.is-run b { animation-play-state: paused; }
.sg-fl-spot__card { position: absolute; inset: 0; padding-top: 18px; opacity: 0; transform: translateY(6px) scale(.99); pointer-events: none; transition: opacity .45s var(--sg-ease), transform .45s var(--sg-ease); }
.sg-fl-spot__card.is-on { opacity: 1; transform: none; pointer-events: auto; }
.sg-fl-spot__card .sg-fl-card__img { width: 72px; height: 72px; }
.sg-fl-spot__card .sg-fl-card__short { -webkit-line-clamp: 2; }
.sg-fl-spot__tap { position: absolute; z-index: 5; top: 0; bottom: 0; width: 18%; border: 0; background: none; cursor: pointer; }
.sg-fl-spot__tap--l { left: 0; } .sg-fl-spot__tap--r { right: 0; }
.sg-fl-spot__list { display: none; }

/* ---- Ticker ---- */
.sg-fl-tk { display: flex; align-items: center; height: 44px; border-radius: 14px; border: 1px solid var(--sg-line); background: var(--sg-surface); box-shadow: var(--sg-shadow); overflow: hidden; }
.sg-fl-tk__badge { display: inline-flex; align-items: center; gap: 6px; height: 100%; padding: 0 12px 0 8px; font-family: var(--sg-display); font-weight: 800; font-size: 14px; color: #fff; background: var(--sg-grad); flex: none; position: relative; }
.sg-fl-tk__badge::after { content: ""; position: absolute; right: -10px; top: 0; bottom: 0; width: 10px; background: linear-gradient(90deg, var(--sg-brand-2), transparent); opacity: .25; }
.sg-fl-tk__badge .sg-fl__bolt { width: 22px; height: 22px; background: rgba(255, 255, 255, .18); box-shadow: none; }
.sg-fl-tk__view { flex: 1; min-width: 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 24px), transparent); }
.sg-fl-tk__track { display: flex; width: max-content; animation: sgFlTick var(--dur, 30s) linear infinite; }
.sg-fl-tk:hover .sg-fl-tk__track, .sg-fl-tk:focus-within .sg-fl-tk__track, .sg-fl-tk.is-paused .sg-fl-tk__track { animation-play-state: paused; }
.sg-fl-tk__set { display: flex; }
.sg-fl-tk__item { display: inline-flex; align-items: center; gap: 7px; padding: 0 18px 0 14px; height: 44px; border: 0; background: none; color: var(--sg-text); font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.sg-fl-tk__item i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.sg-fl-tk__item b { color: var(--c); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.sg-fl-tk__item:hover { color: var(--sg-brand); }
.sg-fl-tk__all { flex: none; display: inline-flex; align-items: center; gap: 2px; height: 100%; padding: 0 8px 0 10px; border: 0; border-left: 1px solid var(--sg-line); background: none; color: var(--sg-text); font-weight: 700; cursor: pointer; }
.sg-fl-tk__all span { min-width: 20px; height: 20px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 10px; background: var(--sg-brand); color: #fff; font-size: 11px; }
.sg-fl-tk__all svg { width: 16px; height: 16px; }

/* ---- Desktop ---- */
@media (min-width: 768px) {
	.sg-fl { margin-top: 14px; margin-bottom: 20px; }
	.sg-fl__nav { display: flex; }
	.sg-fl-rail { grid-auto-columns: calc((100% - 30px) / 4); margin-inline: 0; padding-inline: 0; scroll-padding-inline: 0; }
	.sg-fl-spot--deck { display: grid; }
	.sg-fl-spot--deck .sg-fl-deck { height: 132px; }
	.sg-fl-spot--deck .sg-fl-dots { justify-content: flex-start; padding-left: 4px; }
	.sg-fl--deck .sg-fl__hint { display: none; }
	.sg-fl-spot__card .sg-fl-card__title, .sg-fl-deck__card .sg-fl-card__title { font-size: 17.5px; }
	.sg-fl-spot { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: stretch; }
	.sg-fl-spot__stage { height: 132px; }
	.sg-fl-spot__list { display: grid; align-content: start; gap: 2px; margin: 0; padding: 4px 0; list-style: none; counter-reset: fl; }
	.sg-fl-spot__list button { --c: var(--sg-brand); display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 6px 10px; border: 0; border-radius: 10px; background: none; color: var(--sg-text); text-align: left; font: inherit; font-size: 14px; cursor: pointer; transition: background .2s; }
	.sg-fl-spot__list button i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
	.sg-fl-spot__list button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
	.sg-fl-spot__list button time { font-size: 11.5px; color: var(--sg-muted); }
	.sg-fl-spot__list button:hover, .sg-fl-spot__list li.is-on button { background: var(--sg-surface-2); }
	.sg-fl-spot__list li:nth-child(n+5) { display: none; }
	.sg-fl-card__title { font-size: 16px; }
}
@media (min-width: 1100px) { .sg-fl-rail { grid-auto-columns: calc((100% - 40px) / 5); } }

/* ==========================================================================
   Detail sheet
   ========================================================================== */
html.sg-fls-open { overflow: hidden; }
.sg-fls { position: fixed; inset: 0; z-index: 10050; display: flex; align-items: flex-end; justify-content: center; }
.sg-fls[hidden] { display: none; }
.sg-fls__scrim { position: absolute; inset: 0; background: rgba(10, 4, 6, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .3s var(--sg-ease); }
.sg-fls.is-in .sg-fls__scrim { opacity: 1; }
.sg-fls__sheet {
	--c: var(--sg-brand); position: relative; width: 100%; max-height: 90vh; max-height: 90dvh; display: flex; flex-direction: column;
	background: var(--sg-surface); color: var(--sg-text); border-radius: 26px 26px 0 0; box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .45);
	transform: translateY(100%); transition: transform .42s var(--sg-ease); overflow: hidden; padding-bottom: env(safe-area-inset-bottom);
}
.sg-fls.is-in .sg-fls__sheet { transform: translateY(0); }
.sg-fls__sheet.is-drag { transition: none; }
.sg-fls__sheet::before { content: ""; position: absolute; inset: 0 0 auto; height: 160px; background: radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--c) 18%, transparent), transparent 70%); pointer-events: none; }
.sg-fls__grab { position: relative; z-index: 2; display: grid; place-items: center; height: 22px; flex: none; touch-action: none; cursor: grab; }
.sg-fls__grab::after { content: ""; width: 40px; height: 5px; border-radius: 5px; background: color-mix(in srgb, var(--sg-text) 22%, transparent); }
.sg-fls__bar { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 0 16px 10px 18px; flex: none; }
.sg-fls__bar .sg-fl-tag { font-size: 11.5px; }
.sg-fls__time { font-size: 12px; color: var(--sg-muted); }
.sg-fls__count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--sg-muted); font-variant-numeric: tabular-nums; }
.sg-fls__x { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 0; background: var(--sg-surface-2); color: var(--sg-text); cursor: pointer; }
.sg-fls__x svg { width: 18px; height: 18px; }
.sg-fls__scroll { position: relative; z-index: 1; overflow-y: auto; overscroll-behavior: contain; padding: 2px 18px 18px; -webkit-overflow-scrolling: touch; }
.sg-fls__slide { animation: sgFlSlide .35s var(--sg-ease); }
.sg-fls__slide.is-back { animation-name: sgFlSlideBack; }
/* Photo: never cropped. Any shape fits; empty space is filled with a soft blur of the same photo. */
.sg-fls__media { position: relative; margin: 0 0 14px; border-radius: 18px; overflow: hidden; background: var(--sg-surface-2); isolation: isolate; display: grid; place-items: center; aspect-ratio: 16 / 9; max-height: min(56vh, 460px); width: 100%; }
.sg-fls__media::before { content: ""; position: absolute; inset: -20px; z-index: -1; background: var(--bg) center / cover no-repeat; filter: blur(22px) saturate(1.2); opacity: .55; transform: scale(1.1); }
.sg-fls__media.is-tall { aspect-ratio: 4 / 5; max-height: min(42vh, 440px); }
.sg-fls__img { display: block; width: 100%; height: 100%; max-height: inherit; object-fit: contain; }
.sg-fls__title { font-family: var(--sg-display); font-size: 23px; line-height: 1.3; font-weight: 800; letter-spacing: -.01em; margin: 0 0 8px; }
.sg-fls__lead { white-space: pre-line; font-size: 16.5px; line-height: 1.7; font-weight: 500; color: color-mix(in srgb, var(--sg-text) 82%, var(--sg-muted)); margin: 0 0 12px; padding-left: 12px; border-left: 3px solid var(--c); }
.sg-fls__body { font-size: 16.5px; line-height: 1.85; }
.sg-fls__body > :first-child { margin-top: 0; }
.sg-fls__body p { margin: 0 0 .9em; }
.sg-fls__body img { max-width: 100%; height: auto; border-radius: 14px; }
.sg-fls__body a { color: var(--sg-brand); }
.sg-fls__body blockquote { margin: 1em 0; padding: 8px 14px; border-left: 3px solid var(--c); background: var(--sg-surface-2); border-radius: 0 12px 12px 0; }
.sg-fls__acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.sg-fls__btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--sg-line); background: var(--sg-surface); color: var(--sg-text); font: inherit; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer; }
.sg-fls__btn svg { width: 17px; height: 17px; }
.sg-fls__btn--go { background: var(--sg-grad); border-color: transparent; color: #fff; box-shadow: 0 10px 22px -12px var(--sg-brand); }
.sg-fls__nav { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid var(--sg-line); background: var(--sg-surface); flex: none; }
.sg-fls__nav button { display: grid; gap: 1px; min-height: 48px; padding: 6px 12px; border-radius: 14px; border: 1px solid var(--sg-line); background: var(--sg-surface-2); color: var(--sg-text); font: inherit; text-align: left; cursor: pointer; min-width: 0; }
.sg-fls__nav button:last-child { text-align: right; }
.sg-fls__nav button small { font-size: 11px; color: var(--sg-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.sg-fls__nav button span { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-fls__nav button:disabled { opacity: .35; cursor: default; }
@media (min-width: 768px) {
	.sg-fls { align-items: center; padding: 24px; }
	.sg-fls__sheet { width: min(640px, 100%); max-height: 86vh; border-radius: 26px; transform: translateY(16px) scale(.97); opacity: 0; transition: transform .35s var(--sg-ease), opacity .3s; box-shadow: var(--sg-shadow-lg); }
	.sg-fls.is-in .sg-fls__sheet { transform: none; opacity: 1; }
	.sg-fls__grab { height: 14px; }
	.sg-fls__grab::after { display: none; }
	.sg-fls__scroll { padding: 2px 26px 22px; }
	.sg-fls__bar { padding: 0 18px 12px 26px; }
	.sg-fls__title { font-size: 27px; }
}

/* ---- Motion ---- */
@keyframes sgFlIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sgFlPing { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .45); } 70%, 100% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); } }
@keyframes sgFlDot { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }
@keyframes sgFlBolt { 0%, 86%, 100% { filter: none; transform: none; } 90% { filter: brightness(1.35); transform: rotate(-8deg) scale(1.08); } 94% { transform: rotate(4deg); } }
@keyframes sgFlSweep { 0%, 70% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes sgFlSeg { from { width: 0; } to { width: 100%; } }
@keyframes sgFlTick { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes sgFlSlide { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes sgFlSlideBack { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
	.sg-fl *, .sg-fls * { animation: none !important; transition-duration: .01ms !important; }
	.sg-fl-tk__view { overflow-x: auto; }
}
