/* ============================================================
   Kaan Bilgili — Portfolio · Liquid Glass
   Indigo accent · dark + light theme
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ============================================================
   THEME TOKENS
   ============================================================ */
:root {
  /* Radius */
  --radius-sm:        10px;
  --radius-md:        16px;
  --radius-lg:        24px;
  --radius-pill:      999px;

  /* Blur (+ saturate: arkadaki rengi cama yansıtır — liquid glass) */
  --blur-sm:          blur(10px) saturate(150%);
  --blur-md:          blur(18px) saturate(170%);
  --blur-lg:          blur(26px) saturate(190%);

  /* Nav */
  --nav-height:       72px;

  /* Fonts */
  --font-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:  'SF Mono', 'Cascadia Code', 'Consolas', 'Menlo', monospace;

  /* Type scale */
  --text-xs:    0.75rem;
  --text-sm:    0.875rem;
  --text-base:  1rem;
  --text-lg:    1.125rem;
  --text-xl:    1.25rem;
  --text-2xl:   1.5rem;
  --text-3xl:   2rem;
  --text-hero:  clamp(2.5rem, 6vw, 4.5rem);
}

/* ---------- DARK (default) ---------- */
:root,
:root[data-theme="dark"] {
  --bg-base:          #1a1a20;
  --bg-secondary:     #24242c;

  --glass-bg:         rgba(255, 255, 255, 0.05);
  --glass-bg-hover:   rgba(255, 255, 255, 0.11);
  --glass-border:     rgba(255, 255, 255, 0.16);
  --glass-border-hi:  rgba(255, 255, 255, 0.32);
  --glass-fallback:   rgba(32, 32, 40, 0.92);

  --surface-soft:     rgba(255, 255, 255, 0.06);
  --surface-soft-bd:  rgba(255, 255, 255, 0.12);

  --accent:           #818cf8;
  --accent-dim:       rgba(129, 140, 248, 0.18);
  --accent-glow:      rgba(129, 140, 248, 0.14);

  --text-primary:     rgba(255, 255, 255, 0.94);
  --text-secondary:   rgba(255, 255, 255, 0.58);
  --text-muted:       rgba(255, 255, 255, 0.36);

  --nav-bg:           rgba(26, 26, 32, 0.45);

  --orb-1:            rgba(129, 140, 248, 0.28);
  --orb-2:            rgba(168, 85, 247, 0.24);
  --orb-3:            rgba(56, 189, 248, 0.16);

  --glass-shadow:
    0 1px 0 rgba(255,255,255,0.18) inset,
    0 0 0 0.5px rgba(255,255,255,0.06) inset,
    0 8px 32px rgba(0, 0, 0, 0.45);
  --card-shadow:
    0 1px 0 rgba(255,255,255,0.16) inset,
    0 8px 32px rgba(0,0,0,0.35);
  --card-shadow-hover:
    0 1px 0 rgba(255,255,255,0.22) inset,
    0 16px 50px rgba(0,0,0,0.55),
    0 0 0 1px var(--accent-glow);
  --nav-shadow:
    0 1px 0 rgba(255,255,255,0.20) inset,
    0 16px 48px rgba(0,0,0,0.55);

  color-scheme: dark;
}

/* ---------- LIGHT ---------- */
:root[data-theme="light"] {
  --bg-base:          #e8eaf3;
  --bg-secondary:     #dde0ec;

  --glass-bg:         rgba(255, 255, 255, 0.45);
  --glass-bg-hover:   rgba(255, 255, 255, 0.68);
  --glass-border:     rgba(255, 255, 255, 0.75);
  --glass-border-hi:  rgba(255, 255, 255, 0.95);
  --glass-fallback:   rgba(255, 255, 255, 0.82);

  --surface-soft:     rgba(255, 255, 255, 0.5);
  --surface-soft-bd:  rgba(255, 255, 255, 0.7);

  --accent:           #4f46e5;
  --accent-dim:       rgba(79, 70, 229, 0.12);
  --accent-glow:      rgba(79, 70, 229, 0.20);

  --text-primary:     rgba(22, 24, 42, 0.92);
  --text-secondary:   rgba(22, 24, 42, 0.62);
  --text-muted:       rgba(22, 24, 42, 0.45);

  --nav-bg:           rgba(255, 255, 255, 0.45);

  --orb-1:            rgba(129, 140, 248, 0.30);
  --orb-2:            rgba(192, 132, 252, 0.28);
  --orb-3:            rgba(56, 189, 248, 0.20);

  --glass-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 2px 8px rgba(30, 35, 80, 0.06),
    0 12px 40px rgba(30, 35, 80, 0.12);
  --card-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 2px 8px rgba(30, 35, 80, 0.05),
    0 10px 32px rgba(30, 35, 80, 0.10);
  --card-shadow-hover:
    0 1px 0 rgba(255,255,255,1) inset,
    0 16px 44px rgba(30, 35, 80, 0.18),
    0 0 0 1px var(--accent-glow);
  --nav-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 12px 40px rgba(30, 35, 80, 0.16);

  color-scheme: light;
}

/* ============================================================
   BASE
   ============================================================ */
html { scroll-behavior: smooth; }

body {
  position: relative;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  padding-bottom: calc(var(--nav-height) + 40px);
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ---------- Ambient Background Orbs (cama yansıyan renk) ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(45% 45% at 12% 6%,  var(--orb-1), transparent 72%),
    radial-gradient(42% 42% at 88% 16%, var(--orb-2), transparent 72%),
    radial-gradient(55% 50% at 50% 96%, var(--orb-3), transparent 72%);
  transition: background 0.3s ease;
}

/* ---------- Section ---------- */
section {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  padding: 80px 24px;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.section-title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent);
  text-transform: lowercase;
  letter-spacing: 0.08em;
  margin-bottom: 32px;
  opacity: 0.85;
}

/* ---------- Glass Surface ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
}

.glass:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hi);
}

/* ============================================================
   HERO
   ============================================================ */
#hero { align-items: flex-start; }

.hero-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: 6px 14px;
  margin-bottom: 28px;
  border-radius: var(--radius-pill);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
}

.hero-name {
  font-family: var(--font-sans);
  font-size: var(--text-hero);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.hero-subtitle {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 28px;
}

.hero-bio {
  max-width: 540px;
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.8;
  padding-left: 18px;
  border-left: 2px solid var(--glass-border);
  margin-bottom: 36px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hi);
}

.btn-accent {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-accent:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* ============================================================
   JOURNEY / TIMELINE
   ============================================================ */
.timeline {
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: flex;
  gap: 20px;
  align-items: stretch;
}

.timeline-rail {
  position: relative;
  flex: 0 0 14px;
  display: flex;
  justify-content: center;
}

.timeline-rail::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--glass-border);
}

.timeline-item:first-child .timeline-rail::before { top: 24px; }
.timeline-item:last-child  .timeline-rail::before { bottom: calc(100% - 24px); }

.timeline-dot {
  position: absolute;
  top: 18px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-base);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
  z-index: 1;
}

.timeline-content {
  flex: 1;
  padding: 18px 22px;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
}

.timeline-item:last-child .timeline-content { margin-bottom: 0; }

.timeline-date {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.timeline-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.timeline-org {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 10px;
}

.timeline-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.timeline-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
}

.timeline-tag.tag-edu {
  color: var(--text-secondary);
  background: var(--surface-soft);
  border-color: var(--surface-soft-bd);
}

/* ============================================================
   PROJECTS
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.project-card {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);

  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;

  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.3s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--glass-border-hi);
  box-shadow: var(--card-shadow-hover);
}

.project-number {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  opacity: 0.8;
}

.project-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  padding-right: 28px;
}

.project-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  border: 1px solid var(--surface-soft-bd);
  color: var(--text-muted);
}

.project-link {
  position: absolute;
  top: 20px;
  right: 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
  transition: color 0.2s, transform 0.2s;
}

.project-card:hover .project-link {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* ============================================================
   SKILLS
   ============================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.skill-group {
  padding: 24px;
  border-radius: var(--radius-md);
}

.skill-group-title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
}

.skill-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.skill-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.skill-item::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.skill-item.primary { color: var(--text-primary); }

.skill-item.primary::before {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ============================================================
   ACTIVITY
   ============================================================ */
.activity-card { padding: 24px; }

.activity-img {
  width: 100%;
  display: block;
  border-radius: var(--radius-sm);
}

/* ============================================================
   CONTACT
   ============================================================ */
#contact { min-height: auto; }

.contact-heading {
  font-family: var(--font-sans);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.contact-heading span { color: var(--accent); }

.contact-sub {
  color: var(--text-secondary);
  font-size: var(--text-base);
  margin-bottom: 32px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  transition: all 0.2s ease;
}

.contact-item:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text-primary);
}

.contact-icon {
  display: inline-flex;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.contact-icon svg { width: 18px; height: 18px; }

.contact-item:hover .contact-icon { color: var(--accent); }

.contact-label {
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: lowercase;
  width: 72px;
  flex-shrink: 0;
}

.contact-value {
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Email copy button ---------- */
.contact-mail {
  flex: 1;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  margin: -6px -6px -6px 0;
  padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  color: var(--accent);
  background: var(--surface-soft);
  border-color: var(--surface-soft-bd);
}

.copy-btn svg { width: 17px; height: 17px; }

.copy-ico { display: inline-flex; }
.copy-done { display: none; }
.copy-btn.copied .copy-default { display: none; }
.copy-btn.copied .copy-done {
  display: inline-flex;
  color: var(--accent);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translate(-50%, -16px);
  z-index: 1200;

  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--nav-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  box-shadow: var(--glass-shadow);

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 1100;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width 0.1s linear;
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--glass-border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ============================================================
   THEME TOGGLE
   ============================================================ */
.theme-toggle {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  right: 20px;
  z-index: 1000;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;

  color: var(--text-secondary);
  background: var(--nav-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  box-shadow: var(--glass-shadow);
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--glass-border-hi);
}

.theme-toggle svg { width: 20px; height: 20px; }

.theme-icon { display: none; }
:root[data-theme="dark"]  .icon-moon { display: inline-flex; }
:root[data-theme="light"] .icon-sun  { display: inline-flex; }

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;

  display: flex;
  gap: 4px;
  padding: 8px;

  background: var(--nav-bg);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--nav-shadow);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--glass-bg-hover);
  color: var(--text-secondary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-icon { display: inline-flex; }
.nav-icon svg { width: 20px; height: 20px; }

.nav-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .skills-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  section { padding: 60px 16px; }
  .projects-grid { grid-template-columns: 1fr; }
  .nav-label { display: none; }
  .nav-item { padding: 10px 14px; }
  .footer { flex-direction: column; text-align: center; }
  .contact-label { width: 60px; }
}

/* ============================================================
   FALLBACKS & ACCESSIBILITY
   ============================================================ */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass,
  .project-card,
  .btn,
  .hero-badge,
  .contact-item,
  .theme-toggle,
  .bottom-nav {
    background: var(--glass-fallback);
  }
}

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

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
