/* ==============================================
   BASE.CSS — TilbeHome Pro
   Reset, typography, containers, utility.
   Loads after tokens.css, before legacy.css.
   Uses --th-* token system exclusively.
   ============================================== */

/* ── Box Model Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ── Body Defaults ── */
body {
  margin: 0;
  font-family: var(--th-font-primary);
  font-size: var(--th-text-base);
  line-height: var(--th-leading-normal);
  color: var(--th-color-text);
  background-color: var(--th-color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

/* ── Typography Scale ── */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: var(--th-space-3);
  font-weight: var(--th-font-bold);
  line-height: var(--th-leading-tight);
  color: var(--th-color-text);
}
h1 { font-size: var(--th-text-2xl); }
h2 { font-size: var(--th-text-xl); }
h3 { font-size: var(--th-text-lg); }
h4 { font-size: var(--th-text-md); }
h5 { font-size: var(--th-text-base); }
h6 { font-size: var(--th-text-sm); }

p { margin-top: 0; margin-bottom: var(--th-space-3); }

a {
  color: var(--th-color-text-link);
  text-decoration: none;
  transition: var(--th-transition-fast);
}
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ── Focus Visible (A11y) ── */
:focus-visible {
  outline: var(--th-focus-ring-width) var(--th-focus-ring-style) var(--th-focus-ring-color);
  outline-offset: var(--th-focus-ring-offset);
}

/* ── Selection ── */
::selection {
  background: var(--th-color-primary);
  color: var(--th-color-text-inverse);
}

/* ── Container ── */
.container-fluid { width: 100%; padding-left: var(--th-space-4); padding-right: var(--th-space-4); }

/* ── Utility: Display ── */
.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Utility: Spacing ── */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.p-0 { padding: 0; }

/* ── Utility: Text ── */
.text-center { text-align: center; }
.text-muted { color: var(--th-color-text-muted); }
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Utility: Flex ── */
.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: var(--th-space-2); }
.gap-3 { gap: var(--th-space-3); }
.gap-4 { gap: var(--th-space-4); }
.flex-wrap { flex-wrap: wrap; }

/* ── Utility: Grid column (from shadow S10) ── */
.col-xl-custom-5 {
  flex: 0 0 20%;
  max-width: 20%;
}

/* ── Smooth Scroll ── */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   BOLUM 8: MICRO DETAILS & POLISH
   ═══════════════════════════════════════════════════════════════════ */

/* ── 8A: Custom Scrollbar ── */
::-webkit-scrollbar { width: var(--th-scrollbar-width); }
::-webkit-scrollbar-track { background: var(--th-scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--th-scrollbar-thumb); border-radius: var(--th-scrollbar-radius); }
::-webkit-scrollbar-thumb:hover { background: var(--th-scrollbar-thumb-hover); }
* { scrollbar-width: thin; scrollbar-color: var(--th-scrollbar-thumb) var(--th-scrollbar-track); }

/* ── 8D: Image Drag Prevention ── */
.th2-card__image img,
.pdp2-gallery img,
.tilbe-anasayfa01-image img {
  -webkit-user-drag: none;
  user-select: none;
}

/* ── 8E: Mobile Tap Highlight ── */
* { -webkit-tap-highlight-color: transparent; }

/* ── 8F: Print Styles ── */
@media print {
  .tilbehead19-header,
  .tf2-footer,
  .th2-mobile-bottom-bar,
  .th2-wa-widget,
  .th2-scroll-top,
  .th2-cookie-banner,
  .th2-compare-bar,
  .overlay { display: none !important; }
  body { background: #fff !important; color: #000 !important; font-size: 12pt; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #666; }
  .th2-card,
  .tilbe-anasayfa01-card-product { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
  img { max-width: 100% !important; }
}

/* ── 8G: Global Spin Animation ── */
@keyframes th2-spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════════
   BOLUM 7: CROSS-BROWSER FALLBACKS
   ═══════════════════════════════════════════════════════════════════ */

/* ── 7A: Safari aspect-ratio fallback ── */
@supports not (aspect-ratio: 1/1) {
  .th2-card__image { padding-top: 100%; position: relative; }
  .th2-card__image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
}

/* ── 7A: Safari gap fallback ── */
@supports not (gap: 1px) {
  .th2-flex > * + * { margin-left: var(--th-space-2); }
}

/* ── 7A: Safari :focus-visible fallback ── */
@supports not selector(:focus-visible) {
  :focus { outline: var(--th-focus-ring-width) var(--th-focus-ring-style) var(--th-focus-ring-color); outline-offset: var(--th-focus-ring-offset); }
}
