/*
 * ОтветИУм visual refresh.
 *
 * This file is intentionally imported last and every rule is scoped to the
 * data attribute below. Set OTVETIUM_DESIGN_REFRESH=0 and restart the web app
 * to return to the previous interface without deleting any code.
 */

html[data-design-refresh="on"] {
  --ui-action-orange: #ff641f;
  --ui-action-orange-hover: #f45118;
  --ui-action-orange-start: #ff9f24;
  --ui-action-orange-end: #ff5b24;
  --ui-action-gradient: linear-gradient(115deg, var(--ui-action-orange-start) 0%, #ff7b1f 46%, var(--ui-action-orange-end) 100%);
  --ui-action-gradient-hover: linear-gradient(115deg, #ff961e 0%, #ff6f1c 46%, #f84d1b 100%);
  --ui-radius-card: 28px;
  --ui-radius-section: 38px;
  --ui-shadow-soft: 0 18px 55px rgba(23, 34, 59, 0.08);
  --ui-shadow-float: 0 24px 70px rgba(23, 34, 59, 0.12);
  --ui-ease: cubic-bezier(0.22, 0.8, 0.3, 1);
}

html[data-design-refresh="on"] body {
  background:
    radial-gradient(circle at 8% 8%, color-mix(in srgb, var(--blue-soft) 66%, transparent), transparent 28rem),
    radial-gradient(circle at 94% 14%, color-mix(in srgb, var(--orange-soft) 54%, transparent), transparent 24rem),
    var(--paper);
}

/* Shared navigation: a calm glass surface with deterministic sizing. */
html[data-design-refresh="on"] .app-header-shell {
  border-bottom-color: color-mix(in srgb, var(--line-strong) 72%, transparent);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.14);
  backdrop-filter: blur(18px) saturate(1.14);
  box-shadow: 0 8px 28px rgba(23, 34, 59, 0.055);
}

/* The late-loaded refresh must not restore expensive scroll-time backdrop blur. */
html[data-design-refresh="on"][data-perf="lite"] .app-header-shell {
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

html[data-design-refresh="on"] .app-header nav a,
html[data-design-refresh="on"] .theme-toggle,
html[data-design-refresh="on"] .app-header-support {
  transition:
    color 200ms ease,
    background-color 200ms ease,
    border-color 200ms ease,
    box-shadow 200ms ease,
    transform 200ms var(--ui-ease);
}

html[data-design-refresh="on"] .app-header nav .app-nav-primary,
html[data-design-refresh="on"] .app-header nav a.app-nav-primary.active,
html[data-design-refresh="on"] .primary-button,
html[data-design-refresh="on"] .services-intro > a {
  color: #fff;
  background: var(--ui-action-gradient);
}

html[data-design-refresh="on"] .app-header nav .app-nav-primary:hover,
html[data-design-refresh="on"] .primary-button:hover,
html[data-design-refresh="on"] .services-intro > a:hover {
  color: #fff;
  background: var(--ui-action-gradient-hover);
}

html[data-design-refresh="on"] :is(.app-nav-primary, .primary-button, .services-intro > a, .service-card.orange .service-order-button) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

html[data-design-refresh="on"] :is(.app-nav-primary, .primary-button, .services-intro > a, .service-card.orange .service-order-button)::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 76px;
  height: 76px;
  right: 26%;
  top: -58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 42px 52px 0 -28px rgba(255, 255, 255, 0.16);
  transition: transform 300ms var(--ui-ease);
  pointer-events: none;
}

/* Homepage hero: keep the brand, add depth and a stronger visual boundary. */
html[data-design-refresh="on"] .hero {
  margin-top: 24px;
  padding: clamp(42px, 5vw, 64px);
  overflow: clip;
  --compat-mix-60e1e244ac: color-mix(in srgb, var(--line-strong) 78%, transparent);
  border: 1px solid var(--compat-mix-60e1e244ac);
  border-radius: var(--ui-radius-section);
  background:
    radial-gradient(circle at 86% 18%, color-mix(in srgb, var(--blue-soft) 90%, transparent), transparent 33%),
    radial-gradient(circle at 73% 88%, color-mix(in srgb, var(--orange-soft) 72%, transparent), transparent 31%),
    color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--ui-shadow-soft);
}

html[data-design-refresh="on"] .hero::before {
  z-index: 0;
  inset: 0;
  width: auto;
  height: auto;
  border-radius: inherit;
  background-image:
    linear-gradient(color-mix(in srgb, var(--blue) 5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--blue) 5%, transparent) 1px, transparent 1px);
  background-size: 42px 42px;
  -webkit-mask-image: linear-gradient(90deg, transparent 32%, #000 76%, transparent);
  mask-image: linear-gradient(90deg, transparent 32%, #000 76%, transparent);
}

html[data-design-refresh="on"] .hero::after {
  content: "";
  position: absolute;
  z-index: 0;
  right: 46%;
  top: 9%;
  width: 66px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 17px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.42)),
    var(--ui-action-gradient);
  box-shadow: 0 14px 28px rgba(255, 100, 31, 0.18);
  opacity: 0.68;
  transform: rotate(-11deg);
  pointer-events: none;
}

html[data-design-refresh="on"] .hero-copy,
html[data-design-refresh="on"] .hero-showcase {
  z-index: 1;
}

html[data-design-refresh="on"] .hero h1 {
  text-wrap: balance;
}

html[data-design-refresh="on"] .hero-signature,
html[data-design-refresh="on"] .grade-picker {
  border-color: color-mix(in srgb, var(--blue) 16%, var(--line));
  background: color-mix(in srgb, var(--surface) 82%, var(--blue-soft));
  box-shadow: 0 10px 28px rgba(23, 34, 59, 0.055);
}

html[data-design-refresh="on"] .grade-picker {
  position: relative;
  grid-template-columns: repeat(7, 46px);
  gap: 8px;
  padding: 11px;
  border-radius: 20px;
}

html[data-design-refresh="on"] .grade-picker::after {
  content: "";
  position: absolute;
  right: -11px;
  top: -13px;
  width: 28px;
  height: 28px;
  clip-path: polygon(50% 0, 61% 37%, 100% 50%, 61% 63%, 50% 100%, 39% 63%, 0 50%, 39% 37%);
  background: linear-gradient(145deg, #64b5ff, #087cf0);
  filter: drop-shadow(0 7px 7px rgba(0, 104, 214, 0.2));
  transform: rotate(9deg);
  pointer-events: none;
}

html[data-design-refresh="on"] .grade-picker > span {
  min-height: 30px;
  padding: 0 4px 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  text-transform: none;
}

html[data-design-refresh="on"] .grade-picker > span b {
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.015em;
}

html[data-design-refresh="on"] .grade-picker > span small {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

html[data-design-refresh="on"] .grade-picker a {
  width: 46px;
  min-width: 46px;
  height: 46px;
  --compat-mix-906bc484b3: color-mix(in srgb, var(--blue) 10%, var(--line));
  border: 1px solid var(--compat-mix-906bc484b3);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 86%, var(--blue-soft));
  transition:
    color 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms var(--ui-ease);
}

html[data-design-refresh="on"] .grade-picker a:hover {
  color: var(--blue-dark);
  border-color: color-mix(in srgb, var(--blue) 32%, var(--line));
  background: var(--blue-soft);
  box-shadow: 0 8px 18px rgba(0, 104, 214, 0.11);
  transform: translateY(-2px);
}

html[data-design-refresh="on"] .hero-main-actions > a {
  min-height: 60px;
  border-radius: 17px;
}

html[data-design-refresh="on"] .primary-button {
  padding: 10px 10px 10px 21px;
  box-shadow: 0 13px 30px rgba(255, 91, 36, 0.24);
}

html[data-design-refresh="on"] .primary-button > span[aria-hidden="true"] {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.19);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 220ms var(--ui-ease), background-color 220ms ease;
}

html[data-design-refresh="on"] .hero-solver-button {
  border-color: color-mix(in srgb, var(--blue) 30%, var(--line));
  background: color-mix(in srgb, var(--surface) 66%, var(--blue-soft));
  box-shadow: 0 13px 30px rgba(0, 104, 214, 0.11);
  transition:
    border-color 200ms ease,
    background-color 200ms ease,
    box-shadow 200ms ease,
    transform 200ms var(--ui-ease);
}

html[data-design-refresh="on"] .hero-solver-button small {
  font-size: 10px;
  line-height: 1.2;
}

html[data-design-refresh="on"] .hero-solver-button strong {
  font-size: 13px;
  line-height: 1.25;
}

html[data-design-refresh="on"] .hero-solver-button > i {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
}

/* Main discovery surfaces. */
html[data-design-refresh="on"] .quick-search,
html[data-design-refresh="on"] .journal-shell {
  border-color: color-mix(in srgb, var(--blue) 13%, var(--line));
  box-shadow: var(--ui-shadow-soft);
}

html[data-design-refresh="on"] .services-section {
  position: relative;
}

html[data-design-refresh="on"] .services-section::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 54px -34px 30px;
  border-radius: 46px;
  background:
    radial-gradient(circle at 4% 10%, color-mix(in srgb, var(--orange-soft) 65%, transparent), transparent 31%),
    radial-gradient(circle at 96% 84%, color-mix(in srgb, var(--blue-soft) 72%, transparent), transparent 34%);
  pointer-events: none;
}

html[data-design-refresh="on"] .service-card {
  min-height: 366px;
  padding: 25px;
  border-color: color-mix(in srgb, var(--service-color) 14%, var(--line));
  border-radius: var(--ui-radius-card);
  background:
    linear-gradient(148deg, var(--surface) 54%, color-mix(in srgb, var(--service-background) 60%, var(--surface)) 100%);
  box-shadow: 0 16px 46px rgba(23, 34, 59, 0.065);
}

html[data-design-refresh="on"] .service-card::after {
  content: "";
  width: 170px;
  height: 170px;
  position: absolute;
  z-index: 0;
  right: -84px;
  top: -88px;
  border-radius: 50%;
  background: var(--service-background);
  opacity: 0.7;
  pointer-events: none;
}

html[data-design-refresh="on"] .service-number {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

html[data-design-refresh="on"] .service-card h3 {
  margin-top: 26px;
  font-size: 22px;
  text-wrap: balance;
}

html[data-design-refresh="on"] .service-card > p {
  font-size: 13.5px;
}

html[data-design-refresh="on"] .service-price strong {
  font-size: 18px;
}

html[data-design-refresh="on"] .service-order-button {
  border-radius: 16px;
  --compat-mix-ccd46b4d56: color-mix(in srgb, var(--service-color) 21%, transparent);
  box-shadow: 0 12px 26px var(--compat-mix-ccd46b4d56);
}

html[data-design-refresh="on"] .service-card.orange .service-order-button {
  background: var(--ui-action-gradient);
}

html[data-design-refresh="on"] .service-order-button > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

html[data-design-refresh="on"] .service-actions .service-details-button {
  --compat-mix-921aa8fe0b: color-mix(in srgb, var(--service-color) 13%, var(--line));
  border: 1px solid var(--compat-mix-921aa8fe0b);
  border-radius: 14px;
}

html[data-design-refresh="on"] .services-agreement {
  margin-top: 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--blue-soft) 46%, var(--surface)));
  box-shadow: 0 14px 38px rgba(23, 34, 59, 0.055);
}

html[data-design-refresh="on"] .services-agreement div > span i svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Service chooser: more legible cards without changing its flow. */
html[data-design-refresh="on"] .service-picker-sheet {
  background: color-mix(in srgb, var(--paper) 97%, transparent);
}

html[data-design-refresh="on"] .service-picker-card {
  border-radius: 22px;
  box-shadow: 0 13px 34px rgba(23, 34, 59, 0.065);
}

html[data-design-refresh="on"] .service-picker-copy strong {
  font-size: 14.5px;
}

html[data-design-refresh="on"] .service-picker-copy small {
  font-size: 10px;
}

html[data-design-refresh="on"] .service-picker-card > i {
  --compat-mix-cd448d5247: color-mix(in srgb, var(--picker-color) 12%, var(--line));
  border: 1px solid var(--compat-mix-cd448d5247);
}

/* Consistent keyboard focus across old and new controls. */
html[data-design-refresh="on"] :where(a, button, input, textarea, select, summary):focus-visible {
  --compat-mix-93a4e369ba: color-mix(in srgb, var(--blue) 42%, transparent);
  outline: 3px solid var(--compat-mix-93a4e369ba);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  html[data-design-refresh="on"] .app-header nav a:hover,
  html[data-design-refresh="on"] .theme-toggle:hover,
  html[data-design-refresh="on"] .app-header-support:hover {
    transform: translateY(-1px);
  }

  html[data-design-refresh="on"] .hero-solver-button:hover,
  html[data-design-refresh="on"] .primary-button:hover {
    transform: translateY(-2px);
  }

  html[data-design-refresh="on"] .hero-solver-button:hover {
    border-color: color-mix(in srgb, var(--blue) 48%, var(--line));
    box-shadow: 0 17px 36px rgba(0, 104, 214, 0.15);
  }

  html[data-design-refresh="on"] :is(.app-nav-primary, .primary-button, .services-intro > a, .service-card.orange .service-order-button):hover::before {
    transform: translate(18px, 10px) scale(1.08);
  }

  html[data-design-refresh="on"] .primary-button:hover > span[aria-hidden="true"],
  html[data-design-refresh="on"] .service-order-button:hover > span {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(2px);
  }

  html[data-design-refresh="on"] .service-card:hover {
    transform: translateY(-5px);
    border-color: color-mix(in srgb, var(--service-color) 28%, var(--line));
    box-shadow: var(--ui-shadow-float);
  }
}

@media (max-width: 800px) {
  html[data-design-refresh="on"] .hero {
    width: min(calc(100% - 24px), 620px);
    margin-top: 12px;
    padding: 36px 22px 44px;
    gap: 34px;
    border-radius: 30px;
  }

  html[data-design-refresh="on"] .hero::before {
    inset: 0;
    width: auto;
    height: auto;
    -webkit-mask-image: linear-gradient(180deg, transparent 12%, #000 58%, transparent);
    mask-image: linear-gradient(180deg, transparent 12%, #000 58%, transparent);
  }

  html[data-design-refresh="on"] .hero::after {
    display: none;
  }

  html[data-design-refresh="on"] .services-section::before {
    inset: 38px -12px 18px;
    border-radius: 32px;
  }

  html[data-design-refresh="on"] .service-card {
    min-height: 0;
    padding: 22px;
    border-radius: 24px;
  }
}

@media (max-width: 560px) {
  html[data-design-refresh="on"] .app-header-shell {
    background: color-mix(in srgb, var(--surface) 94%, transparent);
  }

  html[data-design-refresh="on"] .hero {
    padding: 30px 16px 36px;
    border-radius: 26px;
  }

  html[data-design-refresh="on"] .hero-main-actions {
    gap: 9px;
  }

  html[data-design-refresh="on"] .hero-main-actions > a {
    min-height: 58px;
  }

  html[data-design-refresh="on"] .grade-picker {
    width: 100%;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 7px;
  }

  html[data-design-refresh="on"] .grade-picker a {
    width: auto;
    min-width: 0;
    grid-column: span 2;
  }

  html[data-design-refresh="on"] .grade-picker a:nth-of-type(5) {
    grid-column: 2 / span 2;
  }

  html[data-design-refresh="on"] .grade-picker a:nth-of-type(6) {
    grid-column: 4 / span 2;
  }

  html[data-design-refresh="on"] .grade-picker a:nth-of-type(7) {
    grid-column: 6 / span 2;
  }

  html[data-design-refresh="on"] .service-picker-card {
    min-height: 122px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-design-refresh="on"] *,
  html[data-design-refresh="on"] *::before,
  html[data-design-refresh="on"] *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  html[data-design-refresh="on"] .app-header-shell {
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
