/* ========================================
   Portfolio Styles — Mantine / refresh-black design system
   ======================================== */

/* --- Theme Variables --- */
:root {
  --color-bg:             #FAFAFA;
  --color-surface:        #FFFFFF;
  --color-text:           #323232;
  --color-text-heading:   #000000;
  --color-text-muted:     #696969;
  --color-text-faint:     #BDBDBD;
  --color-border:         #E9ECEF;
  --color-border-hover:   #CED4DA;
  --color-divider:        #E0E0E0;
  --color-tag-bg:         #F1F3F5;
  --color-tag-text:       #495057;
  --color-link:           #4F4F4F;
  --color-link-hover:     #000000;
  --color-shadow:         rgba(0, 0, 0, 0.08);
  --color-blockquote-bg:  #F8F9FA;
  --color-blockquote-border: #D0D0D0;
  --color-code-bg:        #F1F3F5;
  --color-pre-bg:         #F8F9FA;
  --color-pre-border:     #E9ECEF;
  --color-table-header:   #F2F2F2;
  --color-table-border:   #E0E0E0;
  --color-hero-bg:        #FFFFFF;
  --color-timeline-line:  #E0E0E0;
  --color-timeline-dot:   #BDBDBD;
  --color-timeline-dot-active: #2D8A56;
}

html {
  scroll-behavior: smooth;
}

/* --- Base / Typography --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem 1rem;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto,
    'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR',
    'Malgun Gothic', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
    sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Index page uses hero layout — no body padding */
body.index-page {
  padding: 0;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  color: var(--color-link-hover);
}

h1, h2, h3, h4 {
  color: var(--color-text-heading);
  line-height: 1.3;
}

/* --- Language Toggle --- */
.lang-en { display: none; }
html[lang="en"] .lang-en { display: inline; }
html[lang="en"] .lang-ko { display: none; }

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.25em;
}

.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.15em 0.35em;
  color: var(--color-text-faint);
  font-weight: 400;
  transition: color 0.2s, font-weight 0.2s;
}

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

.lang-btn-active {
  font-weight: 700;
  color: var(--color-text-heading);
}

.lang-sep {
  color: var(--color-text-faint);
  font-size: 0.875rem;
  user-select: none;
}


/* --- Toggle Bar --- */
.toggle-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 0 0.5rem;
  gap: 0.75rem;
}

/* ========================================
   Index Page — Hero + Timeline Layout
   ======================================== */

/* --- Hero Section --- */
.hero {
  background: var(--color-hero-bg);
  border-bottom: 1px solid var(--color-divider);
  padding: 2rem 1rem 0;
  transition: background-color 0.3s ease;
}

.hero .container {
  padding-bottom: 3rem;
}

.hero-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.hero-text {
  flex: 1;
}

.hero-name {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--color-text-heading);
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.hero-role {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin: 0.5rem 0 0;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.hero-bio {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 1rem 0 0;
  line-height: 1.7;
  max-width: 540px;
}

.hero-contact {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.hero-contact a {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  padding: 0.35em 0.75em;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  transition: all 0.2s ease;
}

.hero-contact a:hover {
  color: var(--color-text-heading);
  border-color: var(--color-border-hover);
  background: var(--color-tag-bg);
}

/* --- Stats Row --- */
.hero-stats {
  display: flex;
  gap: 2rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-divider);
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-heading);
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.2rem;
}

/* --- Main Content --- */
.main-content {
  padding: 2.5rem 1rem 2rem;
}

/* --- Timeline --- */
.timeline {
  position: relative;
  padding-left: 2rem;
}

/* Vertical line */
.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0.5rem;
  bottom: 0;
  width: 2px;
  background: var(--color-timeline-line);
}

/* --- Timeline Divider --- */
.timeline-divider {
  position: relative;
  margin: 2rem 0 2rem;
  text-align: center;
}

.timeline-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--color-divider);
}

.timeline-divider-label {
  position: relative;
  display: inline-block;
  padding: 0.25rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-bg);
  letter-spacing: 0.03em;
}

/* --- Timeline Year --- */
.timeline-year {
  position: relative;
  margin: 0 0 1.25rem;
  padding: 0;
}

.timeline-year-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-faint);
  letter-spacing: 0.05em;
  position: relative;
  display: inline-block;
}

/* Year dot */
.timeline-year::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 2px solid var(--color-timeline-dot);
  z-index: 1;
}

.timeline-year:first-child::before {
  border-color: var(--color-timeline-dot-active);
  background: var(--color-timeline-dot-active);
}

/* --- Timeline Item --- */
.timeline-item {
  position: relative;
  margin-bottom: 1rem;
}

/* Small dot for items */
.timeline-item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 1.35rem;
  transform: translateX(2px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-timeline-dot);
  z-index: 1;
}

/* --- Card Entrance Animation --- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Project Card (Timeline) --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  cursor: pointer;
  transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease,
              background-color 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

.timeline-item:nth-child(1) .card  { animation-delay: 0.05s; }
.timeline-item:nth-child(2) .card  { animation-delay: 0.08s; }
.timeline-item:nth-child(3) .card  { animation-delay: 0.11s; }
.timeline-item:nth-child(4) .card  { animation-delay: 0.14s; }
.timeline-item:nth-child(5) .card  { animation-delay: 0.17s; }
.timeline-item:nth-child(6) .card  { animation-delay: 0.20s; }
.timeline-item:nth-child(7) .card  { animation-delay: 0.23s; }
.timeline-item:nth-child(8) .card  { animation-delay: 0.26s; }
.timeline-item:nth-child(9) .card  { animation-delay: 0.29s; }
.timeline-item:nth-child(10) .card { animation-delay: 0.32s; }

/* Card left accent bar */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  border-radius: 12px 0 0 12px;
  background: transparent;
  transition: background 0.3s ease;
}

.card:hover::before {
  background: var(--color-text-faint);
}

.card:has(.tag-alocados):hover::before { background: #2D8A56; }
.card:has(.tag-swm):hover::before      { background: #3B6FB8; }
.card:has(.tag-sejong):hover::before    { background: #C45A4A; }

.card:hover {
  box-shadow: 0 8px 24px var(--color-shadow);
  transform: translateX(4px);
  border-color: var(--color-border-hover);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-heading);
  margin: 0;
  line-height: 1.35;
}

.card-arrow {
  color: var(--color-text-faint);
  transition: color 0.2s, transform 0.2s;
  flex-shrink: 0;
  margin-top: 2px;
}

.card:hover .card-arrow {
  color: var(--color-text-heading);
  transform: translate(2px, -2px);
}

.card-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.5;
}

.card-techs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.tech {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15em 0.5em;
  border-radius: 4px;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  white-space: nowrap;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.card-date {
  font-size: 0.78rem;
  color: var(--color-text-faint);
}

/* --- Tag Badges --- */
.tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2em 0.6em;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
  line-height: 1.5;
}

.tag-alocados   { background: #2D8A56; }
.tag-swm        { background: #3B6FB8; }
.tag-sejong     { background: #C45A4A; }

/* --- Divider --- */
.divider {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: 0;
}

/* --- Section Label (kept for compatibility) --- */
.section-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  margin: 2.5rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-divider);
}

.section-label:first-of-type {
  margin-top: 0;
}

/* --- Project List (no timeline) --- */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.project-list .card {
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

.project-list .card:nth-child(1) { animation-delay: 0.05s; }
.project-list .card:nth-child(2) { animation-delay: 0.08s; }
.project-list .card:nth-child(3) { animation-delay: 0.11s; }
.project-list .card:nth-child(4) { animation-delay: 0.14s; }
.project-list .card:nth-child(5) { animation-delay: 0.17s; }

/* --- Awards & Activities --- */
.awards-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.award-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.25s ease, border-color 0.25s ease, background-color 0.3s ease;
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

.award-item:nth-child(1) { animation-delay: 0.05s; }
.award-item:nth-child(2) { animation-delay: 0.08s; }
.award-item:nth-child(3) { animation-delay: 0.11s; }

.award-item:hover {
  box-shadow: 0 4px 16px var(--color-shadow);
  border-color: var(--color-border-hover);
}

.award-context {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 110px;
  flex-shrink: 0;
}

.award-date {
  font-size: 0.72rem;
  color: var(--color-text-faint);
}

.award-body {
  flex: 1;
  min-width: 0;
}

.award-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-heading);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.award-name .card-arrow {
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}

.award-item:hover .award-name .card-arrow {
  opacity: 1;
  color: var(--color-text-heading);
  transform: translate(2px, -2px);
}

.award-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0.15rem 0 0;
}

/* --- Footer --- */
.portfolio-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-divider);
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-faint);
}

.portfolio-footer p {
  margin: 0;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .hero-name {
    font-size: 2rem;
  }

  .hero-stats {
    gap: 1.25rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .timeline {
    padding-left: 1.5rem;
  }

  .timeline::before {
    left: 3px;
  }

  .timeline-year::before {
    left: -1.5rem;
    width: 10px;
    height: 10px;
  }

  .timeline-item::before {
    left: -1.5rem;
    width: 6px;
    height: 6px;
    transform: translateX(2px);
  }
}

/* ========================================
   Project Detail Pages
   ======================================== */

/* --- Navigation --- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.back-link:hover {
  color: var(--color-text-heading);
}

/* --- Article --- */
.article {
  max-width: 900px;
  margin: 0 auto;
}

.article h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.article h2 {
  font-size: 1.2rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  scroll-margin-top: 1rem;
}

/* --- Table of Contents --- */
.toc {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--color-blockquote-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.toc-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-heading);
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.toc-list {
  margin: 0;
  padding-left: 1.25rem;
}

.toc-list li {
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.toc-list li:last-child {
  margin-bottom: 0;
}

.toc-list a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.toc-list a:hover {
  color: var(--color-text-heading);
}

.toc-sublist {
  list-style: none;
  margin: 0.25rem 0 0.25rem 1rem;
  padding: 0;
}

.toc-sublist li {
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.toc-sublist li::before {
  content: "–";
  color: var(--color-text-faint);
  margin-right: 0.4em;
}

.article h3 {
  font-size: 1.05rem;
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
  scroll-margin-top: 1rem;
}

.article p {
  margin: 0.6rem 0;
}

.article ul, .article ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.article li {
  margin-bottom: 0.3rem;
}

/* --- Blockquote --- */
.article blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--color-blockquote-border);
  background: var(--color-blockquote-bg);
  color: var(--color-text-muted);
  border-radius: 0 6px 6px 0;
}

.article blockquote p {
  margin: 0;
}

/* --- Tables --- */
.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.article th,
.article td {
  border: 1px solid var(--color-table-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.article th {
  background: var(--color-table-header);
  font-weight: 600;
  color: var(--color-text-heading);
}

/* --- Code / ASCII Diagrams --- */
.article pre {
  background: var(--color-pre-bg);
  border: 1px solid var(--color-pre-border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
}

.article code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;
  font-size: 0.85em;
}

.article :not(pre) > code {
  background: var(--color-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

/* --- Images --- */
.article img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem auto;
  border-radius: 8px;
  cursor: zoom-in;
  transition: opacity 0.2s;
}

.article img:hover {
  opacity: 0.85;
}

/* --- Lightbox --- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-overlay img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  cursor: zoom-out;
  transform: scale(0.95);
  transition: transform 0.25s;
}

.lightbox-overlay.active img {
  transform: scale(1);
}

.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  z-index: 10000;
  opacity: 0.7;
  transition: opacity 0.2s;
  line-height: 1;
}

.lightbox-close:hover {
  opacity: 1;
}

/* ========================================
   Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
  body {
    background: #fff;
    color: #323232;
  }

  .lang-toggle,
  .toggle-bar,
  .back-link,
  .toc {
    display: none !important;
  }

  .card {
    break-inside: avoid;
    box-shadow: none !important;
    transform: none !important;
    opacity: 1 !important;
    animation: none !important;
  }

  .hero {
    border-bottom: 1px solid #E0E0E0;
  }

  .timeline::before {
    background: #E0E0E0;
  }
}
