/* ============================================================
   에이전트 사무실 (office.html) — v2-shared.css 토큰 위에 얹는다
   모바일 우선 · 다크 기본 · [data-theme="light"] 대응 · 움직임 줄이기 존중
   ============================================================ */
:root {
  --of-room: #0D1815;
  --of-room-hi: #12201C;
  --of-wall: #2C3F38;
  --of-grid: rgba(255,255,255,0.025);
  --of-wood: #6B5538;
  --of-wood-dark: #54422B;
  --of-metal: #3A4A46;
  --of-screen: #08110E;
  --of-sofa: #3C5A7A;
  --of-plant: #3E8E5A;
  --of-skin: #F0C9A4;
  --of-hair: #2B2420;
  --of-night-room: #070D16;
  --of-night-wall: #1A2636;
}
[data-theme="light"] {
  --of-room: #F5F7F8;
  --of-room-hi: #FFFFFF;
  --of-wall: #D5DCE1;
  --of-grid: rgba(0,0,0,0.035);
  --of-wood: #C9A977;
  --of-wood-dark: #A98A5C;
  --of-metal: #9AA7B0;
  --of-screen: #1C2730;
  --of-sofa: #7FA6D0;
  --of-plant: #4CA36B;
  --of-night-room: #DDE3EC;
  --of-night-wall: #B8C3D3;
}

body.of-page { padding-top: 64px; overflow-x: hidden; }

.of-skip {
  position: absolute; left: 12px; top: -60px; z-index: 500;
  background: var(--primary); color: var(--primary-ink);
  padding: 10px 14px; border-radius: 10px; font-weight: 800;
}
.of-skip:focus { top: 76px; }
.of-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.of-main { max-width: 1180px; margin: 0 auto; padding: 0 16px 64px; }
.of-main section { padding: 0; }
.of-main section::before { display: none; }

/* ---------- 머리말 ---------- */
.of-main .of-hero { padding: 32px 0 16px; background: none; text-align: left; }
.of-hero::before { display: none; }
.of-hero .page-hero-badge { margin-bottom: 14px; }
.of-hero h1 { font-size: clamp(26px, 6vw, 44px); font-weight: 900; line-height: 1.2; margin-bottom: 12px; }
.of-hero h1 .accent { color: var(--primary); }
.of-lead { font-size: 15.5px; color: var(--ink2); line-height: 1.65; max-width: 720px; }
.of-notice {
  margin-top: 12px; max-width: 720px;
  font-size: 13.5px; line-height: 1.6; color: var(--gray);
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft);
}
.of-notice strong { color: var(--ink2); }

/* ---------- 시계·둘러보기 막대 ---------- */
.of-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin: 14px 0 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg-soft);
}
.of-clock { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--gray); }
.of-clock b { font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.of-daynight { font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink2); }
.of-daynight.is-night { color: #9DB8FF; border-color: rgba(157,184,255,0.4); }
[data-theme="light"] .of-daynight.is-night { color: #3555B0; border-color: rgba(53,85,176,0.35); }
.of-tl { display: flex; align-items: center; gap: 8px; flex: 1 1 240px; min-width: 0; }
.of-tl label { font-size: 13px; font-weight: 700; color: var(--ink2); white-space: nowrap; }
.of-tl input[type=range] { flex: 1; min-width: 0; accent-color: var(--primary); height: 28px; }
.of-btn {
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  padding: 8px 12px; min-height: 40px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-card); color: var(--ink);
}
.of-btn:hover { border-color: var(--primary); }
.of-btn--primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); font-weight: 800; }
.of-btn--primary:hover { background: var(--primary-dark); }
.of-page button:focus-visible, .of-page a:focus-visible, .of-page input:focus-visible {
  outline: 3px solid var(--primary); outline-offset: 2px;
}

/* ---------- 평면도 ---------- */
.office {
  display: grid; gap: 8px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "ceo cs"
    "work work"
    "meet server"
    "lounge pantry";
  padding: 8px; border-radius: 18px;
  background: var(--of-wall);
  transition: background .6s;
}
.room {
  position: relative; min-width: 0;
  display: flex; flex-direction: column;
  background-color: var(--of-room);
  background-image: linear-gradient(var(--of-grid) 1px, transparent 1px), linear-gradient(90deg, var(--of-grid) 1px, transparent 1px);
  background-size: 22px 22px;
  border-radius: 12px; padding: 8px 8px 10px;
  transition: background-color .6s, opacity .25s, box-shadow .25s;
}
.room--ceo { grid-area: ceo; }
.room--cs { grid-area: cs; }
.room--work { grid-area: work; }
.room--meet { grid-area: meet; }
.room--server { grid-area: server; }
.room--lounge { grid-area: lounge; }
.room--pantry { grid-area: pantry; }
.room--ceo, .room--lounge { background-image: repeating-linear-gradient(90deg, rgba(160,120,70,0.08) 0 18px, rgba(160,120,70,0.03) 18px 36px); }
.room--pantry { background-image: linear-gradient(45deg, var(--of-grid) 25%, transparent 25%, transparent 75%, var(--of-grid) 75%), linear-gradient(45deg, var(--of-grid) 25%, transparent 25%, transparent 75%, var(--of-grid) 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.room--cs { box-shadow: inset 0 0 0 1.5px rgba(var(--primary-rgb), 0.35); }

.room-label {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; font-weight: 800; color: var(--ink);
  background: var(--bg-card); border: 1px solid var(--line);
  padding: 5px 10px; min-height: 32px; border-radius: 999px; cursor: pointer;
}
.room-label:hover { border-color: var(--primary); }
.room-label .rc {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; background: rgba(var(--primary-rgb), 0.15); color: var(--primary);
}
.room-label[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.room-label[aria-pressed="true"] .rc { background: rgba(0,0,0,0.18); color: inherit; }
.room-art { width: 100%; height: 44px; margin: 6px 0 2px; display: block; }
.room-people { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-content: flex-start; flex: 1; min-height: 40px; }
.room-cta { margin-top: 6px; align-self: stretch; }

/* 방 강조 */
.office[data-focus] .room { opacity: .42; }
.office[data-focus] .room.is-focus { opacity: 1; box-shadow: 0 0 0 2px var(--primary), 0 0 24px rgba(var(--primary-rgb), .25); }
.office[data-focus] .room.is-focus .p-token { background: rgba(var(--primary-rgb), .08); border-color: rgba(var(--primary-rgb), .45); }

/* 가구 그림 공통 색 */
.f-wood { fill: var(--of-wood); } .f-wood-d { fill: var(--of-wood-dark); }
.f-metal { fill: var(--of-metal); } .f-scr { fill: var(--of-screen); }
.f-sofa { fill: var(--of-sofa); } .f-plant { fill: var(--of-plant); }
.f-pri { fill: var(--primary); } .f-yel { fill: var(--accent-yellow); }
.f-cup { fill: #EDE6D8; } .f-win { fill: rgba(140,190,255,0.25); }
.s-steam { fill: none; stroke: var(--gray); stroke-width: 1.6; stroke-linecap: round; opacity: .7; }
.led { fill: var(--primary); }
.led2 { fill: var(--accent-yellow); }

/* ---------- 팀 책상 ---------- */
.desks {
  display: grid; gap: 6px; margin-top: 8px;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}
.desk {
  display: flex; flex-direction: column; align-items: center;
  background: var(--of-room-hi); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px 4px 6px; min-width: 0; transition: border-color .3s;
}
.desk-seat { min-height: 104px; display: flex; align-items: flex-end; justify-content: center; width: 100%; }
.desk-away { display: none; font-size: 11.5px; color: var(--gray); padding: 0 0 6px; }
.desk.is-away .desk-away { display: block; }
.desk.is-away .desk-seat { min-height: 0; }
.desk.is-away { justify-content: flex-end; }
.desk-art { width: 88px; height: 36px; display: block; }
.desk-name { font-size: 11.5px; font-weight: 700; color: var(--gray); text-align: center; line-height: 1.3; margin-top: 2px; }
.d-top { fill: var(--of-wood); } .d-leg { fill: var(--of-wood-dark); }
.d-mon { fill: var(--of-metal); } .d-scr { fill: var(--of-screen); } .d-stand { fill: var(--of-metal); }
.desk.is-on { border-color: rgba(var(--primary-rgb), .55); }
.desk.is-on .d-scr { fill: var(--primary); opacity: .85; animation: of-scr 1.8s ease-in-out infinite; }
.desk.is-on .desk-name { color: var(--primary); }
.room-people--work { margin-top: 6px; min-height: 0; }

/* ---------- 사람·로봇 ---------- */
.p-token {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  width: 76px; padding: 4px 2px 6px;
  font: inherit; color: inherit; text-align: center; cursor: pointer;
  background: transparent; border: 1.5px solid transparent; border-radius: 12px;
  transition: background .2s, border-color .2s;
}
.p-token:hover { background: rgba(var(--primary-rgb), .07); border-color: var(--line); }
.p-av {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(var(--primary-rgb), .08);
  display: flex; align-items: center; justify-content: center;
}
.p-av svg { width: 46px; height: 46px; display: block; overflow: visible; }
.p-name { font-size: 12.5px; font-weight: 800; line-height: 1.25; margin-top: 2px; }
.p-role { font-size: 10.5px; color: var(--gray); line-height: 1.25; overflow-wrap: anywhere; }
.p-status {
  margin-top: 3px; max-width: 100%;
  font-size: 10.5px; line-height: 1.3; color: var(--ink2);
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 8px; padding: 2px 5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mode-work .p-status, .mode-on .p-status { border-color: rgba(var(--primary-rgb), .55); color: var(--primary); }
.mode-rest .p-status { border-color: rgba(212,168,71,.45); color: var(--accent-yellow); }

.p-av .fx, .csw-av .fx { opacity: 0; }
.mode-work .fx-dots, .mode-on .fx-dots { opacity: 1; }
.mode-work .fx-dots circle, .mode-on .fx-dots circle { animation: of-dot 1.2s ease-in-out infinite; }
.mode-work .fx-dots circle:nth-child(2), .mode-on .fx-dots circle:nth-child(2) { animation-delay: .2s; }
.mode-work .fx-dots circle:nth-child(3), .mode-on .fx-dots circle:nth-child(3) { animation-delay: .4s; }
.fx-dots circle { fill: var(--primary); }
.mode-rest .fx-cup { opacity: 1; }
.mode-rest .fx-cup .s-steam { animation: of-steam 2.4s ease-in-out infinite; }
.mode-idle .fx-zz, .mode-off .fx-zz { opacity: .8; }
.fx-zz text { fill: var(--gray); font-family: Pretendard, sans-serif; font-weight: 800; }
.mode-idle .fx-zz text, .mode-off .fx-zz text { animation: of-zz 3.2s ease-in-out infinite; }
.p-av .head { transform-box: fill-box; transform-origin: 50% 100%; }
.mode-work .head { animation: of-bob 1.6s ease-in-out infinite; }
.mode-on .p-av svg { animation: of-roll 2.2s ease-in-out infinite; }
.p-av .bulb { fill: var(--gray2); }
.mode-on .bulb { fill: var(--primary); animation: of-blink 1s steps(2) infinite; }
.p-av .eye { fill: #CFE9E2; }
.mode-off .eye { fill: #6F8580; }

/* 사진 아바타(사람 7명) — 원형 크롭 + 상태 테두리. 로드 실패하면 .ph-fail 로 기존 SVG(.ph-fb) 표시 */
.ph-wrap { position: relative; display: block; width: 100%; height: 100%; }
.ph-img { display: block; width: 100%; height: 100%; box-sizing: border-box; border-radius: 50%; object-fit: cover; object-position: 50% 30%; border: 2px solid var(--line); background: var(--bg-soft); }
/* 로봇 사진은 배경이 어두워 기본 테두리를 조금 밝게(상태 테두리는 아래 규칙이 덮어씀) */
.ph-img[src*="robot-"] { border-color: rgba(255,255,255,.3); }
.mode-work .ph-img, .mode-on .ph-img { border-color: var(--primary); }
.mode-rest .ph-img { border-color: var(--accent-yellow); }
.ph-wrap .ph-fx { position: absolute; left: 0; top: 0; pointer-events: none; filter: drop-shadow(0 0 1.5px rgba(0,0,0,.65)); }
.ph-wrap .ph-fb { display: none; width: 100%; height: 100%; }
.ph-wrap.ph-fail .ph-fb { display: block; }
.ph-wrap.ph-fail .ph-img, .ph-wrap.ph-fail .ph-fx { display: none; }
.of-credit { margin: 10px 2px 0; font-size: 12px; line-height: 1.5; color: var(--gray); }

@keyframes of-dot { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes of-steam { 0% { opacity: 0; transform: translateY(2px); } 40% { opacity: .8; } 100% { opacity: 0; transform: translateY(-4px); } }
@keyframes of-zz { 0%, 100% { opacity: .2; transform: translateY(1px); } 50% { opacity: .9; transform: translateY(-2px); } }
@keyframes of-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(1px) rotate(2deg); } }
@keyframes of-roll { 0%, 100% { transform: translateX(-1px); } 50% { transform: translateX(1px); } }
@keyframes of-blink { 0% { opacity: 1; } 100% { opacity: .25; } }
@keyframes of-scr { 0%, 100% { opacity: .55; } 50% { opacity: .95; } }
@keyframes of-led { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.led { animation: of-led 1.4s steps(2) infinite; }
.led:nth-of-type(2n) { animation-delay: .5s; }
.s-steam { animation: of-steam 2.6s ease-in-out infinite; }

/* ---------- 밤 (19~05시) ---------- */
.office.is-night { background: var(--of-night-wall); }
.office.is-night .room { background-color: var(--of-night-room); }
.office.is-night .desk { background: var(--of-night-room); }
.office.is-night .desk.is-on { box-shadow: 0 -10px 24px -8px rgba(var(--primary-rgb), .45) inset; }
.office.is-night .f-win { fill: rgba(30,50,110,0.55); }
.of-night-note { display: none; font-size: 12.5px; color: var(--ink2); margin: 0 0 8px; }
.of-night-note.is-on { display: block; }

/* ---------- 지금 누가 무엇을 ---------- */
.of-sec { margin-top: 28px; }
.of-sec h2 { font-size: clamp(19px, 4.4vw, 24px); font-weight: 800; margin-bottom: 10px; letter-spacing: -0.6px; }
.of-sec p.of-desc { font-size: 13.5px; color: var(--gray); line-height: 1.6; margin-bottom: 12px; }
.roster { list-style: none; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.roster-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  font: inherit; color: inherit; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px;
}
.roster-btn:hover { border-color: var(--primary); }
.roster-btn .p-av { width: 40px; height: 40px; flex: none; }
.roster-btn .p-av svg { width: 40px; height: 40px; }
.roster-txt { min-width: 0; flex: 1; }
.roster-name { font-size: 14px; font-weight: 800; line-height: 1.3; }
.roster-name small { font-size: 12px; font-weight: 600; color: var(--gray); margin-left: 4px; }
.roster-st { font-size: 12.5px; color: var(--ink2); line-height: 1.4; overflow-wrap: anywhere; }
.roster-room { font-size: 11.5px; color: var(--gray); }
.roster-go { flex: none; font-size: 12px; font-weight: 700; color: var(--primary); }

.of-rules { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); list-style: none; }
.of-rules li { font-size: 13px; color: var(--ink2); line-height: 1.6; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.of-rules strong { color: var(--ink); display: block; font-size: 13.5px; margin-bottom: 2px; }

/* ---------- 넓은 화면 ---------- */
@media (min-width: 640px) {
  .of-main { padding: 0 24px 80px; }
  .office {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      "ceo meet cs"
      "work work work"
      "server lounge pantry";
    padding: 10px; gap: 10px;
  }
  .p-token { width: 84px; }
  .desks { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .of-main .of-hero { padding-top: 44px; }
  .office {
    grid-template-columns: 1fr 1.25fr 1.25fr 1.1fr;
    grid-template-areas:
      "ceo work work cs"
      "meet work work cs"
      "server lounge pantry cs";
  }
  .room-art { height: 52px; }
  .desks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 400px) {
  .p-token { width: 68px; }
  .p-av, .p-av svg { width: 40px; height: 40px; }
  .desks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .desk-seat { min-height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  .of-page *, .of-page *::before, .of-page *::after { animation: none !important; transition: none !important; }
  .mode-work .fx-dots, .mode-on .fx-dots, .mode-rest .fx-cup { opacity: 1; }
}
