/* Tamakkin Contrast Hotfix
   Fixes low-contrast text in light mode without changing structure or data. */

:root {
  --tmk-light-text-strong: #13231f;
  --tmk-light-text: #243d36;
  --tmk-light-text-muted: #4e655e;
  --tmk-light-border: rgba(22, 77, 60, .14);
  --tmk-light-surface: #ffffff;
  --tmk-light-surface-soft: #f5faf8;
}

html:not([data-theme="dark"]) body,
body:not(.dark),
body.light {
  color: var(--tmk-light-text);
}

html:not([data-theme="dark"]) footer,
body.light footer,
footer.light,
.site-footer {
  color: var(--tmk-light-text);
}

html:not([data-theme="dark"]) footer *,
body.light footer *,
.site-footer * {
  color: inherit;
}

html:not([data-theme="dark"]) footer h1,
html:not([data-theme="dark"]) footer h2,
html:not([data-theme="dark"]) footer h3,
html:not([data-theme="dark"]) footer h4,
html:not([data-theme="dark"]) footer strong,
body.light footer h1,
body.light footer h2,
body.light footer h3,
body.light footer h4,
body.light footer strong,
.site-footer h1,
.site-footer h2,
.site-footer h3,
.site-footer h4,
.site-footer strong {
  color: var(--tmk-light-text-strong) !important;
}

html:not([data-theme="dark"]) footer p,
html:not([data-theme="dark"]) footer a,
html:not([data-theme="dark"]) footer li,
html:not([data-theme="dark"]) footer span,
body.light footer p,
body.light footer a,
body.light footer li,
body.light footer span,
.site-footer p,
.site-footer a,
.site-footer li,
.site-footer span {
  color: var(--tmk-light-text-muted) !important;
}

html:not([data-theme="dark"]) footer a:hover,
body.light footer a:hover,
.site-footer a:hover {
  color: #0f8a64 !important;
}

html:not([data-theme="dark"]) footer .teacher-credit,
html:not([data-theme="dark"]) footer .credit-card,
html:not([data-theme="dark"]) footer .author-card,
body.light footer .teacher-credit,
body.light footer .credit-card,
body.light footer .author-card,
.site-footer .teacher-credit,
.site-footer .credit-card,
.site-footer .author-card {
  background: var(--tmk-light-surface) !important;
  border: 1px solid var(--tmk-light-border) !important;
  color: var(--tmk-light-text-strong) !important;
  box-shadow: 0 14px 36px rgba(21, 61, 49, .08) !important;
}

/* Contact / Ask specialist form readability */
html:not([data-theme="dark"]) input,
html:not([data-theme="dark"]) select,
html:not([data-theme="dark"]) textarea,
body.light input,
body.light select,
body.light textarea {
  color: var(--tmk-light-text-strong) !important;
  background: #fff !important;
  border-color: rgba(20, 72, 56, .18) !important;
}

html:not([data-theme="dark"]) input::placeholder,
html:not([data-theme="dark"]) textarea::placeholder,
body.light input::placeholder,
body.light textarea::placeholder {
  color: #6d7f79 !important;
  opacity: 1 !important;
}

html:not([data-theme="dark"]) label,
body.light label {
  color: var(--tmk-light-text-strong) !important;
}

html:not([data-theme="dark"]) .muted,
html:not([data-theme="dark"]) .text-muted,
html:not([data-theme="dark"]) .subtle,
body.light .muted,
body.light .text-muted,
body.light .subtle {
  color: var(--tmk-light-text-muted) !important;
}

/* Preserve dark mode clarity */
html[data-theme="dark"] footer,
body.dark footer,
html[data-theme="dark"] .site-footer,
body.dark .site-footer {
  color: rgba(255,255,255,.86);
}

/* iOS Safari AI Assistant Zoom Fix */
.ai-assistant input,
.ai-assistant textarea,
.ai-chat-input,
.ai-assistant-panel textarea,
.ai-widget-panel textarea {
  font-size: 16px !important;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .ai-assistant-panel,
  .ai-chat-panel,
  .ai-widget-panel {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    left: 12px !important;
    right: auto !important;
    transform: none !important;
    overflow-x: hidden !important;
  }

  .ai-assistant-panel * {
    max-width: 100%;
    box-sizing: border-box;
  }
}
