/* ═══════════════════════════════════════════
   SoftwareMAR — Klasik Portfolyo
   ═══════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --dusk: #1A1D33;
  --paper: #F2E6DA;
  --dust: #C08A6A;
  --rock: #4A2A26;
  --haze: #8DB6E6;
  --signal: #F3D34A;

  --font-heading: 'Unbounded', system-ui, sans-serif;
  --font-body: 'Instrument Sans', system-ui, sans-serif;

  --measure: 42rem;
  --page-max: 68rem;
  --space-xs: 0.5rem;
  --space-s: 1rem;
  --space-m: 2rem;
  --space-l: 3.5rem;
  --space-xl: 6rem;

  --radius: 6px;
  --transition: 0.2s ease;
}

/* ── Dark theme (default) ── */
[data-theme="dark"],
[data-theme="auto"] {
  --bg: var(--dusk);
  --bg-elevated: #232640;
  --fg: var(--paper);
  --fg-muted: var(--dust);
  --heading: var(--paper);
  --accent: var(--signal);
  --accent-hover: #f5dc6a;
  --on-accent: var(--dusk);
  --link: var(--haze);
  --link-hover: var(--paper);
  --divider: rgba(242, 230, 218, 0.1);
  --badge-live-bg: #264d2f;
  --badge-live-fg: #7ae68a;
  --badge-demo-bg: #2a3e5c;
  --badge-demo-fg: var(--haze);
  --badge-beta-bg: #3d2c1f;
  --badge-beta-fg: var(--dust);
  --tag-bg: var(--rock);
  --tag-fg: var(--paper);
  --focus-ring: var(--signal);
  --input-bg: rgba(255,255,255,0.06);
  --input-border: rgba(242, 230, 218, 0.18);
}

/* ── Light theme ── */
[data-theme="light"] {
  --bg: #F2E6DA;
  --bg-elevated: #fff;
  --fg: var(--dusk);
  --fg-muted: #6B4F3E;
  --heading: var(--dusk);
  --accent: var(--rock);
  --accent-hover: #3a1e1b;
  --on-accent: var(--paper);
  --link: var(--rock);
  --link-hover: var(--dusk);
  --divider: rgba(26, 29, 51, 0.1);
  --badge-live-bg: #d8f0dc;
  --badge-live-fg: #1a5c26;
  --badge-demo-bg: #d8e8f8;
  --badge-demo-fg: #1a3d6b;
  --badge-beta-bg: #f0e0d0;
  --badge-beta-fg: #6B4F3E;
  --tag-bg: var(--dusk);
  --tag-fg: var(--paper);
  --focus-ring: var(--rock);
  --input-bg: rgba(0,0,0,0.03);
  --input-border: rgba(26, 29, 51, 0.18);
}

/* Theme toggle icons */
[data-theme="dark"] .icon-sun,
[data-theme="auto"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon,
[data-theme="auto"] .icon-moon { display: block; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: block; }

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 100%; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.65;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

/* ── Typography ── */
h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--heading);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.2rem, 5vw + 0.5rem, 3.8rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw + 0.3rem, 2.2rem); font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 500; }
p { max-width: var(--measure); }

/* ── Links ── */
a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--transition);
}
a:hover { color: var(--link-hover); }
a:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.75em 1.5em;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
.btn--primary {
  background: var(--accent);
  color: var(--dusk);
  border-color: var(--accent);
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--dusk); }
.btn--outline {
  background: transparent;
  color: var(--fg);
  border-color: var(--divider);
}
.btn--outline:hover { border-color: var(--fg-muted); color: var(--fg); }
.btn--ghost {
  background: transparent;
  color: var(--fg-muted);
  border-color: transparent;
  padding: 0.5em 0.9em;
  font-size: 0.85rem;
}
.btn--ghost:hover { color: var(--fg); background: var(--divider); }
.btn--small { font-size: 0.85rem; padding: 0.55em 1.1em; }

/* ═══ HEADER ═══ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
  transition: background var(--transition);
}
/* subtle backdrop blur for modern browsers */
@supports (backdrop-filter: blur(12px)) {
  .site-header {
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

.header-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0.75rem var(--space-s);
  display: flex;
  align-items: center;
  gap: var(--space-s);
}

/* Brand */
.brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--heading);
  flex-shrink: 0;
}
.brand--small { font-size: 0.95rem; }
.brand-mar { color: var(--dust); }

/* Nav links */
.nav-links {
  list-style: none;
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}
.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 0.4em 0.65em;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.nav-links a:hover { color: var(--fg); background: var(--divider); }

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: var(--space-s);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.theme-toggle:hover { color: var(--fg); background: var(--divider); }
.theme-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* Hamburger */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  position: relative;
}
.menu-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--fg);
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.hamburger { position: relative; }
.hamburger::before,
.hamburger::after { content: ''; position: absolute; left: 0; }
.hamburger::before { top: -6px; }
.hamburger::after { top: 6px; }

.menu-toggle[aria-expanded="true"] .hamburger { background: transparent; }
.menu-toggle[aria-expanded="true"] .hamburger::before { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .hamburger::after { transform: translateY(-6px) rotate(-45deg); }

/* ── Mobile menu ── */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    flex-direction: column;
    align-items: flex-start;
    padding: 5rem var(--space-m) var(--space-m);
    gap: 0.25rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 90;
  }
  .nav-links.is-open { transform: translateX(0); }
  .nav-links a { font-size: 1.25rem; padding: 0.75em 0.5em; }

  .header-actions .btn--ghost { display: none; }
  .menu-toggle { display: flex; z-index: 95; }
}

@media (min-width: 769px) {
  .header-inner { padding: 0.75rem var(--space-m); }
}

/* ═══ HERO ═══ */
.hero {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-s) var(--space-l);
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: var(--space-l);
  position: relative;
  overflow: hidden;
}

@media (min-width: 860px) {
  .hero {
    grid-template-columns: 1fr 400px;
    padding: var(--space-xl) var(--space-m);
    min-height: 80vh;
  }
}

.hero-title {
  margin-bottom: var(--space-s);
}
.hero-intro {
  font-size: clamp(1rem, 1vw + 0.75rem, 1.15rem);
  color: var(--fg-muted);
  margin-bottom: var(--space-m);
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: var(--space-l);
}

.hero-stats {
  display: flex;
  gap: var(--space-m);
  flex-wrap: wrap;
  padding-top: var(--space-m);
  border-top: 1px solid var(--divider);
}
.stat-value {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--heading);
  display: block;
  line-height: 1.2;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* Mars canvas */
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}
#mars-canvas {
  width: 100%;
  max-width: 400px;
  height: auto;
  aspect-ratio: 1;
  opacity: 0.6;
}
@media (max-width: 859px) {
  .hero-visual {
    order: -1;
    max-height: 240px;
    overflow: hidden;
  }
  #mars-canvas { max-width: 240px; opacity: 0.35; }
}

/* ═══ SECTIONS ═══ */
.section {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-s);
}
.section + .section { border-top: 1px solid var(--divider); }
.section-heading { margin-bottom: var(--space-m); }
.section-lead { color: var(--fg-muted); margin-bottom: var(--space-l); }

@media (min-width: 640px) {
  .section { padding: var(--space-xl) var(--space-m); }
}

/* ═══ PROJECTS ═══ */
#projects-container {
  display: grid;
  gap: var(--space-m);
}

.project-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-m);
  padding-bottom: var(--space-m);
  border-bottom: 1px solid var(--divider);
}
.project-card:last-child { border-bottom: none; padding-bottom: 0; }

@media (min-width: 640px) {
  .project-card {
    grid-template-columns: 280px 1fr;
  }
  .project-card--featured {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 860px) {
  .project-card--featured {
    grid-template-columns: 1.3fr 1fr;
  }
}

/* Project image */
.project-card-img {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  line-height: 0;
}
.project-thumb {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.3s ease;
}
.project-thumb:hover { transform: scale(1.03); }
.project-thumb:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }

/* featured card bigger image */
.project-card--featured .project-card-img {
  aspect-ratio: 16/10;
}
.project-card--featured .project-thumb {
  height: 100%;
  object-fit: cover;
}

.project-meta {
  display: flex;
  align-items: baseline;
  gap: var(--space-s);
  flex-wrap: wrap;
  margin-bottom: var(--space-xs);
}
.project-name { color: var(--heading); }
.project-desc { color: var(--fg); margin-bottom: var(--space-xs); }
.project-note {
  font-size: 0.85rem;
  color: var(--fg-muted);
  font-style: italic;
  margin-bottom: var(--space-xs);
}

/* Badge */
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2em 0.6em;
  border-radius: 3px;
  white-space: nowrap;
}
.badge--live { background: var(--badge-live-bg); color: var(--badge-live-fg); }
.badge--demo { background: var(--badge-demo-bg); color: var(--badge-demo-fg); }
.badge--beta { background: var(--badge-beta-bg); color: var(--badge-beta-fg); }

/* Tags */
.project-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: var(--space-s);
}
.project-tags li {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.15em 0.55em;
  background: var(--tag-bg);
  color: var(--tag-fg);
  border-radius: 3px;
}

/* ═══ PREVIEW DIALOG ═══ */
.preview-dialog {
  border: none;
  background: transparent;
  max-width: 90vw;
  max-height: 90vh;
  padding: 0;
}
.preview-dialog::backdrop { background: rgba(0,0,0,0.8); }
.preview-dialog-inner { position: relative; }
.preview-img {
  display: block;
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius);
}
.preview-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius);
}
.preview-close:hover { background: rgba(255,255,255,0.15); }
.preview-close:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ═══ SERVICES ═══ */
.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 640px) {
  .services-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1000px) {
  .services-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.service-item {
  display: flex;
  gap: var(--space-s);
  padding: var(--space-m) 0;
  border-bottom: 1px solid var(--divider);
}
/* remove border on last row items */
@media (min-width: 1000px) {
  .service-item:nth-last-child(-n+3) { border-bottom: none; }
  .service-item {
    padding: var(--space-m) var(--space-s);
    /* vertical divider via border-right for first two columns */
  }
  /* right border on 1st and 2nd columns */
  .service-item:nth-child(3n+1),
  .service-item:nth-child(3n+2) {
    border-right: 1px solid var(--divider);
  }
}
@media (min-width: 640px) and (max-width: 999px) {
  .service-item:nth-last-child(-n+2) { border-bottom: none; }
  .service-item:nth-child(odd) { border-right: 1px solid var(--divider); padding-right: var(--space-s); }
  .service-item:nth-child(even) { padding-left: var(--space-s); }
}

.service-icon {
  flex-shrink: 0;
  color: var(--fg-muted);
  padding-top: 0.1rem;
}
.service-title {
  color: var(--heading);
  margin-bottom: 0.25rem;
}
.service-desc {
  font-size: 0.9rem;
  color: var(--fg-muted);
}

/* ═══ TIMELINE (Process) ═══ */
.timeline {
  list-style: none;
  position: relative;
  padding-left: 3.5rem;
}
/* vertical line */
.timeline::before {
  content: '';
  position: absolute;
  left: 1.1rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 1px;
  background: var(--divider);
}

.timeline-step {
  position: relative;
  padding-bottom: var(--space-l);
}
.timeline-step:last-child { padding-bottom: 0; }

.timeline-num {
  position: absolute;
  left: -3.5rem;
  top: 0;
  width: 2.2rem;
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--fg-muted);
  background: var(--bg);
  padding: 0.25em 0;
  z-index: 1;
}

.timeline-title { margin-bottom: 0.3rem; color: var(--heading); }
.timeline-desc { color: var(--fg-muted); font-size: 0.95rem; }

/* ═══ ABOUT ═══ */
.about-text { margin-bottom: var(--space-s); }
.about-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-s);
  margin-top: var(--space-m);
  padding-top: var(--space-m);
  border-top: 1px solid var(--divider);
}
.about-fact dt {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 0.1rem;
}
.about-fact dd { margin-left: 0; }

/* ═══ CONTACT ═══ */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-l);
}
@media (min-width: 768px) {
  .contact-layout { grid-template-columns: 1fr 1fr; }
}

.contact-text { margin-bottom: var(--space-s); }
.contact-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: var(--space-s);
}
.contact-links a { font-weight: 600; }
.contact-location {
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* ── Contact Form (shared from contact.js) ── */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}
.cf-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.cf-row label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg);
}
.cf-opt {
  color: var(--fg-muted);
  font-weight: 400;
}
.cf-row input,
.cf-row select,
.cf-row textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.6em 0.75em;
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
  width: 100%;
}
.cf-row input:focus,
.cf-row select:focus,
.cf-row textarea:focus {
  outline: none;
  border-color: var(--link);
}
.cf-row [aria-invalid="true"] {
  border-color: #d44 !important;
}
.cf-row textarea { resize: vertical; min-height: 6rem; }
.cf-row select { cursor: pointer; }

.cf-send {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75em 1.5em;
  background: var(--accent);
  color: var(--dusk);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  align-self: flex-start;
}
.cf-send:hover { background: var(--accent-hover); }
.cf-send:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
.cf-send:disabled { opacity: 0.6; cursor: not-allowed; }

.cf-status {
  font-size: 0.85rem;
  min-height: 1.2em;
}
.cf-status.is-ok { color: #5eb86c; }
.cf-status.is-error { color: #d9534f; }

.cf-alt {
  font-size: 0.8rem;
  color: var(--fg-muted);
}
.cf-alt a { color: var(--link); }

/* Honeypot trap — screen-reader accessible but off-screen */
.cf-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ═══ FOOTER ═══ */
.site-footer {
  border-top: 1px solid var(--divider);
  margin-top: var(--space-xl);
}
.footer-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-m) var(--space-s);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-s);
  font-size: 0.85rem;
  color: var(--fg-muted);
}
.footer-link {
  margin-left: auto;
  font-weight: 500;
  color: var(--fg-muted);
}
.footer-link:hover { color: var(--fg); }

@media (min-width: 640px) {
  .footer-inner { padding: var(--space-m) var(--space-m); }
}

/* ═══ Reduced motion ═══ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
  html { scroll-behavior: auto; }
}

/* ═══ Düzeltmeler (Claude) ═══ */
.btn--primary, .btn--primary:hover, .cf-send { color: var(--on-accent); }
@view-transition { navigation: auto; }
.brand { view-transition-name: brand; }
@media (max-width: 768px) {
  /* bulanıklık, sabit konumlu mobil menüyü başlığın içine hapsediyordu */
  .site-header { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .header-actions { margin-left: auto; }
}
.nav-3d { display: none; }
@media (max-width: 768px) { .nav-3d { display: list-item; } .nav-3d a { color: var(--accent); font-weight: 600; } }
/* Açılır liste seçenekleri temaya uysun (koyu temada beyaz üstüne beyaz yazı oluyordu) */
.cf-row select option { background: var(--bg); color: var(--fg); }
[data-theme="dark"] .cf-row select, [data-theme="auto"] .cf-row select { color-scheme: dark; }
[data-theme="light"] .cf-row select { color-scheme: light; }
