/* ============================================================
   DeSine Core — Round 2 widgets (Agent E)
   ds-service-tiles · ds-why-showcase · ds-cost-boxes · ds-posts-grid
   Tokens come from the theme's styles.css (:root).
   Breakpoints: tablet ≤1024px, mobile ≤767px (Elementor defaults).
   ============================================================ */

/* ---------- Service tiles ---------- */
.ds-stiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.1rem;
}
@media (max-width: 1024px) { .ds-stiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px)  { .ds-stiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; } }

.ds-stile {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; text-decoration: none; color: inherit;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
a.ds-stile:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; color: inherit; }
a.ds-stile:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-lg); }
.ds-stile__media {
  display: block; aspect-ratio: 4 / 3; overflow: hidden;
  margin: .45rem .45rem 0; border-radius: 12px; background: var(--ground-alt);
}
.ds-stile__media img {
  width: 100%; height: 100% !important; object-fit: cover; display: block;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
a.ds-stile:hover .ds-stile__media img { transform: scale(1.07); }
.ds-stile__body { display: flex; flex-direction: column; gap: .3rem; flex: 1; padding: .8rem 1rem 1rem; }
.ds-stile__title {
  display: flex; align-items: baseline; justify-content: space-between; gap: .5rem;
  font-size: 1rem; line-height: 1.3; margin: 0; color: var(--ink);
}
a.ds-stile .ds-stile__title::after {
  content: "→"; flex: none; color: var(--accent); font-weight: 700;
  transition: transform .2s ease;
}
a.ds-stile:hover .ds-stile__title::after { transform: translateX(3px); }
.ds-stile__text { font-size: .86rem; line-height: 1.5; color: var(--ink-soft); margin: 0; }
.ds-stile__price { margin-top: auto; padding-top: .35rem; font-size: .82rem; font-weight: 800; color: var(--accent-deep); }

/* "Not sure where to start?" tile */
.ds-stile--extra {
  background: linear-gradient(145deg, var(--dark) 0%, #1B2F49 100%);
  border-color: transparent; color: var(--ink-inverse); justify-content: center;
}
.ds-stile--extra .ds-stile__body { justify-content: center; padding: 1.4rem 1.2rem; gap: .5rem; }
.ds-stile--extra .ds-stile__title { color: #fff; font-size: 1.12rem; }
a.ds-stile--extra .ds-stile__title::after { content: none; }
.ds-stile--extra .ds-stile__text { color: var(--ink-inverse-soft); }
.ds-stile__more { margin-top: .4rem; font-weight: 700; font-size: .88rem; color: #FF8E6B; }
.ds-stile__more span { display: inline-block; transition: transform .2s ease; }
a.ds-stile--extra:hover .ds-stile__more span { transform: translateX(4px); }

/* On dark sections */
.section--dark .ds-stile:not(.ds-stile--extra) { background: var(--dark-2); border-color: var(--line-dark); }
.section--dark .ds-stile__title { color: #fff; }
.section--dark .ds-stile__text { color: var(--ink-inverse-soft); }
.section--dark .ds-stile__price { color: #FF8E6B; }

@media (max-width: 767px) {
  .ds-stile__media { margin: .35rem .35rem 0; border-radius: 10px; }
  .ds-stile__body { padding: .65rem .75rem .8rem; }
  .ds-stile__title { font-size: .92rem; }
  .ds-stile__price { font-size: .78rem; }
  .ds-stiles--compact .ds-stile:not(.ds-stile--extra) .ds-stile__text { display: none; }
  .ds-stile--extra .ds-stile__body { padding: 1rem .85rem; }
  .ds-stile--extra .ds-stile__title { font-size: 1rem; }
  .ds-stile--extra .ds-stile__text { font-size: .8rem; }
}

/* ---------- Why showcase ---------- */
.ds-why {
  --ds-why-overlay: .55;
  --ds-why-interval: 4500ms;
  position: relative; isolation: isolate; overflow: hidden;
  background: var(--dark); color: var(--ink-inverse);
}
.ds-why--panel { border-radius: 24px; }
.ds-why__bg {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100% !important; max-width: none; object-fit: cover;
}
.ds-why__overlay {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(100deg,
      rgba(12, 24, 38, calc(var(--ds-why-overlay) + .25)) 0%,
      rgba(12, 24, 38, var(--ds-why-overlay)) 55%,
      rgba(12, 24, 38, calc(var(--ds-why-overlay) - .15)) 100%);
}
.ds-why__inner {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(1.4rem, 3vw, 2.4rem);
  padding: clamp(2.2rem, 6vw, 4.5rem) clamp(1.3rem, 5vw, 4rem);
}
.ds-why--bleed .ds-why__inner {
  max-width: var(--container); margin-inline: auto;
  padding: clamp(3.4rem, 7vw, 5.6rem) clamp(1.1rem, 4vw, 2rem);
}
.ds-why__head .eyebrow { color: #FF8E6B; }
.ds-why__title { font-size: var(--fs-h2); color: #fff; margin: 0; max-width: 16em; }

/* Static list (no JS / reduced motion / editor before init) */
.ds-why__track {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 1.6rem 2rem;
}
.ds-why__point { min-width: 0; }
.ds-why__num {
  display: block; font-size: 2.2rem; font-weight: 800; line-height: 1; letter-spacing: -.03em;
  color: transparent; -webkit-text-stroke: 1.5px rgba(255, 142, 107, .85); margin-bottom: .7rem;
}
.ds-why__point-title { color: #fff; font-size: 1.2rem; margin: 0 0 .5rem; }
.ds-why__point-text { color: var(--ink-inverse-soft); margin: 0; font-size: .98rem; }
.ds-why__nav { display: none; }

/* Slider mode (JS adds .is-ready) */
.ds-why.is-ready .ds-why__inner {
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.25fr);
  grid-template-areas: "head stage" "nav stage";
  grid-template-rows: auto 1fr;
  column-gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}
.ds-why.is-ready .ds-why__head { grid-area: head; }
.ds-why.is-ready .ds-why__stage { grid-area: stage; align-self: center; min-width: 0; }
.ds-why.is-ready .ds-why__nav { grid-area: nav; display: flex; flex-direction: column; align-self: end; }
.ds-why.is-ready .ds-why__viewport { overflow: hidden; touch-action: pan-y; }
.ds-why.is-ready .ds-why__track {
  display: flex; gap: 0;
  transition: transform .75s cubic-bezier(.65, 0, .35, 1);
  will-change: transform;
}
.ds-why.is-ready .ds-why__point {
  flex: 0 0 100%; padding-right: 1rem;
  opacity: 0; transition: opacity .55s ease;
}
.ds-why.is-ready .ds-why__point.is-active { opacity: 1; }
.ds-why.is-ready .ds-why__num { font-size: clamp(3.4rem, 8vw, 6rem); margin-bottom: 1rem; }
.ds-why.is-ready .ds-why__point-title { font-size: clamp(1.55rem, 3.3vw, 2.5rem); line-height: 1.15; margin-bottom: .9rem; max-width: 17em; }
.ds-why.is-ready .ds-why__point-text { font-size: clamp(1rem, 1.35vw, 1.15rem); max-width: 34em; }
.ds-why.is-ready .ds-why__point.is-active .ds-why__point-title { animation: ds-why-rise .7s .18s cubic-bezier(.2, .7, .2, 1) both; }
.ds-why.is-ready .ds-why__point.is-active .ds-why__point-text { animation: ds-why-rise .7s .3s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes ds-why-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Numbered, clickable progress */
.ds-why__dot {
  appearance: none; -webkit-appearance: none; background: none; border: 0; margin: 0; cursor: pointer;
  font: inherit; color: var(--ink-inverse-soft); text-align: left;
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .9rem; align-items: center;
  min-height: 44px; padding: .55rem 0 0;
  transition: color .2s ease;
}
.ds-why__dot:hover, .ds-why__dot.is-active { color: #fff; }
.ds-why__dot:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.ds-why__dot-num { font-size: .78rem; font-weight: 800; letter-spacing: .12em; }
.ds-why__dot.is-active .ds-why__dot-num { color: #FF8E6B; }
.ds-why__dot-label { font-size: .95rem; font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-why__bar {
  grid-column: 1 / -1; display: block; height: 2px; margin-top: .6rem;
  background: rgba(255, 255, 255, .16); border-radius: 2px; overflow: hidden;
}
.ds-why__bar i {
  display: block; height: 100%; width: 100%; background: var(--accent);
  transform: scaleX(0); transform-origin: left center;
}
.ds-why__dot.is-active .ds-why__bar i { transform: scaleX(1); }
.ds-why.is-playing .ds-why__dot.is-active .ds-why__bar i { animation: ds-why-fill var(--ds-why-interval) linear forwards; }
.ds-why.is-playing.is-paused .ds-why__dot.is-active .ds-why__bar i { animation-play-state: paused; }
@keyframes ds-why-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-width: 1024px) {
  .ds-why.is-ready .ds-why__inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "stage" "nav";
    grid-template-rows: auto;
  }
  .ds-why.is-ready .ds-why__nav { flex-direction: row; gap: .6rem; }
  .ds-why.is-ready .ds-why__dot { flex: 1 1 0; min-width: 0; grid-template-columns: minmax(0, 1fr); }
  .ds-why.is-ready .ds-why__dot-label { display: none; }
}
@media (max-width: 767px) {
  .ds-why--panel { border-radius: 18px; }
  .ds-why.is-ready .ds-why__num { margin-bottom: .7rem; }
  .ds-why.is-ready .ds-why__point { padding-right: .25rem; }
}
/* Reduced motion: always the static list */
@media (prefers-reduced-motion: reduce) {
  .ds-why.is-ready .ds-why__inner { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
  .ds-why.is-ready .ds-why__head, .ds-why.is-ready .ds-why__stage { grid-area: auto; }
  .ds-why.is-ready .ds-why__track { display: grid; transform: none !important; gap: 1.6rem 2rem; }
  .ds-why.is-ready .ds-why__point { opacity: 1; }
  .ds-why.is-ready .ds-why__nav { display: none; }
}

/* ---------- Cost boxes ---------- */
.ds-cost__grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.3rem;
}
@media (max-width: 1024px) { .ds-cost__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px)  { .ds-cost__grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; } }

.ds-cost__box {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.7rem 1.5rem 1.5rem;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.ds-cost__box::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent);
  transform: scaleX(0); transform-origin: left center; transition: transform .35s ease;
}
.ds-cost__box:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.ds-cost__box:hover::before { transform: scaleX(1); }
.ds-cost__icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 54px; height: 54px; border-radius: 999px; margin-bottom: 1.15rem;
  background: var(--accent-soft); color: var(--accent-deep); font-size: 1.3rem;
  transition: background .22s ease, color .22s ease;
}
.ds-cost__icon svg { width: 1.3rem; height: 1.3rem; fill: currentColor; }
.ds-cost__icon i { line-height: 1; }
.ds-cost__box:hover .ds-cost__icon { background: var(--accent); color: #fff; }
.ds-cost__title { font-size: var(--fs-h3); margin: 0 0 .55rem; }
.ds-cost__price { font-size: clamp(1.7rem, 2.5vw, 2.05rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; color: var(--ink); }
.ds-cost__price small { font-size: .9rem; font-weight: 600; letter-spacing: 0; color: var(--ink-soft); }
.ds-cost__price small:first-child {
  display: block; font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: .2rem;
}
.ds-cost__note {
  margin: auto 0 0; padding-top: .85rem; font-size: .9rem; color: var(--ink-soft);
  border-top: 1px dashed var(--line);
}
.ds-cost__price + .ds-cost__note { margin-top: 1rem; }
.ds-cost__note b { color: var(--ink); }

.ds-cost__cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.6rem;
  margin-top: 1.8rem; padding: 1.25rem 1.5rem; border-radius: var(--radius-lg);
  background: var(--ground-alt); border: 1px solid var(--line);
}
.section--alt .ds-cost__cta { background: #fff; }
.ds-cost__cta-note { margin: 0; font-weight: 600; color: var(--ink); max-width: 44em; }
.ds-cost__cta .btn { flex: none; min-height: 46px; }
.ds-cost__cta:not(:has(.ds-cost__cta-note)) { justify-content: center; background: none; border: 0; padding: 0; }
@media (max-width: 767px) {
  .ds-cost__box { padding: 1.4rem 1.25rem 1.25rem; }
  .ds-cost__cta { padding: 1.1rem; }
  .ds-cost__cta .btn { width: 100%; }
}
/* On dark sections */
.section--dark .ds-cost__box { background: var(--dark-2); border-color: var(--line-dark); }
.section--dark .ds-cost__title, .section--dark .ds-cost__price, .section--dark .ds-cost__note b { color: #fff; }
.section--dark .ds-cost__price small, .section--dark .ds-cost__note { color: var(--ink-inverse-soft); }
.section--dark .ds-cost__note { border-color: var(--line-dark); }
.section--dark .ds-cost__icon { background: rgba(244, 99, 58, .18); color: #FF8E6B; }
.section--dark .ds-cost__cta { background: var(--dark-2); border-color: var(--line-dark); }
.section--dark .ds-cost__cta-note { color: #fff; }

/* ---------- Posts grid ---------- */
.ds-posts__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.3rem; }
@media (max-width: 1024px) { .ds-posts__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px)  { .ds-posts__grid { grid-template-columns: minmax(0, 1fr); } }

.ds-post {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.ds-post:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.ds-post__media { aspect-ratio: 16 / 10; overflow: hidden; background: var(--dark); }
.ds-post__img { width: 100%; height: 100% !important; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.ds-post:hover .ds-post__img { transform: scale(1.05); }
.ds-post__body { display: flex; flex-direction: column; gap: .55rem; flex: 1; padding: 1.15rem 1.3rem 1.4rem; }
.ds-post__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; font-size: .8rem; color: var(--ink-soft); }
.ds-post__cat { font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-deep); }
.ds-post__title { font-size: var(--fs-h3); line-height: 1.3; margin: 0; }
.ds-post__link { color: var(--ink); text-decoration: none; }
.ds-post__link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius-lg); }
.ds-post:hover .ds-post__link { color: var(--accent-deep); }
.ds-post__link:focus-visible { outline: none; }
.ds-post__link:focus-visible::after { outline: 3px solid var(--accent); outline-offset: -3px; }
.ds-post__excerpt { font-size: .92rem; color: var(--ink-soft); margin: 0; }
.section--dark .ds-post { background: var(--dark-2); border-color: var(--line-dark); }
.section--dark .ds-post__link { color: #fff; }
.section--dark .ds-post__excerpt, .section--dark .ds-post__meta { color: var(--ink-inverse-soft); }
.section--dark .ds-post__cat { color: #FF8E6B; }

.ds-posts__more { margin-top: 2rem; }
.ds-posts__more--center { justify-content: center; }
.ds-posts__more .btn { min-height: 46px; }

.ds-posts__pager { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; margin-top: 2.4rem; }
.ds-posts__pager .page-numbers {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 .85rem;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink);
  font-weight: 700; font-size: .92rem; text-decoration: none; transition: border-color .15s, background .15s, color .15s;
}
.ds-posts__pager a.page-numbers:hover { border-color: var(--ink); color: var(--ink); }
.ds-posts__pager .page-numbers.current { background: var(--dark); border-color: var(--dark); color: #fff; }
.ds-posts__pager .page-numbers.dots { border: 0; background: none; min-width: 0; padding: 0 .2rem; }
.ds-posts__pager .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;
}
.ds-posts__empty { color: var(--ink-soft); margin: 0; }
.ds-posts__empty--editor {
  padding: 1.4rem 1.6rem; border: 2px dashed var(--line); border-radius: var(--radius-lg);
  background: var(--ground-alt); font-size: .92rem; text-align: center;
}
