/* FinVista — financial news, mobile-first */
:root {
  /* --bg and --accent are defined in /global.css */
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --line: #e8eaef;
  --accent-soft: #ffe8e0;
  --blue: #5b8def;
  --green: #4caf82;
  --purple: #8b7cf6;
  --coral: #ff8a65;
  --orange: #f0a04b;
  --header-h: 52px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(20, 24, 40, 0.06);
  --max: 720px;
  --font: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0);
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  height: 100%;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.header-back, .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 10px;
  flex-shrink: 0;
}
.brand {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.header-actions { display: flex; align-items: center; gap: 2px; }

/* Menu page nav */
.menu-page-nav ul { display: flex; flex-direction: column; gap: 6px; }
.menu-page-nav a {
  display: block;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 15px;
  box-shadow: var(--shadow);
}
.menu-page-nav a:hover { background: var(--accent-soft); color: #c45a38; border-color: transparent; }
.search-box__btn {
  flex-shrink: 0;
  border: 0;
  border-radius: 10px;
  background: var(--text);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
}

/* Main shell */
.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 14px 40px;
}

/* Hero */
.hero {
  position: relative;
  display: block;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(10,12,20,.78) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px 16px 16px;
  color: #fff;
}
.hero-overlay h1 {
  font-size: clamp(18px, 4.6vw, 24px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  text-shadow: 0 1px 8px rgba(0,0,0,.35);
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  width: fit-content;
}
.pill-dark { background: rgba(255,255,255,.22); color: #fff; backdrop-filter: blur(6px); }
.pill-solid { background: var(--accent); color: #fff; }
.tag-blue { background: #5b8def; color: #fff; }
.tag-orange { background: #f0a04b; color: #fff; }
.tag-purple { background: #8b7cf6; color: #fff; }
.tag-green { background: #4caf82; color: #fff; }
.tag-coral { background: #ff8a65; color: #fff; }

/* Two-column grid */
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
.card {
  background: var(--accent);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-media .pill {
  position: absolute;
  left: 8px;
  bottom: 8px;
}
.card-body { padding: 10px 10px 12px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.card-body h3,
.card-body .card-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-body .excerpt {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
  font-size: 10.5px;
  color: var(--muted);
}
.avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #ddd;
}
.card-meta .author { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta .views { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.card-meta .views svg { opacity: .7; }

/* Section title */
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 14px;
}
.section-head h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.section-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Hot topics horizontal */
.hot-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 18px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hot-scroll::-webkit-scrollbar { display: none; }
.hot-card {
  flex: 0 0 140px;
  scroll-snap-align: start;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  box-shadow: var(--shadow);
}
.hot-card img { width: 100%; height: 100%; object-fit: cover; }
.hot-card span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 10px 8px;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.72));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}

/* Wide list card */
.list-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: stretch;
  background: var(--accent);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.list-card__thumb {
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
  align-self: center;
}
.list-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.list-card__body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.list-card__body h3,
.list-card__body .card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-card__body .excerpt {
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Category page */
.cat-banner {
  margin-bottom: 18px;
}
.cat-banner h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.cat-banner p { color: var(--muted); font-size: 14px; }
.cat-list .list-card { grid-template-columns: 110px 1fr; }

/* Article detail */
.article-hero {
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  aspect-ratio: 16 / 9;
}
.article-hero img { width: 100%; height: 100%; object-fit: cover; }
.article-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}
.article-title {
  font-size: clamp(22px, 5.5vw, 30px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 12px;
}
.article-summary {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.article-body h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 22px 0 10px;
  letter-spacing: -0.02em;
}
.article-body p {
  margin-bottom: 14px;
  font-size: 15.5px;
  line-height: 1.7;
  color: #2a2a2a;
}
.article-body ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0 0 14px;
}
.article-body li { margin-bottom: 6px; line-height: 1.6; }
.article-figure {
  margin: 18px 0;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #eef0f4;
}
.article-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.related { margin-top: 28px; }
.related .section-head { margin-top: 0; }

/* Privacy */
.legal h1 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}
.legal .updated { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.legal h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 22px 0 8px;
}
.legal p { margin-bottom: 12px; color: #333; line-height: 1.7; }

/* Footer */
.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 14px 72px;
  text-align: center;
  border-top: 1px solid var(--line);
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.footer-links a:hover { color: var(--text); }
.page-top {
  display: block;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.back-top {
  position: fixed;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 16px 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 138, 101, 0.28);
  background: linear-gradient(180deg, #ffffff 0%, #fff7f3 100%);
  box-shadow:
    0 2px 4px rgba(20, 24, 40, 0.04),
    0 10px 24px rgba(255, 138, 101, 0.18);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #2a2a2a;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.back-top svg {
  width: 28px;
  height: 28px;
  padding: 6px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ff9a78 0%, #ff8a65 55%, #f07a52 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255, 138, 101, 0.45);
  flex-shrink: 0;
}
.back-top:hover {
  color: #c45a38;
  transform: translateY(-2px);
  box-shadow:
    0 4px 8px rgba(20, 24, 40, 0.06),
    0 14px 28px rgba(255, 138, 101, 0.28);
  background: #fff;
}
.back-top:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(255, 138, 101, 0.2);
}
@media (max-width: 380px) {
  .back-top {
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 0;
    gap: 0;
  }
  .back-top svg { margin: 0; }
}
.copyright { font-size: 12px; color: #9aa0ab; }

/* Search page */
.search-box {
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.search-box__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.search-box__row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f4f5f7;
  border-radius: 12px;
  padding: 4px 4px 4px 12px;
}
.search-box__icon { flex-shrink: 0; color: var(--muted); }
.search-box__row input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  padding: 10px 4px;
  outline: none;
  color: var(--text);
}
.search-box__row button {
  flex-shrink: 0;
  border: 0;
  border-radius: 10px;
  background: var(--text);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
}
.search-box__hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}
.search-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: #f0f2f5;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.search-chip:hover { background: var(--accent-soft); color: #c45a38; }
.search-section { margin-bottom: 8px; scroll-margin-top: calc(var(--header-h) + 12px); }

/* Desktop enhancements */
@media (min-width: 768px) {
  :root { --max: 980px; --header-h: 60px; }
  .page { padding: 24px 24px 56px; }
  .brand { font-size: 19px; }
  .card-grid { grid-template-columns: 1fr 1fr; gap: 18px; }
  .card-body h3,
  .card-body .card-title { font-size: 16px; -webkit-line-clamp: 3; }
  .card-body .excerpt { font-size: 13px; -webkit-line-clamp: 3; }
  .card-meta { font-size: 12px; }
  .avatar { width: 24px; height: 24px; }
  .hot-card { flex-basis: 180px; }
  .list-card { grid-template-columns: 140px 1fr; padding: 16px; gap: 16px; }
  .list-card__body h3,
  .list-card__body .card-title { font-size: 17px; }
  .list-card__body .excerpt { font-size: 13.5px; }
  .hero { aspect-ratio: 21 / 9; border-radius: 20px; }
  .hero-overlay { padding: 28px 28px 24px; }
  .hero-overlay h1 { font-size: 28px; max-width: 70%; }
  .article-title { font-size: 34px; }
  .article-body p { font-size: 17px; }
}

@media (min-width: 1024px) {
  :root { --max: 1080px; }
  .home-layout {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 20px;
    align-items: start;
  }
  .home-layout .hero { margin-bottom: 0; aspect-ratio: 4 / 3; }
  .home-layout .card-grid { margin-bottom: 0; }
}


/* Brand logo */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-logo {
  display: block;
  height: 28px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
}

/* Home header: logo + name on the left, no back button */
.site-header--home .header-inner {
  justify-content: space-between;
}
.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.brand-icon {
  display: inline-flex;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
}
.brand-icon img {
  display: block;
  width: 28px;
  height: 28px;
}
.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.list-card__body .card-title {
  font-size: 14px;
  -webkit-line-clamp: 2;
}
@media (min-width: 768px) {
  .brand-logo { height: 32px; }
  .card-title { font-size: 16px; -webkit-line-clamp: 3; }
  .list-card__body .card-title { font-size: 17px; }
}
