/* Plan documents section ([oeme_plan_documents]). */

.oeme-plan-docs {
  --oeme-docs-per-view: 4;
  --oeme-docs-gap: 20px;
  --oeme-docs-border: #e3e7ed;
  --oeme-docs-muted: #667085;
  --oeme-docs-ink: var(--wp--preset--color--contrast, #0f172a);
  --oeme-docs-thumb-bg: #f1f3f7;
  position: relative;
  color: var(--oeme-docs-ink);
}

@media (max-width: 1024px) {
  .oeme-plan-docs { --oeme-docs-per-view: 2.3; }
}

@media (max-width: 599px) {
  .oeme-plan-docs { --oeme-docs-per-view: 1.25; --oeme-docs-gap: 14px; }
}

.oeme-plan-docs .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Heading and controls ─────────────────────────────────────────── */

.oeme-plan-docs__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 24px;
  margin-bottom: 24px;
}

.oeme-plan-docs__eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.oeme-plan-docs__title {
  margin: 0;
  font-size: clamp(24px, 1.2rem + 1.2vw, 34px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: inherit;
}

.oeme-plan-docs__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.oeme-plan-docs__select,
.oeme-plan-docs__search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
}

.oeme-plan-docs__topic,
.oeme-plan-docs__query {
  box-sizing: border-box;
  height: 42px;
  margin: 0;
  border: 1px solid var(--oeme-docs-border);
  border-radius: 10px;
  background-color: #fff;
  color: var(--oeme-docs-ink);
  font: inherit;
  font-size: 15px;
  line-height: 1;
  box-shadow: none;
}

.oeme-plan-docs__topic {
  width: 205px;
  padding: 0 40px 0 14px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.oeme-plan-docs__search svg {
  position: absolute;
  left: 14px;
  color: var(--oeme-docs-muted);
  pointer-events: none;
}

.oeme-plan-docs__query {
  width: 260px;
  padding: 0 14px 0 38px;
}

.oeme-plan-docs__query::placeholder {
  color: #98a2b3;
}

.oeme-plan-docs__topic:focus-visible,
.oeme-plan-docs__query:focus-visible {
  outline: 2px solid var(--wp--preset--color--accent-1, #2563eb);
  outline-offset: 1px;
}

@media (max-width: 782px) {
  .oeme-plan-docs__head { align-items: stretch; }
  .oeme-plan-docs__controls { width: 100%; }
  .oeme-plan-docs__select,
  .oeme-plan-docs__search { flex: 1 1 200px; }
  .oeme-plan-docs__topic,
  .oeme-plan-docs__query { width: 100%; }
}

/* ── The row of cards ─────────────────────────────────────────────── */

.oeme-plan-docs__viewport {
  position: relative;
}

.oeme-plan-docs__track {
  display: flex;
  gap: var(--oeme-docs-gap);
  margin: -6px;
  padding: 6px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.oeme-plan-docs__track::-webkit-scrollbar {
  display: none;
}

.oeme-plan-docs__item {
  flex: 0 0 calc((100% - (var(--oeme-docs-per-view) - 1) * var(--oeme-docs-gap)) / var(--oeme-docs-per-view));
  min-width: 0;
  margin: 0;
  padding: 0;
  scroll-snap-align: start;
}

.oeme-plan-docs__item[hidden] {
  display: none;
}

/* Browse all: every document, as a grid. */
.oeme-plan-docs.is-expanded .oeme-plan-docs__track {
  flex-wrap: wrap;
  overflow: visible;
}

.oeme-plan-docs.is-expanded .oeme-plan-docs__item {
  flex-basis: calc((100% - (var(--oeme-docs-cols, 4) - 1) * var(--oeme-docs-gap)) / var(--oeme-docs-cols, 4));
}

@media (max-width: 1024px) {
  .oeme-plan-docs { --oeme-docs-cols: 2; }
}

@media (max-width: 599px) {
  .oeme-plan-docs { --oeme-docs-cols: 1; }
}

/* ── A card ───────────────────────────────────────────────────────── */

.oeme-plan-docs__card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--oeme-docs-border);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.oeme-plan-docs__card:hover,
.oeme-plan-docs__card:focus-visible {
  border-color: #d0d5dd;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.1);
  transform: translateY(-2px);
  color: inherit;
  text-decoration: none;
}

.oeme-plan-docs__card:focus-visible {
  outline: 2px solid var(--wp--preset--color--accent-1, #2563eb);
  outline-offset: 2px;
}

.oeme-plan-docs__thumb {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  height: 215px;
  padding: 16px 13% 0;
  overflow: hidden;
  background: var(--oeme-docs-thumb-bg);
  border-bottom: 1px solid var(--oeme-docs-border);
}

.oeme-plan-docs__preview {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  background: #fff;
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.14);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.oeme-plan-docs__thumb.has-preview .oeme-plan-docs__preview {
  opacity: 1;
}

/* Shown until (or instead of) a preview. */
.oeme-plan-docs__badge {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 72px;
  border: 1px solid var(--oeme-docs-border);
  border-radius: 8px;
  background: #fff;
  color: var(--oeme-docs-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transform: translate(-50%, -50%);
}

.oeme-plan-docs__thumb.has-preview .oeme-plan-docs__badge {
  display: none;
}

.oeme-plan-docs__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 16px 18px;
}

.oeme-plan-docs__name {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.oeme-plan-docs__info {
  font-size: 13px;
  line-height: 1.3;
  color: var(--oeme-docs-muted);
}

/* ── Arrows ───────────────────────────────────────────────────────── */

.oeme-plan-docs__nav {
  position: absolute;
  top: 107px; /* middle of the preview area */
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--oeme-docs-border);
  border-radius: 50%;
  background: #fff;
  color: var(--oeme-docs-ink);
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.16);
  cursor: pointer;
  transform: translateY(-50%);
}

.oeme-plan-docs__nav[hidden] {
  display: none;
}

.oeme-plan-docs__nav:hover {
  background: var(--oeme-docs-ink);
  color: #fff;
}

.oeme-plan-docs__nav--prev { left: -18px; }
.oeme-plan-docs__nav--next { right: -18px; }

@media (max-width: 782px) {
  .oeme-plan-docs__nav--prev { left: 6px; }
  .oeme-plan-docs__nav--next { right: 6px; }
}

/* ── Empty state and footer ───────────────────────────────────────── */

.oeme-plan-docs__empty {
  margin: 8px 0 0;
  padding: 32px 16px;
  border: 1px dashed var(--oeme-docs-border);
  border-radius: 12px;
  color: var(--oeme-docs-muted);
  text-align: center;
}

.oeme-plan-docs__empty[hidden] {
  display: none;
}

.oeme-plan-docs__footer {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.oeme-plan-docs__browse {
  padding: 12px 20px;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: #fff;
  color: var(--oeme-docs-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.oeme-plan-docs__browse:hover {
  border-color: #98a2b3;
  background: #f9fafb;
}

.oeme-plan-docs__browse:focus-visible {
  outline: 2px solid var(--wp--preset--color--accent-1, #2563eb);
  outline-offset: 2px;
}

/* Without JS the button does nothing, so hide it until the script is running. */
.oeme-plan-docs:not(.is-ready) .oeme-plan-docs__footer {
  display: none;
}

.oeme-plan-docs-error {
  padding: 12px 16px;
  border-left: 4px solid #d63638;
  background: #fcf0f1;
}
