/* === Design Contract: Living Case Study Portfolio === */
/* Style: Living Case Study — process-driven, functional palette, real metrics */
/* Typography: Fraunces (display serif) + Outfit (functional sans) + JetBrains Mono */
/* Color: warm dark charcoal with amber/bronze accent, tinted neutrals */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,600;9..144,700;9..144,900&family=Outfit:wght@200;300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* Color: warm dark charcoal with amber accent — OKLCH-derived */
  --bg: #0d0c0a;
  --surface: #15130f;
  --surface-2: #1e1b15;
  --surface-3: #28241c;
  --border: #332e23;
  --border-light: #443e30;
  --text: #f0ebe0;
  --text-sub: #c4baa8;
  --text-muted: #8a8170;
  --text-disabled: #5a5240;
  --accent: #e0a040;
  --accent-hover: #f0b850;
  --accent-active: #ffc860;
  --accent-soft: rgba(224, 160, 64, 0.12);
  --accent-2: #5dd4b8;
  --accent-3: #d07050;
  --danger: #e84040;
  --warning: #f0a820;
  --success: #50c830;
  --positive: #50c830;
  --negative: #e84040;

  /* Typography scale — 1.333 (perfect fourth) with dramatic display jumps */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-sans: 'Outfit', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.333rem;
  --fs-xl: 1.777rem;
  --fs-2xl: 2.369rem;
  --fs-3xl: 3.157rem;
  --fs-4xl: 4.209rem;
  --fs-hero: clamp(3rem, 7vw, 5.5rem);

  /* Spacing — generous, dramatic */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;
  --sp-10: 128px;

  /* Radius */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 999px;

  /* Layout */
  --max: 1140px;
  --max-read: 720px;
  --max-wide: 960px;
  --nav-h: 64px;

  /* Shadows */
  --shadow-1: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-2: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-3: 0 12px 40px rgba(0,0,0,0.45);
  --shadow-glow: 0 8px 32px rgba(224, 160, 64, 0.08);

  /* Transitions */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.3s;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--accent-hover); }

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

/* === App Shell: Fixed Nav === */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(13, 12, 10, 0.82);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  z-index: 100; display: flex; align-items: center;
}
.nav__inner {
  width: 100%; max-width: var(--max); margin: 0 auto;
  padding: 0 28px; display: flex; align-items: center; justify-content: space-between;
}
.nav__logo {
  font-family: var(--font-display);
  font-size: 1.2rem; font-weight: 700; color: var(--accent);
  letter-spacing: 0.5px; text-decoration: none;
}
.nav__links { display: flex; gap: 32px; list-style: none; }
.nav__links a {
  color: var(--text-sub); font-size: 0.875rem; font-weight: 400;
  letter-spacing: 0.3px; text-decoration: none; transition: color var(--dur) var(--ease);
  position: relative;
}
.nav__links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0;
  width: 0; height: 2px; background: var(--accent);
  transition: width var(--dur) var(--ease-out);
}
.nav__links a:hover, .nav__links a.active { color: var(--accent); }
.nav__links a:hover::after, .nav__links a.active::after { width: 100%; }
.nav__toggle {
  display: none; background: none; border: none;
  color: var(--text); font-size: 1.3rem; cursor: pointer;
}
@media (max-width: 768px) {
  .nav__inner { padding: 0 16px; }
  .nav__toggle { display: block; }
  .nav__links {
    display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; background: var(--surface);
    padding: 20px; gap: 16px; border-bottom: 1px solid var(--border);
  }
  .nav__links.open { display: flex; }
}

/* === Page Content === */
.page { padding-top: var(--nav-h); }
.page__body { width: 100%; max-width: var(--max); margin: 0 auto; padding: 40px 28px; }
.page__back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: 0.85rem;
  margin-bottom: 32px; text-decoration: none;
  transition: color var(--dur) var(--ease), gap var(--dur) var(--ease);
}
.page__back:hover { color: var(--accent); gap: 10px; }

/* === Hero === */
.hero {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  padding: var(--nav-h) 28px var(--sp-9);
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 800px 600px at 20% 30%, rgba(224, 160, 64, 0.06), transparent 60%),
    radial-gradient(ellipse 600px 400px at 80% 70%, rgba(93, 212, 184, 0.03), transparent 50%);
  pointer-events: none;
}
.hero::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: linear-gradient(90deg, transparent, var(--border-light), transparent);
}
.hero__content { position: relative; z-index: 1; text-align: center; max-width: 760px; }
.hero__tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 18px; border: 1px solid var(--border-light); border-radius: var(--r-pill);
  font-size: var(--fs-sm); color: var(--accent-2); margin-bottom: 24px;
  letter-spacing: 1.5px; font-weight: 400;
  background: rgba(93, 212, 184, 0.04);
}
.hero__tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }
.hero__name {
  font-family: var(--font-display); font-weight: 300;
  font-size: var(--fs-hero); line-height: 1.05; margin-bottom: 16px;
  letter-spacing: -1.5px; color: var(--text);
  font-variation-settings: 'opsz' 144;
}
.hero__name em {
  font-style: italic; font-weight: 600; color: var(--accent);
}
.hero__title {
  font-size: var(--fs-lg); color: var(--text-sub);
  margin-bottom: 12px; font-weight: 300; letter-spacing: 0.5px;
}
.hero__desc {
  font-size: var(--fs-base); color: var(--text-muted);
  max-width: 560px; margin: 0 auto 40px; line-height: 1.85;
}
.hero__stats {
  display: flex; justify-content: center; gap: 48px;
  flex-wrap: wrap; margin-top: 32px;
}
.hero__stat { text-align: center; }
.hero__stat-num {
  font-family: var(--font-mono); font-size: var(--fs-2xl); font-weight: 500;
  color: var(--accent); line-height: 1;
}
.hero__stat-label {
  font-size: var(--fs-xs); color: var(--text-muted);
  margin-top: 8px; letter-spacing: 1px; text-transform: uppercase;
}
.hero__scroll {
  position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
  color: var(--text-muted); font-size: var(--fs-xs);
  letter-spacing: 1px; animation: bounce 2.5s var(--ease) infinite;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
@keyframes bounce { 0%,100%{transform:translateX(-50%) translateY(0)} 50%{transform:translateX(-50%) translateY(8px)} }

/* === Section === */
.section { padding: var(--sp-9) 28px; max-width: var(--max); margin: 0 auto; }
.section__header { margin-bottom: var(--sp-7); }
.section__num {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--accent); letter-spacing: 2px; margin-bottom: 12px; font-weight: 500;
}
.section__title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(var(--fs-xl), 3vw, var(--fs-3xl));
  margin-bottom: 12px; line-height: 1.15; letter-spacing: -0.5px;
}
.section__desc { color: var(--text-muted); font-size: var(--fs-base); max-width: 580px; line-height: 1.75; }

/* === About === */
.about { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: start; }
.about__card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 32px;
}
.about__card h3 {
  font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600;
  color: var(--accent); margin-bottom: 16px;
}
.about__card p {
  color: var(--text-sub); font-size: var(--fs-sm); line-height: 1.85; margin-bottom: 12px;
}
.about__info { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; font-size: var(--fs-sm); }
.about__info dt { color: var(--text-muted); white-space: nowrap; font-weight: 400; }
.about__info dd { color: var(--text); font-weight: 500; }
@media (max-width: 640px) { .about { grid-template-columns: 1fr; } }

/* === Skills === */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 28px;
  transition: transform var(--dur) var(--ease-out), border-color var(--dur) var(--ease);
  position: relative; overflow: hidden;
}
.skill-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 0;
  background: var(--accent); transition: height var(--dur) var(--ease-out);
}
.skill-card:hover { transform: translateY(-4px); }
.skill-card:hover::before { height: 100%; }
.skill-card:hover { border-color: var(--border-light); }
.skill-card__icon { font-size: 1.75rem; margin-bottom: 12px; }
.skill-card__title {
  font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600;
  color: var(--accent); margin-bottom: 12px;
}
.skill-card__items { list-style: none; font-size: var(--fs-sm); color: var(--text-sub); }
.skill-card__items li { padding-left: 16px; position: relative; margin-bottom: 6px; line-height: 1.6; }
.skill-card__items li::before {
  content: '→'; position: absolute; left: 0; color: var(--accent-2); font-size: var(--fs-xs);
}

/* === Filter === */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 40px; }
.filter-btn {
  padding: 8px 18px; border: 1px solid var(--border); border-radius: var(--r-pill);
  background: transparent; color: var(--text-sub); font-size: var(--fs-sm);
  cursor: pointer; transition: all var(--dur) var(--ease);
  font-family: var(--font-sans); font-weight: 400;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active {
  background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600;
}

/* === Project Grid === */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; }
.project-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; cursor: pointer;
  transition: transform var(--dur) var(--ease-out), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  position: relative;
}
.project-card:hover {
  transform: translateY(-6px); border-color: var(--border-light); box-shadow: var(--shadow-glow), var(--shadow-3);
}
.project-card__top { padding: 28px; flex: 1; }
.project-card__tag {
  display: inline-block; padding: 3px 12px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; margin-bottom: 16px; letter-spacing: 0.5px;
}
.tag--system { background: rgba(224, 160, 64, 0.12); color: var(--accent); }
.tag--level { background: rgba(93, 212, 184, 0.12); color: var(--accent-2); }
.tag--narrative { background: rgba(208, 112, 80, 0.12); color: var(--accent-3); }
.tag--analysis { background: rgba(160, 140, 100, 0.15); color: #c4a870; }
.project-card__title {
  font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 600;
  margin-bottom: 8px; line-height: 1.3; letter-spacing: -0.3px;
}
.project-card__role { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: 16px; letter-spacing: 0.5px; }
.project-card__desc { font-size: var(--fs-sm); color: var(--text-sub); line-height: 1.75; }
.project-card__link {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 16px; font-size: var(--fs-sm); color: var(--accent);
  transition: gap var(--dur) var(--ease);
}
.project-card:hover .project-card__link { gap: 8px; }
.project-card__metrics {
  display: flex; gap: 16px; padding: 16px 28px;
  border-top: 1px solid var(--border); background: var(--surface-2);
}
.project-card__metric { text-align: center; flex: 1; }
.project-card__metric-num {
  font-family: var(--font-mono); font-size: var(--fs-lg); font-weight: 700; color: var(--accent);
}
.project-card__metric-label { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }

/* === Game Experience === */
.game-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; margin-bottom: 40px; }
.game-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px; text-align: center;
}
.game-stat__num {
  font-family: var(--font-mono); font-size: var(--fs-2xl); font-weight: 700; color: var(--accent);
}
.game-stat__label { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; letter-spacing: 0.5px; }
.game-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.game-table th {
  background: var(--surface-2); color: var(--text-sub); font-weight: 600;
  text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs); letter-spacing: 0.5px;
}
.game-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-sub); }
.game-table tr:hover td { color: var(--text); background: var(--surface-2); }
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); }

/* === Contact === */
.contact { text-align: center; padding: var(--sp-9) 28px; background: var(--surface); border-top: 1px solid var(--border); }
.contact h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(var(--fs-xl), 3vw, var(--fs-2xl)); margin-bottom: 16px;
}
.contact p { color: var(--text-muted); margin-bottom: 32px; font-size: var(--fs-base); }
.contact__links { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.contact__link {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text-sub); font-size: var(--fs-sm); transition: all var(--dur) var(--ease);
  text-decoration: none; font-weight: 400;
}
.contact__link:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* === Footer === */
.footer {
  text-align: center; padding: 32px 28px;
  border-top: 1px solid var(--border); color: var(--text-muted);
  font-size: var(--fs-xs); letter-spacing: 0.5px;
}

/* === Video Player === */
.video-section { margin: 40px 0; }
.video-player {
  width: 100%; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--border); background: #000;
  box-shadow: var(--shadow-3);
}
.video-player video { display: block; width: 100%; height: auto; }
.video-player__bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; background: var(--surface-2);
  border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-sub);
}

/* === Document Reader === */
.doc-reader { max-width: var(--max-read); margin: 0 auto; }
.doc-reader h1 {
  font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 600;
  margin-bottom: 8px; line-height: 1.25; letter-spacing: -0.5px;
}
.doc-reader__meta {
  display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-muted);
  margin-bottom: 40px; padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
.doc-reader h2 {
  font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 600;
  color: var(--accent); margin-top: 40px; margin-bottom: 16px; line-height: 1.3;
}
.doc-reader h3 {
  font-size: var(--fs-lg); font-weight: 600; color: var(--accent-2);
  margin-top: 24px; margin-bottom: 10px;
}
.doc-reader h4 {
  font-size: var(--fs-base); font-weight: 600; color: var(--text-sub);
  margin-top: 20px; margin-bottom: 8px;
}
.doc-reader p {
  font-size: var(--fs-sm); color: var(--text-sub); line-height: 1.9; margin-bottom: 14px;
}
.doc-reader ul, .doc-reader ol {
  font-size: var(--fs-sm); color: var(--text-sub); line-height: 1.85;
  margin-bottom: 14px; padding-left: 24px;
}
.doc-reader li { margin-bottom: 6px; }
.doc-reader table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: var(--fs-sm); }
.doc-reader th {
  background: var(--surface-2); color: var(--text-sub); font-weight: 600;
  text-align: left; padding: 10px 14px; border: 1px solid var(--border);
}
.doc-reader td { padding: 10px 14px; border: 1px solid var(--border); color: var(--text-sub); }
.doc-reader blockquote {
  border-left: 3px solid var(--accent); padding-left: 20px;
  margin: 20px 0; color: var(--text-muted); font-style: italic; font-size: var(--fs-sm);
}
.doc-reader code {
  font-family: var(--font-mono); font-size: 0.85em; color: var(--accent-2);
  background: var(--surface-2); padding: 2px 6px; border-radius: var(--r-sm);
}
.doc-reader__section { margin-bottom: 40px; }

/* === Timeline === */
.timeline { position: relative; padding-left: 28px; margin-top: 20px; }
.timeline::before {
  content: ''; position: absolute; left: 6px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline__item { position: relative; margin-bottom: 24px; padding-left: 20px; }
.timeline__item::before {
  content: ''; position: absolute; left: -26px; top: 6px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.timeline__time { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--accent-2); }
.timeline__title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); margin: 4px 0; }
.timeline__desc { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.7; }

/* === Flow Steps === */
.flow { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.flow__step {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 8px 14px;
  font-size: var(--fs-sm); color: var(--text-sub); position: relative;
}
.flow__step::after {
  content: '→'; position: absolute; right: -10px; top: 50%;
  transform: translateY(-50%); color: var(--accent); font-size: var(--fs-xs);
}
.flow__step:last-child::after { display: none; }

/* === Metrics Grid === */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin: 20px 0; }
.metric-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px 20px; text-align: center;
}
.metric-card__num {
  font-family: var(--font-mono); font-size: var(--fs-xl); font-weight: 700; color: var(--accent);
}
.metric-card__label { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }

/* === Fade In === */
.fade-in {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fade-in { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

@media (max-width: 768px) {
  .hero__stats { gap: 24px; }
  .hero__stat-num { font-size: var(--fs-xl); }
  .section { padding: var(--sp-8) 16px; }
  .about__card { padding: 24px; }
  .page__body { padding: 24px 16px; }
}
