/* ============================================
   myopia.md — Custom Styles
   Safari/WebKit compatibility is mandatory
   ============================================ */

/* --- Base resets --- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    -webkit-animation-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    -webkit-animation-iteration-count: 1 !important;
    animation-iteration-count: 1 !important;
    -webkit-transition-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* (Old halo styles removed — replaced by chart-wrap label system) */

/* --- Skip to content (accessibility) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 9999;
  padding: 8px 16px;
  background: #6366F1;
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  -webkit-transition: top 0.2s ease;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

/* --- Scroll reveal animations --- */
[data-reveal] {
  opacity: 0;
  -webkit-transform: translateY(24px);
  transform: translateY(24px);
  -webkit-transition: opacity 0.6s ease-out, -webkit-transform 0.6s ease-out;
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  will-change: opacity, transform;
}

[data-reveal].revealed {
  opacity: 1;
  -webkit-transform: translateY(0);
  transform: translateY(0);
}

/* --- Navbar --- */
.navbar {
  -webkit-transition: box-shadow 0.3s ease, background-color 0.3s ease;
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

/* Site logo — compact, scales to ~12% of nav width on desktop */
.site-logo {
  display: block;
  height: 28px;
  width: auto;
}
@media (min-width: 768px) {
  .site-logo { height: 32px; }
}

.navbar.scrolled {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  background-color: rgba(255, 255, 255, 0.98);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* --- Hero section --- */
.hero-overlay {
  background: linear-gradient(
    to right,
    rgba(26, 35, 50, 0.75) 0%,
    rgba(26, 35, 50, 0.55) 50%,
    rgba(26, 35, 50, 0.2) 100%
  );
}

/* --- Bounce arrow animation --- */
@-webkit-keyframes bounceArrow {
  0%, 100% {
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
  50% {
    -webkit-transform: translateY(8px);
    transform: translateY(8px);
  }
}
@keyframes bounceArrow {
  0%, 100% {
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
  50% {
    -webkit-transform: translateY(8px);
    transform: translateY(8px);
  }
}

.bounce-arrow {
  -webkit-animation: bounceArrow 2s ease-in-out infinite;
  animation: bounceArrow 2s ease-in-out infinite;
}

/* --- Fade-in keyframe (general purpose) --- */
@-webkit-keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Fade-in-up keyframe --- */
@-webkit-keyframes fadeInUp {
  from {
    opacity: 0;
    -webkit-transform: translateY(20px);
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    -webkit-transform: translateY(20px);
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  -webkit-animation: fadeInUp 0.8s ease-out forwards;
  animation: fadeInUp 0.8s ease-out forwards;
}

/* --- Counter number styling --- */
.counter-number {
  font-variant-numeric: tabular-nums;
}

/* --- Mobile menu overlay --- */
.mobile-menu-overlay {
  -webkit-transition: opacity 0.3s ease, visibility 0.3s ease;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* --- Card hover lift --- */
.card-hover {
  -webkit-transition: box-shadow 0.25s ease, -webkit-transform 0.25s ease;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card-hover:hover {
  -webkit-transform: translateY(-4px);
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* --- CTA button press effect --- */
.cta-press:active {
  -webkit-transform: translateY(1px);
  transform: translateY(1px);
}

/* --- Subtle background pattern (CSS only) --- */
.pattern-bg {
  background-image: radial-gradient(circle at 1px 1px, rgba(10, 126, 140, 0.05) 1px, transparent 0);
  background-size: 24px 24px;
}

/* --- Focus visible outlines (accessibility) --- */
:focus-visible {
  outline: 2px solid #6366F1;
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Line clamp utility --- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Infographic HTML text overlays ---
   Text overlays on clean images, replicating the original Russian labels.
   Uses container queries for responsive font scaling. */

.eye-diagram-container,
.lens-diagram-container,
.timeline-diagram-container {
  position: relative;
  container-type: inline-size;
}

/* Eye comparison diagram labels */
.eye-label {
  position: absolute;
  font-family: 'Inter', sans-serif;
  color: #1A2332;
  font-weight: 500;
  font-size: 1.25cqi;
  line-height: 1.2;
  pointer-events: auto;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.eye-label.eye-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 2.1cqi;
}

/* Lens mechanism diagram labels */
.lens-label {
  position: absolute;
  font-family: 'Inter', sans-serif;
  color: #1A2332;
  font-weight: 500;
  font-size: 1.2cqi;
  line-height: 1.25;
  pointer-events: auto;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.lens-label.lens-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 1.9cqi;
}

.lens-label.lens-label-sm {
  font-size: 1.05cqi;
  line-height: 1.2;
}

/* Two-paths timeline labels */
.timeline-label {
  position: absolute;
  font-family: 'Inter', sans-serif;
  color: #4A5568;
  font-weight: 500;
  font-size: 1.1cqi;
  line-height: 1.25;
  pointer-events: auto;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.timeline-label.tl-coral {
  color: #E8654A;
}

.timeline-label.tl-teal {
  color: #0A7E8C;
}

.timeline-label.tl-sm {
  font-size: 0.95cqi;
}

/* Fallback for browsers without container query support */
@supports not (container-type: inline-size) {
  .eye-label { font-size: clamp(8px, 1.3vw, 16px); }
  .eye-label.eye-title { font-size: clamp(11px, 2.1vw, 24px); }
  .lens-label { font-size: clamp(8px, 1.2vw, 15px); }
  .lens-label.lens-title { font-size: clamp(11px, 1.9vw, 22px); }
  .lens-label.lens-label-sm { font-size: clamp(7px, 1.05vw, 13px); }
  .timeline-label { font-size: clamp(7px, 1.1vw, 14px); }
  .timeline-label.tl-sm { font-size: clamp(6px, 0.95vw, 12px); }
}

/* --- Timeline chart (two-paths) HTML infographic --- */
.chart-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 1280px;
  font-family: "Nunito Sans", "Inter", sans-serif;
  -webkit-user-select: text;
  user-select: text;
  container-type: inline-size;
}
.chart-wrap img {
  display: block;
  width: 100%;
  height: auto;
}
.chart-wrap [data-text] {
  position: absolute;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: auto;
  cursor: text;
}
.chart-wrap .label-top-path {
  left: 0.938%; top: 12.891%;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #D86B58;
  font-size: clamp(11px, 2cqi, 26px);
  background: rgba(255,255,255,0.92);
  padding: 0.05em 0.3em;
  z-index: 2;
}
.chart-wrap .label-top-sub {
  left: 3.359%; top: 19.890%;
  font-weight: 600;
  color: #1C1E2E;
  font-size: clamp(10px, 1.55cqi, 21px);
  background: rgba(255,255,255,0.92);
  padding: 0.05em 0.3em;
  z-index: 2;
}
.chart-wrap .label-bottom-path {
  left: 0.938%; top: 65.930%;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #2A8089;
  font-size: clamp(11px, 2cqi, 26px);
  background: rgba(255,255,255,0.92);
  padding: 0.05em 0.3em;
  z-index: 2;
}
.chart-wrap .label-bottom-sub {
  left: 4.453%; top: 73.297%;
  font-weight: 600;
  color: #1C1E2E;
  font-size: clamp(10px, 1.55cqi, 21px);
  background: rgba(255,255,255,0.92);
  padding: 0.05em 0.3em;
  z-index: 2;
}
.chart-wrap .dv {
  font-weight: 700;
  color: #1C1E2E;
  font-size: clamp(5px, 0.8cqi, 11px);
  letter-spacing: -0.01em;
  background: rgba(255,255,255,0.92);
  padding: 0.05em 0.2em;
  z-index: 2;
}
.chart-wrap .legend-block {
  position: absolute;
  display: flex;
  align-items: flex-start;
  gap: 0.35%;
  line-height: 1.25;
  pointer-events: auto;
  cursor: text;
}
.chart-wrap .legend-icon {
  flex-shrink: 0;
  font-size: clamp(14px, 1.8cqi, 24px);
  line-height: 1;
  margin-top: 0.1em;
}
.chart-wrap .legend-text {
  font-weight: 600;
  color: #1C1E2E;
  font-size: clamp(8px, 1.35cqi, 18px);
  white-space: normal;
  max-width: clamp(80px, 13cqi, 175px);
  -webkit-user-select: text;
  user-select: text;
  background: rgba(255,255,255,0.92);
  padding: 0.05em 0.15em;
}
.chart-wrap .axis-label {
  font-weight: 600;
  color: #1C1E2E;
  font-size: clamp(5px, 0.7cqi, 9px);
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  background: rgba(255,255,255,0.92);
  padding: 0.05em 0.15em;
  z-index: 2;
}
.chart-wrap .axis-title {
  left: 8.594%; top: 90.239%;
  font-weight: 700;
  color: #1C1E2E;
  font-size: clamp(8px, 1.35cqi, 18px);
  white-space: nowrap;
  background: rgba(255,255,255,0.92);
  padding: 0.05em 0.3em;
  z-index: 2;
}
@supports not (container-type: inline-size) {
  .chart-wrap .label-top-path,
  .chart-wrap .label-bottom-path { font-size: clamp(11px, 2vw, 26px); }
  .chart-wrap .label-top-sub,
  .chart-wrap .label-bottom-sub { font-size: clamp(10px, 1.55vw, 21px); }
  .chart-wrap .dv { font-size: clamp(5px, 0.8vw, 11px); }
  .chart-wrap .legend-icon { font-size: clamp(14px, 1.8vw, 24px); }
  .chart-wrap .legend-text { font-size: clamp(8px, 1.35vw, 18px); max-width: clamp(80px, 13vw, 175px); }
  .chart-wrap .axis-label { font-size: clamp(5px, 0.7vw, 9px); }
  .chart-wrap .axis-title { font-size: clamp(8px, 1.35vw, 18px); }
}

/* --- Eye diagram (normal vs myopia) HTML infographic --- */
.chart-wrap .eye-title {
  font-weight: 800;
  color: #1C5C62;
  font-size: clamp(13px, 2.2cqi, 28px);
  white-space: nowrap;
  background: rgba(255,255,255,0.95);
  padding: 0.1em 0.35em;
  z-index: 2;
}
.chart-wrap .lbl {
  font-weight: 600;
  color: #2A2A2A;
  font-size: clamp(8px, 1.1cqi, 14px);
  white-space: nowrap;
  background: rgba(255,255,255,0.95);
  padding: 0.05em 0.25em;
  z-index: 2;
}
.chart-wrap .lbl-sm {
  font-weight: 600;
  color: #2A2A2A;
  font-size: clamp(7px, 1.0cqi, 13px);
  white-space: nowrap;
  background: rgba(255,255,255,0.95);
  padding: 0.05em 0.25em;
  z-index: 2;
}
@supports not (container-type: inline-size) {
  .chart-wrap .eye-title { font-size: clamp(13px, 2.2vw, 28px); }
  .chart-wrap .lbl { font-size: clamp(8px, 1.1vw, 14px); }
  .chart-wrap .lbl-sm { font-size: clamp(7px, 1.0vw, 13px); }
}

/* --- Lens comparison diagram HTML infographic --- */
.chart-wrap .lens-title {
  font-weight: 800;
  color: #1C1E2E;
  font-size: clamp(12px, 1.8cqi, 24px);
  white-space: nowrap;
  background: rgba(255,255,255,0.95);
  padding: 0.1em 0.35em;
  z-index: 2;
}
.chart-wrap .lens-lbl {
  font-weight: 600;
  color: #1a1a1a;
  font-size: clamp(7px, 0.9cqi, 12px);
  line-height: 1.3;
  white-space: normal;
  background: rgba(255,255,255,0.95);
  padding: 0.05em 0.25em;
  z-index: 2;
}
@supports not (container-type: inline-size) {
  .chart-wrap .lens-title { font-size: clamp(12px, 1.8vw, 24px); }
  .chart-wrap .lens-lbl { font-size: clamp(7px, 0.9vw, 12px); }
}

/* --- Smooth image loading --- */
img {
  -webkit-transition: opacity 0.3s ease;
  transition: opacity 0.3s ease;
}

img[loading="lazy"] {
  opacity: 0;
}

img[loading="lazy"].loaded,
img:not([loading="lazy"]) {
  opacity: 1;
}

/* ============================================
   Cookie consent banner (mmd-consent.js)
   ============================================ */
#mcb {
  position: fixed;
  inset: 0;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
  opacity: 0;
  pointer-events: none;
  -webkit-transition: opacity 0.3s ease;
  transition: opacity 0.3s ease;
}
#mcb.mcb-show {
  opacity: 1;
  pointer-events: auto;
}
.mcb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 35, 50, 0.55);
}
.mcb-box {
  position: absolute;
  left: 50%;
  bottom: 24px;
  -webkit-transform: translateX(-50%) translateY(20px);
  transform: translateX(-50%) translateY(20px);
  width: calc(100% - 32px);
  max-width: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(26, 35, 50, 0.25), 0 4px 12px rgba(26, 35, 50, 0.1);
  padding: 24px;
  -webkit-transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#mcb.mcb-show .mcb-box {
  -webkit-transform: translateX(-50%) translateY(0);
  transform: translateX(-50%) translateY(0);
}
.mcb-screen { display: block; }
.mcb-title {
  font-family: 'Manrope', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #1A2332;
  margin-bottom: 8px;
}
.mcb-text {
  font-size: 14px;
  line-height: 1.5;
  color: #4A5568;
  margin-bottom: 16px;
}
.mcb-privacy {
  color: #0A7E8C;
  text-decoration: underline;
}
.mcb-privacy:hover { color: #065A64; }
.mcb-actions {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
}
.mcb-btn-accept {
  background: #0A7E8C;
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  -webkit-transition: background 0.2s ease;
  transition: background 0.2s ease;
  font-family: inherit;
}
.mcb-btn-accept:hover { background: #065A64; }
.mcb-btn-accept:focus-visible {
  outline: 2px solid #0A7E8C;
  outline-offset: 2px;
}
.mcb-link-subtle {
  background: none;
  border: none;
  color: #4A5568;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 4px;
  font-family: inherit;
  text-decoration: underline;
}
.mcb-link-subtle:hover { color: #1A2332; }
.mcb-s2-head {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.mcb-back {
  background: none;
  border: none;
  color: #0A7E8C;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}
.mcb-back:hover { color: #065A64; }
.mcb-s2-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #1A2332;
}
.mcb-cats {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.mcb-cat {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: flex-start;
  align-items: flex-start;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #FAFBFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  cursor: pointer;
}
.mcb-cat-info {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 4px;
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
}
.mcb-cat-info strong {
  font-size: 14px;
  color: #1A2332;
  font-weight: 600;
}
.mcb-cat-desc {
  font-size: 12px;
  color: #4A5568;
  line-height: 1.4;
}
.mcb-toggle {
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: #0A7E8C;
}
.mcb-toggle:disabled { cursor: not-allowed; opacity: 0.6; }

#mcb-footer {
  text-align: center;
  padding: 16px 16px 24px;
}
#mcb-footer-btn {
  background: transparent;
  color: inherit;
  opacity: 0.55;
  border: none;
  border-bottom: 1px dashed currentColor;
  border-radius: 0;
  padding: 2px 0;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s ease;
}
#mcb-footer-btn:hover {
  opacity: 1;
  background: transparent;
}

@media (max-width: 480px) {
  .mcb-box { padding: 20px 18px; bottom: 12px; }
  .mcb-actions { -webkit-flex-direction: column; flex-direction: column; -webkit-align-items: stretch; align-items: stretch; }
  .mcb-btn-accept { width: 100%; }
  .mcb-link-subtle { width: 100%; text-align: center; }
}

/* Honeypot — visible to bots, invisible to humans. */
.mmd-honeypot {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}
