/* ============================================
   Devy Han — Personal Website Styles
   ============================================ */

:root {
  --bg: #0c0c0c;
  --bg-secondary: #141414;
  --surface: #1c1c1c;
  --border: #2a2a2a;
  --text: #e8e6e3;
  --text-muted: #888580;
  --accent: #e2a052;
  --accent-glow: rgba(226, 160, 82, 0.2);
  --accent2: #5eb8a2;
  --accent3: #c9785e;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent2);
}

::selection {
  background: var(--accent);
  color: white;
}

/* ---- Background Texture ---- */
#particles {
  display: none;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ---- Terminal ---- */
.terminal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 700px);
  height: min(80vh, 500px);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 60px rgba(226, 160, 82, 0.08),
    0 25px 50px rgba(0, 0, 0, 0.5);
  animation: terminalBoot 0.5s ease-out;
}

.terminal.hidden {
  display: none;
}

@keyframes terminalBoot {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.terminal-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  gap: 12px;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.red { background: #ff5f57; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #28c840; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.terminal-close-btn {
  background: var(--border);
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.terminal-close-btn:hover {
  background: var(--accent);
  color: white;
}

.terminal-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
}

.terminal-output {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-output .cmd-line {
  color: var(--accent2);
  margin-top: 8px;
}

.terminal-output .cmd-line:first-child {
  margin-top: 0;
}

.terminal-output .output-text {
  color: var(--text);
  margin-bottom: 4px;
}

.terminal-output .error-text {
  color: var(--accent3);
}

.terminal-output .info-text {
  color: var(--text-muted);
}

.terminal-output .highlight {
  color: var(--accent);
}

.terminal-output .success {
  color: var(--accent2);
}

.terminal-input-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.prompt {
  color: var(--accent2);
  white-space: nowrap;
  font-size: 0.85rem;
}

.terminal-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
  caret-color: var(--accent);
}

/* ---- Site (hidden until terminal dismissed) ---- */
.site {
  position: relative;
  z-index: 1;
}

.site.hidden {
  display: none;
}

/* ---- Navigation ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 48px;
  backdrop-filter: blur(12px);
  background: rgba(10, 10, 15, 0.8);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.nav.scrolled {
  border-bottom-color: var(--border);
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent) !important;
  letter-spacing: -1px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--accent);
}

.nav-terminal-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-terminal-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ---- Hero ---- */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 60px;
  padding: 120px 48px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

.hero-greeting {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero-name {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 400;
  line-height: 1.05;
  margin-bottom: 20px;
  font-style: italic;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent2), var(--accent3));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 6s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-tagline {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 36px;
  line-height: 1.8;
}

.typed-text {
  color: var(--accent2);
}

.cursor {
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

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

.hero-cta {
  display: flex;
  gap: 16px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  background: #5a52e0;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-ghost:hover {
  background: var(--accent-glow);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn-large {
  padding: 16px 40px;
  font-size: 1.1rem;
}

/* ---- Code Window ---- */
.code-window {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.code-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.code-filename {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.code-content {
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.8;
  overflow-x: auto;
}

.code-content .kw { color: var(--accent3); }
.code-content .type { color: var(--accent); }
.code-content .str { color: var(--accent2); }
.code-content .fn { color: #e2b93d; }

/* ---- Sections ---- */
.section-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 120px 48px;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  max-width: 300px;
}

.section-number {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--accent);
}

/* ---- About ---- */
.about-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 60px;
}

.about-text p {
  margin-bottom: 16px;
  color: var(--text-muted);
  line-height: 1.8;
}

.about-text strong {
  color: var(--text);
}

.about-skills h3 {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 20px;
}

.skill-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skill-list li {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
}

.skill-list li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ---- Projects ---- */
.project-featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 60px;
}

.project-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 8px;
  display: block;
}

.project-name {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.project-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 20px;
}

.project-description {
  background: var(--surface);
  padding: 24px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.project-description p {
  color: var(--text-muted);
  line-height: 1.7;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-link {
  margin-top: 16px;
}

.project-tech span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 4px 10px;
  background: var(--bg);
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ---- Phone Mockup ---- */
.phone-mockup {
  width: 260px;
  margin: 0 auto;
  background: #1c1c1e;
  border-radius: 36px;
  padding: 12px;
  border: 2px solid #333;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.phone-screen {
  background: #000;
  border-radius: 28px;
  overflow: hidden;
  padding: 40px 0 0;
}

.keyboard-demo {
  background: #2c2c2e;
  padding: 8px 4px;
}

.kb-suggestion-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 6px 8px 10px;
}

.kb-suggestion {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 4px 12px;
  background: #3a3a3c;
  border-radius: 4px;
}

.kb-suggestion.active {
  color: white;
  background: var(--accent);
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}

.kb-row span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 32px;
  background: #4a4a4c;
  color: white;
  font-size: 0.65rem;
  border-radius: 4px;
  font-weight: 500;
}

.kb-shift, .kb-del {
  width: 32px !important;
  background: #3a3a3c !important;
  font-size: 0.75rem !important;
}

.kb-bottom {
  gap: 6px;
}

.kb-lang {
  width: 32px !important;
  background: #3a3a3c !important;
}

.kb-space {
  flex: 1 !important;
  width: auto !important;
  max-width: 120px;
  background: #4a4a4c !important;
  font-size: 0.6rem !important;
  color: var(--text-muted) !important;
}

.kb-return {
  width: 56px !important;
  background: var(--accent) !important;
  font-size: 0.6rem !important;
}

/* ---- Project Cards ---- */
.project-other-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 28px;
  transition: all 0.3s;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(108, 99, 255, 0.1);
}

.project-card-top {
  margin-bottom: 16px;
}

.folder-icon {
  font-size: 1.5rem;
}

.project-card h4 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

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

/* ---- Contact ---- */
.contact {
  text-align: center;
}

.contact-content {
  max-width: 500px;
  margin: 0 auto;
}

.contact-content p {
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.8;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 40px 48px;
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

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

.footer-credit {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---- Scroll animations ---- */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .nav {
    padding: 12px 20px;
  }

  .nav-links {
    gap: 16px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 100px 20px 60px;
    gap: 40px;
    min-height: auto;
  }

  .hero-visual {
    order: -1;
  }

  .section-container {
    padding: 80px 20px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .project-featured {
    grid-template-columns: 1fr;
  }

  .hero-cta {
    flex-direction: column;
  }

  .btn {
    text-align: center;
  }
}

@media (max-width: 480px) {
  .terminal {
    width: 95vw;
    height: 85vh;
    border-radius: 8px;
  }

  .terminal-header {
    border-radius: 8px 8px 0 0;
  }

  .hero-name {
    font-size: 2rem;
  }

  .code-content {
    font-size: 0.65rem;
  }

  .phone-mockup {
    width: 220px;
  }
}
