/* Loople design 2.0 — demo layer.
 *
 * Everything here is scoped to html[data-design="2"]: the current design
 * keeps working untouched, and the switch is reversible.  One token set,
 * one accent, one recipe for cards/buttons/navigation.  Product colours
 * (news category chips, feed labels) stay where they help the eye.
 *
 * Loaded after every service stylesheet; it only overrides tokens and the
 * shared components, never the content or the "voice" of the house.
 */

html[data-design="2"] {
  color-scheme: light;

  /* Canonical tokens.  Both themes are modes of this same set. */
  --l2-bg: #edecEA;
  --l2-bg-soft: #e5e3e0;
  --l2-panel: #f7f6f4;
  --l2-panel-2: #e9e7e3;
  --l2-header: rgba(242, 241, 239, .82);
  --l2-text: #202024;
  --l2-muted: #6c6b72;
  --l2-line: #d9d7d2;
  --l2-chip: #e4e2de;
  --l2-accent: #4c5bd4;
  --l2-accent-strong: #3846b0;
  --l2-accent-soft: rgba(76, 91, 212, .12);
  --l2-on-accent: #ffffff;
  --l2-nav: rgba(247, 246, 244, .72);
  --l2-danger: #b42318;
  --l2-ok: #067647;
  --l2-radius: 16px;
  --l2-radius-sm: 12px;
  --l2-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  /* Alias the names the three services already share or expose. */
  --bg: var(--l2-bg);
  --bg-elevated: var(--l2-panel);
  --panel: var(--l2-panel);
  --panel-2: var(--l2-panel-2);
  --card: var(--l2-panel);
  --surface: var(--l2-bg-soft);
  --surface-muted: var(--l2-bg-soft);
  --surface-unread: var(--l2-accent-soft);
  --text: var(--l2-text);
  --ink: var(--l2-text);
  --muted: var(--l2-muted);
  --line: var(--l2-line);
  --border: var(--l2-line);
  --chip: var(--l2-chip);
  --accent: var(--l2-accent);
  --accent-strong: var(--l2-accent-strong);
  --accent-soft: var(--l2-accent-soft);
  --accent-ink: var(--l2-on-accent);
  --on-accent: var(--l2-on-accent);
  --header-bg: var(--l2-header);
  --bottom-nav-bg: var(--l2-nav);
  --danger: var(--l2-danger);
  --ok: var(--l2-ok);
  --shadow: none;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --radius: var(--l2-radius);
  --radius-sm: var(--l2-radius-sm);
  --radius-lg: var(--l2-radius);
  --font-sans: var(--l2-font);
  --font: 16px/1.55 var(--l2-font);

  --text-xs: 12px;
  --text-sm: 13.5px;
  --text-md: 15px;
  --text-base: 16px;
  --text-lg: 19px;
  --text-xl: 22px;
}

html[data-design="2"][data-theme="dark"] {
  color-scheme: dark;
  --l2-bg: #16161a;
  --l2-bg-soft: #121216;
  --l2-panel: #1d1d23;
  --l2-panel-2: #25252c;
  --l2-header: rgba(22, 22, 26, .82);
  --l2-text: #ecebe8;
  --l2-muted: #a3a1aa;
  --l2-line: #303039;
  --l2-chip: #292930;
  --l2-accent: #9aa6ff;
  --l2-accent-strong: #b8c0ff;
  --l2-accent-soft: rgba(154, 166, 255, .16);
  --l2-on-accent: #141522;
  --l2-nav: rgba(24, 24, 29, .74);
  --l2-danger: #ff8b82;
  --l2-ok: #7ee2ae;
}

/* Base surface ------------------------------------------------------------ */

html[data-design="2"] body {
  background: var(--l2-bg);
  color: var(--l2-text);
  font-family: var(--l2-font);
}

html[data-design="2"] a { color: var(--l2-accent); }
html[data-design="2"] a:hover { color: var(--l2-accent-strong); }

/* One card recipe: same border, radius and padding.  No mixed shadows. */
html[data-design="2"] .card,
html[data-design="2"] .panel,
html[data-design="2"] .post,
html[data-design="2"] .note-card,
html[data-design="2"] .settings-panel {
  border: 1px solid var(--l2-line);
  border-radius: var(--l2-radius);
  background: var(--l2-panel);
  box-shadow: none;
}

html[data-design="2"] .card,
html[data-design="2"] .panel,
html[data-design="2"] .note-card,
html[data-design="2"] .settings-panel {
  padding: 18px;
}

/* One button recipe: same height, radius, focus and states. */
html[data-design="2"] .btn,
html[data-design="2"] .button,
html[data-design="2"] .button-primary,
html[data-design="2"] .button-ghost,
html[data-design="2"] .button-danger,
html[data-design="2"] .action,
html[data-design="2"] button.button {
  min-height: 40px;
  border-radius: var(--l2-radius-sm);
  box-shadow: none;
  font-weight: 600;
}

html[data-design="2"] .btn:not(.ghost):not(.danger),
html[data-design="2"] .button-primary,
html[data-design="2"] .action:not(.secondary):not(.done) {
  border-color: transparent;
  background: var(--l2-accent);
  color: var(--l2-on-accent);
}

html[data-design="2"] .btn.ghost,
html[data-design="2"] .button,
html[data-design="2"] .button-ghost,
html[data-design="2"] .action.secondary {
  border: 1px solid var(--l2-line);
  background: transparent;
  color: var(--l2-text);
}

html[data-design="2"] .btn:hover,
html[data-design="2"] .button:hover,
html[data-design="2"] .button-primary:hover,
html[data-design="2"] .button-ghost:hover,
html[data-design="2"] .action:hover {
  filter: none;
  background-image: linear-gradient(
    color-mix(in srgb, var(--l2-text) 6%, transparent),
    color-mix(in srgb, var(--l2-text) 6%, transparent)
  );
}

html[data-design="2"] .btn:active,
html[data-design="2"] .button:active,
html[data-design="2"] .button-primary:active,
html[data-design="2"] .button-ghost:active,
html[data-design="2"] .action:active {
  filter: none;
  background-image: linear-gradient(
    color-mix(in srgb, var(--l2-text) 11%, transparent),
    color-mix(in srgb, var(--l2-text) 11%, transparent)
  );
}

html[data-design="2"] .btn:disabled,
html[data-design="2"] .button:disabled,
html[data-design="2"] button:disabled {
  opacity: .5;
  filter: none;
}

/* Inputs share the card border and radius. */
html[data-design="2"] input[type="text"],
html[data-design="2"] input[type="search"],
html[data-design="2"] input[type="url"],
html[data-design="2"] input[type="email"],
html[data-design="2"] input[type="password"],
html[data-design="2"] input[type="tel"],
html[data-design="2"] input[type="number"],
html[data-design="2"] input[type="date"],
html[data-design="2"] input[type="time"],
html[data-design="2"] input[type="datetime-local"],
html[data-design="2"] textarea,
html[data-design="2"] select {
  border: 1px solid var(--l2-line);
  border-radius: var(--l2-radius-sm);
  background-color: var(--l2-panel);
  color: var(--l2-text);
  box-shadow: none;
}

/* Navigation: one geometry for the bottom bar in every service. */
html[data-design="2"] .bottom-nav {
  padding: 8px 8px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--l2-line);
  background: var(--l2-nav);
  box-shadow: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

html[data-design="2"] .bottom-nav-link {
  border-radius: var(--l2-radius-sm);
  color: var(--l2-muted);
  font-size: 11px;
  font-weight: 600;
}

html[data-design="2"] .bottom-nav-link.is-active,
html[data-design="2"] .bottom-nav-link[aria-current="page"] {
  color: var(--l2-accent);
  background: var(--l2-accent-soft);
}

/* Reader mode "Аа Текст" is shared by news, notes and the social feed. */
html.text-mode img,
html.text-mode picture,
html.text-mode video,
html.text-mode .card-image-link,
html.text-mode .article-figure,
html.text-mode .skeleton-image {
  display: none !important;
}

html.text-mode .card,
html.text-mode .article {
  background: var(--panel);
}

html[data-design="2"].text-mode body {
  max-width: 72ch;
  margin-inline: auto;
}

/* Demo-only controls: visible in both designs so the switch is easy to find.
   They are not part of the design language and never ship without the demo. */
#l2-demo-tools {
  position: fixed;
  top: calc(var(--loople-header-height, 54px) + 10px);
  right: 12px;
  z-index: 90;
  display: flex;
  gap: 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#l2-demo-tools button {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid rgba(120, 120, 130, .35);
  border-radius: 999px;
  background: rgba(250, 249, 247, .9);
  color: #24242a;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(20, 20, 30, .12);
  backdrop-filter: blur(8px);
}

#l2-demo-tools button[aria-pressed="true"] {
  border-color: transparent;
  background: #4c5bd4;
  color: #fff;
}

html[data-theme="dark"] #l2-demo-tools button {
  border-color: rgba(180, 180, 200, .3);
  background: rgba(30, 30, 37, .9);
  color: #ecebe8;
}

html[data-theme="dark"] #l2-demo-tools button[aria-pressed="true"] {
  background: #9aa6ff;
  color: #141522;
}

@media (max-width: 720px) {
  #l2-demo-tools { top: calc(var(--loople-header-height, 54px) + 6px); right: 8px; }
  #l2-demo-tools button { min-height: 28px; padding: 4px 9px; font-size: 11px; }
  #l2-demo-tools [data-design-toggle] {
    width: 36px;
    padding: 4px 0;
    overflow: hidden;
    font-size: 0;
  }
  #l2-demo-tools [data-design-toggle]::after {
    content: "2.0";
    font-size: 11px;
  }
  #l2-demo-tools [data-design-toggle][aria-pressed="true"]::after {
    content: "1.0";
  }
}
