/* ========================================
   LINKFLICK — style.css
   ======================================== */

:root {
  --bg: #080808;
  --bg2: #111111;
  --bg3: #181818;
  --border: rgba(255,255,255,0.07);
  --text: #f0f0f0;
  --text-muted: #666;
  --text-dim: #999;
  --accent: #ff3d00;
  --accent-glow: rgba(255,61,0,0.25);
  --green: #00e676;
  --yellow: #ffd600;
  --red: #ff1744;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --radius: 10px;
  --card-radius: 8px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  overflow-x: hidden;
  cursor: none;
}

/* ---- NOISE ---- */
.noise {
  position: fixed;
  inset: -200%;
  width: 400%;
  height: 400%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1000;
  /* no animation — causes repaint spike on tab switch */
}

/* ---- CURSOR RING (real cursor untouched) ---- */
#cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: difference;
  transition: width 0.25s cubic-bezier(0.25,0.46,0.45,0.94),
              height 0.25s cubic-bezier(0.25,0.46,0.45,0.94),
              opacity 0.3s ease;
  will-change: transform;
}

#cursor-ring.hovering {
  width: 64px;
  height: 64px;
}

/* ---- HEADER ---- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 48px;
  background: linear-gradient(to bottom, rgba(8,8,8,0.95), transparent);
  backdrop-filter: blur(0px);
}

.logo {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 3px;
  color: var(--text);
}

/* ---- STATUS BAR ---- */
.status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 8px 18px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-dim);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.4s ease;
  flex-shrink: 0;
}

.status-dot.online  { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-dot.offline { background: var(--red); }
.status-dot.sleeping{ background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.status-dot.checking{ animation: pulse-dot 1.2s ease-in-out infinite; }

.status-divider {
  color: var(--border);
  font-size: 14px;
}

/* ---- HERO ---- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 48px 80px;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  width: min(600px, 100vw);
  height: min(600px, 100vw);
  background: radial-gradient(circle, rgba(255,61,0,0.08) 0%, transparent 70%);
  pointer-events: none;
  overflow: hidden;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(80px, 13vw, 160px);
  line-height: 0.9;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 56px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---- SEARCH ---- */
.search-wrap {
  width: 100%;
  max-width: 640px;
}

.search-inner {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 6px 6px 24px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-inner:focus-within {
  border-color: rgba(255,61,0,0.4);
  box-shadow: 0 0 0 4px rgba(255,61,0,0.06);
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 12px;
}

#search {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  caret-color: var(--accent);
}

#search::placeholder {
  color: var(--text-muted);
}

#search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 12px 22px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: none;
  transition: background 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
}

#search-btn svg {
  width: 15px;
  height: 15px;
  transition: transform 0.2s ease;
}

#search-btn:hover {
  background: #ff5722;
}

#search-btn:hover svg {
  transform: translateX(3px);
}

#search-btn:active {
  transform: scale(0.97);
}

/* ---- RESULTS AREA ---- */
.results-area {
  padding: 0 48px 120px;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 80px;
}

/* ---- SECTION HEADER ---- */
.results-section {}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.section-meta {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.section-source {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: 1px;
  color: var(--text);
}

.section-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.section-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* ---- CARD GRID ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

/* ---- MOVIE CARD ---- */
.card {
  position: relative;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: var(--bg2);
  aspect-ratio: 2/3;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation: card-in 0.5s ease both;
}

.card:hover {
  transform: translateY(-6px) scale(1.02);
  z-index: 2;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.card:hover img {
  transform: scale(1.06);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: flex-end;
  padding: 16px;
}

.card:hover .card-overlay {
  opacity: 1;
}

.card-title-overlay {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  color: #fff;
}

.card-title-below {
  padding: 10px 10px 12px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.3;
}

/* ---- SKELETON ---- */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

.skeleton-card {
  border-radius: var(--card-radius);
  background: var(--bg3);
  aspect-ratio: 2/3;
  overflow: hidden;
  position: relative;
}

.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.04) 50%, transparent 100%);
  animation: shimmer 1.5s infinite;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  padding: 60px 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---- SLEEPING STATE ---- */
.sleeping-state {
  padding: 60px 0;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.sleeping-icon {
  font-size: 32px;
  margin-bottom: 16px;
}

.sleeping-state p {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.sleeping-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted) !important;
  margin-bottom: 24px !important;
}

.retry-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 100px;
  padding: 10px 24px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: none;
  transition: background 0.2s, color 0.2s;
}

.retry-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ---- FOOTER ---- */
.footer {
  text-align: center;
  padding: 32px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.footer-sep { color: var(--border); }

/* ---- UTILITIES ---- */
.hidden { display: none !important; }

/* ---- STATUS DROPDOWN (mobile) ---- */
.status-toggle-btn {
  display: none;
  align-items: center;
  gap: 7px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.2s;
}
.status-toggle-btn:hover { border-color: rgba(255,255,255,0.15); }
.status-toggle-btn .toggle-arrow {
  font-size: 9px;
  transition: transform 0.25s ease;
  display: inline-block;
}
.status-toggle-btn.open .toggle-arrow { transform: rotate(180deg); }

.status-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 180px;
  z-index: 200;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: dropdown-in 0.2s cubic-bezier(0.25,0.46,0.45,0.94) both;
}
.status-dropdown.open { display: flex; }

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.status-dropdown .status-item {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  gap: 10px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  /* layout */
  .header        { padding: 16px 20px; position: relative; }
  .logo          { font-size: 22px; }
  .status-bar    { display: none; }           /* hide desktop pill */
  .status-toggle-btn { display: flex; }       /* show mobile toggle */

  /* hero — big title back, just slightly smaller than desktop */
  .hero          { padding: 90px 20px 52px; min-height: 100svh; }
  .hero-eyebrow  { font-size: 10px; letter-spacing: 2px; margin-bottom: 16px; }
  .hero-title    { font-size: clamp(64px, 16vw, 90px); margin-bottom: 36px; }
  .hero::before  { width: 100vw; height: 100vw; max-width: 400px; max-height: 400px; }

  .search-wrap   { max-width: 100%; }
  .search-inner  { padding: 5px 5px 5px 16px; }
  #search        { font-size: 14px; }
  #search-btn    { padding: 10px 16px; font-size: 13px; }
  #search-btn .btn-arrow { display: none; }

  .results-area  { padding: 0 16px 60px; gap: 52px; }
  .section-source { font-size: 24px; }
  .card-grid,
  .skeleton-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .empty-state,
  .sleeping-state { padding: 40px 16px; }
  .footer        { padding: 24px 16px; font-size: 10px; gap: 10px; }

  /* cursor ring off */
  #cursor-ring   { display: none; }
  body           { cursor: auto; }
  button, a      { cursor: pointer; }

  /* cards — disable hover transforms (scroll jank) */
  .card:hover     { transform: none; }
  .card:hover img { transform: none; }
  .card-overlay   { opacity: 1; background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 60%); }
}

/* kill animations for reduced motion / low-end devices */
@media (prefers-reduced-motion: reduce) {
  .noise         { animation: none; }
  .card          { animation: none; }
  .reveal-up,
  .reveal-clip   { animation: none; opacity: 1; transform: none; }
}

/* notch / safe area support */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .footer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
