:root {
  --stories-ink: #17201b;
  --stories-muted: #68736c;
  --stories-paper: #ffffff;
  --stories-card: #f7f9f8;
  --stories-border: rgba(23, 70, 47, 0.12);
  --stories-line: #cbd1cb;
  --stories-green: #1a9b61;
  --stories-green-dark: #0b6640;
  --stories-green-wash: #dff2e8;
}

.stories-page,
.stories-page * { box-sizing: border-box; }

html,
body {
  min-width: 320px;
  background: var(--stories-paper);
  color: var(--stories-ink);
}

.stories-page {
  min-height: calc(100vh - 80px);
  padding-top: 10px;
  font-family: "Lexend", system-ui, sans-serif;
}

.stories-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 72px;
}

.stories-page--public .stories-page__intro h1 {
  position: relative;
  isolation: isolate;
  max-width: 600px;
  margin-right: auto;
  margin-left: auto;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  line-height: 1.04;
}

.stories-page--public { padding-top: 0; }
.stories-page--public .stories-shell { width: 100%; padding: 0 0 72px; }
.stories-page--public #stories-content { width: min(1180px, calc(100% - 36px)); margin: 0 auto; }

.stories-public-masthead {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 226px;
  margin: 0 auto 10px;
  padding: 32px 24px 10px;
  /* Filter menus extend below the masthead and should not be clipped. */
  overflow: visible;
  border: 0;
  border-bottom: 0;
  background: #fff;
}

/* Keep the story cards and controls crisp white, with neutral borders. */
.stories-page {
  --stories-card: #ffffff;
  --stories-border: rgba(23, 32, 27, 0.14);
}

.stories-page .stories-search__field,
.stories-page .story-panel {
  box-shadow: 0 4px 16px rgba(23, 32, 27, 0.04);
}

.stories-page__intro {
  max-width: 680px;
  margin: 0 auto 14px;
  text-align: center;
}

.stories-page--public .stories-page__intro { margin-bottom: 22px; }

.stories-page__eyebrow {
  margin: 0 0 8px;
  color: var(--stories-green-dark);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.stories-page--public .stories-page__eyebrow { font-size: 0.76rem; }

.stories-page__intro h1 {
  margin: 0;
  color: var(--stories-ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(2.3rem, 5vw, 4.25rem);
  font-weight: 400;
  line-height: 0.98;
}

.stories-page__title-copy {
  position: relative;
  z-index: 1;
}

.stories-page__title-highlight-word {
  color: var(--stories-green-dark);
  font-weight: 700;
}

.stories-page--public .stories-public-masthead .stories-search { padding-top: 4px; }
.stories-page--public .stories-public-masthead .stories-filters { margin-top: 4px; }

.stories-page__intro p:last-child {
  margin: 12px 0 0;
  color: var(--stories-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.stories-state {
  display: grid;
  min-height: 48vh;
  place-items: center;
  align-content: center;
  color: var(--stories-muted);
  text-align: center;
}

.stories-state.page-loading { gap: 14px; }

.stories-state .page-loading__spinner {
  width: 44px;
  height: 44px;
  border-width: 3px;
}

.stories-state .page-loading__message {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
}

.stories-state[hidden],
#stories-content[hidden] { display: none; }

.stories-results-loading {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--stories-muted);
  text-align: center;
}

.stories-results-loading .stories-loader {
  width: 44px;
  height: 44px;
  border-width: 3px;
}

.stories-results-loading p {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
}

.stories-loader {
  width: 34px;
  height: 34px;
  border: 2px solid var(--stories-line);
  border-top-color: var(--stories-green);
  border-radius: 50%;
  animation: stories-spin 0.85s linear infinite;
}

@keyframes stories-spin { to { transform: rotate(360deg); } }

.stories-state--error h2 {
  margin: 7px 0 4px;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
}

.stories-state--error button {
  margin-top: 15px;
  padding: 9px 15px;
  border: 1px solid var(--stories-ink);
  border-radius: 999px;
  background: transparent;
  color: var(--stories-ink);
  cursor: pointer;
}

.stories-search {
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  padding: 6px 0 8px;
}

.stories-search__row {
  display: block;
}

.stories-search__field {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--stories-border);
  border-radius: 13px;
  background: var(--stories-card);
  box-shadow: 0 8px 24px rgba(26, 39, 30, 0.05);
}

.stories-search__field:focus-within {
  border-color: var(--stories-border);
}

.stories-search__row:has(.stories-search__popup:not([hidden])) .stories-search__field {
  border-bottom: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
  box-shadow: none;
}

.stories-search input {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 11px 6px 11px 16px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--stories-ink);
  font: inherit;
  font-weight: 400;
}

.stories-search input::placeholder { color: var(--stories-muted); }

.stories-search input:focus-visible {
  outline: none;
}

.stories-search input::-webkit-search-cancel-button {
  display: none;
}

.stories-search__clear {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #7d8580;
  cursor: pointer;
}

.stories-search__field:has(input:not(:placeholder-shown)) .stories-search__clear {
  display: flex;
}

.stories-search__clear span {
  position: relative;
  width: 16px;
  height: 16px;
}

.stories-search__clear span::before,
.stories-search__clear span::after {
  position: absolute;
  top: 7px;
  left: 1px;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.stories-search__clear span::before { transform: rotate(45deg); }
.stories-search__clear span::after { transform: rotate(-45deg); }

.stories-search__clear:hover,
.stories-search__clear:focus-visible { color: var(--stories-ink); }

.stories-search__clear:focus-visible {
  outline: 2px solid rgba(26, 155, 97, 0.3);
  outline-offset: -2px;
}

.stories-search__options {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  margin: 0 2px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--stories-muted);
  cursor: pointer;
}

.stories-search__options svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.stories-search__options:hover,
.stories-search__options[aria-expanded="true"] { color: var(--stories-green-dark); }

.stories-search__options:focus-visible {
  outline: 2px solid rgba(26, 155, 97, 0.3);
  outline-offset: -2px;
}

.stories-search__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--stories-green-dark);
  cursor: pointer;
}

.stories-search__submit-icon {
  display: block;
  width: 20px;
  height: 20px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.stories-search__submit:hover,
.stories-search__submit:focus-visible {
  border-color: var(--stories-green-dark);
  color: var(--stories-green-dark);
}

.stories-search__submit:focus-visible {
  outline: 2px solid rgba(26, 155, 97, 0.3);
  outline-offset: 2px;
}

.stories-search__submit:disabled {
  cursor: wait;
  opacity: 0.55;
}

.stories-search__popup {
  position: static;
  width: 100%;
  display: flex;
  flex-direction: column;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--stories-border);
  border-top: 0;
  border-radius: 0 0 13px 13px;
  background: var(--stories-card);
  box-shadow: none;
}

.stories-search__popup[hidden] { display: none; }

.stories-search__suggestions {
  flex: 0 1 auto;
  max-height: min(250px, 38vh);
  overflow-y: auto;
  margin: 0;
  padding: 8px 6px 6px;
  list-style: none;
}

.stories-search__suggestions[hidden] { display: none; }

.stories-search__suggestion {
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--stories-ink);
  font: inherit;
  font-size: 0.74rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.stories-search__suggestion-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.stories-search__suggestion-icon {
  display: inline-grid;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  place-items: center;
  color: var(--stories-green-dark);
}

.stories-search__suggestion-icon--story,
.stories-search__suggestion-icon--event { color: var(--stories-green-dark); }

.stories-search__suggestion-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.stories-search__suggestion:hover,
.stories-search__suggestion:focus-visible,
.stories-search__suggestion--active {
  background: var(--stories-green-wash);
  color: var(--stories-green-dark);
  outline: none;
}

.stories-search__feedback {
  margin: 7px 3px 0;
  color: var(--stories-muted);
  font-size: 0.66rem;
  line-height: 1.45;
}

.stories-search__feedback--error { color: #9c2f2f; }

.stories-filters {
  width: min(100%, 480px);
  margin: 4px auto 0;
  display: flex;
  align-items: stretch;
  padding: 0;
  border: 1px solid var(--stories-border);
  border-radius: 13px;
  overflow: visible;
  background: var(--stories-card);
  box-shadow: none;
}

.stories-filter-panel {
  width: 100%;
}

.stories-filter-panel[hidden] { display: none; }

.stories-filter-control {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
}

.stories-filter-control + .stories-filter-control {
  border-left: 1px solid var(--stories-border);
}

.stories-trending {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(100%, 480px);
  margin: 10px auto 0;
}

.stories-trending[hidden] { display: none; }

.stories-trending__bubbles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.stories-trending__bubble {
  max-width: 100%;
  padding: 4px 8px;
  overflow: hidden;
  border: 1px solid var(--stories-border);
  border-radius: 5px;
  background: #fff;
  color: var(--stories-ink);
  font: inherit;
  font-size: 0.69rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.stories-trending__bubble:hover,
.stories-trending__bubble[aria-pressed="true"] {
  border-color: rgba(26, 155, 97, 0.55);
  background: #fff;
  color: var(--stories-ink);
  box-shadow: 0 0 0 1px rgba(26, 155, 97, 0.12);
}

.stories-trending__bubble:focus-visible {
  border-color: rgba(26, 155, 97, 0.65);
  outline: 2px solid rgba(26, 155, 97, 0.38);
  outline-offset: 2px;
}

.stories-filter-control[hidden] { display: none; }

.stories-filter-control__native { display: none; }

.stories-filter-control__trigger {
  position: relative;
  z-index: 2;
  width: 100%;
  min-width: 0;
  padding: 9px 38px 9px 12px;
  border: 0;
  border-radius: 0;
  background: var(--stories-card);
  color: var(--stories-ink);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  cursor: pointer;
  text-align: left;
}

.stories-filter-control:first-child .stories-filter-control__trigger {
  border-radius: 12px 0 0 12px;
}

.stories-filter-control:not([hidden]):not(:has(~ .stories-filter-control:not([hidden]))) .stories-filter-control__trigger {
  border-radius: 0 12px 12px 0;
}

/* When only Type is visible (public News), it is both the first and last
   control. Keep the outer left corners rounded instead of letting the
   last-control rule above square them off. */
.stories-filter-control:first-child:not(:has(~ .stories-filter-control:not([hidden]))) .stories-filter-control__trigger {
  border-radius: 12px;
}
.stories-filter-control__trigger span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stories-filter-control__trigger svg {
  position: absolute;
  top: calc(50% + 1px);
  right: 12px;
  width: 12px;
  height: 8px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--stories-muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
  pointer-events: none;
}

.stories-filter-control__trigger:disabled {
  color: var(--stories-muted);
  cursor: default;
}

.stories-filter-menu {
  position: absolute;
  z-index: 1;
  /* Tuck the popup behind the rounded trigger so its edge emerges beneath it. */
  top: calc(100% - 16px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--stories-border);
  padding-top: 16px;
  border-radius: 12px;
  background: var(--stories-card);
  box-shadow: none;
}

.stories-filter-menu[hidden] { display: none; }

.stories-filter-control.stories-filter-control:not([hidden]):has(> .stories-filter-menu:not([hidden])) .stories-filter-control__trigger {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.stories-filters:has(> .stories-filter-control:first-child > .stories-filter-menu:not([hidden])) {
  border-bottom-left-radius: 0;
}

.stories-filters:has(> .stories-filter-control:not([hidden]):not(:has(~ .stories-filter-control:not([hidden]))) > .stories-filter-menu:not([hidden])) {
  border-bottom-right-radius: 0;
}

/* Align each popup with its cell's visible edges, including the outer border
   or center divider where the cell meets them. */
.stories-filter-control:first-child .stories-filter-menu {
  left: -1px;
  right: -1px;
}

.stories-filter-control + .stories-filter-control .stories-filter-menu {
  left: -1px;
  right: -1px;
}

.stories-filter-menu__option {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--stories-ink);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.stories-filter-menu__option:hover,
.stories-filter-menu__option:focus-visible,
.stories-filter-menu__option[aria-selected="true"] {
  background: var(--stories-green-wash);
  outline: 0;
}

/* The hidden first option is the closed-state placeholder (Type, Sector, or
   Industry), while real filter selections retain the regular ink color. */
.stories-filter-control:has(option:first-child:checked) .stories-filter-control__trigger {
  color: var(--stories-muted);
  font-weight: 500;
}

.stories-filter-control__trigger:focus-visible {
  outline: 0;
  box-shadow: none;
}

.stories-heading {
  display: flex;
  justify-content: space-between;
  padding: 22px 0 13px;
  color: var(--stories-muted);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.15em;
}

.stories-page--public .stories-heading { padding-top: 12px; }

.stories-heading a {
  color: inherit;
  text-decoration: none;
}

.stories-heading a:hover,
.stories-heading a:focus-visible {
  color: var(--stories-green-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}

.stories-day + .stories-day {
  margin-top: 34px;
  padding-top: 12px;
  border-top: 1px solid var(--stories-line);
}

.stories-grid {
  column-count: 3;
  column-gap: 12px;
}

.stories-grid__item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0 0 12px;
  break-inside: avoid-column;
  page-break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

.stories-grid__item[hidden] { display: none; }

.story-panel {
  display: flex;
  width: 100%;
  flex-direction: column;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--stories-border);
  border-radius: 13px;
  background: var(--stories-card);
  box-shadow: 0 3px 14px rgba(23, 70, 47, 0.035);
  color: inherit;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.story-panel:hover,
.story-panel:focus-visible {
  border-color: rgba(11, 102, 64, 0.38);
  box-shadow: 0 10px 28px rgba(23, 70, 47, 0.09);
  outline: none;
}

.story-panel[hidden],
.stories-day[hidden],
.stories-filter-empty[hidden] { display: none; }

.story-panel__meta,
.story-panel__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  color: var(--stories-muted);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Keep card titles aligned whether or not a story has ticker logos. */
.story-panel__meta { min-height: 38px; }

.story-panel__type,
.story-panel__sector {
  color: var(--stories-green-dark);
  font-weight: 600;
}

.story-panel__logos {
  display: flex;
  align-items: center;
  margin-left: auto;
  padding-left: 10px;
}

.story-panel__logo {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--stories-border);
  border-radius: 10px;
  background: var(--stories-paper);
  box-shadow: 0 2px 7px rgba(23, 70, 47, 0.07);
}

.story-panel__logo + .story-panel__logo { margin-left: -7px; }

.story-panel__logo img {
  width: 100%;
  height: 100%;
  padding: 6px;
  object-fit: contain;
}

.story-panel__logo--fallback {
  color: var(--stories-muted);
  font-size: 0.48rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.story-panel__theme {
  margin: 0 0 20px;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(1.4rem, 2.4vw, 1.75rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.08;
  text-wrap: balance;
}

.story-panel__meta + .story-panel__theme { margin-top: 12px; }

.story-panel__footer {
  padding-top: 13px;
  border-top: 1px solid var(--stories-border);
}

.story-panel__sector {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--stories-green-wash);
}

.stories-empty {
  column-span: all;
  padding: 54px 0;
  color: var(--stories-muted);
  text-align: center;
}

.stories-filter-empty {
  margin: 38px 0 0;
  padding: 38px 0;
  color: var(--stories-muted);
  text-align: center;
}

.stories-load-more {
  display: flex;
  justify-content: center;
  padding-top: 34px;
}

.stories-load-more button {
  padding: 10px 17px;
  border: 1px solid var(--stories-ink);
  border-radius: 999px;
  background: var(--stories-paper);
  color: var(--stories-ink);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
}

.stories-load-more button:hover,
.stories-load-more button:focus-visible {
  border-color: var(--stories-green-dark);
  color: var(--stories-green-dark);
  outline: none;
}

.stories-load-more button:disabled {
  cursor: wait;
  opacity: 0.55;
}

@media (max-width: 860px) {
  .stories-grid { column-count: 2; }
}

@media (max-width: 580px) {
  .stories-shell { width: min(100% - 24px, 1180px); padding-top: 18px; }
  .stories-page--public .stories-shell { width: 100%; padding-top: 0; }
  .stories-public-masthead { min-height: 210px; margin-bottom: 8px; padding: 27px 14px 8px; }
  .stories-page--public #stories-content { width: min(1180px, calc(100% - 24px)); }
  .stories-search__row { flex-wrap: wrap; }
  .stories-search__field { flex-basis: 100%; }
  .stories-filters { justify-content: space-between; }
  .stories-filters select { min-width: 0; max-width: 65%; }
  .stories-grid { column-count: 1; }
  .story-panel { padding: 17px; }
  .story-panel__logo { width: 36px; height: 36px; }
}
