/* ============================================
   John Yu - Fab Academy Documentation
   Modern CSS Stylesheet
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.7;
  color: #333;
  background-color: #f8f9fa;
}

/* --- Bilingual Toggle --- */
.lang-zh { display: none; }
body.zh .lang-en { display: none; }
body.zh .lang-zh { display: inline; }

/* Block-level bilingual elements */
h1 .lang-zh, h2 .lang-zh, h3 .lang-zh, h4 .lang-zh,
p.bilingual .lang-zh, li.bilingual .lang-zh,
div.bilingual .lang-zh, figcaption .lang-zh,
blockquote .lang-zh, .card-body .lang-zh {
  display: none;
}
body.zh h1 .lang-en, body.zh h2 .lang-en, body.zh h3 .lang-en, body.zh h4 .lang-en,
body.zh p.bilingual .lang-en, body.zh li.bilingual .lang-en,
body.zh div.bilingual .lang-en, body.zh figcaption .lang-en,
body.zh blockquote .lang-en, body.zh .card-body .lang-en {
  display: none;
}
body.zh h1 .lang-zh, body.zh h2 .lang-zh, body.zh h3 .lang-zh, body.zh h4 .lang-zh,
body.zh p.bilingual .lang-zh, body.zh li.bilingual .lang-zh,
body.zh div.bilingual .lang-zh, body.zh figcaption .lang-zh,
body.zh blockquote .lang-zh, body.zh .card-body .lang-zh {
  display: inline;
}

/* --- Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  background-color: #1a1a2e;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.navbar-brand {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.navbar-brand:hover {
  color: #e94560;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.navbar-links a {
  color: #b0b0cc;
  font-size: 14px;
  padding: 8px 14px;
  text-decoration: none;
  border-radius: 6px;
  transition: color 0.2s, background-color 0.2s;
}

.navbar-links a:hover,
.navbar-links a.active {
  color: #ffffff;
  background-color: rgba(233, 69, 96, 0.15);
}

/* Language toggle button */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  margin-left: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #e94560;
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid rgba(233, 69, 96, 0.3);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.lang-toggle:hover {
  background: rgba(233, 69, 96, 0.2);
  border-color: #e94560;
}

/* Mobile hamburger */
.navbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: #b0b0cc;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
}

/* --- Content Area --- */
.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

/* --- Typography --- */
h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 16px;
  line-height: 1.3;
}

h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 3px solid #e94560;
  display: inline-block;
}

/* Make h2 take full width but border only underlines text */
h2::after {
  content: '';
  display: block;
}

h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #2d2d44;
  margin-top: 32px;
  margin-bottom: 12px;
}

h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #444;
  margin-top: 24px;
  margin-bottom: 8px;
}

p {
  margin-bottom: 16px;
  color: #444;
}

a {
  color: #e94560;
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #c0392b;
  text-decoration: underline;
}

ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

li {
  margin-bottom: 6px;
}

code {
  background-color: #f0f0f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: #e94560;
}

pre {
  background-color: #1a1a2e;
  color: #e0e0e0;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
}

blockquote {
  border-left: 4px solid #e94560;
  padding: 12px 20px;
  margin: 20px 0;
  background: #fff5f5;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: #555;
}

hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #ddd, transparent);
  margin: 40px 0;
}

/* --- Card Layout (Home Page) --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.card {
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  text-decoration: none;
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 20px;
}

.card-body h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.15rem;
  color: #1a1a2e;
}

.card-body p {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0;
}

.card-tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #e94560;
  background: rgba(233, 69, 96, 0.1);
  border-radius: 12px;
  margin-bottom: 10px;
}

/* --- Image Styles --- */
.content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  margin: 8px 0;
}

/* Image gallery grid */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.image-gallery img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.image-gallery img:hover {
  transform: scale(1.02);
}

/* Full-width image */
.image-full {
  width: 100%;
  margin: 20px 0;
}

/* Portrait (vertical) images — constrain size */
.content .img-portrait,
figure .img-portrait {
  max-width: 38%;
  width: 38%;
  display: block;
  margin: 16px auto;
}

@media (max-width: 768px) {
  .content .img-portrait,
  figure .img-portrait {
    max-width: 60%;
    width: 60%;
  }
}

/* Figure with caption */
figure {
  margin: 24px 0;
}

figure img {
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  display: block;
}

figcaption {
  font-size: 0.88rem;
  color: #777;
  text-align: center;
  margin-top: 8px;
  font-style: italic;
}

/* --- About Page --- */
.about-header {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  margin-bottom: 32px;
}

.content .about-avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.about-intro h1 {
  margin-bottom: 4px;
}

.about-intro .subtitle {
  font-size: 1.05rem;
  color: #e94560;
  font-weight: 500;
  margin-bottom: 12px;
}

.achievement-list {
  list-style: none;
  padding: 0;
}

.achievement-list li {
  padding: 8px 0;
  padding-left: 28px;
  position: relative;
  border-bottom: 1px solid #f0f0f0;
}

.achievement-list li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: #e94560;
  font-weight: bold;
}

/* Philosophy quote */
.philosophy-box {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  color: #fff;
  padding: 32px;
  border-radius: 12px;
  margin: 32px 0;
  text-align: center;
}

.philosophy-box p {
  color: #ddd;
  font-size: 1.15rem;
  font-style: italic;
  margin-bottom: 0;
}

.philosophy-box .quote-mark {
  font-size: 3rem;
  color: #e94560;
  line-height: 1;
  margin-bottom: 8px;
}

/* --- Table Styles --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

thead {
  background: #1a1a2e;
  color: #fff;
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}

tbody tr:hover {
  background: #f8f9fa;
}

/* --- Checklist --- */
.checklist {
  list-style: none;
  padding: 0;
}

.checklist li {
  padding: 6px 0 6px 32px;
  position: relative;
}

.checklist li::before {
  content: '\2610';
  position: absolute;
  left: 4px;
  font-size: 1.1rem;
  color: #999;
}

.checklist li.done::before {
  content: '\2611';
  color: #27ae60;
}

/* --- Footer --- */
footer {
  background: #1a1a2e;
  color: #888;
  text-align: center;
  padding: 30px 20px;
  margin-top: 60px;
}

footer p {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 4px;
}

footer a {
  color: #e94560;
}

footer a:hover {
  color: #ff6b81;
}

/* --- Hero Section --- */
.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  padding: 60px 20px;
  text-align: center;
  margin: -40px -20px 40px;
  border-radius: 0 0 24px 24px;
}

.hero h1 {
  color: #fff;
  font-size: 2.6rem;
  margin-bottom: 12px;
}

.hero p {
  color: #b0b0cc;
  font-size: 1.15rem;
  max-width: 600px;
  margin: 0 auto;
}

.hero .accent {
  color: #e94560;
}

/* --- Section Box --- */
.section-box {
  background: #ffffff;
  border-radius: 12px;
  padding: 32px;
  margin: 24px 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* --- Process Steps --- */
.process-step {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin: 24px 0;
  padding: 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.process-step .step-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: #e94560;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.process-step .step-content {
  flex: 1;
}

.process-step .step-content h4 {
  margin-top: 0;
  margin-bottom: 8px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .navbar-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px;
  }

  .navbar-hamburger {
    display: block;
  }

  .navbar-links {
    display: none;
    width: 100%;
    flex-direction: column;
    padding: 10px 0;
    gap: 2px;
  }

  .navbar-links.open {
    display: flex;
  }

  .navbar-links a {
    width: 100%;
    padding: 10px 14px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.3rem; }

  .content {
    padding: 24px 16px 40px;
  }

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

  .image-gallery {
    grid-template-columns: 1fr;
  }

  .about-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .content .about-avatar {
    width: 140px;
    height: 140px;
  }

  .process-step {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 40px 16px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .section-box {
    padding: 20px 16px;
  }
}
