/* ═══════════════════════════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════════════════════════ */
:root {
  /* Palette */
  --bg:        #1A2226;
  --surface:   #343A40;
  --text:      #F8F9FA;
  --accent:    #00F5D4;
  --contrast:  #FF7F50;

  /* Derived */
  --text-muted:   rgba(248, 249, 250, 0.55);
  --surface-hover: #3e454b;
  --border:       rgba(248, 249, 250, 0.08);
  --shadow:       0 4px 24px rgba(0, 0, 0, 0.35);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Layout */
  --max-w: 1120px;
  --gap:   24px;
  --radius: 14px;

  /* Transitions */
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ═══════════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

ul { list-style: none; }

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

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

/* ═══════════════════════════════════════════════════════════════════
   CONTAINER
   ═══════════════════════════════════════════════════════════════════ */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ═══════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 20px 0;
  background: transparent;
  transition: background .35s var(--ease), padding .35s var(--ease), box-shadow .35s var(--ease);
}

.site-header.scrolled {
  background: rgba(52, 58, 64, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 12px 0;
  box-shadow: 0 1px 0 var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  transition: opacity .2s var(--ease);
}
.logo-img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}
.logo:hover { opacity: .8; }
.logo-dot { color: var(--accent); }

/* Navigation */
.main-nav ul {
  display: flex;
  gap: 32px;
}

.main-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  transition: color .25s var(--ease);
}

.main-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  transition: width .3s var(--ease);
}

.main-nav a:hover {
  color: var(--text);
}

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

/* Mobile toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}

/* ═══════════════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════════════ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 100px 0 40px;
  position: relative;
  overflow: hidden;
}

/* Subtle radial glow behind hero */
.hero::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(0, 245, 212, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeUp .6s var(--ease) .15s forwards;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeUp .6s var(--ease) .3s forwards;
}

.hero-title .accent {
  color: var(--accent);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 540px;
  margin-bottom: 36px;
  opacity: 0;
  animation: fadeUp .6s var(--ease) .45s forwards;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp .6s var(--ease) .6s forwards;
}

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), color .25s var(--ease);
}

.btn:active {
  transform: scale(0.97);
}

/* Primary */
.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  box-shadow: 0 0 20px rgba(0, 245, 212, 0.35);
}

/* Secondary */
.btn-secondary {
  background: transparent;
  color: var(--contrast);
  border: 1.5px solid var(--contrast);
}

.btn-secondary:hover {
  background: var(--contrast);
  color: var(--bg);
  box-shadow: 0 0 20px rgba(255, 127, 80, 0.3);
}

/* Small */
.btn-sm {
  font-size: 0.82rem;
  padding: 9px 20px;
}

/* Disabled */
.btn-disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════
   ABOUT / CHI SONO
   ═══════════════════════════════════════════════════════════════════ */
.about {
  padding: 40px 0 60px;
  border-top: 1px solid var(--border);
}

.about-content {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  align-items: start;
}

.about-text p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.about-text p:last-child {
  margin-bottom: 0;
}

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

.highlight-accent {
  color: var(--accent);
  font-weight: 600;
}

.highlight-contrast {
  color: var(--contrast);
  font-weight: 600;
}

.about-link {
  color: var(--accent);
  font-weight: 600;
  border-bottom: 1.5px solid transparent;
  transition: border-color .25s var(--ease);
}

.about-link:hover {
  border-color: var(--accent);
}

/* Badges */
.about-badges {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color .25s var(--ease);
}

.badge:hover {
  border-color: rgba(0, 245, 212, 0.2);
}

.badge-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.badge-label {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   PROJECTS SECTION
   ═══════════════════════════════════════════════════════════════════ */
.projects {
  padding: 60px 0 80px;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 48px;
  max-width: 460px;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}

/* ═══════════════════════════════════════════════════════════════════
   CARD
   ═══════════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--border);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);

  /* Reveal animation */
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .5s var(--ease), transform .5s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}

.card.visible {
  opacity: 1;
  transform: translateY(0);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(0, 245, 212, 0.15);
}

.card.visible:hover {
  transform: translateY(-4px);
}

.card-icon {
  font-size: 2rem;
  line-height: 1;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════ */
.site-footer {
  padding: 60px 0;
  border-top: 1px solid var(--border);
}

.footer-inner {
  text-align: center;
}

.footer-text {
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.footer-link {
  color: var(--accent);
  font-weight: 600;
  border-bottom: 1.5px solid transparent;
  transition: border-color .25s var(--ease);
}

.footer-link:hover {
  border-color: var(--accent);
}

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

/* ═══════════════════════════════════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════════════════════════════════ */
.card-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: .4; }
  50% { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
    z-index: 1001;
  }

  .main-nav {
    position: fixed;
    inset: 0;
    background: rgba(26, 34, 38, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .35s var(--ease), visibility .35s var(--ease);
  }

  .nav-open .main-nav {
    opacity: 1;
    visibility: visible;
  }

  .main-nav ul {
    flex-direction: column;
    gap: 28px;
    text-align: center;
  }

  .main-nav a {
    font-size: 1.4rem;
  }

  /* Hamburger → X */
  .nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-open .nav-toggle span:nth-child(2) {
    opacity: 0;
  }
  .nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .hero {
    padding: 100px 0 60px;
    min-height: auto;
  }

  .hero-title br { display: none; }

  .about-content {
    grid-template-columns: 1fr;
  }

  .about-badges {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .projects {
    padding: 64px 0 80px;
  }

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

@media (max-width: 480px) {
  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

/* ════════════════════════════════════════════════════════════════
   CATEGORIES & MARKDOWN MODAL
   ════════════════════════════════════════════════════════════════ */
.category-section {
  margin-bottom: 60px;
}
.category-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
  display: inline-block;
}

.modal-lg {
  max-width: 800px;
  width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

#readme-content {
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 10px;
}

.markdown-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  color: var(--accent);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}
.markdown-body h1 { font-size: 1.8rem; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.markdown-body h2 { font-size: 1.4rem; }
.markdown-body p { margin-bottom: 1em; }
.markdown-body code {
  background: var(--surface);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
}
.markdown-body pre {
  background: var(--surface);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1em;
}
.markdown-body pre code {
  background: transparent;
  padding: 0;
}
.markdown-body ul, .markdown-body ol {
  padding-left: 20px;
  margin-bottom: 1em;
}
.markdown-body a {
  color: var(--accent);
  text-decoration: none;
}
.markdown-body a:hover {
  text-decoration: underline;
}
  .card-actions {
    flex-direction: column;
  }

  .card-actions .btn {
    width: 100%;
  }
}
