/* FreshInsight — aligned with UI/freshinsight.ai.pen + VI tokens */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --fi-bg: #f6f3ec;
  --fi-elevated: #fafaf8;
  --fi-surface: #ffffff;
  --fi-text: #2b2f36;
  --fi-text-muted: #6b7280;
  --fi-border: #e4dfd6;
  --fi-border-subtle: #efe8e0;
  --fi-fresh-blue: #3b8bed;
  --fi-insight-teal: #2ab3a8;
  --fi-negative: #dc2626;
  --fi-negative-bg: rgba(220, 38, 38, 0.08);
  --fi-shadow: rgba(43, 47, 54, 0.08);
  --fi-radius-sm: 6px;
  --fi-radius-md: 10px;
  --fi-radius-lg: 14px;
  --fi-header-h: 72px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--fi-text);
  background: var(--fi-bg);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

a {
  color: var(--fi-fresh-blue);
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: #2563c4;
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* —— Layout —— */
.fi-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* —— Header —— */
.fi-header {
  position: relative;
  z-index: 20;
  background: var(--fi-bg);
  border-bottom: 1px solid var(--fi-border);
}

.fi-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--fi-header-h);
  gap: 16px;
  padding: 12px 0;
}

.fi-logo {
  display: block;
  height: 40px;
  width: auto;
  object-fit: contain;
}

.fi-logo--icon {
  height: 40px;
  width: 40px;
  object-fit: contain;
}

.fi-header__nav {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fi-text-muted);
}

.fi-header__link {
  color: var(--fi-text-muted);
  font-weight: 600;
  text-decoration: none;
}

.fi-header__link:hover {
  color: var(--fi-text);
  text-decoration: none;
}

/* —— Band (elevated strip, matches pen sticky / ticker) —— */
.fi-band {
  position: relative;
  z-index: 10;
}

.fi-band--elevated {
  background: var(--fi-elevated);
  border-bottom: 1px solid var(--fi-border-subtle);
}

/* Matches pen “Tech Accent Bar” */
.fi-accent-line {
  width: 100%;
  height: 6px;
  background: var(--fi-insight-teal);
}

/* —— Hero —— */
.fi-hero {
  text-align: center;
  padding: 48px 20px 40px;
  position: relative;
  z-index: 1;
}

.fi-hero__badge {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--fi-insight-teal);
  letter-spacing: 0.02em;
}

.fi-hero__title {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--fi-text);
  letter-spacing: -0.02em;
}

.fi-hero__sub {
  margin: 0 auto;
  max-width: 560px;
  font-size: 1.05rem;
  color: var(--fi-text-muted);
  font-weight: 400;
}

/* —— Category + chips —— */
.fi-category {
  margin-top: 8px;
  margin-bottom: 28px;
}

.fi-category__title {
  margin: 0 0 16px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--fi-text);
}

.fi-channels {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.fi-channels.is-visible {
  display: flex;
}

.fi-chip {
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fi-text);
  background: var(--fi-surface);
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius-md);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.fi-chip:hover {
  border-color: var(--fi-fresh-blue);
  box-shadow: 0 2px 8px var(--fi-shadow);
}

.fi-chip--active {
  font-weight: 700;
  color: #fff;
  background: var(--fi-fresh-blue);
  border-color: var(--fi-fresh-blue);
}

.fi-chip--active:hover {
  box-shadow: 0 4px 14px rgba(59, 139, 237, 0.35);
}

/* —— Video grid —— */
.fi-videos {
  margin-top: 8px;
}

.fi-videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.fi-card {
  background: var(--fi-surface);
  border-radius: var(--fi-radius-sm);
  overflow: hidden;
  border: 1px solid var(--fi-border-subtle);
  box-shadow: 0 1px 3px var(--fi-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--fi-shadow);
}

.fi-card__thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  cursor: pointer;
  background: #e8e4dc;
}

.fi-card__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.fi-card:hover .fi-card__thumb {
  transform: scale(1.04);
}

.fi-card__play {
  position: absolute;
  bottom: 12px;
  left: 12px;
  width: 44px;
  height: 44px;
  background: rgba(43, 47, 54, 0.75);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.fi-card__play::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 14px solid #fff;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  margin-left: 3px;
}

.fi-card__body {
  padding: 14px 16px 16px;
}

.fi-card__title {
  margin: 0 0 6px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--fi-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.fi-card__meta {
  font-size: 0.8rem;
  color: var(--fi-text-muted);
}

/* —— States —— */
.fi-loading {
  text-align: center;
  padding: 48px 20px;
  color: var(--fi-text-muted);
  font-size: 1rem;
}

.fi-loading::after {
  content: '...';
  animation: fi-dots 1.2s steps(4, end) infinite;
}

@keyframes fi-dots {
  0%,
  20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%,
  100% {
    content: '...';
  }
}

.fi-error {
  background: var(--fi-negative-bg);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: var(--fi-negative);
  padding: 18px 20px;
  border-radius: var(--fi-radius-md);
  margin: 16px 0;
  text-align: center;
}

/* —— Load more —— */
.fi-load-more-wrap {
  text-align: center;
  margin: 40px 0 24px;
}

.fi-btn-primary {
  display: inline-block;
  padding: 12px 28px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--fi-fresh-blue);
  border: none;
  border-radius: var(--fi-radius-sm);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(59, 139, 237, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fi-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(59, 139, 237, 0.45);
}

.fi-btn-primary:active {
  transform: translateY(0);
}

.fi-btn-primary.hidden {
  display: none;
}

.fi-btn-ghost {
  display: inline-block;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fi-text);
  background: var(--fi-surface);
  border: 1px solid var(--fi-border);
  border-radius: var(--fi-radius-sm);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.fi-btn-ghost:hover {
  border-color: var(--fi-fresh-blue);
  text-decoration: none;
  color: var(--fi-text);
}

/* —— Footer —— */
.fi-footer {
  margin-top: 56px;
  padding: 22px 20px 28px;
  background: var(--fi-bg);
  border-top: 1px solid var(--fi-border);
}

.fi-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.fi-footer__brand {
  flex-shrink: 0;
}

.fi-footer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  justify-content: center;
  flex: 1;
  min-width: 200px;
}

.fi-footer__sep {
  color: var(--fi-border);
  user-select: none;
}

.fi-footer__link {
  color: var(--fi-text-muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.fi-footer__link:hover {
  color: var(--fi-fresh-blue);
  text-decoration: underline;
}

.fi-footer__copy {
  margin: 0;
  font-size: 0.85rem;
  color: var(--fi-text-muted);
  text-align: right;
}

.fi-footer__note {
  font-size: 0.9rem;
  color: var(--fi-text-muted);
}

@media (max-width: 640px) {
  .fi-footer__inner {
    flex-direction: column;
    text-align: center;
  }

  .fi-footer__copy {
    text-align: center;
  }
}

/* —— Video modal —— */
.fi-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: rgba(15, 18, 24, 0.88);
  backdrop-filter: blur(8px);
}

.fi-modal.is-open {
  display: flex;
}

.fi-modal__panel {
  position: relative;
  width: 92%;
  max-width: 1100px;
  max-height: 92vh;
  overflow: auto;
  padding: 20px;
  background: var(--fi-surface);
  border-radius: var(--fi-radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.fi-modal__panel--portrait {
  max-width: 420px;
}

.fi-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--fi-elevated);
  color: var(--fi-text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 2;
}

.fi-modal__close:hover {
  background: var(--fi-border-subtle);
}

.fi-modal__player {
  width: 100%;
  border-radius: var(--fi-radius-sm);
  overflow: hidden;
  background: #000;
}

.fi-modal__player--landscape {
  aspect-ratio: 16/9;
}

.fi-modal__player--portrait {
  aspect-ratio: 9/16;
  max-height: 70vh;
}

.fi-modal__player iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.fi-modal__info {
  margin-top: 16px;
  color: var(--fi-text);
}

.fi-modal__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.fi-modal__meta {
  font-size: 0.9rem;
  color: var(--fi-text-muted);
}

.fi-modal__desc {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--fi-border-subtle);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--fi-text-muted);
  white-space: pre-wrap;
  max-height: 240px;
  overflow-y: auto;
}

.fi-modal__desc:empty {
  display: none;
}

/* —— Legal pages —— */
.fi-legal {
  padding: 32px 20px 48px;
}

.fi-legal__card {
  max-width: 920px;
  margin: 0 auto;
  padding: 36px 40px;
  background: var(--fi-surface);
  border: 1px solid var(--fi-border-subtle);
  border-radius: var(--fi-radius-md);
  box-shadow: 0 2px 12px var(--fi-shadow);
}

.fi-legal h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 700;
  color: var(--fi-text);
}

.fi-legal h2 {
  margin: 28px 0 10px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--fi-text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--fi-border-subtle);
}

.fi-legal h3 {
  margin: 18px 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fi-text);
}

.fi-legal p,
.fi-legal li {
  color: var(--fi-text-muted);
}

.fi-legal ul {
  margin: 8px 0 12px 20px;
  padding: 0;
}

.fi-legal .fi-muted {
  font-size: 0.9rem;
  color: var(--fi-text-muted);
}

.fi-legal .fi-last-updated {
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: var(--fi-text-muted);
}

.fi-legal strong {
  color: var(--fi-text);
  font-weight: 600;
}

@media (max-width: 600px) {
  .fi-legal__card {
    padding: 24px 18px;
  }

  .fi-legal h1 {
    font-size: 1.6rem;
  }
}

/* —— Video detail page —— */
.fi-video-page {
  margin-top: 24px;
}

.fi-video-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.fi-video-player {
  border-radius: var(--fi-radius-md);
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 28px var(--fi-shadow);
}

.fi-video-player--landscape {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  aspect-ratio: 16/9;
}

.fi-video-player--portrait {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  aspect-ratio: 9/16;
}

.fi-video-player iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.fi-video-info {
  margin-top: 20px;
  padding: 24px 28px;
  background: var(--fi-surface);
  border: 1px solid var(--fi-border-subtle);
  border-radius: var(--fi-radius-md);
}

.fi-video-info__title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--fi-text);
  overflow-wrap: anywhere;
}

.fi-video-info__meta {
  font-size: 0.95rem;
  color: var(--fi-text-muted);
  margin-bottom: 16px;
}

.fi-video-info__desc {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--fi-border-subtle);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--fi-text-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Scrollbar — light */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--fi-border-subtle);
}

::-webkit-scrollbar-thumb {
  background: #c4bdb2;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a099;
}
