/* ==========================================================================
   Sonic Blog — single post + archives
   --------------------------------------------------------------------------
   The Sonic design language on a reading surface: dark shell (matches the
   site body + glass header — no header swap needed), fluid type/space
   scale, ~700px reading measure, EVERY image rounded clamp(14px,1.8vw,22px).
   Prefix: .sb-*. RTL-safe (logical properties only). Zero JS.

   .sb-content is the Gutenberg DESIGN SYSTEM: every core block an editor
   can drop lands on-system without extra classes.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */
.sb {
  --sb-step--1: clamp(0.80rem, 0.76rem + 0.18vw, 0.94rem);
  --sb-step-0:  clamp(1.02rem, 0.96rem + 0.27vw, 1.18rem);   /* reading body */
  --sb-step-1:  clamp(1.20rem, 1.08rem + 0.55vw, 1.55rem);
  --sb-step-2:  clamp(1.44rem, 1.22rem + 0.98vw, 2.05rem);
  --sb-step-3:  clamp(1.73rem, 1.37rem + 1.60vw, 2.70rem);
  --sb-step-4:  clamp(2.07rem, 1.50rem + 2.55vw, 3.55rem);

  --sb-space-2xs: clamp(0.50rem, 0.46rem + 0.18vw, 0.63rem);
  --sb-space-xs:  clamp(0.75rem, 0.69rem + 0.27vw, 0.94rem);
  --sb-space-s:   clamp(1.00rem, 0.91rem + 0.36vw, 1.25rem);
  --sb-space-m:   clamp(1.50rem, 1.24rem + 1.16vw, 2.50rem);
  --sb-space-l:   clamp(2.00rem, 1.48rem + 2.32vw, 4.00rem);
  --sb-space-xl:  clamp(3.00rem, 1.96rem + 4.64vw, 7.00rem);

  --sb-bg:       #0a0a0c;
  --sb-surface:  #17171a;                   /* cards / code panels */
  --sb-fg:       #f5f5f7;
  --sb-body:     #c7c7cc;                   /* long-form body text */
  --sb-muted:    #a1a1a6;
  --sb-hairline: #2c2c2e;
  --sb-accent:   #0065ff;                   /* the site-wide CTA blue */

  --sb-radius:  clamp(14px, 1.8vw, 22px);   /* THE image/media radius */
  --sb-measure: 700px;                      /* reading column (narrowest) */
  --sb-header-shell: 966px;                 /* the Elementor header column */
  --sb-hero-shell: var(--sb-header-shell);  /* head row SITS ON the header
                                               line (review: must match) */
  --sb-shell:   1024px;                     /* archive column */
  --sb-gutter:  clamp(1rem, 0.4rem + 3vw, 4rem);

  background: var(--sb-bg);
  color: var(--sb-fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: var(--sb-step-0);
  line-height: 1.7;
  overflow-x: clip;
  /* Clear the floating glass header (exists only live): pill bottoms
     ~117px @1440 desktop / ~158px mobile — see the header-clearance rule. */
  padding-block-start: clamp(135px, 15vh, 180px);
  padding-block-end: var(--sb-space-xl);
}
@media (max-width: 767px) {
  .sb { padding-block-start: 126px; }   /* hugging the mobile pill */
}

/* No focus rings (site-wide client requirement). */
.sb a:focus,
.sb button:focus,
.sb a:focus-visible,
.sb button:focus-visible { outline: none !important; }
.sb a, .sb button { -webkit-tap-highlight-color: transparent; }

/* --------------------------------------------------------------------------
   2. SINGLE POST — the mock's head: two columns on desktop (title/author/
   category PILLS | featured image), stacked on mobile, hairline below.
   The article shell is WIDE for the hero; the reading column (.sb-content,
   prev/next) re-centers itself to --sb-measure.
   -------------------------------------------------------------------------- */
.sb-article {
  width: 100%;
  max-width: calc(var(--sb-hero-shell) + 2 * var(--sb-gutter));
  margin-inline: auto;
  padding-inline: var(--sb-gutter);
}

.sb-hero {
  display: grid;
  gap: var(--sb-space-m);
  align-items: center;
}
@media (min-width: 900px) {
  .sb-hero {
    grid-template-columns: 1.05fr 1fr;
    column-gap: clamp(2rem, 4vw, 4.5rem);
  }
}
/* Mobile: the featured image LEADS (above the title). */
@media (max-width: 899px) {
  .sb-hero__media { order: -1; }
}

/* Breadcrumbs — quiet trail above the title. A long post title WRAPS
   to the next line (nowrap overflowed the viewport on mobile); only the
   Home/Blog links stay unbreakable. */
.sb-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25em 0.5em;
  margin-block-end: var(--sb-space-s);
  color: var(--sb-muted);
  font-size: var(--sb-step--1);
  line-height: 1.45;
}
.sb-crumbs__link {
  color: var(--sb-muted) !important;
  text-decoration: none !important;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.sb-crumbs__link:hover { color: var(--sb-fg) !important; }
.sb-crumbs__sep { opacity: 0.55; }

.sb-article__title {
  margin: 0;
  font-size: clamp(1.5rem, 1.15rem + 1.5vw, 2.5rem);   /* moderated (review) */
  font-weight: 500;                          /* calmer weight (review) */
  line-height: 1.16;
  letter-spacing: -0.02em;
  color: var(--sb-fg);
  text-wrap: balance;
}

/* Meta row — avatar, bold author; date | reading time beneath. */
.sb-meta {
  display: flex;
  align-items: center;
  gap: var(--sb-space-xs);
  margin-block-start: var(--sb-space-m);
}
.sb-meta__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.sb-meta__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.35;
}
.sb-meta__author {
  color: var(--sb-fg);
  font-size: var(--sb-step-0);
  font-weight: 500;               /* quieter (review) */
}
.sb-meta__sub {
  color: var(--sb-muted);
  font-size: var(--sb-step--1);
}
.sb-meta__dot { margin-inline: 0.4em; opacity: 0.7; }

/* CATEGORY pills (real categories, not tags): light chips on the dark
   shell, like the mock. */
.sb-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: var(--sb-space-m);
}
.sb-cat {
  display: inline-block;
  padding: 0.34em 0.95em;
  border-radius: 999px;
  background: var(--sb-fg);
  color: #0a0a0c !important;                 /* beat theme link paints */
  font-size: var(--sb-step--1);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none !important;
  transition: background-color 0.25s ease;
}
.sb-cat:hover { background: #d9d9de; }

/* Featured image — rounded, filling its column. */
.sb-hero__media { margin: 0; }
.sb-hero__img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--sb-radius);
}
@media (min-width: 900px) {
  .sb-hero__img { aspect-ratio: 16 / 10; object-fit: cover; }
}

/* Full-width hairline under the hero (the mock's divider). */
.sb-article__rule {
  border: 0;
  border-block-start: 1px solid var(--sb-hairline);
  margin: var(--sb-space-l) 0 0;            /* full width of the header line */
}

/* --------------------------------------------------------------------------
   3. .sb-content — the GUTENBERG DESIGN SYSTEM
   --------------------------------------------------------------------------
   Heading hierarchy INSIDE a post starts at H2 (the H1 is the title).
   Every core block lands on-system with zero editor effort.
   -------------------------------------------------------------------------- */
.sb-content {
  /* FULL header-line width (review) — the 700px centered measure read
     as unwanted side margins against the aligned head. */
  margin-block-start: var(--sb-space-l);
  color: var(--sb-body);
  font-size: var(--sb-step-0);
  line-height: 1.75;
}

/* Opening paragraph — a touch larger and brighter (the mock's lead). */
.sb-content > p:first-of-type {
  color: #e8e8ed;
  font-size: calc(var(--sb-step-0) * 1.08);
  line-height: 1.72;
}

/* EXTERNAL links get the small arrow beside them (mask = currentColor,
   so it rides the link's blue and its hover shade). Internal links and
   anchors stay clean. */
.sb-content a[href^="http"]:not([href*="sonictech.co.il"])::after {
  content: '';
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-inline-start: 0.28em;
  vertical-align: 0.08em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M9 7h8v8'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M9 7h8v8'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* — Headings — */
.sb-content h2,
.sb-content h3,
.sb-content h4,
.sb-content h5,
.sb-content h6 {
  color: var(--sb-fg);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: var(--sb-space-l) 0 var(--sb-space-xs);
  text-wrap: balance;
}
.sb-content h2 { font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.7rem); }
.sb-content h3 { font-size: clamp(1.15rem, 1.02rem + 0.5vw, 1.4rem); }
.sb-content h4 { font-size: calc(var(--sb-step-0) * 1.05); }
.sb-content h5,
.sb-content h6 { font-size: var(--sb-step-0); }

/* — Body copy — */
.sb-content p {
  margin: 0 0 var(--sb-space-s);
}
/* No lonely words on a line — everywhere long-form text renders. */
.sb-content :is(p, li, blockquote, figcaption, dd) { text-wrap: pretty; }
.sb-content a {
  color: var(--sb-accent) !important;
  text-decoration: underline !important;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}
.sb-content a:hover { color: #4d94ff !important; }
.sb-content strong { color: var(--sb-fg); font-weight: 600; }
.sb-content em { font-style: italic; }

/* — Lists — */
.sb-content ul,
.sb-content ol {
  margin: 0 0 var(--sb-space-s);
  padding-inline-start: 1.4em;
}
.sb-content li { margin-block-end: 0.4em; }
.sb-content li::marker { color: var(--sb-muted); }

/* — Images / figures: ALWAYS rounded — */
.sb-content img,
.sb-content video,
.sb-content .wp-block-image img,
.sb-content .wp-block-video video,
.sb-content .wp-block-cover,
.sb-content .wp-block-cover__image-background,
.sb-content .wp-block-gallery .wp-block-image img,
.sb-content .wp-block-media-text__media img,
.sb-content .wp-block-media-text__media video {
  border-radius: var(--sb-radius);
  max-width: 100%;
  height: auto;
}
.sb-content figure {
  margin: var(--sb-space-m) 0;
}
.sb-content figcaption {
  margin-block-start: var(--sb-space-2xs);
  color: var(--sb-muted);
  font-size: var(--sb-step--1);
  line-height: 1.5;
  text-align: center;
}

/* — Embeds (YouTube / Vimeo / etc.): rounded frame — */
.sb-content .wp-block-embed__wrapper {
  border-radius: var(--sb-radius);
  overflow: hidden;
}
.sb-content .wp-block-embed iframe {
  display: block;
  width: 100%;
}

/* — Quotes — */
.sb-content blockquote,
.sb-content .wp-block-quote {
  margin: var(--sb-space-m) 0;
  padding-inline-start: var(--sb-space-s);
  border-inline-start: 3px solid var(--sb-accent);
  color: var(--sb-fg);
  font-size: var(--sb-step-1);
  font-weight: 400;
  line-height: 1.5;
}
.sb-content blockquote p { margin-block-end: var(--sb-space-2xs); }
.sb-content blockquote cite {
  display: block;
  color: var(--sb-muted);
  font-size: var(--sb-step--1);
  font-style: normal;
}
.sb-content .wp-block-pullquote {
  margin: var(--sb-space-l) 0;
  padding: var(--sb-space-m) 0;
  border-block: 1px solid var(--sb-hairline);
  text-align: center;
}
.sb-content .wp-block-pullquote blockquote {
  border: 0;
  padding: 0;
  margin: 0;
}

/* — Code — */
.sb-content code {
  background: var(--sb-surface);
  border-radius: 6px;
  padding: 0.15em 0.4em;
  font-size: 0.9em;
}
.sb-content pre,
.sb-content .wp-block-code {
  background: var(--sb-surface);
  border: 1px solid var(--sb-hairline);
  border-radius: var(--sb-radius);
  padding: var(--sb-space-s);
  overflow-x: auto;
  margin: var(--sb-space-m) 0;
}
.sb-content pre code { background: none; padding: 0; }

/* — Separator — */
.sb-content hr,
.sb-content .wp-block-separator {
  border: 0;
  border-block-start: 1px solid var(--sb-hairline);
  margin: var(--sb-space-l) auto;
  max-width: 200px;
}
.sb-content .wp-block-separator.is-style-wide { max-width: none; }

/* — Buttons: the site pill — */
.sb-content .wp-block-button__link {
  background: var(--sb-accent) !important;
  color: #fff !important;
  border-radius: 999px !important;
  border: 0 !important;
  padding: 0.8em 1.9em !important;
  font-size: var(--sb-step-0);
  font-weight: 500;
  text-decoration: none !important;
  transition: background-color 0.3s ease;
}
.sb-content .wp-block-button__link:hover { background: #0053d6 !important; }

/* — Tables — */
.sb-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sb-space-m) 0;
  font-size: var(--sb-step--1);
}
.sb-content th,
.sb-content td {
  padding: 0.7em 0.9em;
  border-block-end: 1px solid var(--sb-hairline);
  text-align: start;
}
.sb-content th { color: var(--sb-fg); font-weight: 500; }

/* — Wide / full alignments stay inside a sane bleed — */
.sb-content .alignwide {
  margin-inline: calc(-1 * min(var(--sb-gutter), 6vw));
}
.sb-content .alignfull {
  margin-inline: calc(-1 * var(--sb-gutter));
}

/* --------------------------------------------------------------------------
   4. PREV / NEXT
   -------------------------------------------------------------------------- */
.sb-pn {
  display: grid;
  gap: var(--sb-space-s);
  margin-block-start: var(--sb-space-xl);
  padding-block-start: var(--sb-space-l);
  border-block-start: 1px solid var(--sb-hairline);
}
@media (min-width: 768px) {
  .sb-pn { grid-template-columns: 1fr 1fr; }
  .sb-pn__item--next { text-align: end; }
}
.sb-pn__item {
  display: block;
  text-decoration: none !important;
  color: var(--sb-fg) !important;
}
.sb-pn__label {
  display: block;
  color: var(--sb-muted);
  font-size: var(--sb-step--1);
  margin-block-end: 0.3em;
}
.sb-pn__title {
  font-size: var(--sb-step-1);
  font-weight: 500;
  line-height: 1.3;
  transition: color 0.25s ease;
}
.sb-pn__item:hover .sb-pn__title { color: var(--sb-accent); }

/* --------------------------------------------------------------------------
   5. ARCHIVE
   -------------------------------------------------------------------------- */
.sb-archive__head,
.sb-grid,
.sb-archive__empty,
.sb-archive .sb-pagination {
  width: 100%;
  max-width: calc(var(--sb-shell) + 2 * var(--sb-gutter));
  margin-inline: auto;
  padding-inline: var(--sb-gutter);
}
.sb-archive__head { margin-block-end: var(--sb-space-l); }
.sb-archive__title {
  margin: 0;
  font-size: clamp(1.5rem, 1.15rem + 1.5vw, 2.5rem);   /* matches the post H1 */
  font-weight: 500;                                     /* quieter (review) */
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.sb-archive__sub {
  margin: var(--sb-space-xs) 0 0;
  color: var(--sb-muted);
  font-size: var(--sb-step-0);
  line-height: 1.55;              /* matches the cards' rhythm */
  max-width: 52ch;
  text-wrap: pretty;
}
.sb-archive__sub p { margin: 0; }
.sb-archive__empty { color: var(--sb-muted); }

/* Card grid: 1 / 2 / 3 columns. */
.sb-grid {
  display: grid;
  gap: var(--sb-space-l) var(--sb-space-m);
}
@media (min-width: 600px)  { .sb-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .sb-grid { grid-template-columns: 1fr 1fr 1fr; } }

/* Card — a surface a touch lighter than the page, the whole box is the
   link. Same voice as the single: category PILL, avatar meta row. */
.sb-card {
  min-width: 0;
  background: #131316;                       /* one step above --sb-bg */
  border: 1px solid #1d1d21;
  border-radius: var(--sb-radius);
  overflow: hidden;
  transition: background-color 0.3s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.sb-card:hover {
  background: #17171b;
  transform: translateY(-3px);
}
.sb-card__link {
  display: block;
  height: 100%;
  text-decoration: none !important;
  color: inherit !important;
}
.sb-card__media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--sb-surface);             /* the card clips the corners */
}
.sb-card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.sb-card__link:hover .sb-card__img { transform: scale(1.04); }
.sb-card__body { padding: var(--sb-space-s); }
/* Category pill — the single post's chip, one size down. */
.sb-card__cat {
  display: inline-block;
  padding: 0.3em 0.85em;
  border-radius: 999px;
  background: var(--sb-fg);
  color: #0a0a0c;
  font-size: var(--sb-step--1);
  font-weight: 600;
  line-height: 1.2;
  margin-block-end: 0.8em;
}
.sb-card__title {
  margin: 0;
  color: var(--sb-fg);
  font-size: var(--sb-step-1);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  /* NO hover recolor (review) — the card's lift + surface shift carry
     the affordance. */
}
.sb-card__excerpt {
  margin: 0.5em 0 0;
  color: var(--sb-muted);
  font-size: var(--sb-step--1);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Meta — avatar circle + author + numeric date, like the single. */
.sb-card__meta {
  display: flex;
  align-items: center;
  gap: 0.55em;
  margin-block-start: 0.9em;
  color: var(--sb-muted);
  font-size: var(--sb-step--1);
}
.sb-card__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.sb-card__author { color: #d5d5da; font-weight: 500; }
.sb-card__dot { margin-inline: 0; opacity: 0.7; }

/* Pagination — quiet pills. */
.sb-archive .sb-pagination { margin-block-start: var(--sb-space-l); }
.sb-archive .sb-pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.sb-archive .sb-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding-inline: 0.9em;
  border-radius: 999px;
  border: 1px solid var(--sb-hairline);
  color: var(--sb-fg) !important;
  font-size: var(--sb-step--1);
  text-decoration: none !important;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
.sb-archive .sb-pagination .page-numbers:hover { border-color: var(--sb-muted); }
.sb-archive .sb-pagination .page-numbers.current {
  background: var(--sb-fg);
  border-color: var(--sb-fg);
  color: #0a0a0c !important;
}
.sb-archive .sb-pagination .page-numbers.dots { border: 0; color: var(--sb-muted) !important; }

/* --------------------------------------------------------------------------
   6. REDUCED MOTION
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sb *,
  .sb *::before,
  .sb *::after {
    transition-duration: 0.001ms !important;
    animation: none !important;
  }
}
