/**
 * Okuma modu — telefon okuyucu tarzı: sade zemin, dar sütun, dikkat dağıtan öğeler gizli
 * body.reading-mode sınıfı reading-mode.js ile eklenir.
 */

#reading-mode-btn .reading-mode-icon-enter {
  display: block;
}

#reading-mode-btn .reading-mode-icon-exit {
  display: none;
}

/* ── Genel zemin ve tipografi ── */
body.reading-mode {
  background: #f3efe6 !important;
  color: #1c1917;
  --reading-dim: 0;
}

body.reading-mode.dark-theme {
  background: #1c1917 !important;
  color: #e7e5e4;
}

/* İçerik: sitedeki var(--text-color) vb. token’ları okuma paletine çek (gradient başlıklar hariç ayrıca) */
body.reading-mode:not(.dark-theme) main,
body.reading-mode:not(.dark-theme) .modern-footer {
  --text-color: #1c1917 !important;
  --text-muted: #57534e !important;
  --home-apple-text: #1c1917 !important;
  --home-apple-muted: #57534e !important;
  --home-apple-list: #44403c !important;
  --border-color: rgba(28, 25, 23, 0.12) !important;
  color: #1c1917 !important;
}

body.reading-mode.dark-theme main,
body.reading-mode.dark-theme .modern-footer {
  --text-color: #e7e5e4 !important;
  --text-muted: #a8a29e !important;
  --home-apple-text: #e7e5e4 !important;
  --home-apple-muted: #a8a29e !important;
  --home-apple-list: #d6d3d1 !important;
  --border-color: rgba(231, 229, 228, 0.14) !important;
  color: #e7e5e4 !important;
}

/* Gradient/metin kırpılmış başlıkları düz okunur renge çevir */
body.reading-mode:not(.dark-theme) main :where(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  .hero-title-apple,
  .hero-subtitle-apple,
  .section-title--apple,
  .blog-hero__title,
  .blog-article__title,
  .s-hero__title,
  .s-section-title,
  .about-page-hero__title,
  .contact-hero h1,
  .glass-card h2
) {
  background-image: none !important;
  background-clip: border-box !important;
  -webkit-background-clip: border-box !important;
  -webkit-text-fill-color: currentColor !important;
  color: var(--text-color) !important;
}

body.reading-mode.dark-theme main :where(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  .hero-title-apple,
  .hero-subtitle-apple,
  .section-title--apple,
  .blog-hero__title,
  .blog-article__title,
  .s-hero__title,
  .s-section-title,
  .about-page-hero__title,
  .contact-hero h1,
  .glass-card h2
) {
  background-image: none !important;
  background-clip: border-box !important;
  -webkit-background-clip: border-box !important;
  -webkit-text-fill-color: currentColor !important;
  color: var(--text-color) !important;
}

body.reading-mode main {
  position: relative;
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
  padding-left: clamp(16px, 4vw, 24px);
  padding-right: clamp(16px, 4vw, 24px);
  font-size: 1.0625rem;
  line-height: 1.75;
}

body.reading-mode main::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(0, 0, 0, var(--reading-dim, 0));
  pointer-events: none;
  z-index: 40;
}

body.reading-mode main p,
body.reading-mode main li {
  line-height: 1.75;
}

/* Tam genişlik “viewport kırma” (100vw + calc(50% - 50vw)): dar okuma sütununda yatay taşma ve üst bar kayması yapar */
body.reading-mode main .sectoral-section {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  left: auto;
  right: auto;
}

body.reading-mode .modern-footer {
  position: relative;
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(16px, 4vw, 24px);
  padding-right: clamp(16px, 4vw, 24px);
  background: transparent !important;
  border-top-color: rgba(0, 0, 0, 0.08);
}

body.reading-mode .modern-footer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, var(--reading-dim, 0));
  pointer-events: none;
  z-index: 40;
}

body.reading-mode.dark-theme .modern-footer {
  border-top-color: rgba(255, 255, 255, 0.1);
}

/* ── Üst bar: daha sade ── */
body.reading-mode .glass-header,
body.reading-mode .site-header-el {
  background: rgba(243, 239, 230, 0.92) !important;
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid rgba(28, 25, 23, 0.08);
  box-shadow: none;
}

body.reading-mode.dark-theme .glass-header,
body.reading-mode.dark-theme .site-header-el {
  background: rgba(28, 25, 23, 0.92) !important;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.reading-mode .header-ctas-desk,
body.reading-mode .header-ctas-mobile,
body.reading-mode .header-portal-login {
  display: none !important;
}

/* Üst menü: okuma modunda öğeler gizlenince grid taşması / satır kayması olmasın */
body.reading-mode .header-inner.site-header-el__inner {
  min-width: 0;
}

@media (min-width: 1200px) {
  body.reading-mode .header-inner.site-header-el__inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  body.reading-mode .site-header-el__nav.main-nav {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap;
    justify-content: center;
    gap: clamp(0.55rem, 1vw, 1.15rem);
  }

  body.reading-mode .site-header-el__nav.main-nav a {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: clamp(0.98rem, 1.05vw, 1.1rem);
    padding: 0.35rem 0.15rem;
  }
}

/* Mobil / tablet: sağ aksiyonlar sıkışınca taşma yapmasın */
@media (max-width: 1199px) {
  body.reading-mode .header-inner.site-header-el__inner {
    min-width: 0;
    gap: 8px;
  }

  body.reading-mode .site-header-el__actions.header-actions {
    gap: 6px;
    min-width: 0;
  }

  body.reading-mode .lang-switcher {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

/* ── Dikkat dağıtan sabit öğeler ── */
body.reading-mode .edge-rail,
body.reading-mode .fab,
body.reading-mode #fab-whatsapp,
body.reading-mode #fab-top,
body.reading-mode #artemis-chat-root,
body.reading-mode .artemis-chat-root {
  display: none !important;
}

/* ── Okuma modu düğmesi ── */
#reading-mode-btn.is-active,
body.reading-mode #reading-mode-btn {
  background: rgba(30, 144, 255, 0.12);
  color: #156cc4;
}

body.reading-mode.dark-theme #reading-mode-btn {
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
}

body.reading-mode #reading-mode-btn .reading-mode-icon-enter {
  display: none !important;
}

body.reading-mode #reading-mode-btn .reading-mode-icon-exit {
  display: block !important;
}

body:not(.reading-mode) #reading-mode-btn .reading-mode-icon-exit {
  display: none !important;
}

body:not(.reading-mode) #reading-mode-btn .reading-mode-icon-enter {
  display: block !important;
}

@media (prefers-reduced-motion: reduce) {
  body.reading-mode .glass-header,
  body.reading-mode .site-header-el {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* Okuma modu: sağ sekme + sağdan açılan parlaklık paneli (telefon çerçevesi, JS ile eklenir) */
.reading-mode-dock {
  position: fixed;
  inset: 0;
  z-index: 10060;
  pointer-events: none;
}

.reading-mode-dock[hidden] {
  display: none !important;
}

.reading-mode-dock__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s;
  pointer-events: none;
}

.reading-mode-dock--open .reading-mode-dock__backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.reading-mode-dock__backdrop[hidden] {
  display: none !important;
}

.reading-mode-dock__sheet {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, calc(100vw - 44px));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: max(12px, env(safe-area-inset-top)) calc(48px + max(8px, env(safe-area-inset-right)))
    max(12px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  pointer-events: none;
}

.reading-mode-dock--open .reading-mode-dock__sheet {
  pointer-events: auto;
}

/* Sekme: sağ kenar, dikey orta — sadece bu her zaman tıklanabilir */
.reading-mode-dock__tab {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 96px;
  padding: 10px 6px;
  margin: 0;
  border-radius: 12px 0 0 12px;
  background: rgba(255, 252, 245, 0.98);
  border: 1px solid rgba(28, 25, 23, 0.14);
  border-right: none;
  box-shadow: -4px 8px 24px rgba(0, 0, 0, 0.1);
  color: #1c1917;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.reading-mode-dock__tab:hover {
  background: #fff;
  box-shadow: -6px 10px 28px rgba(0, 0, 0, 0.12);
}

.reading-mode-dock__tab:focus-visible {
  outline: 2px solid #1e90ff;
  outline-offset: 2px;
}

.reading-mode-dock__tab-icon {
  font-size: 26px;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

body.reading-mode.dark-theme .reading-mode-dock__tab {
  background: rgba(41, 37, 36, 0.98);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e7e5e4;
  box-shadow: -4px 8px 28px rgba(0, 0, 0, 0.45);
}

body.reading-mode.dark-theme .reading-mode-dock__tab:hover {
  background: rgba(51, 47, 46, 0.99);
}

body.reading-mode.dark-theme .reading-mode-dock__tab:focus-visible {
  outline-color: #38bdf8;
}

.reading-mode-dock--open .reading-mode-dock__tab {
  box-shadow: -2px 6px 20px rgba(0, 0, 0, 0.08);
}

/* Panel: sağdan kayar */
.reading-mode-settings {
  position: relative;
  width: 100%;
  max-width: 268px;
  padding: 0;
  border: none;
  background: transparent;
  transform: translateX(calc(100% + 8px));
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
  pointer-events: none;
}

.reading-mode-dock--open .reading-mode-settings {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.reading-mode-settings__close {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.65);
  color: #44403c;
  cursor: pointer;
  transition: background 0.15s ease;
}

.reading-mode-settings__close:hover {
  background: rgba(255, 255, 255, 0.9);
}

.reading-mode-settings__close:focus-visible {
  outline: 2px solid #1e90ff;
  outline-offset: 2px;
}

.reading-mode-settings__close .material-symbols-rounded {
  font-size: 22px;
}

body.reading-mode.dark-theme .reading-mode-settings__close {
  background: rgba(0, 0, 0, 0.35);
  color: #e7e5e4;
}

body.reading-mode.dark-theme .reading-mode-settings__close:hover {
  background: rgba(0, 0, 0, 0.5);
}

body.reading-mode.dark-theme .reading-mode-settings__close:focus-visible {
  outline-color: #38bdf8;
}

/* Telefon kabuğu */
.reading-mode-phone {
  margin: 0 auto;
  padding: 10px 0 6px;
}

.reading-mode-phone__bezel {
  position: relative;
  border-radius: 28px;
  padding: 10px 10px 14px;
  background: linear-gradient(145deg, #3f3f46 0%, #27272a 45%, #18181b 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 18px 48px rgba(0, 0, 0, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.2);
}

.reading-mode-phone__notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 22px;
  border-radius: 0 0 14px 14px;
  background: #18181b;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  z-index: 1;
}

.reading-mode-phone__screen {
  position: relative;
  margin-top: 18px;
  padding: 16px 14px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, #fffefb 0%, #f5f0e8 100%);
  border: 1px solid rgba(28, 25, 23, 0.08);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04) inset;
  color: #1c1917;
}

body.reading-mode.dark-theme .reading-mode-phone__screen {
  background: linear-gradient(180deg, #292524 0%, #1c1917 100%);
  border-color: rgba(255, 255, 255, 0.08);
  color: #e7e5e4;
}

.reading-mode-phone__title {
  margin: 0 0 6px;
  padding-right: 32px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.reading-mode-phone__hint {
  margin: 0 0 12px;
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.82;
  color: inherit;
}

.reading-mode-phone__brightness-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reading-mode-phone__icon {
  flex-shrink: 0;
  font-size: 22px;
  opacity: 0.85;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.reading-mode-phone__range-wrap {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.reading-mode-phone__range-wrap input[type='range'] {
  display: block;
  width: 100%;
  height: 30px;
  margin: 0;
  cursor: pointer;
  accent-color: #1e90ff;
}

body.reading-mode.dark-theme .reading-mode-phone__range-wrap input[type='range'] {
  accent-color: #38bdf8;
}

@media (prefers-reduced-motion: reduce) {
  .reading-mode-dock__backdrop,
  .reading-mode-settings {
    transition: none;
  }
}
