/* MotoAtlas — açık / koyu tema.
   theme.js <html data-theme="light|dark"> yazar: kayıtlı seçim yoksa sistem tercihi.
   JavaScript yoksa sayfalar bugünkü varsayılan görünümleriyle açılır.
   Bu dosya her sayfada en son yüklenir; mevcut sayfa CSS'ine dokunmadan
   yalnız renk katmanını değiştirir. Marka kırmızısı iki temada da aynı aileden. */

/* ---------- Tema düğmesi ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border, #393033);
  border-radius: 9px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}
.theme-toggle:hover { background: var(--muted, rgba(127, 127, 127, 0.12)); }
.theme-toggle svg { width: 19px; height: 19px; pointer-events: none; }
.theme-toggle .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }
.theme-toggle.is-floating {
  position: fixed;
  z-index: 80;
  right: 16px;
  bottom: 16px;
  background: var(--card, #191618);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.route-header .theme-toggle { width: 42px; height: 42px; }
.planner-header .theme-toggle { width: 36px; height: 36px; border-radius: 8px; }
@media (max-width: 800px) {
  .route-header .theme-toggle { margin-left: auto; }
  .route-header .theme-toggle ~ .route-account,
  .route-header .theme-toggle ~ .route-mobile-menu,
  .route-header .theme-toggle ~ #map-header-switch { margin-left: 0; }
}
@media (max-width: 1120px) {
  .community-explore .route-header .theme-toggle { margin-left: auto; }
  .community-explore .route-header .theme-toggle ~ #map-header-switch { margin-left: 0; }
}

/* =====================================================================
   AÇIK TEMA
   ===================================================================== */
html[data-theme="light"] {
  --bg: #f6f3f1;
  --fg: #1c1718;
  --primary: #c41e1a;
  --primary-fg: #ffffff;
  --primary-bright: #b01d19;
  --secondary: #ebe5e2;
  --secondary-fg: #3d3437;
  --accent: #c41e1a;
  --accent-fg: #ffffff;
  --muted: #efe8e5;
  --muted-fg: #665b58;
  --card: #ffffff;
  --border: #e0d7d3;
  --success: #15804a;
  --info: #1d6a9e;
  color-scheme: light;
  background: var(--bg);
}
html[data-theme="light"] body { background: var(--bg); color: var(--fg); }

/* Ürün kabukları kendi koyu değişkenlerini tanımlıyor; aynı adlarla açığa çevrilir. */
html[data-theme="light"] body.route-surface,
html[data-theme="light"] body.route-surface.community-home,
html[data-theme="light"] .app-surface,
html[data-theme="light"] .route-header,
html[data-theme="light"] .manual-planner,
html[data-theme="light"] .community-explore {
  --bg: #f6f3f1;
  --fg: #1c1718;
  --card: #ffffff;
  --border: #e0d7d3;
  --muted: #efe8e5;
  --muted-fg: #665b58;
  --secondary: #ebe5e2;
  --secondary-fg: #3d3437;
  --primary: #c41e1a;
  --primary-bright: #b01d19;
  --accent: #c41e1a;
  color-scheme: light;
}
html[data-theme="light"] .route-header {
  background: #ffffff;
  color: var(--fg);
}
html[data-theme="light"] .route-mobile-menu nav { box-shadow: 0 12px 40px rgba(40, 24, 20, 0.16); }
html[data-theme="light"] .site-header { background: #f6f3f1; }
html[data-theme="light"] .route-header.site-header, html[data-theme="light"] header.route-header { background: #ffffff; }
html[data-theme="light"] .route-surface :focus-visible,
html[data-theme="light"] .route-header :focus-visible { outline-color: #c41e1a; }

/* Genel bileşenler */
html[data-theme="light"] .btn-ghost { color: var(--fg); border-color: var(--border); }
html[data-theme="light"] .region-search-field { border-color: #b9aeaa; background: var(--card); }
html[data-theme="light"] .home-search .region-options,
html[data-theme="light"] .region-options { box-shadow: 0 8px 28px rgba(40, 24, 20, 0.14); }
html[data-theme="light"] .ride-more-invitation { background: linear-gradient(180deg, rgba(246, 243, 241, 0.15), rgba(246, 243, 241, 0.92) 75%); }
html[data-theme="light"] .has-preview .feed-gate-message { background: linear-gradient(transparent, rgba(246, 243, 241, 0.75) 45%, var(--bg)); }

/* Ana sayfa */
html[data-theme="light"] .community-home :focus-visible { outline-color: #c41e1a; }
html[data-theme="light"] .home-feature-label { color: #b01d19; }
html[data-theme="light"] .home-feature-copy > p { color: #4c4245; }
html[data-theme="light"] .home-feature-actions a:not(.btn) { color: #2a2224; }
html[data-theme="light"] .home-feature-map { background: #fbeeed; border-color: #efcac6; }
html[data-theme="light"] .home-feature-map .home-feature-copy > p { color: #4c3a3b; }
html[data-theme="light"] .home-feature-navigation { background: #ffffff; }
html[data-theme="light"] .home-feature-planning { background: #fdf3f1; border-color: #eccfcb; }
html[data-theme="light"] .home-phone-device { box-shadow: 0 0 0 1px #c9bdc0, 0 16px 32px rgba(40, 24, 20, 0.22); }
html[data-theme="light"] .home-phone-visual figcaption { color: #6d5f62; }

/* Editoryal not ve satış ortağı kartları */
html[data-theme="light"] .ride-editorial { background: #fdf1ef; border-color: #f0cdc8; color: var(--fg); }
html[data-theme="light"] .ride-editorial .ride-editorial-label { color: #b01d19; }
html[data-theme="light"] .ride-editorial .ride-editorial-context,
html[data-theme="light"] .ride-editorial .ride-editorial-checked { color: #6b5b5f; }
html[data-theme="light"] .ride-editorial-sources a,
html[data-theme="light"] .ride-editorial-more { color: #9c1b17; }
html[data-theme="light"] .ride-editorial-more:focus-visible { outline-color: #c41e1a; }
html[data-theme="light"] .affiliate-offer { background: #ffffff; border-color: #e5d6d4; }
html[data-theme="light"] .affiliate-offer p { color: #5a4f52; }

/* Keşif haritası ve topluluk listesi */
html[data-theme="light"] .route-surface .map-result[aria-pressed=true] { background: #fbecea; border-color: #e3a8a2; }
html[data-theme="light"] .route-surface .map-filter-chip.is-filtered { background: #fbecea; }
html[data-theme="light"] .route-surface .map-hint { background: rgba(255, 255, 255, 0.94); color: #4f4548; border-color: var(--border); }
html[data-theme="light"] .route-surface .community-map-feedback { background: rgba(255, 255, 255, 0.92); }
html[data-theme="light"] .route-surface .map-results-scroll { scrollbar-color: #c9bdb8 transparent; }

/* Sürüş detayı */
html[data-theme="light"] .ride-next { background: #fbeeed; color: var(--fg); }
html[data-theme="light"] .route-detail :is(button, a, summary, input):focus-visible { outline-color: #c41e1a; }
html[data-theme="light"] .route-surface .photo-view-dialog { background: #ffffff; color: var(--fg); }

/* Manuel rota planlayıcı */
html[data-theme="light"] .manual-planner { --bg: #f4f1ee; --card: #ffffff; --border: #ddd5d1; }
html[data-theme="light"] .manual-planner button,
html[data-theme="light"] .manual-planner input,
html[data-theme="light"] .manual-planner select,
html[data-theme="light"] .manual-planner textarea { background: #ffffff; color: var(--fg); border-color: #d3cac6; }
html[data-theme="light"] .manual-planner button:hover { background: #f1ebe8; }
html[data-theme="light"] .manual-planner :focus-visible { outline-color: #c41e1a; }
html[data-theme="light"] .manual-planner label { color: #4f4548; }
html[data-theme="light"] .manual-planner input::placeholder,
html[data-theme="light"] .manual-planner textarea::placeholder { color: #8a7f7c; }
html[data-theme="light"] .manual-planner .planner-primary { background: #c41e1a; border-color: #c41e1a; color: #ffffff; }
html[data-theme="light"] .manual-planner .planner-primary:hover { background: #a91a16; }
html[data-theme="light"] .manual-planner .planner-primary:disabled { background: #e3b7b4; border-color: #e3b7b4; }
html[data-theme="light"] .planner-header { background: #ffffff; border-color: var(--border); }
html[data-theme="light"] .planner-header-label { color: #6b6062; }
html[data-theme="light"] .planner-panel { background: #faf8f6; scrollbar-color: #cdc3bf transparent; }
html[data-theme="light"] .planner-intro .planner-eyebrow { color: #b01d19; }
html[data-theme="light"] .planner-empty { border-color: #cfc5c1; color: #6b6062; }
html[data-theme="light"] .planner-stops { scrollbar-color: #cdc3bf transparent; }
html[data-theme="light"] .planner-stop { background: #ffffff; }
html[data-theme="light"] .planner-stop.is-selected { border-color: #c41e1a; background: #fdf0ee; }
html[data-theme="light"] .planner-stop.is-drop-target { outline-color: #c41e1a; }
html[data-theme="light"] .planner-stop-index { border-color: #b9afab; color: #2a2224; }
html[data-theme="light"] .planner-stop:first-child .planner-stop-index { color: #157a45; border-color: #79b894; }
html[data-theme="light"] .planner-stop-editor { background: #ffffff; border-color: #ddd5d1 !important; }
html[data-theme="light"] .manual-planner .planner-error,
html[data-theme="light"] .planner-calculation #planner-status.is-error { color: #b3241e; }
html[data-theme="light"] .planner-calculation #planner-status { color: #4f4548; }
html[data-theme="light"] .manual-planner #planner-check-auth { color: #2a2224; }
html[data-theme="light"] .planner-metrics span { color: #6b6062; }
html[data-theme="light"] .planner-share-result { background: #fdf3f1; border-color: #eccfcb !important; }
html[data-theme="light"] .planner-notice { background: #fbf4ea; border-color: #e8d4bb; }
html[data-theme="light"] .planner-map-panel { background: #e8e5e0; }
html[data-theme="light"] .planner-map-toolbar p,
html[data-theme="light"] .planner-map-toolbar button,
html[data-theme="light"] .planner-map-legend,
html[data-theme="light"] .manual-planner .planner-map-toolbar #planner-map-style { background: rgba(255, 255, 255, 0.94); border-color: #d6cdc9; color: var(--fg); box-shadow: 0 4px 16px rgba(40, 24, 20, 0.12); }
html[data-theme="light"] .planner-map-message { background: #ffffff; }
html[data-theme="light"] .planner-map-message span { color: #6b6062; }
html[data-theme="light"] #planner-confirm { background: #ffffff; border-color: #ddd5d1; color: var(--fg); }
html[data-theme="light"] #planner-confirm p { color: #5a4f52; }
html[data-theme="light"] .manual-planner #planner-trip-summary { background: #fdf3f1; }

/* İndirme sayfası */
html[data-theme="light"],
html[data-theme="light"] body.download-page { background: var(--bg); }
html[data-theme="light"] .download-intro,
html[data-theme="light"] .download-home { color: #5a4f52; }
html[data-theme="light"] .download-home:hover { color: #1c1718; }
html[data-theme="light"] .download-brand { color: #b01d19; }
html[data-theme="light"] .download-action-secondary { background: #ffffff; border-color: #d6cdc9; color: #1c1718; }
html[data-theme="light"] .download-action:focus-visible,
html[data-theme="light"] .download-home:focus-visible { outline-color: #c41e1a; }

/* Form sayfaları */
html[data-theme="light"] .field-error,
html[data-theme="light"] .form-message { color: #b3241e; }
html[data-theme="light"] .partner-main input:not([type=checkbox]),
html[data-theme="light"] .partner-main textarea,
html[data-theme="light"] .partner-main select { background: #ffffff; border-color: #c9bfbb; color: var(--fg); }
html[data-theme="light"] .partner-main input::placeholder,
html[data-theme="light"] .partner-main textarea::placeholder { color: #8a7f7c; }
html[data-theme="light"] .submission-card { box-shadow: 0 26px 70px -48px rgba(40, 24, 20, 0.35); }

/* =====================================================================
   KOYU TEMA — açık tasarlanmış sayfalar (Günlüğüm)
   ===================================================================== */
html[data-theme="dark"] .member-page {
  --paper: #0f0d0e;
  --ink: #f4efee;
  --muted: #b3a7a4;
  --line: #352d2f;
  --red: #ef6259;
  --muted-fg: #b3a7a4;
  --secondary: #241f21;
  --card: #1a1617;
  --primary-bright: #ef6259;
  color-scheme: dark;
}
html[data-theme="dark"] .member-page button,
html[data-theme="dark"] .member-header,
html[data-theme="dark"] .member-login,
html[data-theme="dark"] .member-tabs button[aria-current="page"],
html[data-theme="dark"] .journal-item,
html[data-theme="dark"] .map-selection,
html[data-theme="dark"] .member-page input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html[data-theme="dark"] .member-page select,
html[data-theme="dark"] .member-page textarea { background: #1a1617; color: var(--ink); }
html[data-theme="dark"] .member-map-shell,
html[data-theme="dark"] .member-speed-map { background: #1d1a1b; }
html[data-theme="dark"] .member-ride-meta span { background: #2a2426; }
html[data-theme="dark"] .member-page .member-error { color: #ff9a90; }
html[data-theme="dark"] .member-page :focus-visible { outline-color: #8fb4ff; }
html[data-theme="dark"] .member-page .oauth-apple { background: #f4efee; border-color: #f4efee; color: #151515; }
html[data-theme="dark"] .profile-cursor { stroke: #e9e2e0; }
html[data-theme="dark"] .profile-peak { stroke: #1a1617; }
html[data-theme="dark"] .member-page .mapboxgl-popup-content { color: #211f1e; }

/* Eski içerik sayfalarının başlığı dar ekranda iki satıra iner; düğme marka satırında kalır. */
.site-header:not(.route-header) .wrap { position: relative; }
.site-header:not(.route-header) .wrap > .theme-toggle { margin-left: auto; }
@media (max-width: 620px) {
  .site-header:not(.route-header) .wrap > .theme-toggle { position: absolute; top: 10px; right: 24px; width: 38px; height: 38px; }
}
.member-header .theme-toggle { margin-left: 12px; }

/* İndirme sayfası bilinçli olarak betiksizdir: tema yalnız sistem tercihini izler. */
@media (prefers-color-scheme: light) {
  html:not([data-theme]), html:not([data-theme]) body { background: #f6f3f1; color: #1c1718; color-scheme: light; }
  html:not([data-theme]) .download-intro, html:not([data-theme]) .download-home { color: #5a4f52; }
  html:not([data-theme]) .download-home:hover { color: #1c1718; }
  html:not([data-theme]) .download-brand { color: #b01d19; }
  html:not([data-theme]) .download-action-secondary { background: #ffffff; border-color: #d6cdc9; color: #1c1718; }
}
