/* al-folio inspired clean academic theme */

/* ===== CSS Variables ===== */
:root {
  --bg-color: #ffffff;
  --text-color: #212529;
  --text-muted: #6c757d;
  --heading-color: #212529;
  --link-color: #0076df;
  --link-hover: #004080;
  --border-color: #dee2e6;
  --card-bg: #f8f9fa;
  --accent-color: #0076df;
  --nav-bg: rgba(255, 255, 255, 0.95);
  --code-bg: #f4f4f4;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  --max-width: 800px;
  --transition: 0.2s ease;
}

/* Dark mode */
[data-theme="dark"] {
  --bg-color: #1a1a2e;
  --text-color: #e4e4e7;
  --text-muted: #a1a1aa;
  --heading-color: #fafafa;
  --link-color: #60a5fa;
  --link-hover: #93c5fd;
  --border-color: #3f3f46;
  --card-bg: #27273a;
  --accent-color: #60a5fa;
  --nav-bg: rgba(26, 26, 46, 0.95);
  --code-bg: #27273a;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ===== Base Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  color: var(--heading-color);
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; margin-top: 2rem; }
h3 { font-size: 1.25rem; }

p {
  margin: 0 0 1rem;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* ===== Navigation ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
}

.navbar-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading-color);
  text-decoration: none;
}

.navbar-brand:hover {
  color: var(--heading-color);
  text-decoration: none;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item a {
  color: var(--text-color);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.25rem 0;
  position: relative;
}

.nav-item a:hover {
  color: var(--link-color);
  text-decoration: none;
}

.nav-item a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-color);
  transition: width var(--transition);
}

.nav-item a:hover::after {
  width: 100%;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition);
}

.theme-toggle:hover {
  background: var(--card-bg);
}

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

/* ===== Main Content ===== */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* ===== About Section (al-folio style) ===== */
.about-section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  align-items: start;
  margin-bottom: 3rem;
}

.profile-wrapper {
  text-align: center;
}

.profile-image {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-color);
  margin-bottom: 1rem;
}

.profile-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.profile-title {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.profile-affiliation {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.profile-affiliation a {
  color: var(--text-muted);
}

.profile-affiliation a:hover {
  color: var(--link-color);
}

.bio-content h1 {
  margin-bottom: 1rem;
  font-size: 1.75rem;
}

.bio-text {
  color: var(--text-color);
  margin-bottom: 1.5rem;
}

/* Social icons row */
.social-icons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  transition: all var(--transition);
}

.social-link:hover {
  color: var(--link-color);
  border-color: var(--link-color);
  text-decoration: none;
}

.social-link svg {
  width: 18px;
  height: 18px;
}

/* ===== Section Headings ===== */
.section-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.section-heading h2 {
  margin: 0;
  font-size: 1.25rem;
}

.section-heading a {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== News Section ===== */
.news-section {
  margin-bottom: 3rem;
}

.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.news-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.news-item:last-child {
  border-bottom: none;
}

.news-date {
  flex-shrink: 0;
  width: 80px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.news-content {
  flex: 1;
}

.news-content a {
  font-weight: 500;
}

/* ===== Publications Section ===== */
.publications-section {
  margin-bottom: 3rem;
}

.publication-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}

.publication-item:last-child {
  border-bottom: none;
}

.publication-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.publication-title a {
  color: var(--heading-color);
}

.publication-title a:hover {
  color: var(--link-color);
}

.publication-authors {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.publication-venue {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.publication-links {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.pub-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.pub-link:hover {
  color: var(--link-color);
  border-color: var(--link-color);
  text-decoration: none;
}

/* ===== Projects Section ===== */
.projects-section {
  margin-bottom: 3rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  transition: box-shadow var(--transition), transform var(--transition);
}

.project-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.project-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.project-card h3 a {
  color: var(--heading-color);
}

.project-card h3 a:hover {
  color: var(--link-color);
  text-decoration: none;
}

.project-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

/* ===== Experience Section ===== */
.experience-section {
  margin-bottom: 3rem;
}

.experience-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}

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

.experience-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.experience-content h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.experience-company {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.experience-description {
  font-size: 0.9rem;
  color: var(--text-color);
  margin: 0;
}

/* ===== Education Section ===== */
.education-section {
  margin-bottom: 3rem;
}

.education-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.education-item:last-child {
  border-bottom: none;
}

.education-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.education-content h3 {
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.education-school {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ===== Skills Section ===== */
.skills-section {
  margin-bottom: 3rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.skill-category h3 {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-color);
}

/* ===== Terminal Button (keep as fun feature) ===== */
.terminal-launcher {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 50;
}

.terminal-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--heading-color);
  color: var(--bg-color);
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform var(--transition), box-shadow var(--transition);
}

.terminal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.terminal-btn svg {
  width: 18px;
  height: 18px;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--link-color);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .about-section {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .profile-wrapper {
    margin-bottom: 1rem;
  }

  .profile-image {
    width: 150px;
    height: 150px;
  }

  .bio-content {
    text-align: left;
  }

  .social-icons {
    justify-content: center;
  }

  .experience-item,
  .education-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .navbar-nav {
    gap: 1rem;
  }

  .nav-item a {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .navbar-container {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .navbar-nav {
    gap: 0.75rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Utility Classes ===== */
.text-muted {
  color: var(--text-muted);
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ===== Blog Post Styles ===== */
.post {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.post h1 {
  margin-bottom: 1.5rem;
}

.post h2, .post h3, .post h4 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.post p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.post a {
  text-decoration: underline;
}

.post pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1rem 0;
}

.post code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

.post pre code {
  background: none;
  padding: 0;
}

.post img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1rem 0;
}

.post blockquote {
  border-left: 4px solid var(--accent-color);
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  background: var(--card-bg);
  border-radius: 0 6px 6px 0;
}

.post ul, .post ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.post li {
  margin-bottom: 0.5rem;
}

/* ===== Terminal Mode Styles ===== */
/* Terminal-specific variables */
body.terminal-active {
  --terminal-bg: #211830;
  --terminal-text: #22eae0;
  --terminal-accent: #e60efe;
  background: var(--terminal-bg);
  color: var(--terminal-text);
  font-family: 'Courier New', Courier, monospace;
  padding: 10px 20px;
}

body.terminal-active .navbar {
  background: rgba(33, 24, 48, 0.95);
  border-bottom-color: rgba(230, 14, 254, 0.15);
}

body.terminal-active .navbar-brand,
body.terminal-active .nav-item a {
  color: var(--terminal-text);
}

body.terminal-active .theme-toggle {
  color: var(--terminal-text);
}

/* Hide main content when terminal is active */
body.terminal-active .main-content,
body.terminal-active .site-footer,
body.terminal-active .terminal-launcher {
  display: none;
}

/* Terminal cursor */
body.terminal-active .cursor {
  font-size: 12px;
  background-color: #22eae0;
  color: #22eae0;
  position: relative;
  opacity: 0.5;
  height: 1.5em;
  width: 3px;
  max-width: 3px;
  transform: translateY(4px);
  overflow: hidden;
  text-indent: -5px;
  display: inline-block;
  animation: blinker 1s linear infinite;
}

@keyframes blinker {
  50% { opacity: 0; }
}

/* Terminal input */
body.terminal-active #cmd {
  cursor: text;
  height: 50px;
  display: block !important;
}

body.terminal-active #getter {
  line-height: 1.3em;
  margin-top: -2px;
  animation: show 0.1s ease forwards;
  opacity: 0;
}

body.terminal-active #getter::before {
  content: "admin> ";
}

body.terminal-active #getter.password::before {
  content: "Password:";
}

body.terminal-active #getter.shutdown::before {
  content: "";
}

@keyframes show {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Terminal output */
body.terminal-active #terminal {
  display: block !important;
}

body.terminal-active #terminal p {
  display: block;
  line-height: 1.3em;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: 0.05em;
  animation: typing 0.5s steps(30, end);
  color: #22eae0;
}

body.terminal-active .no-animation {
  animation: typing 0 steps(30, end);
}

body.terminal-active .margin {
  margin-left: 20px;
}

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

/* Terminal text colors */
body.terminal-active .indice { color: #433674; }
body.terminal-active .colored { color: #e60efe; }
body.terminal-active .command { color: #9d0ffd; }
body.terminal-active .error { color: #f50f65; }
body.terminal-active .white { color: #fff; }
body.terminal-active .inherit { color: #22eae0; }

body.terminal-active a {
  color: #22eae0;
  text-decoration: none;
}

body.terminal-active a:hover {
  background: #22eae0;
  color: #211830;
  text-decoration: none;
}

body.terminal-active b {
  font-weight: bold;
  text-decoration: underline;
}

body.terminal-active ::selection {
  background-color: #22eae0;
  color: #211830;
}

body.terminal-active ::-moz-selection {
  background-color: #22eae0;
  color: #211830;
}

/* Terminal textarea */
body.terminal-active textarea#setter {
  left: -1000px;
  position: absolute;
}

/* Terminal animation overlay */
.animation {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: #211830;
  z-index: 110;
  text-align: center;
  display: none;
}

.animation img,
.animation a {
  margin-top: 50vh;
  transform: translateY(-50%);
}

/* Terminal color themes */
body.terminal-active.color1 { filter: hue-rotate(45deg); }
body.terminal-active.color2 { filter: hue-rotate(90deg); }
body.terminal-active.color3 { filter: hue-rotate(135deg); }
body.terminal-active.color4 { filter: hue-rotate(180deg); }
body.terminal-active.color5 { filter: hue-rotate(225deg); }
body.terminal-active.color6 { filter: hue-rotate(270deg); }
body.terminal-active.color7 { filter: hue-rotate(315deg); }
body.terminal-active.color8 { filter: invert(100%); background: #dee7cf; }
body.terminal-active.shutdown { filter: contrast(100%) grayscale(100%); background: #000; }

/* Terminal window (works popup) */
body.terminal-active .container {
  position: fixed;
  width: 100vw;
  height: calc(100vh - 10px);
  z-index: 20;
  display: none;
  opacity: 0;
}

body.terminal-active .container.open {
  display: block !important;
  opacity: 1;
}

body.terminal-active .resize-drag {
  background: #c0c0c0;
  border: 4px #000 outset;
  font-weight: bold;
  touch-action: none;
  position: absolute;
  height: 600px;
  width: 560px;
  top: 10vh;
  left: 10vw;
  box-sizing: border-box;
  overflow: hidden;
}

body.terminal-active .top {
  height: 25px;
  line-height: 25px;
  color: #fff;
  background: linear-gradient(to right, #9d0ffd 0%, #e60efe 100%);
  width: 100%;
}

body.terminal-active #toped {
  padding: 3px 0 0 10px;
  float: left;
  color: #fff;
}

body.terminal-active .undrag {
  background: #c0c0c0;
  width: 100%;
  height: calc(100% - 25px);
  color: #000;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

body.terminal-active .linkTop {
  display: inline;
  color: #000;
  padding: 3px;
  line-height: 24px;
}

body.terminal-active .linkTop:hover {
  background: #969696;
}

body.terminal-active .linkTop:first-child {
  margin-left: 4px;
}

body.terminal-active .prez {
  background: #fff;
  border: 3px #969696 inset;
  margin: 0 4px 4px;
  padding: 10px;
  width: calc(100% - 8px);
  height: calc(100% - 88px);
  overflow-y: scroll;
  box-sizing: border-box;
  position: relative;
}

body.terminal-active .bottom {
  display: flex;
  margin: 4px;
}

body.terminal-active .bottom p {
  height: 20px;
  border: 3px #969696 inset;
  padding: 2px 4px;
  color: #000;
  white-space: nowrap;
  animation: none;
}

body.terminal-active .b1 {
  flex: initial;
  margin-right: 6px;
}

body.terminal-active .b2 {
  flex: 1;
}

body.terminal-active #close {
  float: right;
  margin: 2px 4px;
  cursor: pointer;
}

body.terminal-active .btn {
  background: #c0c0c0;
  padding: 2px 6px;
  color: #000;
  border: 3px #000 outset;
  transition: all 0.5s ease;
}

body.terminal-active .btn:hover {
  background: #c0c0c0;
  border: 3px #000 inset;
}

body.terminal-active .prez-2 {
  position: absolute;
  top: 24px;
  left: 4px;
  right: 4px;
  display: none;
  opacity: 0;
  height: calc(100% - 88px);
  background: #fff;
  border: 3px #969696 inset;
  padding: 10px;
  overflow-y: auto;
  box-sizing: border-box;
}

body.terminal-active .prez-2 img {
  width: 100%;
  max-width: auto;
}

body.terminal-active .prez-2 p {
  white-space: inherit;
  animation: none;
  color: #000;
  margin: 0 0 10px;
}

body.terminal-active .prez-2 h3 {
  color: #000;
  margin: 0 0 10px;
  font-size: 16px;
}

body.terminal-active .prez-show {
  display: inherit;
  opacity: 1;
}

body.terminal-active .icon {
  display: inline;
  text-align: center;
  float: left;
  margin: 14px;
  width: 100px;
}

body.terminal-active .icon:first-child {
  margin-left: 6px;
}

body.terminal-active .icon p,
body.terminal-active .icon img {
  display: block;
  width: 90px;
  animation: inherit;
  color: #000;
  overflow: inherit;
  white-space: inherit;
}

body.terminal-active .icon p {
  width: 100px;
}

body.terminal-active .hover {
  position: absolute;
  opacity: 0;
}

body.terminal-active .icon:hover {
  background: inherit;
}

body.terminal-active .icon:hover p {
  color: #fff;
  background: url(../img/bk.png), linear-gradient(to right, #9d0ffd 0%, #e60efe 100%);
}

body.terminal-active .icon:hover > .hover {
  opacity: 1;
}

/* Exit terminal button in navbar */
.exit-terminal-btn {
  display: none;
  padding: 0.5rem 0.75rem;
  background: transparent;
  color: #f50f65;
  border: 1px solid rgba(245, 15, 101, 0.5);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

body.terminal-active .exit-terminal-btn {
  display: inline-flex;
}

.exit-terminal-btn:hover {
  background: rgba(245, 15, 101, 0.1);
}

/* Hide terminal elements when not active */
body:not(.terminal-active) .container,
body:not(.terminal-active) #terminal,
body:not(.terminal-active) #cmd {
  display: none;
}

/* ===== Print Styles ===== */
@media print {
  .navbar,
  .terminal-launcher,
  .theme-toggle {
    display: none;
  }

  body {
    background: white;
    color: black;
  }
}
