/* ================================================================
   PULSE — Bioluminescent Terminal
   Content Radar SPA Stylesheet
   Designed by Jony spec, implemented vanilla CSS
================================================================ */

/* ── Design Tokens ── */
:root {
  --bg:            #0A0C12;
  --surface:       #111520;
  --surface-hover: #1A2035;
  --accent-mint:   #00FFB2;
  --accent-violet: #7B61FF;
  --accent-ember:  #FF6B35;
  --text-primary:  #E8EDF5;
  --text-secondary:#6B7A99;
  --divider:       #1E2640;

  /* Section colors */
  --color-hn:          #FF6B35;
  --color-github:      #00FFB2;
  --color-reddit:      #7B61FF;
  --color-rss:         #3DD6F5;
  --color-newsletters: #FFD166;

  /* Typography */
  --font-headline: 'Space Grotesk', sans-serif;
  --font-body:     'Inter', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;

  /* Sizes (fluid) */
  --headline-featured: clamp(18px, 4vw, 22px);
  --headline-standard: clamp(16px, 3.5vw, 18px);
  --meta:          clamp(11px, 2.5vw, 14px);

  /* Layout */
  --header-height:   72px;
  --dock-height:     64px;
  --column-max:      480px;
  --safe-bottom:     env(safe-area-inset-bottom, 0px);
  --safe-top:        env(safe-area-inset-top, 0px);
}

/* ── Light Mode Overrides ── */
[data-theme="light"] {
  --bg:            #F5F6FA;
  --surface:       #FFFFFF;
  --surface-hover: #F0F1F5;
  --text-primary:  #1A1D27;
  --text-secondary:#6B7A99;
  --divider:       #E2E5F0;
  --accent-mint:   #00CC8E;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100dvh;
  overflow-x: hidden;
  padding-top: calc(var(--header-height) + var(--safe-top));
  padding-bottom: calc(var(--dock-height) + var(--safe-bottom) + 8px);
}

/* ── Upgrade 1: Ambient Gradient Orbs ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 10% 20%, rgba(0, 255, 178, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(0, 180, 255, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 50% 110%, rgba(120, 0, 255, 0.04) 0%, transparent 60%);
  animation: orb-drift 20s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

/* ── Upgrade 1: Noise Texture Overlay ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1;
}

@keyframes orb-drift {
  0%   { opacity: 1;   transform: scale(1); }
  50%  { opacity: 0.8; transform: scale(1.05) translate(2%, 1%); }
  100% { opacity: 1;   transform: scale(1.02) translate(-1%, 2%); }
}

/* Accessibility: disable animation for reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

/* Light mode: greatly reduce orbs (they don't work on light backgrounds) */
[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 60% 50% at 10% 20%, rgba(0, 204, 142, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(0, 120, 180, 0.02) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 50% 110%, rgba(80, 0, 180, 0.02) 0%, transparent 60%);
  animation: none;
}

[data-theme="light"] body::after {
  opacity: 0.015;
}

/* ================================================================
   HEADER
================================================================ */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 12, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--divider);
  padding-top: var(--safe-top);
  display: flex;
  flex-direction: column;
  min-height: calc(var(--header-height) + var(--safe-top));
  height: auto;
}

[data-theme="light"] #header {
  background: rgba(245, 246, 250, 0.9);
}

/* Logo row */
#logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 4px;
  font-family: var(--font-headline);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.logo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-mint);
  box-shadow: 0 0 6px var(--accent-mint);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--accent-mint); }
  50%       { opacity: 0.5; box-shadow: 0 0 12px var(--accent-mint); }
}

/* Theme toggle button */
#theme-toggle {
  margin-left: auto;
  background: none;
  border: 1px solid var(--divider);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
#theme-toggle:hover {
  border-color: var(--accent-mint);
  background: var(--surface-hover);
}

/* Date ribbon */
#date-ribbon {
  display: flex;
  gap: 6px;
  padding: 0 16px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-direction: row-reverse; /* today on the right */
}
#date-ribbon::-webkit-scrollbar { display: none; }

/* Day pill */
.day-pill {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(17, 21, 32, 0.6);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.day-pill:hover  {
  background: rgba(26, 32, 53, 0.8);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}
.day-pill.active {
  background: rgba(0, 255, 178, 0.12);
  border-color: var(--accent-mint);
  color: var(--accent-mint);
  box-shadow: 0 0 8px rgba(0, 255, 178, 0.25);
}

[data-theme="light"] .day-pill {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .day-pill:hover {
  background: rgba(240, 241, 245, 0.9);
  border-color: rgba(0, 0, 0, 0.18);
}
[data-theme="light"] .day-pill.active {
  background: rgba(0, 204, 142, 0.12);
  border-color: var(--accent-mint);
}
/* "First open" pulse on active pill */
.day-pill.active.pulse-once {
  animation: pill-pulse 0.6s ease-out forwards;
}
@keyframes pill-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 255, 178, 0.5); }
  50%  { box-shadow: 0 0 0 8px rgba(0, 255, 178, 0); }
  100% { box-shadow: 0 0 8px rgba(0, 255, 178, 0.25); }
}

/* ================================================================
   RADAR LINE (pull-to-refresh visual)
================================================================ */
#radar-line {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top));
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-mint), transparent);
  opacity: 0;
  z-index: 99;
  pointer-events: none;
  transition: opacity 0.2s;
}
#radar-line.scanning {
  opacity: 1;
  animation: radar-sweep 1s ease-in-out forwards;
}
@keyframes radar-sweep {
  0%   { transform: translateY(0); opacity: 1; }
  80%  { transform: translateY(calc(100dvh - var(--header-height))); opacity: 0.6; }
  100% { transform: translateY(calc(100dvh - var(--header-height))); opacity: 0; }
}

/* ================================================================
   MAIN / FEED
================================================================ */
#main {
  max-width: var(--column-max);
  margin: 0 auto;
  padding: 0;
  width: 100%;
  position: relative;
  z-index: 2;
}

/* Stats bar */
#stats-bar {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  padding: 10px 16px 6px;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--divider);
  min-height: 34px;
}

/* Source filter dropdown */
#source-filter {
  padding: 8px 16px 6px;
  border-bottom: 1px solid var(--divider);
}

#source-select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: rgba(17, 21, 32, 0.8);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 36px 8px 12px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B7A99'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: all 0.15s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#source-select:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background-color: rgba(26, 32, 53, 0.9);
}
#source-select:focus {
  outline: none;
  border-color: var(--accent-mint);
  box-shadow: 0 0 0 1px var(--accent-mint);
}
#source-select option {
  background: #111520;
  color: var(--text-primary);
}

[data-theme="light"] #source-select {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] #source-select:hover {
  background: rgba(240, 241, 245, 0.95);
  border-color: rgba(0, 0, 0, 0.18);
}
[data-theme="light"] #source-select option {
  background: #FFFFFF;
}

/* Feed status (loading / empty) */
#feed-status {
  padding: 40px 16px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-secondary);
}
#feed-status.loading::after {
  content: '';
  display: block;
  margin: 16px auto 0;
  width: 24px;
  height: 24px;
  border: 2px solid var(--divider);
  border-top-color: var(--accent-mint);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   SIGNAL TILES
================================================================ */
#feed {
  display: flex;
  flex-direction: column;
}

.tile {
  position: relative;
  background: rgba(17, 21, 32, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 2px solid var(--tile-color, var(--divider));
  padding: 12px 16px 12px 14px;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
  will-change: transform, opacity;
}

.tile:hover {
  background: rgba(26, 32, 53, 0.9);
  border-color: rgba(0, 255, 178, 0.25);
  box-shadow: 0 0 20px rgba(0, 255, 178, 0.05);
  transform: translateY(-1px);
}

.tile:active {
  background: rgba(26, 32, 53, 0.9);
}

[data-theme="light"] .tile {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .tile:hover {
  background: rgba(240, 241, 245, 0.95);
  border-color: rgba(0, 204, 142, 0.3);
  box-shadow: 0 0 20px rgba(0, 204, 142, 0.08);
}

/* Left border pulse on first load */
.tile.border-pulse {
  animation: border-glow 0.8s ease-out forwards;
}
@keyframes border-glow {
  0%   { box-shadow: -3px 0 10px var(--tile-color); }
  100% { box-shadow: none; }
}

/* Tile content sits above the ::before spotlight (z-index 0) */
.tile-meta,
.tile-title,
.tile-summary,
.tile-footer {
  position: relative;
  z-index: 2;
}

/* Tile header row: source tag + timestamp */
.tile-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.tile-source {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tile-color, var(--text-secondary));
  opacity: 0.85;
}

.tile-time {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  opacity: 0.6;
  margin-left: auto;
}

/* Subreddit tag */
.tile-subreddit {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* Headline */
.tile-title {
  font-family: var(--font-headline);
  font-size: var(--headline-standard);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 5px;
  letter-spacing: -0.01em;
}

/* Blurb / summary */
.tile-summary {
  font-family: var(--font-body);
  font-size: 14px;
  color: #8B93A8;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

[data-theme="light"] .tile-summary {
  color: #5A6380;
}

/* Footer row: score + language */
.tile-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.tile-score {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--tile-color, var(--text-secondary));
  text-shadow: 0 0 6px var(--tile-color, transparent);
  opacity: 0.9;
}

.tile-language {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.6;
}

/* ── Upgrade 2: Cursor-Tracked Spotlight ── */
/* Swipe ripple uses ::after; spotlight uses ::before */
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(0, 255, 178, 0.06),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 0;
}

.tile:hover::before {
  opacity: 1;
}

/* Light mode spotlight uses slightly darker accent */
[data-theme="light"] .tile::before {
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(0, 204, 142, 0.08),
    transparent 40%
  );
}

/* Mobile: simple active glow instead of cursor tracking */
@media (hover: none) {
  .tile:active {
    border-color: rgba(0, 255, 178, 0.3) !important;
    box-shadow: 0 0 16px rgba(0, 255, 178, 0.08);
  }
  .tile::before { display: none; }
}

/* ── Upgrade 3: Skeleton Loaders ── */
.tile-skeleton {
  padding: 12px 16px 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 2px solid rgba(255, 255, 255, 0.08);
  background: rgba(17, 21, 32, 0.8);
  overflow: hidden;
  position: relative;
}

.skeleton-line {
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(0, 255, 178, 0.07) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  margin-bottom: 8px;
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton-meta   { height: 10px; width: 30%; margin-bottom: 8px; }
.skeleton-title  { height: 16px; width: 85%; margin-bottom: 6px; }
.skeleton-title2 { height: 16px; width: 60%; margin-bottom: 8px; }
.skeleton-body   { height: 12px; width: 100%; margin-bottom: 4px; }
.skeleton-body.short { width: 70%; }
.skeleton-score  { height: 10px; width: 20%; margin-top: 4px; margin-left: auto; }

@media (prefers-reduced-motion: reduce) {
  .skeleton-line { animation: none; }
}

[data-theme="light"] .skeleton-line {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.05) 0%,
    rgba(0, 204, 142, 0.08) 50%,
    rgba(0, 0, 0, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

/* ── Swipe Gestures ── */

/* Ripple from left on swipe-right (save) */
.tile::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0;
  background: linear-gradient(90deg, rgba(0, 255, 178, 0.18), transparent);
  pointer-events: none;
  transition: width 0.3s ease-out;
  z-index: 1;
}
.tile.swipe-save::after { width: 100%; }

/* Swipe-left → desaturate + collapse */
.tile.swipe-dismiss {
  filter: saturate(0.1) brightness(0.5);
  transform: translateX(-100%);
  opacity: 0;
  max-height: 200px;
  transition: transform 0.2s ease-out, opacity 0.2s ease-out, filter 0.2s ease-out, max-height 0.25s ease-out 0.15s;
}

/* ── Cascade animations ── */
/* Tiles cascade in from bottom on section/date switch */
.tile.cascade-in {
  animation: cascade-up 0.3s ease-out both;
}
@keyframes cascade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   DATE SLIDE TRANSITIONS
================================================================ */
#feed.slide-left  { animation: slide-from-right 0.25s ease-out; }
#feed.slide-right { animation: slide-from-left  0.25s ease-out; }

@keyframes slide-from-right {
  from { transform: translateX(32px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes slide-from-left {
  from { transform: translateX(-32px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* ================================================================
   BOTTOM DOCK — always horizontal at bottom, all viewports
================================================================ */
#section-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(var(--dock-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(17, 21, 32, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-around;
}

[data-theme="light"] #section-nav {
  background: rgba(245, 246, 250, 0.9);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.nav-btn {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  opacity: 0.35;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 4px;
  position: relative;
  border-radius: 8px;
}
.nav-btn:hover { opacity: 0.65; }
.nav-btn:active { opacity: 0.6; }

.nav-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* Active glow indicator dot above icon */
.nav-btn.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.04);
}
.nav-btn.active .nav-label {
  color: var(--nav-active-color, var(--accent-mint));
}
/* Note: active::after is the dot indicator; active::before is used for spotlight on tiles */
.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--nav-active-color, var(--accent-mint));
  box-shadow: 0 0 8px var(--nav-active-color, var(--accent-mint));
  transition: all 0.15s ease;
}

/* ── Desktop: wider content, keep horizontal dock ── */
@media (min-width: 768px) {
  :root {
    --column-max: 960px;
  }

  #main {
    padding: 0 16px;
  }

  .tile {
    border-radius: 8px;
    margin-bottom: 2px;
  }
}

/* ================================================================
   EMPTY & ERROR STATES
================================================================ */
.state-empty, .state-error {
  padding: 60px 24px;
  text-align: center;
}
.state-empty h2, .state-error h2 {
  font-family: var(--font-headline);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.state-empty p, .state-error p {
  font-size: 14px;
  color: var(--text-secondary);
}
.state-error h2 { color: var(--accent-ember); }

/* ================================================================
   SCROLLBAR STYLING (WebKit)
================================================================ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ================================================================
   MOBILE WOW UPGRADES
================================================================ */

/* ── Overscroll: prevent native pull-to-refresh on mobile ── */
@media (hover: none) {
  body {
    overscroll-behavior-y: none;
  }
}

/* ── Gyroscope Parallax Layer (injected by JS) ── */
#gyro-orbs {
  position: fixed;
  inset: -30px;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 50% 40% at 20% 30%, rgba(0, 255, 178, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 80% 70%, rgba(100, 0, 255, 0.04) 0%, transparent 60%);
  transform: translate(var(--tilt-x, 0px), var(--tilt-y, 0px));
  transition: transform 0.3s ease-out;
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  #gyro-orbs { transition: none; }
}
[data-theme="light"] #gyro-orbs {
  opacity: 0;
}

/* ── Upgrade 1: Touch Ripple Effect ── */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(0, 255, 178, 0.15);
  transform: scale(0);
  animation: ripple-expand 0.6s ease-out forwards;
  pointer-events: none;
  z-index: 5;
}
[data-theme="light"] .ripple {
  background: rgba(0, 204, 142, 0.12);
}
@keyframes ripple-expand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ── Upgrade 2: Staggered Card Entrance ── */
.tile-enter {
  opacity: 0;
  transform: translateY(20px);
  animation: tile-slide-in 0.3s ease-out forwards;
}
@keyframes tile-slide-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Upgrade 4: Dock Sliding Indicator ── */
.dock-indicator {
  position: absolute;
  height: 36px;
  bottom: calc(var(--safe-bottom) + 14px);
  left: 0;
  width: var(--dock-indicator-width, 60px);
  background: rgba(0, 255, 178, 0.1);
  border: 1px solid rgba(0, 255, 178, 0.2);
  border-radius: 16px;
  pointer-events: none;
  z-index: 0;
  transform: translateX(var(--dock-indicator-x, 0px));
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease, opacity 0.3s;
  opacity: 0;
}
[data-theme="light"] .dock-indicator {
  background: rgba(0, 204, 142, 0.1);
  border-color: rgba(0, 204, 142, 0.25);
}

/* ── Upgrade 5: Pull-to-Refresh Visual Indicator ── */
.pull-indicator {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top) + 12px);
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  width: 36px;
  height: 36px;
  border: 2px solid rgba(0, 255, 178, 0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  color: rgba(0, 255, 178, 0.7);
  background: rgba(10, 12, 18, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.pull-indicator.visible {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.pull-indicator.ready {
  border-color: rgba(0, 255, 178, 0.8);
  color: var(--accent-mint);
  box-shadow: 0 0 16px rgba(0, 255, 178, 0.3);
}
[data-theme="light"] .pull-indicator {
  background: rgba(245, 246, 250, 0.9);
  color: var(--accent-mint);
}

/* Radar Ping — expands on pull release */
.radar-ping {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top) + 30px);
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  border: 2px solid rgba(0, 255, 178, 0.8);
  border-radius: 50%;
  pointer-events: none;
  z-index: 200;
  animation: radar-ping-anim 0.8s ease-out forwards;
}
@keyframes radar-ping-anim {
  0%   { transform: scale(1); opacity: 1; }
  100% { transform: scale(8); opacity: 0; }
}

/* ================================================================
   UTILITY
================================================================ */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ================================================================
   READ STATE — Tile visual treatment
================================================================ */

/* Dimmed tile for read items */
.tile--read {
  opacity: 0.42;
  transition: opacity 0.25s ease;
}
.tile--read:hover {
  opacity: 0.75;
}
/* Strikethrough on title for read tiles */
.tile--read .tile-title {
  text-decoration: line-through;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-decoration-thickness: 1px;
}
[data-theme="light"] .tile--read .tile-title {
  text-decoration-color: rgba(0, 0, 0, 0.3);
}

/* ── Read button (✓) inside tile-meta ── */
.tile-read-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 44px; /* mobile tap target padding accounted via negative margin */
  min-height: 44px;
  margin: -8px -4px -8px auto; /* push to right, absorb tile padding */
  padding: 0;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
/* Always visible on touch devices */
@media (hover: none) {
  .tile-read-btn {
    opacity: 0.35;
  }
}
/* Show on hover/focus on pointer devices */
.tile:hover .tile-read-btn,
.tile-read-btn:focus-visible {
  opacity: 1;
}
/* Already-read state — always visible */
.tile-read-btn--read {
  opacity: 1 !important;
  color: var(--accent-mint);
  border-color: var(--accent-mint);
  background: rgba(0, 255, 178, 0.1);
}
.tile-read-btn:hover {
  color: var(--accent-mint);
  border-color: rgba(0, 255, 178, 0.5);
  background: rgba(0, 255, 178, 0.08);
}
[data-theme="light"] .tile-read-btn {
  border-color: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .tile-read-btn--read {
  color: var(--accent-mint);
  border-color: var(--accent-mint);
  background: rgba(0, 204, 142, 0.1);
}

/* ================================================================
   READ CONTROLS BAR
================================================================ */

#read-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--divider);
  flex-wrap: wrap;
}

.read-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  flex: 1;
  white-space: nowrap;
}

.read-ctrl-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 0 12px;
  height: 30px;
  min-width: 44px;
  background: rgba(17, 21, 32, 0.8);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.read-ctrl-btn:hover:not(:disabled) {
  background: rgba(26, 32, 53, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}
.read-ctrl-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.read-ctrl-btn--primary {
  color: var(--accent-mint);
  border-color: rgba(0, 255, 178, 0.25);
}
.read-ctrl-btn--primary:hover:not(:disabled) {
  background: rgba(0, 255, 178, 0.08);
  border-color: rgba(0, 255, 178, 0.5);
  color: var(--accent-mint);
}

[data-theme="light"] .read-ctrl-btn {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .read-ctrl-btn:hover:not(:disabled) {
  background: rgba(240, 241, 245, 0.95);
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--text-primary);
}
[data-theme="light"] .read-ctrl-btn--primary {
  color: var(--accent-mint);
  border-color: rgba(0, 204, 142, 0.3);
}

/* ================================================================
   TUTORIAL BADGE
================================================================ */
.tile-tutorial-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 209, 102, 0.15);
  color: #FFD166;
  padding: 2px 6px;
  border-radius: 2px;
  border: 1px solid rgba(255, 209, 102, 0.3);
}

/* Light mode */
[data-theme="light"] .tile-tutorial-badge {
  background: rgba(255, 179, 0, 0.12);
  color: #B37700;
  border-color: rgba(255, 179, 0, 0.3);
}
