/* ============================================================
   LEXNOMIK — Legal Shorts (Inshorts-style feed)
   assets/css/shorts.css
   ============================================================ */
:root { --sh-top: 52px; --sh-filters: 46px; --sh-chrome: calc(var(--sh-top) + var(--sh-filters)); --sh-bg: #0b1a31; }

html:has(body.sh-page) { overflow: hidden; height: 100%; }
body.sh-page { background: var(--sh-bg); height: 100%; overflow: hidden; color: var(--gray-800, #1f2937); }

/* ---- Top bar + filters ---------------------------------- */
.sh-top {
  position: fixed; top: 0; left: 0; right: 0; height: var(--sh-top); z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  padding-top: env(safe-area-inset-top); box-sizing: content-box;
  background: var(--sh-bg); color: #fff; border-bottom: 1px solid rgba(255,255,255,.06);
}
.sh-logo { font-family: var(--font-display, Georgia, serif); font-weight: 900; font-size: 21px; color: #fff; letter-spacing: .01em; }
.sh-logo span { color: var(--gold-light, #e8c97a); }
.sh-top-title { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold, #c8a84b);
  border-left: 1px solid rgba(255,255,255,.18); padding-left: 12px; }
.sh-install { margin-left: auto; border: 1px solid rgba(200,168,75,.6); background: transparent; color: var(--gold-light, #e8c97a);
  font: 600 12.5px var(--font-ui, sans-serif); padding: 6px 12px; border-radius: 99px; cursor: pointer; }
.sh-install:not([hidden]) + .sh-top-link { margin-left: 0; }
.sh-top-link { margin-left: auto; color: rgba(255,255,255,.75); font-size: 13.5px; font-weight: 600; }
.sh-top-link:hover { color: #fff; }

.sh-filters {
  position: fixed; top: calc(var(--sh-top) + env(safe-area-inset-top)); left: 0; right: 0; height: var(--sh-filters); z-index: 19;
  display: flex; align-items: center; gap: 8px; padding: 0 16px; overflow-x: auto; scrollbar-width: none;
  background: var(--sh-bg);
}
.sh-filters::-webkit-scrollbar { display: none; }
.sh-filters a {
  flex: 0 0 auto; padding: 6px 13px; border-radius: 99px; font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,.72); background: rgba(255,255,255,.07);
}
.sh-filters a.active { background: var(--gold, #c8a84b); color: var(--navy-dark, #0f2240); }

/* ---- Feed ---------------------------------------------------- */
.sh-feed {
  position: fixed; left: 0; right: 0; bottom: 0;
  top: calc(var(--sh-chrome) + env(safe-area-inset-top));
  overflow-y: auto; overscroll-behavior: contain;
  scroll-snap-type: y mandatory; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.sh-feed::-webkit-scrollbar { display: none; }

.sh-card {
  height: 100%; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; flex-direction: column; background: #fff; overflow: hidden; position: relative;
}
.sh-card[hidden] { display: none; }

.sh-media { flex: 0 0 clamp(130px, 32%, 300px); position: relative; overflow: hidden; background: #13294a; }
.sh-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sh-media-brand { background: radial-gradient(420px circle at 85% 0%, rgba(200,168,75,.22), transparent 60%), linear-gradient(150deg, #1d4372, #0f2240 70%); }
.sh-brand-art { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 18px 18px 16px; color: #fff; }
.sh-brand-icon { position: absolute; right: 14px; top: -6px; font-family: var(--font-display, Georgia, serif); font-size: 150px; line-height: 1; color: rgba(200,168,75,.22); }
.sh-brand-label { font-family: var(--font-display, Georgia, serif); font-weight: 700; font-size: 22px; line-height: 1.2; max-width: 80%; }
.sh-chip {
  position: absolute; left: 14px; top: 12px; background: rgba(11,26,49,.82); color: var(--gold-light, #e8c97a);
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 4px 9px; border-radius: 6px;
}

.sh-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 18px 10px; scrollbar-width: none; }
.sh-body::-webkit-scrollbar { display: none; }
.sh-title { font-family: var(--font-display, Georgia, serif); font-size: 19.5px; line-height: 1.3; font-weight: 700; margin-bottom: 10px; }
.sh-title a { color: var(--navy-dark, #0f2240); }
.sh-summary { font-family: var(--font-body, Georgia, serif); font-size: 16px; line-height: 1.6; color: #374151; }
.sh-impact {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--gold-pale, #f7f0dd);
  border-left: 3px solid var(--gold, #c8a84b); font-size: 13.5px; line-height: 1.5; color: var(--navy-dark, #0f2240);
}
.sh-impact strong { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #9a7b22; margin-bottom: 3px; }
.sh-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 12px; font-size: 11.5px; color: var(--gray-500, #6b7280); }
.sh-by { color: var(--gray-400, #9ca3af); }

.sh-actions {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--gray-100, #f3f4f6); background: #fff;
}
.sh-act {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 38px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--gray-200, #e5e7eb); background: #fff; color: var(--navy-dark, #0f2240);
  font: 600 13px var(--font-ui, sans-serif); cursor: pointer; white-space: nowrap;
}
.sh-act-main { flex: 1; background: var(--navy-dark, #0f2240); border-color: var(--navy-dark, #0f2240); color: #fff; }
.sh-act-main:hover { color: #fff; background: var(--navy, #1a3a5c); }
.sh-icon { font-size: 15px; }
.sh-icon span, .sh-act span { font-size: 12.5px; }
.sh-act[aria-pressed="true"] { background: var(--gold-pale, #f7f0dd); border-color: var(--gold, #c8a84b); color: #9a7b22; }

/* ---- Swipe deck (JS engine; native scroll-snap above is the no-JS fallback) ---- */
.sh-feed.sh-deck {
  overflow: hidden; scroll-snap-type: none; touch-action: none; overscroll-behavior: none;
  background: var(--sh-bg); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.sh-deck .sh-card {
  position: absolute; inset: 0; height: auto;
  visibility: hidden; transform: translate3d(0, 100%, 0);
  transform-origin: 50% 35%; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  contain: layout style;
}
.sh-deck .sh-card.sh-live { visibility: visible; will-change: transform; box-shadow: 0 -10px 40px rgba(0,0,0,.28); }
.sh-deck .sh-body { overflow: hidden; }
.sh-deck img { -webkit-user-drag: none; pointer-events: none; }
.sh-dragging, .sh-dragging * { cursor: grabbing; }
.sh-dim { position: absolute; inset: 0; background: #0b1a31; opacity: 0; pointer-events: none; z-index: 5; }

/* Auto-fit for long shorts so a card never needs inner scrolling */
.sh-card.sh-fit-1 .sh-media { flex-basis: clamp(100px, 24%, 220px); }
.sh-card.sh-fit-1 .sh-title { font-size: 18px; }
.sh-card.sh-fit-1 .sh-summary { font-size: 15px; line-height: 1.52; }
.sh-card.sh-fit-2 .sh-media { flex-basis: clamp(80px, 16%, 160px); }
.sh-card.sh-fit-2 .sh-brand-label { font-size: 17px; }
.sh-card.sh-fit-2 .sh-title { font-size: 16.5px; margin-bottom: 6px; }
.sh-card.sh-fit-2 .sh-summary { font-size: 14px; line-height: 1.48; }
.sh-card.sh-fit-2 .sh-impact { font-size: 12.5px; margin-top: 8px; padding: 8px 10px; }
.sh-card.sh-fit-2 .sh-meta { margin-top: 8px; }

/* ---- End / empty card --------------------------------------- */
.sh-end { background: linear-gradient(170deg, #13294a, #0b1a31); color: #fff; justify-content: center; }
.sh-end-inner { padding: 32px 26px; text-align: center; max-width: 420px; margin: 0 auto; }
.sh-end-icon { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center;
  font-size: 28px; background: rgba(200,168,75,.16); color: var(--gold-light, #e8c97a); }
.sh-end h2 { color: #fff; font-family: var(--font-display, Georgia, serif); font-size: 26px; margin-bottom: 8px; }
.sh-end p { color: rgba(255,255,255,.7); line-height: 1.6; margin-bottom: 20px; }
.sh-end-links { display: flex; flex-direction: column; gap: 10px; }
.sh-btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,.25); color: #fff; }
.sh-btn-ghost:hover { border-color: var(--gold, #c8a84b); color: #fff; }
.sh-ios-tip { margin-top: 18px; font-size: 13px; }

/* ---- Hint + toast ------------------------------------------- */
.sh-hint {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 25;
  background: rgba(11,26,49,.88); color: #fff; font-size: 12.5px; font-weight: 600; padding: 8px 14px; border-radius: 99px;
  pointer-events: none; animation: shHint 4.5s ease 1.2s both; white-space: nowrap;
}
.sh-hint span { display: inline-block; animation: shBounce 1s ease infinite; color: var(--gold-light, #e8c97a); }
.sh-page.sh-scrolled .sh-hint { display: none; }
@keyframes shHint { 0% { opacity: 0; transform: translate(-50%, 10px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
@keyframes shBounce { 50% { transform: translateY(-3px); } }
.sh-toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); z-index: 30; opacity: 0;
  background: #fff; color: var(--navy-dark, #0f2240); font-size: 13.5px; font-weight: 600; padding: 10px 16px;
  border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.35); transition: opacity .2s, transform .2s; pointer-events: none;
}
.sh-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Short screens ------------------------------------------ */
@media (max-height: 720px) {
  .sh-media { flex-basis: clamp(110px, 26%, 220px); }
  .sh-title { font-size: 18px; margin-bottom: 8px; }
  .sh-summary { font-size: 15px; line-height: 1.55; }
  .sh-impact { font-size: 13px; margin-top: 10px; }
}
@media (max-width: 360px) {
  .sh-act span { display: none; }
  .sh-top-title { display: none; }
}

/* ---- Desktop: centred phone-width column -------------------- */
@media (min-width: 768px) {
  body.sh-page { background: radial-gradient(900px circle at 50% 0%, #17325a, var(--sh-bg) 65%); }
  .sh-top { padding: 0 28px; }
  .sh-filters a:first-child { margin-left: auto; }   /* centred, but never clipped when it overflows */
  .sh-filters a:last-child { margin-right: auto; }
  .sh-feed { left: 50%; right: auto; width: 460px; transform: translateX(-50%); top: calc(var(--sh-chrome) + 12px); bottom: 16px;
    border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
  .sh-hint { bottom: 40px; }
  .sh-hint::after { content: " · or use ↑ ↓ keys"; }
}
@media (prefers-reduced-motion: reduce) {
  .sh-hint, .sh-hint span { animation: none; }
}
