/* mac-ai.mintdev.uk — 계측 실험실 디자인
   팔레트: 알루미늄 화이트 위 잉크, 실리콘 바이올렛 액센트, 판정 3색 */
:root {
  --bg: #f4f5f8;          /* 알루미늄 화이트 */
  --panel: #ffffff;
  --ink: #171a21;
  --muted: #5c6472;
  --line: #dde0e7;
  --accent: #5b3df5;      /* 실리콘 바이올렛 */
  --accent-soft: #ede9ff;
  --ok: #0e8f62;          /* 판정: 가능 */
  --ok-soft: #e2f5ec;
  --no: #c2412d;          /* 판정: 불가 */
  --no-soft: #fbe9e5;
  --cond: #a06a00;        /* 판정: 조건부 */
  --cond-soft: #faf0d8;
  --sans: "IBM Plex Sans KR", "Apple SD Gothic Neo", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: break-word;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--mono); }

/* ── 상단 내비게이션 ─────────────────────── */
.nav {
  display: flex; align-items: center; gap: 1.2rem;
  max-width: 1060px; margin: 0 auto; padding: 1.1rem 1.4rem;
}
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--mono); font-weight: 600; font-size: 1.05rem; }
.brand em { font-style: normal; font-family: var(--sans); font-weight: 400; color: var(--muted); font-size: .82rem; }
.die {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: .55rem;
  background: var(--accent); color: #fff;
  font-family: var(--mono); font-size: .8rem; font-weight: 600;
  box-shadow: 0 1px 0 rgba(23,26,33,.18), inset 0 1px 0 rgba(255,255,255,.28);
}
.die.sm { width: 1.35rem; height: 1.35rem; font-size: .55rem; border-radius: .4rem; }
.navlinks { margin-left: auto; display: flex; gap: .25rem; }
.navlinks a { padding: .35rem .8rem; border-radius: 99px; color: var(--muted); font-size: .95rem; }
.navlinks a:hover { color: var(--ink); background: #e9ebf1; }
.navlinks a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.navtoggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: .5rem; font-size: 1.1rem; padding: .2rem .6rem; cursor: pointer; color: var(--ink); }

main { max-width: 1060px; margin: 0 auto; padding: 0 1.4rem 4rem; }

/* ── 히어로 ─────────────────────────────── */
.hero {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 2.5rem; align-items: center;
  padding: 3.2rem 0 3rem;
}
.eyebrow {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .12em;
  color: var(--accent); text-transform: uppercase; margin-bottom: .9rem;
}
.hero h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); line-height: 1.28; font-weight: 700; letter-spacing: -.015em; }
.grad { color: var(--accent); }
.hero .lede { margin-top: 1.1rem; }
.lede { color: var(--muted); font-size: 1.02rem; max-width: 58ch; }

.readouts { display: flex; flex-wrap: wrap; gap: .6rem 2rem; margin-top: 1.7rem; }
.readouts b { display: block; font-size: 1.45rem; font-weight: 600; color: var(--ink); }
.readouts b i { font-style: normal; font-size: .8rem; color: var(--muted); margin-left: .15rem; }
.readouts span { font-size: .78rem; color: var(--muted); }

.hero-art svg { width: 100%; height: auto; display: block; }
.svgdie { font-family: var(--mono); font-size: 17px; font-weight: 600; fill: #fff; }
.svglabel { font-family: var(--mono); font-size: 11.5px; fill: #5c6472; }
.svgwire { font-family: var(--mono); font-size: 12px; fill: #5b3df5; font-weight: 600; }
/* 문서 내 구조 다이어그램 */
.diagram { margin: 1.3rem 0; }
.diagram svg { width: 100%; height: auto; display: block; }
.svgtitle { font-family: var(--sans); font-size: 15px; font-weight: 700; fill: #171a21; }
.svgsub { font-family: var(--mono); font-size: 10.5px; fill: #5c6472; }
.svgchip { fill: #ede9ff; }
.svgchipt { font-family: var(--mono); font-size: 11px; font-weight: 600; fill: #5b3df5; }
.wire { animation: wiredash 1.6s linear infinite; }
@keyframes wiredash { to { stroke-dashoffset: -13; } }

/* ── 홈 섹션 ────────────────────────────── */
.homesec { margin-top: 2.8rem; }
.sechead { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.sechead h2 { font-size: 1.25rem; font-weight: 700; }
.more { margin-left: auto; color: var(--accent); font-size: .9rem; font-weight: 500; }
.more:hover { text-decoration: underline; }
.secnote { color: var(--muted); max-width: 62ch; }

/* ── 로그 목록 ──────────────────────────── */
.loglist { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.logrow {
  display: flex; gap: 1.6rem; padding: 1.05rem .4rem;
  border-bottom: 1px solid var(--line); align-items: baseline;
}
.logrow:hover { background: #eceef4; }
.logrow .date { flex: 0 0 7.2rem; color: var(--accent); font-size: .85rem; font-weight: 500; }
.logbody b { display: block; font-weight: 600; }
.logbody span { color: var(--muted); font-size: .92rem; }

/* ── 카드 (정보/서비스) ──────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .9rem; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 1.15rem 1.25rem; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card.svc { border-left: 3px solid var(--accent); }
.golive { display: inline-block; margin-top: .5rem; color: var(--accent); font-size: .85rem; font-weight: 600; }
.card b { display: block; font-weight: 600; margin-bottom: .3rem; }
.card p { color: var(--muted); font-size: .9rem; line-height: 1.6; }

.infocat { margin-top: 2.2rem; }
.infocat h2 {
  font-family: var(--mono); font-size: .82rem; letter-spacing: .1em; color: var(--muted);
  border-bottom: 1px solid var(--line); padding-bottom: .5rem; margin-bottom: 1rem;
}

/* ── 문서 페이지 ────────────────────────── */
.pagehead { padding: 2.6rem 0 1.6rem; }
.pagehead h1 { font-size: 2rem; font-weight: 700; margin-bottom: .5rem; }

.doc { max-width: 800px; margin: 0 auto; padding-top: 2.6rem; }
.doc h1 { font-size: 1.85rem; line-height: 1.3; font-weight: 700; margin-bottom: .6rem; letter-spacing: -.01em; }
.doc .lede { margin-bottom: 1.4rem; }
.doc h2 { font-size: 1.32rem; font-weight: 700; margin: 2.4rem 0 .8rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.doc h3 { font-size: 1.08rem; font-weight: 600; margin: 1.6rem 0 .5rem; }
.doc p { margin: .8rem 0; }
.doc ul, .doc ol { margin: .8rem 0 .8rem 1.4rem; }
.doc li { margin: .3rem 0; }
.doc strong { font-weight: 600; }
.doc a { color: var(--accent); }
.doc a:hover { text-decoration: underline; }
.doc blockquote {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: .7rem 1.1rem; border-radius: 0 10px 10px 0; margin: 1rem 0;
  color: #3b3369; font-size: .95rem;
}
.doc blockquote p { margin: .2rem 0; }
.doc code {
  font-family: var(--mono); font-size: .86em;
  background: #e9ebf1; border-radius: 5px; padding: .1em .38em;
}
.doc pre {
  background: #1c1f27; color: #e6e8ee; border-radius: 12px;
  padding: 1rem 1.2rem; overflow-x: auto; margin: 1rem 0;
  font-size: .85rem; line-height: 1.6;
}
.doc pre code { background: none; padding: 0; color: inherit; font-size: 1em; }

/* 표 — 계측표 스타일 */
.doc table { width: 100%; border-collapse: collapse; margin: 1.1rem 0; font-size: .92rem; display: block; overflow-x: auto; }
.doc th {
  text-align: left; font-family: var(--mono); font-size: .74rem; letter-spacing: .06em;
  color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--ink);
  padding: .45rem .7rem .45rem 0; white-space: nowrap;
}
.doc td { border-bottom: 1px solid var(--line); padding: .55rem .7rem .55rem 0; vertical-align: top; }
.doc td:first-child { font-weight: 500; }

/* 판정 칩 */
.chip {
  display: inline-block; font-family: var(--mono); font-size: .72rem; font-weight: 600;
  padding: .1rem .55rem; border-radius: 99px; white-space: nowrap; vertical-align: 1px;
}
.chip.ok { color: var(--ok); background: var(--ok-soft); }
.chip.no { color: var(--no); background: var(--no-soft); }
.chip.cond { color: var(--cond); background: var(--cond-soft); }

/* 측정값 리드아웃 */
.rd { font-family: var(--mono); font-weight: 600; color: var(--accent); white-space: nowrap; }

.backlink { margin-top: 2.6rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.backlink a { color: var(--muted); font-size: .92rem; }
.backlink a:hover { color: var(--accent); }

/* 빈 상태 (서비스) */
.empty {
  background: var(--panel); border: 1px dashed var(--line); border-radius: 16px;
  padding: 1.8rem 2rem; margin-top: 1.4rem; max-width: 680px;
}
.empty .mono { color: var(--accent); font-size: .85rem; margin-bottom: .5rem; }
.empty ul { margin: .6rem 0 0 1.3rem; color: var(--muted); }

/* ── 채팅 데모 ──────────────────────────── */
.chatwrap { margin: 1.4rem 0; }
.chatmodels { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .9rem; }
.modelpill { cursor: pointer; }
.modelpill input { position: absolute; opacity: 0; }
.modelpill span {
  display: inline-block; padding: .45rem 1rem; border-radius: 99px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: .88rem; color: var(--muted); transition: all .15s;
}
.modelpill input:checked + span { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.modelpill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.msgs {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 1rem; height: 26rem; overflow-y: auto;
  display: flex; flex-direction: column; gap: .7rem;
}
.msg { display: flex; flex-direction: column; max-width: 85%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.bot { align-self: flex-start; align-items: flex-start; }
.bubble {
  padding: .55rem .9rem; border-radius: 14px; white-space: pre-wrap;
  font-size: .95rem; line-height: 1.65;
}
.msg.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot .bubble { background: #eef0f5; border-bottom-left-radius: 4px; white-space: normal; }
/* 봇 말풍선 내부 마크다운 렌더링 */
.msg.bot .bubble p { margin: .35rem 0; }
.msg.bot .bubble p:first-child { margin-top: 0; }
.msg.bot .bubble p:last-child { margin-bottom: 0; }
.msg.bot .bubble ul, .msg.bot .bubble ol { margin: .35rem 0 .35rem 1.2rem; }
.msg.bot .bubble li { margin: .15rem 0; }
.msg.bot .bubble h1, .msg.bot .bubble h2, .msg.bot .bubble h3, .msg.bot .bubble h4 {
  font-size: 1.02rem; font-weight: 700; margin: .7rem 0 .3rem; border: 0; padding: 0;
}
.msg.bot .bubble code {
  font-family: var(--mono); font-size: .84em;
  background: #dfe2ea; border-radius: 4px; padding: .05em .3em;
}
.msg.bot .bubble pre {
  background: #1c1f27; color: #e6e8ee; border-radius: 10px;
  padding: .7rem .9rem; overflow-x: auto; margin: .45rem 0; font-size: .82rem; line-height: 1.55;
}
.msg.bot .bubble pre code { background: none; padding: 0; color: inherit; }
.msg.bot .bubble table {
  border-collapse: collapse; margin: .45rem 0; font-size: .86rem;
  display: block; overflow-x: auto; max-width: 100%;
}
.msg.bot .bubble th {
  font-family: var(--mono); font-size: .72rem; color: var(--muted);
  border-bottom: 2px solid var(--ink); text-align: left; padding: .3rem .6rem .3rem 0; white-space: nowrap;
}
.msg.bot .bubble td { border-bottom: 1px solid var(--line); padding: .35rem .6rem .35rem 0; vertical-align: top; }
.msg.bot .bubble blockquote {
  border-left: 3px solid var(--accent); padding: .2rem .7rem; margin: .4rem 0;
  color: var(--muted);
}
.msg.bot .bubble hr { border: 0; border-top: 1px solid var(--line); margin: .6rem 0; }
.msg.bot .bubble a { color: var(--accent); text-decoration: underline; }
.cursor { animation: blink 1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.loadnote { color: var(--muted); font-size: .88rem; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.thinkbox {
  font-size: .78rem; color: var(--muted); margin-bottom: .3rem;
  border: 1px dashed var(--line); border-radius: 10px; padding: .3rem .7rem; max-width: 100%;
}
.thinkbox summary { cursor: pointer; font-family: var(--mono); }
.thinkbox pre { white-space: pre-wrap; margin-top: .4rem; max-height: 10rem; overflow-y: auto; font-family: var(--sans); }
.chatbar { display: flex; gap: .6rem; margin-top: .8rem; align-items: flex-end; }
.chatbar textarea {
  flex: 1; resize: none; font-family: var(--sans); font-size: .95rem;
  padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--ink); line-height: 1.5;
}
.chatbar textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.chatbtns { display: flex; flex-direction: column; gap: .4rem; }
.btn {
  padding: .45rem 1rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-size: .88rem; cursor: pointer; font-family: var(--sans);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.statline { font-size: .75rem; color: var(--muted); margin-top: .5rem; min-height: 1.2em; }
@media (max-width: 820px) {
  .msgs { height: 20rem; }
  .chatbar { flex-direction: column; align-items: stretch; }
  .chatbtns { flex-direction: row; }
}

/* ── VLM 데모 ───────────────────────────── */
.vlmwrap { margin: 1.4rem 0; }
.segtabs { display: flex; gap: .4rem; margin-bottom: 1rem; }
.segtab {
  padding: .45rem 1.1rem; border-radius: 99px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: .9rem; cursor: pointer; font-family: var(--sans);
}
.segtab.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.vlmpanel { margin-bottom: 1rem; }
.thumbrow { display: flex; gap: .7rem; flex-wrap: wrap; }
.thumbrow img {
  width: 130px; height: 96px; object-fit: cover; border-radius: 12px; cursor: pointer;
  border: 2px solid transparent; transition: border-color .15s, transform .15s;
}
.thumbrow img:hover { transform: translateY(-2px); }
.thumbrow img.sel { border-color: var(--accent); }
.vlmhint { font-size: .8rem; color: var(--muted); margin-top: .4rem; }
.upbox {
  display: block; border: 1.5px dashed var(--line); border-radius: 14px; padding: 1.4rem;
  text-align: center; color: var(--muted); font-size: .92rem; cursor: pointer; background: var(--panel);
}
.upbox:hover { border-color: var(--accent); color: var(--accent); }
.upbox input { display: none; }
#panel-camera video {
  width: 100%; max-width: 480px; border-radius: 14px; background: #1c1f27; display: block;
  aspect-ratio: 4/3; object-fit: cover;
}
.camrow { display: flex; align-items: center; gap: 1rem; margin-top: .6rem; }
.vlmmain { display: grid; grid-template-columns: 1fr 1.2fr; gap: 1rem; align-items: start; }
.vlmpreview {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  min-height: 200px; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.vlmpreview span { color: var(--muted); font-size: .85rem; padding: 1rem; }
.vlmpreview img { width: 100%; height: auto; display: block; }
.presetrow { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: .6rem; }
.chipbtn {
  font-family: var(--mono); font-size: .74rem; font-weight: 600; cursor: pointer;
  color: var(--accent); background: var(--accent-soft); border: 0; border-radius: 99px; padding: .3rem .8rem;
}
.chipbtn:hover { filter: brightness(.95); }
.vlmright textarea {
  width: 100%; resize: none; font-family: var(--sans); font-size: .95rem;
  padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--ink); line-height: 1.5;
}
.vlmright textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.vlmbtns { flex-direction: row; margin-top: .6rem; }
.vlmanswer {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 1rem 1.2rem; margin-top: 1rem; font-size: .95rem; line-height: 1.7;
}
.vlmanswer p { margin: .4rem 0; }
.vlmanswer ul, .vlmanswer ol { margin: .4rem 0 .4rem 1.3rem; }
.vlmanswer table { border-collapse: collapse; font-size: .88rem; display: block; overflow-x: auto; }
.vlmanswer th { border-bottom: 2px solid var(--ink); text-align: left; padding: .3rem .6rem .3rem 0; font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.vlmanswer td { border-bottom: 1px solid var(--line); padding: .35rem .6rem .35rem 0; }
@media (max-width: 820px) { .vlmmain { grid-template-columns: 1fr; } }

/* YOLO 데모 */
.chipbtn.scen { font-size: .8rem; padding: .4rem .95rem; opacity: .75; }
.chipbtn.scen.active { opacity: 1; outline: 2px solid var(--accent); }
.yoloview { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; margin-top: 1rem; align-items: start; }
.yolocanvaswrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  min-height: 220px; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.yolocanvas { width: 100%; height: auto; display: block; }
.yolocounts { display: flex; flex-wrap: wrap; gap: .45rem; }
.ycount {
  font-family: var(--mono); font-size: .82rem; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, white);
  border: 1px solid color-mix(in srgb, var(--c) 35%, white);
  border-radius: 99px; padding: .25rem .8rem;
}
@media (max-width: 820px) { .yoloview { grid-template-columns: 1fr; } }

/* 법령 RAG 데모 */
.ragblock { border-top: 2px solid var(--line); margin-top: 1.4rem; padding-top: 1.1rem; }
.ragq { font-weight: 700; font-size: 1.05rem; margin-bottom: .7rem; }
.ragq::before { content: "Q. "; color: var(--accent); font-family: var(--mono); }
.ragsrcs { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .8rem; }
.lawsrc {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: .45rem .9rem; font-size: .88rem;
}
.lawsrc summary { cursor: pointer; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.lawsrc .lsno { font-family: var(--mono); font-size: .7rem; color: var(--accent); }
.lawsrc .lsscore { font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-left: auto; }
.lawsrc pre {
  white-space: pre-wrap; font-family: var(--sans); font-size: .86rem; color: #3f4553;
  margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--line); line-height: 1.7;
}
.raga { font-size: .96rem; line-height: 1.75; }
.raga p { margin: .5rem 0; } .raga ul, .raga ol { margin: .5rem 0 .5rem 1.3rem; }
.ragstat { margin-top: .4rem; }
/* 위키 RAG 탐색 경로 */
.trail { display: flex; flex-direction: column; gap: .45rem; background: var(--panel);
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px;
  padding: .7rem 1rem; font-size: .85rem; }
.tstep { display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap; }
.tlabel { font-family: var(--mono); font-size: .72rem; color: var(--accent); flex: 0 0 7.5em; }
.tbody.kw { font-weight: 600; }
.tpage { display: inline-block; background: #e9ebf1; border-radius: 8px; padding: .12rem .55rem;
  margin: .1rem .25rem .1rem 0; font-size: .8rem; }
.tpage i { font-style: normal; color: var(--muted); font-family: var(--mono); font-size: .7rem; }
.tpage.exp { background: var(--accent-soft); color: #4a3fa3; }

/* ── 푸터 ───────────────────────────────── */
.foot { border-top: 1px solid var(--line); margin-top: 2rem; }
.foot p {
  max-width: 1060px; margin: 0 auto; padding: 1.6rem 1.4rem 2.2rem;
  color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: .6rem;
}
.hiddenlink { color: #c3c7d1; font-size: .8rem; text-decoration: none; margin-left: auto; }
.hiddenlink:hover { color: var(--accent); }

/* ── 반응형 ─────────────────────────────── */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 1.8rem; padding-top: 2rem; }
  .navtoggle { display: block; }
  .navlinks {
    display: none; position: absolute; top: 3.6rem; right: 1rem; z-index: 10;
    flex-direction: column; background: var(--panel); border: 1px solid var(--line);
    border-radius: 12px; padding: .5rem; box-shadow: 0 8px 24px rgba(23,26,33,.12);
  }
  .navlinks.open { display: flex; }
  .logrow { flex-direction: column; gap: .15rem; }
  .logrow .date { flex: none; }
}
