/* ============================================
   码哥工坊 — Design System
   Warm editorial + bold game studio aesthetic
   ============================================ */

/* === Tokens === */
:root {
  --ink: #1a1a3e;
  --ink-muted: #5a5a72;
  --ink-subtle: #9494a8;
  --coral: #ff4b26;
  --coral-deep: #d93a1a;
  --coral-pale: #fff0eb;
  --cream: #faf7f2;
  --cream-warm: #f5efe4;
  --white: #ffffff;
  --navy: #1a1a3e;
  --navy-light: #2a2a5e;
  --gold: #ffb347;
  --border: #e8e4db;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; font-size: 16px; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--coral-pale); color: var(--coral); }

/* === Container === */
.container { max-width: 1280px; margin: 0 auto; padding: 0 clamp(1.5rem, 5vw, 3rem); }

/* === Section === */
.section { padding: clamp(4rem, 10vw, 8rem) 0; }
.section--dark { background: var(--navy); color: var(--white); }
.section--alt { background: var(--cream-warm); }

.section-header { margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.section-header--light .section-tag { color: var(--coral); background: rgba(255,75,38,0.12); }
.section-header--light h2 { color: var(--white); }
.section-tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--coral);
  background: var(--coral-pale);
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}
.section-tag--light { color: var(--gold); background: rgba(255,179,71,0.15); }
.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* === Navigation === */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: background 0.3s, box-shadow 0.3s;
}
.nav.scrolled { background: rgba(250,247,242,0.85); backdrop-filter: blur(16px); box-shadow: 0 1px 0 var(--border); }
.nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 clamp(1.5rem, 5vw, 3rem);
  height: 72px; display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 0.6rem; z-index: 110; }
.logo-mark {
  width: 34px; height: 34px; background: var(--coral); color: var(--white);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-size: 0.7rem; font-weight: 700; letter-spacing: -0.03em;
}
.logo-texts { display: flex; flex-direction: column; }
.logo-text { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.logo-sub { font-family: var(--font-body); font-size: 0.6rem; font-weight: 500; color: var(--ink-subtle); letter-spacing: 0.08em; text-transform: uppercase; }

.nav-links { display: none; align-items: center; gap: 2rem; }
.nav-links a { font-size: 0.9rem; font-weight: 500; color: var(--ink-muted); transition: color 0.2s; }
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  background: var(--ink); color: var(--white) !important;
  padding: 0.5rem 1.25rem; border-radius: 100px; font-size: 0.85rem !important;
  transition: background 0.2s, transform 0.2s !important;
}
.nav-cta:hover { background: var(--coral); transform: translateY(-1px); }

.menu-btn {
  display: flex; flex-direction: column; gap: 5px; z-index: 110;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.menu-btn span {
  display: block; width: 22px; height: 2px; background: var(--ink);
  border-radius: 2px; transition: transform 0.3s, opacity 0.3s;
}
.menu-btn.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-btn.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }

.mobile-menu {
  position: fixed; inset: 0; background: var(--cream);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5rem;
  opacity: 0; pointer-events: none; transition: opacity 0.4s; z-index: 105;
}
.mobile-menu.active { opacity: 1; pointer-events: auto; }
.mobile-menu a { font-family: var(--font-display); font-size: 2rem; font-weight: 600; color: var(--ink); }

@media (min-width: 768px) {
  .nav-links { display: flex; }
  .menu-btn { display: none; }
}

/* === Hero === */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; align-items: center;
  padding: 8rem 0 4rem;
  overflow: hidden;
}
.hero-content { max-width: 1280px; margin: 0 auto; padding: 0 clamp(1.5rem, 5vw, 3rem); width: 100%; }

/* Decorative shapes */
.hero-deco {
  position: absolute; pointer-events: none;
}
.hero-deco--1 {
  top: 15%; right: 5%;
  width: clamp(200px, 30vw, 420px); aspect-ratio: 1;
  background: var(--coral-pale);
  border-radius: 40% 60% 60% 40% / 40% 40% 60% 60%;
  animation: morph 12s ease-in-out infinite;
}
.hero-deco--2 {
  bottom: 20%; left: 3%;
  width: 100px; height: 100px;
  border: 2px solid var(--coral);
  border-radius: 50%;
  opacity: 0.3;
  animation: float 8s ease-in-out infinite;
}
.hero-deco--3 {
  top: 30%; left: 45%;
  width: 60px; height: 60px;
  background: var(--gold);
  border-radius: var(--radius-sm);
  opacity: 0.4;
  transform: rotate(15deg);
  animation: float 10s ease-in-out infinite 1s;
}

@keyframes morph {
  0%, 100% { border-radius: 40% 60% 60% 40% / 40% 40% 60% 60%; }
  33% { border-radius: 60% 40% 40% 60% / 60% 60% 40% 40%; }
  66% { border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%; }
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(15deg); }
  50% { transform: translateY(-20px) rotate(20deg); }
}

.hero-eyebrow {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--coral);
  letter-spacing: 0.04em;
  margin-bottom: 1.25rem;
}

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}
.hero-headline__italic { font-style: italic; font-weight: 400; }
.hero-headline__accent {
  color: var(--coral);
  position: relative;
}
.hero-headline__accent::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: -8px; height: 6px;
  background: var(--coral-pale);
  z-index: -1;
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--ink-muted);
  max-width: 520px;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 3rem; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  font-family: var(--font-body); font-size: 0.95rem; font-weight: 600;
  background: var(--coral); color: var(--white);
  border: none; border-radius: 100px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  letter-spacing: -0.01em;
}
.btn:hover { background: var(--coral-deep); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,75,38,0.2); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn--ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--border); }
.btn--ghost:hover { background: var(--white); color: var(--ink); box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.btn--sm { padding: 0.55rem 1.25rem; font-size: 0.85rem; }
.btn--full { width: 100%; justify-content: center; }

/* === Hero Stats === */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.hero-stat__num {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--coral);
  line-height: 1;
}
.hero-stat__label { font-size: 0.85rem; color: var(--ink-muted); margin-top: 0.3rem; display: block; }

/* === Bento Grid === */
.bento {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 600px) {
  .bento {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
  .bento-card--main { grid-column: span 2; }
}
@media (min-width: 1024px) {
  .bento {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
  .bento-card--main { grid-column: span 2; grid-row: span 2; }
  .bento-card--cta { grid-row: span 1; }
}

.bento-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  transition: border-color 0.3s, box-shadow 0.3s;
  overflow: hidden;
}
.bento-card:hover { border-color: var(--coral); box-shadow: 0 4px 24px rgba(0,0,0,0.04); }
.bento-card__inner { padding: clamp(1.5rem, 4vw, 2.25rem); height: 100%; display: flex; flex-direction: column; }

.bento-card__num {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--coral);
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}
.bento-card__title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.bento-card__desc {
  font-size: 0.9rem;
  color: var(--ink-muted);
  line-height: 1.55;
  margin-bottom: 1rem;
  flex-grow: 1;
}
.bento-card__tags {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  list-style: none; padding: 0; margin: 0;
}
.bento-card__tags li {
  font-size: 0.72rem; font-weight: 500;
  padding: 0.25rem 0.65rem;
  background: var(--cream-warm);
  border-radius: 100px;
  color: var(--ink-muted);
}

.bento-card__visual {
  margin-top: 1.25rem;
  background: var(--cream);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.bento-card__visual svg { width: 100%; height: auto; display: block; }

.bento-card--main .bento-card__inner { gap: 0; }
.bento-card--main .bento-card__desc { max-width: 480px; }
.bento-card--cta {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
  text-align: center;
  align-items: center;
  justify-content: center;
}
.bento-card--cta .bento-card__title { color: var(--white); font-size: 1.25rem; }
.bento-card--cta .bento-card__desc { color: rgba(255,255,255,0.55); }
.bento-card--cta .btn { margin-top: 0.5rem; }

/* === Work / Portfolio === */
.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 768px) { .work-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .work-grid { grid-template-columns: repeat(3, 1fr); } }

.work-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: border-color 0.3s, transform 0.3s;
}
.work-card:hover { border-color: rgba(255,255,255,0.2); transform: translateY(-4px); }
.work-card__media { position: relative; aspect-ratio: 4/3; overflow: hidden; }
.work-card__media svg { width: 100%; height: 100%; }
.work-card__platform {
  position: absolute; top: 1rem; right: 1rem;
  font-size: 0.7rem; font-weight: 600; color: var(--white);
  background: rgba(0,0,0,0.4); backdrop-filter: blur(8px);
  padding: 0.25rem 0.7rem; border-radius: 100px;
}
.work-card__body { padding: 1.5rem; }
.work-card__tags { display: flex; gap: 0.4rem; margin-bottom: 0.6rem; }
.work-card__tags span {
  font-size: 0.7rem; font-weight: 500;
  color: var(--gold); background: rgba(255,179,71,0.12);
  padding: 0.2rem 0.6rem; border-radius: 100px;
}
.work-card__body h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}
.work-card__body p { font-size: 0.88rem; color: rgba(255,255,255,0.45); line-height: 1.5; }

/* === Process === */
.process-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 768px) {
  .process-grid {
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    align-items: start;
  }
}
.process-step {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 4vw, 2rem);
}
.process-step__num {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--coral);
  margin-bottom: 0.5rem;
}
.process-step h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.process-step p { font-size: 0.9rem; color: var(--ink-muted); line-height: 1.5; margin-bottom: 1rem; }
.process-step__time {
  font-size: 0.78rem; font-weight: 500; color: var(--ink-subtle);
  padding-top: 0.75rem; border-top: 1px solid var(--border);
}
.process-arrow {
  display: none;
  color: var(--coral);
  padding: 0 0.25rem;
  align-self: center;
}
.process-arrow svg { width: 28px; height: 28px; }
@media (min-width: 768px) { .process-arrow { display: block; } }

/* === Testimonials === */
.testimonials-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 768px) { .testimonials-grid { grid-template-columns: repeat(3, 1fr); } }

.testimonial {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(1.75rem, 4vw, 2.25rem);
}
.testimonial__stars { color: var(--gold); font-size: 1rem; margin-bottom: 1rem; letter-spacing: 0.05em; }
.testimonial blockquote {
  font-size: 0.92rem;
  color: var(--ink-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  font-style: italic;
  quotes: none;
}
.testimonial footer strong { display: block; font-size: 0.9rem; color: var(--ink); font-weight: 600; }
.testimonial footer span { font-size: 0.8rem; color: var(--ink-subtle); }

/* === Contact === */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}
@media (min-width: 768px) { .contact-layout { grid-template-columns: 1fr 1fr; gap: 4rem; } }

.contact-info h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  margin-top: 1rem;
}
.contact-info > p { font-size: 0.95rem; color: var(--ink-muted); max-width: 420px; line-height: 1.6; margin-bottom: 2rem; }

.contact-details { display: flex; flex-direction: column; gap: 1rem; }
.contact-detail {
  display: flex; align-items: center; gap: 1rem;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem 1.25rem;
}
.contact-detail svg { width: 22px; height: 22px; color: var(--coral); flex-shrink: 0; }
.contact-detail div { line-height: 1.4; }
.contact-detail div span { display: block; font-size: 0.72rem; color: var(--ink-subtle); text-transform: uppercase; letter-spacing: 0.05em; }

/* QR code card */
.contact-qr { display: flex; align-items: flex-start; justify-content: center; }
.contact-qr__card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  text-align: center;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.contact-qr__card:hover { border-color: var(--coral); box-shadow: 0 8px 32px rgba(0,0,0,0.06); }
.contact-qr__img {
  display: block;
  width: clamp(200px, 40vw, 280px);
  height: auto;
  margin: 0 auto 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.contact-qr__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.4rem;
  letter-spacing: -0.02em;
}
.contact-qr__hint {
  font-size: 0.85rem;
  color: var(--ink-muted);
  line-height: 1.55;
  max-width: 260px;
  margin: 0 auto;
}

.contact-form {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  display: flex; flex-direction: column; gap: 1.25rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--ink); }
.form-group input, .form-group select, .form-group textarea {
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--cream);
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: vertical;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(255,75,38,0.12);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--ink-subtle); }
.form-group select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%235a5a72' viewBox='0 0 16 16'%3E%3Cpath d='M4.6 6.4L8 9.8l3.4-3.4.8.8L8 11.3 3.8 7.2z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.form-success {
  display: none;
  padding: 1rem;
  background: #ecfdf3;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: var(--radius);
  font-size: 0.9rem;
  text-align: center;
}
.form-success.show { display: block; }

/* === Footer === */
.footer { padding: 2.5rem 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
@media (min-width: 768px) { .footer-inner { flex-direction: row; justify-content: space-between; } }
.footer-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.9rem; }
.logo-mark--sm { width: 26px; height: 26px; font-size: 0.55rem; border-radius: 6px; }
.footer-copy { font-size: 0.8rem; color: var(--ink-subtle); }
.footer-icp { font-size: 0.75rem; }
.footer-icp a { color: var(--ink-subtle); transition: color 0.2s; }
.footer-icp a:hover { color: var(--coral); }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { font-size: 0.82rem; color: var(--ink-muted); transition: color 0.2s; }
.footer-links a:hover { color: var(--coral); }

/* === Scroll Reveal === */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.reveal.revealed { opacity: 1; transform: translateY(0); }

/* === Focus === */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--coral); outline-offset: 2px; border-radius: 4px;
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* === Touch Device === */
@media (pointer: coarse) {
  .hero-deco--2, .hero-deco--3 { animation: none; }
}
