/* style.css — Linear Design System */
:root {
  /* Canvas & Surfaces */
  --canvas: #010102;
  --surface-1: #0f1011;
  --surface-2: #141516;
  --surface-3: #18191a;
  --surface-4: #191a1b;

  /* Ink (text hierarchy) */
  --ink: #f7f8f8;
  --ink-muted: #d0d6e0;
  --ink-subtle: #8a8f98;
  --ink-tertiary: #62666d;

  /* Primary accent (lavender) */
  --primary: #5e6ad2;
  --primary-hover: #828fff;
  --primary-focus: #5e69d1;
  --on-primary: #ffffff;

  /* Hairlines (borders) */
  --hairline: #23252a;
  --hairline-strong: #34343a;
  --hairline-tertiary: #3e3e44;

  /* Semantic */
  --success: #27a644;
  --overlay: #000000;

  /* Inverse */
  --inverse-canvas: #ffffff;
  --inverse-ink: #000000;

  /* Spacing */
  --sp-xxs: 4px;
  --sp-xs: 8px;
  --sp-sm: 12px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-xxl: 48px;
  --sp-section: 96px;

  /* Border Radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-xxl: 24px;
  --r-pill: 9999px;

  /* Typography */
  --font-display: 'Inter', -apple-system, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  --font-text: 'Inter', -apple-system, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Transition */
  --transition: all 0.15s ease;
}

html {
  scrollbar-gutter: stable;
}

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

*:focus-visible {
  outline: 2px solid var(--primary-focus);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

body {
  font-family: var(--font-text);
  background-color: var(--canvas);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  scrollbar-color: var(--surface-2) var(--canvas);
}

::selection {
  background-color: var(--primary);
  color: var(--on-primary);
}

::-moz-selection {
  background-color: var(--primary);
  color: var(--on-primary);
}

/* App Container */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--sp-lg);
  padding-bottom: 20vh;
}

/* Navigation */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: var(--sp-xxl);
  background: var(--canvas);
}

.logo {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: var(--sp-lg);
}

.nav-link {
  text-decoration: none;
  color: var(--ink-subtle);
  font-weight: 500;
  font-size: 14px;
  position: relative;
  transition: var(--transition);
  padding-bottom: 4px;
  letter-spacing: 0;
}

.nav-link:hover {
  color: var(--ink);
}

.nav-link.active {
  color: var(--ink);
  font-weight: 600;
}

/* Page Management */
.page {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typography Shared */
.page-title {
  font-size: 42px;
  font-weight: 600;
  text-align: center;
  margin-bottom: var(--sp-xxl);
  color: var(--ink);
  letter-spacing: -1px;
  line-height: 1.1;
}

/* Typewriter Cursor */
.typewriter-text::after {
  content: '|';
  display: inline-block;
  margin-left: 4px;
  opacity: 1;
  color: var(--ink-subtle);
  animation: blinkCursor 0.8s step-end infinite;
}

@keyframes blinkCursor {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.section-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: var(--sp-lg);
  color: var(--ink);
  letter-spacing: -0.6px;
}

.empty-message {
  text-align: center;
  color: var(--ink-subtle);
  font-size: 14px;
  padding: var(--sp-xxl) 0;
  width: 100%;
}

/* Sub Tabs (pill-toggle) */
.sub-tabs {
  display: flex;
  justify-content: center;
  gap: var(--sp-xxs);
  margin-bottom: var(--sp-xxl);
  background: var(--canvas);
  border-radius: var(--r-pill);
  padding: var(--sp-xxs);
}

.sub-tab {
  background: none;
  border: none;
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-subtle);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  transition: var(--transition);
  letter-spacing: 0;
}

.sub-tab:hover {
  color: var(--ink-muted);
}

.sub-tab.active {
  color: var(--ink);
  font-weight: 500;
  background: var(--surface-2);
  border-radius: var(--r-pill);
}

/* Sub-page management */
.sub-page {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.sub-page.active {
  display: block;
}

/* Profile Section */
.profile-section {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 auto var(--sp-section) auto;
  max-width: 900px;
  align-items: stretch;
}

.profile-section.active {
  display: grid;
}

.profile-photo {
  background: transparent;
  border: none;
  border-radius: var(--r-xl);
  aspect-ratio: 1 / 1;
  height: auto;
  width: 100%;
  max-width: 100%;
  padding: 0 var(--sp-xxl);
  justify-self: center;
  align-self: flex-start;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: 0;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--r-xl);
}

.photo-placeholder {
  color: var(--ink-subtle);
  font-size: 14px;
}

.profile-intro {
  background: transparent;
  border-left: 1px solid var(--hairline);
  padding-left: var(--sp-xxl);
  border-radius: 0;
  box-shadow: none;
  font-size: 16px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.social-links {
  display: flex;
  gap: var(--sp-md);
  padding-top: var(--sp-md);
  margin-top: var(--sp-md);
}

.social-item {
  color: var(--ink-subtle);
  font-size: 1.5rem;
  text-decoration: none;
  transition: var(--transition);
  line-height: 1;
  display: inline-block;
}

.social-item:hover {
  color: var(--primary);
}

.social-email {
  font-size: 14px;
  line-height: 1.5rem;
  background: none;
  border: none;
  color: var(--ink-subtle);
  padding: 0;
  cursor: pointer;
  font-family: var(--font-text);
  transition: var(--transition);
}

.social-email:hover {
  color: var(--primary);
}

.copy-toast {
  font-size: 12px;
  color: var(--primary);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  align-self: center;
}

.copy-toast.visible {
  opacity: 1;
}

/* Projects Section specific */
.projects-section .section-title {
  font-size: 28px;
  text-align: center;
  margin-bottom: var(--sp-xxl);
  font-weight: 600;
  letter-spacing: -0.6px;
}

.project-placeholder {
  min-height: 1px;
}

/* Project Card */
.project-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-xl);
  margin: 0 auto var(--sp-xxl) auto;
  align-items: start;
  max-width: 900px;
  padding-bottom: var(--sp-xxl);
  border-bottom: 1px solid var(--hairline);
}

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

.project-carousel {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  display: grid;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.project-carousel img {
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: var(--r-xl);
  pointer-events: none;
}

.project-carousel img.active {
  opacity: 1;
  pointer-events: auto;
}

/* Arrow buttons */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  color: var(--ink);
  font-size: 1.1rem;
  transition: var(--transition);
}

.carousel-arrow:hover {
  background: var(--surface-3);
  border-color: var(--hairline-tertiary);
}

.carousel-arrow-prev {
  left: 10px;
}

.carousel-arrow-next {
  right: 10px;
}

.project-content {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 var(--sp-md);
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--sp-md);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: var(--sp-md);
}

.project-title-area {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
}

.project-tag {
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: var(--r-xs);
  font-weight: 500;
  letter-spacing: 0;
}

.project-title {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.4px;
  color: var(--ink);
}

.github-link {
  color: var(--ink-subtle);
  font-size: 1.5rem;
  transition: var(--transition);
}

.github-link:hover {
  color: var(--primary-hover);
}

.project-description {
  font-size: 16px;
  color: var(--ink-muted);
  line-height: 1.5;
  flex-grow: 1;
}

/* Thoughts Page */
.thoughts-header {
  text-align: center;
  margin-bottom: var(--sp-xxl);
}

.thoughts-header .page-title {
  margin-bottom: var(--sp-sm);
}

.thoughts-header .page-subtitle {
  color: var(--ink-subtle);
  font-size: 14px;
  letter-spacing: 0;
}

.thoughts-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.thought-category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  margin-bottom: var(--sp-lg);
  padding-bottom: var(--sp-md);
  border-bottom: 1px solid var(--hairline);
}

.thought-category-button {
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  color: var(--ink-subtle);
  cursor: pointer;
  font-family: var(--font-text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  padding: 7px 10px;
  transition: var(--transition);
}

.thought-category-button:hover {
  border-color: var(--hairline-strong);
  color: var(--ink-muted);
}

.thought-category-button.active {
  background: var(--surface-2);
  border-color: var(--hairline-strong);
  color: var(--ink);
}

.thought-card {
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  padding: var(--sp-lg) 0;
  box-shadow: none;
  transition: none;
}

.thought-card:hover {
  box-shadow: none;
  transform: none;
}

.thought-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-text);
  padding: 0;
  text-align: left;
}

.thought-toggle:hover .thought-title {
  color: var(--primary-hover);
}

.thought-title-group {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  min-width: 0;
}

.thought-category-label {
  flex: 0 0 auto;
  color: var(--ink-subtle);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xs);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  padding: 4px 7px;
}

.thought-title {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.4px;
  color: var(--ink);
  transition: color 0.15s ease;
  overflow-wrap: anywhere;
}

.thought-toggle-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-right: 1.5px solid var(--ink-subtle);
  border-bottom: 1.5px solid var(--ink-subtle);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.thought-toggle:hover .thought-toggle-icon,
.thought-toggle[aria-expanded="true"] .thought-toggle-icon {
  border-color: var(--primary-hover);
}

.thought-toggle[aria-expanded="true"] .thought-toggle-icon {
  transform: rotate(225deg) translate(-3px, -3px);
}

.thought-content {
  font-size: 16px;
  color: var(--ink-muted);
  line-height: 1.75;
  padding-top: var(--sp-md);
}

.thought-content[hidden] {
  display: none;
}

/* Markdown Styling overrides */
.markdown-body {
  line-height: 1.75;
  color: var(--ink-muted);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin-top: 1.4em;
  margin-bottom: 0.65em;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
  margin-top: 0;
}

.markdown-body p {
  margin-bottom: 1.1em;
  color: var(--ink-muted);
}

.markdown-body ul,
.markdown-body ol {
  margin-left: 1.5em;
  margin-bottom: 1.1em;
  color: var(--ink-muted);
}

.markdown-body li {
  margin-bottom: 0.35em;
}

.markdown-body a {
  color: var(--primary);
  text-decoration: none;
}

.markdown-body a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.markdown-body code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  padding: 2px 5px;
  border-radius: var(--r-xs);
  font-size: 13px;
  color: var(--ink);
}

.markdown-body pre {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: var(--sp-md) var(--sp-lg);
  overflow-x: auto;
  margin: var(--sp-md) 0 var(--sp-lg);
  line-height: 1.65;
}

.markdown-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: inherit;
}

.markdown-body pre code.hljs {
  background: transparent;
  color: #c9d1d9;
}

.markdown-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: var(--sp-md) 0 var(--sp-lg);
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.6;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--hairline-strong);
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
}

.markdown-body th {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 500;
}

.markdown-body tr:nth-child(even) td {
  background: var(--surface-1);
}

/* ===================== About.md intro styling ===================== */

/* School/major text */
.profile-intro .markdown-body div>p:first-child,
.profile-intro .markdown-body>p:first-child {
  font-size: 14px;
  color: var(--ink-subtle);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: var(--sp-lg);
}

/* Languages, Tech Stack section headers */
.profile-intro .markdown-body h3 {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ink-subtle);
  margin-top: var(--sp-lg);
  margin-bottom: var(--sp-xs);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: var(--sp-xxs);
}

/* Badge styling — monochrome Linear */
.profile-intro .markdown-body .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--surface-2);
  margin: 3px 4px 3px 0;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
}

/* ===================== Lightbox ===================== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--r-xl);
  cursor: default;
  pointer-events: none;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  cursor: pointer;
  transition: var(--transition);
}

.lightbox-close:hover {
  background: var(--surface-3);
}

/* clickable image cursor */
.project-carousel img,
.profile-photo img {
  cursor: zoom-in;
}

/* ===================== Project Description Truncation ===================== */
.project-description {
  position: relative;
}

.project-description.clamped {
  max-height: 250px;
  overflow: hidden;
}

/* Gradient fade for clamped descriptions */
.project-description.clamped::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--canvas));
  pointer-events: none;
}

.read-more-btn {
  background: none;
  color: var(--primary);
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-top: var(--sp-md);
  align-self: flex-start;
  transition: var(--transition);
  letter-spacing: 0;
}

.read-more-btn:hover {
  color: var(--primary-hover);
  background: none;
}

/* ===================== Modal (Project Details) ===================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 10000;
  padding: var(--sp-lg);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-lg) var(--sp-xl);
  border-bottom: 1px solid var(--hairline);
}

.modal-header h3 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.6px;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: none;
  color: var(--ink-subtle);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.15s ease;
  padding: var(--sp-xs);
  border-radius: var(--r-md);
}

.modal-close:hover {
  color: var(--ink);
  background: var(--surface-2);
}

#modal-project-body {
  padding: var(--sp-xl);
  overflow-y: auto;
  line-height: 1.7;
  color: var(--ink-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .page-title {
    font-size: 34px;
    letter-spacing: -0.4px;
    margin-bottom: var(--sp-xl);
    word-break: keep-all;
  }

  .profile-section {
    grid-template-columns: 1fr;
    max-height: none;
    gap: var(--sp-xl);
    margin-bottom: var(--sp-xxl);
  }

  .profile-photo {
    width: 240px;
    height: auto;
    margin: 0 auto;
    padding: 0;
  }

  .profile-intro {
    text-align: left;
    gap: var(--sp-md);
    border-left: none;
    border-top: 1px solid var(--hairline);
    padding-left: 0;
    padding-top: var(--sp-xl);
  }

  .project-card {
    grid-template-columns: 1fr;
    gap: var(--sp-lg);
    margin-bottom: var(--sp-xxl);
    padding-bottom: var(--sp-xxl);
  }

  .project-title {
    font-size: 20px;
    letter-spacing: -0.2px;
  }

  .modal-content {
    max-height: 90vh;
  }

  .modal-header {
    padding: var(--sp-md) var(--sp-lg);
  }

  .modal-header h3 {
    font-size: 22px;
    letter-spacing: -0.4px;
  }

  #modal-project-body {
    padding: var(--sp-lg);
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 30px;
    letter-spacing: -0.2px;
  }

  .top-nav {
    padding: 0 var(--sp-md);
  }

  .nav-links {
    gap: var(--sp-md);
  }
}

/* Icon sprite */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: middle;
}
