/* ========================================
   Theme Variables
   ======================================== */

:root,
[data-theme="dark"] {
  --bg-primary: #0d0d0f;
  --bg-card: rgba(24,28,36,0.98);
  --bg-card-hover: linear-gradient(90deg, #233a5e 0%, #181c24 100%);
  --bg-social: #181c24;
  --text-primary: #f3f6fa;
  --text-heading: #eaf0fa;
  --text-secondary: #b6c3d6;
  --text-link: #4f7ccf;
  --text-link-hover: #fff;
  --accent: #4f7ccf;
  --accent-bg: #233a5e;
  --shadow-sm: 0 2px 10px #233a5e22;
  --shadow-md: 0 6px 32px #233a5e22, 0 2px 12px #0008;
  --shadow-hover: 0 12px 36px #233a5e44, 0 4px 18px #0008;
  --shadow-social-hover: 0 4px 18px #233a5e44;
  --divider: linear-gradient(90deg, rgba(35,58,94,0.18) 0%, rgba(255,255,255,0.08) 100%);
  --tag-bg: #233a5e22;
  --tag-color: #4f7ccf;
  --overlay-1: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(35,58,94,0.55) 0%, rgba(35,58,94,0.18) 60%, transparent 100%);
  --overlay-2: radial-gradient(ellipse 30% 20% at 20% 80%, rgba(79,124,207,0.18) 0%, rgba(35,58,94,0.08) 60%, transparent 100%);
  --overlay-3: radial-gradient(ellipse 80% 60% at 50% 100%, rgba(35,58,94,0.12) 0%, rgba(0,0,0,0.95) 100%);
  --icon-filter: drop-shadow(0 0 6px #233a5e44);
  --icon-hover-filter: drop-shadow(0 0 16px #fff8);
  --icon-hover-color: #fff;
  --profile-shadow: 0 4px 24px 0 #233a5e33;
  --card-border: none;
  --switcher-bg: rgba(24,28,36,0.9);
  --switcher-border: 1px solid rgba(79,124,207,0.2);
  --switcher-btn-hover: rgba(35,58,94,0.5);
  --switcher-active-bg: #4f7ccf;
  --switcher-active-color: #fff;
  --switcher-color: #b6c3d6;
}

[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-card: rgba(255,255,255,0.95);
  --bg-card-hover: linear-gradient(90deg, #e8eef6 0%, #fff 100%);
  --bg-social: #ffffff;
  --text-primary: #1a1a2e;
  --text-heading: #0d0d2b;
  --text-secondary: #4a5568;
  --text-link: #2b5dae;
  --text-link-hover: #0d0d2b;
  --accent: #3b6fd4;
  --accent-bg: #dbe5f5;
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.06), 0 1px 6px rgba(0,0,0,0.04);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.1), 0 2px 10px rgba(0,0,0,0.04);
  --shadow-social-hover: 0 4px 14px rgba(0,0,0,0.1);
  --divider: linear-gradient(90deg, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0.02) 100%);
  --tag-bg: #e8eef6;
  --tag-color: #2b5dae;
  --overlay-1: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(219,229,245,0.6) 0%, rgba(219,229,245,0.2) 60%, transparent 100%);
  --overlay-2: radial-gradient(ellipse 30% 20% at 20% 80%, rgba(59,111,212,0.08) 0%, transparent 60%, transparent 100%);
  --overlay-3: radial-gradient(ellipse 80% 60% at 50% 100%, rgba(219,229,245,0.15) 0%, rgba(240,242,245,0.95) 100%);
  --icon-filter: drop-shadow(0 0 4px rgba(0,0,0,0.1));
  --icon-hover-filter: drop-shadow(0 0 8px rgba(59,111,212,0.4));
  --icon-hover-color: #2b5dae;
  --profile-shadow: 0 4px 20px rgba(0,0,0,0.1);
  --card-border: 1px solid rgba(0,0,0,0.06);
  --switcher-bg: rgba(255,255,255,0.95);
  --switcher-border: 1px solid rgba(0,0,0,0.1);
  --switcher-btn-hover: rgba(0,0,0,0.06);
  --switcher-active-bg: #3b6fd4;
  --switcher-active-color: #fff;
  --switcher-color: #4a5568;
}

/* ========================================
   Base Styles
   ======================================== */

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Montserrat', 'Inter', 'Segoe UI', 'Roboto', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  position: relative;
  overflow-x: hidden;
  font-size: 15px;
  letter-spacing: 0.01em;
  transition: background 0.3s, color 0.3s;
}

.site-win98 { display: none; }

/* ========================================
   Theme Switcher
   ======================================== */

.theme-switcher {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  gap: 2px;
  background: var(--switcher-bg);
  border: var(--switcher-border);
  border-radius: 24px;
  padding: 3px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.theme-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--switcher-color);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.theme-btn:hover {
  background: var(--switcher-btn-hover);
}

.theme-btn.active {
  background: var(--switcher-active-bg);
  color: var(--switcher-active-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ========================================
   Background Overlay
   ======================================== */

.background-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    var(--overlay-1),
    var(--overlay-2),
    var(--overlay-3);
  transition: background 0.3s;
}

/* ========================================
   Container
   ======================================== */

.container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 8px 16px 8px;
}

/* ========================================
   Profile
   ======================================== */

.profile-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: none;
  margin-bottom: 14px;
  box-shadow: var(--profile-shadow);
  transition: box-shadow 0.3s;
}

.title {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0 0 7px 0;
  letter-spacing: 1.5px;
  text-align: center;
  color: var(--text-heading);
  transition: color 0.3s;
}

.subtitle {
  font-size: 0.93rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  text-align: center;
  line-height: 1.6;
  font-weight: 400;
  transition: color 0.3s;
}

/* ========================================
   Social Icons
   ======================================== */

.social-icons {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
  justify-content: center;
}
.social-icons a {
  color: var(--text-secondary);
  font-size: 1.08rem;
  background: var(--bg-social);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  border: var(--card-border);
}
.social-icons a:hover {
  background: var(--accent-bg);
  color: var(--icon-hover-color);
  box-shadow: var(--shadow-social-hover);
}

/* ========================================
   Bento Grid
   ======================================== */

.ensar-section {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto;
  gap: 18px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto 36px auto;
}

.ensar-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px 18px 16px 18px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.98rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  position: relative;
  transition: background 0.18s, box-shadow 0.18s, transform 0.18s;
  border: var(--card-border);
}
.ensar-card i {
  font-size: 1.1rem;
  margin: 0 7px 0 0;
  filter: var(--icon-filter);
  transition: filter 0.18s, color 0.18s;
}
.ensar-title {
  font-size: 1.04rem;
  font-weight: 600;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-heading);
}
.ensar-card .desc {
  font-size: 0.89rem;
  margin-top: 1px;
  color: var(--text-secondary);
}
.ensar-card-wide {
  padding-top: 22px;
  padding-bottom: 18px;
}
.ensar-card:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px) scale(1.022);
}
.ensar-card:hover i {
  color: var(--icon-hover-color);
  filter: var(--icon-hover-filter);
}

/* ========================================
   Divider
   ======================================== */

.divider {
  border: none;
  height: 2px;
  width: 80%;
  margin: 18px auto 0 auto;
  background: var(--divider);
  border-radius: 2px;
}

/* ========================================
   Medium Posts
   ======================================== */

.medium-list {
  list-style: none;
  padding: 0;
  margin: 0;
  margin-top: 2px;
}
.medium-list li {
  margin: 16px 0 16px 0;
  font-size: 0.87em;
  line-height: 1.5;
  display: block;
  font-weight: 400;
}
.medium-list a {
  color: var(--text-link);
  text-decoration: none;
  transition: color 0.18s;
  font-weight: 500;
}
.medium-list a:hover {
  color: var(--text-link-hover);
  text-decoration: underline;
}

.medium-link-white {
  color: var(--text-link-hover) !important;
  text-decoration: underline;
  font-weight: 500;
  font-family: 'Montserrat', 'Inter', 'Segoe UI', 'Roboto', Arial, sans-serif;
  font-size: 0.97em;
  display: block;
  margin-bottom: 4px;
}
.medium-link-white::before {
  content: '\f35d';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.93em;
  margin-right: 4px;
  opacity: 0.7;
  display: inline-block;
}
.medium-link-white:hover {
  color: var(--accent) !important;
  text-decoration: underline;
}
.medium-list-title {
  font-size: 1.01em;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.medium-meta {
  font-size: 0.78em;
  color: var(--text-secondary);
  margin-top: 0;
  font-weight: 400;
  display: block;
  margin-left: 0;
}
.medium-meta span, .medium-meta .medium-tag {
  display: inline-block;
  margin-top: 2px;
}
.medium-tag {
  background: var(--tag-bg);
  color: var(--tag-color);
  border-radius: 6px;
  padding: 1px 7px 1px 7px;
  font-size: 0.85em;
  margin-left: 0;
  margin-top: 2px;
  font-weight: 500;
  letter-spacing: 0.01em;
  display: inline-block;
}

.medium-tags-row {
  display: block;
  margin-top: 4px;
}

/* ========================================
   GitHub Repos
   ======================================== */

.github-list {
  list-style: none;
  padding: 0;
  margin: 0;
  margin-top: 2px;
}
.github-repo-item {
  margin: 14px 0;
  font-size: 0.87em;
  line-height: 1.5;
}
.github-repo-desc {
  font-size: 0.85em;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.4;
}
.github-lang {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.github-lang-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ========================================
   Legacy Support
   ======================================== */

.links {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.link-box {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 18px 22px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  transition: background 0.18s cubic-bezier(.4,0,.2,1), transform 0.18s cubic-bezier(.4,0,.2,1), box-shadow 0.18s;
  position: relative;
}
.link-box:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px) scale(1.015);
}
.link-box .desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 4px;
}

/* ========================================
   CV Modal
   ======================================== */

.cv-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0; right: 0; bottom: 0;
  width: 100vw; height: 100vh;
  background: rgba(20,24,32,0.88);
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.cv-modal-content {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
  max-width: 700px;
  width: 98vw;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}
.cv-modal-content h3 {
  color: var(--text-heading);
  font-size: 1.13rem;
  font-weight: 700;
  margin: 18px 0 10px 0;
  text-align: center;
}
.cv-modal-content iframe {
  width: 100%;
  height: 540px;
  border-radius: 0;
  border: none;
  background: #222;
  margin: 0;
  display: block;
}
.cv-modal-close {
  position: absolute;
  top: 10px; right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.7rem;
  cursor: pointer;
  transition: color 0.18s;
  z-index: 2;
}
.cv-modal-close:hover {
  color: var(--text-primary);
}
.cv-download-btn {
  margin: 18px auto 18px auto;
  display: block;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 900px) {
  .ensar-section {
    max-width: 98vw;
  }
  .cv-modal-content {
    max-width: 99vw;
  }
  .cv-modal-content iframe {
    height: 340px;
  }
  .theme-switcher {
    top: 10px;
    right: 10px;
  }
}

@media (max-width: 700px) {
  .ensar-section {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    max-width: 99vw;
    gap: 12px;
  }
  .ensar-card, .ensar-card-wide {
    padding: 14px 8px 10px 10px;
    font-size: 0.93rem;
  }
  .ensar-title {
    font-size: 0.98rem;
  }
  .ensar-card .desc {
    font-size: 0.82rem;
  }
  .profile-img {
    width: 62px;
    height: 62px;
    margin-bottom: 8px;
  }
  .theme-switcher {
    top: 8px;
    right: 8px;
  }
  .theme-btn {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .cv-modal-content {
    max-width: 99vw;
  }
  .cv-modal-content h3 {
    font-size: 1rem;
    margin: 10px 0 6px 0;
  }
  .cv-modal-content iframe {
    height: 180px;
  }
  .cv-download-btn {
    font-size: 0.93rem;
    padding: 7px 10px;
  }
}
