/* Tasarım token'ları ve bileşenler — kaynak: docs/design/DESIGN.md */
:root {
  color-scheme: light dark;
  /* Renk — açık (kağıt + mürekkep + sinyal kırmızısı) */
  --bg: #f5f1e8;
  --surface: #fffdf8;
  --surface-2: #ebe5d6;
  --ink: #17140f;
  --ink-2: #4d463a;
  --line: #cfc6b2;
  --accent: #c8321a;
  --accent-hover: #a82812;
  --on-accent: #ffffff;
  --ok: #1b6b3a;
  --ok-bg: #e0f0e4;
  --err: #a4231a;
  --err-bg: #fbe4df;
  --info-bg: #ece7d8;
  --focus: #17140f;
  /* Tipografi */
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --fs-xs: 0.75rem; --fs-sm: 0.875rem; --fs-md: 1rem; --fs-lg: 1.25rem;
  --fs-xl: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  --fs-display: clamp(2.5rem, 1.4rem + 5vw, 5.25rem);
  /* Boşluk (4px tabanı) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  --sp-6: 32px; --sp-7: 48px; --sp-8: 72px;
  /* Köşe */
  --r-sm: 4px; --r-md: 8px; --r-lg: 14px;
  --border: 2px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --maxw: 1120px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120e;
    --surface: #1d1a14;
    --surface-2: #2a261d;
    --ink: #f3eee0;
    --ink-2: #b9b19d;
    --line: #4a4333;
    --accent: #ff6a4d;
    --accent-hover: #ff8a72;
    --on-accent: #14120e;
    --ok: #7fd49a;
    --ok-bg: #16301f;
    --err: #ff9a8c;
    --err-bg: #3a1b17;
    --info-bg: #2a261d;
    --focus: #f3eee0;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--fs-md)/1.6 var(--font-body);
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.05; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--sp-4); top: -80px; background: var(--ink); color: var(--bg); padding: var(--sp-3) var(--sp-4); z-index: 10; }
.skip:focus { top: var(--sp-4); }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--sp-4); }

/* Navigasyon */
.nav { border-bottom: var(--border); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: var(--sp-4); }
.brand { display: inline-flex; align-items: center; gap: var(--sp-3); font: 800 1.125rem/1 var(--font-display); text-decoration: none; min-height: 44px; }
.brand-mark { display: inline-flex; align-items: flex-end; gap: 2px; height: 22px; }
.brand-mark i { display: block; width: 4px; background: var(--accent); border-radius: 1px; }
.brand-mark i:nth-child(1) { height: 8px; } .brand-mark i:nth-child(2) { height: 22px; }
.brand-mark i:nth-child(3) { height: 14px; } .brand-mark i:nth-child(4) { height: 18px; } .brand-mark i:nth-child(5) { height: 6px; }
.nav-links { display: flex; gap: var(--sp-2); list-style: none; margin: 0; padding: 0; }
.nav-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--sp-3); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; border-radius: var(--r-sm); }
.nav-links a:hover, .nav-links a[aria-current="page"] { background: var(--surface-2); }

/* Hero */
.hero { padding: var(--sp-7) 0 var(--sp-6); }
.eyebrow { font: 500 var(--fs-xs)/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-2); display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--accent); }
.hero h1 { font-size: var(--fs-display); font-weight: 800; max-width: 12ch; overflow-wrap: anywhere; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: var(--fs-lg); color: var(--ink-2); max-width: 46ch; margin-top: var(--sp-5); line-height: 1.5; }

/* Dönüştürücü kartı */
.panel { background: var(--surface); border: var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: var(--sp-5); margin-bottom: var(--sp-8); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.panel-head h2 { font-size: var(--fs-lg); }
.tag { font: 500 var(--fs-xs)/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; padding: 6px 10px; border: 1.5px solid var(--ink); border-radius: 99px; white-space: nowrap; }
.field { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-5); border: 0; padding: 0; min-width: 0; }
.label, legend { font: 600 var(--fs-sm)/1.2 var(--font-body); padding: 0; }
.hint { font-size: var(--fs-sm); color: var(--ink-2); }
.input { width: 100%; min-height: 52px; padding: 0 var(--sp-4); font: 400 var(--fs-md) var(--font-mono); color: var(--ink); background: var(--bg); border: var(--border); border-radius: var(--r-md); }
.input::placeholder { color: var(--ink-2); opacity: 1; }
.input:hover { background: var(--surface-2); }
.input:focus-visible { outline-offset: 2px; }
.input[aria-invalid="true"] { border-color: var(--err); }
.error { color: var(--err); font-size: var(--fs-sm); font-weight: 600; }
.error[hidden] { display: none; }

/* Kalite seçici (segmented) */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 56px; border: var(--border); border-radius: var(--r-md); font: 700 var(--fs-md)/1.2 var(--font-mono); background: var(--bg); }
.seg small { font: 400 var(--fs-xs) var(--font-body); color: var(--ink-2); }
.seg input:hover + span { background: var(--surface-2); }
.seg input:checked + span { background: var(--ink); color: var(--bg); }
.seg input:checked + span small { color: var(--bg); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Onay kutusu */
.check { display: flex; gap: var(--sp-3); align-items: flex-start; min-height: 44px; font-size: var(--fs-sm); cursor: pointer; margin-bottom: var(--sp-5); }
.check input { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--accent); }

/* Butonlar */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 52px; padding: 0 var(--sp-5); font: 700 var(--fs-md)/1 var(--font-display); color: var(--on-accent); background: var(--accent); border: var(--border); border-radius: var(--r-md); cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .12s, background .12s; }
.btn:hover { background: var(--accent-hover); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.btn:active { transform: none; box-shadow: none; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--surface-2); color: var(--ink-2); border-color: var(--line); cursor: not-allowed; transform: none; box-shadow: none; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }

/* Uyarılar ve durumlar */
.alert { display: flex; gap: var(--sp-3); padding: var(--sp-4); border-radius: var(--r-md); border: 1.5px solid currentColor; font-size: var(--fs-sm); margin-top: var(--sp-5); }
.alert[hidden] { display: none; }
.alert-info { background: var(--info-bg); color: var(--ink); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--err-bg); color: var(--err); }
.alert strong { display: block; }
.state { text-align: center; padding: var(--sp-6) var(--sp-4); border: 2px dashed var(--line); border-radius: var(--r-md); color: var(--ink-2); }
.progress { height: 10px; background: var(--surface-2); border: 1.5px solid var(--ink); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 40%; background: repeating-linear-gradient(45deg, var(--accent) 0 8px, var(--accent-hover) 8px 16px); animation: slide 1.2s linear infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .progress > div { animation: none; } .btn { transition: none; } }

/* Nasıl çalışır */
.steps { list-style: none; margin: 0 0 var(--sp-8); padding: 0; display: grid; gap: var(--sp-5); counter-reset: s; }
.steps li { counter-increment: s; border-top: var(--border); padding-top: var(--sp-4); }
.steps li::before { content: "0" counter(s); font: 500 var(--fs-sm) var(--font-mono); color: var(--accent); }
.steps h3 { font-size: var(--fs-lg); margin: var(--sp-2) 0; }
.steps p { color: var(--ink-2); font-size: var(--fs-sm); }
.foot { border-top: var(--border); padding: var(--sp-5) 0; font-size: var(--fs-sm); color: var(--ink-2); }

/* Kırılımlar: 640 / 960 */
@media (min-width: 640px) {
  .wrap { padding: 0 var(--sp-6); }
  .panel { padding: var(--sp-6); }
  .steps { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
  .hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: var(--sp-7); align-items: start; padding: var(--sp-8) 0; }
  .hero .panel { margin: var(--sp-5) 0 0; }
}

/* Düzeltmeler (tur 2) */
.field { margin-inline: 0; }
.hero .panel { margin-top: var(--sp-6); margin-bottom: var(--sp-7); }
.brand { white-space: nowrap; }
@media (max-width: 479px) { .nav-links li + li { display: none; } .brand { font-size: 1rem; } }
@media (min-width: 960px) { .hero .panel { margin: var(--sp-5) 0 0; } }

/* Dönüştürücü akışı (token'larla) */
.preview { display: flex; gap: var(--sp-4); align-items: center; padding: var(--sp-4); margin: var(--sp-5) 0; border: var(--border); border-radius: var(--r-md); background: var(--bg); }
.preview img { width: 120px; max-width: 40%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border: 1.5px solid var(--ink); border-radius: var(--r-sm); flex: none; }
.preview h3 { font-size: var(--fs-md); line-height: 1.3; overflow-wrap: anywhere; }
.mono { font-family: var(--font-mono); }
#info-form, #convert-form { margin: 0; }
#progress { margin: var(--sp-5) 0 0; display: grid; gap: var(--sp-2); }
.progress-det > div { animation: none; transition: width .3s; background: var(--accent); }
.actions { display: grid; gap: var(--sp-3); margin-top: var(--sp-5); }
@media (min-width: 640px) { .actions { grid-template-columns: 1fr 1fr; } }
.preview[hidden], #progress[hidden], #done[hidden], #convert-form[hidden] { display: none; }

/* Yasal / düz metin sayfaları */
.doc { max-width: 68ch; padding: var(--sp-7) 0 var(--sp-8); }
.doc h1 { font-size: var(--fs-xl); font-weight: 800; margin-bottom: var(--sp-4); }
.doc .lead { margin-bottom: var(--sp-6); }
.doc section { margin-bottom: var(--sp-6); border-top: var(--border); padding-top: var(--sp-4); }
.doc h2 { font-size: var(--fs-lg); margin-bottom: var(--sp-3); }
.doc p, .doc li { color: var(--ink-2); }
.doc p + p, .doc p + ul, .doc ul + p { margin-top: var(--sp-4); }
.doc ul { margin: 0; padding-left: var(--sp-5); display: grid; gap: var(--sp-2); }
.doc .btn { text-decoration: none; }
.foot a { color: var(--ink); }

/* Hata uyarısı: ikon + tekrar dene */
#alert-icon { font-size: var(--fs-lg); line-height: 1.2; flex: none; }
.btn-sm { min-height: 44px; margin-top: var(--sp-3); padding: 0 var(--sp-4); font-size: var(--fs-sm); color: var(--err); border-color: var(--err); }
#retry[hidden] { display: none; }
#alert-msg { display: block; }
.alert { margin-bottom: var(--sp-4); }

/* Panodan yapıştır, SSS, bölüm başlıkları */
.btn-paste { margin-top: var(--sp-3); margin-bottom: var(--sp-4); }
.btn-paste[hidden] { display: none; }
.sec-title { font-size: var(--fs-xl); font-weight: 800; margin-bottom: var(--sp-5); }
.faq { margin-bottom: var(--sp-8); max-width: 72ch; }
.faq details { border-top: var(--border); }
.faq details:last-child { border-bottom: var(--border); }
.faq summary { display: flex; align-items: center; min-height: 52px; padding: var(--sp-3) 0; font: 700 var(--fs-md)/1.3 var(--font-display); cursor: pointer; list-style: none; gap: var(--sp-3); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; font: 700 var(--fs-lg)/1 var(--font-mono); color: var(--accent); width: 1ch; flex: none; }
.faq details[open] summary::before { content: "−"; }
.faq details p { color: var(--ink-2); padding: 0 0 var(--sp-4) calc(1ch + var(--sp-3)); }
.steps { margin-bottom: var(--sp-7); }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.preview[hidden] { display: none; }

/* Reklam yuvaları (Tunnl) */
.ad-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); margin: var(--sp-6) auto; max-width: 100%; overflow: hidden; }
.ad-label { font: 500 var(--fs-xs)/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); }
.ad-wrap > div { max-width: 100%; width: 100%; display: flex; justify-content: center; }
@media (max-width: 720px) { .ad-desktop { display: none; } }
@media (min-width: 721px) { .ad-mobile { display: none; } }
.ad-wrap[hidden] { display: none; }

/* Arama sonuçları */
.btn-row { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-3); }
.results-wrap { margin: var(--sp-5) 0 0; }
.results-wrap[hidden], .state[hidden] { display: none; }
.results-title { font-size: var(--fs-md); margin: 0 0 var(--sp-3); }
.state { padding: var(--sp-4); border: 2px dashed var(--line); border-radius: var(--r-md); color: var(--ink-2); margin: 0; }
.results { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: var(--sp-3); }
.result { display: flex; gap: var(--sp-3); align-items: center; width: 100%; min-height: 44px; padding: var(--sp-3); text-align: left; font: inherit; color: var(--ink); background: var(--bg); border: var(--border); border-radius: var(--r-md); cursor: pointer; }
.result:hover:not(:disabled) { background: var(--surface-2); }
.result:disabled { cursor: not-allowed; color: var(--ink-2); border-color: var(--line); background: var(--surface-2); }
.result:disabled img { opacity: .5; }
.result img { width: 96px; max-width: 34%; aspect-ratio: 16 / 9; object-fit: cover; border: 1.5px solid var(--ink); border-radius: var(--r-sm); flex: none; background: var(--surface-2); }
.result-body { display: grid; gap: var(--sp-1); min-width: 0; }
.result-title { font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-meta { font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.result-warn { font-size: var(--fs-sm); font-weight: 700; color: var(--err); }
.result-skel { min-height: 72px; border: 2px solid var(--line); border-radius: var(--r-md); background: linear-gradient(90deg, var(--surface-2), var(--bg), var(--surface-2)); background-size: 200% 100%; animation: skel 1.2s linear infinite; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .result-skel { animation: none; } }
@media (max-width: 720px) { .result { min-height: 72px; } }
