@import "tailwindcss";

/* Digest/thumb helpers (Bootstrap-like spec adapted to Tailwind) */
.thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2; /* slightly more vertical */
  border-radius: 0.25rem;
  overflow: hidden; /* ensure the crop is clean */
}
.thumb-wrap > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;    /* center-crop */
  object-position: center;
  display: block;
}

@supports not (aspect-ratio: auto) {
  .thumb-wrap::before {
    content: "";
    display: block;
    padding-top: calc(100% * 2 / 3); /* 3:2 aspect fallback */
  }
  .thumb-wrap > img {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
  }
}

/* Keep card fonts stable across breakpoints on digest pages */
.digest-container .card .card-title, .digest-card .card-title { font-size: 1rem; }
.digest-container .card .card-text,  .digest-card .card-text  { font-size: 0.95rem; }

/* Digest card typography – fixed sizes across breakpoints (match design) */
.dc-topic { font-size: 1rem; font-weight: 600; color: #475569; }
.dc-title { font-size: 1.5rem; line-height: 1.25; font-weight: 700; font-family: nyt-cheltenham,cheltenham-fallback-georgia,cheltenham-fallback-noto,georgia,'times new roman',times,serif; }
.dc-summary { font-size: 1.125rem; line-height: 1.55; font-family: nyt-imperial,georgia,'times new roman',times,serif; }

/* Light mode: make digest show topic tags blue (only on digest page) */
html:not(.dark) body.page-digests-show .dc-topic a { color: #2563eb; }
.dc-meta { font-size: 0.95rem; color: #64748b; }

/* Article typography – match digest card fonts for headline/snippet only */
.article-source { color: #6b7280; /* gray-500 */ }
.article-headline { font-size: 1.125rem; line-height: 1.55; color: #000000; font-weight: 700; font-family: nyt-cheltenham,cheltenham-fallback-georgia,cheltenham-fallback-noto,georgia,'times new roman',times,serif; }
.article-snippet { font-size: 1.125rem; line-height: 1.55; color: #64748b; font-family: nyt-imperial,georgia,'times new roman',times,serif; }

/* Ensure card body has equal vertical padding so image centers with self-center */
/* Remove fixed padding so per-breakpoint utility classes control spacing */
/* .digest-card { padding-top: 1rem; padding-bottom: 1rem; } */

/* Simple 2-line clamp without Tailwind plugin */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Fixed-size icon helpers to normalize SVG and emoji sizing */
.icon-16 {
  width: 16px;
  height: 16px;
  display: block;
}
.emoji-16 {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 16px;
}

/* Normalize any inline SVGs inside digest meta rows */
.dc-meta svg {
  width: 16px !important;
  height: 16px !important;
  display: block;
}

/* Nudge inline icons slightly downward to match text visual baseline */
.icon-nudge { position: relative; top: 1px; display: inline-block; }
/* Scholar icon color: match link color in light and dark modes */
.scholar-icon { color: #2563eb; }
html.dark .scholar-icon { color: #60a5fa; }

/* Desktop-only hover affordances for clickable digest cards */
@media (hover: hover) and (pointer: fine) {
  .card-clickable { cursor: pointer; }
  .digest-card {
    transition: background-color 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  }
  .digest-card:hover {
    background-color: rgb(249 250 251); /* gray-50 */
    border-color: rgb(148 163 184);      /* gray-400 */
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  }
  /* Subtle hover for Bluesky cards - much lighter than gray-50 */
  .bsky-card { transition: background-color 120ms ease, border-color 120ms ease; }
  .bsky-card:hover { background-color: rgba(0, 0, 0, 0.02); }
}

/* Dark mode overrides */
html.dark body { background-color: #000000; color: rgb(241, 243, 245); }
html.dark a { color: #60a5fa; }
html.dark .text-black { color: rgb(241, 243, 245); }
html.dark .text-gray-700 { color: #cbd5e1; }
html.dark .text-gray-600 { color: #cbd5e1; }
html.dark .text-gray-500 { color: #94a3b8; }
html.dark .bg-white { background-color: #0b0b0b; }
html.dark .bg-white\/90 { background-color: rgba(11,11,11,0.90); }
html.dark .bg-white\/80 { background-color: rgba(11,11,11,0.80); }
html.dark .bg-white\/95 { background-color: rgba(11,11,11,0.95); }
html.dark .bg-gray-50 { background-color: #0b0b0b; }
html.dark .bg-gray-100 { background-color: #111827; }
html.dark .border { border-color: #334155; }
html.dark .border-t { border-color: #334155; }
html.dark .border-b { border-color: #334155; }
html.dark .border-gray-200 { border-color: #334155; }
html.dark .border-gray-300 { border-color: #475569; }
html.dark .border-gray-400 { border-color: #64748b; }
html.dark .hover\:bg-gray-50:hover { background-color: #111827; }
html.dark .divide-gray-200 > :not([hidden]) ~ :not([hidden]) { border-color: #334155; }
html.dark .text-gray-500 { color: #94a3b8; }
html.dark .text-gray-700 { color: #e2e8f0; }
html.dark .text-gray-800 { color: #e5e7eb; }
html.dark .brand-text { color: #ffffff !important; }
html.dark .dc-topic { color: #94a3b8; }
html.dark .dc-meta { color: #94a3b8; }
html.dark .article-source { color: #94a3b8; }
html.dark .article-headline { color: rgb(241, 243, 245); }
html.dark .article-snippet { color: #94a3b8; }
html.dark header .border-b { border-color: #334155; }
html.dark footer { border-color: #334155; }
html.dark .digest-card { background-color: #0b0b0b; border-color: #475569; }
html.dark .digest-card:hover { background-color: #111827; border-color: #64748b; }
html.dark .bsky-card:hover { background-color: #0f1116; }
/* Match Bluesky list cards to digest card border style on large screens */
.bluesky-list-card { border-color: #e5e7eb; }
html.dark .bluesky-list-card { border-color: #475569; }
html.dark .dc-title { color: rgb(241, 243, 245); }
html.dark .dc-summary { color: #cbd5e1; }
html.dark [class*="bg-white/90"] { background-color: rgba(11,11,11,0.90); }
/* Scholar modal specific */
html.dark .modal-scholar .text-gray-600 { color: #cbd5e1; }
html.dark .modal-scholar .text-gray-800 { color: #e5e7eb; }
html.dark .modal-scholar .border { border-color: #475569; }

/* Thread connector line color – match card borders */
.thread-line { background-color: #e5e7eb; }
html.dark .thread-line { background-color: #334155; }

/* Bluesky reply text – match Bluesky mobile styles */
.bsky-reply-text {
  font-size: 15px;
  line-height: 20px;
  letter-spacing: 0;
  font-family: InterVariable, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-variant-ligatures: no-contextual;
}
html.dark .bsky-reply-text { color: rgb(241, 243, 245); }

/* Swap header brand icon in dark mode */
.logo-dark { display: none; }
html.dark .logo-light { display: none !important; }
html.dark .logo-dark { display: inline-block !important; }
