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

/* ================================================================
   CRT/VHS Glitch Transition (index.html → portfolio.html)
================================================================ */
#vhs-noise {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 80ms linear;
  mix-blend-mode: screen;
}

#scanlines {
  position: fixed;
  inset: 0;
  z-index: 9001;
  pointer-events: none;
  opacity: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.05) 0px,
    rgba(255, 255, 255, 0.05) 1px,
    transparent 1px,
    transparent 3px
  );
  transition: opacity 80ms linear;
}

#glitch-flash {
  position: fixed;
  inset: 0;
  z-index: 9002;
  pointer-events: none;
  background: #fff;
  opacity: 0;
  transition: opacity 80ms ease-in;
}

@keyframes glitch-shake {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3px, 2px); }
  40%  { transform: translate(3px, -2px); }
  60%  { transform: translate(-2px, -2px); }
  80%  { transform: translate(2px, 2px); }
  100% { transform: translate(0, 0); }
}

@keyframes glitch-slice-1 {
  0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
  20%      { clip-path: inset(10% 0 70% 0); transform: translate(-6px, 0); }
  40%      { clip-path: inset(40% 0 30% 0); transform: translate(8px, 0); }
  60%      { clip-path: inset(70% 0 5% 0);  transform: translate(-4px, 0); }
  80%      { clip-path: inset(25% 0 55% 0); transform: translate(5px, 0); }
}

@keyframes glitch-slice-2 {
  0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0, 0); filter: hue-rotate(0deg); }
  25%      { clip-path: inset(60% 0 10% 0); transform: translate(7px, 1px); filter: hue-rotate(90deg); }
  50%      { clip-path: inset(15% 0 60% 0); transform: translate(-6px, -1px); filter: hue-rotate(180deg); }
  75%      { clip-path: inset(45% 0 30% 0); transform: translate(4px, 0); filter: hue-rotate(270deg); }
}

body.glitching {
  animation: glitch-shake 0.08s steps(2, end) infinite;
  overflow: hidden;
}

body.glitching .resume-container {
  position: relative;
  filter: contrast(1.1) saturate(1.15);
}

body.glitching .resume-container::before,
body.glitching .resume-container::after {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  pointer-events: none;
  mix-blend-mode: screen;
}

body.glitching .resume-container::before {
  background: linear-gradient(transparent, rgba(255, 0, 80, 0.18));
  animation: glitch-slice-1 0.12s infinite;
}

body.glitching .resume-container::after {
  background: linear-gradient(transparent, rgba(0, 200, 255, 0.18));
  animation: glitch-slice-2 0.16s infinite;
}

@media (prefers-reduced-motion: reduce) {
  body.glitching {
    animation: none;
  }
  body.glitching .resume-container::before,
  body.glitching .resume-container::after {
    animation: none;
  }
}

body {
  font-family: 'Malgun Gothic', '맑은 고딕', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

.resume-container {
  max-width: 900px;
  margin: 20px auto;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* Header - Title */
.resume-header {
  padding: 24px 30px;
  border-bottom: 1px solid #e0e0e0;
}

.resume-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #222;
  line-height: 1.4;
}

/* Profile Section */
.profile-section {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 24px 30px;
  border-bottom: 1px solid #e0e0e0;
}

.profile-photo {
  width: 100px;
  height: 120px;
  border-radius: 4px;
  object-fit: cover;
  background-color: #e0e0e0;
  flex-shrink: 0;
}

.profile-photo-placeholder {
  width: 100px;
  height: 120px;
  border-radius: 4px;
  background-color: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #999;
  font-size: 12px;
}

.profile-info {
  flex: 1;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.profile-name .gender-age {
  font-size: 14px;
  font-weight: 400;
  color: #666;
  margin-left: 8px;
}

.profile-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 13px;
}

.profile-details dt {
  color: #666;
  white-space: nowrap;
}

.profile-details dd {
  color: #333;
}

.profile-details dd a {
  color: #2563eb;
  text-decoration: none;
}

.profile-details dd a:hover {
  text-decoration: underline;
}

.profile-details .github-line {
  grid-column: 2 / 3;
  margin-top: 4px;
  font-size: 12px;
  color: #666;
  line-height: 1.6;
}

.profile-details .github-line strong {
  color: #2563eb;
  font-weight: 600;
}

/* Summary Table */
.summary-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid #e0e0e0;
}

.summary-item {
  text-align: center;
  padding: 16px 12px;
  border-right: 1px solid #e0e0e0;
}

.summary-item:last-child {
  border-right: none;
}

.summary-label {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}

.summary-value {
  font-size: 14px;
  font-weight: 700;
  color: #333;
}

.summary-sub {
  font-size: 12px;
  color: #e74c3c;
  margin-top: 2px;
}

.summary-status {
  font-size: 12px;
  color: #e74c3c;
}

/* Skills Section */
.skills-section {
  padding: 20px 30px;
  border-bottom: 1px solid #e0e0e0;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.skill-tag {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid #ccc;
  border-radius: 2px;
  font-size: 13px;
  color: #333;
  background: #fff;
}

/* Personal Projects / Open Source */
.projects-section {
  padding: 0 30px 20px;
  border-bottom: 1px solid #e0e0e0;
}

.projects-subtitle {
  font-size: 12px;
  color: #666;
  margin: 8px 0 16px;
}

.project-item {
  border-left: 3px solid #2563eb;
  background: #f5f8ff;
  padding: 12px 16px;
  margin-bottom: 14px;
  border-radius: 2px;
  break-inside: avoid;
}

.project-item:last-child {
  margin-bottom: 0;
}

.project-item-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}

.project-name {
  font-size: 15px;
  font-weight: 700;
  color: #1e3a8a;
}

.project-role {
  font-size: 12px;
  color: #2563eb;
  font-weight: 600;
}

.project-period {
  font-size: 12px;
  color: #666;
  margin-left: auto;
}

.project-link {
  font-size: 12px;
  margin-bottom: 8px;
  word-break: break-all;
}

.project-link a {
  color: #2563eb;
  text-decoration: none;
}

.project-link a:hover {
  text-decoration: underline;
}

.project-summary {
  font-size: 13px;
  color: #333;
  margin-bottom: 8px;
  line-height: 1.6;
}

.project-bullets {
  list-style: disc;
  padding-left: 18px;
  margin: 0 0 8px;
}

.project-bullets li {
  font-size: 12.5px;
  color: #444;
  line-height: 1.6;
  margin-bottom: 2px;
}

.project-item .project-tech {
  font-size: 12px;
  color: #555;
  margin-top: 4px;
}

/* Section Title */
.section-title {
  font-size: 18px;
  font-weight: 700;
  padding: 20px 30px 0;
  color: #222;
}

.section-title .total-experience {
  font-size: 13px;
  font-weight: 400;
  color: #e74c3c;
  margin-left: 12px;
}

/* Education Section */
.education-section {
  padding: 0 30px 20px;
  border-bottom: 1px solid #e0e0e0;
}

.education-item {
  display: flex;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid #f0f0f0;
}

.education-item:last-child {
  border-bottom: none;
}

.education-period {
  width: 160px;
  flex-shrink: 0;
  font-size: 13px;
  color: #666;
  line-height: 1.8;
}

.education-period .status {
  display: block;
  color: #e74c3c;
  font-size: 12px;
}

.education-detail {
  flex: 1;
}

.education-detail .school {
  font-size: 15px;
  font-weight: 700;
  color: #222;
}

.education-detail .major {
  font-size: 13px;
  color: #666;
  margin-left: 8px;
}

/* Career Section */
.career-section {
  padding: 0 30px 20px;
  border-bottom: 1px solid #e0e0e0;
}

.career-item {
  display: flex;
  align-items: flex-start;
  padding: 20px 0;
  border-bottom: 1px solid #f0f0f0;
}

.career-item:last-child {
  border-bottom: none;
}

.career-period {
  width: 160px;
  flex-shrink: 0;
  font-size: 13px;
  color: #666;
  line-height: 1.8;
}

.career-period .duration {
  display: block;
  color: #e74c3c;
  font-size: 12px;
}

.career-detail {
  flex: 1;
}

.career-company {
  font-size: 16px;
  font-weight: 700;
  color: #222;
  margin-bottom: 4px;
}

.career-company .department {
  font-size: 13px;
  font-weight: 400;
  color: #666;
  margin-left: 8px;
}

.career-projects {
  margin-top: 12px;
}

.career-project {
  margin-bottom: 14px;
}

.career-project:last-child {
  margin-bottom: 0;
}

.career-project.is-highlight {
  border-left: 3px solid #2563eb;
  background: #f5f8ff;
  padding: 10px 12px 10px 14px;
  margin-left: -6px;
  margin-bottom: 16px;
  border-radius: 2px;
}

.career-project.is-highlight .project-title {
  font-weight: 700;
  color: #1e3a8a;
}

.career-project .project-url {
  font-size: 12px;
  color: #2563eb;
  margin-top: 2px;
  word-break: break-all;
}

.career-project .project-url a {
  color: #2563eb;
  text-decoration: none;
}

.career-project .project-url a:hover {
  text-decoration: underline;
}

.project-title {
  font-size: 13px;
  color: #333;
  margin-bottom: 4px;
}

.project-description {
  font-size: 13px;
  color: #555;
  padding-left: 0;
  margin-top: 2px;
}

.project-tech {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.career-meta {
  margin-top: 16px;
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: #666;
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
}

.career-meta dt {
  display: inline;
}

.career-meta dd {
  display: inline;
  margin-left: 8px;
  color: #333;
}

/* About Section */
.about-section {
  padding: 0 30px 20px;
  border-bottom: 1px solid #e0e0e0;
}

.about-box {
  border: 1px solid #e0e0e0;
  padding: 24px;
  margin-top: 16px;
}

.about-heading {
  font-size: 15px;
  font-weight: 700;
  color: #222;
  margin-top: 20px;
  margin-bottom: 8px;
}

.about-heading:first-child {
  margin-top: 0;
}

.about-content {
  font-size: 13px;
  color: #444;
  line-height: 1.8;
  white-space: pre-line;
}

/* Table Sections (Military, Preferences) */
.table-section {
  padding: 0 30px 20px;
  border-bottom: 1px solid #e0e0e0;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 13px;
}

.info-table th,
.info-table td {
  border: 1px solid #e0e0e0;
  padding: 10px 14px;
  text-align: left;
}

.info-table th {
  background-color: #fafafa;
  color: #666;
  font-weight: 400;
  white-space: nowrap;
  width: 120px;
}

.info-table td {
  color: #333;
}

/* Footer */
.resume-footer {
  padding: 30px;
  text-align: center;
}

.footer-confirm {
  font-size: 18px;
  font-weight: 700;
  color: #222;
  margin-bottom: 16px;
}

.footer-info {
  font-size: 12px;
  color: #999;
  line-height: 1.8;
}

.footer-author {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}

/* Responsive */
@media screen and (max-width: 768px) {
  .resume-container {
    margin: 0;
    box-shadow: none;
  }

  .profile-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-details {
    grid-template-columns: auto 1fr;
    text-align: left;
  }

  .summary-section {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-item:nth-child(2) {
    border-right: none;
  }

  .summary-item:nth-child(1),
  .summary-item:nth-child(2) {
    border-bottom: 1px solid #e0e0e0;
  }

  .career-item,
  .education-item {
    flex-direction: column;
  }

  .career-period,
  .education-period {
    width: 100%;
    margin-bottom: 8px;
  }

  .career-meta {
    flex-direction: column;
    gap: 4px;
  }
}

/* Shipped Games (참여 게임 작품) */
.shipped-games {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 18px 0 8px;
}

.shipped-game {
  display: flex;
  flex-direction: column;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  margin: 0;
  break-inside: avoid;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.shipped-game:hover {
  border-color: #2563eb;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
  transform: translateY(-2px);
}

.shipped-game img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
  background: #0a0a0a;
}

.shipped-game figcaption {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sg-title {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}

.sg-meta {
  font-size: 11.5px;
  color: #6b7280;
  line-height: 1.4;
}

@media (max-width: 720px) {
  .shipped-games { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .shipped-games { grid-template-columns: 1fr; }
}

/* Print */
@page {
  size: A4;
  margin: 12mm;
}

@media print {
  body {
    background: #fff;
    font-size: 12px;
  }

  #vhs-noise,
  #scanlines,
  #glitch-flash {
    display: none !important;
  }

  .resume-container {
    box-shadow: none;
    margin: 0;
    max-width: 100%;
  }

  .shipped-games {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    page-break-inside: avoid;
  }
  .shipped-game img {
    height: 62px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .shipped-game {
    box-shadow: none !important;
    transform: none !important;
  }
  .sg-title { font-size: 10.5px; }
  .sg-meta  { font-size: 9px; }

  .career-project.is-highlight {
    background: #f5f8ff !important;
    border-left: 3px solid #2563eb !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    break-inside: avoid;
  }

  .project-item {
    background: #f5f8ff !important;
    border-left: 3px solid #2563eb !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    break-inside: avoid;
  }

  .project-name {
    color: #1e3a8a !important;
  }

  .project-role {
    color: #2563eb !important;
  }

  .project-url a {
    color: #2563eb !important;
    text-decoration: underline !important;
  }

  .profile-details .github-line strong {
    color: #2563eb !important;
  }

  .section-title {
    break-after: avoid;
  }

  .career-item {
    break-inside: auto;
  }

  .career-company {
    break-after: avoid;
  }

  .career-project {
    break-inside: avoid;
  }

  .career-meta {
    break-before: avoid;
  }

  .education-item {
    break-inside: avoid;
  }

  .about-heading {
    break-after: avoid;
  }

  .about-content {
    break-inside: auto;
  }

  .resume-footer {
    break-inside: avoid;
  }
}