/* Magazine context styles. Unlayered intentionally to preserve the existing page-specific cascade. */
/* RP Magazine archive and article styles. */

.rp-magazine-shell {
  display: grid;
  gap: 24px;
}
.rp-mag-hero-shell {
  display: grid;
  gap: 20px;
}
.rp-mag-featured .rp-mag-card {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  min-height: 420px;
}
.rp-mag-grid,
.rp-mag-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.rp-mag-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  background: #fff;
}
.rp-mag-image {
  min-height: 220px;
  aspect-ratio: 16/11;
  background: linear-gradient(145deg, #f8f8f8, #e8e8e8);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.rp-mag-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rp-mag-placeholder {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: #000;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 36px;
  font-weight: 900;
}
.rp-mag-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.rp-mag-kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.rp-mag-chip {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: #393939;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
}
.rp-mag-read-time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.rp-mag-card h2 {
  margin: 0 0 12px;
  font-size: clamp(22px, 3vw, 44px);
  line-height: 0.96;
  letter-spacing: -0.045em;
}
.rp-mag-grid .rp-mag-card h2,
.rp-mag-quick-grid .rp-mag-card h2 {
  font-size: 22px;
  line-height: 1.05;
}
.rp-mag-card .muted {
  margin: 0;
}
.rp-mag-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 12px;
}
.rp-mag-read-more {
  display: none;
}
.rp-mag-tabs-wrap,
.rp-mag-section-title {
  display: none;
}

.rp-article {
  max-width: 980px;
  margin: 0 auto;
}
.rp-article-head {
  text-align: center;
  margin: 20px 0 28px;
}
.rp-article-head h1 {
  font-size: clamp(44px, 7vw, 86px);
  line-height: 0.9;
  letter-spacing: -0.065em;
  margin: 0 0 18px;
}
.rp-article-cover {
  margin: 0 0 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
}
.rp-article-cover img {
  width: 100%;
  max-height: 620px;
  object-fit: cover;
}
.rp-article-content {
  max-width: 760px;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.85;
}
.rp-article-content h1,
.rp-article-content h2,
.rp-article-content h3 {
  line-height: 1;
  letter-spacing: -0.04em;
  margin-top: 36px;
}
.rp-article-content img {
  border-radius: 22px;
  border: 1px solid var(--line);
}
.rp-article-footer {
  max-width: 760px;
  margin: 28px auto;
}
.rp-comments {
  max-width: 760px;
  margin: 28px auto 0;
}
.comment-list {
  padding-left: 20px;
}
.rp-comment-form textarea,
.rp-comment-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.rp-mobile-magazine {
  display: grid;
  gap: 14px;
}
.rp-mobile-mag-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.rp-mobile-mag-tabs a,
.rp-mobile-mag-tabs button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.rp-mobile-mag-tabs .active {
  background: #000;
  color: #fff;
  border-color: #000;
}
.rp-mobile-mag-list {
  display: grid;
  gap: 10px;
}
.rp-mobile-mag-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  background: #fff;
}
.rp-mobile-mag-row span {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #f8f8f8, #e8e8e8);
}
.rp-mobile-mag-row img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rp-mobile-mag-row i {
  font-style: normal;
  font-weight: 900;
  font-size: 22px;
}
.rp-mobile-mag-row b {
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.rp-mobile-mag-row em {
  grid-column: 2;
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.rp-mag-native .rp-mobile-mag-row {
  grid-template-columns: 58px 1fr;
}
.rp-mag-native .rp-mobile-mag-row span {
  width: 58px;
  height: 58px;
}

body.rp-theme
  :where(
    .rp-mag-card a,
    .rp-mag-tab,
    .rp-mobile-mag-tabs a,
    .rp-mobile-mag-tabs button,
    .rp-mobile-mag-row,
    .rp-article-footer a,
    .rp-comment-form button,
    .rp-comment-form input[type="submit"]
  ) {
  min-width: 48px;
  min-height: 48px;
}

/* Tablet magazine: avoid desktop minimum columns inside the narrower viewport. */
@media (min-width: 768px) and (max-width: 1023px) {
  body.rp-theme.rp-page-magazine .rp-mag-featured .rp-mag-card {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }
  body.rp-theme.rp-page-magazine .rp-mag-grid,
  body.rp-theme.rp-page-magazine .rp-mag-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  body.rp-theme.rp-page-magazine {
    overflow-x: hidden;
  }
  body.rp-theme.rp-page-magazine main.site-main {
    max-width: 430px;
    padding: 14px 12px
      calc(var(--bottom-nav) + env(safe-area-inset-bottom) + 34px);
  }
  body.rp-theme.rp-page-magazine .bottom-nav .is-active {
    color: #000;
  }
  body.rp-theme.rp-page-magazine .bottom-nav .is-active .rp-icon,
  body.rp-theme.rp-page-magazine .bottom-nav .is-active .bottom-nav-label {
    color: #000;
  }
  .rp-magazine-shell {
    gap: 16px;
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
  }
  .rp-mag-hero-shell {
    border: 1px solid var(--line);
    border-radius: 30px;
    background: #fff;
    overflow: hidden;
    gap: 0;
  }
  body.rp-theme.rp-page-magazine
    .rp-mag-hero-shell
    .rp-mag-page-head.section-head {
    padding: 22px 18px 16px;
    margin: 0;
    display: grid;
    gap: 8px;
    align-items: start;
  }
  .rp-mag-page-head .eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .rp-mag-page-head h1 {
    margin: 0;
    font-size: 44px;
    line-height: 0.88;
    letter-spacing: -0.065em;
  }
  .rp-mag-page-head p {
    margin: 0;
    max-width: 34ch;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
  }
  .rp-mag-featured .rp-mag-card {
    margin: 0 10px 10px;
    border-color: rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    display: block;
    min-height: 0;
  }
  .rp-mag-featured .rp-mag-image {
    min-height: 210px;
    aspect-ratio: 16/10;
  }
  .rp-mag-featured .rp-mag-body {
    padding: 18px;
    display: grid;
    gap: 12px;
    justify-content: stretch;
  }
  .rp-mag-featured .rp-mag-kicker-row {
    margin: 0;
  }
  .rp-mag-featured .rp-mag-card h2 {
    margin: 0;
    max-width: 10ch;
    font-size: 38px;
    line-height: 0.91;
    letter-spacing: -0.07em;
  }
  .rp-mag-featured .rp-mag-card .muted {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.58;
  }
  .rp-mag-featured .rp-mag-meta {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 2px;
  }
  .rp-mag-featured .rp-mag-read-more {
    min-width: 48px;
    min-height: 48px;
    border: 1px solid #000;
    border-radius: 50%;
    background: #000;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 22px;
    line-height: 1;
  }
  .rp-mag-tabs-wrap {
    display: block;
    position: sticky;
    top: calc(var(--mobile-header) + env(safe-area-inset-top) + 8px);
    z-index: 10;
    margin: 0 -12px;
    padding: 0 12px;
    background: linear-gradient(#fff 68%, rgba(255, 255, 255, 0));
  }
  .rp-mag-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 0 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .rp-mag-tabs::-webkit-scrollbar {
    display: none;
  }
  .rp-mag-tab {
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
  }
  .rp-mag-tab.active {
    background: #000;
    color: #fff;
    border-color: #000;
  }
  .rp-mag-section-title {
    padding: 2px 2px 0;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
  }
  .rp-mag-section-title h2 {
    margin: 0;
    font-size: 26px;
    line-height: 0.96;
    letter-spacing: -0.045em;
  }
  .rp-mag-section-title a {
    color: var(--muted);
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .rp-mag-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .rp-mag-grid .rp-mag-card {
    min-height: 118px;
    display: grid;
    grid-template-columns: 102px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    border-radius: 22px;
    padding: 10px;
  }
  .rp-mag-grid .rp-mag-image {
    width: 102px;
    height: 98px;
    min-height: 0;
    aspect-ratio: auto;
    border-radius: 16px;
  }
  .rp-mag-grid .rp-mag-placeholder {
    width: 54px;
    height: 54px;
    font-size: 22px;
  }
  .rp-mag-grid .rp-mag-body {
    min-width: 0;
    padding: 0;
    display: grid;
    gap: 8px;
    align-content: center;
    justify-content: stretch;
  }
  .rp-mag-grid .rp-mag-kicker-row {
    display: none;
  }
  .rp-mag-grid .rp-mag-card h2 {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 20px;
    line-height: 0.98;
    letter-spacing: -0.045em;
  }
  .rp-mag-grid .rp-mag-card .muted {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
  }
  .rp-mag-grid .rp-mag-meta {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.1em;
  }
  .rp-mag-quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .rp-mag-quick-grid .rp-mag-card {
    min-height: 198px;
    display: grid;
    grid-template-rows: 104px 1fr;
    grid-template-columns: 1fr;
    border-radius: 22px;
    padding: 0;
  }
  .rp-mag-quick-grid .rp-mag-image {
    width: 100%;
    height: 104px;
    min-height: 104px;
    aspect-ratio: auto;
    border-radius: 0;
  }
  .rp-mag-quick-grid .rp-mag-placeholder {
    width: 46px;
    height: 46px;
    font-size: 20px;
  }
  .rp-mag-quick-grid .rp-mag-body {
    min-width: 0;
    padding: 12px;
    display: grid;
    align-content: space-between;
    gap: 10px;
    justify-content: stretch;
  }
  .rp-mag-quick-grid .rp-mag-kicker-row,
  .rp-mag-quick-grid .muted {
    display: none;
  }
  .rp-mag-quick-grid .rp-mag-card h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.02;
    letter-spacing: -0.035em;
  }
  .rp-mag-quick-grid .rp-mag-meta {
    margin: 0;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: 0.1em;
  }
  .rp-article-head {
    text-align: left;
  }
  .rp-article-head h1 {
    font-size: 44px;
  }
  .rp-article-cover {
    margin-left: -12px;
    margin-right: -12px;
    border-left: 0;
    border-right: 0;
    border-radius: 0 0 28px 28px;
  }
  .rp-article-content {
    font-size: 16px;
    line-height: 1.75;
  }
}

@media (max-width: 360px) {
  .rp-mag-page-head h1 {
    font-size: 40px;
  }
  .rp-mag-featured .rp-mag-card h2 {
    font-size: 34px;
  }
  .rp-mag-grid .rp-mag-card {
    grid-template-columns: 88px 1fr;
  }
  .rp-mag-grid .rp-mag-image {
    width: 88px;
  }
  .rp-mag-grid .rp-mag-card h2 {
    font-size: 18px;
  }
}
