/* ==========================================================================
   İSG CEP — stil dosyası
   Bağımlılık yok. Tema, html[data-theme] üzerinden CSS değişkenleriyle yönetilir.
   ========================================================================== */

:root {
  --brand: #0f766e;
  --brand-strong: #115e59;
  --brand-soft: #ccfbf1;
  --accent: #b45309;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --err: #b91c1c;
  --err-soft: #fee2e2;
  --warn: #a16207;
  --warn-soft: #fef9c3;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .18);
  --wrap: 1080px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --brand: #2dd4bf;
  --brand-strong: #5eead4;
  --brand-soft: #134e4a;
  --accent: #fbbf24;
  --ok: #4ade80;
  --ok-soft: #14532d;
  --err: #f87171;
  --err-soft: #7f1d1d;
  --warn: #fcd34d;
  --warn-soft: #713f12;

  --bg: #0b1220;
  --surface: #111a2b;
  --surface-2: #16223a;
  --border: #24314a;
  --text: #e8eefb;
  --muted: #93a3bd;

  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px -14px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; }
p { margin: 0 0 .85rem; }
a { color: var(--brand-strong); }
a:hover { color: var(--brand); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--surface); color: var(--text);
  padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.loading { padding: 3rem 0; text-align: center; color: var(--muted); }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; align-items: center; gap: 1rem;
  min-height: 64px;
}

.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; flex: 0 0 auto; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  font-weight: 800; font-size: .82rem; letter-spacing: .02em;
}
html[data-theme="dark"] .brand-mark { color: #06231f; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1rem; }
.brand-text small { color: var(--muted); font-size: .72rem; }

.main-nav {
  display: flex; gap: .15rem; margin-left: auto;
  overflow-x: auto; scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  padding: .5rem .7rem; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--muted); font-size: .9rem;
  white-space: nowrap; transition: background-color .15s ease, color .15s ease;
}
.main-nav a:hover { background: var(--surface-2); color: var(--text); }
.main-nav a.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }

.theme-toggle {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .7rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: .85rem; font-family: inherit;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle-icon {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 50%, transparent 50%);
  border: 1px solid var(--brand);
}

/* ---------- Layout helpers ---------- */

main { padding: 1.5rem 0 3rem; min-height: 60vh; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem;
}

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.stack > * + * { margin-top: .75rem; }

.page-head { margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.6rem; }
.page-head p { color: var(--muted); margin: 0; }

.eyebrow {
  display: inline-block; font-size: .72rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--brand-strong);
  margin-bottom: .35rem;
}

/* ---------- Hero ---------- */

.hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff; border-radius: var(--radius); padding: 1.9rem 1.5rem;
  box-shadow: var(--shadow);
}
html[data-theme="dark"] .hero { color: #04211d; }
.hero h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); margin-bottom: .5rem; }
.hero p { max-width: 62ch; opacity: .95; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.1rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .62rem 1.05rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--brand); color: #fff;
  font: inherit; font-weight: 600; font-size: .92rem;
  cursor: pointer; text-decoration: none;
  transition: transform .12s ease, filter .15s ease, background-color .15s ease;
}
html[data-theme="dark"] .btn { color: #04211d; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); }
.btn-sm { padding: .4rem .7rem; font-size: .84rem; }
.btn-block { width: 100%; }

/* ---------- Stat cards ---------- */

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .9rem 1rem;
}
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; color: var(--brand-strong); }
.stat-label { font-size: .8rem; color: var(--muted); }

/* ---------- Progress ---------- */

.bar {
  height: 9px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; border: 1px solid var(--border);
}
.bar > span {
  display: block; height: 100%; background: var(--brand);
  border-radius: 999px; transition: width .4s ease;
}
.bar-row { display: flex; align-items: center; gap: .7rem; }
.bar-row .bar { flex: 1; }
.bar-value { font-variant-numeric: tabular-nums; font-size: .82rem; color: var(--muted); min-width: 3.2em; text-align: right; }

/* ---------- Topic list ---------- */

.topic {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem;
  transition: border-color .15s ease, transform .15s ease;
}
.topic:hover { border-color: var(--brand); transform: translateY(-2px); }
.topic h3 { font-size: 1.02rem; margin-bottom: .3rem; }
.topic p { color: var(--muted); font-size: .88rem; margin-bottom: .7rem; }
.topic-meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: auto; }
.topic-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }

.chip {
  display: inline-block; padding: .18rem .55rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; background: var(--surface-2);
  color: var(--muted); border: 1px solid var(--border);
}
.chip-6331 { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.chip-4857 { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

/* ---------- Article (konu içeriği) ---------- */

.article { max-width: 76ch; }
.article h2 { font-size: 1.35rem; margin-top: 1.6rem; }
.article h3 { font-size: 1.05rem; margin-top: 1.2rem; }
.article ul, .article ol { padding-left: 1.25rem; margin: 0 0 .9rem; }
.article li { margin-bottom: .3rem; }

.callout {
  border-left: 4px solid var(--brand);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .8rem 1rem; margin: 1rem 0;
}
.callout strong { display: block; margin-bottom: .2rem; }
.callout-warn { border-left-color: var(--accent); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; min-width: 420px; }
th, td { border: 1px solid var(--border); padding: .5rem .65rem; text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; }

.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: .8rem; }
.breadcrumb a { text-decoration: none; }

/* ---------- Quiz ---------- */

.quiz-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem;
}
.quiz-progress { flex: 1 1 200px; }

.question-text { font-size: 1.06rem; font-weight: 600; margin-bottom: 1rem; }
.question-source { font-size: .8rem; color: var(--muted); font-weight: 500; }

.options { display: grid; gap: .55rem; }
.option {
  display: flex; align-items: flex-start; gap: .7rem;
  width: 100%; text-align: left;
  padding: .7rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: inherit; font: inherit; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.option:hover:not(:disabled) { border-color: var(--brand); background: var(--surface-2); }
.option:disabled { cursor: default; }
.option-key {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .78rem; font-weight: 700;
}
.option.is-selected { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.option.is-selected .option-key { background: var(--brand); color: #fff; border-color: transparent; }
html[data-theme="dark"] .option.is-selected .option-key { color: #04211d; }
.option.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.option.is-correct .option-key { background: var(--ok); color: #fff; border-color: transparent; }
.option.is-wrong { border-color: var(--err); background: var(--err-soft); }
.option.is-wrong .option-key { background: var(--err); color: #fff; border-color: transparent; }

.feedback { margin-top: 1rem; border-radius: var(--radius-sm); padding: .8rem 1rem; font-size: .92rem; }
.feedback-ok { background: var(--ok-soft); border: 1px solid var(--ok); }
.feedback-err { background: var(--err-soft); border: 1px solid var(--err); }
.feedback strong { display: block; margin-bottom: .25rem; }

.quiz-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---------- Deneme (exam) ---------- */

.exam-bar {
  position: sticky; top: 68px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .7rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1rem; box-shadow: var(--shadow);
}
.timer {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.1rem;
  color: var(--brand-strong);
}
.timer.is-low { color: var(--err); }

.q-grid { display: grid; gap: .4rem; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
.q-dot {
  aspect-ratio: 1; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted);
  font-size: .78rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.q-dot.answered { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.q-dot.current { outline: 2px solid var(--brand); outline-offset: 1px; }

.result-score {
  font-size: 3rem; font-weight: 800; line-height: 1;
  color: var(--brand-strong);
}
.result-score.is-fail { color: var(--err); }

/* ---------- Flashcards ---------- */

.flashcard {
  perspective: 1200px; min-height: 230px; cursor: pointer;
}
.flashcard-inner {
  position: relative; width: 100%; min-height: 230px;
  transition: transform .55s cubic-bezier(.4, .2, .2, 1);
  transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem; display: flex; flex-direction: column; justify-content: center;
  background: var(--surface);
}
.flashcard-back { transform: rotateY(180deg); background: var(--surface-2); }
.flashcard-tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--brand-strong); margin-bottom: .5rem; }
.flashcard-q { font-size: 1.08rem; font-weight: 650; }
.flashcard-a { font-size: .95rem; }
.flashcard-hint { margin-top: .8rem; font-size: .78rem; color: var(--muted); }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.4rem 0 2rem;
  font-size: .85rem;
}
.footer-inner p { margin-bottom: .5rem; }
.footer-nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-nav a { text-decoration: none; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%) translateY(140%);
  background: var(--text); color: var(--bg);
  padding: .6rem 1rem; border-radius: 999px; font-size: .85rem;
  z-index: 90; transition: transform .3s ease; max-width: calc(100% - 2rem);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; padding-top: .55rem; padding-bottom: .55rem; gap: .5rem; }
  .brand-text small { display: none; }
  .main-nav { order: 3; flex: 1 1 100%; margin-left: 0; padding-bottom: .25rem; }
  .theme-toggle { margin-left: auto; }
  .theme-toggle-label { display: none; }
  main { padding-top: 1.1rem; }
  .hero { padding: 1.4rem 1.1rem; }
  .exam-bar { top: 104px; }
  .card { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .site-header, .site-footer, .quiz-actions, .exam-bar, .toast { display: none !important; }
  body { background: #fff; }
}
