/* News project styles (extends global /styles.css tokens)
   Scoped to .news-app so the portfolio header/footer keep their original look.
*/

.news-app {
  /* Dark "news feed" theme */
  --bg0: #070a14;
  --bg1: #0b1020;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.10);
  --border: rgba(255, 255, 255, 0.12);

  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --faint: rgba(255, 255, 255, 0.48);

  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);

  color: var(--text);
  background:
    radial-gradient(900px 600px at 18% 10%, rgba(124, 92, 255, 0.22), transparent 55%),
    radial-gradient(800px 520px at 82% 16%, rgba(34, 211, 238, 0.16), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

/* News should never appear blank if the global reveal JS fails.
   Override the global [data-reveal] hidden state for this project page. */
.news-page [data-reveal] {
  opacity: 1;
  transform: none;
}

/* Hint to the browser/OS that this page is dark-themed (affects native controls) */
.news-page {
  color-scheme: dark;
}

.news-app a {
  color: inherit;
}

.news-app a:hover {
  color: var(--accent-2);
}

.news-app :focus-visible {
  outline: 3px solid rgba(34, 211, 238, 0.60);
  outline-offset: 3px;
  border-radius: 10px;
}

.news-app .muted {
  color: var(--muted) !important;
}

/* Hero */
.news-app .news-hero {
  padding: var(--space-5) 0 var(--space-4);
  position: relative;
  /* Allow sticky sidebar to work (sticky breaks under overflow != visible). */
  overflow: visible;
}

.news-app .news-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(920px 420px at 22% 0%, rgba(34, 211, 238, 0.10), transparent 62%),
    radial-gradient(920px 420px at 78% 0%, rgba(124, 92, 255, 0.10), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 72%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.02) 0px,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 28px
    );
  opacity: 0.85;
  pointer-events: none;
}

.news-app .news-hero .container {
  position: relative;
}

.news-app .news-top-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.news-app .news-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.news-app .news-topbar .news-top-actions {
  margin-top: 0;
}

.news-app .news-topbar .news-top-links {
  margin-top: 0;
}

.news-app .news-top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.news-app .news-top-links .news-pill {
  padding: 8px 12px;
}

.news-app .markets-anchor {
  height: 1px;
}

.news-app .news-hero-extras {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 14px;
}

.news-app .news-masthead {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.news-app .news-dateline {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.news-app .news-masthead .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}

/* Mascot */
.news-app .news-mascot {
  justify-self: end;
  width: min(360px, 100%);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: translateY(0);
  animation: mascotFloat 4.6s ease-in-out infinite;
}

.news-app .news-mascot svg {
  display: block;
  width: 100%;
  height: auto;
}

.news-app .news-mascot .m-caption {
  opacity: 0.95;
}

@keyframes mascotFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.news-app .news-mascot .m-topic {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transform-origin: center;
  transition: opacity 220ms ease, transform 220ms ease;
}

.news-app .news-mascot[data-topic="world"] .m-world,
.news-app .news-mascot[data-topic="business"] .m-business,
.news-app .news-mascot[data-topic="tech"] .m-tech,
.news-app .news-mascot[data-topic="sports"] .m-sports,
.news-app .news-mascot[data-topic="crypto"] .m-crypto {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Controls */
.news-app .news-controls {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  margin: 18px 0 18px;
}

.news-app .news-controls label {
  display: block;
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.news-app .news-controls select,
.news-app .news-controls input[type="search"] {
  width: 100%;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

/* Help the native dropdown menu render dark on supported browsers */
.news-app .news-controls select {
  color-scheme: dark;
}

.news-app .news-controls select option {
  background-color: var(--bg1);
  color: var(--text);
}

.news-app .news-controls input::placeholder {
  color: var(--faint);
}

.news-app .news-controls .news-actions {
  display: flex;
  gap: 10px;
}

.news-app .news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.news-app .news-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 34vw, 420px);
  gap: 18px;
  align-items: start;
  margin-top: 14px;
}

.news-app .news-hero-main,
.news-app .news-hero-side {
  min-width: 0;
}

.news-app .news-hero-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.news-app .news-hero-side #trendsPanel {
  position: sticky;
  top: 82px;
}

.news-app .news-preview-frame {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  overflow: hidden;
}

.news-app .news-preview-checking {
  margin: 0;
}

.news-app .news-preview-blocked {
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 12px;
  background: var(--surface);
}

.news-app .news-preview-blocked p {
  margin: 0 0 8px;
}

.news-app .news-preview-blocked p:last-child {
  margin-bottom: 0;
}

.news-app .news-preview-frame iframe {
  display: block;
  width: 100%;
  height: 520px;
  border: 0;
}

.news-app .news-preview-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.news-app .news-preview-title a {
  text-decoration: none;
}

.news-app .news-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
}

.news-app .news-preview-meta .news-time {
  margin-left: auto;
}

.news-app .news-item {
  cursor: pointer;
}

.news-app .news-item.is-active {
  border-color: rgba(34, 211, 238, 0.26);
  background: rgba(255, 255, 255, 0.07);
}

.news-app .news-item-inline {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 10px;
}

/* If the item is in 2-column grid on desktop, make inline preview span full width */
@media (min-width: 980px) {
  .news-app .news-item-inline { grid-column: 1 / -1; }
}

.news-app .news-item-inline .news-preview-frame iframe {
  height: 420px;
}

.news-app .news-hero-main .news-panel {
  margin-top: 12px;
}

.news-app .news-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

/* Layout */
.news-app .news-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.news-app .news-panel {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: rgba(7, 10, 20, 0.62);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.news-app .news-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 40%),
    radial-gradient(520px 220px at 10% 0%, rgba(34, 211, 238, 0.10), transparent 60%),
    radial-gradient(520px 220px at 90% 0%, rgba(124, 92, 255, 0.10), transparent 60%);
  opacity: 0.9;
}

.news-app .news-panel > * {
  position: relative;
}

.news-app .news-panel-head {
  padding: 16px 16px 0;
}

.news-app .news-panel-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.news-app .news-panel-head::after {
  content: "";
  display: block;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin-top: 12px;
}

.news-app .news-panel-body {
  padding: 16px;
}

/* Loading overlay */
.news-app .news-loading {
  position: absolute;
  inset: 0;
  background: rgba(7, 10, 20, 0.72);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  z-index: 10;
}

.news-app .news-loading[hidden] {
  display: none !important;
}

.news-app .news-loading-inner {
  width: min(520px, calc(100% - 32px));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.news-app .news-skel-title,
.news-app .news-skel-line {
  border-radius: 999px;
  height: 12px;
  margin: 10px 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.12), rgba(255,255,255,0.06));
  background-size: 240% 100%;
  animation: shimmer 1.15s ease-in-out infinite;
}

.news-app .news-skel-title { height: 14px; width: 72%; }
.news-app .news-skel-line { width: 100%; }
.news-app .news-skel-line.short { width: 62%; }

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* Feed */
.news-app .news-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-app .news-item {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 12px;
  margin: 0;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
  position: relative;
}

.news-app .news-item:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 211, 238, 0.20);
  background: rgba(255, 255, 255, 0.06);
}

.news-app .news-list.is-animated .news-item {
  animation: feedIn 260ms ease both;
}

@keyframes feedIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.news-app .news-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.news-app .news-source {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.news-app .news-time {
  color: var(--faint);
  font-weight: 600;
  font-size: 12px;
}

.news-app .news-time-unknown {
  font-style: italic;
}

.news-app .news-item h3 {
  margin: 6px 0 6px;
  font-size: 16px;
  line-height: 1.25;
}

/* On wide screens, avoid reserving a big right column for actions.
   Keep cards compact by letting text span full width; align actions to the right. */
@media (min-width: 980px) {
  .news-app .news-item {
    display: block;
  }

  .news-app .news-item .news-links {
    justify-content: flex-end;
    margin-top: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.news-app .news-item h3 a {
  text-decoration: none;
}

.news-app .news-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.news-app .news-pill,
.news-app .news-links .news-share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.news-app .news-links .news-share {
  cursor: pointer;
  font: inherit;
}

.news-app .news-pill:hover,
.news-app .news-links .news-share:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 211, 238, 0.26);
}

.news-app .news-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: rgba(255, 255, 255, 0.92);
}

.news-app .news-icon svg {
  display: block;
  width: 16px;
  height: 16px;
}

.news-app .news-pill-text {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.01em;
}

/* Variant "colored" pills using existing tokens (no new hard-coded palette) */
.news-app .news-pill--share {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.20), rgba(34, 211, 238, 0.16));
  border-color: rgba(124, 92, 255, 0.25);
}

.news-app .news-pill--share:hover {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.26), rgba(34, 211, 238, 0.22));
  border-color: rgba(34, 211, 238, 0.30);
}

.news-app .news-pill--x {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.06));
  border-color: rgba(255, 255, 255, 0.16);
}

.news-app .news-pill--x:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.08));
}

.news-app .news-pill--reddit {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(124, 92, 255, 0.14));
  border-color: rgba(34, 211, 238, 0.24);
}

.news-app .news-pill--reddit:hover {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.22), rgba(124, 92, 255, 0.20));
  border-color: rgba(124, 92, 255, 0.28);
}

/* Markets blocks */
.news-app .markets-block + .markets-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.news-app .markets-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.news-app .markets-tab.is-active {
  border-color: rgba(34, 211, 238, 0.26);
  background: rgba(255, 255, 255, 0.08);
}

.news-app .markets-hint {
  margin: 0;
}

.news-app .markets-actions {
  display: flex;
  justify-content: flex-start;
  margin: 10px 0 12px;
}

.news-app .markets-title {
  margin: 0;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.news-app .market-title-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.88);
}

.news-app .market-title-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.news-app .market-link {
  color: inherit;
  text-decoration: none;
}

.news-app .market-link:hover {
  color: var(--accent-2);
}

.news-app .market-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.news-app .market-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.news-app img.market-icon {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
}

.news-app .market-icon--stock,
.news-app .market-icon--coin {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.86);
}

.news-app .market-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  min-width: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.86);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.news-app .market-name {
  font-weight: 700;
}

.news-app .market-sym {
  color: var(--muted);
  font-weight: 700;
}

.news-app .markets-subtitle {
  margin: 6px 0 0;
}

.news-app .crypto-chart-card {
  margin-top: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 12px;
}

.news-app .crypto-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 10px;
}

.news-app .crypto-sel {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.news-app .crypto-sel-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
}

.news-app .crypto-sel-text {
  min-width: 0;
}

.news-app .crypto-sel-name {
  font-weight: 900;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-app .crypto-sel-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-app .crypto-sel-right {
  text-align: right;
  flex: 0 0 auto;
}

.news-app .crypto-sel-price {
  font-size: 18px;
  font-weight: 900;
}

.news-app .crypto-sel-chg {
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}

.news-app .market-select {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.news-app .market-select:hover .market-name {
  color: var(--accent-2);
}

.news-app .market-ext {
  margin-left: 8px;
  color: var(--muted);
  text-decoration: none;
}

.news-app .market-ext:hover {
  color: var(--accent-2);
}

.news-app .crypto-table tbody tr.is-selected {
  background: rgba(255, 255, 255, 0.05);
}

.news-app .crypto-chart-wrap {
  height: 240px;
}

.news-app .crypto-table-wrap {
  margin-top: 14px;
  overflow: auto;
}

.news-app .crypto-table {
  width: 100%;
  border-collapse: collapse;
}

.news-app .crypto-table th,
.news-app .crypto-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  text-align: left;
  font-size: 13px;
}

.news-app .crypto-table th {
  color: var(--muted);
  font-weight: 700;
}

.news-app .crypto-up { color: var(--good); font-weight: 700; }
.news-app .crypto-down { color: #ff6b6b; font-weight: 700; }
.news-app .pct-up { color: var(--good); font-weight: 700; }
.news-app .pct-down { color: rgba(255, 255, 255, 0.72); font-weight: 700; }

/* Toast */
.news-app .news-toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(7, 10, 20, 0.85);
  backdrop-filter: blur(10px);
  color: var(--text);
  box-shadow: var(--shadow);
  z-index: 2000;
}

/* Responsive */
@media (max-width: 980px) {
  .news-app .news-hero-grid {
    grid-template-columns: minmax(0, 1fr) clamp(300px, 40vw, 420px);
  }
  .news-app .news-mascot { justify-self: start; }
}

@media (max-width: 860px) {
  .news-app .news-hero-grid { grid-template-columns: 1fr; }

  .news-app .news-hero-side #trendsPanel {
    position: static;
    top: auto;
  }
}

@media (max-width: 820px) {
  .news-app .news-controls { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .news-app .news-controls { grid-template-columns: 1fr; }
  .news-app .news-controls .news-actions { flex-direction: column; }
  .news-app .news-preview-frame iframe { height: 60vh; }
}

@media (prefers-reduced-motion: reduce) {
  .news-app .news-mascot,
  .news-app .news-skel-title,
  .news-app .news-skel-line {
    animation: none !important;
  }

  .news-app .news-item,
  .news-app .news-links a,
  .news-app .news-mascot .m-topic {
    transition: none !important;
  }

  .news-app .news-list.is-animated .news-item {
    animation: none !important;
  }
}
