/* JESUS.TOKYO shared card language: warm paper, site red, quiet depth. */
:root {
  --jtx-ui-accent: #c9232d;
  --jtx-ui-accent-dark: #9f1821;
  --jtx-ui-accent-soft: #fff4f4;
  --jtx-ui-ink: #292421;
  --jtx-ui-muted: #6f665f;
  --jtx-ui-paper: #fff;
  --jtx-ui-wash: #fbf8f3;
  --jtx-ui-media: #f3ede7;
  --jtx-ui-border: #e3d9cf;
  --jtx-ui-border-strong: #e7c5c8;
  --jtx-ui-radius: 14px;
  --jtx-ui-radius-small: 9px;
  --jtx-ui-shadow: 0 5px 18px rgba(48, 34, 24, 0.08);
  --jtx-ui-shadow-hover: 0 12px 28px rgba(48, 34, 24, 0.14);
  --jtx-ui-focus: 0 0 0 3px rgba(201, 35, 45, 0.22);
}

/* Shared card shell. */
:is(
  article.post-list,
  .jtx-card,
  .jtx-topic-index__card,
  .jtx-topic-card,
  .jtx-start__card,
  .jtx-link-card,
  .jtx-profile-card,
  .jtx-popular-card,
  .jtx-finder-card,
  .related-box .related-list.jtx-related-list .jtx-related-link,
  .jtx-products,
  .jtx-author-trust
) {
  box-sizing: border-box;
  border: 1px solid var(--jtx-ui-border);
  border-radius: var(--jtx-ui-radius);
  background: var(--jtx-ui-paper);
  box-shadow: var(--jtx-ui-shadow);
  color: var(--jtx-ui-ink);
}

:is(
  article.post-list,
  .jtx-card,
  .jtx-topic-index__card,
  .jtx-topic-card,
  .jtx-profile-card,
  .jtx-popular-card,
  .jtx-finder-card,
  .related-box .related-list.jtx-related-list .jtx-related-link
) {
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

:is(
  article.post-list,
  .jtx-card,
  .jtx-topic-index__card,
  .jtx-topic-card,
  .jtx-profile-card,
  .jtx-popular-card,
  .jtx-finder-card,
  .related-box .related-list.jtx-related-list .jtx-related-link
):hover {
  border-color: var(--jtx-ui-border-strong);
  box-shadow: var(--jtx-ui-shadow-hover);
  transform: translateY(-2px);
}

/* Section-level containers use the same warm neutral family. */
:is(
  .jtx-discovery,
  .jtx-topic-hub__intro,
  .jtx-start__intro,
  .jtx-policy > section,
  .jtx-post-list-hub,
  .jtx-toc
) {
  border-color: var(--jtx-ui-border);
  border-radius: var(--jtx-ui-radius);
  background: linear-gradient(145deg, var(--jtx-ui-paper), var(--jtx-ui-wash));
  color: var(--jtx-ui-ink);
}

.jtx-discovery {
  box-shadow: var(--jtx-ui-shadow);
}

/* Keep the start-page introduction heading consistent with the site's red bands. */
body.jtx-focus-hub .jtx-start__intro h2 {
  margin: 0 0 0.7rem !important;
  padding: 0.68rem 0.9rem !important;
  border: 0 !important;
  border-radius: 6px;
  background: var(--jtx-ui-accent) !important;
  box-shadow: none !important;
  color: #fff !important;
  font-size: clamp(1rem, 3.8vw, 1.25rem);
  line-height: 1.45;
}

/* Remove the blue-gray drift from media placeholders and card surfaces. */
:is(
  .jtx-link-card__thumb,
  .jtx-profile-card__avatar,
  .jtx-popular-card__thumb,
  .jtx-finder-card__thumb,
  .jtx-image-fallback
) {
  background: var(--jtx-ui-media);
}

.jtx-profile-card {
  background: linear-gradient(145deg, var(--jtx-ui-paper), var(--jtx-ui-wash));
}

.jtx-link-card__link {
  background: transparent;
}

.jtx-link-card__link:hover {
  background: var(--jtx-ui-wash);
}

/* Titles and supporting copy. */
:is(
  .jtx-card__title,
  .jtx-topic-index__body strong,
  .jtx-topic-card h3,
  .jtx-start__card strong,
  .jtx-link-card__title,
  .jtx-profile-card__title,
  .jtx-profile-card__lead,
  .jtx-popular-card__title,
  .jtx-finder-card__title,
  .related-box .related-list.jtx-related-list .jtx-related-link .ttl
) {
  color: var(--jtx-ui-ink);
}

:is(
  .jtx-card__views,
  .jtx-topic-index__body > span,
  .jtx-topic-card__meta,
  .jtx-topic-card__excerpt,
  .jtx-start__card span,
  .jtx-link-card__excerpt,
  .jtx-link-card__date,
  .jtx-profile-card__text,
  .jtx-popular-card__excerpt,
  .jtx-popular-card__date,
  .jtx-finder-card__excerpt,
  .jtx-finder-card__date,
  .jtx-related-meta .date
) {
  color: var(--jtx-ui-muted);
}

/* One badge/chip treatment across discovery, search and related cards. */
:is(
  .jtx-card-tag,
  .jtx-link-card__tag,
  .jtx-popular-card__chip,
  .jtx-finder-card__chip,
  .jtx-finder-card__tag,
  .jtx-related-meta .cat-name,
  .jtx-related-tag,
  .jtx-similarity
) {
  border: 1px solid var(--jtx-ui-border-strong);
  border-radius: 999px;
  background: var(--jtx-ui-accent-soft);
  color: var(--jtx-ui-accent-dark);
}

:is(
  .jtx-discovery__eyebrow,
  .jtx-card__cta,
  .jtx-topic-index__body em,
  .jtx-topic-card__cta,
  .jtx-start__eyebrow,
  .jtx-start__card em,
  .jtx-start__all a,
  .jtx-related__heading p
) {
  color: var(--jtx-ui-accent);
}

/* Buttons and active controls share the site red. */
:is(
  .jtx-profile-card__cta-btn,
  .jtx-post-finder__more,
  .jtx-discovery__tab[aria-selected="true"]
) {
  border-color: var(--jtx-ui-accent);
  background: var(--jtx-ui-accent);
  color: #fff;
}

:is(
  .jtx-products__store,
  .jtx-post-finder__reset,
  .jtx-topic-hub__other a
) {
  border-color: var(--jtx-ui-border);
  background: var(--jtx-ui-wash);
  color: var(--jtx-ui-accent);
}

.jtx-discovery__tab:not([aria-selected="true"]):hover {
  border-color: var(--jtx-ui-border-strong);
  color: var(--jtx-ui-accent);
}

.jtx-discovery__tab[aria-selected="true"],
.jtx-discovery__tab[aria-selected="true"]:hover,
.jtx-discovery__tab[aria-selected="true"]:focus-visible,
.jtx-discovery__tab[aria-selected="true"]:active {
  border-color: var(--jtx-ui-accent);
  background: var(--jtx-ui-accent);
  color: #fff;
}

.jtx-carousel__track {
  scrollbar-color: rgba(201, 35, 45, 0.45) transparent;
}

.jtx-carousel__track::-webkit-scrollbar-thumb {
  background: rgba(201, 35, 45, 0.45);
}

.jtx-carousel__arrow {
  color: var(--jtx-ui-accent);
}

/* Consistent focus state for every clickable card and control. */
:is(
  article.post-list > a,
  .jtx-card__link,
  .jtx-topic-index__card,
  .jtx-topic-card > a,
  .jtx-start__card,
  .jtx-link-card__link,
  .jtx-profile-card,
  .jtx-popular-card,
  .jtx-finder-card,
  .related-box .related-list.jtx-related-list .jtx-related-link,
  .jtx-products__store,
  .jtx-discovery__tab,
  .jtx-carousel__arrow
):focus-visible {
  outline: 2px solid var(--jtx-ui-accent);
  outline-offset: 3px;
  box-shadow: var(--jtx-ui-focus);
}

/* Preserve the unified shell on compact screens. */
@media (max-width: 767px) {
  :root {
    --jtx-ui-radius: 12px;
  }

  :is(article.post-list, .jtx-card, .jtx-topic-card, .jtx-start__card) {
    box-shadow: 0 3px 12px rgba(48, 34, 24, 0.08);
  }

  /* Search-result card is the shared compact mobile pattern. */
  :is(.top-post-list, .post-list-card) {
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
    border-top: 0;
  }

  :is(body.home, .top-post-list, .post-list-card) article.post-list {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0;
    margin: 0 0 8px;
    overflow: hidden;
    border: 1px solid var(--jtx-ui-border);
    border-radius: 10px;
    background: #fff;
  }

  :is(body.home, .top-post-list, .post-list-card) article.post-list > a {
    display: grid;
    width: 100%;
    height: auto !important;
    min-height: 0;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: auto !important;
    align-items: stretch;
    gap: 8px;
    padding: 8px;
    border: 0;
    background: #fff;
  }

  :is(body.home, .top-post-list, .post-list-card) article.post-list .eyecatch {
    float: none;
    width: 56px;
    height: 56px;
    max-height: none;
    margin: 0 !important;
    overflow: hidden;
    border-radius: 8px;
    grid-column: 1 !important;
    grid-row: 1 !important;
    align-self: start;
    order: 0 !important;
  }

  :is(body.home, .top-post-list, .post-list-card) article.post-list .eyecatch img {
    display: block;
    width: 100%;
    height: 100% !important;
    object-fit: cover !important;
  }

  :is(body.home, .top-post-list, .post-list-card) article.post-list .eyecatch .cat-name {
    display: none;
  }

  :is(body.home, .top-post-list, .post-list-card) article.post-list .entry-content {
    display: flex;
    min-width: 0;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    flex-direction: column;
    align-self: center;
    float: none !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
    order: 0 !important;
    gap: 4px;
    padding: 0;
  }

  :is(body.home, .top-post-list, .post-list-card) article.post-list .entry-content .entry-title {
    display: -webkit-box !important;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: none;
    color: var(--jtx-ui-ink);
    font-size: 0.78rem;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  :is(body.home, .top-post-list, .post-list-card) article.post-list .entry-content :is(.description, p) {
    display: -webkit-box !important;
    margin: 0;
    overflow: hidden;
    color: var(--jtx-ui-muted);
    font-size: 0.72rem;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  :is(body.home, .top-post-list, .post-list-card) article.post-list .entry-content .date {
    margin: 0;
    color: var(--jtx-ui-muted);
    font-size: 0.67rem;
    line-height: 1.3;
  }

  :is(body.home, .top-post-list, .post-list-card) article.post-list .entry-content .description {
    max-height: calc(0.72rem * 1.45 * 2);
  }

  :is(body.home, .top-post-list, .post-list-card) article.post-list :is(.jtx-card-tags, .wpulike) {
    display: none !important;
  }

  /* HOME uses the same inset and content order as the article finder cards. */
  body.home article.post-list {
    width: calc(100% - 34px) !important;
    margin-right: auto;
    margin-left: auto;
  }

  body.home article.post-list .entry-title {
    order: 1;
  }

  body.home article.post-list .description {
    order: 2;
  }

  body.home article.post-list .entry-content p.byline {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    order: 3;
    min-height: 16px;
  }

  body.jtx-focus-hub .jtx-topic-index__card,
  body.jtx-focus-hub .jtx-start__card,
  .jtx-topic-card > a,
  .jtx-card__link,
  .jtx-link-card__link {
    display: grid;
    min-height: 0;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: 1fr;
    align-items: stretch;
    gap: 8px;
    padding: 8px;
  }

  body.jtx-focus-hub .jtx-topic-index__media,
  body.jtx-focus-hub .jtx-start__media,
  .jtx-topic-card__media,
  .jtx-card__media,
  .jtx-link-card__thumb {
    width: 56px;
    height: 56px;
    min-height: 0;
    max-width: none;
    aspect-ratio: auto;
    overflow: hidden;
    border-radius: 8px;
  }

  :is(
    .jtx-topic-index__image,
    .jtx-start__image,
    .jtx-topic-card__image,
    .jtx-card__image,
    .jtx-link-card__thumb img
  ) {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
  }

  body.jtx-focus-hub .jtx-topic-index__body,
  body.jtx-focus-hub .jtx-start__body,
  .jtx-topic-card__body,
  .jtx-card__body,
  .jtx-link-card__body {
    display: flex;
    min-width: 0;
    min-height: 0;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 0;
  }

  :is(
    .jtx-topic-index__body strong,
    .jtx-start__card strong,
    .jtx-topic-card h3,
    .jtx-card__title,
    .jtx-link-card__title,
    .jtx-popular-card__title,
    .jtx-finder-card__title,
    .related-box .related-list.jtx-related-list .jtx-related-link .ttl
  ) {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--jtx-ui-ink);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  :is(
    .jtx-topic-index__body > span,
    .jtx-start__description,
    .jtx-topic-card__excerpt,
    .jtx-link-card__excerpt,
    .jtx-popular-card__excerpt,
    .jtx-finder-card__excerpt
  ) {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--jtx-ui-muted);
    font-size: 0.72rem;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  :is(
    .jtx-topic-index__body em,
    .jtx-start__card em,
    .jtx-topic-card__cta,
    .jtx-card__cta,
    .jtx-card__category,
    .jtx-link-card__tags,
    .jtx-related-tags
  ) {
    display: none;
  }

  .jtx-card__views,
  .jtx-topic-card__meta,
  .jtx-link-card__date,
  .jtx-popular-card__date {
    margin: 0;
    font-size: 0.67rem;
    line-height: 1.3;
  }

  .jtx-popular-card,
  .jtx-finder-card {
    gap: 8px;
    padding: 8px;
    border-radius: 10px;
  }

  .jtx-popular-card__thumb,
  .jtx-finder-card__thumb {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border-radius: 8px;
  }

  .jtx-popular-card__body,
  .jtx-finder-card__body {
    gap: 4px;
  }

  .related-box .related-list.jtx-related-list {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /*
   * The parent theme leaves a 190px minimum height on related-post list
   * items at phone widths. Reset the list item as well as the link so these
   * cards use the same compact horizontal rhythm as mobile search results.
   */
  .related-box .related-list.jtx-related-list > li.jtx-related-item {
    height: auto !important;
    min-height: 0 !important;
  }

  .related-box .related-list.jtx-related-list .jtx-related-link {
    display: grid !important;
    height: auto !important;
    min-height: 0 !important;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: auto auto !important;
    align-items: center;
    column-gap: 8px;
    row-gap: 4px;
    padding: 8px;
    border-radius: 10px;
  }

  .related-box .related-list.jtx-related-list .jtx-related-link .eyecatch {
    width: 56px !important;
    height: 56px;
    grid-column: 1;
    grid-row: 1 / 3;
    aspect-ratio: auto;
    border-radius: 8px;
  }

  .related-box .related-list.jtx-related-list .jtx-related-link .ttl {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
  }

  .related-box .related-list.jtx-related-list .jtx-related-meta {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    gap: 5px;
    padding: 0;
    font-size: 0.66rem;
  }

  /* Match the mobile search card: title and date only, without a floating badge. */
  .related-box .related-list.jtx-related-list .jtx-related-meta .cat-name {
    display: none !important;
    position: static !important;
  }

  .jtx-similarity {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  :is(
    article.post-list,
    .jtx-card,
    .jtx-topic-index__card,
    .jtx-topic-card,
    .jtx-profile-card,
    .jtx-popular-card,
    .jtx-finder-card,
    .related-box .related-list.jtx-related-list .jtx-related-link
  ) {
    transition: none;
  }
}
