/* === Variables === */
:root {
  --font-mono: 'IBM Plex Mono', monospace;
  --color-bg: #080808;
  --color-text: #ddd;
  --color-accent: #e74c3c;
  --color-muted: #383838;
  --color-faint: #2e2e2e;
  --color-dim: #505050;
  --color-border: #ffffff09;
  --space: 1rem;
}

/* === Reset & Base === */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,300;0,400;0,500;1,300&display=swap');

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

html { font-size: clamp(15px, 2vw, 27px); }
body { font-family: var(--font-mono); background: var(--color-bg); color: var(--color-text); min-height: 100vh; overflow-x: clip; }
a { color: inherit; text-decoration: none; transition: color 0.2s; }
a:hover { color: #ccc; }

/* === Layout === */
.container { max-width: 1000px; margin: 0 auto; }
.section { padding: 1.1rem 1.5rem 1.1rem 2rem; max-width: 1200px; margin: 0 auto; }
.section-label { font-size: 1.2rem; line-height: 1.4; color: var(--color-accent); text-align: left; width: 100%; margin-bottom: 1.5rem; letter-spacing: 0.15em; transition: transform 0.3s ease-out; cursor: default; }
.section-label:hover { transform: translateX(4px); }

/* === Nav === */
#site-icon {
  position: fixed;
  top: 1.2rem;
  left: 1.2rem;
  z-index: 100;
}
#site-icon img { width: 1.2rem; height: auto; }

nav {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  display: flex;
  gap: 1.3rem;
  z-index: 100;
  background: transparent;
}
nav a { font-size: 0.6rem; color: #666; letter-spacing: 0.12em; }
nav a:hover { color: #fff; }

/* === Hero === */
#hero-section {
  padding: 4rem 2.6rem 1.1rem;
  min-height: 85vh;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 120px;
  flex-wrap: nowrap;
  margin: 0 auto;
  max-width: 1200px;
  min-width: 900px;
}
#hero-section > div { max-width: 480px; }
#hero-tag { font-size: 0.7rem; letter-spacing: 0.3em; color: #777; margin-bottom: 1rem; opacity: 0; transition: opacity 0.7s; }
#ascii-name { font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 300; letter-spacing: 0.07em; color: #e8e8e8; line-height: 1.15; opacity: 0; transition: opacity 0.8s, transform 0.3s ease-out; margin-left: -0.35rem; cursor: default; }
#ascii-name .name-line { display: block; white-space: nowrap; }
#ascii-name:hover { transform: translateX(4px); }
#hero-desc { margin-top: 0.9rem; font-size: 0.85rem; color: #777; line-height: 1.9; opacity: 0; transition: opacity 0.8s 0.25s; }
#hero-desc span { font-style: italic; color: #555; }
#hero-cta { margin-top: 2.9rem; opacity: 0; transition: opacity 0.8s 0.5s; }
#hero-cta a { color: var(--color-accent); font-size: 0.6rem; letter-spacing: 0.18em; border-bottom: 1px solid #ff525260; padding-bottom: 0.2rem; }

#ghost-container {
  font-family: var(--font-mono);
  line-height: 1.12;
  font-size: clamp(0.2rem, 0.6vw, 0.4rem);
  color: #e8e8e8;
  white-space: pre;
  opacity: 0;
  transition: opacity 1s;
  flex-shrink: 0;
}

/* === Chat === */
#chat-root { position: fixed; bottom: 1.8rem; right: 1.8rem; width: 380px; z-index: 100; }
#chat-panel { display: none; background: #0e0e0e; border: 1px solid #252525; border-radius: 8px; margin-bottom: 0.7rem; flex-direction: column; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
#chat-panel-header { padding: 0.8rem 1rem; border-bottom: 1px solid #1a1a1a; font-size: 0.55rem; color: #555; letter-spacing: 0.15em; display: flex; justify-content: space-between; }
#chat-messages { height: 320px; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.8rem; }
#chat-messages { scrollbar-width: none; -ms-overflow-style: none; }
#chat-messages::-webkit-scrollbar { display: none; }
#chat-panel-input { padding: 0.8rem 1rem; border-top: 1px solid #1a1a1a; display: flex; gap: 0.5rem; align-items: center; }
#chat-input { flex: 1; background: #161616; border: 1px solid #252525; border-radius: 4px; outline: none; color: #c8c8c8; font-size: 0.6rem; font-family: var(--font-mono); padding: 0.4rem 0.6rem; }
#chat-input:focus { border-color: #444; }
#chat-send { background: transparent; border: 1px solid #333; color: var(--color-accent); border-radius: 4px; padding: 0.4rem 0.6rem; cursor: pointer; font-size: 0.7rem; font-family: var(--font-mono); transition: all 0.2s; }
#chat-send:hover { border-color: var(--color-accent); }
#chat-btn { background: transparent; border: 1px solid #333; color: #aaa; padding: 0.5rem 1.1rem; cursor: pointer; font-size: 0.6rem; letter-spacing: 0.12em; font-family: var(--font-mono); width: 100%; transition: all 0.2s; border-radius: 4px; }
#chat-btn:hover { color: #fff; border-color: #555; }
#chat-btn.chat-open { color: #aaa; border-color: #333; }
#chat-btn.chat-open:hover { color: #fff; border-color: #555; }

.chat-msg { display: flex; flex-direction: column; gap: 0.2rem; }
.chat-msg-label { font-size: 0.45rem; letter-spacing: 0.15em; font-weight: 500; }
.chat-msg-label.assistant { color: var(--color-accent); }
.chat-msg-label.user { color: #666; }
.chat-msg-text { font-size: 0.6rem; color: #bbb; line-height: 1.6; }
.chat-msg-text a { color: var(--color-accent); text-decoration: underline; }

/* === About === */
#about { display: flex; flex-direction: column; align-items: flex-start; margin: 0 auto; }
#about .bio-text { font-size: 0.75rem; line-height: 1.8; color: #a0a0a0; text-align: left; }
#about .bio-text .email { color: var(--color-accent); }
#about-tags { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.7rem; }
#about-tags .skill-tag { font-size: 0.65rem; color: #888; border: 1px solid #3a3a3a; padding: 0.35rem 0.9rem; display: inline-flex; align-items: center; gap: 0.5rem; border-radius: 4px; background: #111; transition: all 0.2s; }
#about-tags .skill-tag:hover { border-color: #555; color: #bbb; }
.skill-icon { font-size: 0.5rem; color: #555; background: #1a1a1a; padding: 0.15rem 0.3rem; border-radius: 3px; letter-spacing: 0.05em; }

/* === Skills === */
#skills { display: flex; flex-direction: column; align-items: flex-start; margin: 0 auto; }

/* === Projects === */
#projects { display: flex; flex-direction: column; align-items: flex-start; margin: 0 auto; width: 100%; }
#proj-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; width: 100%; }
#proj-list a { display: flex; flex-direction: column; padding: 0; border: 1px solid transparent; border-radius: 12px; text-decoration: none; gap: 0; text-align: left; background: #0e0e0e; transition: all 0.3s ease; overflow: hidden; }
#proj-list a:hover { transform: translateY(-4px); border-color: #ffffff18; box-shadow: 0 12px 40px rgba(0,0,0,0.5); }
#proj-list a.dimmed { opacity: 0.2; }
#proj-list .card-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 0.4s ease; }
#proj-list a:hover .card-img { transform: scale(1.05); }
#proj-list .card-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
#proj-list h3 { font-size: 1rem; font-weight: 400; color: #ccc; margin-bottom: 0.3rem; transition: color 0.2s; }
#proj-list p { font-size: 0.75rem; color: #666; line-height: 1.6; }
#proj-list .card-link { color: var(--color-accent); font-size: 0.7rem; margin-top: auto; transition: color 0.2s; }
#proj-list .card-langs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; }
#proj-list .card-lang { font-size: 0.5rem; color: #777; border: 1px solid #2a2a2a; padding: 0.2rem 0.5rem; border-radius: 3px; letter-spacing: 0.05em; background: #151515; display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap; }
#lang-filter .filter-chip { font-size: 0.6rem; color: #999; border: 1px solid #444; padding: 0.3rem 0.7rem; border-radius: 4px; cursor: pointer; transition: all 0.2s; background: #111; letter-spacing: 0.05em; display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
#lang-filter .filter-chip:hover { border-color: #555; color: #bbb; }
#lang-filter .filter-chip.active { border-color: #ccc; color: #fff; background: #1a1a1a; }

.lang-icon { width: 12px; height: 12px; display: inline-block; vertical-align: middle; }
.lang-fallback { font-size: 0.45rem; color: #555; background: #1a1a1a; padding: 0.05rem 0.25rem; border-radius: 2px; letter-spacing: 0.02em; }

#lang-hint { font-size: 0.75rem; color: #a0a0a0; line-height: 1.8; margin-bottom: 0.8rem; }
#lang-filter { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.2rem; }
.skill-row { display: flex; align-items: flex-start; gap: 0.4rem; }
.skill-label { font-size: 0.6rem; color: var(--color-accent); width: 85px; text-align: left; padding-top: 0.35rem; letter-spacing: 0.05em; flex-shrink: 0; white-space: nowrap; }
.skill-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: 1; margin-left: 1rem; }

/* === Project Pages === */
.project-page { background: var(--color-bg); color: var(--color-text); min-height: 100vh; padding: 4rem 2.6rem; }
.project-page .back-link { color: var(--color-accent); font-size: 0.85rem; letter-spacing: 0.12em; }
.project-page .content { margin: 3rem auto 0; max-width: 900px; text-align: left; }
.project-page .content h1 { font-size: clamp(1.5rem, 4vw, 2.5rem); font-weight: 300; margin-bottom: 0.5rem; }
.project-page .content .project-subtitle { font-size: 0.7rem; color: #666; letter-spacing: 0.05em; margin-bottom: 1.5rem; }
.project-page .content p { font-size: 0.9rem; line-height: 1.8; color: #a0a0a0; text-align: left; }
.project-page .content p a { color: #e74c3c; text-decoration: none; border-bottom: 1px solid #e74c3c33; }
.project-page .content p a:hover { color: #ff5252; border-bottom-color: #ff5252; }
.project-page .content .project-img { width: 100%; max-width: 100%; border-radius: 4px; margin-bottom: 1.5rem; display: block; }

/* === Footer === */
footer { padding: 1.3rem 2.6rem; border-top: 1px solid #ffffff06; display: flex; justify-content: center; font-size: 0.55rem; color: #232323; margin: 0 auto; max-width: 1000px; }
footer span { color: var(--color-faint); letter-spacing: 0.12em; }

/* === Responsive === */
@media (max-width: 900px) {
  #about, #skills, #projects, #hero-section, nav, footer { margin-left: 24px !important; margin-right: 24px !important; max-width: 100% !important; min-width: auto !important; }
  #hero-section { flex-direction: column !important; gap: 32px !important; min-width: auto !important; }
  #proj-list { grid-template-columns: repeat(2, 1fr) !important; }
  nav { padding: 22px 24px !important; }
  #ghost-container { font-size: clamp(5px, 1.6vw, 10px) !important; }
}

@media (max-width: 600px) {
  #about, #skills, #projects, #hero-section, nav, footer { margin-left: 16px !important; margin-right: 16px !important; }
  #hero-section { padding: 40px 16px 80px !important; flex-direction: column !important; }
  #hero-section > * { display: flex !important; flex-direction: column !important; align-items: flex-start !important; }
  #chat-root { width: calc(100vw - 32px) !important; bottom: 8px !important; right: 16px !important; left: 16px !important; }
  #ghost-container { font-size: clamp(4px, 1.4vw, 7px) !important; }
  nav { flex-direction: row !important; gap: 16px !important; justify-content: flex-start !important; }
  #proj-list { grid-template-columns: 1fr !important; }
}
