/* ============================================================
   FONTS
   ============================================================ */
@font-face {
  font-family: 'NanumGothic';
  src: url('fonts/NanumGothicLight.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NanumGothic';
  src: url('fonts/NanumGothic.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NanumGothic';
  src: url('fonts/NanumGothicBold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NanumGothic';
  src: url('fonts/NanumGothicExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Palette sampled from image/profile.webp: jacket/glass petrol blue,
     sky teal, cool grey-white of the jacket stripe and ledge. */
  --bg:        #F1F4F3;
  --bg-warm:   #E4EBEA;
  --bg-inset:  #D5DFDF;

  --text:      #16222A;
  --text-mid:  #3C4B53;
  --text-dim:  #74858B;

  --accent:    #1E4E66;
  --accent-lt: #3A7F95;

  --rule:       rgba(22,34,42,0.12);
  --rule-heavy: rgba(22,34,42,0.35);

  --fs-hero:  clamp(3rem, 7.5vw, 6.25rem);
  --fs-h1:    clamp(2.2rem, 5vw, 4rem);
  --fs-h2:    clamp(1.5rem, 3vw, 2.5rem);
  --fs-body:  clamp(1rem, 1.5vw, 1.125rem);
  --fs-small: 0.8rem;
  --fs-mono:  0.75rem;

  /* Korean serif fallbacks matter: without them Latin drops to Times
     while Hangul drops to a sans, and headlines render in two faces. */
  --font-display: 'Noto Serif KR', 'Nanum Myeongjo', 'AppleMyungjo', 'Batang', serif;
  --font-body:    'NanumGothic', sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;
  /* DM Mono has no Hangul glyphs. Labels that mix Korean with Latin
     or digits need an explicit Korean fallback, otherwise the Hangul
     drops to whatever the browser picks. */
  --font-label:   'DM Mono', 'NanumGothic', sans-serif;

  --section-gap: clamp(6rem, 12vw, 10rem);
  --content-max: 680px;
  --wide-max:    1200px;
  --page-pad:    clamp(1.5rem, 8%, 6rem);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  /* Hangul has no spaces inside a word-unit, so default breaking
     splits words mid-syllable. keep-all breaks on spaces instead. */
  word-break: keep-all;
  overflow-wrap: break-word;
}

h1, h2, h3, .hero-sub, .card-title, .work-sub-title {
  text-wrap: balance;
}

/* Paper texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.section-inner {
  padding: var(--section-gap) var(--page-pad);
}

.section-inner.narrow {
  max-width: calc(var(--content-max) + 2 * var(--page-pad));
  margin: 0 auto;
}

.section-inner.wide {
  max-width: calc(var(--wide-max) + 2 * var(--page-pad));
  margin: 0 auto;
}

/* ============================================================
   NAV
   ============================================================ */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem var(--page-pad);
  background: rgba(241,244,243,0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

#nav.has-border {
  border-bottom-color: var(--rule);
}

.nav-name {
  font-family: var(--font-label);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-family: var(--font-label);
  font-size: 0.8rem;
  color: var(--text-mid);
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--accent);
}

/* ============================================================
   HERO
   ============================================================ */
#hero {
  min-height: 100svh;
  padding: 6rem var(--page-pad) 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.hero-inner {
  max-width: var(--wide-max);
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 4rem;
  align-items: center;
}

.hero-text {
  min-width: 0;
}

.hero-photo-wrap {
  width: 260px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  flex-shrink: 0;
}

/* Source is a 3:2 landscape with the subject low and centred. Anchor
   the zoom to the bottom edge so the crop lands on him, not the sky. */
.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  display: block;
  transform: scale(1.8);
  transform-origin: 50% 100%;
}

.hero-anim {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.5s cubic-bezier(0.2, 0.6, 0.2, 1) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.eyebrow-line {
  display: block;
  width: 2rem;
  height: 1px;
  background: var(--accent);
}

.eyebrow-text {
  font-family: var(--font-label);
  font-size: var(--fs-small);
  color: var(--text-mid);
  letter-spacing: 0.06em;
}

.hero-title {
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: 900;
  line-height: 1.0;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.hero-title em {
  font-style: normal;
  font-weight: 300;
  color: var(--accent);
}

.hero-sub {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--text-mid);
  line-height: 1.8;
  margin-bottom: 2.5rem;
  max-width: 520px;
}

.hero-cta {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-block;
  border: 2px solid var(--text);
  padding: 0.75rem 2rem;
  font-family: var(--font-label);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  border-radius: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-primary:hover {
  background: var(--text);
  color: var(--bg);
}

.btn-text {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--accent);
  text-decoration: underline;
  transition: color 0.2s;
}

.btn-text:hover {
  color: var(--accent-lt);
}

.scroll-hint {
  position: absolute;
  bottom: 3rem;
  left: var(--page-pad);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.scroll-text {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.scroll-line {
  display: block;
  width: 40px;
  height: 1px;
  background: var(--text-dim);
  transform-origin: left center;
  animation: slideRight 2s ease-in-out infinite;
}

@keyframes slideRight {
  0%, 100% { transform: scaleX(0); }
  50%       { transform: scaleX(1); }
}

/* ============================================================
   CHAPTER HEADER (shared)
   ============================================================ */
.chapter-header {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--rule-heavy);
  margin-bottom: 3rem;
}

/* Chapter number sits out in the margin like a print folio, so the
   label starts on the same baseline as the body text below it. */
.chapter-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

.chapter-label {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0;
}

@media (min-width: 1100px) {
  .chapter-num {
    position: absolute;
    left: -4.5rem;
    top: 0.35rem;
  }
}

/* ============================================================
   STORY SECTION
   ============================================================ */
#story {
  background: var(--bg-warm);
}

.story-body p {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--text-mid);
  line-height: 1.85;
  margin-bottom: 1.5rem;
}

.dropcap::first-letter {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 5.5em;
  float: left;
  line-height: 0.78;
  margin: 0.06em 0.1em 0 0;
  color: var(--accent);
}

/* ============================================================
   EXPERIENCE / TIMELINE
   ============================================================ */
#experience {
  background: var(--bg);
}

.role-card {
  border: 1px solid var(--rule-heavy);
  background: var(--bg-warm);
  padding: 2.5rem;
}

.role-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  padding-bottom: 1.75rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
}

.role-logo {
  height: 28px;
  width: auto;
  max-width: 40%;
  flex-shrink: 0;
  opacity: 0.85;
}

.tl-period {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.tl-company {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.tl-company small {
  font-size: 0.75em;
  color: var(--text-dim);
}

.tl-role {
  font-family: var(--font-label);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.tl-duties {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.tl-duty-title {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.tl-duty-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tl-duty-list li {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-mid);
  line-height: 1.6;
  padding-left: 1rem;
  position: relative;
}

.tl-duty-list li::before,
.skill-group li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.62em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-dim);
  opacity: 0.7;
}

.tl-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tl-tag {
  border: 1px solid var(--rule-heavy);
  border-radius: 0;
  padding: 0.15rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* Uniform padding on every block is what reads as machine-set.
   Weight the sections by how much each one actually carries. */
#story > .section-inner      { padding-block: clamp(4.5rem, 8vw, 7rem); }
#experience > .section-inner { padding-block: clamp(5.5rem, 10vw, 9rem); }
#projects > .section-inner   { padding-block: clamp(6rem, 12vw, 10.5rem); }
#skills > .section-inner     { padding-block: clamp(4.5rem, 8vw, 7rem); }
#contact > .section-inner    { padding-block: clamp(4rem, 7vw, 6rem) clamp(3rem, 5vw, 4.5rem); }

/* ============================================================
   PROJECTS (sticky scroll)
   ============================================================ */
#projects {
  background: var(--bg);
}

#projects > .section-inner {
  padding-bottom: 0;
}

.visual-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
}

.visual-btn {
  display: inline-block;
  border: 1px solid var(--rule-heavy);
  border-radius: 0;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-mid);
  letter-spacing: 0.06em;
  transition: background 0.2s, color 0.2s;
}

.visual-btn:hover {
  background: var(--text);
  color: var(--bg);
}

/* The document is the deliverable, so its button outweighs the page's
   other links instead of matching them. */
.visual-btn--download {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  padding: 1rem 1.9rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

/* Pulls the two downloads out of the body flow as one block. */
.doc-cta {
  margin-top: 2rem;
  padding: 1.75rem;
  background: var(--bg-warm);
  border-left: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.doc-cta-text .work-sub-label {
  display: block;
  margin-bottom: 0.35rem;
}

.doc-cta-text .proj-body {
  font-size: 0.95rem;
}

.visual-btn--download:hover {
  background: var(--accent-lt);
  border-color: var(--accent-lt);
  color: #fff;
}

.visual-btn__icon {
  width: 1.45em;
  height: 1.45em;
  object-fit: contain;
  flex-shrink: 0;
}

/* YouTube embed */

/* Worldmap SVG */

/* Mission flow diagram */

/* Editor mockup */

/* Project index (index page) */
.project-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 3rem;
  row-gap: 4rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--rule-heavy);
  padding-top: 1.25rem;
}

/* Lead project gets the width and the bigger image: real hierarchy,
   not three equal cells. */
.project-card--feature {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2.75rem;
  align-items: start;
}

.project-card--feature .card-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.project-card--feature .card-title {
  font-size: 2rem;
}

.project-card--feature .card-desc {
  font-size: 1rem;
}

.card-body {
  display: contents;
}

.card-thumb {
  aspect-ratio: 16 / 9;
  background: var(--bg-inset);
  overflow: hidden;
}

.project-card--feature .card-thumb {
  aspect-ratio: 16 / 10;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.project-card:hover .card-thumb img {
  transform: scale(1.03);
}

.card-meta {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.card-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.card-kind {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
}

.card-desc {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-mid);
  line-height: 1.75;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.card-tag {
  border: 1px solid var(--rule-heavy);
  padding: 0.15rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.card-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-top: auto;
}

/* Project content (scrolling side) */

.proj-subtitle {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text-dim);
}

.proj-body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--text-mid);
  line-height: 1.8;
}

.design-intent {
  background: var(--bg-inset);
  border-left: 3px solid var(--accent);
  padding: 1.5rem;
}

.intent-label {
  font-family: var(--font-label);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.design-intent p {
  font-family: var(--font-display);
  font-style: normal;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-mid);
}

.proj-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.5rem;
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.meta-label {
  font-family: var(--font-label);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--text-dim);
}

.meta-value {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
}

.proj-meta--below-fold {
  margin-top: 2rem;
}

.meta-item--full-row {
  grid-column: 1 / -1;
}

.meta-tools-text {
  line-height: 1.75;
  max-width: none;
}

/* ============================================================
   IMAGES
   ============================================================ */

.bear-portraits {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.bear-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
}

.bear-portrait img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--rule-heavy);
}

.bear-name {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.05em;
}

.bear-role {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Map SVG */
.wbb-map-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Scene GIFs */
.scene-gif {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 1rem;
  border: 1px solid var(--rule);
}

/* Side-by-side comparison */
.scene-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
  align-items: center;
}

.scene-compare figure {
  margin: 0;
}

.scene-compare img,
.scene-compare video {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
}

.scene-compare figcaption {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

/* Scene reference */

/* ============================================================
   SKILLS
   ============================================================ */
#skills {
  background: var(--bg-warm);
}

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

.skill-group-label {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text);
  font-weight: 700;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}

.skill-group ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skill-group li {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-mid);
  line-height: 1.6;
  position: relative;
  padding-left: 1rem;
  transition: color 0.2s;
}

.skill-group li:hover {
  color: var(--text);
}

.credentials {
  border-top: 1px solid var(--rule);
  padding-top: 2.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.cred-label {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 1rem;
}

.cred-items {
  display: flex;
  flex-direction: column;
}

.cred-item {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-mid);
}

.cred-year {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  min-width: 3rem;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* ============================================================
   CONTACT
   ============================================================ */
#contact {
  background: var(--bg);
}

.contact-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.contact-headline {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: 900;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.contact-headline em {
  font-style: normal;
  font-weight: 300;
  color: var(--accent);
}

.contact-list {
  width: 100%;
  max-width: 420px;
  margin-bottom: 2.5rem;
}

.contact-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
}

.contact-item:last-child {
  border-bottom: 1px solid var(--rule);
}

.contact-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.contact-value {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  transition: color 0.2s;
}

.contact-value:hover {
  color: var(--accent);
}

/* ============================================================
   FOOTER
   ============================================================ */
#footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem var(--page-pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--text-dim);
}

/* ============================================================
   ATTACK PHASE LAYOUT
   ============================================================ */
.attack-phase-row {
  border-left: 2px solid var(--rule-heavy);
  padding-left: 1rem;
}

.attack-phase-label {
  font-family: var(--font-label);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.attack-phase-label--enrage {
  color: #c0392b;
}

.attack-phase-grid {
  display: grid;
  gap: 1rem;
}

.attack-phase-grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

.attack-phase-grid--summon {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: start;
  gap: 1.25rem;
  max-width: 600px;
}

.summon-desc {
  padding-top: 0.25rem;
}

.attack-caption {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  line-height: 1.5;
}

/* GIF / work image hover */
.attack-phase-grid figure img,
.work-img {
  transition: filter 0.2s ease, transform 0.2s ease;
}

.attack-phase-grid figure:hover img,
.work-img:hover {
  filter: brightness(1.08);
  transform: scale(1.02);
}

/* Dark blueprint screenshot polish */
img[src*="/unbound/Boss_"],
img[src*="/unbound/PC_BP"] {
  border: 1px solid var(--rule-heavy);
}

@media (max-width: 700px) {
  .attack-phase-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .attack-phase-grid--summon {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
}

/* ============================================================
   WORKS PAGE
   ============================================================ */
.work-section {
  border-bottom: 1px solid var(--rule);
}

.work-section > .section-inner:first-child {
  padding-bottom: 0;
}

/* ============================================================
   CHAPTER STICKY TITLE
   ============================================================ */
.chapter-sticky {
  position: sticky;
  top: 3.7rem; /* below fixed nav */
  z-index: 50;
  background: var(--bg-warm);
  border-top: 4px solid var(--accent);
  border-bottom: 1px solid var(--rule-heavy);
}

.chapter-sticky .section-inner {
  padding-top: 0.9rem;
  padding-bottom: 0;
}

.chapter-sticky .chapter-header {
  margin-bottom: 0;
  padding-bottom: 0.9rem;
  border-bottom: none;
}

/* Project title has to outrank the sub-titles inside it. */
.chapter-sticky .chapter-label {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 900;
  line-height: 1.2;
}

.chapter-sticky .chapter-num {
  color: var(--accent);
  font-weight: 500;
}

/* Per-project palette. Each section re-scopes the tokens, so accents,
   alt-block backgrounds and the sticky band all follow the project.
   Colours sampled from each project's thumbnail. */
#wbb {
  --bg-warm:  #E3ECEF;
  --bg-inset: #D3E0E5;
}

#unreal {
  --accent:    #8A2E2A;
  --accent-lt: #B24A40;
  --bg-warm:   #F1E6E3;
  --bg-inset:  #E6D6D2;
}

#farmquest {
  --accent:    #3E6B34;
  --accent-lt: #5C8C4E;
  --bg-warm:   #E6EDE1;
  --bg-inset:  #D6E2CF;
}

/* Space between projects so one ends before the next begins. */
.work-section + .work-section {
  margin-top: clamp(4rem, 9vw, 8rem);
}

.chapter-sticky .back-link {
  display: block;
  margin-bottom: 0.35rem;
}

.back-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 2rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent-lt);
}

.work-block {
  border-top: 1px solid var(--rule);
}

.work-block--alt {
  background: var(--bg-warm);
}

.work-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

/* Grid items default to min-width:auto, so a wide table stretches the
   column instead of letting .data-table scroll inside it. */
.work-col-text,
.work-col-media {
  min-width: 0;
}

.work-col-text {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.work-col-media {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: static;
}

.video-chapter-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  background: var(--bg-inset);
  border: 1px solid var(--rule);
  border-radius: 99px;
  padding: 0.2rem 0.65rem;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  color: inherit;
}

.video-chapter-item:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.video-chapter-item:hover .chapter-name {
  color: var(--accent);
}

.chapter-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.chapter-name {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-mid);
  transition: color 0.15s;
}

.video-embed-work {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
}

.video-embed-work iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.work-sub-header {
  margin-bottom: 0;
}

.work-sub-label {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  display: block;
  margin-bottom: 0.3rem;
}

.work-sub-label + p,
.work-sub-label + .proj-body,
.work-sub-header + p,
.work-sub-header + .proj-body {
  margin-top: 0;
}

.work-sub-title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

/* Code block */
.code-block {
  background: #1e1e2e;
  border: 1px solid var(--rule);
  overflow-x: auto;
}

.code-block pre {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.7;
  color: #cdd6f4;
  padding: 1.5rem;
  margin: 0;
  white-space: pre;
}

/* Data table */
.data-table {
  overflow-x: auto;
}

.data-table table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.85rem;
}

.data-table th,
.data-table td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--rule);
  text-align: left;
  color: var(--text-mid);
}

.data-table th {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 500;
}

/* Tool grid */

/* Character grid */

.character-info .meta-label {
  display: inline;
  margin-right: 0.4rem;
  font-size: 0.6rem;
}

/* Quest flow */

/* Phase flow */

/* Image placeholder */

/* ============================================================
   SCROLL REVEAL ANIMATIONS
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s cubic-bezier(0.2, 0.6, 0.2, 1),
              transform 0.5s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .hero-anim {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .reveal,
  .reveal-gsap {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .scanline {
    animation: none;
    display: none;
  }

  .scroll-line {
    animation: none;
    transform: scaleX(1);
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .project-content {
    padding: 4rem clamp(1.5rem, 4%, 3rem);
  }
}

@media (max-width: 900px) {
  .project-cards {
    grid-template-columns: 1fr;
    row-gap: 3rem;
  }

  .project-card--feature {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .project-card--feature .card-title {
    font-size: 1.45rem;
  }

  .project-card--feature .card-desc {
    font-size: 0.9rem;
  }

  .project-chapter {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .project-chapter--reverse .project-visual {
    order: 0;
    border-left: none;
    border-top: 1px solid var(--rule);
  }

  .project-visual {
    position: relative;
    height: 56.25vw;
    min-height: 300px;
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }

  .project-chapter--reverse .project-content {
    order: -1;
  }
}

@media (max-width: 768px) {
  .work-two-col {
    grid-template-columns: 1fr;
  }

  .work-col-media {
    position: relative;
    top: 0;
  }

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

  .quest-flow {
    grid-template-columns: 1fr;
  }

  .phase-flow {
    flex-direction: column;
  }

  .phase-flow > .flow-arrow {
    transform: rotate(90deg);
    justify-content: center;
  }

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

  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-photo-wrap {
    width: 150px;
    height: auto;
    order: -1;
  }

  .nav-links {
    display: none;
  }

  #dot-nav {
    display: none;
  }

  .role-card {
    padding: 1.75rem 1.5rem;
  }

  .role-card-head {
    flex-wrap: wrap;
  }

  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }

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

  .proj-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: clamp(2.5rem, 12vw, 4.25rem);
  }

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

  .hero-cta {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .contact-item {
    flex-direction: column;
    gap: 0.3rem;
  }

  .visual-btn--download {
    width: 100%;
    justify-content: center;
  }

  #footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .worldmap-svg {
    max-height: 200px;
  }
}
