:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --bg-alt: #eef0f7;
  --surface: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --border: #e4e7ef;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --accent: #22d3ee;
  --danger: #e11d48;
  --success: #16a34a;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(31, 36, 48, 0.06);
  --shadow-lg: 0 12px 40px rgba(31, 36, 48, 0.12);
  --header-bg: rgba(255, 255, 255, 0.85);
  --nav-panel-bg: #ffffff;
  --input-bg: #ffffff;
  --hero-grad: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 50%, #ecfeff 100%);
  --page-hero-grad: linear-gradient(135deg, #eef2ff, #ecfeff);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1117;
  --bg-alt: #171a23;
  --surface: #1b1f2a;
  --text: #e7eaf3;
  --muted: #97a0b6;
  --border: #2a3040;
  --primary: #818cf8;
  --primary-dark: #a5b4fc;
  --accent: #22d3ee;
  --danger: #fb7185;
  --success: #4ade80;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --header-bg: rgba(15, 17, 23, 0.85);
  --nav-panel-bg: #171a23;
  --input-bg: #14161d;
  --hero-grad: linear-gradient(135deg, #151826 0%, #141a26 50%, #132023 100%);
  --page-hero-grad: linear-gradient(135deg, #161b2b, #132023);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 8px 14px;
  z-index: 100;
}
.skip-link:focus { left: 0; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
}
.brand {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand:hover { color: var(--primary); }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: 10px;
  transition: 0.15s ease;
}
.nav-links a:hover { color: var(--text); background: var(--bg-alt); }
.nav-links a.active { color: var(--primary); background: rgba(99, 102, 241, 0.1); }
.nav-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); font-size: 1.2rem; border-radius: 8px; padding: 6px 10px; cursor: pointer; color: var(--text); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* Hero */
.hero {
  background: var(--hero-grad);
  padding: 60px 0 50px;
  border-bottom: 1px solid var(--border);
}
.hero-inner { display: flex; justify-content: center; text-align: center; }
.hero-text { max-width: 720px; }
.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow-lg);
  margin-bottom: 18px;
}
.hero-title { font-size: 2.5rem; margin: 0 0 6px; letter-spacing: -0.03em; }
.hero-subtitle { font-size: 1.25rem; color: var(--primary-dark); font-weight: 600; margin: 0 0 10px; }
.hero-tagline { color: var(--muted); font-size: 1.05rem; margin: 0 0 26px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 34px; }
.hero-stats { display: flex; justify-content: center; gap: 40px; }
.stat { display: flex; flex-direction: column; }
.stat strong { font-size: 1.6rem; color: var(--primary); }
.stat span { color: var(--muted); font-size: 0.9rem; }

/* Sections */
.section { padding: 50px 0; }
.section-alt { background: var(--bg-alt); }
.section-title { font-size: 1.5rem; margin: 0 0 20px; letter-spacing: -0.02em; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
.page-hero {
  background: var(--page-hero-grad);
  padding: 44px 0 36px;
  border-bottom: 1px solid var(--border);
}
.page-hero h1 { margin: 6px 0 6px; font-size: 2rem; letter-spacing: -0.02em; }
.page-hero p { color: var(--muted); margin: 0 0 14px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.about-card p { margin: 0; font-size: 1.05rem; }

/* Grids */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

/* Project cards */
.project-card { display: flex; flex-direction: column; gap: 10px; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.project-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.project-top h3 { margin: 0; font-size: 1.12rem; }
.project-top a { color: var(--text); }
.project-top a:hover { color: var(--primary); }
.project-card p { color: var(--muted); margin: 0; font-size: 0.95rem; flex: 1; }

/* Chips & badges */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--text);
}
.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-soft { background: rgba(99, 102, 241, 0.1); color: var(--primary-dark); }
.badge-published { background: rgba(22, 163, 74, 0.12); color: var(--success); }

.link-more { font-weight: 600; font-size: 0.92rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* Skill bars */
.skill-bars { display: grid; gap: 16px; margin-bottom: 34px; }
.skill-bar .skill-label { display: flex; justify-content: space-between; font-size: 0.95rem; margin-bottom: 6px; }
.skill-bar .skill-label strong { color: var(--primary); }
.bar { height: 10px; border-radius: 999px; background: var(--bg-alt); overflow: hidden; }
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.8s ease;
}
.bar-violet { background: linear-gradient(90deg, #a855f7, var(--primary)); }

/* Blog */
.blog-list { display: grid; gap: 20px; }
.post-card { display: flex; flex-direction: column; gap: 8px; }
.post-card h2, .post-card h3 { margin: 4px 0 0; }
.post-card p { color: var(--muted); margin: 0; }
.post-meta { display: flex; align-items: center; gap: 12px; }
.post-meta .date { color: var(--muted); font-size: 0.9rem; }

/* Detail pages */
.detail-wrap { max-width: 780px; }
.detail-card { display: flex; flex-direction: column; gap: 16px; }
.detail-image { border-radius: 10px; max-height: 380px; object-fit: cover; }
.lead { font-size: 1.1rem; color: var(--text); font-weight: 500; }
.prose { font-size: 1rem; }
.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 8px; }

/* CV */
.cv-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 30px; }
.cv-side .section-title { font-size: 1.1rem; }
.cv-summary { font-size: 0.98rem; }
.cv-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; }
.cv-list small { color: var(--muted); }
.cv-download-links { display: flex; gap: 10px; flex-wrap: wrap; }
.timeline { display: grid; gap: 22px; margin-bottom: 30px; padding-left: 18px; border-left: 2px solid var(--border); }
.timeline-item { position: relative; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}
.timeline-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.timeline-head h3 { margin: 0; font-size: 1.1rem; }
.timeline-sub { color: var(--primary-dark); font-weight: 600; margin: 2px 0 8px; }

/* Contact */
.contact-wrap { display: grid; grid-template-columns: 340px 1fr; gap: 22px; }
.contact-list { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 12px; }
.footer-social { display: flex; gap: 8px; flex-wrap: wrap; }
.social-chip {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 600;
}
.social-chip:hover { border-color: var(--primary); color: var(--primary); }

/* Forms */
.form { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: transparent;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--input-bg);
  color: var(--text);
}
.field textarea { resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox input { width: auto; }
.justify-flex { justify-content: flex-start; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: 0.15s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: var(--input-bg); color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: rgba(225, 29, 72, 0.1); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.alert-success { background: rgba(22, 163, 74, 0.12); color: var(--success); }
.alert-error { background: rgba(225, 29, 72, 0.12); color: var(--danger); }

/* Footer */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 36px 0 24px; margin-top: 40px; }
.footer-inner { display: grid; gap: 20px; }
.footer-brand p { margin: 2px 0 0; color: var(--muted); }
.footer-bottom { color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--border); padding-top: 16px; }

/* ---------- Admin ---------- */
.admin-body { background: #f4f5fa; }
.admin-side { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 0; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-tabs a {
  padding: 7px 14px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.admin-tabs a:hover { color: var(--text); background: var(--bg-alt); }
.admin-tabs a.active { color: var(--primary); background: rgba(99, 102, 241, 0.1); border-color: rgba(99, 102, 241, 0.2); }
.admin-tabs a.danger { color: var(--danger); }
.admin-main { padding-top: 30px; }
.admin-title { font-size: 1.3rem; margin: 0 0 6px; letter-spacing: -0.02em; }
.admin-title small { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { display: flex; flex-direction: column; }
.stat-card strong { font-size: 1.8rem; color: var(--primary); }
.stat-card span { color: var(--muted); font-size: 0.9rem; }
.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 20px; }
.meter-row { display: grid; gap: 14px; }
.meter .meter-label { display: flex; justify-content: space-between; font-size: 0.92rem; margin-bottom: 6px; }
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.td-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-trunc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Repeatable admin rows */
.rep-rows { display: grid; gap: 14px; }
.rep-row { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 12px; }
.form-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.form-head .admin-title { margin: 0; }
.rep-row .form-row { grid-template-columns: 1fr 1fr; }
.rep-row .form-row .field:nth-child(3) { grid-column: span 1; }
.cat-row .form-head input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; font: inherit; flex: 1; min-width: 220px; }
.skill-rows { display: grid; gap: 10px; }

/* Messages */
.message { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 14px; background: #fff; }
.message.unread { border-left: 4px solid var(--primary); }
.message-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.message-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Auth */
.auth-wrap { display: flex; justify-content: center; padding-top: 30px; }
.auth-card { max-width: 430px; width: 100%; display: grid; gap: 16px; }

/* Responsive */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .cv-wrap { grid-template-columns: 1fr; }
  .contact-wrap { grid-template-columns: 1fr; }
  .admin-grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Mobil menü (hamburger) */
  .nav { position: relative; }
  .nav-toggle { display: block; }
  .nav-actions { margin-left: auto; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--nav-panel-bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 10px 20px 16px;
    gap: 6px;
    box-shadow: 0 16px 30px rgba(31, 36, 48, 0.1);
  }
  .nav-links.open { display: flex; }
}
@media (max-width: 640px) {
  .grid-3, .grid-2, .form-row { grid-template-columns: 1fr; }
  .hero { padding: 42px 0 36px; }
  .hero-title { font-size: 1.9rem; }
  .hero-stats { gap: 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Animations ---------- */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.35); }
  70% { box-shadow: 0 0 0 9px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

html { scroll-padding-top: 80px; }

/* Hero giriş animasyonu */
.hero .avatar { animation: float 5s ease-in-out infinite; }
.hero-text > *:not(.avatar) { animation: fade-in-up 0.6s ease both; }
.hero-text > *:nth-child(2) { animation-delay: 0.08s; }
.hero-text > *:nth-child(3) { animation-delay: 0.16s; }
.hero-text > *:nth-child(4) { animation-delay: 0.24s; }
.hero-text > *:nth-child(5) { animation-delay: 0.32s; }
.hero-text > *:nth-child(6) { animation-delay: 0.4s; }

/* İç sayfa üst kısımları */
.page-hero .container > * { animation: fade-in-up 0.55s ease both; }
.page-hero .container > *:nth-child(2) { animation-delay: 0.1s; }
.page-hero .container > *:nth-child(3) { animation-delay: 0.2s; }

/* Scroll reveal (main.js "in" sınıfını ekler) */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* Yetenek bar dolumları */
.skill-bars .bar-fill { transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1); }

.timeline-item::before { animation: pulse-dot 2.4s ease-out infinite; }

/* Hover iyileştirmeleri (admin paneli hariç) */
body:not(.admin-body) .card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
body:not(.admin-body) .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
body:not(.admin-body) .btn { transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
body:not(.admin-body) .btn:hover { transform: translateY(-2px); }
body:not(.admin-body) .btn:active { transform: translateY(0) scale(0.97); }
body:not(.admin-body) .btn-primary:hover { box-shadow: 0 8px 22px rgba(99, 102, 241, 0.35); }
body:not(.admin-body) .chip,
body:not(.admin-body) .social-chip { transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
body:not(.admin-body) .chip:hover,
body:not(.admin-body) .social-chip:hover { transform: translateY(-2px); }
body:not(.admin-body) .nav-links a { position: relative; }
body:not(.admin-body) .nav-links a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 100%;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
  transition: right 0.25s ease;
}
body:not(.admin-body) .nav-links a:hover::after { right: 14px; }

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

@media print {
  .site-header, .site-footer, .page-hero .btn, .skip-link { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
  .section { padding: 14px 0; }
}