
/* =========================================
   Stories — Single Article
   Mobile-first article layout
   ========================================= */

.stories-article-page {
  width: 100%;
  max-width: 900px;
  margin-inline: auto;
  padding: 24px 18px 48px;
  padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  color: var(--stories-text, #172033);
}

.stories-article {
  min-width: 0;
}

.stories-article-header {
  margin: 0 auto 24px;
}

.stories-article-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.stories-category-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
}

.stories-category-link:hover,
.stories-category-link:focus-visible {
  background: #dbeafe;
  text-decoration: underline;
}

.stories-article-title {
  margin: 0 0 14px;
  font-size: clamp(30px, 7vw, 48px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.stories-article-excerpt {
  margin: 0 0 18px;
  color: var(--stories-muted, #64748b);
  font-size: 17px;
  line-height: 1.65;
}

.stories-article-excerpt p {
  margin: 0;
}

.stories-article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--stories-muted, #64748b);
  font-size: 13px;
  line-height: 1.6;
}

.stories-article-author {
  color: var(--stories-text, #172033);
  font-weight: 700;
}

.stories-meta-separator {
  color: #94a3b8;
}

.stories-article-featured-image {
  margin: 0 0 28px;
}

.stories-featured-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 16px;
}

.stories-article-featured-image figcaption {
  margin-top: 9px;
  color: var(--stories-muted, #64748b);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

/* Main article text */

.stories-article-content {
  color: var(--stories-text, #263244);
  font-size: 17px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.stories-article-content > * {
  max-width: 100%;
}

.stories-article-content p {
  margin: 0 0 1.4em;
}

.stories-article-content h2 {
  margin: 1.7em 0 0.65em;
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.stories-article-content h3 {
  margin: 1.5em 0 0.6em;
  font-size: clamp(20px, 4.5vw, 25px);
  font-weight: 750;
  line-height: 1.3;
}

.stories-article-content h4 {
  margin: 1.4em 0 0.5em;
  font-size: 19px;
  line-height: 1.4;
}

.stories-article-content a {
  color: #2563eb;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.stories-article-content a:hover {
  text-decoration-thickness: 2px;
}

.stories-article-content ul,
.stories-article-content ol {
  margin: 0 0 1.5em;
  padding-left: 1.5em;
}

.stories-article-content li {
  margin-bottom: 0.5em;
  padding-left: 0.15em;
}

.stories-article-content blockquote {
  margin: 1.8em 0;
  padding: 6px 0 6px 18px;
  border-left: 4px solid #2563eb;
  color: var(--stories-muted, #475569);
  font-size: 19px;
  line-height: 1.7;
}

.stories-article-content blockquote p:last-child {
  margin-bottom: 0;
}

.stories-article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.stories-article-content figure {
  margin: 1.8em 0;
}

.stories-article-content figcaption {
  margin-top: 8px;
  color: var(--stories-muted, #64748b);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.stories-article-content iframe,
.stories-article-content video {
  max-width: 100%;
}

.stories-article-content pre {
  max-width: 100%;
  padding: 16px;
  overflow-x: auto;
  border-radius: 12px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 14px;
  line-height: 1.6;
}

.stories-article-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.stories-article-content th,
.stories-article-content td {
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  text-align: left;
}

.stories-article-content hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid #e2e8f0;
}

.stories-page-links {
  margin: 28px 0;
  font-size: 14px;
}

.stories-page-links a,
.stories-page-links > span {
  margin-right: 8px;
}

/* Tags */

.stories-article-footer {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid #e2e8f0;
}

.stories-article-tags h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 800;
}

.stories-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stories-tag-link {
  display: inline-flex;
  padding: 7px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  color: var(--stories-text, #334155);
  font-size: 13px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.stories-tag-link:hover,
.stories-tag-link:focus-visible {
  background: #f1f5f9;
  text-decoration: underline;
}

/* Related stories */

.stories-related {
  margin-top: 46px;
  padding-top: 28px;
  border-top: 1px solid #e2e8f0;
}

.stories-related-heading {
  margin-bottom: 18px;
}

.stories-section-eyebrow {
  margin: 0 0 5px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stories-related-heading h2 {
  margin: 0;
  font-size: clamp(24px, 5vw, 30px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.stories-related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.stories-related-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e8edf3;
  border-radius: 15px;
  background: var(--stories-card-bg, #ffffff);
}

.stories-related-image-link {
  display: block;
  overflow: hidden;
  background: #f1f5f9;
}

.stories-related-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.stories-related-card:hover .stories-related-image {
  transform: scale(1.025);
}

.stories-related-image-placeholder {
  background: linear-gradient(135deg, #eff6ff, #e2e8f0);
}

.stories-related-card-body {
  padding: 15px;
}

.stories-related-category {
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.stories-related-card-title {
  margin: 7px 0 10px;
  font-size: 19px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.stories-related-card-title a {
  color: var(--stories-text, #172033);
  text-decoration: none;
}

.stories-related-card-title a:hover,
.stories-related-card-title a:focus-visible {
  color: #2563eb;
  text-decoration: underline;
}

.stories-related-date {
  margin: 0;
  color: var(--stories-muted, #64748b);
  font-size: 12px;
}

/* Tablet and desktop */

@media (min-width: 600px) {
  .stories-article-page {
    padding: 36px 28px 60px;
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  }

  .stories-article-header {
    margin-bottom: 30px;
  }

  .stories-featured-image {
    border-radius: 20px;
  }

  .stories-related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (min-width: 800px) {
  .stories-article-page {
    padding-top: 44px;
  }

  .stories-article-content {
    font-size: 18px;
    line-height: 1.9;
  }

  .stories-related-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Respect reduced-motion preferences */

@media (prefers-reduced-motion: reduce) {
  .stories-related-image {
    transition: none;
  }
}

/* ========================================
   Stories - Article Comments
   ======================================== */

.stories-comments {
    margin: 32px 0;
    padding: 24px 16px;
    background: #ffffff;
    border: 1px solid #e8eaf0;
    border-radius: 18px;
    box-shadow: 0 4px 18px rgba(20, 30, 55, 0.04);
}

.stories-comments-inner {
    width: 100%;
    min-width: 0;
}

.stories-comments-title {
    margin: 0 0 24px;
    color: #172033;
    font-size: 22px;
    line-height: 1.3;
    font-weight: 750;
}

/* Existing comments */
.stories-comment-list {
    margin: 0 0 28px;
    padding: 0;
    list-style: none;
    counter-reset: stories-comment;
}

.stories-comment-list > li {
    margin: 0 0 18px;
    padding: 16px;
    list-style: none;
    background: #f8f9fc;
    border: 1px solid #e9edf4;
    border-radius: 14px;
    overflow-wrap: anywhere;
}

.stories-comment-list .children {
    margin: 16px 0 0;
    padding-left: 14px;
    list-style: none;
    border-left: 2px solid #dce4f2;
}

.stories-comment-list .children > li {
    margin-top: 12px;
    list-style: none;
}

.stories-comment-list .comment-author {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    color: #172033;
    font-size: 14px;
    font-weight: 700;
}

.stories-comment-list .comment-author .avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
}

.stories-comment-list .comment-author a {
    color: #243b70;
    text-decoration: none;
}

.stories-comment-list .comment-author a:hover {
    text-decoration: underline;
}

.stories-comment-list .comment-metadata {
    margin: 0 0 12px;
    font-size: 12px;
    color: #737d90;
}

.stories-comment-list .comment-metadata a {
    color: inherit;
    text-decoration: none;
}

.stories-comment-list .comment-content {
    color: #354056;
    font-size: 15px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.stories-comment-list .comment-content p {
    margin: 0 0 10px;
}

.stories-comment-list .comment-content p:last-child {
    margin-bottom: 0;
}

.stories-comment-list .reply {
    margin-top: 12px;
}

.stories-comment-list .reply a {
    display: inline-block;
    padding: 7px 13px;
    color: #284b91;
    background: #eaf0ff;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}

.stories-comment-list .reply a:hover {
    background: #dce6ff;
}

/* Comment form */
.stories-comments #reply-title {
    margin: 0 0 18px;
    color: #172033;
    font-size: 21px;
    line-height: 1.35;
    font-weight: 750;
}

.stories-comment-form {
    margin-top: 12px;
}

.stories-comments .comment-notes,
.stories-comments .logged-in-as,
.stories-comments .must-log-in {
    margin: 0 0 16px;
    color: #737d90;
    font-size: 13px;
    line-height: 1.6;
}

.stories-comments .logged-in-as a,
.stories-comments .must-log-in a {
    color: #284b91;
    text-decoration: none;
}

.stories-comments .comment-form {
    margin: 0;
}

.stories-comments .comment-form p {
    margin: 0 0 16px;
}

.stories-comments .comment-form label {
    display: block;
    margin-bottom: 7px;
    color: #354056;
    font-size: 14px;
    font-weight: 600;
}

.stories-comments .comment-form textarea,
.stories-comments .comment-form input[type="text"],
.stories-comments .comment-form input[type="email"],
.stories-comments .comment-form input[type="url"] {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 12px 14px;
    color: #172033;
    background: #ffffff;
    border: 1px solid #d8deea;
    border-radius: 11px;
    font: inherit;
    font-size: 15px;
    line-height: 1.5;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stories-comments .comment-form textarea {
    min-height: 140px;
    resize: vertical;
}

.stories-comments .comment-form textarea:focus,
.stories-comments .comment-form input[type="text"]:focus,
.stories-comments .comment-form input[type="email"]:focus,
.stories-comments .comment-form input[type="url"]:focus {
    outline: none;
    border-color: #5579d6;
    box-shadow: 0 0 0 3px rgba(85, 121, 214, 0.14);
}

.stories-comments .comment-form-cookies-consent {
    display: flex;
    align-items: flex-start;
    gap: 9px;
}

.stories-comments .comment-form-cookies-consent input {
    flex: 0 0 auto;
    margin-top: 5px;
}

.stories-comments .comment-form-cookies-consent label {
    margin: 0;
    color: #737d90;
    font-size: 13px;
    font-weight: 400;
}

.stories-comments .form-submit {
    margin-top: 20px !important;
}

.stories-comments .comment-form input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 22px;
    color: #ffffff;
    background: #284b91;
    border: 0;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.stories-comments .comment-form input[type="submit"]:hover {
    background: #1d376f;
    transform: translateY(-1px);
}

.stories-comments .comment-form input[type="submit"]:focus-visible {
    outline: 3px solid rgba(85, 121, 214, 0.35);
    outline-offset: 3px;
}

.stories-comments .no-comments,
.stories-comments .stories-comments-closed {
    color: #737d90;
    font-size: 14px;
    line-height: 1.6;
}

.stories-comments .comment-navigation {
    margin: 20px 0;
}

.stories-comments .comment-navigation a {
    color: #284b91;
    text-decoration: none;
}

/* Small-screen layout */
@media (max-width: 480px) {
    .stories-comments {
        margin: 24px 0;
        padding: 20px 14px;
        border-radius: 15px;
    }

    .stories-comments-title {
        font-size: 20px;
    }

    .stories-comment-list > li {
        padding: 13px;
    }

    .stories-comments .comment-form textarea {
        min-height: 125px;
    }

    .stories-comments .comment-form input[type="submit"] {
        width: 100%;
    }
}


/* Fix WordPress comment form field widths and button styling */
.stories-comments .comment-form-author,
.stories-comments .comment-form-email,
.stories-comments .comment-form-url,
.stories-comments .comment-form-comment {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 0 18px;
}

.stories-comments .comment-form-author input,
.stories-comments .comment-form-email input,
.stories-comments .comment-form-url input {
    display: block !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 44px;
    margin-top: 6px;
    padding: 10px 12px;
    color: #172033;
    background: #fff;
    border: 1px solid #d8deea;
    border-radius: 10px;
    font: inherit;
    font-size: 15px;
}

.stories-comments .comment-form-comment textarea {
    display: block;
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 140px;
    padding: 12px;
    border: 1px solid #d8deea;
    border-radius: 10px;
    background: #fff;
}

.stories-comments .comment-form-author input:focus,
.stories-comments .comment-form-email input:focus,
.stories-comments .comment-form-url input:focus,
.stories-comments .comment-form-comment textarea:focus {
    outline: none;
    border-color: #5579d6;
    box-shadow: 0 0 0 3px rgba(85, 121, 214, 0.14);
}

.stories-comments .form-submit input[type="submit"] {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 22px;
    color: #fff !important;
    background: #284b91 !important;
    border: none !important;
    border-radius: 999px !important;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.stories-comments .form-submit input[type="submit"]:hover {
    background: #1d376f !important;
}

.stories-comments .comment-form-cookies-consent {
    display: flex;
    align-items: flex-start;
    gap: 9px;
}

.stories-comments .comment-form-cookies-consent input[type="checkbox"] {
    width: auto;
    margin-top: 4px;
}

/* ========================================
   Stories: Article metadata action buttons
   ======================================== */

.stories-article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.stories-article-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.stories-article-actions button,
.stories-article-actions a {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 40px;
    min-height: 40px;
    padding: 8px 12px;
    color: #273247;
    background: #f8f9fb;
    border: 1px solid transparent;
    border-radius: 999px;
    font-family: inherit;
    font-size: 12px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.stories-article-actions button:hover,
.stories-article-actions a:hover {
    color: #ff1744;
    background: #fff0f3;
}

.stories-article-actions svg {
    display: block;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stories-article-actions .stories-like-button {
    color: #273247;
}

.stories-article-actions .stories-like-button:hover,
.stories-article-actions .stories-like-button.is-liked {
    color: #ff1744;
    background: #fff0f3;
}

.stories-article-actions .stories-like-button.is-liked svg {
    fill: currentColor;
}

.stories-article-actions .stories-like-count {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.stories-article-actions .stories-comment-action {
    color: #273247;
}

.stories-article-actions .stories-bookmark-icon-button {
    width: 40px;
    min-width: 40px;
    padding: 8px;
}

.stories-article-actions .stories-bookmark-icon-button svg {
    width: 19px;
    height: 19px;
}

.stories-article-actions .stories-bookmark-icon-button.is-saved {
    color: #ff1744;
    background: #fff0f3;
}

.stories-article-actions .stories-bookmark-icon-button.is-saved svg {
    fill: currentColor;
}

.stories-article-actions button:focus-visible,
.stories-article-actions a:focus-visible {
    outline: 3px solid rgba(85, 121, 214, 0.35);
    outline-offset: 3px;
}

/* Keep the metadata row usable on phones */
@media (max-width: 600px) {
    .stories-article-meta {
        row-gap: 12px;
    }

    .stories-article-actions {
        margin-left: auto;
        gap: 6px;
    }

    .stories-article-actions button,
    .stories-article-actions a {
        min-height: 38px;
        padding: 7px 10px;
    }

    .stories-article-actions .stories-bookmark-icon-button {
        width: 38px;
        min-width: 38px;
        padding: 7px;
    }
}


/* Bookmark icon: tooltip and saved state */
.stories-article-actions .stories-bookmark-icon-button {
    position: relative;
    color: #273247;
}

.stories-article-actions .stories-bookmark-icon-button.is-saved {
    color: #2563eb !important;
    background: #eff6ff !important;
}

.stories-article-actions .stories-bookmark-icon-button.is-saved svg {
    fill: #2563eb;
    stroke: #2563eb;
}

.stories-article-actions .stories-bookmark-icon-button::after {
    content: attr(title);
    position: absolute;
    z-index: 20;
    left: 50%;
    bottom: calc(100% + 9px);
    transform: translate(-50%, 4px);
    padding: 7px 10px;
    color: #ffffff;
    background: #172033;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.stories-article-actions .stories-bookmark-icon-button:hover::after,
.stories-article-actions .stories-bookmark-icon-button:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}


/* Progressive reveal for long articles */
.stories-article-remaining > .stories-article-chunk.is-hidden {
    display: none;
}

.stories-article-remaining > .stories-article-chunk:not(.is-hidden) {
    display: block;
}

.stories-article-reveal-sentinel {
    display: block;
    width: 100%;
    height: 1px;
    pointer-events: none;
}


/* Sticky article action widget */
.stories-sticky-article-widget {
    position: fixed;
    left: 50%;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 8px 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    background: #fff;
    color: #252525;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.12);
    transform: translateX(-50%);
    opacity: 1;
    visibility: visible;
}

.stories-sticky-article-widget[hidden] {
    display: none !important;
}

.stories-sticky-article-widget button,
.stories-sticky-article-widget a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 36px;
    min-height: 36px;
    padding: 5px 7px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.stories-sticky-article-widget button:hover,
.stories-sticky-article-widget a:hover {
    background: #f2f4f7;
}

.stories-sticky-article-widget button:focus-visible,
.stories-sticky-article-widget a:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.stories-sticky-article-widget svg {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stories-sticky-article-widget .stories-sticky-like.is-liked {
    color: #e53950;
}

.stories-sticky-article-widget .stories-sticky-like.is-liked svg {
    fill: currentColor;
}

.stories-sticky-divider {
    width: 1px;
    height: 22px;
    flex: 0 0 1px;
    background: #e7e7e7;
}

.stories-sticky-progress {
    min-width: 36px;
    padding: 0 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 380px) {
    .stories-sticky-article-widget {
        gap: 4px;
        padding: 6px 7px;
    }

    .stories-sticky-article-widget button,
    .stories-sticky-article-widget a {
        min-width: 32px;
        padding: 4px;
    }
}
