/* ── Case Study shared stylesheet ── */

:root {
  --paper: #fffdf7;
  --paper-line: #ece6d3;
  --bg-page: #faf6ec;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-soft: #eef0ff;
  --azure: #6366f1;
  --dark: #1f2233;
  --light: #eef0ff;
  --surface: #f7f3e8;
  --border: #ece6d3;
  --text: #2a2a2a;
  --dim: #6b6b75;
  --green: #0e8a16;
  --white: #ffffff;
  --warm: #fef8e8;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans TC', sans-serif;
  line-height: 1.8;
  color: var(--text);
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  background:
    radial-gradient(circle at 20% 0%, rgba(99,102,241,.04), transparent 40%),
    radial-gradient(circle at 80% 100%, rgba(139,92,246,.04), transparent 40%),
    linear-gradient(to bottom, var(--bg-page), #fcf8ee);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--azure); }
a:hover { text-decoration: underline; }

/* ── Back link ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .88rem;
  color: var(--dim);
  text-decoration: none;
  margin-bottom: 1.5rem;
  font-weight: 600;
  padding: .35rem .9rem .35rem .7rem;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(50,30,15,.04);
  transition: all .2s ease;
}

.back-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateX(-2px);
  text-decoration: none;
}

.back-link svg { width: 14px; height: 14px; fill: currentColor; }

/* ── Hero ── */
.cs-hero {
  position: relative;
  padding-bottom: 1.6rem;
  margin-bottom: 2rem;
}

.cs-hero::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
}

.cs-hero .cs-tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .76rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  letter-spacing: .3px;
  margin-bottom: .7rem;
}

.cs-hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: .4rem;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.cs-hero .cs-subtitle {
  font-size: 1.05rem;
  color: var(--dim);
  font-weight: 500;
  margin-bottom: .8rem;
  line-height: 1.6;
}

.cs-hero .cs-meta {
  font-size: .88rem;
  color: var(--dim);
  margin-bottom: .8rem;
}

.cs-hero .cs-links {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .8rem;
  font-size: .9rem;
  margin-top: .8rem;
}

.cs-hero .cs-links a {
  color: var(--azure);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 6px;
  background: var(--surface);
  transition: all .15s;
}

.cs-hero .cs-links a:hover {
  background: var(--azure);
  color: var(--white);
  text-decoration: none;
  border-color: var(--azure);
}

/* ── CTA buttons row ── */
.cs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1.2rem;
  align-items: center;
}

/* Primary CTA */
.cs-cta {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .8rem 1.7rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--white) !important;
  border-radius: 999px;
  font-size: .98rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(99,102,241,.35), 0 2px 4px rgba(99,102,241,.18);
  transition: transform .2s ease, box-shadow .2s ease;
  line-height: 1;
  letter-spacing: .3px;
  white-space: nowrap;
}

.cs-cta .cs-cta-icon {
  display: inline-block;
  font-size: 1.1rem;
  transition: transform .2s ease;
  line-height: 1;
}

.cs-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(99,102,241,.45), 0 3px 6px rgba(99,102,241,.2);
  text-decoration: none;
}

.cs-cta:hover .cs-cta-icon {
  transform: translateX(4px);
}

.cs-cta svg { display: none; }

/* Secondary CTA */
.cs-cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .8rem 1.3rem;
  background: var(--paper);
  color: var(--dim) !important;
  border: 1.5px solid var(--paper-line);
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .2s ease;
  white-space: nowrap;
}

.cs-cta-secondary:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
  background: var(--accent-soft);
  text-decoration: none;
}

/* Status badge for projects without public link */
.cs-status {
  display: inline-block;
  font-size: .8rem;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  color: var(--dim);
  margin-top: 1rem;
  font-style: italic;
}

/* ── Section headings ── */
h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--dark);
  margin-top: 2.4rem;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  position: relative;
  letter-spacing: -.01em;
}

h2::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 50px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
}

h3 {
  font-size: 1.05rem;
  color: var(--dark);
  margin-top: 1.4rem;
  margin-bottom: .5rem;
}

p { margin-bottom: .8rem; }

ul, ol { padding-left: 1.5rem; margin-bottom: .8rem; }
li { margin-bottom: .4rem; }

strong { color: var(--dark); }

/* ── Metrics row ── */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1.2rem 0;
}

.metric {
  background: linear-gradient(135deg, #f0f6ff, var(--white));
  border: 1px solid var(--border);
  border-left: 4px solid var(--azure);
  border-radius: 8px;
  padding: 1rem 1.2rem;
}

.metric .num {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--azure);
  line-height: 1.1;
}

.metric .lbl {
  font-size: .82rem;
  color: var(--dim);
  margin-top: .2rem;
}

/* ── Pain → Solution callout ── */
.callout {
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 1.1rem 1.4rem;
  margin: 1rem 0;
  box-shadow: 0 1px 2px rgba(50,30,15,.03), 0 4px 12px rgba(50,30,15,.04);
}

.callout.pain {
  border-left-color: #d97757;
  background: linear-gradient(135deg, #fdf3ee, var(--paper));
}

.callout.solution {
  border-left-color: var(--green);
  background: linear-gradient(135deg, #edf6ee, var(--paper));
}

.callout .ctitle {
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: .3rem;
}

.callout.pain .ctitle { color: #b54a1d; }
.callout.solution .ctitle { color: var(--green); }

/* ── Tech stack chips ── */
.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 1rem 0;
}

.tech-stack span {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--dim);
  padding: 4px 12px;
  border-radius: 14px;
  font-size: .82rem;
  font-weight: 500;
}

.tech-stack span.highlight {
  background: var(--light);
  color: var(--dark);
  border-color: var(--azure);
  font-weight: 600;
}

/* ── Mock dashboard (TWCA) — clearly labeled fake demo ── */
.mock-dashboard {
  background: linear-gradient(135deg, #f5f7fb, #ffffff);
  border: 1px solid var(--paper-line);
  border-radius: 14px;
  padding: 1.2rem;
  margin: 1rem 0;
  box-shadow: 0 1px 3px rgba(50,30,15,.04), 0 8px 24px rgba(50,30,15,.06);
  position: relative;
  overflow: hidden;
}

.mock-dashboard::before {
  content: 'MOCK DATA · 示意';
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--white);
  background: linear-gradient(135deg, #d97757, #c45a3a);
  padding: 3px 10px;
  border-radius: 999px;
  z-index: 2;
}

.mock-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
}

.mock-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.mock-dot.r { background: #ff5f57; }
.mock-dot.y { background: #ffbd2e; }
.mock-dot.g { background: #28ca42; }

.mock-title {
  font-size: .82rem;
  color: var(--dim);
  margin-left: .4rem;
  font-family: 'SF Mono', Menlo, monospace;
}

.mock-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .8rem;
  margin-bottom: 1rem;
}

.mock-kpi {
  background: var(--white);
  border-radius: 8px;
  padding: .7rem .9rem;
  border: 1px solid #e8ebf2;
}

.mock-kpi .lbl {
  font-size: .68rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .2rem;
}

.mock-kpi .val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--dark);
  filter: blur(2.5px);
  user-select: none;
}

.mock-kpi .trend {
  font-size: .7rem;
  margin-top: .15rem;
  filter: blur(1.5px);
}

.mock-kpi .trend.up { color: #1a9d3a; }
.mock-kpi .trend.down { color: #c0392b; }

.mock-bars {
  background: var(--white);
  border-radius: 8px;
  border: 1px solid #e8ebf2;
  padding: .9rem 1rem .8rem;
  margin-bottom: 1rem;
}

.mock-bars .b-title {
  font-size: .75rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: .6rem;
  filter: blur(1px);
}

.mock-bar-row {
  display: flex;
  align-items: end;
  gap: 6px;
  height: 70px;
}

.mock-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 3px 3px 0 0;
  opacity: .85;
}

.mock-ai-summary {
  background: linear-gradient(135deg, #fdf8ff, #f5f0ff);
  border: 1px solid #e0d5f5;
  border-radius: 10px;
  padding: .9rem 1.1rem;
  position: relative;
}

.mock-ai-summary::before {
  content: '🤖 AI 分析摘要';
  display: inline-block;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--accent);
  background: var(--white);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: .55rem;
  border: 1px solid var(--accent-soft);
}

.mock-ai-summary p {
  font-size: .82rem;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: .4rem;
}

.mock-ai-summary p.blurred {
  filter: blur(3.5px);
  user-select: none;
}

.mock-ai-summary p strong { color: var(--dark); }

@media (max-width: 600px) {
  .mock-kpis { grid-template-columns: repeat(2, 1fr); }
}

/* ── Screenshot placeholder / image ── */
.screenshot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--dim);
  font-size: .88rem;
  margin: 1rem 0;
}

.screenshot img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.screenshot .caption {
  margin-top: .6rem;
  font-size: .8rem;
  color: var(--dim);
  font-style: italic;
}

.screenshot.placeholder::before {
  content: '🖼️';
  display: block;
  font-size: 2.5rem;
  margin-bottom: .4rem;
  opacity: .6;
}

/* ── Architecture / Flow box ── */
.flow-box {
  background: #1d1f2e;
  color: #e8eaf6;
  padding: 1.3rem 1.5rem;
  border-radius: 12px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: .85rem;
  line-height: 1.75;
  overflow-x: auto;
  margin: 1rem 0;
  white-space: pre;
  border: 1px solid #2a2d40;
  box-shadow: 0 4px 14px rgba(30,30,60,.18);
}

/* ── My role box ── */
.role-box {
  background: linear-gradient(135deg, var(--warm), #fffdf5);
  border: 1px solid #f0d878;
  border-radius: 8px;
  padding: 1rem 1.3rem;
  margin: 1rem 0;
}

.role-box h3 {
  margin-top: 0;
  color: #8a6d00;
  font-size: 1rem;
}

.role-box ul { margin-top: .4rem; padding-left: 1.3rem; }

/* ── Footer of case study ── */
.cs-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.cs-footer .back-to-portfolio {
  color: var(--azure);
  text-decoration: none;
  font-weight: 600;
  font-size: .92rem;
}

.cs-footer .back-to-portfolio:hover { text-decoration: underline; }

.cs-footer .copyright {
  font-size: .82rem;
  color: var(--dim);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  body { padding: 1.2rem 1rem 3rem; }
  .cs-hero h1 { font-size: 1.5rem; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric .num { font-size: 1.5rem; }
  h2 { font-size: 1.15rem; }
}
