@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
  --font-header: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --color-bg: #f4f4f4;
  --color-text: #000000;
  --color-text-muted: #000000;
  --color-accent: #000000;
  --color-border: #e5e5e5;
  --color-card-bg: #f8f8f8;
  --max-width: 1280px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-header);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); margin-bottom: 1.5rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }

a {
  color: inherit;
  text-decoration: none;
}

a:not(.btn) {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.fade-link {
  transition: opacity 0.3s ease;
}

.fade-link:hover {
  opacity: 0.2;
}

.btn-text {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 5rem 0;
}

.btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-primary {
  background: #f0f0f0;
  color: var(--color-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.btn-primary:hover {
  background: #e5e5e5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Split layout (about + projects side by side) */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.split-right .bubble:first-child {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-bottom: 0;
  padding: 1.5rem;
}
.split-right .bubble:first-child .project-card {
  display: flex;
  flex-direction: column;
}

.split-right .bubble:first-child .project-card p {
  flex: 1;
}

.bubble {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 28px;
  padding: 2.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.split-left {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.skills-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
}

.skills-area .skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.skills-area .skills-list li {
  background: var(--color-card-bg);
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
}

.section-label {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text);
}

.bubble-sm {
  padding: 1.5rem;
}

.split-left-actions {
  display: flex;
  gap: 0.75rem;
}

.split-left-actions .btn {
  flex: 1;
  padding: 0.75rem 1rem;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.split-right {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  flex: 1;
}

.split-right .projects-grid {
  grid-template-columns: 1fr;
  gap: 1rem;
  flex: 1;
  grid-auto-rows: 1fr;
}

.split-right .project-card {
  padding: 0.75rem;
  background: var(--color-card-bg);
  border: none;
  border-radius: 16px;
}

.split-right .project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.split-right .project-card h3 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.split-right .project-card p {
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.split-right .project-tags {
  margin-bottom: 0.5rem;
}

.split-right .project-tags li {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
}

.split-right .project-links a {
  font-size: 0.8rem;
}

/* About */
.about-photo {
  float: left;
  width: 180px;
  margin-right: 1.5rem;
  margin-bottom: 0.5rem;
  border-radius: 20px;
  overflow: hidden;
}

.about-photo img {
  width: 100%;
  display: block;
}

.about-text p {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
  list-style: none;
}

.skills-list li {
  background: var(--color-card-bg);
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.75rem;
}

.project-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  padding: 2.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card p {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  list-style: none;
}

.project-tags li {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

.project-links {
  display: flex;
  gap: 1rem;
}

.project-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.project-links a {
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.3s ease;
}

.project-links a:hover {
  opacity: 0.2;
}

/* Resume */
.resume-header {
  text-align: center;
  margin-bottom: 0.5rem;
  padding: 1.5rem 0 0.5rem;
}

.resume-header h1 {
  margin-bottom: 0.25rem;
  white-space: nowrap;
  font-size: clamp(1.5rem, 4vw, 3rem);
}

.resume-header .title {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.resume-section {
  margin-bottom: 2.5rem;
}

.resume-section h2 {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.resume-item {
  margin-bottom: 1.5rem;
}

.resume-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.resume-item-header h3 {
  font-size: 1.05rem;
  margin-bottom: 0;
}

.resume-item-header .date {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.resume-item .subtitle {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.resume-item p,
.resume-item ul {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

.resume-item ul {
  list-style: none;
  padding-left: 0;
}

.resume-item ul li {
  position: relative;
  padding-left: 1.2rem;
  margin-bottom: 0.3rem;
}

.resume-item ul li::before {
  content: '—';
  position: absolute;
  left: 0;
}

.resume-download {
  text-align: center;
  max-width: var(--max-width);
  margin: -1rem auto 0;
  padding: 1rem 1.5rem;
}

.resume-download .btn-primary {
  border: 1px solid var(--color-border);
}

/* Footer */
.footer {
  padding: 8rem 0 2rem;
  text-align: center;
}

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

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  overflow-y: auto;
  padding: 2rem 1.5rem 0;
}

.modal-overlay.open {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

.modal-overlay.open .modal {
  animation: scaleIn 0.25s ease-out;
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal {
  background: var(--color-bg);
  max-width: var(--max-width);
  margin: 2rem auto 1rem;
  padding: 3rem 3rem 1.5rem;
  border-radius: 28px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  color: var(--color-text-muted);
  padding: 0.25rem;
}

.modal-close:hover {
  color: var(--color-text);
}

body.modal-open {
  overflow: hidden;
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: #ffffff;
  color: var(--color-text);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: background 0.2s, color 0.2s;
  perspective: 200px;
}

.theme-toggle:hover {
  background: #f0f0f0;
}

.theme-toggle-icon {
  display: inline-block;
  backface-visibility: hidden;
}

.theme-toggle-icon.flipping {
  animation: flip 0.3s ease;
}

@keyframes flip {
  0%   { transform: rotateY(0deg); }
  50%  { transform: rotateY(180deg); }
  100% { transform: rotateY(360deg); }
}

body.dark-mode .theme-toggle {
  background: #333333;
  color: #f0c040;
  border-color: #555555;
}

body.dark-mode .theme-toggle:hover {
  background: #444444;
}

@media (max-width: 768px) {
  .split-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .bubble {
    padding: 1.5rem;
  }

  .split-left {
    gap: 1.5rem;
  }

  .split-right {
    gap: 1.5rem;
  }

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

  .about-photo {
    float: none;
    width: 200px;
    height: 200px;
    margin: 0 auto 1.5rem;
  }

  .about-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .resume-item-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal {
    padding: 2rem 1.5rem;
    margin: 1rem auto;
  }
}

body.dark-mode {
  --color-bg: #121212;
  --color-text: #e0e0e0;
  --color-text-muted: #888888;
  --color-accent: #ffffff;
  --color-border: #333333;
  --color-card-bg: #2a2a2a;
}

body.dark-mode .bubble {
  background: #1e1e1e;
}

body.dark-mode .modal {
  background: #1e1e1e;
}

body.dark-mode .btn-primary {
  background: #333333;
}

body.dark-mode .btn-primary:hover {
  background: #444444;
}

body.dark-mode .modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}

/* Project modal content */
.project-modal-body h2 {
  margin-bottom: 1rem;
}

.project-modal-body .project-detail {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  line-height: 1.7;
}

body.dark-mode .project-modal-body .project-detail,
body.dark-mode .project-modal-body .project-detail * {
  color: #ffffff !important;
}

body.dark-mode #resume-modal .resume-header h1,
body.dark-mode #resume-modal .title,
body.dark-mode #resume-modal .resume-section h2,
body.dark-mode #resume-modal .resume-item h3,
body.dark-mode #resume-modal .resume-item .subtitle,
body.dark-mode #resume-modal .resume-item .date,
body.dark-mode #resume-modal .resume-item p,
body.dark-mode #resume-modal .resume-item ul li {
  color: #ffffff !important;
}

.modal-mtab-content[data-mtab="markdown"] pre {
  white-space: pre-wrap;
  word-break: break-word;
}

/* Syntax highlighting for Markdown code blocks */
.hl-str { color: #ce9178; }
.hl-prop { color: #9cdcfe; }
.hl-op  { color: #d4d4d4; }
.hl-bullet { color: #b392f0; }
.hl-bold { color: #e0e0e0; font-weight: 600; }
.hl-head { color: #e06c75; }

/* Placeholder highlighting */
.placeholder {
  display: inline-block;
  padding: 0.08em 0.35em;
  border-radius: 4px;
  font-weight: 600;
  color: var(--color-text);
  background: rgba(0,0,0,0.06);
}

body.dark-mode .placeholder {
  background: rgba(255,255,255,0.1);
}

