/* Ortak temel + bileşenler (site ve panel). Sayfaya özel stiller kendi dosyalarında. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0 0 var(--space-3); line-height: 1.1; font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0 0 var(--space-4); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }
::selection { background: var(--yellow); color: var(--ink); }
[hidden] { display: none !important; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.01em; text-transform: uppercase; line-height: 0.95; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-3); top: -60px; z-index: 1000;
  background: var(--ink); color: var(--yellow); padding: 10px 14px; border-radius: var(--radius-sm);
  font-weight: 700; text-decoration: none; transition: top var(--dur) var(--ease-out);
}
.skip-link:focus { top: var(--space-3); }

/* ---------- düğmeler ---------- */
.btn {
  --btn-bg: var(--yellow);
  --btn-fg: var(--ink);
  --btn-border: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border: 2px solid var(--btn-border); border-radius: var(--radius-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 800; font-size: var(--fs-md); letter-spacing: 0.01em;
  text-decoration: none; cursor: pointer; user-select: none; white-space: nowrap;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background-color var(--dur-fast);
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--ink); }
.btn--dark { --btn-bg: var(--ink); --btn-fg: var(--yellow); box-shadow: 3px 3px 0 var(--yellow-700); }
.btn--dark:hover { box-shadow: 5px 5px 0 var(--yellow-700); }
.btn--light { --btn-bg: var(--surface); }
.btn--ghost { --btn-bg: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--yellow-100); box-shadow: none; transform: none; }
.btn--danger { --btn-bg: var(--red); --btn-fg: #fff; }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: var(--fs-sm); box-shadow: 2px 2px 0 var(--ink); }
.btn--lg { min-height: 58px; padding: 0 30px; font-size: var(--fs-lg); }
.btn--block { width: 100%; }
.btn--icon { width: 44px; padding: 0; }
.btn .spinner { width: 18px; height: 18px; }

/* ---------- form ---------- */
.field { display: grid; gap: 6px; margin-bottom: var(--space-4); }
.field > label, .field__label { font-weight: 700; font-size: var(--fs-sm); }
.field__hint { font-size: var(--fs-xs); color: var(--muted); }
.field__error { font-size: var(--fs-sm); color: var(--red); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 2px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 16px; /* iOS yakınlaştırmasın */
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.textarea { min-height: 96px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px var(--yellow-200); }
.input[aria-invalid='true'], .select[aria-invalid='true'] { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-100); }
.input--xl { min-height: 64px; font-size: 1.5rem; font-weight: 800; letter-spacing: 0.04em; }

.check { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; padding: 12px 0; cursor: pointer; }
.check input {
  appearance: none; width: 26px; height: 26px; margin: 0; border: 2px solid var(--ink); border-radius: 7px;
  background: var(--surface); display: grid; place-content: center; cursor: pointer;
  transition: background-color var(--dur-fast);
}
.check input::after {
  content: ''; width: 12px; height: 7px; border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink);
  transform: rotate(-45deg) scale(0); transform-origin: center; transition: transform var(--dur-fast) var(--ease-spring);
  margin-top: -3px;
}
.check input:checked { background: var(--yellow); }
.check input:checked::after { transform: rotate(-45deg) scale(1); }
.check input[aria-invalid='true'] { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-100); }
.check__text { font-size: var(--fs-sm); line-height: 1.5; }

/* ---------- kart, rozet, uyarı ---------- */
.card {
  background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius);
  padding: var(--space-5); box-shadow: var(--shadow-hard);
}
.card--soft { border: 1px solid var(--line); box-shadow: var(--shadow); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 800; letter-spacing: 0.02em;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge--yellow { background: var(--yellow); border-color: var(--ink); color: var(--ink); }
.badge--green { background: var(--green-100); border-color: transparent; color: var(--green); }
.badge--red { background: var(--red-100); border-color: transparent; color: var(--red); }
.badge--blue { background: var(--blue-100); border-color: transparent; color: var(--blue); }
.badge--orange { background: var(--orange-100); border-color: transparent; color: var(--orange); }
.badge--dark { background: var(--ink); border-color: var(--ink); color: var(--yellow); }

.alert {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start;
  padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface-2); font-size: var(--fs-sm);
}
.alert::before { content: 'i'; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--yellow); font-weight: 800; font-size: 13px; }
.alert--warn { background: var(--orange-100); border-color: #f3c793; }
.alert--warn::before { content: '!'; background: var(--orange); color: #fff; }
.alert--error { background: var(--red-100); border-color: #f1b3ad; }
.alert--error::before { content: '!'; background: var(--red); color: #fff; }
.alert--ok { background: var(--green-100); border-color: #a9dcb8; }
.alert--ok::before { content: '✓'; background: var(--green); color: #fff; }

/* ---------- tablo ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: var(--surface-2); font-weight: 800; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); white-space: nowrap; position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--yellow-50); }
.table .r { text-align: right; }

/* ---------- diyalog ---------- */
dialog.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0;
  border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-lg); background: var(--surface); color: var(--ink);
}
dialog.dialog::backdrop { background: rgb(23 19 11 / 0.55); backdrop-filter: blur(3px); }
dialog.dialog[open] { animation: dialog-in var(--dur) var(--ease-out); }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog__head h2 { margin: 0; font-size: var(--fs-lg); }
.dialog__body { padding: 20px; overflow-y: auto; max-height: calc(100dvh - 180px); }
.dialog__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

/* ---------- bildirim (toast) ---------- */
.toasts { position: fixed; z-index: 2000; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--ink); color: #fff;
  box-shadow: var(--shadow-lg); font-weight: 600; font-size: var(--fs-sm); display: flex; gap: 10px; align-items: center;
  animation: toast-in var(--dur) var(--ease-out);
}
.toast--ok { border-left: 6px solid #4ade80; }
.toast--error { border-left: 6px solid #f87171; }
.toast--warn { border-left: 6px solid var(--yellow); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } }

/* ---------- yükleniyor ---------- */
.spinner { width: 28px; height: 28px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--yellow-50) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-sm); min-height: 18px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; padding: var(--space-7) var(--space-4); color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: var(--fs-lg); margin-bottom: 6px; }

/* ---------- kaydırınca belirme (JS: [data-reveal] -> .is-visible) ---------- */
[data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); transition-delay: var(--reveal-delay, 0ms); }
[data-reveal].is-visible { opacity: 1; transform: none; }
[data-reveal='left'] { transform: translateX(-36px); }
[data-reveal='right'] { transform: translateX(36px); }
[data-reveal='zoom'] { transform: scale(0.92); }
@media (prefers-reduced-motion: reduce) { [data-reveal] { opacity: 1; transform: none; transition: none; } }
.no-js [data-reveal] { opacity: 1; transform: none; }
