/* 포트폴리오: 스크롤 없는 한 화면, 가로 3열, 흰 배경 · 검정 글자 · 각진 흑백 레트로 */

/* ── 폰트 (fonts/ 에 파일 포함, 라이선스는 fonts/LICENSE-*.txt) ───── */
@font-face {
  font-family: "Pretendard";
  src: url("fonts/Pretendard-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Pretendard";
  src: url("fonts/Pretendard-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* 레트로 분위기는 짧은 라벨에만 쓴다(본문·긴 문장에는 쓰지 않는다) */
@font-face {
  font-family: "Galmuri11";
  src: url("fonts/Galmuri11-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fbfbf9;
  --paper: #fff;
  --ink: #111;
  --muted: #555;
  --soft: #e9e9e6;
  --rule: 2px;
  --gutter: 28px;
  /* 제목 줄(.project-head)과 프로젝트 개요 자리(.project-overview)가 함께 쓰는 높이 */
  --head-h: clamp(36px, 2.9vw, 56px);
  --font-body: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --font-label: "Galmuri11", "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  /* 쌓기 배치 여부(0 = 한 화면 3열, 1 = 스크롤 쌓기). 아래 쌓기 미디어 쿼리가 1로 바꾸고 index.js가 읽는다 */
  --stacked: 0;
  /* 도트 장식: 2px 네모를 엇갈려 찍은 6px 타일 */
  --dots: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Crect width='2' height='2' fill='%23111'/%3E%3Crect x='3' y='3' width='2' height='2' fill='%23111'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}
html {
  color-scheme: light;
}
a {
  color: inherit;
}
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.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;
}

/* ── 한 화면 뼈대: 헤더 / 본문(남는 높이) / 푸터 ─────────── */
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  word-break: keep-all;
}

/* ── 헤더 ─────────────────────────── */
.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px var(--gutter);
  border-bottom: var(--rule) solid var(--ink);
}
.brand {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 14px;
  line-height: 1.2;
}
.brand strong {
  font-family: var(--font-label);
  font-size: clamp(22px, 2.1vw, 32px);
  font-weight: 700;
}
.site-header .brand span {
  font-size: clamp(14px, 1.2vw, 18px);
}
.site-header nav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 36px);
}
.site-header nav a,
.site-header nav button {
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  font-family: var(--font-label);
  font-size: clamp(13px, 1.1vw, 16px);
  text-decoration: none;
  cursor: pointer;
}
.site-header nav a:hover,
.site-header nav button:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.career-link[aria-disabled="true"] {
  color: var(--muted);
  cursor: default;
}
.career-link[aria-disabled="true"]:hover {
  text-decoration: none;
}
.career-link small {
  margin-left: 4px;
  padding: 0 4px;
  border: 1px solid currentColor;
  font-size: 10px;
}

/* ── 본문: 프로젝트 3개를 가로 한 줄로. 01 넓게, 02·03 좁게 ───────── */
main {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 2.8fr) minmax(0, 1fr) minmax(0, 1fr);
  /* 한 줄의 높이를 본문 높이에 고정해, 기기가 커지거나 작아져도 칸 높이 계산이 되먹임되지 않게 한다 */
  grid-template-rows: minmax(0, 1fr);
  padding: 0 var(--gutter);
}
section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px clamp(12px, 1.6vw, 24px) 12px;
}
section + section {
  border-left: 1px solid var(--ink);
}
section:first-child {
  padding-left: 0;
}

/* 제목 줄: 아이콘 + 번호 + 제목 + 부제 */
.project-head {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  height: var(--head-h);
  margin-bottom: 8px;
}
/* 프로젝트 개요 자리: 제목 줄과 같은 높이(글이 길어지면 늘어난다). 비어 있어도 자리를 차지한다 */
.project-overview {
  margin: -6px 0 8px; /* 위쪽 음수 여백: 제목 줄과의 간격을 조금 줄인다 */
  min-height: var(--head-h);
  font-size: clamp(12px, 0.95vw, 14px);
  line-height: 1.4;
}
/* "스택"·"기능" 같은 짧은 라벨에만 레트로 글꼴을 쓴다 */
.project-overview strong {
  margin-right: 0.35em;
  font-family: var(--font-label);
  font-weight: 700;
}
.icon {
  flex: 0 0 auto;
  width: clamp(26px, 2.6vw, 44px);
  height: auto;
  fill: var(--ink);
  shape-rendering: crispEdges;
}
.icon .cut,
.icon rect.cut {
  fill: var(--bg);
}
.project-title {
  min-width: 0;
}
section h2 {
  margin: 0;
  font-family: var(--font-label);
  font-size: clamp(13px, 1.15vw, 24px);
  line-height: 1.25;
  white-space: nowrap;
}
.project-no {
  margin-right: 0.35em;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.85em;
}
.project-sub {
  margin: 0;
  font-size: clamp(11px, 0.9vw, 14px);
  color: var(--ink);
}

/* ── 데모(관제·외부 데모 공통) ─────── */
/* 기기·캡션·버튼 묶음은 내용 높이만큼만 차지하고 제목 바로 아래에 붙는다(남는 높이는 맨 아래로) */
.demo,
.ext-demo {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.demo-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.demo-tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 3px 10px;
  font-family: var(--font-label);
  font-size: 12px;
  cursor: pointer;
}
.demo-tabs button:hover {
  background: var(--soft);
}
.demo-tabs button[aria-selected="true"] {
  background: var(--ink);
  color: var(--paper);
}
.demo-tabs button span {
  margin-right: 6px;
}

/* 기기 칸: 높이는 폭 × 기기 바깥 비율로 정해지고, 화면이 낮아 모자랄 때만 줄어든다 */
.device-slot {
  flex: none;
  width: 100%;
  /* 기기는 실제 크기(배율 1.0)보다 커지지 않으므로 칸도 그 폭을 넘기지 않는다 */
  max-width: calc(var(--dw) * 1px);
  margin-inline: auto;
}
/* 기기 바깥 논리 크기(px): 모니터 = 화면 1920×1080 + 베젤 40px + 받침 140px, 폰 = 화면 393×852(iPhone 16) + 베젤 16px.
   칸의 높이는 안의 기기 높이를 그대로 따른다(배율은 index.js의 fitDevices가 정한다) */
.demo .device-slot {
  --dw: 2000;
  --dh: 1300;
}
.ext-demo .device-slot {
  --dw: 425;
  --dh: 884;
}

/* 기기: 논리 크기 그대로 그린 뒤(.device__body) --scale(index.js가 계산, 상한 1)만큼 통째로 줄인다.
   transform은 자리 크기를 바꾸지 않으므로 바깥 .device의 크기를 같은 배율로 따로 정한다. */
.device {
  position: relative;
  margin-inline: auto;
  width: calc(var(--dw) * var(--scale, 1) * 1px);
  height: calc(var(--dh) * var(--scale, 1) * 1px);
}
.device__body {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--dw) * 1px);
  height: calc(var(--dh) * 1px);
  transform: scale(var(--scale, 1));
  transform-origin: 0 0;
}
.device__head {
  position: relative;
  background: var(--ink);
}
/* 베젤·받침의 둥근 모서리는 기기 모양을 위한 것이라 UI의 각진 규칙의 예외다 */
.device--monitor .device__head {
  width: 2000px;
  height: 1160px;
  padding: 40px;
  border-radius: 20px;
}
.device__neck {
  position: absolute;
  top: 1160px;
  left: 50%;
  width: 260px;
  height: 90px;
  margin-left: -130px;
  background: var(--ink);
  clip-path: polygon(15% 0, 85% 0, 100% 100%, 0 100%);
}
.device__base {
  position: absolute;
  top: 1250px;
  left: 50%;
  width: 760px;
  height: 50px;
  margin-left: -380px;
  background: var(--ink);
  border-radius: 14px 14px 4px 4px;
}
.device--phone .device__head {
  width: 425px;
  height: 884px;
  padding: 16px;
  border-radius: 72px;
}

/* 화면(논리 크기): 앱은 실제 기기와 같은 폭·높이로 렌더링된다 */
.demo-frame,
.ext-demo__frame {
  position: relative;
  overflow: hidden;
  background: #fff;
}
.demo-frame {
  width: 1920px;
  height: 1080px;
}
.ext-demo__frame {
  width: 393px;
  height: 852px;
  border-radius: 56px;
}
.demo-frame iframe,
.ext-demo__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.demo-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 28px;
}

/* 캡션 + 크게 보기 버튼: 기기 바로 아래 가운데 */
.demo-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
}
.caption {
  margin: 0;
  text-align: center;
  text-wrap: balance;
  font-size: clamp(12px, 0.95vw, 14px);
  line-height: 1.4;
}
.button {
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 5px 18px;
  font-family: var(--font-label);
  font-size: clamp(13px, 1vw, 15px);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.button:hover {
  background: var(--ink);
  color: var(--paper);
}

/* 폰 데모 위 스크롤 안내. 기기와 함께 줄어드는 논리 크기 안에 있으므로 글자를 크게 잡았다(동작 정리는 Block 5) */
.scroll-hint {
  position: absolute;
  top: 70%; /* 앱 상단의 지도·로고를 가리지 않도록 화면 아래쪽 */
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 80px 28px;
  border: 4px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-label);
  font-size: 26px;
  white-space: nowrap;
  transition: opacity 0.4s ease; /* 휠·터치·클릭을 직접 받아야 하므로 pointer-events는 기본값(auto) */
}
.scroll-hint.is-hidden {
  opacity: 0;
  pointer-events: none; /* 사라진 뒤에는 아래 화면 조작을 막지 않는다 */
}
.scroll-hint__mouse {
  position: relative;
  width: 40px;
  height: 62px;
  border: 4px solid var(--ink);
}
.scroll-hint__wheel {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 7px;
  height: 14px;
  margin-left: -3.5px;
  background: var(--ink);
  animation: scroll-wheel 1.4s ease-in-out infinite;
}
@keyframes scroll-wheel {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  70% {
    transform: translateY(22px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 0;
  }
}

/* ── 푸터 ─────────────────────────── */
.site-footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px var(--gutter);
  border-top: var(--rule) solid var(--ink);
}
.site-footer .label {
  margin: 0;
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.site-footer .brand {
  display: block;
  font-size: 13px;
}
.site-footer .brand strong {
  font-family: var(--font-body);
  font-size: inherit;
}

/* 도트 장식: 네 모서리, 좌우 여백(gutter) 안에만 둔다. 글자·기기 뒤에 깔지 않는다 */
.site-header::before,
.site-header::after,
.site-footer::before,
.site-footer::after {
  content: "";
  position: absolute;
  width: calc(var(--gutter) - 8px);
  height: 52px;
  background-image: var(--dots);
  pointer-events: none;
}
.site-header::before {
  top: 4px;
  left: 4px;
}
.site-header::after {
  top: 4px;
  right: 4px;
}
.site-footer::before {
  bottom: 4px;
  left: 4px;
}
.site-footer::after {
  bottom: 4px;
  right: 4px;
}

/* ── 토스트 ───────────────────────── */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-label);
  font-size: 13px;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.25s;
  z-index: 40;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: none;
}

/* ── 가로 대비 세로가 긴 화면·좁은 화면·아주 낮은 화면: 한 화면 고정을 풀고 스크롤을 허용한다 ──
   01(모니터)은 전폭, 02·03(폰)은 그 아래 나란히. 기기는 최대 크기(폰 393px 폭 화면)까지 크게 보인다.
   폭 1200px 이하: 한 화면 3열에서는 폰 기기 폭이 170px 밑으로 내려가기 때문(1024×768에서 약 146px, layout.spec.js 검증).
   (작은 폰 화면의 세부 조정은 Block 6) */
@media (max-aspect-ratio: 6/5), (max-width: 1200px), (max-height: 560px) {
  :root {
    --stacked: 1;
  }
  body {
    height: auto;
    display: block;
  }
  main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-bottom: 8px;
  }
  section {
    padding: 18px clamp(12px, 2vw, 24px) 20px;
  }
  section + section {
    border-left: 0;
  }
  #work {
    grid-column: 1 / -1;
    padding-inline: 0;
    border-bottom: 1px solid var(--ink);
  }
  #dailyset {
    padding-left: 0;
  }
  #hackathon {
    padding-right: 0;
    border-left: 1px solid var(--ink);
  }
  .demo,
  .ext-demo {
    flex: none;
  }
  .device-slot,
  .demo .device-slot,
  .ext-demo .device-slot {
    container-type: normal;
    display: block;
    width: 100%; /* auto면 가운데 정렬 여백 때문에 기기 폭으로 줄어들어 배율이 1에서 풀리지 않는다 */
    aspect-ratio: auto;
  }
  .site-header,
  .site-footer {
    flex-wrap: wrap;
  }
  /* 쌓기 배치의 간격: 제목 → 개요 → (탭) → 기기 → 캡션을 한 화면 배치처럼 숨 쉴 만큼 띄운다 */
  .project-head,
  .project-overview {
    margin-bottom: 14px;
  }
  .demo-tabs {
    padding-bottom: 14px;
  }
  .demo-foot {
    padding-top: 16px;
  }
}
@media (max-width: 640px) {
  main {
    grid-template-columns: minmax(0, 1fr);
  }
  #dailyset,
  #hackathon {
    padding-inline: 0;
  }
  #hackathon {
    border-left: 0;
    border-top: 1px solid var(--ink);
  }
  /* 휴대폰 화면: 손가락으로 누를 수 있는 크기, 줄이 넘치면 줄바꿈(가로 스크롤·잘림 방지) */
  .site-header nav {
    flex-wrap: wrap;
    row-gap: 0;
  }
  .site-header nav a,
  .site-header nav button {
    padding: 10px 2px;
  }
  .demo-tabs {
    flex-wrap: wrap;
    justify-content: center;
  }
  .demo-tabs button {
    min-height: 40px;
    padding: 8px 12px;
  }
  .button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* 한 화면 3열(위 쌓기 조건의 반대)에서만: 01의 탭을 제목 줄 오른쪽으로 올려, 모니터가 폰과 같은 높이에서 시작하고
   캡션·버튼 줄이 세 열에서 나란하도록 한다. 조건은 위 쌓기 미디어 쿼리의 반대로, 함께 고쳐야 한다. */
@media (min-aspect-ratio: 6/5) and (min-width: 1201px) and (min-height: 561px) {
  /* 시안처럼 [제목 줄] → 기기 → [캡션·버튼]을 같은 간격으로 잇고, 그 묶음 전체를 섹션 안에서 세로 가운데에 둔다.
     (남는 높이는 묶음 위아래의 여백이 된다.) .demo를 display: contents로 풀어 섹션의 그리드에 직접 놓아,
     01의 탭도 제목 줄 오른쪽에 함께 놓이고 세 열의 줄이 나란해진다. */
  section {
    display: grid;
    align-content: center;
    row-gap: clamp(14px, 2.6dvh, 28px);
  }
  #work {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .demo,
  .ext-demo {
    display: contents;
  }
  .project-head,
  .project-overview {
    margin-bottom: 0;
  }
  #work .demo-tabs {
    grid-row: 1; /* 개요 줄이 사이에 끼므로 제목 줄 오른쪽 자리를 직접 지정 */
    grid-column: 2;
    align-self: center;
    padding-bottom: 0;
  }
  .project-overview,
  .device-slot,
  .demo-foot {
    grid-column: 1 / -1;
  }
  .demo-foot {
    padding-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint__wheel {
    animation: none;
  }
  .toast {
    transition: none;
  }
}
