/* Súmula — InShorts-style card feed. Clean, minimal, image-forward. */
:root {
  --red: #d6002a;
  --red-soft: #ff2d55;
  --bg: #f2f2f4;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e6e9;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
  --card-max: 460px;
  --topbar-h: 54px;
  --chips-h: 46px;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #16161a;
  --text: #f2f2f2;
  --muted: #9b9ba3;
  --line: #26262c;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  --red: #ff375f;
  --red-soft: #ff6482;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #000000; --surface: #16161a; --text: #f2f2f2; --muted: #9b9ba3;
    --line: #26262c; --shadow: 0 6px 24px rgba(0,0,0,.5); --red: #ff375f; --red-soft: #ff6482;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------- Top bar ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 20;
  padding-top: env(safe-area-inset-top);
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.brand-mark {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--red); color: #fff; font-weight: 900; font-size: 16px;
}
.brand-name { font-size: 18px; letter-spacing: -0.02em; }
.topbar-actions { display: flex; gap: 4px; }
.icon-btn {
  background: none; border: none; color: var(--text);
  font-size: 20px; line-height: 1; cursor: pointer;
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--line); }
.icon-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- Category chips ---------- */
.chips {
  height: var(--chips-h);
  display: flex; gap: 8px; align-items: center;
  padding: 0 12px; overflow-x: auto; overflow-y: hidden;
  background: var(--surface); border-bottom: 1px solid var(--line);
  scrollbar-width: none; position: relative; z-index: 15;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.chip[aria-selected="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.chip:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- Search ---------- */
.searchbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--surface); border-bottom: 1px solid var(--line); z-index: 15;
}
.searchbar input {
  flex: 1; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  border-radius: 999px; padding: 10px 16px; font-size: 15px; outline: none;
}
.searchbar input:focus { border-color: var(--red); }

/* ---------- Feed (scroll-snap) ---------- */
.feed {
  height: calc(100dvh - var(--topbar-h) - var(--chips-h) - env(safe-area-inset-top));
  overflow-y: auto; scroll-snap-type: y mandatory;
  scroll-behavior: smooth; outline: none;
  -webkit-overflow-scrolling: touch;
}
.feed::-webkit-scrollbar { width: 0; }

.card {
  scroll-snap-align: start; scroll-snap-stop: always;
  height: 100%; display: flex; justify-content: center; align-items: stretch;
  padding: 10px 10px 16px;
}
.card-inner {
  width: 100%; max-width: var(--card-max);
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
}
.card-img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--line);
  display: block; flex: 0 0 auto;
}
.card-img.placeholder {
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 22px;
  background: linear-gradient(135deg, var(--red), var(--red-soft));
}
.card-body { padding: 16px 18px 8px; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.card-cat {
  align-self: flex-start; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--red); margin-bottom: 8px;
}
.card h2 {
  font-size: 21px; line-height: 1.28; font-weight: 800; margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.card p.summary {
  font-size: 16px; line-height: 1.5; margin: 0; color: var(--text);
  overflow-y: auto; flex: 1 1 auto;
}
.card-meta {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px;
}
.card-meta a { color: var(--red); text-decoration: none; font-weight: 700; }
.card-meta a:hover { text-decoration: underline; }

.card-actions {
  display: flex; align-items: center; gap: 6px; padding: 4px 12px 12px;
}
.card-actions .grow { flex: 1; }
.act {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
}
.act:hover { background: var(--line); color: var(--text); }
.act[aria-pressed="true"] { color: var(--red); }
.act:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- States ---------- */
.state {
  height: 100%; display: grid; place-items: center; text-align: center; padding: 24px;
  color: var(--muted);
}
.state .retry-btn { margin-top: 12px; }
.state .spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--red);
  animation: spin 0.8s linear infinite; margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  background: rgba(0,0,0,.72); color: #fff; font-size: 12px;
  padding: 7px 14px; border-radius: 999px; z-index: 30; pointer-events: none;
  transition: opacity .4s; backdrop-filter: blur(4px);
}
.hint.hide { opacity: 0; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(56px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600;
  padding: 10px 16px; border-radius: 999px; z-index: 40; box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
  .feed { scroll-behavior: auto; }
  .spinner { animation: none; }
}

/* Desktop: give the phone-column a subtle stage */
@media (min-width: 700px) {
  body { background: radial-gradient(circle at 50% 0%, rgba(214,0,42,.06), var(--bg) 60%); }
}
