:root {
  color-scheme: light;
  --accent: #2F6BF5;
  --hero-surface: #2F6BF5;
  --link: #1D4ED8;
  --text: #222;
  --muted: #59636e;
  --line: #e3e7ed;
  --surface: #F4F6F9;
  --header: 4rem;
  font-family: "Pretendard", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: var(--text);
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header) + 1rem); }
body { margin: 0; padding-top: var(--header); background: #fff; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; text-wrap: balance; }
img { display: block; width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .22em; }
a:hover { color: var(--link); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }
::selection { background: #dbe6ff; color: var(--text); }
.wrap { width: min(1080px, calc(100% - 3rem)); margin-inline: auto; }

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 5;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.header-inner {
  height: var(--header);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.brand { font-size: 1.15rem; font-weight: 800; }
.site-header a { text-decoration: none; }
.menu-toggle { display: none; }
.site-header nav { display: flex; align-items: center; gap: clamp(.65rem, 3vw, 2rem); }
.site-header nav a { font-size: .9rem; font-weight: 650; }

.hero {
  background: var(--hero-surface);
  color: #fff;
  overflow: hidden;
  padding: clamp(2.25rem, 6vw, 5.5rem) 0 clamp(2.75rem, 6vw, 5rem);
}
.hero-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
}
.hero-label { margin-bottom: .5rem; color: rgba(255,255,255,.75); font-size: .9rem; }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.75rem); font-weight: 700; line-height: 1.3; }
.hero h1 span { color: inherit; }
.hero-slogan { margin-top: 1rem; font-weight: 700; }
.hero-intro { margin-top: .75rem; max-width: 610px; }
.hero .contacts { font-size: .9rem; }
.hero .contacts a { color: inherit; }
.hero .contacts a:hover { color: #dbe6ff; }
.portrait { width: 200px; border-radius: 16px; }

.section { padding-block: 96px; }
.section > .section-heading { margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.label { margin-bottom: .65rem; color: var(--link); font-size: .9rem; font-weight: 750; }
.section-heading h2 { font-size: 1.875rem; font-weight: 700; }
.strengths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
#skills > .section-heading { margin-bottom: 2rem; }
.strengths article {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 3;
  row-gap: .875rem;
  padding: 1.25rem;
  border-radius: 12px;
  background: var(--surface);
}
.cover-img, figure img { border-radius: 12px; background: var(--surface); }
.strengths h3 { font-size: 1.22rem; text-wrap: wrap; }
.strengths p, .timeline p, .project-body { color: var(--muted); }
.strength-result { font-size: .875rem; }
.strength-result strong {
  display: block;
  color: var(--link);
  font-size: 1.5rem;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.timeline, .projects, .education-list, .skills { max-width: 830px; }
.timeline, .education-list, .chips, .contacts { padding: 0; list-style: none; }
.timeline { margin-block: 0; }
.timeline > li {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: .5rem 1.5rem;
  border-top: 1px solid var(--line);
  padding: 1.35rem 0;
}
.timeline > li:last-child { border-bottom: 1px solid var(--line); }
.period { font-size: .95rem; font-variant-numeric: tabular-nums; }
.timeline h3 { font-size: 1.22rem; text-wrap: wrap; }
.timeline .role { margin: .25rem 0 .5rem; color: var(--link); font-weight: 700; }
summary { position: relative; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+" / "";
  position: absolute;
  right: 0;
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 700;
}
details[open] > summary::after { content: "−" / ""; }
.timeline summary::after { font-size: .9rem; }
.timeline summary { width: fit-content; margin-top: .55rem; padding: .18rem 1.4rem .18rem 0; color: var(--link); font-weight: 650; }
.timeline details p { margin-top: .35rem; }

.project > summary {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: .2rem .8rem;
  padding: 1.25rem 2.4rem 1.25rem 0;
  border-bottom: 1px solid var(--line);
}
.project > summary::after { top: 1.25rem; }
.project-name { font-size: 1.4rem; font-weight: 800; letter-spacing: -.03em; }
.project-period, figcaption { color: var(--muted); font-size: .9rem; }
.project-summary { grid-column: 1 / -1; }
.project-body { padding: 1.5rem 0 2.5rem; }
.project-body > * + * { margin-top: 1rem; }
.cover-img { aspect-ratio: 2 / 1; max-height: 220px; object-fit: cover; }
.cover-img.contain { max-height: 160px; object-fit: contain; }
.meta { font-size: .9rem; }
.project-body h3 { margin-top: 1.8rem; font-size: 1.25rem; color: var(--text); text-wrap: wrap; }
.project-body .lead { color: #383838; }
.project-body figure { max-width: 640px; }
.project-body figcaption { margin-top: .5rem; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.pair img { max-width: 320px; }
.pair figcaption { grid-column: 1 / -1; margin-top: 0; }
.project-body ul { padding-left: 1.25rem; }
.project-body li + li { margin-top: .5rem; }

.education-list { margin: 0 0 1.5rem; }
.education-list li { padding: .65rem 0; border-bottom: 1px solid var(--line); }
.chips, .contacts { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.chips li { padding: .22rem .65rem; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: .9rem; }

.chips li:hover { border-color: var(--accent); color: var(--link); }

footer { padding-block: 96px; background: var(--surface); }
.contact-cards { display: grid; grid-template-columns: 300px minmax(0, 1.5fr) minmax(0, 1fr); gap: 1rem; margin-top: 1.75rem; align-items: start; }
.contact-card { display: flex; min-width: 0; border-radius: 15px; text-decoration: none; }
.img-card img { width: 100%; align-self: start; border-radius: inherit; }
.github-card { background: none; }
.github-card img { height: auto; }
.mail-card { flex-direction: column; justify-content: space-between; gap: .35rem; height: 195px; padding: 22px 24px; background: #fff; border: 1px solid #e4e2e2; border-radius: 15px; color: var(--text); }
.mail-card .cc-label { font-size: .85rem; color: var(--muted); }
.mail-card strong { font-size: 1.15rem; }
.mail-card .cc-desc { font-size: .9rem; color: var(--muted); }
.mail-card .cc-go { margin-top: auto; font-size: .9rem; font-weight: 600; color: var(--link); }
.mail-card:hover { border-color: var(--accent); }
.contacts { gap: .55rem 1.5rem; margin-top: 1.4rem; }
.contacts a { color: var(--link); }

@media (max-width: 900px) {
  .strengths { grid-template-columns: 1fr; gap: 1rem; max-width: 640px; }
  .strengths article { grid-template-rows: auto; grid-row: auto; }
  .contact-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .hero-stage, .contact-cards { grid-template-columns: 1fr; }
  .section, footer { padding-block: 3.5rem; }
  .section > .section-heading { margin-bottom: 1.5rem; }
  .section-heading h2 { font-size: 1.625rem; }
  .hero-stage { gap: 1.5rem; }
  .portrait { grid-row: 1; width: 112px; }
  .timeline summary { display: flex; align-items: center; min-height: 44px; }
  .timeline > li, .pair { grid-template-columns: 1fr; }
}

@media screen and (max-width: 760px) {
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-inline: .85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
  }
  .site-header nav {
    position: absolute;
    inset: 100% 0 auto;
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .25rem .75rem;
    max-height: calc(100dvh - var(--header));
    overflow-y: auto;
    padding: .75rem 1rem;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 16px rgb(0 0 0 / .08);
  }
  .menu-toggle[aria-expanded="true"] + nav { display: grid; }
  .site-header nav a:not([hidden]) {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding-inline: .75rem;
    background: none;
  }
  .site-header nav a[aria-current] { background: var(--surface); border-radius: 8px; }
}

@media (max-width: 430px) {
  .wrap { width: calc(100% - 2rem); }
  .project > summary { grid-template-columns: 1fr; }
}

.site-header.scrolled { box-shadow: 0 2px 10px rgb(0 0 0 / .08); }

.site-header nav a, .contacts a, .cc-go {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
}
.site-header nav a[aria-current] { color: var(--link); }
.site-header nav a:is(:hover, :focus-visible, [aria-current]),
.contacts a:is(:hover, :focus-visible),
.mail-card:is(:hover, :focus-visible) .cc-go { background-size: 100% 1px; }
.hero .contacts a { text-decoration: underline; }
.hero .contacts a:is(:hover, :focus-visible) { text-decoration: none; }

.project > summary:is(:hover, :focus-visible) .project-name { color: var(--link); }

@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: reveal 550ms ease-out backwards; animation-delay: calc(var(--i, 0) * 75ms); }
  .hero-copy h1 { animation-name: hero-title-in; animation-duration: 850ms; animation-timing-function: cubic-bezier(.16, 1, .3, 1); }
  :is(.hero-copy > *, [data-reveal]):nth-child(2) { --i: 1; }
  :is(.hero-copy > *, [data-reveal]):nth-child(3) { --i: 2; }
  :is(.hero-copy > *, [data-reveal]):nth-child(4) { --i: 3; }
  .hero-copy > :nth-child(5) { --i: 4; }
  .portrait { animation: portrait-in 950ms cubic-bezier(.16, 1, .3, 1) both; }
  .revealed {
    --rise: 16px;
    animation: reveal 500ms ease-out backwards;
    animation-delay: calc(var(--i, 0) * 70ms);
  }
  @keyframes reveal { from { opacity: 0; transform: translateY(var(--rise, 12px)); } }
  @keyframes hero-title-in {
    from { opacity: 0; transform: translateY(.65em); clip-path: inset(100% 0 0); }
    to { opacity: 1; transform: translateY(0); clip-path: inset(0); }
  }
  @keyframes portrait-in {
    from { opacity: 0; transform: translateY(20px) scale(.84); clip-path: inset(0 0 100% round 16px); }
    70% { opacity: 1; transform: translateY(-4px) scale(1.025); clip-path: inset(0 round 16px); }
    to { opacity: 1; transform: none; clip-path: inset(0 round 16px); }
  }

  .contact-card, .badges img { transition: translate 200ms, box-shadow 200ms; }
  .contact-card:hover {
    translate: 0 -4px;
    box-shadow: 0 4px 14px rgb(0 0 0 / .06);
  }
  .badges img:hover { translate: 0 -2px; }
  .project > summary::after { transition: transform 200ms; }
  .project > summary:hover::after { transform: rotate(90deg); }
  .project-name { transition: color 200ms; }
  .site-header { transition: box-shadow 200ms; }
  .site-header nav a, .contacts a, .cc-go { transition: background-size 200ms; }

  @supports (interpolate-size: allow-keywords) and selector(details::details-content) {
    details { interpolate-size: allow-keywords; }
    details::details-content {
      height: 0;
      overflow: clip;
      transition: height 250ms ease-out, content-visibility 250ms allow-discrete;
    }
    details[open]::details-content { height: auto; }
  }
}

@media print {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    box-shadow: none !important;
    translate: none !important;
  }
  details::details-content { transition: none !important; }
  body { padding-top: 0; }
  .site-header { display: none; }
  .hero, footer { background: white; color: black; }
  .hero { padding: 0 0 1rem; }
  .hero-stage { grid-template-columns: 1fr; }
  .hero-label, .hero h1 span, .hero .contacts a { color: inherit; }
  .hero h1 { font-size: 2rem; }
  .wrap { width: 100%; }
  .section, footer { padding-block: 1.25rem; }
  .section > .section-heading { margin-bottom: 1rem; }
  summary::after { display: none; }
  h2, h3, summary { break-after: avoid; }
  figure, .cover-img { break-inside: avoid; }
}

.skills { display: grid; gap: .9rem; }
.skill-row { display: grid; grid-template-columns: 9.5rem 1fr; align-items: center; gap: 1rem; }
.skill-cat { font-size: .9rem; font-weight: 600; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; }
.badges img { width: auto; height: 26px; border-radius: 4px; }
@media (max-width: 640px) { .skill-row { grid-template-columns: 1fr; gap: .4rem; } }

.hobbies { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.hobby img, .hobby video { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 12px; background: #111; }
.hobby h3 { margin-top: .9rem; font-size: 1.1rem; }
.hobby p { margin-top: .3rem; color: var(--muted); }
@media (max-width: 640px) { .hobbies { grid-template-columns: 1fr; } }


/* contact layout: left stack (email + GitHub) | right velog */
.contact-cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: stretch; max-width: none; }
.contact-stack { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.contact-stack .mail-card { flex: 1; height: auto; min-height: 0; justify-content: center; }
.contact-stack .mail-card .cc-go { margin-top: .6rem; }
.img-card { background: none !important; padding: 0 !important; box-shadow: none; }
.img-card img { width: 100%; height: auto; display: block; }
@media (max-width: 640px) { .contact-cards { grid-template-columns: 1fr; } }

.section-sub { margin-top: .4rem; color: var(--muted); }
#guestbook > .section-heading { margin-bottom: 1.5rem; }
