/* =========================================================
   Ryan Tran — Portfolio
   Design concept: a code editor. Nav = file tabs, hero =
   an open file with a "person" object, sections read like
   commented code blocks. Signature element: the window
   chrome (traffic-light dots + tab bar) that frames the
   whole page.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #12141c;
  --surface: #1a1d29;
  --surface-raised: #20232f;
  --border: #2b2f40;
  --text: #e7e6ea;
  --text-muted: #8b8fa3;
  --accent: #f2b84b;      /* Monkey King gold — nods to Wukong's Journey */
  --accent-soft: #f2b84b26;
  --teal: #6ee7c8;         /* secondary accent, used like a string literal */
  --pink: #ff8fa3;         /* used sparingly, like a keyword */
  --dot-red: #ff5f56;
  --dot-yellow: #ffbd2e;
  --dot-green: #27c93f;
  --shadow: 0 20px 50px -20px rgba(0,0,0,0.5);
  --radius: 10px;
  color-scheme: dark;
}

body.dark-theme {
  /* dark-theme class kept for the existing toggle button;
     the site now defaults to the dark ("editor") theme. */
}

body:not(.dark-theme) {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --border: #e3e1da;
  --text: #1c1e27;
  --text-muted: #6b6f80;
  --accent: #b8791a;
  --accent-soft: #b8791a1f;
  --teal: #0f9d78;
  --pink: #d1436a;
  --shadow: 0 20px 50px -25px rgba(20,20,30,0.25);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.65;
  transition: background-color 0.4s ease, color 0.4s ease;
}

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

.mono {
  font-family: 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;
}

a { color: inherit; }

/* -------------------- Editor chrome shell -------------------- */

.editor-shell {
  max-width: 1200px;
  margin: clamp(1rem, 4vw, 3rem) auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--surface);
}

.title-bar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1rem;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
}

.dots { display: flex; gap: 0.4rem; flex-shrink: 0; }
.dots span {
  width: 11px; height: 11px; border-radius: 50%;
  display: inline-block;
}
.dots .red { background: var(--dot-red); }
.dots .yellow { background: var(--dot-yellow); }
.dots .green { background: var(--dot-green); }

.title-bar .filename {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.title-bar .spacer { flex: 1; }

#toggle-theme {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease;
}

#toggle-theme:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

#toggle-theme:focus-visible,
a:focus-visible,
.project:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Tab bar acts as the primary nav */
.tab-bar {
  display: flex;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tab-bar a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--text-muted);
  padding: 0.75rem 1.1rem;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  position: relative;
  transition: color 0.25s ease, background 0.25s ease;
}

.tab-bar a:hover { color: var(--text); background: var(--surface-raised); }

.tab-bar a.active {
  color: var(--accent);
  background: var(--bg);
}

.tab-bar a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.tab-bar a .dim { color: var(--pink); }

/* -------------------- Hero -------------------- */

.hero {
  padding: clamp(2rem, 8vw, 4rem) clamp(1.25rem, 5vw, 3rem);
  background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 100%);
  position: relative;
  min-height: 50vh;
  display: flex;
  align-items: center;
}

.hero-content {
  width: 100%;
  max-width: 680px;
}

.hero-intro h1 {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.hero-subtitle {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 2rem;
  max-width: 55ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.25s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.cta-primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(242, 184, 75, 0.2);
}

.cta-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.cta-secondary:hover {
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.cta-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .hero-cta {
    flex-direction: column;
    width: 100%;
  }
  
  .cta-button {
    width: 100%;
  }
}

/* -------------------- Sections -------------------- */

section {
  padding: 2.25rem clamp(1.25rem, 5vw, 3rem);
  border-top: 1px solid var(--border);
}

.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--teal);
  margin: 0 0 0.9rem;
  letter-spacing: 0.02em;
}

.section-label::before { content: "// "; color: var(--text-muted); }

h2 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 1.4rem;
  margin: 0 0 1rem;
  letter-spacing: -0.01em;
}

section#about p {
  max-width: 60ch;
  color: var(--text);
}

/* Projects */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.project-image {
  width: 90%;
  height: 90%;
  object-fit: cover;
  transform: translateY(-105%) translateX(18px);
  border-radius: 8px;
}

.project-image-text {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  font-weight: 700;
  color: var(--text);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.project-visual {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: var(--border);
  flex-shrink: 0;
}

.project-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
  color: var(--text);
  opacity: 0.15;
  transition: all 0.3s ease;
}

.project-card:hover .project-placeholder {
  opacity: 0.25;
  transform: scale(1.05);
}

/* Theme colors for project placeholders */
.project-placeholder[data-theme="purple"] {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: rgba(255, 255, 255, 0.2);
}

.project-placeholder[data-theme="pink"] {
  background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
  color: rgba(255, 255, 255, 0.2);
}

.project-placeholder[data-theme="teal"] {
  background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
  color: rgba(255, 255, 255, 0.2);
}

.project-placeholder[data-theme="gold"] {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: rgba(255, 255, 255, 0.2);
}

.project-placeholder[data-theme="green"] {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: rgba(255, 255, 255, 0.2);
}

.project-placeholder[data-theme="orange"] {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: rgba(255, 255, 255, 0.2);
}

.project-content {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.project-content h3 {
  margin: 0 0 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.project-content p {
  margin: 0.4rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.project-content .stack-line {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--teal);
  margin: 0.8rem 0 1rem;
  font-weight: 500;
}

.project-content a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
  margin-top: auto;
}

.project-content a:hover {
  border-color: var(--accent);
}

.project-content a::after {
  content: "→";
  transition: transform 0.2s ease;
}

.project-content a:hover::after {
  transform: translateX(2px);
}

/* Skills */

.skills-grid {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0;
  margin: 0;
}

.skills-grid li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem 0.5rem 0.6rem;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.skills-grid li:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--surface-raised);
}

.skills-grid img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.skills-grid span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text);
}

/* Contact */

.contact-section {
  border-top: none;
}

.contact-intro {
  color: var(--text-muted);
  max-width: 50ch;
  margin-top: -0.4rem;
  margin-bottom: 1.5rem;
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
}

.contact-list li {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.contact-list li:hover { border-color: var(--accent); transform: translateX(3px); }

.contact-list .key { color: var(--teal); flex-shrink: 0; }
.contact-list a { color: var(--accent); text-decoration: none; word-break: break-all; }
.contact-list a:hover { text-decoration: underline; }

/* Footer / status bar */

footer {
  padding: 0.7rem 1.25rem;
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}

footer .status-ok { color: var(--dot-green); }

/* Scroll reveal */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* Responsive */

@media (max-width: 560px) {
  .code-block { font-size: 0.78rem; }
  .line-no { width: 1.6em; }
  h2 { font-size: 1.2rem; }
}
