/* ling-lin.me — dark, teal-accented, same visual family as ling-lang.org
   (rainbow palette anchored on --teal) but restrained for a personal
   portfolio: one accent color used with intent, generous whitespace,
   no external fonts/JS/CDNs so the page stays fast and self-contained. */

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

:root {
  --red:    #ff1040;
  --teal:   #00e0cc;
  --cyan:   #00c4ff;
  --blue:   #0070ff;
  --violet: #9900ee;

  --bg:       #07070f;
  --bg1:      #0d0d1c;
  --bg2:      #121224;
  --card:     #0f0f1e;
  --text:     #ddddf0;
  --text-dim: #8888ad;
  --white:    #f4f4ff;
  --border:   rgba(255,255,255,0.08);
  --radius:   6px;
  --radius-lg:10px;
  --font-mono: ui-monospace,'JetBrains Mono','Fira Code','Cascadia Code',Consolas,monospace;
  --font-sans: -apple-system,BlinkMacSystemFont,'Segoe UI','Noto Sans',Roboto,sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* subtle fixed grid, same trick as ling-lang.org */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.028) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--white); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
code { font-family: var(--font-mono); }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }
.section { padding: 80px 0; }
.section.alt { background: var(--bg1); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 10px;
}
h1, h2, h3 { font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; color: var(--white); }
.section-title { font-size: clamp(1.5rem, 3.2vw, 2.15rem); margin-bottom: 14px; }
.section-sub { color: var(--text-dim); max-width: 600px; margin-bottom: 40px; }

/* ── buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--teal); color: #04241f; }
.btn-primary:hover { background: #33f0dc; color: #04241f; }
.btn-outline { border-color: var(--border); color: var(--white); }
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }
.btn-ghost { color: var(--text-dim); }
.btn-ghost:hover { color: var(--white); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.82rem; }
.btn-lg { padding: 0.85rem 1.7rem; font-size: 1rem; }

/* Print CV / Print Resume — scoped to these two buttons only (compound
   .btn.js-print-* selector outranks .btn-outline's single class, so the
   shared outline style used elsewhere, e.g. "View projects", is untouched). */
.btn.js-print-cv, .btn.js-print-resume { background: #12306b; border-color: #12306b; color: #fff; }
.btn.js-print-cv:hover, .btn.js-print-resume:hover { background: #1a44a0; border-color: #1a44a0; color: #fff; }

/* ── nav ── */
#site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(7,7,15,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.9rem 24px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--white);
  font-size: 1.05rem;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--teal);
  font-size: 0.95rem;
}
.nav-links { display: flex; gap: 1.4rem; margin-left: 0.5rem; }
.nav-links a { color: var(--text-dim); font-size: 0.92rem; font-weight: 500; }
.nav-links a:hover { color: var(--white); }
.nav-right { display: flex; align-items: center; gap: 0.7rem; margin-left: auto; }

/* ── language dropdown ── */
.lang-switcher { position: relative; }
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}
.lang-toggle:hover { color: var(--white); border-color: var(--teal); }
.lang-chevron { transition: transform 0.15s ease; }
.lang-switcher.open .lang-chevron { transform: rotate(180deg); }
.lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 140px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
  box-shadow: 0 12px 28px rgba(0,0,0,0.45);
  z-index: 30;
}
.lang-switcher.open .lang-menu { display: block; }
.lang-item {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 0.88rem;
}
.lang-item:hover { background: var(--card); color: var(--white); }
.lang-item.on { color: var(--teal); font-weight: 600; }

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
}
.menu-toggle span { display: block; width: 100%; height: 2px; background: var(--white); border-radius: 2px; }

/* ── hero ── */
#hero { padding: 96px 0 64px; position: relative; }
.hero-inner { text-align: left; max-width: 760px; }
.eyebrow {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--teal);
  margin-bottom: 1rem;
}
#hero h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); margin-bottom: 0.6rem; }
.hero-hook { color: var(--white); font-size: 1.3rem; font-weight: 600; max-width: 620px; margin-bottom: 0.4rem; }
.hero-sub { color: var(--text-dim); font-size: 1.05rem; max-width: 620px; margin-bottom: 1.2rem; }
.hero-highlights { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.8rem; }
.hero-highlights li { color: var(--text); font-size: 0.98rem; padding-left: 1.3rem; position: relative; }
.hero-highlights li::before { content: '›'; position: absolute; left: 0; color: var(--teal); font-weight: 700; }
.hero-highlights strong { color: var(--white); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }

/* ── stat strip ── */
.stat-strip { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg1); }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  padding: 2rem 0;
}
.stat-tile { text-align: center; }
.stat-value { font-family: var(--font-mono); font-size: 1.9rem; font-weight: 700; color: var(--teal); }
.stat-label { color: var(--text-dim); font-size: 0.82rem; margin-top: 0.3rem; }

/* ── about ── */
.about-body { max-width: 720px; }
.about-body p { color: var(--text); margin-bottom: 1.1rem; }
.about-body p:last-child { margin-bottom: 0; }
.about-body code {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ── skills ── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}
.skill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
}
.skill-card h3 { font-size: 1rem; color: var(--teal); margin-bottom: 0.8rem; }
.skill-card ul { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; }
.skill-card li { color: var(--text-dim); font-size: 0.9rem; padding-left: 1rem; position: relative; }
.skill-card li::before { content: '›'; position: absolute; left: 0; color: var(--teal); }

/* ── projects ── */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.7rem;
  display: flex;
  flex-direction: column;
}
.project-card:first-child { grid-column: 1 / -1; }
.project-head h3 { font-size: 1.15rem; margin-bottom: 0.25rem; }
.project-tagline { color: var(--teal); font-size: 0.85rem; font-weight: 600; margin-bottom: 0.9rem; }
.project-desc { color: var(--text-dim); font-size: 0.92rem; margin-bottom: 1rem; }
.project-desc code {
  background: var(--bg1);
  border: 1px solid var(--border);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--text);
}
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
}
.project-links { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: auto; padding-top: 0.4rem; }
.project-links a { font-size: 0.88rem; font-weight: 600; }
.project-links-note { font-size: 0.82rem; color: var(--text-dim); font-style: italic; }

/* ── code demo (Hello World tabs) ── */
.code-demo { margin: 0.4rem 0 1.2rem; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.code-tabs { display: flex; background: var(--bg1); border-bottom: 1px solid var(--border); }
.code-tab {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.code-tab:hover { color: var(--white); }
.code-tab.on { color: var(--teal); border-bottom-color: var(--teal); }
.code-pane { display: none; margin: 0; padding: 1rem 1.1rem; background: var(--bg); overflow-x: auto; }
.code-pane.on { display: block; }
.code-pane code { font-size: 0.82rem; color: var(--text); white-space: pre; }

/* ── contact ── */
.contact-inner { max-width: 560px; }
.contact-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.4rem 1.5rem;
  margin-bottom: 1.6rem;
}
.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.contact-row:last-child { border-bottom: none; }
.contact-label { color: var(--text-dim); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.contact-value { font-size: 0.95rem; text-align: right; }

/* ── footer ── */
footer { border-top: 1px solid var(--border); padding: 1.6rem 0; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 0.82rem;
}
.footer-inner a { color: var(--text-dim); font-weight: 600; }
.footer-inner a:hover { color: var(--teal); }

/* ── print header (screen: hidden; shown only in @media print) ── */
.print-header { display: none; }

/* ── print (Print CV / Print Resume) ──
   Both buttons call window.print(); "Print Resume" additionally tags
   <body class="print-resume"> so the rules below can drop project detail
   down to a one-line-per-project summary. Everything else (nav, hero,
   contact section, footer) is replaced by .print-header. */
@media print {
  @page { margin: 1.5cm; }

  body::before { display: none; }
  #site-nav, #hero, #contact, footer { display: none; }
  .print-header { display: block; margin-bottom: 1.6em; }
  .print-name { font-size: 1.7rem; font-weight: 700; margin-bottom: 0.2em; }
  .print-title { font-size: 0.95rem; margin-bottom: 0.3em; }
  .print-contact { font-size: 0.82rem; }

  body { background: #fff !important; }
  /* Every dark-theme surface (card/pill/code-pane fills, not just section
     backgrounds) needs stripping — a class-scoped list missed the stat strip
     and the code-demo/inline-code panes, which stayed near-black with the
     text-color sweep below turned them invisible. Blanket to white first,
     add borders back where a boundary is still useful. */
  body, body * { background: #fff !important; background-image: none !important; box-shadow: none !important; }
  /* catch-all first (low specificity), then re-lighten secondary text below —
     class selectors win the specificity tie so order here doesn't matter,
     but a plain ".section { color:#000 }" alone does NOT reach text nested
     in elements like ".about-body p" that set their own (light, dark-theme)
     color, hence the "body *" sweep. */
  body, body * { color: #000 !important; }
  a { color: #000 !important; text-decoration: underline; }
  .section-eyebrow, .stat-value, .project-tagline, .print-title,
  .section-sub, .stat-label, .contact-label,
  .skill-card li, .project-desc, .print-contact { color: #333 !important; }

  .section { padding: 0 0 24px; border-color: #ccc !important; }
  .section.alt { border: none; }

  .skill-card, .project-card, .contact-card, .stat-tile, .code-pane,
  .about-body code, .project-desc code {
    border: 1px solid #ccc !important;
    break-inside: avoid;
  }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: 1fr; }
  .project-card:first-child { grid-column: auto; }
  .tag { border-color: #ccc !important; color: #333 !important; }
  .code-tabs { display: none; }

  /* Print Resume: collapse each project to name + tagline only. */
  body.print-resume .resume-hide,
  body.print-resume .project-desc,
  body.print-resume .tags,
  body.print-resume .project-links,
  body.print-resume .code-demo { display: none; }
}

/* ── responsive ── */
@media (max-width: 860px) {
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: 1fr; }
  .project-card:first-child { grid-column: auto; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg1);
    border-bottom: 1px solid var(--border);
    padding: 1rem 24px;
    gap: 0.9rem;
  }
  .nav-links.open { display: flex; }
  .menu-toggle { display: flex; }
  /* Keep the primary "Email me" CTA visible on mobile — only trim the
     language toggle's text label (icon + chevron stay) so both fit. */
  .lang-toggle span { display: none; }
  .lang-toggle { padding: 0.4rem; }
  .nav-right { gap: 0.4rem; }
  .skills-grid { grid-template-columns: 1fr; }
  .contact-row { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
  .contact-value { text-align: left; }
}

/* Very narrow phones: drop the wordmark, keep the 灵 mark + full nav-right
   (Email CTA, language switcher, hamburger) from overflowing. */
@media (max-width: 400px) {
  .brand-name { display: none; }
}
