/* ==========================================================================
   Legichain — base: reset, tipografi, düzen yardımcıları
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  min-height: 100dvh;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

body.is-locked { overflow: hidden; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
svg[hidden], .svg-sprite { display: none !important; }
[hidden] { display: none !important; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled, button[aria-disabled='true'] { cursor: not-allowed; }

/* Türkçe: locale-aware büyük harf dönüşümü */
:lang(tr) { text-transform: none; }

/* --- Odak: klavye için görünür ring (DS 4.2) --- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

::selection { background: var(--accent-subtle); color: var(--text-primary); }

/* --- Metin öğeleri --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text-primary);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

h1, .t-h1 { font-size: var(--text-h1); line-height: var(--lh-h1); letter-spacing: var(--tracking-h1); }
h2, .t-h2 { font-size: var(--text-h2); line-height: var(--lh-h2); letter-spacing: var(--tracking-h2); }
h3, .t-h3 { font-size: var(--text-h3); line-height: var(--lh-h3); letter-spacing: var(--tracking-h3); }
h4, .t-h4 { font-size: var(--text-h4); line-height: var(--lh-h4); letter-spacing: var(--tracking-h4); font-weight: 500; }

.t-display {
  font-size: var(--text-display);
  line-height: var(--lh-display);
  letter-spacing: var(--tracking-display);
  font-weight: 500;
}
.t-lead { font-size: var(--text-lead); line-height: var(--lh-lead); color: var(--text-secondary); }
.t-body { font-size: var(--text-body); line-height: var(--lh-body); }
.t-ui { font-size: var(--text-ui); line-height: var(--lh-ui); }
.t-label { font-size: var(--text-label); line-height: var(--lh-label); font-weight: 500; }
.t-caption { font-size: var(--text-caption); line-height: var(--lh-caption); color: var(--text-muted); }
.t-mono { font-family: var(--font-mono); font-size: var(--text-code); line-height: var(--lh-code); }
.t-kpi { font-size: var(--text-kpi); line-height: var(--lh-kpi); letter-spacing: var(--tracking-kpi); font-weight: 500; font-variant-numeric: tabular-nums; }
.t-secondary { color: var(--text-secondary); }
.t-muted { color: var(--text-muted); }
.t-strong { font-weight: 700; }
.t-medium { font-weight: 500; }
.t-num { font-variant-numeric: tabular-nums; }

p { max-width: var(--measure); }
p:empty { display: none; }

a {
  color: var(--accent-fg);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  transition: color var(--motion-fast) var(--ease-standard);
}
a:hover { text-decoration-thickness: 2px; }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: var(--text-code); line-height: var(--lh-code); }
code:not(pre code) {
  padding: .05em .35em;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--code-fg);
  font-size: .875em;
}

hr { border: 0; border-top: 1px solid var(--border-subtle); }

ul, ol { padding-inline-start: 1.25rem; }
ul.plain, ol.plain { list-style: none; padding: 0; }

table { border-collapse: collapse; border-spacing: 0; font-variant-numeric: tabular-nums; }

/* --- Erişilebilirlik yardımcıları --- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  top: -100px; left: var(--gutter);
  z-index: var(--z-toast);
  padding: .625rem 1rem;
  background: var(--surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-overlay);
  text-decoration: none;
  font-weight: 500;
}
.skip-link:focus-visible { top: .75rem; }

/* --- Düzen --- */
.container {
  width: 100%;
  max-width: calc(var(--container-max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: calc(52rem + var(--gutter) * 2); }
.container--prose { max-width: calc(60rem + var(--gutter) * 2); }

.section { padding-block: var(--section-y); }
.section--lg { padding-block: var(--section-y-lg); }
.section--tight { padding-block: calc(var(--section-y) * .6); }
.section--subtle { background: var(--bg-subtle); }
.section--bordered { border-top: 1px solid var(--border-subtle); }

.grid {
  display: grid;
  gap: var(--grid-gap);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (min-width: 768px) { .grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(12, minmax(0, 1fr)); } }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--sm { gap: var(--space-2); }
.stack--lg { gap: var(--space-8); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.cluster--between { justify-content: space-between; }

.section-head { max-width: 46rem; margin-bottom: clamp(2rem, 1.5rem + 2vw, 3.5rem); }
.section-head > * + * { margin-top: var(--space-4); }
.section-head .t-lead { max-width: var(--measure); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .625rem;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  line-height: var(--lh-label);
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: .02em;
}
.eyebrow::before {
  content: '';
  width: .5rem; height: .5rem;
  background: var(--accent-fg);
  border-radius: 1px;
  flex: none;
}

.measure { max-width: var(--measure); }
.measure-hero { max-width: var(--measure-hero); }

/* Küçük boşluk yardımcıları (spacing scale ile aynı adımlar) */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--space-1) !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-3 { margin-top: var(--space-3) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mt-8 { margin-top: var(--space-8) !important; }
.mb-3 { margin-bottom: var(--space-3) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mb-12 { margin-bottom: var(--space-12) !important; }
.ml-auto { margin-left: auto !important; }
.mx-auto { margin-inline: auto !important; }
.self-center { align-self: center !important; }
.justify-center { justify-content: center !important; }
.span-full { grid-column: 1 / -1 !important; }

.hidden-mobile { display: none !important; }
@media (min-width: 1024px) {
  .hidden-mobile { display: revert !important; }
  .hidden-desktop { display: none !important; }
}

/* Tek seferlik scroll reveal (isteğe bağlı, 8 px / 200 ms). İçerik JS
   olmadan görünür kalır: sınıf yalnız JS varsa eklenir. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--motion-base) var(--ease-standard), transform var(--motion-base) var(--ease-standard);
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
}
