/* 링크 한 장짜리 자기소개 페이지.
   값은 모두 ai-design-skills/landing-page-design 규칙에서 옵니다:
   글꼴 Geist 하나(한글은 기기 기본 한글 글꼴), 크기는 Tailwind 단계, 간격은 2·4·8·12·16·24·32·40·48·64·80·96만,
   배경은 #181818 위에 움직이지 않는 옅은 별 무늬, 움직임은 cubic-bezier(0.22, 1, 0.36, 1). */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #181818;
  --surface: #1f1f1f;
  --surface-hover: #272727;
  --line: #313131;
  --text: #e6e6e6;   /* 바탕 대비 14.2:1 */
  --muted: #a3a3a3;  /* 바탕 대비 7.0:1, 카드 위 6.5:1 */
  --dim: #8a8a8a;    /* 바탕 대비 5.1:1 */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Geist", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh; /* 휴대폰 주소창을 뺀 높이. 100vh는 주소창만큼 넘쳐 스크롤이 생깁니다 */
  display: flex;
  flex-direction: column;
  /* 별 무늬: 맨 위 겹은 가운데 글 뒤를 바탕색으로 덮어 읽기를 방해하지 않게 하고,
     아래 두 겹은 큰 점(470px 타일)과 작은 점(280px 타일). 타일 크기가 달라 되풀이가 덜 보입니다.
     SVG를 CSS 안에 넣어 파일 요청이 늘지 않고, 평균 밝기는 단색 바탕과 같습니다. */
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 360px 70% at 50% 50%, var(--bg) 30%, transparent 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='470' height='470' fill='white'%3E\
%3Ccircle cx='18.4' cy='314.1' r='1.03' fill-opacity='0.44'/%3E\
%3Ccircle cx='411.5' cy='147.5' r='1.01' fill-opacity='0.45'/%3E\
%3Ccircle cx='272.6' cy='214.4' r='1.05' fill-opacity='0.54'/%3E\
%3Ccircle cx='222.8' cy='312.2' r='0.82' fill-opacity='0.48'/%3E\
%3Ccircle cx='304.2' cy='466.8' r='1.05' fill-opacity='0.37'/%3E\
%3Ccircle cx='181.3' cy='314.3' r='0.81' fill-opacity='0.42'/%3E\
%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280' fill='white'%3E\
%3Ccircle cx='90.7' cy='42.2' r='0.70' fill-opacity='0.20'/%3E\
%3Ccircle cx='150.0' cy='102.4' r='0.52' fill-opacity='0.29'/%3E\
%3Ccircle cx='10.5' cy='121.4' r='0.52' fill-opacity='0.20'/%3E\
%3Ccircle cx='118.9' cy='231.5' r='0.54' fill-opacity='0.23'/%3E\
%3Ccircle cx='175.7' cy='265.4' r='0.67' fill-opacity='0.27'/%3E\
%3Ccircle cx='273.4' cy='13.0' r='0.76' fill-opacity='0.24'/%3E\
%3Ccircle cx='40.4' cy='33.0' r='0.59' fill-opacity='0.36'/%3E\
%3Ccircle cx='50.6' cy='162.8' r='0.69' fill-opacity='0.26'/%3E\
%3Ccircle cx='153.4' cy='17.6' r='0.52' fill-opacity='0.23'/%3E\
%3Ccircle cx='190.5' cy='119.7' r='0.59' fill-opacity='0.31'/%3E\
%3Ccircle cx='126.9' cy='83.9' r='0.74' fill-opacity='0.33'/%3E\
%3Ccircle cx='68.3' cy='160.8' r='0.66' fill-opacity='0.37'/%3E\
%3Ccircle cx='204.2' cy='80.6' r='0.79' fill-opacity='0.21'/%3E\
%3Ccircle cx='117.1' cy='212.0' r='0.55' fill-opacity='0.29'/%3E\
%3C/svg%3E");
  background-size: 100% 100%, 470px 470px, 280px 280px;
  background-repeat: no-repeat, repeat, repeat;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 24px;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 10;
  padding: 8px 12px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.skip:focus {
  top: 16px;
}

/* 한 줄 기둥: 링크 모음처럼 가운데 좁게, 한 화면 안에서 세로 가운데 */
.page {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 16px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

/* 프로필 */
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 12px; /* 아래 간격 12px과 합쳐 24px */
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 9999px;
  border: 1px solid var(--line);
  object-fit: cover;
}

.avatar-initial {
  display: grid;
  place-items: center;
  background: var(--surface);
  font-size: 30px;
  line-height: 36px;
  font-weight: 600;
  color: var(--text);
}

/* 소개 한 줄. 첫 화면 제목이라 흰색에서 회색으로 */
.intro {
  margin: 16px 0 0;
  font-size: 18px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
  background: linear-gradient(90deg, #ffffff, #9b9b9b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* 포트폴리오 링크 */
.label {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--muted);
}

.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "icon text meta arrow";
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-decoration: none;
  transition: background-color 300ms var(--ease), transform 500ms var(--ease);
}

.link-card:hover {
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.link-card:active {
  transform: scale(0.98);
}

/* 파일 크기 칸이 없는 링크(스레드·링크드인): 빈 칸 몫의 간격이 생기지 않게 세 칸만 씁니다 */
.link-card.is-plain {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "icon text arrow";
}

/* 링크: 두 칸 격자. 카드 16px, 안쪽 12px → 아이콘 칸은 원 */
.link-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.link-grid .link-card {
  padding: 12px;
  gap: 8px; /* 360px 폭 휴대폰에서도 '링크드인'이 잘리지 않게 */
}

.link-grid .link-icon {
  width: 32px;
  height: 32px;
}

.link-grid .link-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* 카드와 간격(16px)이 같아 안쪽 둥글기 공식(16 − 16 = 0)이 2 이하라, 아이콘 칸은 원으로 둡니다 */
.link-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: var(--surface-hover);
  color: var(--text);
}

.link-text {
  grid-area: text;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.link-title {
  font-weight: 600;
  text-wrap: pretty;
}

.link-note {
  font-size: 14px;
  line-height: 20px;
  color: var(--muted);
  text-wrap: pretty;
}

.link-meta {
  grid-area: meta;
  font-size: 12px;
  line-height: 16px;
  color: var(--dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.link-arrow {
  grid-area: arrow;
  display: grid;
  color: var(--muted);
  transition: transform 500ms var(--ease);
}

.link-card:hover .link-arrow {
  transform: translate(2px, -2px);
}

/* 포트폴리오 접기·펼치기: 상자 하나에 머리(버튼)와 PDF 목록이 함께 들어 있습니다.
   높이는 grid 행(0fr ↔ 1fr)으로 움직이고, 접힌 동안은 visibility로 숨겨 키보드·화면 낭독기도 건너뜁니다.
   둥글기: 상자 16px, 목록 안쪽 여백 8px → 안쪽 줄은 16 − 8 = 8px. */
.fold {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.fold-heading {
  margin: 0;
  font: inherit;
}

.fold-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "icon text arrow";
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 16px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 300ms var(--ease);
}

.fold-toggle:hover {
  background: var(--surface-hover);
}

.fold.is-open .fold-toggle {
  border-radius: 16px 16px 0 0;
}

.fold-chevron {
  grid-area: arrow;
  display: grid;
  color: var(--muted);
  transition: transform 500ms var(--ease);
}

.fold.is-open .fold-chevron {
  transform: rotate(180deg);
}

.fold-panel {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 500ms var(--ease), visibility 0s;
}

.js .fold:not(.is-open) .fold-panel {
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 500ms var(--ease), visibility 0s linear 500ms;
}

/* position: relative — 안쪽의 화면 낭독기용 글자(.sr-only, 절대 위치)가 접힌 영역 밖으로 빠져 스크롤을 만들지 않게 */
.fold-inner {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

/* 상자 안 목록: 머리와 줄 하나로 나누고, 아이콘이 머리 아이콘과 같은 세로줄에 오게 8 + 8 = 16px */
.fold-inner > .link-list {
  gap: 4px;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.fold .link-card {
  padding: 8px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
}

.fold .link-card:hover {
  background: var(--surface-hover);
  transform: none;
}

.fold-inner > .empty {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

/* 스크립트가 없으면 펼친 채로 두고, 누를 것처럼 보이는 표시도 숨깁니다 */
html:not(.js) .fold-hint,
html:not(.js) .fold-chevron {
  display: none;
}

html:not(.js) .fold-toggle {
  cursor: default;
}

.empty {
  margin: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  text-wrap: pretty;
}

/* 바닥글 */
.footer {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  display: flex;
  justify-content: center;
}

.fine {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--dim);
}

.fine a {
  margin-left: 8px;
  color: var(--muted);
}

/* 들어올 때: 32px 아래에서 올라오며 나타남. 한 번만 */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* 질문 창: 링크 바로 아래. 대화는 입력창 위에 쌓입니다. 스크립트가 없으면 쓸 수 없어 숨깁니다 */
html:not(.js) .ask {
  display: none;
}

.ask {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 질문 창 상자: 제목·안내·예시 질문·대화·입력칸을 모두 한 상자에 넣고 구분선으로 나눕니다.
   테두리는 소개 문장처럼 흰색에서 회색으로 흐르는 그라데이션으로, 페이지에서 가장 먼저 눈에 띄게 합니다. */
.ask-panel {
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 16px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0.08) 64%) border-box;
}

/* 누르면 테두리가 또렷해집니다(초점 표시) */
.ask-panel:focus-within {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, #ffffff, rgba(255, 255, 255, 0.32) 64%) border-box;
}

.ask-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 16px;
}

/* 링크 카드의 아이콘 칸 모양만 빌리고, 칸 배치(grid-area: icon)는 쓰지 않습니다 */
.ask-icon {
  grid-area: auto;
  background: #ffffff;
  color: var(--bg);
}

.ask-head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ask-title {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
}

.ask-note {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}

.ask-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
}

.ask-starters[hidden] {
  display: none;
}

.ask-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-top: 1px solid var(--line);
}

.ask-form textarea {
  flex: 1;
  min-width: 0;
  height: 40px;
  max-height: 120px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit; /* 16px: 휴대폰에서 누를 때 화면이 확대되지 않게 */
  line-height: 24px;
  resize: none;
  outline: none; /* 초점은 상자 테두리로 표시 */
}

.ask-form textarea::placeholder {
  color: var(--dim);
}

.ask-form textarea:disabled {
  opacity: 0.64;
}

.ask-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: #ffffff;
  color: var(--bg);
  cursor: pointer;
  transition: background-color 300ms var(--ease);
}

.ask-send:hover {
  background: #e6e6e6;
}

.ask-send:disabled {
  opacity: 0.5;
  cursor: default;
}

.chat-starter {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
  transition: background-color 300ms var(--ease), color 300ms var(--ease);
}

.chat-starter:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* 대화: 내 질문은 오른쪽 흰 말풍선, 답은 왼쪽. 길어지면 상자 안에서만 스크롤합니다 */
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  max-height: min(420px, 55vh);
  overflow-y: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.chat-log[hidden] {
  display: none;
}

.chat-msg {
  margin: 0;
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  line-height: 1.625;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-msg-me {
  align-self: flex-end;
  background: #ffffff;
  color: var(--bg);
}

.chat-msg-bot,
.chat-msg-notice {
  align-self: flex-start;
  border: 1px solid var(--line);
  background: var(--bg); /* 상자(--surface)보다 한 단계 어둡게 */
}

/* 답 말풍선: 문단(빈 줄)은 12px, 줄과 목록 항목은 4px 띄우고, 목록은 16px 들여씁니다 */
.chat-msg-bot {
  max-width: 92%;
  padding: 12px 16px;
  white-space: normal;
}

.chat-msg-notice,
.chat-msg.is-pending {
  color: var(--muted);
}

.chat-msg-bot a,
.chat-msg-notice a {
  color: var(--text);
  text-underline-offset: 2px;
}

.chat-block + .chat-block {
  margin-top: 12px;
}

.chat-block > * + * {
  margin-top: 4px;
}

.chat-block p,
.chat-block ul,
.chat-block ol {
  margin: 0;
}

.chat-block ul,
.chat-block ol {
  padding-left: 16px;
}

.chat-block li + li {
  margin-top: 4px;
}

.chat-block li::marker {
  color: var(--dim);
}

/* 작은 글 페이지(개인정보 안내, 404): 위에서부터 */
.doc {
  justify-content: flex-start;
  gap: 24px;
}

.doc h1 {
  margin: 0;
  font-size: 30px;
  line-height: 36px;
  font-weight: 600;
}

.doc p {
  margin: 0;
  color: var(--muted);
  text-wrap: pretty;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 300ms var(--ease), transform 500ms var(--ease);
}

.back:hover {
  background: var(--surface);
  transform: translateY(-2px);
}

.back:active {
  transform: scale(0.98);
}

/* 좁은 화면: 파일 크기를 제목 아래로 내려 제목이 넓게 쓰이게 */
@media (max-width: 639px) {
  .link-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "icon text arrow"
      "icon meta arrow";
    row-gap: 4px;
  }

  .link-meta {
    white-space: normal;
  }
}

/* 아주 좁은 화면(320px대): 링크 화살표를 빼서 이름이 잘리지 않게, 위 여백도 줄여 한 화면에 */
@media (max-width: 359px) {
  .page {
    padding-top: 16px;
    gap: 8px;
  }

  .footer {
    padding: 8px 16px 16px;
  }

  .avatar {
    width: 64px;
    height: 64px;
  }

  .intro {
    margin-top: 12px;
  }

  .fold-toggle,
  .ask-head {
    padding: 12px;
  }

  .ask-form {
    padding: 4px 4px 4px 12px;
  }

  .ask-starters {
    display: none;
  }

  .link-grid .link-card {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "icon text";
  }

  .link-grid .link-arrow {
    display: none;
  }
}

/* 세로가 짧은 화면: 예시 질문 줄을 숨겨 한 화면에 들어오게 */
@media (max-height: 699px) {
  .ask-starters {
    display: none;
  }
}

@media (min-width: 640px) {
  .page {
    padding-top: 48px;
  }
}

/* 움직임 줄이기: 움직임 대신 투명도만 */
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] {
    transform: none;
  }

  .link-card,
  .link-card:hover,
  .link-card:active,
  .link-card:hover .link-arrow,
  .back:hover,
  .back:active {
    transform: none;
  }

  .fold-panel,
  .js .fold:not(.is-open) .fold-panel,
  .fold-chevron {
    transition: none;
  }
}
