:root {
  --bg: #0a0d14;
  --bg-soft: #111622;
  --card: rgba(12, 18, 28, 0.82);
  --card-edge: rgba(255, 255, 255, 0.12);
  --text: #f4efe4;
  --muted: rgba(244, 239, 228, 0.72);
  --accent: #f4a261;
  --accent-soft: #f7c38c;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(244, 162, 97, 0.16), transparent 30%),
    linear-gradient(180deg, #07090f 0%, #0e1320 48%, #080a10 100%);
  color: var(--text);
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
}

body {
  overflow: hidden;
}

.app-shell {
  height: 100vh;
  position: relative;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 0;
  z-index: 20;
  pointer-events: none;
}

.brand-block {
  display: grid;
  gap: 0.1rem;
}

.control-stack {
  display: grid;
  gap: 0.75rem;
  justify-items: end;
}

.topbar > * {
  pointer-events: auto;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: min(100%, 42rem);
}

.search-shell {
  min-width: min(26rem, calc(100vw - 3rem));
  flex: 1;
}

.search-shell input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.82rem 1rem;
  background: rgba(7, 10, 16, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 0.96rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
}

.search-shell input::placeholder {
  color: rgba(244, 239, 228, 0.46);
}

.search-shell input:focus {
  outline: none;
  border-color: rgba(244, 162, 97, 0.72);
  box-shadow:
    0 0 0 3px rgba(244, 162, 97, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: end;
}

.eyebrow {
  margin: 0 0 0.25rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent-soft);
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-family: "Instrument Serif", serif;
  font-weight: 400;
}

.feed {
  height: 100vh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

.feed::-webkit-scrollbar {
  width: 0;
}

.card {
  position: relative;
  min-height: 100vh;
  scroll-snap-align: start;
  display: grid;
  align-items: center;
  padding: 5rem 1rem 1rem;
}

.card-media,
.media-image,
.media-gradient {
  position: absolute;
  inset: 0;
}

.card-media {
  overflow: hidden;
}

.media-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.05) contrast(1.02) brightness(0.75);
  transform: scale(1.04);
}

.media-gradient {
  background:
    linear-gradient(180deg, rgba(4, 8, 14, 0.16) 0%, rgba(4, 8, 14, 0.58) 40%, rgba(4, 8, 14, 0.92) 100%),
    linear-gradient(90deg, rgba(5, 7, 12, 0.72) 0%, transparent 55%);
}

.card-content {
  position: relative;
  z-index: 1;
  width: min(100%, 33rem);
  margin-top: auto;
  padding: 1rem;
  border: 1px solid var(--card-edge);
  border-radius: 1.5rem;
  background: linear-gradient(180deg, rgba(19, 24, 35, 0.62), rgba(9, 12, 19, 0.88));
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.4rem 0.72rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.8rem;
}

.card-title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 3.35rem);
  line-height: 0.96;
  max-width: 11ch;
  text-wrap: balance;
}

.card-extract {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.55;
  max-width: 48ch;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  overflow: hidden;
}

.card-search-snippet {
  margin: 0.85rem 0 0;
  padding: 0.72rem 0.8rem;
  border-radius: 1rem;
  background: rgba(244, 162, 97, 0.1);
  color: rgba(247, 226, 200, 0.92);
  font-size: 0.9rem;
  line-height: 1.45;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1rem;
}

.read-link,
.ghost-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 0.72rem 0.98rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
  font: inherit;
  font-size: 0.94rem;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.read-link {
  background: linear-gradient(135deg, var(--accent), #df7b2d);
  color: #1e1108;
  border-color: transparent;
  font-weight: 700;
}

.read-link:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.ghost-button.is-busy {
  opacity: 0.58;
  cursor: progress;
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status-chip {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 25;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: rgba(8, 10, 16, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-size: 0.9rem;
  backdrop-filter: blur(12px);
}

.card.is-loading .card-content {
  min-height: 22rem;
  animation: pulse 1.1s ease-in-out infinite alternate;
}

.card.is-loading .card-title,
.card.is-loading .card-extract,
.card.is-loading .meta-pill,
.card.is-loading .card-actions {
  visibility: hidden;
}

@keyframes pulse {
  from {
    opacity: 0.62;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
  }

  .control-stack {
    width: 100%;
    justify-items: stretch;
  }

  .search-form {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-shell {
    min-width: 100%;
  }

  .topbar-actions {
    justify-content: start;
  }

  .card {
    padding-top: 11rem;
  }

  .card-content {
    width: 100%;
    border-radius: 1.25rem;
  }

  .card-title {
    max-width: none;
  }
}
