/* Innet — header chrome & fold markers (§4d)
   Restrained brand tools: tight SVGs, theme/mood/CB reactive, no spill. */

/* ——— Display cluster (lang + tools, one pill) ——— */

.header-tools__display {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.08rem;
  padding: 0.12rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border-subtle) 40%, transparent);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  overflow: visible; /* lang menu escapes */
  max-width: 100%;
}

.header-tools__display--art {
  /* isolate paint of chips; menu still escapes via absolute */
  isolation: isolate;
}

.header-tools__lang {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
}

.header-tools__lang .lang-dropdown {
  position: relative;
}

/* Shared chip geometry — clipped, no internal padding spill */
.header-tools__display--art .lang-dropdown__toggle,
.header-tools__display--art .vision-large-btn,
.header-tools__display--art .vision-cb-btn,
.header-tools__display--art .theme-cycle-btn,
.header-tools__display--art .mood-switch,
.header-tools__display .lang-dropdown__toggle,
.header-tools__display .vision-large-btn,
.header-tools__display .vision-cb-btn,
.header-tools__display .theme-cycle-btn,
.header-tools__display .mood-switch {
  position: relative;
  z-index: 0;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.1rem;
  height: 2.1rem;
  min-width: 2.1rem;
  min-height: 2.1rem;
  max-width: 2.1rem;
  max-height: 2.1rem;
  padding: 0 !important; /* beat harmony asymmetric padding (CB drift) */
  margin: 0;
  border: none;
  border-radius: 999px;
  box-shadow: none;
  overflow: hidden;
  color: var(--text-muted);
  background: transparent;
  opacity: 0.88;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.header-tools__display .lang-dropdown__toggle {
  width: 2.1rem;
  max-width: 2.1rem;
  min-width: 2.1rem;
  height: 2.1rem;
  min-height: 2.1rem;
  max-height: 2.1rem;
  padding: 0 !important;
  gap: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
}

.header-tools__display .lang-dropdown__chevron {
  display: none !important;
}

.header-tools__display .lang-dropdown__current {
  display: block;
  width: 100%;
  text-align: center;
  line-height: 1;
}

.header-tools__display .lang-dropdown__toggle:hover,
.header-tools__display .vision-large-btn:hover,
.header-tools__display .vision-cb-btn:hover,
.header-tools__display .theme-cycle-btn:hover,
.header-tools__display .mood-switch:hover {
  color: var(--text);
  opacity: 1;
  background: color-mix(in srgb, var(--surface-muted) 55%, transparent);
}

.header-tools__display .lang-dropdown__toggle:focus-visible,
.header-tools__display .vision-large-btn:focus-visible,
.header-tools__display .vision-cb-btn:focus-visible,
.header-tools__display .theme-cycle-btn:focus-visible,
.header-tools__display .mood-switch:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 1px;
}

.header-tools__display .vision-large-btn[aria-pressed="true"],
.header-tools__display .vision-large-btn--on,
.header-tools__display .vision-cb-btn[aria-pressed="true"],
.header-tools__display .vision-cb-btn--on {
  color: var(--text);
  opacity: 1;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border-subtle) 55%, transparent);
}

.lang-dropdown__chevron {
  width: 0.7rem;
  height: 0.7rem;
  flex-shrink: 0;
  color: currentColor;
  transition: transform 0.2s ease;
  transform-origin: 50% 45%;
}

.lang-dropdown__toggle[aria-expanded="true"] .lang-dropdown__chevron {
  transform: rotate(180deg);
}

.lang-dropdown__menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 140;
  min-width: 10rem;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--border-subtle) 35%, transparent),
    0 10px 28px color-mix(in srgb, var(--text) 12%, transparent);
}

.lang-dropdown__menu[hidden] {
  display: none !important;
}

.lang-dropdown__option {
  display: block;
  width: 100%;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  padding: 0.55rem 0.7rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: start;
  cursor: pointer;
  transition: background 0.12s ease;
}

.lang-dropdown__option:hover {
  background: var(--surface-muted);
}

.lang-dropdown__option.is-active {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-muted));
  font-weight: 600;
}

/* ——— Aa+ — restrained brand tints ——— */

.vision-large-btn__art {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0;
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  font-family: var(--font-display, "SF Pro Display", "Segoe UI", sans-serif);
  font-weight: 700;
  letter-spacing: -0.05em;
  user-select: none;
}

.aa-mark {
  line-height: 1;
}

.aa-mark--a {
  font-size: 0.92rem;
  color: color-mix(in srgb, var(--accent) 72%, var(--text-muted));
}

.aa-mark--a2 {
  font-size: 0.78rem;
  font-weight: 650;
  color: color-mix(in srgb, var(--success, var(--status-ok, #8fb896)) 70%, var(--text-muted));
}

.aa-mark--plus {
  font-size: 0.72rem;
  font-weight: 700;
  margin-inline-start: 0.01em;
  color: color-mix(in srgb, var(--accent-pop, #5b8fb9) 65%, var(--text-muted));
}

/* Live tokens → every mood/theme; CB overrides accents globally */
[data-theme="dark"] .aa-mark--a,
[data-theme="dim"] .aa-mark--a {
  color: color-mix(in srgb, var(--accent) 78%, #f0e8e0);
}

[data-theme="dark"] .aa-mark--a2,
[data-theme="dim"] .aa-mark--a2 {
  color: color-mix(in srgb, var(--success, var(--status-ok, #8fb896)) 80%, #e8f8ec);
}

[data-theme="dark"] .aa-mark--plus,
[data-theme="dim"] .aa-mark--plus {
  color: color-mix(in srgb, var(--accent-pop) 78%, #f0e8d0);
}

.vision-large-btn__label {
  display: none;
}

/* ——— CB — centered Venn; brand tokens off / Okabe on; readable on dark ——— */

.header-tools__display--art .vision-cb-btn__icon,
.vision-cb-btn__icon {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
  margin: 0 auto;
  overflow: visible;
}

.vision-cb-btn__icon .cb-disc {
  opacity: 0.72;
  transition: fill 0.25s ease, opacity 0.25s ease;
}

.vision-cb-btn__icon .cb-disc--b {
  fill: color-mix(in srgb, var(--accent-pop) 55%, #7aa8c8);
}

.vision-cb-btn__icon .cb-disc--o {
  fill: color-mix(in srgb, var(--accent) 50%, #e0b878);
}

.vision-cb-btn__icon .cb-disc--g {
  fill: color-mix(in srgb, var(--success, var(--status-ok, #8fb896)) 80%, #90c0a0);
}

[data-theme="dark"] .vision-cb-btn__icon .cb-disc--b,
[data-theme="dim"] .vision-cb-btn__icon .cb-disc--b {
  fill: color-mix(in srgb, var(--accent-pop) 65%, #6a98b8);
}

[data-theme="dark"] .vision-cb-btn__icon .cb-disc--o,
[data-theme="dim"] .vision-cb-btn__icon .cb-disc--o {
  fill: color-mix(in srgb, var(--accent) 55%, #d0a060);
}

[data-theme="dark"] .vision-cb-btn__icon .cb-disc--g,
[data-theme="dim"] .vision-cb-btn__icon .cb-disc--g {
  fill: color-mix(in srgb, var(--success, #8fb896) 70%, #60a878);
}

/* ——— Mood — palette well; swatches = live CSS tokens ——— */

.header-tools__display .mood-switch::after {
  display: none !important;
}

.mood-switch__art {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
  margin: 0 auto;
  overflow: hidden;
}

.mood-switch__art .mood-well {
  fill: color-mix(in srgb, var(--surface) 55%, var(--border-subtle));
  stroke: color-mix(in srgb, var(--text-muted) 45%, var(--border));
  stroke-width: 0.9;
  transition: fill 0.3s ease, stroke 0.3s ease;
}

.mood-switch__art .mood-swatch {
  transition: fill 0.3s ease;
  stroke: color-mix(in srgb, var(--surface) 40%, transparent);
  stroke-width: 0.35;
}

.mood-switch__art .mood-swatch--a {
  fill: var(--accent);
}

.mood-switch__art .mood-swatch--b {
  fill: var(--accent-pop);
}

.mood-switch__art .mood-swatch--c {
  fill: var(--success, var(--status-ok, #8fb896));
}

/* Light plum accent is near-black — keep swatches distinct */
[data-theme="light"][data-mood="plum"] .mood-switch__art .mood-swatch--a {
  fill: var(--accent-muted, #6d4a5a);
}

[data-theme="light"][data-mood="plum"] .mood-switch__art .mood-swatch--c {
  fill: color-mix(in srgb, var(--success) 70%, #6a8a70);
}

/* ——— Theme — one icon at a time (sun → half → moon) ——— */

.header-tools__display--art .theme-cycle-btn__icon,
.header-tools__display .theme-cycle-btn__icon,
.theme-cycle-btn__icon {
  width: 1.35rem !important;
  height: 1.35rem !important;
  display: none !important;
  margin: 0 auto;
  overflow: visible;
  flex-shrink: 0;
}

/* Sole switch: data-theme-mode on the button (HTML hidden removed — it hid dim/moon) */
.header-tools__display .theme-cycle-btn[data-theme-mode="light"] .icon-sun,
.theme-cycle-btn[data-theme-mode="light"] .icon-sun {
  display: block !important;
}

.header-tools__display .theme-cycle-btn[data-theme-mode="dim"] .icon-dim,
.theme-cycle-btn[data-theme-mode="dim"] .icon-dim {
  display: block !important;
}

.header-tools__display .theme-cycle-btn[data-theme-mode="dark"] .icon-moon,
.theme-cycle-btn[data-theme-mode="dark"] .icon-moon {
  display: block !important;
}

.theme-cycle-btn .sun-core {
  fill: var(--accent-pop);
  stroke: color-mix(in srgb, var(--accent) 35%, var(--accent-pop));
  stroke-width: 0.7;
}

.theme-cycle-btn .sun-rays {
  stroke: var(--accent-pop);
  stroke-width: 1.55;
  opacity: 0.95;
}

.theme-cycle-btn .dim-ring {
  stroke: color-mix(in srgb, var(--text) 55%, var(--text-muted));
  stroke-width: 1.55;
}

.theme-cycle-btn .dim-fill {
  fill: var(--accent-pop);
  opacity: 0.85;
}

.theme-cycle-btn .moon-body {
  fill: #7a8eb0;
  stroke: #3a4a68;
  stroke-width: 0.75;
}

[data-theme="dark"] .theme-cycle-btn .moon-body,
[data-theme="dim"] .theme-cycle-btn .moon-body {
  fill: #e8eef8;
  stroke: #a8b8d8;
}

[data-theme="dark"] .theme-cycle-btn .dim-fill,
[data-theme="dim"] .theme-cycle-btn .dim-fill {
  fill: var(--accent-pop);
  opacity: 0.95;
}

[data-theme="dark"] .theme-cycle-btn .dim-ring,
[data-theme="dim"] .theme-cycle-btn .dim-ring {
  stroke: color-mix(in srgb, var(--text) 80%, var(--accent-muted));
}

/* ——— CB tool glyphs: Okabe roles only (tokens from vision-cb.css) ——— */

html[data-vision~="cb"] .header-tools__display .lang-dropdown__toggle {
  color: var(--accent);
  font-weight: 700;
}

html[data-vision~="cb"] .aa-mark--a {
  color: var(--accent) !important;
}

html[data-vision~="cb"] .aa-mark--a2 {
  color: var(--success) !important;
}

html[data-vision~="cb"] .aa-mark--plus {
  color: var(--accent-pop) !important;
}

html[data-vision~="cb"] .vision-cb-btn__icon .cb-disc {
  opacity: 1;
}

html[data-vision~="cb"] .vision-cb-btn__icon .cb-disc--b {
  fill: var(--oi-sky, #56b4e9) !important;
}

html[data-vision~="cb"] .vision-cb-btn__icon .cb-disc--o {
  fill: var(--oi-orange, #e69f00) !important;
}

html[data-vision~="cb"] .vision-cb-btn__icon .cb-disc--g {
  fill: var(--oi-green, #009e73) !important;
}

html[data-vision~="cb"] .mood-switch__art .mood-well {
  fill: color-mix(in srgb, var(--accent) 16%, var(--surface));
  stroke: var(--accent);
  stroke-width: 1;
}

html[data-vision~="cb"] .mood-switch__art .mood-swatch--a {
  fill: var(--accent) !important;
}

html[data-vision~="cb"] .mood-switch__art .mood-swatch--b {
  fill: var(--accent-pop) !important;
}

html[data-vision~="cb"] .mood-switch__art .mood-swatch--c {
  fill: var(--success) !important;
}

/* Theme icons under CB: yellow sun, blue half, purple moon — distinct shapes + hues */
html[data-vision~="cb"] .theme-cycle-btn .sun-core {
  fill: var(--oi-yellow, #f0e442) !important;
  stroke: var(--oi-orange, #e69f00) !important;
}

html[data-vision~="cb"] .theme-cycle-btn .sun-rays {
  stroke: var(--oi-orange, #e69f00) !important;
  opacity: 1;
}

html[data-vision~="cb"] .theme-cycle-btn .dim-ring {
  stroke: var(--oi-sky, #56b4e9) !important;
  stroke-width: 1.8;
}

html[data-vision~="cb"] .theme-cycle-btn .dim-fill {
  fill: var(--oi-blue, #0072b2) !important;
  opacity: 1;
}

html[data-vision~="cb"][data-theme="dark"] .theme-cycle-btn .dim-fill,
html[data-vision~="cb"][data-theme="dim"] .theme-cycle-btn .dim-fill {
  fill: var(--oi-sky, #56b4e9) !important;
}

html[data-vision~="cb"] .theme-cycle-btn .moon-body {
  fill: var(--oi-purple, #cc79a7) !important;
  stroke: var(--oi-sky, #56b4e9) !important;
  stroke-width: 0.9;
}

/* ——— Shared fold chevron (Архив, about) ——— */

.link-archive > summary,
.about-fold__summary,
.about-how-details__summary,
.donate-compare-details > summary {
  list-style: none;
}

.about-fold__summary {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
}

.about-how-details__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
}

.link-archive > summary::-webkit-details-marker,
.about-fold__summary::-webkit-details-marker,
.about-how-details__summary::-webkit-details-marker,
.donate-compare-details > summary::-webkit-details-marker {
  display: none;
}

.link-archive > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: color 0.15s ease;
}

.link-archive > summary:hover {
  color: var(--text);
}

.link-archive > summary::before,
.about-fold__summary::before,
.about-how-details__summary::before,
.donate-compare-details > summary::before {
  content: "";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
  background-color: currentColor;
  color: var(--text-muted);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M3.2 5.75a.75.75 0 0 1 1.05-.05L8 9.2l3.75-3.5a.75.75 0 1 1 1 1.1l-4.25 4a.75.75 0 0 1-1 0l-4.25-4a.75.75 0 0 1-.05-1.05z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M3.2 5.75a.75.75 0 0 1 1.05-.05L8 9.2l3.75-3.5a.75.75 0 1 1 1 1.1l-4.25 4a.75.75 0 0 1-1 0l-4.25-4a.75.75 0 0 1-.05-1.05z'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  transition: transform 0.2s ease, color 0.15s ease;
  transform: rotate(0deg);
  transform-origin: 50% 45%;
}

.link-archive[open] > summary::before,
.about-fold[open] > .about-fold__summary::before,
.about-how-details[open] > .about-how-details__summary::before,
.donate-compare-details[open] > summary::before {
  transform: rotate(180deg);
  color: var(--text);
}

@media (max-width: 520px) {
  .header-tools__display {
    gap: 0.1rem;
    padding: 0.14rem;
  }

  .header-tools__display .lang-dropdown__toggle,
  .header-tools__display .vision-large-btn,
  .header-tools__display .vision-cb-btn,
  .header-tools__display .theme-cycle-btn,
  .header-tools__display .mood-switch {
    width: 2.55rem;
    height: 2.55rem;
    min-width: 2.55rem;
    min-height: 2.55rem;
    max-width: 2.55rem;
    max-height: 2.55rem;
  }

  .header-tools__display .lang-dropdown__toggle {
    width: auto;
    max-width: none;
    min-width: 2.65rem;
    height: 2.55rem;
    min-height: 2.55rem;
    max-height: 2.55rem;
    padding: 0 0.4rem 0 0.5rem !important;
    font-size: 0.72rem;
  }

  .aa-mark--a {
    font-size: 1.12rem;
  }

  .aa-mark--a2 {
    font-size: 0.95rem;
  }

  .aa-mark--plus {
    font-size: 0.9rem;
  }

  .vision-cb-btn__icon,
  .mood-switch__art,
  .header-tools__display--art .theme-cycle-btn__icon,
  .header-tools__display .theme-cycle-btn__icon,
  .theme-cycle-btn__icon {
    width: 1.85rem !important;
    height: 1.85rem !important;
  }
}
