/*
 * Section type: Sekmeli Cihaz Seçici (Tabbed Device Selector).
 * Reuses shared classes from main.css (.sembo-container, .sembo-kicker,
 * .sembo-section-heading, .sembo-text-link) — only section-specific classes
 * are defined here, all scoped under .sembo-tabs-sel-*.
 *
 * The tab interaction is pure CSS: three visually-hidden (but focusable) radio
 * inputs are toggled by labels styled as tab buttons, and the general sibling
 * combinator (~) shows the matching panel based on which radio is :checked.
 *
 * Because this section type can be placed more than once on a page, every
 * instance gets its own dynamic id/name attributes (see inc/sections/tabs-selector.php),
 * so these selectors CANNOT target fixed ids like the old #hp8-tab-1. Instead,
 * the Nth radio input (counted structurally via :nth-of-type, independent of
 * its id/name) is paired with the Nth panel (also counted via :nth-of-type)
 * inside the panels wrapper — see the "Panel pairing" block below. This works
 * for any instance id and for any number of instances on the same page.
 *
 * No JavaScript anywhere in this section.
 */

/* ---------- Section shell ---------- */

.sembo-tabs-sel {
  padding: var(--sembo-section-padding, 96px) 0;
  background: var(--sembo-soft);
}

.sembo-tabs-sel-tabset {
  position: relative;
  max-width: 1040px;
  margin: 0 auto;
}

/* Radio inputs stay in the document flow (for the ~ sibling combinator to
 * reach the panels) but are visually hidden while remaining keyboard
 * focusable and operable — never display:none. */
.sembo-tabs-sel-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

/* ---------- Tab labels (buttons) ---------- */

.sembo-tabs-sel-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}

.sembo-tabs-sel-label {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 200px;
  padding: 16px 20px;
  color: var(--sembo-copy);
  background: var(--sembo-surface);
  border: 1px solid var(--sembo-line);
  border-radius: var(--sembo-card-radius);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.sembo-tabs-sel-label:hover {
  border-color: var(--sembo-pd-55);
}

.sembo-tabs-sel-label__index {
  font-size: 13px;
  font-weight: 800;
  color: var(--sembo-primary-light);
}

.sembo-tabs-sel-label__text {
  font-size: 15px;
  font-weight: 700;
  color: var(--sembo-ink);
}

/* Focus-visible state for keyboard users tabbing to the hidden radio input.
 * Adjacent-sibling combinator: structurally sound regardless of id/name. */
.sembo-tabs-sel-input:focus-visible + .sembo-tabs-sel-label {
  outline: 3px solid var(--sembo-pl-40);
  outline-offset: 2px;
}

/* Checked (active) tab state — also a plain adjacent-sibling pairing, no id needed. */
.sembo-tabs-sel-input:checked + .sembo-tabs-sel-label {
  color: #fff;
  background: var(--sembo-gradient);
  border-color: transparent;
  box-shadow: 0 10px 24px var(--sembo-pd-20);
}

.sembo-tabs-sel-input:checked + .sembo-tabs-sel-label .sembo-tabs-sel-label__index,
.sembo-tabs-sel-input:checked + .sembo-tabs-sel-label .sembo-tabs-sel-label__text {
  color: #fff;
}

/* ---------- Panel pairing (the trickiest part) ----------
 * Panels are hidden by default. To reveal the panel that matches the checked
 * radio WITHOUT relying on ids (which are now dynamic per instance), we pair
 * "the Nth radio input, counted structurally" with "the Nth panel, counted
 * structurally" using :nth-of-type on both sides of the same selector chain:
 *
 *   .sembo-tabs-sel-input:nth-of-type(N):checked
 *     ~ .sembo-tabs-sel-panels .sembo-tabs-sel-panel:nth-of-type(N)
 *
 * - `:nth-of-type(N)` on the input counts only <input> siblings among the
 *   tabset's direct children, in source order — so input #1/#2/#3 map to
 *   N=1/2/3 no matter what id or name they carry.
 * - The general sibling combinator (~) reaches from that input past the
 *   labels block into the panels wrapper.
 * - `:nth-of-type(N)` on the panel counts only sibling <div class="sembo-
 *   tabs-sel-panel"> elements inside the panels wrapper (they are the only
 *   children there, all <div>s), so panel #1/#2/#3 also map to N=1/2/3 by
 *   pure source order — again with no id dependency.
 * - Because N is matched on BOTH sides of the same rule, input N being
 *   checked can only ever reveal panel N. This is fully instance-agnostic:
 *   the same three rules work correctly for any section id, and for multiple
 *   instances of this section type on one page, since each instance's own
 *   input/panel pair only ever affects descendants within its own
 *   .sembo-tabs-sel-tabset.
 */
.sembo-tabs-sel-panel {
  display: none;
}

.sembo-tabs-sel-input:nth-of-type(1):checked ~ .sembo-tabs-sel-panels .sembo-tabs-sel-panel:nth-of-type(1),
.sembo-tabs-sel-input:nth-of-type(2):checked ~ .sembo-tabs-sel-panels .sembo-tabs-sel-panel:nth-of-type(2),
.sembo-tabs-sel-input:nth-of-type(3):checked ~ .sembo-tabs-sel-panels .sembo-tabs-sel-panel:nth-of-type(3) {
  display: grid;
}

.sembo-tabs-sel-panel {
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 36px;
  align-items: center;
  padding: 36px;
  background: var(--sembo-surface);
  border: 1px solid var(--sembo-line);
  border-radius: var(--sembo-card-radius);
  box-shadow: var(--sembo-shadow);
}

.sembo-tabs-sel-panel__image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--sembo-card-radius);
}

.sembo-tabs-sel-panel__tag {
  display: inline-block;
  padding: 4px 10px;
  color: var(--sembo-text-teal);
  background: var(--sembo-soft-strong);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
}

.sembo-tabs-sel-panel__title {
  margin: 12px 0 10px;
  font-size: 22px;
  font-weight: var(--sembo-heading-weight, 800);
  color: var(--sembo-ink);
}

.sembo-tabs-sel-panel__text {
  margin: 0 0 18px;
  color: var(--sembo-copy);
  font-size: 15px;
  line-height: 1.75;
}

.sembo-tabs-sel-panel__points {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.sembo-tabs-sel-panel__point {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--sembo-ink);
  font-size: 14px;
  font-weight: 600;
}

.sembo-tabs-sel-panel__check {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: #fff;
  background: var(--sembo-gradient);
  border-radius: 50%;
  font-size: 11px;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .sembo-tabs-sel-panel {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
    padding: 28px;
  }
}

@media (max-width: 680px) {
  .sembo-tabs-sel-labels {
    flex-direction: column;
  }

  .sembo-tabs-sel-label {
    flex-basis: auto;
  }

  .sembo-tabs-sel-panel {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .sembo-tabs-sel-panel__image {
    max-width: 220px;
    margin: 0 auto;
  }
}
