/*
 * Tasarım token'ları.
 *
 * Kaynak: Xudbin paneli (apps/web/src/index.css) ve xudbin sitesi. Renkler
 * panelle aynı; Less kartvizitinden gelen eski kimlik kaldırıldı.
 *
 *   #1b1a1c  koyu zemin        #232224  yükseltilmiş yüzey
 *   #343236  koyu çizgi        #edebec  koyu zeminde metin
 *   #f7f7f6  açık tuval        #b4233a  lal kırmızısı (tek vurgu)
 *
 * Yüzeyler koyu (üst şerit, giriş, künye, panel rayı), katalog tuvali açık
 * ki 55 ürünün ekran görüntüsü doğru okunsun; lal kırmızısı tek eylem rengi.
 *
 * Erişilebilirlik: vurgunun üç tonu var, her birinin işi ayrı:
 *   --brand        #e5525d  KOYU zeminde metin ve ikon, çizgi, çip
 *   --brand-deep   #b4233a  düğme dolgusu, üstünde beyaz metin
 *   --brand-text   #a01f35  AÇIK zeminde metin ve bağlantı
 */

:root {
  color-scheme: light;

  /* --- Kömür: karttan ------------------------------------------------- */
  --coal: #1b1a1c;
  --coal-deep: #141315;
  --coal-raise: #232224;
  --coal-rule: #343236;
  --coal-text: #edebec;
  --coal-muted: #a9a4a7;

  /* --- Açık tuval ------------------------------------------------------ */
  --paper: #f7f7f6;
  --surface: #ffffff;
  --wash: #f1f0ef;
  --ink: #1b1a1c;
  --ink-soft: #3a3638;
  --muted: #5f5a5c;
  --faint: #767073;  /* açık zeminde 4,5:1 (WCAG AA); eskisi #a9a4a7 2,3:1'di */
  --rule: #e5e3e2;
  --rule-strong: #d2cfcd;

  /* --- Lal kırmızısı: tek vurgu ---------------------------------------------- */
  --brand: #e5525d;
  --brand-deep: #b4233a;
  --brand-darker: #9b1c31;
  --brand-bright: #ec6b74;
  --brand-text: #a01f35;
  --brand-soft: #f9e8ea;
  --brand-line: #f0c9cf;

  /* Ürün paleti çipleri ve numune renkleri buradan gelir. */
  --product-accent: var(--brand-deep);

  /* Alet yüzeyleri (özelleştirici, yönetim rayı) koyu yüzey. */
  --tool-bg: var(--coal-deep);
  --tool-surface: var(--coal);
  --tool-raise: var(--coal-raise);
  --tool-rule: var(--coal-rule);
  --tool-text: var(--coal-text);
  --tool-muted: var(--coal-muted);

  /* --- Anlamsal --------------------------------------------------------- */
  --ok: #2f6f4e;
  --ok-soft: #e7f1eb;
  --warn: #96650d;
  --warn-soft: #f8f0dd;
  --err: #b4233a;
  --err-soft: #f9e8ea;
  --info: var(--brand-text);
  --info-soft: var(--brand-soft);

  /* --- Tipografi -------------------------------------------------------- */
  /*
   * Kelime işareti uzun ve daraltılmış. Başlıklar bunu Archivo'nun genişlik
   * ekseniyle yankılıyor (wdth 88, ağırlık 700); ayrı bir "grunge" font
   * aranmadı, çünkü kelime işaretinin dokusu tek seferlik ve taklidi ucuz
   * durur. Gövde Inter.
   */
  --font: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;

  --w-narrow: 84;
  --w-display: 88;
  --w-normal: 100;

  --t-display: clamp(2.6rem, 5.2vw, 4.5rem);
  --t-h1: clamp(2rem, 3.6vw, 3rem);
  --t-h2: clamp(1.75rem, 3vw, 2.5rem);
  --t-h3: 1.1875rem;
  --t-body: 1rem;
  --t-small: 0.9375rem;
  --t-caption: 0.8125rem;

  /* --- Boşluk ----------------------------------------------------------- */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --s9: 96px; --s10: 128px; --s11: 176px;

  /* --- Düzen ------------------------------------------------------------ */
  --paper-width: 1320px;
  --measure: 66ch;
  --gutter: 20px;
  --masthead-h: 72px;

  /* --- Biçim: kart köşeli, hap yok ------------------------------------- */
  /* Xudbin kimliği yuvarlak köşeli (panelle aynı); eski kesik köşe kaldırıldı.
     Pah büyüklüğü tek yerde tanımlı ve clip-path'lerde kullanılıyor. */
  --chamfer: 0px;
  --chamfer-sm: 0px;
  --r-touch: 8px;
  --r-card: 10px;
  --r-panel: 12px;
  --r-field: 8px;

  /* --- Yükseklik: gölge vurgunun değil koyu zeminin gölgesi ----------------- */
  --shadow-sm: 0 1px 2px rgb(27 26 28 / 0.06);
  --shadow-card: 0 1px 3px rgb(27 26 28 / 0.06), 0 12px 28px -14px rgb(27 26 28 / 0.34);
  --shadow-lift: 0 2px 6px rgb(27 26 28 / 0.08), 0 26px 48px -18px rgb(27 26 28 / 0.42);
  --shadow-float: 0 24px 60px -20px rgb(27 26 28 / 0.4);
  --glow-brand: 0 8px 22px -10px rgb(180 35 58 / 0.7);

  /* --- Hareket ---------------------------------------------------------- */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-micro: 140ms;
  --t-normal: 260ms;
  --t-macro: 520ms;

  /* --- Katman sırası ---------------------------------------------------- */
  --z-sticky: 20;
  --z-drawer: 40;
  --z-float: 60;
  --z-toast: 80;
}

/*
 * Koyu tema: xudbin.com ve panelle aynı değerler. Yalnızca açık tuvalin
 * token'ları değişiyor; kömür yüzeyler (şerit, künye, alet rayı) zaten koyu.
 * Kömür bantlar koyu tuvalden ayrılsın diye tuval bir ton aşağıda.
 */
:root[data-theme="dark"] {
  color-scheme: dark;

  --paper: #161517;
  --surface: #1f1e20;
  --wash: #262528;
  --ink: #edebec;
  --ink-soft: #cfcbcd;
  --muted: #a9a4a7;
  --faint: #8a8589;
  --rule: #343236;
  --rule-strong: #444146;

  --brand-text: #ec6b74;
  --brand-soft: #3a2326;
  --brand-line: #5a2d33;

  --ok: #62c08a;
  --ok-soft: #1d2e24;
  --warn: #e2a640;
  --warn-soft: #33291a;
  --err: #ec6b74;
  --err-soft: #3a2326;

  --masthead-bg: rgb(22 21 23 / 0.82);

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow-card: 0 1px 3px rgb(0 0 0 / 0.3), 0 12px 28px -14px rgb(0 0 0 / 0.6);
  --shadow-lift: 0 2px 6px rgb(0 0 0 / 0.35), 0 26px 48px -18px rgb(0 0 0 / 0.7);
  --shadow-float: 0 24px 60px -20px rgb(0 0 0 / 0.7);
  --glow-brand: 0 8px 22px -10px rgb(229 82 93 / 0.55);
}

@media (min-width: 768px) { :root { --gutter: 32px; } }
@media (min-width: 1280px) { :root { --gutter: 40px; } }

@view-transition { navigation: auto; }

/* --- Taban -------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-block-start: calc(var(--masthead-h) + var(--s5));
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "wdth" var(--w-display);
  letter-spacing: -0.02em;
  line-height: 1.12;
  text-wrap: balance;
}

h1 { font-size: var(--t-h1); line-height: 1.04; letter-spacing: -0.03em; }
h2 { font-size: var(--t-h2); line-height: 1.08; letter-spacing: -0.028em; }
h3 { font-size: var(--t-h3); line-height: 1.3; letter-spacing: -0.015em; font-variation-settings: "wdth" 94; }

p { margin: 0; max-width: var(--measure); }
a { color: inherit; text-underline-offset: 0.18em; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

::selection { background: var(--brand); color: #fff; }

.data { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.ink-soft { color: var(--ink-soft); }

/* --- Düzen kabuğu ------------------------------------------------------- */

.paper {
  width: 100%;
  max-width: var(--paper-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/*
 * Kömür yüzey. Kartın köşeli panelleri iki çok düşük opaklıklı eğik lekeyle
 * yankılanıyor: doku okunuyor ama metnin okunmasını engellemiyor.
 */
.coal {
  position: relative;
  isolation: isolate;
  background: var(--coal);
  color: var(--coal-text);
}

.coal::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(112deg, transparent 0 12%, rgb(255 255 255 / 0.022) 12% 34%, transparent 34%),
    linear-gradient(248deg, transparent 0 58%, rgb(255 255 255 / 0.03) 58% 82%, transparent 82%);
  pointer-events: none;
}

.coal h1, .coal h2, .coal h3 { color: #fff; }
.coal p, .coal li { color: rgb(237 235 236 / 0.72); }
.coal .muted { color: var(--coal-muted); }

/*
 * İmza öge: bölüm başlığının üstündeki vurgu çizgisi. Bölüm başlıklarının
 * altında ve künyede aynı biçimde kullanılıyor.
 */
.rule-mark {
  width: 68px;
  height: 5px;
  background: var(--brand);
  clip-path: none; border-radius: 6px;
}

/* --- Düğmeler ----------------------------------------------------------- */

/*
 * Pah, kimliğin biçim imzası. Odak halkası clip-path tarafından kırpıldığı
 * için düğmede kırpma YOK: pah, iç gölge çiftiyle çiziliyor. Böylece hem
 * köşeli duruyor hem klavye odağı görünür kalıyor.
 */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 48px;
  padding: 0 var(--s6);
  border: 1px solid transparent;
  border-radius: var(--r-touch);
  background: var(--brand-deep);
  color: #fff;
  box-shadow: var(--glow-brand);
  font: inherit;
  font-size: var(--t-small);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-micro) var(--ease),
              border-color var(--t-micro) var(--ease),
              box-shadow var(--t-normal) var(--ease),
              transform var(--t-micro) var(--ease),
              color var(--t-micro) var(--ease);
}

.btn:hover { background: var(--brand-darker); transform: translateY(-1px); box-shadow: 0 12px 26px -10px rgb(180 35 58 / 0.8); }
.btn:active { transform: translateY(1px); box-shadow: var(--glow-brand); }

.btn--quiet {
  background: var(--surface);
  border-color: var(--rule-strong);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.btn--quiet:hover { background: var(--surface); border-color: var(--brand); color: var(--brand-text); box-shadow: var(--shadow-card); }

/* Kömür dolgu: koyu ve nötr ana eylem, ürün bağlamı olmayan ekranlarda. */
.btn--coal { background: var(--coal); border-color: var(--coal); color: #fff; box-shadow: var(--shadow-card); }
.btn--coal:hover { background: var(--coal-deep); border-color: var(--coal-deep); box-shadow: var(--shadow-lift); }

/* Yumuşak vurgu rozeti düğmesi. */
.btn--soft { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-text); box-shadow: none; }
.btn--soft:hover { background: #f7e2e1; box-shadow: none; }

/* Koyu zemin üstünde ikincil. */
.btn--ghost { background: rgb(255 255 255 / 0.06); border-color: rgb(255 255 255 / 0.24); color: #fff; box-shadow: none; }
.btn--ghost:hover { background: rgb(255 255 255 / 0.14); border-color: rgb(255 255 255 / 0.55); box-shadow: none; }

.btn--text {
  min-height: auto;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--brand-text);
  font-weight: 600;
}

.btn--text:hover { background: none; box-shadow: none; transform: none; color: var(--brand-darker); text-decoration: underline; }
.btn--text:active { transform: none; }
.coal .btn--text, .colophon .btn--text { color: var(--brand); }
.coal .btn--text:hover, .colophon .btn--text:hover { color: var(--brand-bright); }

.btn--small { min-height: 40px; padding-inline: var(--s5); font-size: var(--t-caption); }
.btn--large { min-height: 54px; padding-inline: var(--s7); font-size: 1rem; }
.btn--wide { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

/* --- Rozet: kesik köşeli, karttaki panel biçimi ------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 7px var(--s4);
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: var(--t-caption);
  font-weight: 600;
  clip-path: none; border-radius: 6px;
}

.badge i { color: var(--brand); }
.badge--ghost { background: rgb(229 82 93 / 0.16); color: var(--brand); }
.badge--ghost i { color: var(--brand); }
.badge--neutral { background: var(--wash); color: var(--ink-soft); }

/* --- Form alanları ------------------------------------------------------ */

.field {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--s4);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-field);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-small);
  transition: border-color var(--t-micro) var(--ease), box-shadow var(--t-micro) var(--ease);
}

textarea.field { min-height: 120px; padding-block: var(--s3); line-height: 1.55; resize: vertical; }
.field::placeholder { color: var(--faint); }
.field:hover { border-color: var(--muted); }
.field:focus { outline: none; border-color: var(--brand-deep); box-shadow: 0 0 0 3px rgb(229 82 93 / 0.2); }

select.field {
  appearance: none;
  padding-inline-end: var(--s7);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right var(--s4) center, right calc(var(--s4) - 5px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--brand-deep);
  outline-offset: 2px;
  border-radius: 2px;
}

.coal :where(a, button, summary, [tabindex]):focus-visible,
.colophon :where(a, button):focus-visible { outline-color: var(--brand-bright); }

/* --- Erişilebilirlik ---------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: fixed;
  inset-block-start: var(--s3);
  inset-inline-start: var(--s3);
  z-index: var(--z-toast);
  padding: var(--s3) var(--s5);
  border-radius: var(--r-touch);
  background: var(--coal);
  color: #fff;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip:focus-visible { transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
