/* avoid-ai-design-ignore: SD2 — 검정 바탕과 라임 강조는 사용자 지정 브랜드 색. 값의 근거는 DESIGN.md. */

:root {
  color-scheme: dark;

  --ground: #000000;
  --surface: #151515;
  --line: #2b2b2b;
  --line-control: #5c5c58;
  --ink: #f4f4f0;
  --muted: #a8a8a2;
  --lime: #c8f03c;
  --lime-hover: #b4dc28;
  --on-lime: #000000;
  --notice: #ffc857;

  --font: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-code: ui-monospace, "Cascadia Mono", Consolas, monospace;

  --fs-display: clamp(36px, 5.2vw, 64px);
  --fs-heading: clamp(24px, 2.6vw, 32px);
  --fs-item: 20px;
  --fs-body: 17px;
  --fs-small: 15px;
  --fs-meta: 14px;

  --radius-control: 6px;
  --radius-panel: 8px;

  --space-item: 12px;
  --space-group: 24px;
  --space-section: clamp(72px, 10vw, 128px);
  --gutter: clamp(16px, 4vw, 48px);
  --content-max: 1200px;
  --measure: 36em;

  --focus: 2px solid var(--lime);
  --focus-offset: 3px;
  --transition: 120ms ease-out;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
img { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

:focus-visible { outline: var(--focus); outline-offset: var(--focus-offset); }

.skip-link {
  position: absolute; left: var(--gutter); top: -100px;
  padding: 8px 12px; background: var(--ink); color: var(--ground);
  border-radius: var(--radius-control); z-index: 10;
}
.skip-link:focus { top: 12px; }

.wrap { max-width: calc(var(--content-max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* 머리글 */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: var(--space-group); }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 18px; }
.brand svg { flex: none; }

.site-nav ul { display: flex; gap: var(--space-group); margin: 0; padding: 0; list-style: none; }
.site-nav a {
  display: inline-block; padding: 8px 0; text-decoration: none; color: var(--muted);
  font-size: var(--fs-small); border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

/* 버튼과 링크 */
.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 24px;
  background: var(--lime); color: var(--on-lime);
  border: 1px solid var(--lime); border-radius: var(--radius-control);
  font: 600 var(--fs-body)/1 var(--font); text-decoration: none; cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition);
}
.btn-primary:hover { background: var(--lime-hover); border-color: var(--lime-hover); }
.btn-primary[aria-disabled="true"] {
  background: transparent; color: var(--muted); border-color: var(--line-control); cursor: not-allowed;
}
.btn-primary svg { flex: none; }

.link { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.link:hover { text-decoration-thickness: 2px; }

/* 구역: 왼쪽 글 5칸, 오른쪽 화면 7칸 */
.section { padding: var(--space-section) 0; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; }

.split { display: grid; gap: var(--space-group); }
@media (min-width: 960px) {
  .split { grid-template-columns: 5fr 7fr; gap: 64px; align-items: start; }
  .split-center { align-items: center; }
}

/* 첫 화면: 회사 소개와 지식 구조 그림 */
.hero { padding-top: clamp(40px, 6vw, 80px); }

.ontology { margin: 0; display: grid; gap: var(--space-item); }
.ontology canvas {
  display: block; width: 100%; aspect-ratio: 1 / 1; max-height: min(680px, 78vh);
  cursor: grab; touch-action: pan-y;
}
.ontology canvas:active { cursor: grabbing; }

/* ALMEUM MATH 페이지: 왼쪽 글 단계, 오른쪽에 고정된 실제 앱 화면 */
.story { padding-top: 0; }
.story-grid { display: grid; gap: var(--space-group); }
.story-step { display: grid; gap: var(--space-item); align-content: center; min-height: 72vh; padding: 40px 0; }
.story-step p { color: var(--muted); max-width: var(--measure); }
.story-step .heading { color: var(--muted); transition: color var(--transition); }
.story-step.is-current .heading { color: var(--ink); }

.story-stage { position: sticky; top: 0; z-index: 1; padding: 12px 0; background: var(--ground); order: -1; }
.story-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 10;
  border: 1px solid var(--line); border-radius: var(--radius-panel); overflow: hidden;
  background: #f3f3f1; /* 앱 바탕(앱 디자인 토큰 --surface-canvas) */
  transform-origin: 50% 100%;
}
.story-stage .story-frame {
  transform: perspective(1600px) rotateX(calc((1 - var(--enter, 1)) * 20deg)) scale(calc(0.9 + var(--enter, 1) * 0.1));
}
/* 새 화면이 위에서 나타나는 동안 이전 화면은 그대로 두었다가 끝나면 숨긴다(두 화면이 반투명하게 겹치지 않게). */
.story-scene {
  position: absolute; inset: 0; opacity: 0; transform: translateY(24px);
  transition: opacity 0s linear 450ms, transform 450ms ease-out;
  pointer-events: none;
}
.story-scene[data-position="before"] { transform: translateY(-24px); }
.story-scene[data-position="current"] {
  z-index: 1; opacity: 1; transform: none;
  transition: opacity 450ms ease-out, transform 450ms ease-out;
}
.story-scene iframe {
  display: block; width: 1280px; height: 800px; border: 0;
  transform: scale(var(--scale, 0.5)); transform-origin: 0 0;
}

/* 좁은 화면: 고정된 앱 화면 아래로 글이 지나간다. 글이 화면 경계에서 반쯤 잘려 보이지 않게 경계 아래를 흐리게 덮는다. */
@media (max-width: 959px) {
  .story-step { min-height: auto; align-content: start; padding: 32px 0 30vh; }
  .story-stage::after {
    content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 24px;
    background: linear-gradient(var(--ground), transparent); pointer-events: none;
  }
}
@media (min-width: 960px) {
  /* 앱 글자가 읽히도록 앱 화면에 8칸을 주고, 콘텐츠 폭보다 창이 넓으면 오른쪽 여백까지 뻗는다. 글의 왼쪽 끝은 다른 구역과 같다. */
  .story-grid { grid-template-columns: 4fr 8fr; gap: 48px; align-items: start; }
  .story-step { min-height: 100vh; padding: 0; }
  /* 앱 화면의 가운데를 화면 가운데에 맞춘다. story.js가 틀 높이로 --stage-top을 계산한다. */
  .story-stage {
    order: 0; top: var(--stage-top, 88px); padding: 0; background: none;
    margin-right: min(0px, calc((var(--content-max) + 2 * var(--gutter) - 100vw) / 2));
  }
}

/* 함께 들어 있는 기능: 이름과 한 줄 설명 */
.feature-list { display: grid; gap: 0 var(--space-group); margin: 0; }
.feature-list div { display: grid; gap: 4px; padding: var(--space-group) 0; border-top: 1px solid var(--line); }
.feature-list dt { font-weight: 600; }
.feature-list dd { margin: 0; color: var(--muted); font-size: var(--fs-small); line-height: 1.6; }
@media (min-width: 720px) { .feature-list { grid-template-columns: 1fr 1fr; } }

.copy { display: grid; gap: var(--space-group); max-width: var(--measure); align-content: start; }
.copy p { color: var(--muted); }

.display { font-size: var(--fs-display); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.heading { font-size: var(--fs-heading); font-weight: 600; line-height: 1.3; }
.item-title { font-size: var(--fs-item); font-weight: 600; line-height: 1.4; }
.lead { font-size: var(--fs-body); }
.small { font-size: var(--fs-small); color: var(--muted); line-height: 1.6; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-item) var(--space-group); }

/* 화면 캡처 틀 */
.shot {
  margin: 0; aspect-ratio: 16 / 10; border: 1px solid var(--line); border-radius: var(--radius-panel);
  background: var(--surface); overflow: hidden;
  display: grid; place-items: center;
}
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.shot-empty { color: var(--muted); font-size: var(--fs-small); text-align: center; padding: var(--space-group); }

/* 하는 일 목록 */
.features { display: grid; gap: var(--space-section); margin-top: var(--space-section); }
.feature .copy { gap: var(--space-item); }

/* 정보판 */
.panel { background: var(--surface); border-radius: var(--radius-panel); padding: 32px; }
@media (max-width: 599px) { .panel { padding: 20px; } }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-item) var(--space-group); margin: 0; }
.facts dt { color: var(--muted); font-size: var(--fs-small); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

.disclosure { border: 1px solid var(--line-control); border-radius: var(--radius-control); }
.disclosure summary {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  cursor: pointer; list-style: none; font-size: var(--fs-small);
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary svg { transition: transform var(--transition); }
.disclosure[open] summary svg { transform: rotate(90deg); }
.disclosure .code {
  margin: 0; padding: 0 16px 16px; font: 400 var(--fs-meta)/1.6 var(--font-code);
  color: var(--ink); word-break: break-all; overflow-wrap: anywhere;
}

.notice { display: flex; gap: 10px; align-items: flex-start; color: var(--notice); font-size: var(--fs-small); }
.notice svg { flex: none; margin-top: 3px; }
.notice[hidden] { display: none; }

/* 순서 목록: 실제 설치 순서에만 번호를 쓴다 */
.steps { display: grid; gap: var(--space-group); margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 32px 1fr; gap: var(--space-item); counter-increment: step; }
.steps li::before {
  content: counter(step); font-weight: 600; font-variant-numeric: tabular-nums;
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid var(--line-control); border-radius: 50%; font-size: var(--fs-small);
}
.steps h3 { font-size: var(--fs-body); font-weight: 600; line-height: 1.9; }
.steps p { color: var(--muted); font-size: var(--fs-small); }

/* 바닥글 */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0 64px; color: var(--muted); font-size: var(--fs-small); }
.site-footer .wrap { display: grid; gap: var(--space-group); }
.site-footer nav ul { display: flex; flex-wrap: wrap; gap: var(--space-group); margin: 0; padding: 0; list-style: none; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
