/* One Eleven CMS - Shared blog styles for RapidWeaver
   Customize colors via :root variables below. Text tokens are separate from
   surfaces and accents so you can retype blog copy without retinting the whole UI.
*/

:root {
  /* ----- Typography (blog text) ----- */
  --oe-blog-text-body: #111827;
  --oe-blog-text-heading: #0f172a;
  --oe-blog-text-muted: #475569;
  --oe-blog-text-card-title: #0f172a;
  --oe-blog-text-card-excerpt: rgba(15, 23, 42, 0.68);
  --oe-blog-text-hero: #ffffff;
  --oe-blog-text-hero-subtle: rgba(255, 255, 255, 0.92);
  --oe-blog-text-hero-date: rgba(255, 255, 255, 0.9);
  --oe-blog-text-search-label: #0f172a;
  --oe-blog-text-input: #111827;
  --oe-blog-text-button-secondary: #1f2937;
  --oe-blog-text-pagination: #1f2937;
  --oe-blog-text-pagination-active: #0f172a;
  --oe-blog-text-empty: #444444;

  /* ----- Surfaces (backgrounds, not body copy hue) ----- */
  --oe-blog-surface-page: transparent;
  --oe-blog-surface-card: #ffffff;
  --oe-blog-surface-input: #ffffff;
  --oe-blog-surface-muted: #f6f7f9;
  --oe-blog-surface-clear-hover: #f8fafc;
  --oe-blog-surface-pagination: #f0f3f7;
  --oe-blog-surface-pagination-active: #dbeafe;

  /* ----- Borders ----- */
  --oe-blog-border-input: #d1d5db;
  --oe-blog-border-clear: #d1d5db;

  /* ----- Accent (primary actions + card meta label) ----- */
  --oe-blog-accent: #2f6fde;
  --oe-blog-accent-hover: #295fbe;
  --oe-blog-text-on-accent: #ffffff;

  /* ----- Hero overlay (single tint over the image; raise alpha if text is still hard to read) ----- */
  --oe-blog-hero-scrim: rgba(0, 0, 0, 0.68);
  --oe-blog-hero-scrim-loading-opacity: 0.55;

  /* ----- Article body (HTML from Directus) ----- */
  --oe-blog-content-font-size: 1.0625rem;
  --oe-blog-content-line-height: 1.75;
  /* Horizontal inset for post body + blog index (safe-area aware on notched phones) */
  --oe-blog-page-padding-inline: clamp(1rem, 4vw, 1.75rem);

  /* ----- Shadows ----- */
  --oe-blog-shadow-card: 0 8px 24px rgba(0, 0, 0, 0.06);
  --oe-blog-shadow-card-hover: 0 16px 40px rgba(0, 0, 0, 0.1);
  --oe-blog-shadow-skeleton-card: 0 8px 24px rgba(0, 0, 0, 0.04);

  /* ----- Skeleton shimmer (neutral chrome; change separately from text) ----- */
  --oe-blog-skeleton-a: #e8ecf1;
  --oe-blog-skeleton-b: #f2f4f8;
  --oe-blog-skeleton-hero-a: #cfd6e0;
  --oe-blog-skeleton-hero-b: #e8ecf1;
  --oe-blog-skeleton-hero-text-hi: rgba(255, 255, 255, 0.35);
  --oe-blog-skeleton-hero-text-lo: rgba(255, 255, 255, 0.18);
}

.oe-blog-hero-shell {
  position: relative;
  width: 100vw;
  left: 50%;
  margin-left: -50vw;
  overflow: hidden;
}

.oe-blog-hero-image-wrap {
  position: relative;
  height: 420px;
  overflow: hidden;
}

.oe-blog-hero-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.oe-blog-hero-image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: var(--oe-blog-hero-scrim);
}

.oe-blog-hero {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 92%;
  max-width: 980px;
  color: var(--oe-blog-text-hero);
  text-align: center;
}

.oe-blog-title {
  margin: 0 0 8px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.1;
  color: var(--oe-blog-text-hero);
}

.oe-blog-subtitle {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--oe-blog-text-hero-subtle);
}

.oe-blog-date {
  margin: 14px 0 0;
  font-size: 0.92rem;
  color: var(--oe-blog-text-hero-date);
}

.oe-blog-body {
  padding-top: 48px;
  padding-bottom: 64px;
  padding-left: max(var(--oe-blog-page-padding-inline), env(safe-area-inset-left, 0px));
  padding-right: max(var(--oe-blog-page-padding-inline), env(safe-area-inset-right, 0px));
  background: var(--oe-blog-surface-page);
  box-sizing: border-box;
}

.oe-blog-content {
  max-width: 960px;
  margin: 0 auto;
  color: var(--oe-blog-text-body);
  font-size: var(--oe-blog-content-font-size);
  line-height: var(--oe-blog-content-line-height);
  box-sizing: border-box;
}

.oe-blog-content > *:first-child {
  margin-top: 0;
}

.oe-blog-content p {
  margin: 0 0 1.15em;
}

.oe-blog-content h1,
.oe-blog-content h2,
.oe-blog-content h3,
.oe-blog-content h4,
.oe-blog-content h5,
.oe-blog-content h6 {
  color: var(--oe-blog-text-heading);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.02em;
}

.oe-blog-content h1 {
  font-size: clamp(1.65rem, 2.8vw, 2.125rem);
  margin: 0 0 0.55em;
}

.oe-blog-content h2 {
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  margin: 2.1em 0 0.6em;
}

.oe-blog-content h3 {
  font-size: clamp(1.25rem, 2vw, 1.45rem);
  margin: 1.85em 0 0.5em;
}

.oe-blog-content h4 {
  font-size: clamp(1.125rem, 1.65vw, 1.22rem);
  margin: 1.6em 0 0.45em;
}

.oe-blog-content h5 {
  font-size: 1.05rem;
  margin: 1.45em 0 0.4em;
  letter-spacing: -0.015em;
}

.oe-blog-content h6 {
  font-size: 1rem;
  margin: 1.35em 0 0.35em;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.oe-blog-content h1 + p,
.oe-blog-content h2 + p,
.oe-blog-content h3 + p,
.oe-blog-content h4 + p,
.oe-blog-content h5 + p,
.oe-blog-content h6 + p {
  margin-top: 0;
}

.oe-blog-content ul,
.oe-blog-content ol {
  margin: 0 0 1.15em;
  padding-left: 1.35em;
}

.oe-blog-content li {
  margin-bottom: 0.55em;
}

.oe-blog-content li:last-child {
  margin-bottom: 0;
}

.oe-blog-content ol > li::marker {
  font-weight: 700;
  color: var(--oe-blog-text-heading);
}

.oe-blog-content li > p {
  margin-bottom: 0.6em;
}

.oe-blog-content li > p:last-child {
  margin-bottom: 0;
}

.oe-blog-content blockquote {
  margin: 1.25em 0;
  padding: 0.6em 0 0.6em 1.1em;
  border-left: 4px solid var(--oe-blog-accent);
  color: var(--oe-blog-text-muted);
  font-style: italic;
}

.oe-blog-content code {
  font-size: 0.92em;
  padding: 0.12em 0.35em;
  border-radius: 4px;
  background: var(--oe-blog-surface-muted);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.oe-blog-content pre {
  margin: 1.15em 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.9em;
  line-height: 1.6;
  border-radius: 8px;
  background: var(--oe-blog-surface-muted);
}

.oe-blog-content pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.oe-blog-content hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--oe-blog-border-input);
}

.oe-blog-content a {
  color: var(--oe-blog-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.oe-blog-content a:hover {
  color: var(--oe-blog-accent-hover);
}

/* Tables (wide tables: wrap in <div style="overflow-x:auto"> in RW if needed) */
.oe-blog-content table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 1.25em 0;
  font-size: 0.94em;
  line-height: 1.5;
}

.oe-blog-content caption {
  caption-side: top;
  margin-bottom: 0.65em;
  font-weight: 600;
  font-size: 0.95em;
  color: var(--oe-blog-text-heading);
  text-align: left;
}

.oe-blog-content th,
.oe-blog-content td {
  border: 1px solid var(--oe-blog-border-input);
  padding: 0.65em 0.85em;
  text-align: left;
  vertical-align: top;
}

.oe-blog-content thead th {
  background: var(--oe-blog-surface-muted);
  color: var(--oe-blog-text-heading);
  font-weight: 600;
  border-bottom: 2px solid var(--oe-blog-border-input);
}

.oe-blog-content tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.035);
}

/* Images, video, embeds */
.oe-blog-content img,
.oe-blog-content video {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.15em auto;
  border-radius: 8px;
}

.oe-blog-content figure {
  margin: 1.35em 0;
}

.oe-blog-content figure img,
.oe-blog-content figure video {
  margin-left: auto;
  margin-right: auto;
}

.oe-blog-content figcaption {
  margin-top: 0.55em;
  font-size: 0.92em;
  line-height: 1.5;
  color: var(--oe-blog-text-muted);
  text-align: center;
}

.oe-blog-content iframe {
  max-width: 100%;
  margin: 1.15em 0;
  border: 0;
  border-radius: 8px;
}

/* Definition lists */
.oe-blog-content dl {
  margin: 0 0 1.15em;
}

.oe-blog-content dt {
  margin-top: 0.85em;
  font-weight: 700;
  color: var(--oe-blog-text-heading);
}

.oe-blog-content dt:first-child {
  margin-top: 0;
}

.oe-blog-content dd {
  margin: 0.35em 0 0 1.1em;
}

/* Collapsible / notes */
.oe-blog-content details {
  margin: 1.05em 0;
  padding: 0.85em 1rem;
  border-radius: 8px;
  border: 1px solid var(--oe-blog-border-input);
  background: var(--oe-blog-surface-muted);
}

.oe-blog-content summary {
  font-weight: 600;
  color: var(--oe-blog-text-heading);
  cursor: pointer;
}

.oe-blog-content details[open] summary {
  margin-bottom: 0.65em;
}

/* Small inline semantics */
.oe-blog-content mark {
  padding: 0.06em 0.18em;
  border-radius: 3px;
  background: #fef08a;
  color: var(--oe-blog-text-body);
}

.oe-blog-content abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

.oe-blog-content kbd {
  display: inline-block;
  font-size: 0.88em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  padding: 0.08em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--oe-blog-border-input);
  background: var(--oe-blog-surface-input);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

.oe-blog-content samp {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.oe-blog-content sup,
.oe-blog-content sub {
  line-height: 0;
  font-size: 0.8em;
}

.oe-blog-content address {
  margin: 1em 0;
  font-style: normal;
  color: var(--oe-blog-text-muted);
}

/* Blog index shell (search + grid): same horizontal inset as post body */
[data-oe-index-root] {
  padding-left: max(var(--oe-blog-page-padding-inline), env(safe-area-inset-left, 0px));
  padding-right: max(var(--oe-blog-page-padding-inline), env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}

.oe-blog-grid {
  display: grid !important;
  gap: 28px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.oe-blog-search {
  margin: 0 0 24px;
}

.oe-blog-search-label {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--oe-blog-text-search-label);
}

.oe-blog-search-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.oe-blog-search-input {
  flex: 1 1 auto;
  min-width: 240px;
  padding: 10px 12px;
  border: 1px solid var(--oe-blog-border-input);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--oe-blog-text-input);
  background: var(--oe-blog-surface-input);
}

.oe-blog-search-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--oe-blog-accent);
  color: var(--oe-blog-text-on-accent);
  font-weight: 600;
  cursor: pointer;
}

.oe-blog-search-button:hover {
  background: var(--oe-blog-accent-hover);
}

.oe-blog-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid var(--oe-blog-border-clear);
  border-radius: 8px;
  background: var(--oe-blog-surface-input);
  color: var(--oe-blog-text-button-secondary);
  font-weight: 600;
  cursor: pointer;
}

.oe-blog-search-clear:hover {
  background: var(--oe-blog-surface-clear-hover);
}

.oe-blog-search-loading {
  font-size: 0.92rem;
  color: var(--oe-blog-text-muted);
}

.oe-blog-search-state {
  margin: 10px 0 0;
  color: var(--oe-blog-text-muted);
  font-size: 0.95rem;
}

@media (max-width: 1080px) {
  .oe-blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .oe-blog-grid {
    grid-template-columns: 1fr;
  }

  .oe-blog-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .oe-blog-body {
    padding-top: 32px;
    padding-bottom: 48px;
  }
}

.oe-blog-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: var(--oe-blog-surface-card);
  box-shadow: var(--oe-blog-shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.oe-blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--oe-blog-shadow-card-hover);
}

.oe-blog-card-image-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.oe-blog-card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.oe-blog-card-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 22px;
}

.oe-blog-card-label {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--oe-blog-accent);
}

.oe-blog-card-title {
  margin: 0 0 12px;
  font-size: 1.35rem;
  line-height: 1.25;
  color: var(--oe-blog-text-card-title);
}

.oe-blog-card-title a {
  color: inherit;
  text-decoration: none;
}

.oe-blog-card-title a:hover {
  text-decoration: underline;
}

.oe-blog-card-excerpt {
  margin: 0 0 16px;
  color: var(--oe-blog-text-card-excerpt);
  line-height: 1.55;
}

.oe-blog-card-button {
  display: inline-flex;
  align-items: center;
  margin-top: auto;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--oe-blog-accent);
  color: var(--oe-blog-text-on-accent);
  font-weight: 600;
  text-decoration: none;
}

.oe-blog-card-button:hover {
  background: var(--oe-blog-accent-hover);
}

.oe-blog-card-empty {
  padding: 18px;
  border-radius: 8px;
  background: var(--oe-blog-surface-muted);
  color: var(--oe-blog-text-empty);
}

.oe-blog-pagination {
  margin-top: 28px;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.oe-page {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--oe-blog-surface-pagination);
  color: var(--oe-blog-text-pagination);
  text-decoration: none;
}

.oe-page.current {
  background: var(--oe-blog-surface-pagination-active);
  color: var(--oe-blog-text-pagination-active);
}

.oe-page.disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* Index skeleton loaders (while Directus fetch runs) */
.oe-blog-skeleton-card {
  pointer-events: none;
  box-shadow: var(--oe-blog-shadow-skeleton-card);
}

.oe-blog-skeleton-card .oe-blog-card-image-wrap {
  background: var(--oe-blog-skeleton-a);
}

.oe-blog-skeleton-block {
  min-height: 0;
  aspect-ratio: 16 / 9;
  background: linear-gradient(
    90deg,
    var(--oe-blog-skeleton-a) 0%,
    var(--oe-blog-skeleton-b) 40%,
    var(--oe-blog-skeleton-a) 80%
  );
  background-size: 200% 100%;
  animation: oe-skeleton-shimmer 1.2s ease-in-out infinite;
}

.oe-blog-skeleton-line {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  background: linear-gradient(
    90deg,
    var(--oe-blog-skeleton-a) 0%,
    var(--oe-blog-skeleton-b) 40%,
    var(--oe-blog-skeleton-a) 80%
  );
  background-size: 200% 100%;
  animation: oe-skeleton-shimmer 1.2s ease-in-out infinite;
}

.oe-blog-skeleton-line--short {
  width: 28%;
  height: 10px;
}

.oe-blog-skeleton-line--title {
  width: 92%;
  height: 18px;
  margin-bottom: 14px;
}

.oe-blog-skeleton-line--medium {
  width: 75%;
}

.oe-blog-skeleton-button {
  width: 120px;
  height: 36px;
  border-radius: 8px;
  margin-top: 8px;
  background: linear-gradient(
    90deg,
    var(--oe-blog-skeleton-a) 0%,
    var(--oe-blog-skeleton-b) 40%,
    var(--oe-blog-skeleton-a) 80%
  );
  background-size: 200% 100%;
  animation: oe-skeleton-shimmer 1.2s ease-in-out infinite;
}

@keyframes oe-skeleton-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* Single post skeleton (while Directus fetch runs) */
article[data-oe-post-root].oe-blog-post--loading .oe-blog-hero-image-wrap {
  background: linear-gradient(
    90deg,
    var(--oe-blog-skeleton-hero-a) 0%,
    var(--oe-blog-skeleton-hero-b) 45%,
    var(--oe-blog-skeleton-hero-a) 85%
  );
  background-size: 200% 100%;
  animation: oe-skeleton-shimmer 1.2s ease-in-out infinite;
}

article[data-oe-post-root].oe-blog-post--loading .oe-blog-hero-image {
  opacity: 0;
}

article[data-oe-post-root].oe-blog-post--loading .oe-blog-hero-image-wrap::after {
  opacity: var(--oe-blog-hero-scrim-loading-opacity);
}

.oe-post-skeleton-line {
  display: block;
  height: 12px;
  border-radius: 6px;
  margin: 0 auto 10px;
  max-width: 100%;
  background: linear-gradient(
    90deg,
    var(--oe-blog-skeleton-hero-text-lo) 0%,
    var(--oe-blog-skeleton-hero-text-hi) 45%,
    var(--oe-blog-skeleton-hero-text-lo) 85%
  );
  background-size: 200% 100%;
  animation: oe-skeleton-shimmer 1.2s ease-in-out infinite;
}

.oe-post-skeleton-line--hero-title {
  width: min(520px, 85vw);
  height: clamp(28px, 5vw, 44px);
  border-radius: 8px;
  margin-bottom: 16px;
}

.oe-post-skeleton-line--hero-sub {
  width: min(640px, 90vw);
  margin-bottom: 8px;
}

.oe-post-skeleton-line--hero-sub.oe-post-skeleton-line--short {
  width: min(420px, 70vw);
}

.oe-post-skeleton-line--hero-date {
  width: 120px;
  height: 10px;
  margin-top: 6px;
}

.oe-post-skeleton-body {
  max-width: 960px;
  margin: 0 auto;
}

.oe-post-skeleton-body .oe-post-skeleton-line {
  margin-left: 0;
  margin-right: 0;
  background: linear-gradient(
    90deg,
    var(--oe-blog-skeleton-a) 0%,
    var(--oe-blog-skeleton-b) 45%,
    var(--oe-blog-skeleton-a) 85%
  );
  background-size: 200% 100%;
}

.oe-post-skeleton-body .oe-post-skeleton-line--wide {
  width: 100%;
}

.oe-post-skeleton-body .oe-post-skeleton-line--medium {
  width: 88%;
}

.oe-post-skeleton-body .oe-post-skeleton-line--narrow {
  width: 62%;
}
