:root {
  color-scheme: light;
  --page-bg: #eff4f9;
  --paper: #ffffff;
  --paper-soft: #f7faff;
  --ink: #111827;
  --muted: #5f6b7a;
  --line: #d7e0eb;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --shadow: 0 22px 60px rgba(17, 24, 39, 0.08);
  --radius-lg: 30px;
  --radius-md: 22px;
  --radius-sm: 16px;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-top: var(--appbar-height, 60px);
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28rem),
    linear-gradient(180deg, #f7fbff 0%, var(--page-bg) 100%);
  color: var(--ink);
  font-family: var(--sans);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--sans);
  font-weight: 750;
  letter-spacing: -0.04em;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3.5rem;
}

.tool-tag {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  font-size: 0.82rem;
}

.hero {
  position: relative;
  min-height: 540px;
  overflow: hidden;
  margin-bottom: 2.25rem;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.story-stack,
.tool-card {
  background: var(--paper);
  border: 1px solid rgba(215, 224, 235, 0.85);
  box-shadow: var(--shadow);
}

.story-stack,
.tool-card {
  border-radius: var(--radius-lg);
}

.hero {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(100%, 42rem);
  padding: 0;
  display: grid;
  align-content: center;
  gap: 1rem;
  color: #fff;
  box-shadow: none;
  text-shadow: 0 2px 18px rgba(15, 23, 42, 0.45);
}

.hero-copy h1 {
  font-size: clamp(3rem, 5vw, 5.2rem);
  line-height: 0.92;
  max-width: 10ch;
}

.hero-copy .eyebrow {
  color: #dbeafe;
}

.hero-copy .lede {
  color: rgba(255, 255, 255, 0.9);
  max-width: 32rem;
  font-size: 1.05rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent);
}

.hero-banner-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(15, 23, 42, 0.72) 0%, rgba(15, 23, 42, 0.42) 32%, rgba(15, 23, 42, 0.16) 58%, rgba(15, 23, 42, 0.18) 100%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.18) 0%, rgba(15, 23, 42, 0.24) 100%);
}

.hero-banner-overlay {
  position: relative;
  z-index: 1;
  min-height: 540px;
}

.hero-banner-inner {
  width: min(1220px, calc(100% - 2rem));
  min-height: 540px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 2.5rem 1.1rem;
}

.lede,
.section-copy,
.story-kicker,
.story-summary,
.tool-copy {
  color: var(--muted);
  line-height: 1.65;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin: 0 0 1rem;
}

.section-heading h2,
.story-list-header h3 {
  margin-top: 0.15rem;
}

.section-copy {
  margin: 0;
  max-width: 34rem;
}

.story-stack {
  padding: 1.1rem 1.1rem 0.85rem;
  display: grid;
  gap: 1.1rem;
}

.story-stack-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  padding: 0.25rem 0.25rem 0;
}

.story-stack-header h3 {
  margin-top: 0.2rem;
  font-size: 1.35rem;
}

.featured-story {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1fr);
  gap: 1.35rem;
  overflow: visible;
  padding: 0.25rem 0.25rem 1.35rem;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  background: transparent;
}

.featured-media {
  background: var(--paper-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.featured-image {
  width: 100%;
  height: 100%;
  min-height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(17, 24, 39, 0.08));
}

.featured-body {
  padding: 0.4rem 0;
  display: grid;
  gap: 0.85rem;
  align-content: center;
}

.featured-story .story-category {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--accent-soft);
}

.story-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.story-meta-row .story-date,
.story-list-date {
  font-size: 0.88rem;
  color: var(--muted);
}

.story-category {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.featured-title,
.story-list-title {
  line-height: 1.03;
  text-wrap: balance;
}

.featured-title {
  font-size: clamp(2.4rem, 4vw, 4rem);
  max-width: 12ch;
}

.featured-actions,
.tool-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.2rem;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.78rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 650;
}

.button-link.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.story-list {
  display: grid;
  gap: 0.9rem;
  padding-top: 0.2rem;
}

.story-list-item {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  padding: 0.25rem;
  border-top: 1px solid var(--line);
}

.story-list-thumb-link {
  display: block;
}

.story-list-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(17, 24, 39, 0.08));
}

.story-list-body {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.2rem 0;
}

.story-list-title {
  font-size: 1.42rem;
}

.story-list-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.show-more-btn {
  display: block;
  margin: 0.75rem 0 0 auto;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.show-more-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.search-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.tools-heading {
  margin-top: 2rem;
}

.tool-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.tool-card {
  padding: 1.2rem;
  display: grid;
  gap: 0.85rem;
}

.tool-top {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: start;
}

.tool-title {
  font-size: 1.2rem;
}

.tool-tag {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tool-link {
  color: var(--accent);
  font-weight: 700;
}

.tool-embed {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}

.tool-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.tool-card--live .tool-tag {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

.tool-card--external {
  border-style: dashed;
}

.tool-card--external .tool-tag {
  background: rgba(107, 114, 128, 0.1);
  color: var(--muted);
}

.tool-external-note {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  font-style: italic;
}

.tool-card--obsolete {
  opacity: 0.55;
  border-style: dashed;
  border-color: rgba(215, 224, 235, 0.6);
}

.tool-card--obsolete:hover {
  opacity: 0.8;
}

.tool-card--obsolete .tool-tag {
  background: rgba(107, 114, 128, 0.08);
  color: var(--muted);
  text-decoration: line-through;
}

.tool-card--obsolete .tool-title {
  color: var(--muted);
}

.tool-archived-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 1rem;
}

.tool-archived-toggle {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
  padding: 0.4rem 0;
  transition: color 0.15s;
}

.tool-archived-toggle:hover {
  color: var(--ink);
}

.tool-archived-toggle i {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.tool-archived-toggle.expanded i {
  transform: rotate(90deg);
}

.tool-archived-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 1040px) {
  .tool-archived-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .tool-archived-grid {
    grid-template-columns: 1fr;
  }
}



@media (max-width: 1040px) {
  .featured-story {
    grid-template-columns: 1fr;
  }

  .tool-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 1rem, 1180px);
  }

  .section-heading,
  .story-stack-header {
    display: grid;
  }

  .story-list-item {
    grid-template-columns: 1fr;
  }

  .hero,
  .hero-banner-inner {
    min-height: 460px;
  }

  .hero-banner-inner {
    align-items: flex-end;
    width: min(100% - 1rem, 1220px);
    padding: 1.25rem 1.1rem;
  }

  .hero-copy {
    width: 100%;
  }

  .tool-strip {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 1.4rem;
  }

  .story-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .engagement-row {
    align-self: flex-start;
  }

  .comment-drawer {
    width: 100%;
  }
}

/* ============================
   Hearts & Engagement
   ============================ */

.story-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.story-title-row .featured-title,
.story-title-row .story-list-title {
  flex: 1;
  min-width: 0;
}

.engagement-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.heart-btn,
.comment-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0.3rem 0.45rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}

.heart-btn:hover {
  color: #e11d48;
  background: rgba(225, 29, 72, 0.08);
}

.comment-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.heart-icon,
.comment-icon {
  fill: currentColor;
  flex-shrink: 0;
}

.heart-btn.heart-active {
  color: #e11d48;
}

.heart-btn.heart-active .heart-icon {
  fill: #e11d48;
}

.heart-count,
.comment-count {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  min-width: 1ch;
}

/* ============================
   Comment Drawer (slide-in)
   ============================ */

.comment-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(17, 24, 39, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.comment-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.comment-drawer {
  position: fixed;
  top: var(--appbar-height, 60px);
  right: 0;
  bottom: 0;
  z-index: 910;
  width: min(420px, 90vw);
  background: var(--paper);
  box-shadow: -8px 0 40px rgba(17, 24, 39, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.comment-drawer.open {
  transform: translateX(0);
}

.comment-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.comment-drawer-title {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.comment-drawer-close {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--muted);
  padding: 0.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.comment-drawer-close:hover {
  color: var(--ink);
}

.comment-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comment-loading,
.comment-empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 0;
}

.comment-item {
  display: grid;
  gap: 0.2rem;
}

.comment-author {
  font-weight: 700;
  font-size: 0.88rem;
}

.comment-time {
  font-size: 0.78rem;
  color: var(--muted);
}

.comment-text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink);
}

.comment-compose {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.comment-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
}

.comment-input:focus {
  border-color: var(--accent);
}

.comment-submit {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 650;
  font-size: 0.88rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.comment-submit:hover {
  opacity: 0.88;
}

.comment-submit:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ============================
   Sidebar
   ============================ */

.sidebar {
  position: fixed;
  top: var(--appbar-height, 60px);
  left: 0;
  bottom: 0;
  z-index: 850;
  width: min(300px, 85vw);
  background: var(--paper);
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 24px rgba(17, 24, 39, 0.08);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 840;
  background: rgba(17, 24, 39, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-inner {
  padding: 0.75rem 0.65rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-heading {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin: 0 0 0.1rem;
  padding: 0 0.5rem;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-list li a,
.sidebar-list li button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.35rem 0.55rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}

.sidebar-list li a:hover,
.sidebar-list li button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-list li a i,
.sidebar-list li button i {
  width: 1.1rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
  flex-shrink: 0;
}

.sidebar-list li a:hover i,
.sidebar-list li button:hover i {
  color: var(--accent);
}

.sidebar-sources button.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.sidebar-sources button.active i {
  color: var(--accent);
}

.sidebar-source-count {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sidebar-sources button.active .sidebar-source-count {
  color: var(--accent);
}

/* Source filter banner */
.source-filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
}

.source-filter-banner button {
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
}

.source-filter-banner button:hover {
  opacity: 1;
}

/* Story source clickable */
.story-category.clickable {
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}

.story-category.clickable:hover {
  background: var(--accent);
  color: #fff;
}

/* Desktop: push content when sidebar is open */
@media (min-width: 769px) {
  .sidebar-overlay.open {
    display: none;
  }

  body.sidebar-open {
    padding-left: 300px;
    transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
}

@media (max-width: 768px) {
  .sidebar {
    box-shadow: 8px 0 40px rgba(17, 24, 39, 0.15);
  }
  .sidebar-list li a,
  .sidebar-list li button {
    font-size: 1rem;
    padding: 0.5rem 0.65rem;
  }
  .sidebar-heading {
    font-size: 0.8rem;
  }
  .sidebar-list li a i,
  .sidebar-list li button i {
    font-size: 1rem;
  }
}
