/*
 * iSmart Parenting Hub article foundation.
 *
 * This layer defines semantic design tokens for single Posts and standardizes
 * reading measure, typography, spacing, radii, borders and restrained depth.
 * Component styles should consume these tokens instead of inventing new values.
 */

:root {
  /* Content widths */
  --isp-article-width-reading: 820px;
  --isp-article-width-wide: 960px;
  --isp-article-width-discovery: 1120px;
  --isp-article-width-container: 1240px;
  --isp-article-inline-space: 40px;

  /* Spacing */
  --isp-article-space-1: 0.5rem;
  --isp-article-space-2: 0.75rem;
  --isp-article-space-3: 1rem;
  --isp-article-space-paragraph: 1.125rem;
  --isp-article-space-4: 1.5rem;
  --isp-article-space-5: 2rem;
  --isp-article-space-6: 3rem;
  --isp-article-space-7: 4rem;
  --isp-article-space-8: 6rem;
  --isp-article-space-h2-top: 4rem;
  --isp-article-space-h3-top: 2rem;
  --isp-article-space-block: clamp(3rem, 5vw, 4rem);

  /* Component padding */
  --isp-article-padding-card: 1.25rem;
  --isp-article-padding-callout: clamp(1.25rem, 2.5vw, 1.5rem);

  /* Type scale */
  --isp-article-font-xs: 0.78rem;
  --isp-article-font-sm: 0.9rem;
  --isp-article-font-body: 1.125rem;
  --isp-article-font-lead: clamp(1.16rem, 1.06rem + 0.34vw, 1.4rem);
  --isp-article-font-h3: clamp(1.375rem, 2vw, 1.625rem);
  --isp-article-font-h2: clamp(1.875rem, 3vw, 2.375rem);
  --isp-article-font-h1: clamp(2.5rem, 5vw, 4.5rem);

  /* Line heights */
  --isp-article-line-tight: 1.05;
  --isp-article-line-heading: 1.14;
  --isp-article-line-body: 1.7;
  --isp-article-line-ui: 1.45;

  /* Semantic radii */
  --isp-article-radius-control: 8px;
  --isp-article-radius-callout: 16px;
  --isp-article-radius-card: 16px;
  --isp-article-radius-image: 20px;
  --isp-article-radius-pill: 999px;

  /* Compatibility aliases for existing component CSS */
  --isp-article-radius-sm: var(--isp-article-radius-control);
  --isp-article-radius-md: var(--isp-article-radius-card);
  --isp-article-radius-lg: var(--isp-article-radius-image);

  /* Colors */
  --isp-article-color-text: #444244;
  --isp-article-color-body: #4f4c4e;
  --isp-article-color-muted: #6f6b6d;
  --isp-article-color-subtle: #8c898b;
  --isp-article-color-link: #2378aa;
  --isp-article-color-link-hover: #a43f6c;
  --isp-article-color-surface: #ffffff;
  --isp-article-color-surface-soft: #f7fbfd;
  --isp-article-color-border: var(--isp-border, #eae9ea);
  --isp-article-color-border-strong: #dfe3e6;

  /* Borders */
  --isp-article-border: 1px solid var(--isp-article-color-border);
  --isp-article-border-strong: 1px solid var(--isp-article-color-border-strong);

  /* Shadows are reserved for interaction or meaningful elevation */
  --isp-article-shadow-none: none;
  --isp-article-shadow-hover: 0 10px 24px rgba(68, 68, 68, 0.06);
  --isp-article-shadow-focus: 0 12px 28px rgba(68, 68, 68, 0.075);
}

/* Overall article canvas */
.single-post-layout .single-article {
  width: min(calc(100% - var(--isp-article-inline-space)), var(--isp-article-width-container));
  margin-inline: auto;
}

/* Hero and utility areas use the centered editorial measure. */
.single-post-layout .isp-post-breadcrumbs,
.single-post-layout .single-entry-header,
.single-post-layout .entry-featured-image {
  width: 100%;
  max-width: var(--isp-article-width-wide);
  margin-inline: auto;
}

.single-post-layout .entry-title {
  max-width: 900px;
  color: var(--isp-article-color-text);
  font-size: var(--isp-article-font-h1);
  line-height: var(--isp-article-line-tight);
}

.single-post-layout .entry-subheading,
.single-post-layout .entry-lead {
  max-width: var(--isp-article-width-reading);
  color: var(--isp-article-color-muted);
  font-size: var(--isp-article-font-lead);
  line-height: 1.58;
}

.single-post-layout .entry-meta {
  color: var(--isp-article-color-muted);
  font-size: var(--isp-article-font-sm);
  line-height: var(--isp-article-line-ui);
}

/* The Gutenberg article canvas is centered at 960px. */
.single-post-layout .entry-content {
  width: 100%;
  max-width: var(--isp-article-width-wide);
  margin-top: var(--isp-article-space-6);
  margin-left: auto;
  margin-right: auto;
  color: var(--isp-article-color-body);
  font-size: var(--isp-article-font-body);
  line-height: var(--isp-article-line-body);
}

/* Normal reading elements use one centered 820px measure. */
.single-post-layout .entry-content > p,
.single-post-layout .entry-content > ul,
.single-post-layout .entry-content > ol,
.single-post-layout .entry-content > h2,
.single-post-layout .entry-content > h3,
.single-post-layout .entry-content > h4,
.single-post-layout .entry-content > h5,
.single-post-layout .entry-content > h6,
.single-post-layout .entry-content > blockquote,
.single-post-layout .entry-content > pre,
.single-post-layout .entry-content > table,
.single-post-layout .entry-content > .wp-block-quote,
.single-post-layout .entry-content > .wp-block-list,
.single-post-layout .entry-content > .wp-block-table {
  width: min(100%, var(--isp-article-width-reading));
  max-width: var(--isp-article-width-reading);
  margin-left: auto;
  margin-right: auto;
}

.single-post-layout .entry-content p,
.single-post-layout .entry-content ul,
.single-post-layout .entry-content ol,
.single-post-layout .entry-content blockquote,
.single-post-layout .entry-content .wp-block-quote,
.single-post-layout .entry-content .wp-block-list {
  margin-top: 0;
  margin-bottom: var(--isp-article-space-paragraph);
}

.single-post-layout .entry-content h2 {
  margin-top: var(--isp-article-space-h2-top);
  margin-bottom: var(--isp-article-space-3);
  color: var(--isp-article-color-text);
  font-size: var(--isp-article-font-h2);
  line-height: var(--isp-article-line-heading);
}

.single-post-layout .entry-content h3 {
  margin-top: var(--isp-article-space-h3-top);
  margin-bottom: var(--isp-article-space-2);
  color: var(--isp-article-color-text);
  font-size: var(--isp-article-font-h3);
  line-height: 1.18;
}

.single-post-layout .entry-content h4,
.single-post-layout .entry-content h5,
.single-post-layout .entry-content h6 {
  color: var(--isp-article-color-text);
  line-height: 1.22;
}

.single-post-layout .entry-content a {
  color: var(--isp-article-color-link);
}

.single-post-layout .entry-content a:hover,
.single-post-layout .entry-content a:focus-visible {
  color: var(--isp-article-color-link-hover);
}

/* Native Gutenberg width roles map directly to the article tokens. */
.single-post-layout .entry-content > .alignwide {
  width: min(100%, var(--isp-article-width-wide));
  max-width: var(--isp-article-width-wide);
  margin-left: auto;
  margin-right: auto;
  transform: none;
}

.single-post-layout .entry-content > .alignfull {
  width: min(calc(100vw - var(--isp-article-inline-space)), var(--isp-article-width-container));
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}

/* Editorial media stays centered and restrained. */
.single-post-layout .entry-featured-image {
  border: var(--isp-article-border);
  border-radius: var(--isp-article-radius-image);
  box-shadow: var(--isp-article-shadow-none);
}

.single-post-layout .entry-content img,
.single-post-layout .wp-block-image img,
.single-post-layout .wp-block-cover {
  border-radius: var(--isp-article-radius-image);
}

/* Reading-width supporting sections */
.single-post-layout .isp-post-author,
.single-post-layout .post-tags,
.single-post-layout .comments-area,
.single-post-layout .isp-callout,
.single-post-layout .isp-article-conclusion {
  width: 100%;
  max-width: var(--isp-article-width-reading);
  margin-left: auto;
  margin-right: auto;
}

/* Wider discovery and navigation sections */
.single-post-layout .isp-related-posts {
  width: 100%;
  max-width: var(--isp-article-width-discovery);
  margin-inline: auto;
}

.single-post-layout .single-post-navigation {
  width: 100%;
  max-width: var(--isp-article-width-wide);
  margin-inline: auto;
}

.single-post-layout .isp-post-author,
.single-post-layout .isp-related-posts,
.single-post-layout .post-tags,
.single-post-layout .single-post-navigation,
.single-post-layout .comments-area,
.single-post-layout .isp-callout,
.single-post-layout .isp-article-conclusion {
  margin-top: var(--isp-article-space-block);
}

/* Content blocks use subtle borders and no persistent elevation. */
.single-post-layout .isp-post-author,
.single-post-layout .isp-callout,
.single-post-layout .isp-article-conclusion,
.single-post-layout .isp-related-card,
.single-post-layout .single-post-navigation a {
  border-color: var(--isp-article-color-border);
  box-shadow: var(--isp-article-shadow-none);
}

.single-post-layout .isp-callout,
.single-post-layout .isp-article-conclusion {
  padding: var(--isp-article-padding-callout);
  border-radius: var(--isp-article-radius-callout);
}

.single-post-layout .isp-post-author,
.single-post-layout .isp-related-card,
.single-post-layout .single-post-navigation a {
  border-radius: var(--isp-article-radius-card);
}

.single-post-layout .isp-post-author,
.single-post-layout .isp-related-card__body,
.single-post-layout .single-post-navigation a {
  padding: var(--isp-article-padding-card);
}

.single-post-layout .isp-related-card__media {
  border-radius: var(--isp-article-radius-card) var(--isp-article-radius-card) 0 0;
}

/* Small article controls use the same compact radius. */
.single-post-layout .comments-area input:not([type="checkbox"]):not([type="radio"]),
.single-post-layout .comments-area textarea,
.single-post-layout .comments-area select,
.single-post-layout .comments-area .submit {
  border-radius: var(--isp-article-radius-control);
}

/* Elevation is reserved for active interaction. */
@media (hover: hover) {
  .single-post-layout .isp-related-card:hover,
  .single-post-layout .single-post-navigation a:hover {
    box-shadow: var(--isp-article-shadow-hover);
  }
}

.single-post-layout .isp-related-card:focus-within,
.single-post-layout .single-post-navigation a:focus-visible {
  box-shadow: var(--isp-article-shadow-focus);
}

@media (max-width: 700px) {
  :root {
    --isp-article-inline-space: 24px;
    --isp-article-font-body: clamp(1.0625rem, 4.2vw, 1.125rem);
    --isp-article-space-h2-top: 3.25rem;
    --isp-article-space-h3-top: 1.75rem;
    --isp-article-space-block: 3rem;
    --isp-article-space-8: 4rem;
  }

  .single-post-layout .entry-content,
  .single-post-layout .single-entry-header,
  .single-post-layout .isp-post-breadcrumbs,
  .single-post-layout .entry-featured-image,
  .single-post-layout .isp-post-author,
  .single-post-layout .post-tags,
  .single-post-layout .comments-area,
  .single-post-layout .isp-callout,
  .single-post-layout .isp-article-conclusion,
  .single-post-layout .isp-related-posts,
  .single-post-layout .single-post-navigation {
    width: 100%;
  }
}
