/* ============================================
   Profile — global styles
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0f172a;
  --bg-2: #131c33;
  --card: rgba(30, 41, 59, 0.7);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #a78bfa;
  --border: rgba(148, 163, 184, 0.15);
  --glass: rgba(15, 23, 42, 0.7);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Page load fade-in */
@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

main {
  animation: pageFadeIn 1.4s cubic-bezier(0.22, 1, 0.36, 1);
  flex: 1;
  display: flex;
  flex-direction: column;
}

main > .container {
  flex: 1;
}

@media (prefers-reduced-motion: reduce) {
  main {
    animation: none;
  }
}

/* ============================================
   Page loader overlay
   ============================================ */
#loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loader-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader {
  height: 80px;
  aspect-ratio: 1;
  display: grid;
}
.loader:before,
.loader:after {
  content: "";
  --c: no-repeat linear-gradient(#fff 0 0);
  background: var(--c), var(--c);
  background-size: 25% 50%;
  animation: l4 1.5s infinite linear;
}
.loader:after {
  transform: scale(-1);
}
@keyframes l4 {
  0%,
  10%  { background-position: 33.4% 100%, 66.6% 100%; }
  40%  { background-position: 33.4% 0, 100% 100%; }
  70%  { background-position: 0 100%, 66.6% 0; }
  100% { background-position: 33.4% 100%, 66.6% 100%; }
}

/* ============================================
   Binary background canvas
   ============================================ */
#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ============================================
   Top bar (rendered inside assets/nav.html iframe)
   ============================================ */
.topbar {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-frame {
  position: sticky;
  top: 0;
  z-index: 100;
  border: none;
  width: 100%;
  height: 65px;
  display: block;
  background: transparent;
  transition: height 0.25s ease;
}

.footer-frame {
  border: none;
  width: 100%;
  max-width: 900px;
  height: 50px;
  display: block;
  margin: 0 auto;
  background: transparent;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 0.4rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  position: relative;
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.08);
}

.nav-links a.active {
  color: var(--accent);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.25rem;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.4rem;
}

.hamburger svg {
  width: 24px;
  height: 24px;
}

/* ============================================
   Page container
   ============================================ */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  min-height: calc(100vh - 70px);
}

/* ============================================
   Hero
   ============================================ */
.hero {
  text-align: center;
  padding: 2rem 1rem 2.5rem;
}

.avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: 700;
  color: #0f172a;
  box-shadow: 0 10px 40px rgba(56, 189, 248, 0.35);
  animation: avatarFloat 6s ease-in-out infinite;
}

@keyframes avatarFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 0.7rem;
}

.location {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.8rem;
  margin-bottom: 1.4rem;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 12px 32px rgba(56, 189, 248, 0.12);
}

h2 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================
   About
   ============================================ */
.about p {
  color: var(--muted);
  font-size: 1.05rem;
}

.about p + p {
  margin-top: 1rem;
}

/* ============================================
   Skills
   ============================================ */
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--accent);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.skill:hover {
  background: rgba(56, 189, 248, 0.15);
  transform: translateY(-2px);
}

.skill-group {
  margin-bottom: 1rem;
}

.skill-group:last-child {
  margin-bottom: 0;
}

.skill-label {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* ============================================
   Experience
   ============================================ */
.experience {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.experience:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.experience:first-child {
  padding-top: 0;
}

.exp-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
}

.exp-company {
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  font-weight: 500;
}

.exp-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.exp-desc {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

/* ============================================
   Education
   ============================================ */
.edu-item {
  margin-bottom: 1.4rem;
}

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

.edu-school {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
}

.edu-detail {
  color: var(--accent);
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.edu-courses {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.4rem;
  font-style: italic;
}

/* ============================================
   Projects
   ============================================ */
.project {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.project:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.project:first-child {
  padding-top: 0;
}

.project-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.project-desc {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.project-stack {
  color: var(--accent-2);
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  line-height: 1.5;
}

/* ============================================
   Certifications
   ============================================ */
.cert {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.cert:last-child {
  border-bottom: none;
}

.cert-title {
  font-weight: 600;
  color: var(--text);
}

.cert-issuer {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

/* ============================================
   Contact
   ============================================ */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.link-btn {
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.3);
  color: var(--accent-2);
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.2s;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.link-btn:hover {
  background: rgba(167, 139, 250, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(167, 139, 250, 0.2);
}

/* ============================================
   Footer (rendered inside assets/footer.html iframe, transparent)
   ============================================ */
footer {
  text-align: center;
  padding: 1rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  background: transparent;
}

/* ============================================
   Blog — listing
   ============================================ */
.blog-list {
  display: grid;
  gap: 1rem;
}

.blog-card {
  display: block;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.35);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.blog-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.blog-card-title {
  font-weight: 600;
  font-size: 1.12rem;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.blog-meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  margin-bottom: 0.5rem;
}

.blog-excerpt {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}

.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.blog-tag {
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  color: var(--accent-2);
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

.blog-card-cta {
  display: inline-block;
  margin-top: 0.7rem;
  font-size: 0.85rem;
  color: var(--accent);
}

/* ============================================
   Blog — article
   ============================================ */
.article-header {
  margin-bottom: 1.2rem;
}

.article-header h1 {
  font-size: 1.9rem;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.article-lede {
  color: var(--muted);
  font-size: 1.02rem;
}

.article-figure {
  margin: 1.4rem 0 1.8rem;
}

.article-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.article-figure figcaption {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.83rem;
  text-align: center;
}

.article h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.7rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.article h3 {
  font-size: 1.05rem;
  margin: 1.4rem 0 0.5rem;
  color: var(--accent);
}

.article p,
.article li {
  color: var(--text);
  font-size: 0.97rem;
}

.article p {
  margin-bottom: 0.9rem;
}

.article ul,
.article ol {
  margin: 0 0 1rem 1.3rem;
}

.article li {
  margin-bottom: 0.35rem;
}

.article a {
  color: var(--accent);
}

.article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 0.86em;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 5px;
  padding: 0.1rem 0.35rem;
  color: var(--accent);
}

.article pre {
  background: rgba(2, 6, 23, 0.75);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0 0 1.1rem;
  position: relative;
}

.article pre code {
  background: none;
  border: none;
  padding: 0;
  color: #cbd5e1;
  font-size: 0.85rem;
  line-height: 1.65;
}

/* Copy button anchored to the top-right of every code block. Hidden
   until the user hovers the block — keeps the design clean by default
   while making commands one click away when someone actually needs
   to run them. */
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 0.72rem;
  padding: 0.22rem 0.55rem;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease,
              background 0.15s ease, border-color 0.15s ease;
}

.article pre:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.16);
}

.copy-btn.copied {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.12);
  opacity: 1;
}

.article blockquote {
  margin: 0 0 1.1rem;
  padding: 0.8rem 1rem;
  border-left: 3px solid var(--accent-2);
  background: rgba(167, 139, 250, 0.07);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.article blockquote p:last-child {
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.2rem;
}

.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 460px;
}

.article th,
.article td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.article th {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

.callout {
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: rgba(56, 189, 248, 0.07);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin: 0 0 1.2rem;
  font-size: 0.93rem;
}

.callout strong {
  color: var(--accent);
}

.callout.warn {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.07);
}

.callout.warn strong {
  color: #fbbf24;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
}

.back-link:hover {
  color: var(--accent);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 700px) {
  .article-header h1 { font-size: 1.5rem; }
  .article pre { padding: 0.8rem; }
  /* No hover on touch — keep the copy button visible. */
  .copy-btn { opacity: 0.85; }

  h1 { font-size: 2rem; }
  .avatar { width: 110px; height: 110px; font-size: 2.8rem; }
  .card { padding: 1.4rem; }

  .hamburger {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .nav-links.open {
    max-height: 480px;
  }

  .nav-links a {
    padding: 0.8rem 1rem;
    border-radius: 6px;
  }
}
