/* Stories module — loaded only on /stories, /stories/{category}[/{subcategory}], and story detail
   pages. Reuses bws-ui utility classes and pto-theme.css tokens wherever possible. */

.pto-stories-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: clamp(22px, 4vw, 48px);
  align-items: end;
  margin: 0 0 26px;
  padding: clamp(24px, 5vw, 48px);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--bws-primary, #d4a537) 24%, var(--bws-border, #e5e7eb));
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--pto-gold, #d4a537) 24%, transparent) 0, transparent 34%),
    linear-gradient(135deg, #fffaf0 0%, #ffffff 52%, #f7fbff 100%);
  box-shadow: 0 22px 60px rgba(15, 27, 51, .08);
}
.pto-stories-hero::before {
  content: "";
  position: absolute;
  inset: auto 28px 20px auto;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(212, 165, 55, .22);
  border-radius: 999px;
  pointer-events: none;
}
.pto-stories-hero-copy {
  position: relative;
  z-index: 1;
}
.pto-stories-hero h1,
.pto-story-article-header h1 {
  max-width: 820px;
  margin: 8px 0 12px;
  color: var(--bws-text, #111827);
  line-height: 1.04;
  letter-spacing: 0;
}
.pto-stories-hero h1 {
  font-size: clamp(1.95rem, 3.4vw, 3.2rem);
}
.pto-stories-hero-copy p {
  max-width: 720px;
  margin: 0;
  color: var(--bws-text-muted, #5f6b7a);
  font-size: 1.05rem;
  line-height: 1.65;
}
.pto-stories-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.pto-stories-hero-stats span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid rgba(17, 24, 39, .08);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: var(--bws-text-muted, #5f6b7a);
  font-size: .88rem;
  box-shadow: 0 8px 24px rgba(15, 27, 51, .06);
}
.pto-stories-hero-stats strong {
  color: var(--bws-text, #111827);
}
.pto-stories-search-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 14px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 18px 42px rgba(15, 27, 51, .1);
  backdrop-filter: blur(12px);
}
.pto-stories-search-row {
  display: flex;
  gap: 8px;
}
.pto-stories-clear-search {
  color: var(--bws-primary, #b8860f);
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none;
}
.pto-stories-result-note {
  margin: 0 0 16px;
  color: var(--bws-text-muted, #6b7280);
  font-size: .94rem;
}
.pto-stories-empty {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 220px;
  padding: 36px;
  border: 1px dashed var(--bws-border, #d1d5db);
  border-radius: 16px;
  background: #fff;
  color: var(--bws-text-muted, #6b7280);
  text-align: center;
}
.pto-stories-empty i {
  color: var(--bws-primary, #d4a537);
  font-size: 2rem;
}

.pto-story-breadcrumbs { margin: 0 0 18px; }
.pto-story-breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  font-size: .85rem;
  color: var(--bws-text-muted, #6b7280);
}
.pto-story-breadcrumbs li { display: flex; align-items: center; gap: 6px; }
.pto-story-breadcrumbs li:not(:last-child)::after { content: "/"; color: var(--bws-border, #d1d5db); }
.pto-story-breadcrumbs a { color: inherit; text-decoration: none; }
.pto-story-breadcrumbs a:hover { color: var(--bws-primary, #b8860f); }
.pto-story-breadcrumbs [aria-current="page"] { color: var(--bws-text, #111827); font-weight: 700; }

.pto-story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 22px;
}

.pto-story-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, .08);
  border-radius: 16px;
  background: var(--bws-surface, #fff);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 12px 34px rgba(15, 27, 51, .06);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.pto-story-card:hover,
.pto-story-card:focus-visible {
  border-color: color-mix(in srgb, var(--bws-primary, #d4a537) 36%, var(--bws-border, #e5e7eb));
  box-shadow: 0 22px 46px rgba(15, 27, 51, .13);
  transform: translateY(-4px);
}
.pto-story-card-img-wrap {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(212, 165, 55, .18), rgba(55, 124, 212, .12)),
    #eef1f6;
}
.pto-story-card-img-wrap::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(to top, rgba(0, 0, 0, .18), transparent);
  opacity: .55;
  pointer-events: none;
}
.pto-story-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .28s ease;
}
.pto-story-card:hover .pto-story-card-img-wrap img,
.pto-story-card:focus-visible .pto-story-card-img-wrap img {
  transform: scale(1.035);
}
.pto-story-card-pinned {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  box-shadow: 0 8px 18px rgba(15, 27, 51, .16);
}
.pto-story-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 17px 18px 18px;
}
.pto-story-card-category {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  color: var(--bws-primary, #b8860f);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.pto-story-card-category::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--pto-gold, #d4a537);
}
.pto-story-card-title {
  margin: 0;
  color: var(--bws-text, #111827);
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.32;
}
.pto-story-card-excerpt {
  flex: 1;
  margin: 0;
  color: var(--bws-text-muted, #6b7280);
  font-size: .91rem;
  line-height: 1.55;
}
.pto-story-card-meta {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--pto-gold-soft, #fdf3dc);
  color: #6f4b05;
  font-size: .78rem;
  font-weight: 700;
}

.pto-story-list-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--bws-border, #eef0f3);
  color: inherit;
  text-decoration: none;
}
.pto-story-list-item:last-child { border-bottom: 0; }
.pto-story-list-item:hover .pto-story-list-title { color: var(--bws-primary, #b8860f); }
.pto-story-list-thumb {
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 10px;
  background: #eef1f6;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .06);
}
.pto-story-list-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pto-story-list-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pto-story-list-title { color: var(--bws-text, #111827); font-size: .94rem; font-weight: 750; line-height: 1.32; }
.pto-story-list-meta { font-size: .76rem; color: var(--bws-text-muted, #6b7280); }

.pto-story-detail-shell {
  background:
    linear-gradient(180deg, rgba(253, 243, 220, .5), transparent 260px),
    var(--bws-body-bg, #fff);
}
.pto-story-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: clamp(28px, 4vw, 48px);
  align-items: start;
}
.pto-story-main {
  min-width: 0;
}
.pto-story-article-header {
  max-width: 900px;
  margin-bottom: 20px;
}
.pto-story-article-header h1 {
  font-size: clamp(1.9rem, 3.2vw, 3.05rem);
}
.pto-story-dek {
  max-width: 780px;
  margin: 0 0 18px;
  color: var(--bws-text-muted, #5f6b7a);
  font-size: clamp(1.04rem, 2vw, 1.24rem);
  line-height: 1.65;
}
.pto-story-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0;
  color: var(--bws-text-muted, #6b7280);
  font-size: .9rem;
}
.pto-story-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--bws-border, #e5e7eb);
  border-radius: 999px;
  background: rgba(255, 255, 255, .74);
}
.pto-story-meta i {
  color: var(--bws-primary, #b8860f);
}
.pto-story-hero-img-wrap {
  overflow: hidden;
  margin: 0 0 22px;
  border: 1px solid rgba(17, 24, 39, .08);
  border-radius: 18px;
  background: #eef1f6;
  box-shadow: 0 20px 50px rgba(15, 27, 51, .12);
}
.pto-story-hero-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pto-story-share {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 28px;
  padding: 10px;
  border: 1px solid var(--bws-border, #e5e7eb);
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 10px 30px rgba(15, 27, 51, .07);
}
.pto-story-share-label {
  padding: 0 8px;
  color: var(--bws-text-muted, #6b7280);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pto-story-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--bws-border, #e5e7eb);
  border-radius: 999px;
  background: var(--bws-surface, #fff);
  color: var(--bws-text, #111827);
  text-decoration: none;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.pto-story-share-btn:hover,
.pto-story-share-btn:focus-visible {
  border-color: var(--pto-gold, #d4a537);
  background: var(--pto-gold-soft, #fdf3dc);
  transform: translateY(-1px);
}
.pto-story-share-status { font-size: .82rem; color: var(--bws-text-muted, #6b7280); }

.pto-story-body {
  max-width: 820px;
  color: var(--bws-text, #111827);
  font-size: 1.08rem;
  line-height: 1.78;
}
.pto-story-body h2 {
  margin: 1.9em 0 .65em;
  color: var(--bws-text, #111827);
  font-size: 1.65rem;
  line-height: 1.2;
}
.pto-story-body h3 { font-size: 1.3rem; margin: 1.65em 0 .5em; }
.pto-story-body h4,
.pto-story-body h5,
.pto-story-body h6 { margin: 1.4em 0 .4em; }
.pto-story-body p { margin: 0 0 1.12em; }
.pto-story-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(15, 27, 51, .08);
}
.pto-story-body table {
  width: 100%;
  margin: 1.2em 0;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 10px;
}
.pto-story-body table th,
.pto-story-body table td {
  padding: 10px 12px;
  border: 1px solid var(--bws-border, #e5e7eb);
  text-align: left;
}
.pto-story-body table th { background: var(--bws-surface, #f8fafc); }
.pto-story-body a { color: var(--bws-primary, #b8860f); text-decoration: underline; text-underline-offset: 3px; }
.pto-story-body blockquote {
  margin: 1.6em 0;
  padding: .65em 1.1em;
  border-left: 4px solid var(--pto-gold, #d4a537);
  border-radius: 0 10px 10px 0;
  background: var(--pto-gold-soft, #fdf3dc);
  color: #5f4a15;
}
.pto-story-related {
  margin-top: 46px;
  padding-top: 28px;
  border-top: 1px solid var(--bws-border, #e5e7eb);
}
.pto-story-sidebar {
  position: sticky;
  top: 18px;
  min-width: 0;
}
.pto-story-sidebar-card {
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid rgba(17, 24, 39, .08);
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(15, 27, 51, .07);
}
.pto-story-sidebar-card .bws-card-body {
  padding: 18px;
}
.pto-story-sidebar-card .pto-section-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}

.pto-story-business-card,
.pto-story-book-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bws-border, #eef0f3);
  color: inherit;
  text-decoration: none;
}
.pto-story-business-card:last-child,
.pto-story-book-card:last-child { border-bottom: 0; }
.pto-story-business-card:hover strong,
.pto-story-book-card:hover strong { color: var(--bws-primary, #b8860f); }
.pto-story-business-logo {
  display: flex;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 12px;
  background: #f3f4f6;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .06);
}
.pto-story-business-logo img { width: 100%; height: 100%; object-fit: cover; }
.pto-story-book-cover {
  width: 46px;
  height: 66px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 7px;
  background: #f3f4f6;
  box-shadow: 0 8px 18px rgba(15, 27, 51, .1);
}
.pto-story-book-cover img { width: 100%; height: 100%; object-fit: cover; }

.pto-story-category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 24px;
}
.pto-story-category-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--bws-border, #e5e7eb);
  border-radius: 999px;
  background: #fff;
  color: var(--bws-text, #111827);
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(15, 27, 51, .04);
}
.pto-story-category-chip:hover,
.pto-story-category-chip:focus-visible {
  border-color: var(--pto-gold, #d4a537);
  background: var(--pto-gold-soft, #fdf3dc);
}
.pto-story-category-chip[aria-current="page"] {
  border-color: var(--pto-gold, #d4a537);
  background: var(--pto-gold, #d4a537);
  color: #1a1200;
}

@media (max-width: 980px) {
  .pto-stories-hero,
  .pto-story-layout {
    grid-template-columns: 1fr;
  }
  .pto-story-sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .pto-stories-hero {
    padding: 22px;
    border-radius: 14px;
  }
  .pto-stories-hero::before {
    display: none;
  }
  .pto-stories-search-row {
    flex-direction: column;
  }
  .pto-story-grid {
    grid-template-columns: 1fr;
  }
  .pto-story-share {
    border-radius: 16px;
  }
  .pto-story-share-label {
    width: 100%;
    padding: 0 4px;
  }
}
