/* 공개 데모 쪽(`/demo/`, ADR 0188)의 컴포넌트 CSS — 색·글꼴·크기는 토큰(tokens.css)만 쓴다. 밝은 모드 하나(사이트 규칙, ADR 0086 결정 1).
   스크립트가 없으면 글마다 요약 · 상세 · 원문이 차례로 보이는 긴 쪽이고, site/demo.js가 `.demo-js`를 붙이면 앱처럼 목록 + 읽는 칸 + 탭 + 근거 창이 된다. */

.demo {
  padding-bottom: 0;
}

/* 첫 구획 — 작은 제목 알약은 랜딩과 같은 모양이다(랜딩 CSS를 읽지 않으므로 여기 둔다). */
.demo .eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--small-size);
  font-weight: 700;
}
.demo-hero {
  padding: 56px 0 32px;
}
.demo-hero .wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.demo-hero h1 {
  max-width: 24em;
  font-size: 40px;
  line-height: var(--heading-leading);
  font-weight: 800;
  letter-spacing: var(--heading-tracking);
}
.demo-lead {
  max-width: 40em;
  color: var(--text-2);
  font-size: 18px;
  line-height: 1.65;
}
.demo-how {
  max-width: 48em;
  color: var(--muted);
  font-size: var(--small-size);
  line-height: var(--small-leading);
}

/* 가입으로 가는 링크 줄 — 웹 버전(진한 주 행동) · Google Play 공식 배지 · 크롬 확장 */
.demo-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
}
.demo-store {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: 52px;
  padding: 8px 18px;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--text);
  line-height: 1.15;
  text-decoration: none;
}
.demo-store:hover {
  border-color: var(--text-2);
}
.demo-store-web,
.demo-store-ios {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--on-ink);
}
.demo-store-web:hover,
.demo-store-ios:hover {
  border-color: var(--ink-hover);
  background: var(--ink-hover);
}
.demo-store-small {
  font-size: var(--tiny-size);
  font-weight: 500;
}
.demo-store-big {
  font-size: 16px;
  font-weight: 700;
}
.demo-store-play {
  display: inline-flex;
  border-radius: var(--radius);
}
.demo-store-play img {
  width: auto;
  height: 60px;
}

/* 목록 + 읽는 칸 */
.demo-app {
  display: grid;
  gap: 24px;
  padding-top: 16px;
  padding-bottom: 64px;
}
.demo-list-title {
  margin-bottom: 12px;
  font-size: var(--h3-size);
  line-height: var(--heading-leading);
}
.demo-items {
  display: grid;
  gap: 4px;
  padding: 0;
  list-style: none;
}
.demo-items a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: var(--touch);
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.demo-items a:hover {
  background: var(--surface);
}
.demo-items a[aria-current="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}
.demo-item-title {
  font-weight: 700;
  line-height: 1.4;
}
.demo-item-meta {
  color: var(--muted);
  font-size: var(--small-size);
}
.demo-item-match {
  align-self: flex-start;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--tiny-size);
  font-weight: 600;
}

/* 찾기(스크립트가 입력란을 만든다) */
.demo-search:empty {
  display: none;
}
.demo-search {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.demo-search label {
  color: var(--text-2);
  font-size: var(--small-size);
  font-weight: 600;
}
.demo-search input {
  width: 100%;
  min-height: var(--control);
  padding: 10px 14px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--text);
  font: inherit;
}
.demo-search input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
.demo-search-count {
  min-height: 1.5em;
  color: var(--muted);
  font-size: var(--small-size);
}

/* 글 하나 */
.demo-article {
  display: grid;
  gap: 24px;
  margin-bottom: 32px;
  padding: 28px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  background: var(--canvas);
  box-shadow: var(--shadow-card);
}
.demo-article-head {
  display: grid;
  gap: 8px;
}
.demo-article-kind {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--small-size);
}
.demo-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.demo-article h2 {
  font-size: var(--h2-size);
  line-height: var(--heading-leading);
  letter-spacing: var(--heading-tracking);
}
.demo-article-meta {
  color: var(--muted);
  font-size: var(--small-size);
}
.demo-own {
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text);
  font-size: var(--small-size);
  font-weight: 600;
}

/* 구획(요약 · 상세 · 원문) */
.demo-panel {
  display: grid;
  gap: 16px;
}
.demo-panel > h3 {
  font-size: var(--h3-size);
  line-height: var(--heading-leading);
}
.demo-js-only {
  display: none;
}
.demo-js .demo-js-only {
  display: block;
}
.demo-tip {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text-2);
  font-size: var(--small-size);
}
.demo-points,
.demo-slot ul {
  display: grid;
  gap: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.demo-sentence,
.demo-block {
  padding: 14px 18px;
  line-height: 1.65;
}
.demo-sentence + .demo-sentence,
.demo-sentence + .demo-block,
.demo-block + .demo-sentence,
.demo-block + .demo-block {
  border-top: 1px solid var(--stroke);
}
.demo-points .demo-sentence {
  font-weight: 600;
}
.demo-preview .demo-sentence {
  font-weight: 400;
}
.demo-preview-title {
  color: var(--text-2);
  font-size: 15px;
  font-weight: 700;
}
.demo-js .demo-text {
  cursor: pointer;
}
.demo-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--on-ink);
  font-size: var(--tiny-size);
  font-weight: 700;
  vertical-align: 2px;
}
.demo-caveat .demo-text {
  color: var(--warning);
}
.demo-ev {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  padding: 1px 8px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-pill);
  color: var(--accent);
  font-size: var(--tiny-size);
  font-weight: 700;
  white-space: nowrap;
  vertical-align: 1px;
}
.demo-ev:hover {
  background: var(--accent-soft);
}
.demo-slot {
  display: grid;
  gap: 10px;
}
.demo-slot h4 {
  color: var(--text-2);
  font-size: 15px;
  font-weight: 700;
}
.demo-slot-heading {
  color: var(--muted);
  font-weight: 500;
}
.demo-slot-heading::before {
  content: "· ";
}
/* 일반 칸은 칸 이름 없이 원문 묶음 제목만 제목 줄이 된다(앱과 같은 규칙) — 앞 점 없이 제목처럼. */
.demo-slot-heading-only {
  color: var(--text-2);
  font-weight: 700;
}
.demo-slot-heading-only::before {
  content: none;
}
.demo-verbatim {
  display: grid;
  gap: 2px;
  margin-bottom: 6px;
  padding: 10px 14px;
  border-left: 3px solid var(--stroke-strong);
  border-radius: var(--radius-sm);
  background: var(--canvas);
  white-space: pre-wrap;
}
.demo-empty,
.demo-note {
  color: var(--muted);
  font-size: var(--small-size);
}

/* 원문 */
.demo-attribution {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--small-size);
  line-height: var(--small-leading);
  list-style: none;
}
.demo-label {
  color: var(--muted);
  font-weight: 700;
}
.demo-attribution a {
  color: var(--accent);
}
.demo-source {
  display: grid;
  gap: 12px;
  max-width: var(--wide-measure);
  color: var(--text);
  line-height: var(--leading);
  overflow-wrap: anywhere;
}
.demo-src-heading {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 700;
}
.demo-source mark {
  border-radius: 3px;
  background: var(--accent-soft);
  color: inherit;
  box-shadow: inset 0 -2px 0 var(--accent);
}
.demo-anchor:target + mark {
  background: var(--accent-line);
}
.demo-source mark.is-flash {
  background: var(--accent-line);
}
.demo-anchor {
  scroll-margin-top: 120px;
}

/* 근거 창(스크립트가 만든다) — 앱의 「원문에서」 시트처럼 아래에서 올라온다. */
.demo-evidence {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 30;
  display: grid;
  gap: 12px;
  max-width: 640px;
  max-height: min(70vh, 560px);
  margin: 0 auto;
  padding: 20px 22px;
  overflow: auto;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius-lg);
  background: var(--canvas);
  box-shadow: var(--shadow-phone);
}
.demo-evidence[hidden] {
  display: none;
}
.demo-evidence-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.demo-evidence-head h2 {
  font-size: 18px;
}
.demo-evidence-sentence {
  color: var(--text-2);
  font-size: var(--small-size);
}
.demo-evidence blockquote {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  white-space: pre-wrap;
}
.demo-evidence-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.demo-evidence button,
.demo-tab {
  min-height: var(--touch);
  padding: 8px 14px;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.demo-evidence button:hover,
.demo-tab:hover {
  border-color: var(--text-2);
}
.demo-evidence .demo-evidence-go {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

/* 스크립트가 있을 때: 목록 + 읽는 칸, 탭, 한 번에 글 하나 */
.demo-js .demo-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--stroke);
}
.demo-js .demo-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-2);
}
.demo-js .demo-tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--accent);
}
.demo-js .demo-panel > h3 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.demo-js .demo-panel[hidden],
.demo-js .demo-article[hidden],
.demo-js .demo-items li[hidden] {
  display: none;
}
.demo-js .demo-article {
  margin-bottom: 0;
}
@media (min-width: 1000px) {
  /* 넓은 화면에서는 근거 창을 읽는 칸 쪽(오른쪽)에 둔다 — 목록을 가리지 않는다. */
  .demo-evidence {
    right: max(16px, calc((100vw - var(--frame)) / 2));
    left: auto;
    width: min(560px, calc(100vw - 32px));
  }
  .demo-js .demo-app {
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    align-items: start;
    gap: 32px;
  }
  .demo-js .demo-list {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
}

/* 아래 띠 — 내가 읽는 글로 해 보기 */
.demo-download {
  padding: 56px 0;
  background: var(--ink);
  color: var(--on-ink);
}
.demo-download .wrap {
  display: grid;
  justify-items: start;
  gap: 14px;
}
.demo-download h2 {
  font-size: var(--h1-size);
  line-height: var(--heading-leading);
}
.demo-download p {
  max-width: 40em;
  color: var(--on-ink-muted);
}
.demo-download .demo-store {
  border-color: var(--on-ink-stroke);
  background: transparent;
  color: var(--on-ink);
}
.demo-download .demo-store-web,
.demo-download .demo-store-ios {
  border-color: var(--on-ink);
  background: var(--on-ink);
  color: var(--ink);
}
.demo-download a.demo-guide {
  color: var(--on-ink);
}
.demo-ev,
.demo-download a.demo-guide {
  text-decoration: none;
}
.demo-download :focus-visible {
  outline-color: var(--on-ink);
}

/* 이 데모에 대해 */
.demo-about {
  padding: 40px 0 56px;
}
.demo-about .wrap {
  display: grid;
  gap: 10px;
}
.demo-about h2 {
  font-size: var(--h3-size);
}
.demo-about p {
  max-width: 52em;
  color: var(--text-2);
  font-size: var(--small-size);
  line-height: var(--small-leading);
}

/* 좁은 화면 */
@media (max-width: 640px) {
  .demo-hero {
    padding-top: 32px;
  }
  .demo-hero h1 {
    font-size: 30px;
  }
  .demo-lead {
    font-size: 17px;
  }
  .demo-article {
    padding: 18px 16px;
  }
  .demo-sentence,
  .demo-block {
    padding: 12px 14px;
  }
  .demo-store-play img {
    height: 52px;
  }
}

/* iOS(WebKit)는 받을 수 없는 Play 배지·크롬 확장과 확인 전인 iPhone 웹 대신 「PC 웹으로 시작」(시작하기의 PC 웹 안내)만 둔다(랜딩과 같은 규칙, ADR 0177·0187). */
.demo-store-ios {
  display: none;
}
@supports (-webkit-touch-callout: none) {
  .demo-store-web,
  .demo-store-play,
  .demo-store-ext {
    display: none;
  }
  .demo-store-ios {
    display: inline-flex;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .demo-source mark {
    transition: background-color 0.4s var(--ease-out);
  }
}
