/* =========================================================
   RHINE LAB // Personnel Archive — style.css
   遵循 STYLE_GUIDE.md
   ========================================================= */
:root,
[data-theme="light"] {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #E9EBEF;
  --ink: #111215;
  --ink-2: #4A4E57;
  --muted: #8A8F99;
  --line: rgba(17, 18, 21, .12);
  --line-strong: #111215;
  --accent: #F59E0B;
  --accent-ink: #111215;
  --ok: #10B981;
  --warn: #F59E0B;
  --alert: #E11D48;
  --cyan: #0EA5E9;
  --shadow: 0 1px 0 rgba(17, 18, 21, .04), 0 12px 32px -18px rgba(17, 18, 21, .25);
  --cut: 14px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0E0F12;
  --surface: #16181D;
  --surface-2: #1E2127;
  --ink: #E8EAED;
  --ink-2: #A3A8B3;
  --muted: #6B7280;
  --line: rgba(232, 234, 237, .10);
  --line-strong: #E8EAED;
  --accent: #FFE600;
  --accent-ink: #111215;
  --ok: #00E5B0;
  --warn: #F5A623;
  --alert: #FF3D71;
  --cyan: #22BBFF;
  --shadow: none;
  color-scheme: dark;
}

html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body { transition: background-color .3s, color .3s; overflow-x: hidden; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- 背景网格 ---------- */
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    radial-gradient(var(--line) 1px, transparent 1.2px);
  background-size: 48px 48px, 48px 48px, 8px 8px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 85%);
  opacity: .9;
}
.guide-lines {
  position: fixed; top: 0; bottom: 0; left: 50%; z-index: 0; pointer-events: none;
  width: min(1280px, 100%); transform: translateX(-50%);
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
@media (max-width: 1023px) { .guide-lines { display: none; } }

/* ---------- 切角 ---------- */
.cut-2, .cut-card {
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
.cut-card { --cut: 18px; }
.cut-btn { --cut: 10px; clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut))); }
.cut-sm { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%); }
.cut-br { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%); }

/* ---------- 顶部遥测栏 ---------- */
.telemetry {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.calib-bar { display: flex; height: 2px; }
.calib-bar i { flex: 1; }
.calib-bar i:nth-child(1), .calib-mini i:nth-child(1) { background: #FF00AA; }
.calib-bar i:nth-child(2), .calib-mini i:nth-child(2) { background: #FFE600; }
.calib-bar i:nth-child(3), .calib-mini i:nth-child(3) { background: #00E5B0; }
.calib-bar i:nth-child(1) { flex: .06; }
.calib-bar i:nth-child(2) { flex: .1; }
.calib-bar i:nth-child(3) { flex: .04; }
.calib-bar::after { content: ""; flex: .8; }
.calib-mini { display: flex; width: 72px; height: 3px; }
.calib-mini i { flex: 1; }

.rl-logo { color: var(--ink); }
.rl-ring { transform-origin: 32px 32px; animation: spin 18s linear infinite; }
.rl-hex { transform-origin: 32px 32px; animation: hexPulse 4s ease-in-out infinite; }
.rl-core { transform-origin: 32px 32px; animation: corePulse 2.4s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes hexPulse { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(.92) rotate(30deg); } }
@keyframes corePulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.6); opacity: .6; } }

.nav-link { position: relative; padding: 4px 0; transition: color .2s; }
.nav-link::after { content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 0; background: var(--accent); transition: width .25s; }
.nav-link:hover, .nav-link.active { color: var(--ink); }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }

.status-led {
  display: inline-block; width: 8px; height: 8px; background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
  animation: led 1.6s ease-in-out infinite;
}
.status-led.sm-led { width: 6px; height: 6px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 22%, transparent); }
@keyframes led { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.theme-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 10px;
  background: var(--ink); color: var(--bg); font-weight: 600; letter-spacing: .16em;
  transition: background .2s, color .2s;
}
.theme-btn:hover { background: var(--accent); color: var(--accent-ink); }
.theme-label-dark, [data-theme="dark"] .theme-label-light { display: none; }
[data-theme="dark"] .theme-label-dark { display: inline; }
.ico-moon, [data-theme="dark"] .ico-sun { display: none; }
[data-theme="dark"] .ico-moon { display: inline; }

/* ---------- 侧轨 ---------- */
.side-rail {
  position: fixed; right: 18px; top: 50%; transform: translateY(-50%); z-index: 30;
  flex-direction: column; align-items: center; gap: 14px; writing-mode: vertical-rl;
}
.rail-bar { display: block; width: 1px; height: 120px; background: var(--line); position: relative; }
.rail-bar i { position: absolute; left: -1px; top: 0; width: 3px; height: 0; background: var(--accent); transition: height .15s; }

/* ---------- Hero ---------- */
.section { position: relative; }
.display { font-size: clamp(3.2rem, 9vw, 8.5rem); line-height: .85; letter-spacing: -.04em; }
.outline-text { color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.h2 { font-size: clamp(1.75rem, 3.2vw, 2.75rem); letter-spacing: -.01em; line-height: 1; }

.rec { display: inline-flex; align-items: center; gap: 6px; color: var(--alert); }
.rec i { width: 7px; height: 7px; background: var(--alert); animation: rec 1s steps(2) infinite; }
@keyframes rec { 50% { opacity: 0; } }

.terminal { background: var(--line-strong); padding: 1px; max-width: 640px; }
.terminal-inner { background: var(--surface); padding: 14px 18px 16px; clip-path: inherit; }
.caret { color: var(--accent); animation: blink 1s step-end infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }

.btn-primary {
  display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 22px;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px;
  transition: background .2s, color .2s, transform .2s;
}
.btn-primary:hover { background: var(--accent); color: var(--accent-ink); transform: translateX(2px); }
.btn-ghost {
  display: inline-flex; align-items: center; height: 46px; padding: 0 20px;
  border: 1px solid var(--line-strong); font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px; letter-spacing: .2em; transition: background .2s, color .2s;
}
.btn-ghost:hover { background: var(--ink); color: var(--bg); }

/* ---------- 档案卡 ---------- */
.profile-card { position: relative; background: var(--line-strong); padding: 1px; box-shadow: var(--shadow); outline: none; transition: background .25s; }
.profile-card:hover, .profile-card:focus-visible { background: var(--accent); }
.profile-inner { position: relative; overflow: hidden; background: var(--surface); padding: 22px; }
.scanline {
  position: absolute; left: 0; right: 0; top: -10%; height: 2px; background: var(--accent);
  box-shadow: 0 0 12px 2px color-mix(in srgb, var(--accent) 60%, transparent);
  opacity: 0; pointer-events: none;
}
.crt {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: repeating-linear-gradient(0deg, var(--ink) 0 1px, transparent 1px 3px);
}
.profile-card:hover .scanline, .profile-card:focus-visible .scanline { animation: scan 1.6s linear infinite; opacity: 1; }
.profile-card:hover .crt, .profile-card:focus-visible .crt { opacity: .05; }
@keyframes scan { from { top: -2%; } to { top: 102%; } }

.avatar-frame { position: relative; width: 92px; height: 112px; padding: 4px; border: 1px solid var(--line); }
.avatar-frame img, .avatar-frame svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.af { position: absolute; width: 10px; height: 10px; border-color: var(--line-strong); border-style: solid; }
.af.tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.af.tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.af.bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.af.br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.tag {
  display: inline-block; padding: 3px 7px; font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9.5px; letter-spacing: .14em; border: 1px solid var(--line); color: var(--ink-2);
}
.tag-accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

.social {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px;
  border: 1px solid var(--line); font-size: 12px; transition: border-color .2s, background .2s;
}
.social span {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px;
  background: var(--ink); color: var(--bg); font-family: "JetBrains Mono", monospace; font-size: 10px; font-weight: 600;
}
.social:hover { border-color: var(--line-strong); background: var(--surface-2); }
.social:hover span { background: var(--accent); color: var(--accent-ink); }

.barcode {
  width: 84px; height: 14px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 3px, var(--ink) 3px 5px, transparent 5px 6px, var(--ink) 6px 7px, transparent 7px 10px);
  opacity: .7;
}

/* ---------- 区块标题 ---------- */
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; }

/* ---------- 项目卡 ---------- */
.exp-card {
  position: relative; display: flex; flex-direction: column; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); padding: 20px; min-height: 280px;
  transition: border-color .25s, transform .25s, box-shadow .25s; cursor: pointer;
}
.exp-card:hover, .exp-card:focus-visible { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: var(--shadow); outline: none; }
.xh { position: absolute; width: 12px; height: 12px; pointer-events: none; transition: transform .25s; }
.xh::before, .xh::after { content: ""; position: absolute; background: var(--line-strong); transition: background .25s; }
.xh::before { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-50%); }
.xh::after { top: 50%; left: 0; height: 1px; width: 100%; transform: translateY(-50%); }
.xh.tl { top: -6px; left: -6px; } .xh.tr { top: -6px; right: -6px; }
.xh.bl { bottom: -6px; left: -6px; } .xh.br { bottom: -6px; right: -6px; }
.exp-card:hover .xh::before, .exp-card:hover .xh::after,
.exp-card:focus-visible .xh::before, .exp-card:focus-visible .xh::after { background: var(--accent); }
.exp-card:hover .xh.tl { transform: translate(-3px, -3px); }
.exp-card:hover .xh.tr { transform: translate(3px, -3px); }
.exp-card:hover .xh.bl { transform: translate(-3px, 3px); }
.exp-card:hover .xh.br { transform: translate(3px, 3px); }
.exp-visual { height: 92px; border: 1px solid var(--line); background: var(--surface-2); position: relative; overflow: hidden; }
.exp-visual svg { width: 100%; height: 100%; }
.exp-card .exp-code { font-family: "JetBrains Mono", monospace; }
.exp-card:hover .exp-code { color: var(--ink); }
.exp-card .arrow { transition: transform .25s; }
.exp-card:hover .arrow { transform: translateX(4px); color: var(--accent); }

.state { display: inline-flex; align-items: center; gap: 6px; }
.state::before { content: ""; width: 6px; height: 6px; background: currentColor; }
.state-active { color: var(--ok); }
.state-testing { color: var(--warn); }
.state-archived { color: var(--muted); }
.state-classified { color: var(--alert); }

/* ---------- 技能面板 ---------- */
.skill-panel { background: var(--surface); border: 1px solid var(--line); }
.skill-row + .skill-row { border-top: 1px dashed var(--line); }
.bar { position: relative; height: 10px; background: var(--surface-2); overflow: hidden; }
.bar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 9px, var(--surface) 9px 10px);
}
.bar > i {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ink);
  transition: width 1.2s cubic-bezier(.2, .8, .2, 1);
}
.bar > i.hi { background: var(--accent); }
.bar > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--alert); }

/* ---------- 日志 ---------- */
.filter-btn {
  height: 32px; padding: 0 12px; border: 1px solid var(--line); background: var(--surface);
  font-family: "JetBrains Mono", monospace; font-size: 11px; letter-spacing: .14em; color: var(--ink-2);
  transition: all .2s;
}
.filter-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.filter-btn[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filter-btn .cnt { opacity: .55; margin-left: 4px; }
.log-panel { background: var(--surface); border: 1px solid var(--line); }
.log-item { display: grid; grid-template-columns: 150px 92px 1fr; gap: 16px; padding: 14px 16px; align-items: baseline; animation: logIn .35s both; }
.log-item:hover { background: var(--surface-2); }
@keyframes logIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.lvl { font-family: "JetBrains Mono", monospace; font-size: 10px; letter-spacing: .14em; padding: 2px 6px; border: 1px solid currentColor; justify-self: start; }
.lvl-research { color: var(--cyan); }
.lvl-build { color: var(--ok); }
.lvl-murmur { color: var(--muted); }
.lvl-alert { color: var(--alert); }
@media (max-width: 640px) {
  .log-item { grid-template-columns: 1fr auto; gap: 6px 10px; }
  .log-item .log-msg { grid-column: 1 / -1; }
}

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(14, 15, 18, .55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fade .22s both;
}
.modal-panel {
  position: relative; width: min(760px, 100%); max-height: calc(100vh - 32px); background: var(--accent); padding: 1px;
  animation: rise .26s cubic-bezier(.2, .8, .2, 1) both;
}
.modal-inner { background: var(--surface); padding: 20px 22px 24px; max-height: calc(100vh - 34px); overflow-y: auto; }
.close-btn { padding: 4px 8px; border: 1px solid var(--line); transition: all .2s; }
.close-btn:hover { background: var(--ink); color: var(--bg); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
body.modal-open { overflow: hidden; }

/* ---------- 进入动画 ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s, transform .6s cubic-bezier(.2, .8, .2, 1); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
