:root {
  --wrap: 1100px;
  --pad: clamp(18px, 5vw, 32px);
  --bg: #f9f9ff;
  --fg: #0f172a;
  --muted: #454b6b;
  --band: #eaf3ff;
  --line: #dee6ef;
  --card: #fff;
  --accent: #0b5bd3;
  --shadow: 0 10px 30px rgba(15,23,42,.08);
  --radius: 16px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --fg: #e2e8f0;
  --muted: #94a3b8;
  --band: #1e293b;
  --line: #334155;
  --card: #1e293b;
  --accent: #3b82f6;
  --shadow: 0 10px 30px rgba(0,0,0,.3);
}

*{box-sizing:border-box}
html,body{
  margin:0; padding:0;
  background:var(--bg); color:var(--fg);
  font:16px/1.6 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
}
a{color:var(--accent); text-underline-offset:2px}
.container{max-width:var(--wrap); margin:0 auto; padding:0 var(--pad)}

/* ---------- Header ---------- */
header.site{
  background:var(--card);
  border-bottom:1px solid var(--line);
  box-shadow:var(--shadow);
  position:sticky; top:0; z-index:10;
}
.topbar{display:flex; justify-content:space-between; align-items:center; padding:14px 0}
.brandwrap{display:flex; flex-direction:column; gap:.25rem; margin-left:32px}
.brand{font-size:1.7rem; font-weight:700; color:var(--fg)}
.tagline{
  font-size: 0.9rem;
  color: #4A90E2 !important;
  font-weight: 500;
  letter-spacing: 0.3px;
}

[data-theme="dark"] .tagline {
  color: var(--accent) !important;
}

[data-theme="light"] .tagline {
  color: var(--accent) !important;
}

nav{display:flex; gap:12px; align-items:center}
nav a{
  display:inline-block; padding:8px 10px; border-radius:12px;
  text-decoration:none; color:var(--fg); font-weight:700
}
nav a:hover{background:#eef4ff}

/* ---------- Hero band ---------- */
.hero-band{background:var(--band); border-bottom:1px solid var(--line)}
.hero{
  display:grid; grid-template-columns:minmax(0,1fr) 380px;
  gap:28px; align-items:start; padding:32px 0
}
.hero h2{margin:0 0 12px 0; font-size:1.9rem; line-height:1.2}
.hero p{margin:0 0 12px 0; color:#1f2d3d}
.hero ul{margin:10px 0 0 22px}
.hero li{margin:6px 0}
.profileimg{width:100%; height:auto; border-radius:14px; box-shadow:var(--shadow); object-fit:cover; display:block}

/* ---------- Sections / cards / pills ---------- */
section.section{padding:40px 0}

h3.title {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: #ffffff;
}

[data-theme="dark"] h3.title {
  color: #ffffff;
}

[data-theme="light"] h3.title {
  color: #0f172a;
}

p.lead{
  margin: 6px 0 10px 0;
  color: var(--muted);
  text-align: center;
}

[data-theme="dark"] p.lead {
  color: #b0c4ff;
}

[data-theme="light"] p.lead {
  color: #1e2a38;
}

.pills{display:flex; flex-wrap:wrap; gap:10px; justify-content:center;}
.pill{background:#e6f1ff; border:1px solid #b7d8ff; color:#0f3b82; padding:8px 12px; border-radius:12px; font-weight:600}

[data-theme="dark"] .pill {
  background: #0f3460 !important;
  border: 1px solid #1e5a8e !important;
  color: #a8d5ff !important;
}

[data-theme="light"] .pill {
  background: #0066ff !important;
  border: 1px solid #0052cc !important;
  color: #ffffff !important;
  font-weight: 600 !important;
}

.grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:18px}
.card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; display:flex; flex-direction:column; height:100%}
.card-body{padding:14px; display:flex; flex-direction:column; flex:1; justify-content:space-between}
.card h4{margin:6px 0; font-size:1.12rem}

[data-theme="dark"] .card h4 {
  color: #f1f5f9 !important;
}

.tidy li{margin:6px 0}

.btnrow{display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-top:auto; padding-top:10px}
.btn{display:inline-block; padding:10px 12px; border-radius:12px; border:1px solid var(--line); text-decoration:none; font-weight:700; background:#f9fbff}
.btn:hover{background:#f0f0ff}

[data-theme="dark"] .btn { background: #0f172a; color: #60a5fa; }

.smalllink{font-size:.9rem}

[data-theme="dark"] .smalllink { color: #60a5fa; }

.thumb{display:block; position:relative; width:100%; aspect-ratio:16/9; overflow:hidden}
.thumb img{width:100%; height:100%; object-fit:cover; display:block}

/* ---------- Media grid ---------- */
#media .card-body{height:220px; overflow:hidden; display:flex; align-items:center; justify-content:center; background:#fff}
#media .card-body img{width:100%; height:100%; object-fit:cover; border-radius:12px; transition:transform .2s ease; cursor:pointer}
#media .card-body img:hover{transform:scale(1.03)}

[data-theme="dark"] #media .card-body { background: #1e293b; }

/* ---------- Section card ---------- */
.section-card{background:#f9fafb; border:1px solid #e0e0e0; border-radius:12px; padding:2.5rem; box-shadow:0 4px 12px rgba(0,0,0,.03); transition:box-shadow .3s ease}

[data-theme="dark"] .section-card {
  background: #0f172a !important;
  border: 1px solid #334155 !important;
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--line);
  color: #6b7a90;
  padding: 18px 0;
  margin-top: 10px;
  text-align: center;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.95rem;
}

footer * {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

footer .container span,
footer .container a {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] .footer-email {
  color: #b0c4ff;
}

[data-theme="light"] .footer-email {
  color: #1f2d5d;
}

/* ---------- Smooth scroll & anchor offset ---------- */
html{scroll-behavior:smooth; scroll-padding-top: 120px;}
section[id], .hero-band{ scroll-margin-top: 120px; }

/* ---------- Dark mode toggle button ---------- */
#theme-toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--fg);
  transition: all 0.2s;
  font-size: 1.2rem;
}

#theme-toggle:hover {
  background: #eef4ff;
}

/* ---------- Skills section ---------- */
#skills h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
}

[data-theme="dark"] #skills h4 {
  color: #f1f5f9 !important;
}

[data-theme="light"] #skills h4 {
  color: #1e293b !important;
}

/* ---------- Education section ---------- */
#education h3.title {
  text-align: center !important;
  font-size: 2rem !important;
}

[data-theme="dark"] #education h3.title {
  color: #ffffff !important;
}

[data-theme="light"] #education h3.title {
  color: #0f172a !important;
}

#education h4 {
  color: #ffffff !important;
}

[data-theme="dark"] #education h4 {
  color: #ffffff !important;
}

[data-theme="light"] #education h4 {
  color: #ffffff !important;
}

/* Ensure card titles stay white on mobile too */
@media (max-width: 820px) {
  #education h4 {
    color: #ffffff !important;
  }
}

/* ---------- About section ---------- */
[data-theme="dark"] #about h2 { color: #e2e8f0 !important; }
[data-theme="dark"] #about p { color: #cbd5e1 !important; }
[data-theme="dark"] #about li { color: #cbd5e1 !important; }

#about ul {
  list-style-type: none !important;
}

#about a {
  pointer-events: auto !important;
  cursor: pointer !important;
}

#about a svg,
#about a img,
#about a span {
  pointer-events: none !important;
}

/* ---------- Connect section ---------- */
#connect a[href*="github"] {
  color: #0f172a !important;
}

#connect a[href*="github"] svg {
  color: #0f172a !important;
}

/* ---------- Mobile layout ---------- */
@media (max-width:820px){
  .topbar{flex-direction:column; align-items:stretch; gap:8px; padding:12px 0}
  .brandwrap{margin-left:0; padding:0 var(--pad); padding-right: 50px;}

  .tagline {
    font-size: 0.7rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  nav{
    display:grid; grid-template-columns:repeat(3,minmax(0,1fr));
    gap:8px 10px; width:100%; padding:0 var(--pad) 2px;
  }

  nav a{
    margin:0; padding:8px 6px; text-align:center;
    background:#f4f7ff; border:1px solid var(--line); border-radius:10px; font-weight:700;
    font-size:0.88rem;
  }

  [data-theme="dark"] nav a {
    color: #e2e8f0 !important;
    background: #334155 !important;
    border: 1px solid #475569 !important;
  }

  [data-theme="light"] nav a {
    color: #0f172a !important;
    background: #f4f7ff !important;
  }

  #theme-toggle {
    position: absolute;
    top: 12px;
    right: var(--pad);
    z-index: 100;
    padding: 6px 8px;
    font-size: 1rem;
    min-width: 36px;
  }

  #theme-icon {
    font-size: 1rem;
  }

  .hero{grid-template-columns:1fr; padding:20px 0}
  .hero .profileimg{max-width:320px; margin:0 auto}
  .hero h2{font-size:1.6rem}
  .hero p{font-size:.95rem}

  #about section {
    text-align: center !important;
  }

  #about h2 {
    text-align: center !important;
    margin-bottom: 1rem !important;
  }

  #about p {
    text-align: center !important;
    margin-bottom: 1rem !important;
  }

  #about ul {
    text-align: left !important;
    display: inline-block !important;
    margin: 1rem auto !important;
    padding-left: 0 !important;
  }

  #about div[style*="display: flex"] {
    display: flex !important;
    justify-content: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    gap: 1.5rem !important;
  }

  #about div[style*="display: flex"][style*="gap: 1.5rem"] {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 1rem !important;
  max-width: 300px !important;
  margin: 0 auto !important;
  padding: 0 var(--pad) !important;
  justify-items: center !important;
}

  #about section {
  padding: 0 1.5rem !important;
}

#about div[style*="margin: 1.5rem 0"] {
  padding: 0 1rem !important;
}

#about div[style*="display: flex"][style*="gap: 1.5rem"] {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 1rem !important;
  max-width: 300px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

  #education > div > h3.title {
    text-align: center !important;
    font-size: 2rem !important;
  }

  #education .section-card > div {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 2rem !important;
}

#education .section-card > div > div {
  min-width: 100% !important;
  width: 100% !important;
  max-width: 100% !important;
}

  .pills {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.6rem;
    justify-items: center;
  }

  .pill {
    width: 100%;
    text-align: center;
  }

  .connect-label {
    display: none;
  }
}

@media (max-width:420px){
  nav a{padding:6px 8px; font-size:.82rem}
  .brand{font-size:1.35rem}
  .tagline{font-size:.7rem}
}

@media (min-width: 821px) {
  .tagline {
    font-size: 0.9rem !important;
  }
}

/* Typewriter effect for tagline - desktop only */
@media (min-width: 821px) {
  .tagline {
    overflow: hidden;
    border-right: 2px solid var(--accent);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
    animation-delay: 0.5s;
    animation-fill-mode: backwards;
  }

  .tagline.typed {
    animation: none;
    border-right: none;
  }
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent); }
}

/* Hide cert logos on mobile only */
@media (max-width: 768px) {
  .cert-logo-hide-mobile {
    display: none !important;
  }
}