/* ==========================================================================
   손지원 · Frontend Developer — Resume
   Apple-inspired · Notion-style Key Contribution cards · white bg fixed
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Color — locked to light */
  --bg: #ffffff;
  --bg-canvas: #eceef3;
  --bg-elev: #f5f5f7;
  --bg-card: #f7f7f9;
  --bg-chip: #f0f0f3;
  --primary: #1d1d1f;
  --secondary: #4b4b50;
  --tertiary: #8e8e93;
  --divider: #e5e5ea;
  --divider-strong: #1d1d1f;
  --accent: #0071e3;
  --success: #12814a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);

  /* Typography */
  --font-sans: "Inter", "Pretendard", -apple-system, BlinkMacSystemFont,
    "SF Pro Text", "Helvetica Neue", "Apple SD Gothic Neo", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;

  --fs-display: 38px;
  --fs-h2: 20px;
  --fs-h3: 17px;
  --fs-h4: 13px;
  --fs-body: 14px;
  --fs-small: 12px;
  --fs-label: 11px;
  --lh-tight: 1.25;
  --lh-body: 1.65;

  /* Layout */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --content-max: 820px;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  background: var(--bg-canvas);
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--primary);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}
h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
ol,
dl,
dd {
  margin: 0;
  padding: 0;
}
ul,
ol {
  list-style: none;
}
a {
  color: inherit;
  text-decoration: none;
}

/* ---------- Toolbar ---------- */
.toolbar {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 10;
}
.tb-btn {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--divider);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: -0.01em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 160ms ease, transform 160ms ease,
    border-color 160ms ease;
  box-shadow: var(--shadow);
}
.tb-btn:hover {
  background: var(--bg-elev);
  border-color: #d2d2d7;
}
.tb-btn:active {
  transform: scale(0.96);
}
.tb-icon {
  font-size: 14px;
  line-height: 1;
}
.tb-text {
  letter-spacing: 0.02em;
}

/* ---------- Page shell ---------- */
.page {
  max-width: 210mm; /* A4 portrait width */
  margin: 32px auto;
  padding: 72px 48px 96px;
  background: var(--bg);
  border-radius: 12px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.06),
    0 16px 40px rgba(0, 0, 0, 0.10);
}

/* ---------- Hero / Header ---------- */
.hero {
  margin-bottom: 40px;
}
.hero__name-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.hero__name {
  font-size: var(--fs-display);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: var(--lh-tight);
}
.hero__name-en {
  font-size: 18px;
  font-weight: 400;
  color: var(--secondary);
  letter-spacing: -0.015em;
}
.hero__role {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--secondary);
}
.hero__meta {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px 28px;
}
.hero__meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.meta-label {
  font-size: var(--fs-label);
  font-weight: 500;
  color: var(--tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.meta-value {
  font-size: 13px;
  color: var(--primary);
}
.meta-link {
  color: var(--accent);
  transition: opacity 160ms ease;
}
.meta-link:hover {
  opacity: 0.72;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.hero__rule {
  margin-top: 32px;
  border: 0;
  border-top: 1px solid var(--divider-strong);
}

/* ---------- Section ---------- */
.section {
  margin-top: 48px;
}
.section__title {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tertiary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 20px;
}
.section__lead {
  font-size: 15px;
  color: var(--primary);
  line-height: 1.75;
}

/* ---------- Experience (timeline) ---------- */
.exp {
  padding: 16px 0;
  border-top: 1px dashed var(--divider);
}
.exp:first-of-type {
  padding-top: 4px;
  border-top: 0;
}
.exp__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.exp__name {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.exp__meta {
  font-size: var(--fs-small);
  color: var(--tertiary);
}
.exp__desc {
  margin-top: 6px;
  font-size: 13px;
  color: var(--secondary);
  line-height: 1.7;
}

/* ---------- Project (detailed with Key Contributions) ---------- */
.project {
  padding-top: 32px;
  margin-top: 32px;
  border-top: 1px solid var(--divider);
}
.project:first-of-type {
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}
.project__head-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.project__name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.project__period {
  font-size: var(--fs-small);
  color: var(--tertiary);
  font-feature-settings: "tnum";
}
.project__sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--secondary);
}
.stack-chips {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  background: var(--bg-chip);
  color: var(--secondary);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border-radius: 999px;
}

/* ---------- Key Contribution (Notion-style card) ---------- */
.contrib-heading {
  margin-top: 24px;
  margin-bottom: 14px;
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--tertiary);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.contrib {
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--divider);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  position: relative;
}
.contrib:last-of-type {
  margin-bottom: 0;
}

/* Highlight variant — for the most important contributions (subtle marker) */
.contrib--highlight {
  border-color: rgba(0, 113, 227, 0.35);
}
.contrib__highlight-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  padding: 2px 9px;
  background: transparent;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  border: 1px solid rgba(0, 113, 227, 0.4);
  border-radius: 999px;
  line-height: 1.4;
}

.contrib__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
  line-height: 1.45;
}
.contrib__block + .contrib__block {
  margin-top: 12px;
}
.contrib__label {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tertiary);
  margin-bottom: 4px;
}
.contrib__text {
  font-size: 13px;
  color: var(--primary);
  line-height: 1.7;
}
.contrib__list {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--primary);
  line-height: 1.65;
}
.contrib__list li {
  position: relative;
  padding-left: 14px;
}
.contrib__list li::before {
  content: "›";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--tertiary);
  font-weight: 400;
}
.contrib__list li + li {
  margin-top: 3px;
}
.contrib__list--outcome li::before {
  content: "✓";
  color: var(--success);
  font-weight: 600;
}
.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-chip);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--secondary);
}
.dim {
  color: var(--tertiary);
  font-size: 0.92em;
}

/* ---------- Collapsible "더보기" for Key Contributions ---------- */
/* Default (collapsed): hide the 3rd and beyond contribution cards */
.project[data-collapsible="true"] .contrib:nth-of-type(n + 4) {
  display: none;
}
.project[data-collapsible="true"].is-expanded .contrib:nth-of-type(n + 4) {
  display: block;
}

/* 더보기 / 접기 버튼 */
.contrib-more {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 14px auto 0;
  padding: 10px 18px;
  background: #ffffff;
  border: 1px solid var(--divider);
  border-radius: 999px;
  font: 500 12.5px / 1 var(--font-sans);
  letter-spacing: -0.01em;
  color: var(--secondary);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.contrib-more:hover {
  background: var(--bg-elev);
  border-color: #d2d2d7;
  color: var(--primary);
}
.contrib-more:active {
  transform: scale(0.98);
}
.contrib-more__count {
  color: var(--tertiary);
  font-weight: 400;
}
.contrib-more__chev {
  display: inline-block;
  font-size: 11px;
  color: var(--tertiary);
  transition: transform 220ms ease;
  line-height: 1;
}
.project.is-expanded .contrib-more__chev {
  transform: rotate(180deg);
}
.project.is-expanded .contrib-more__count {
  display: none;
}

/* ---------- Skills ---------- */
.skills {
  display: grid;
  gap: 0;
}
.skills__row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
}
.skills__row:last-child {
  border-bottom: 0;
}
.skills__key {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tertiary);
  align-self: center;
}
.skills__val {
  font-size: 13.5px;
  color: var(--primary);
  line-height: 1.6;
}

/* ---------- Education ---------- */
.edu__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.edu__school {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.edu__date {
  font-size: var(--fs-small);
  color: var(--tertiary);
  font-feature-settings: "tnum";
}
.edu__major {
  margin-top: 4px;
  font-size: 13px;
  color: var(--secondary);
}

/* ---------- Footer ---------- */
.foot {
  margin-top: 72px;
  padding-top: 20px;
  border-top: 1px solid var(--divider);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-small);
  color: var(--tertiary);
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .page {
    margin: 0 auto;
    padding: 56px 20px 72px;
    border-radius: 0;
    box-shadow: none;
  }
  .hero__name {
    font-size: 30px;
  }
  .hero__name-en {
    font-size: 15px;
  }
  .project__name {
    font-size: 19px;
  }
  .toolbar {
    top: 12px;
    right: 12px;
  }
  .skills__row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .contrib {
    padding: 14px 16px;
  }
}

/* ---------- Print (A4) ---------- */
@media print {
  @page {
    size: A4;
    margin: 14mm 14mm;
  }
  html,
  body {
    background: #ffffff !important;
    color: #1d1d1f !important;
  }
  .toolbar,
  .foot {
    display: none !important;
  }
  .page {
    padding: 0;
    max-width: none;
    margin: 0;
    background: #ffffff !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  .section,
  .contrib,
  .project,
  .exp {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .contrib {
    background: #f7f7f9 !important;
    border: 1px solid #e5e5ea !important;
    display: block !important;
  }
  /* Highlight도 인쇄에서 부드러운 액센트 유지 */
  .contrib--highlight {
    border-color: rgba(0, 113, 227, 0.45) !important;
  }
  .contrib__highlight-badge {
    background: transparent !important;
    color: #0071e3 !important;
    border: 1px solid rgba(0, 113, 227, 0.5) !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  /* Print 시에는 모든 Key Contribution 노출 + 더보기 버튼 숨김 */
  .project[data-collapsible="true"] .contrib:nth-of-type(n + 4) {
    display: block !important;
  }
  .contrib-more {
    display: none !important;
  }
  a {
    color: inherit !important;
    text-decoration: none !important;
  }
  .meta-link {
    color: inherit !important;
  }
  .hero__rule {
    border-top-color: #1d1d1f !important;
  }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition: none !important;
  }
}
