/* ==========================================================================
   Rick — Data Scientist / tomokazu-rikioka.github.io
   黒地のグリッドに置いたターミナル窓＋ドット絵のチャトラ
   ========================================================================== */

:root {
  --bg: #0b0f14;
  --panel: #11161d;
  --panel-2: #161d26;
  --line: #232c38;
  --fg: #d7e0ea;
  --fg-dim: #6d7d90;
  --amber: #f0a202;
  --cyan: #35d0ba;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  min-height: 100svh;
  padding: 30px 20px 108px;
  display: grid;
  place-items: start center;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(53, 208, 186, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 208, 186, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
  color: var(--fg);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* 猫が歩く走査線 */
.scanline {
  position: fixed;
  left: 0; right: 0; bottom: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 162, 2, 0.55), transparent);
  box-shadow: 0 0 14px rgba(240, 162, 2, 0.35);
  pointer-events: none;
  z-index: 1;
}

/* --- ターミナル窓 ------------------------------------------------------- */
.term {
  width: 100%;
  max-width: 680px;
  position: relative;
  z-index: 2;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
}
.term__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.term__title { margin-left: 8px; font-size: 11.5px; color: var(--fg-dim); }
.term__body { padding: 20px 22px 22px; }

.cmd {
  margin: 0 0 12px;
  color: var(--fg-dim);
  font-size: 13px;
}
.cmd::before { content: '$ '; color: var(--cyan); }
.block + .cmd { margin-top: 26px; }

/* --- whoami ------------------------------------------------------------- */
.who { display: flex; align-items: center; gap: 18px; }
.avatar {
  flex: none;
  width: 86px; height: 86px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
  filter: saturate(1.05);
}
h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
@keyframes blink { 50% { opacity: 0; } }
.role { margin: 2px 0 0; color: var(--amber); font-size: 12.5px; letter-spacing: 0.12em; }
.bio {
  margin: 8px 0 0;
  color: var(--fg-dim);
  font-size: 12.5px;
  font-family: 'Noto Sans JP', system-ui, sans-serif;
}

/* --- 訪問者カウンター --------------------------------------------------- */
.visitor {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.visitor[hidden] { display: none; }
.visitor__text {
  font-family: 'Noto Sans JP', system-ui, sans-serif;
  font-size: 13px;
  color: var(--fg-dim);
}
.visitor__num {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(240, 162, 2, 0.35);
}

/* 末尾の入力待ちプロンプト */
.cmd.prompt { margin: 22px 0 0; }
.cursor {
  display: inline-block;
  width: 9px; height: 16px;
  background: var(--amber);
  vertical-align: -3px;
  animation: blink 1.15s steps(1) infinite;
}

/* --- リンク ------------------------------------------------------------- */
.rows { display: grid; }
.row {
  display: grid;
  grid-template-columns: 22px 26px 96px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 4px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: background 0.18s, padding-left 0.18s;
}
.row:first-child { border-top: 1px solid var(--line); }
.row:hover, .row:focus-visible { background: rgba(53, 208, 186, 0.06); padding-left: 10px; }
.row:focus-visible { outline: 1px solid var(--cyan); outline-offset: -1px; }

.row__caret { color: var(--cyan); opacity: 0; transition: opacity 0.18s; }
.row:hover .row__caret { opacity: 1; }
.row__icon { color: var(--fg-dim); display: grid; place-items: center; transition: color 0.18s; }
.row__icon svg { width: 17px; height: 17px; fill: currentColor; display: block; }
.row:hover .row__icon { color: var(--brand); }
.row__key { font-weight: 700; font-size: 13.5px; }
.row__val { color: var(--fg-dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row:hover .row__val { color: var(--amber); }
.row__ext { color: var(--fg-dim); font-size: 12px; }

/* --- 茶トラ猫 ------------------------------------------------------- */
.pixcat-stage { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 30; }
.pixcat { position: absolute; left: 0; will-change: transform; }
.pixcat__inner { display: block; transform-origin: 50% 100%; }
.pixcat__bubble {
  position: absolute;
  left: 50%; bottom: var(--cat-top, 100%);
  transform: translateX(-50%) translateY(4px);
  margin-bottom: 6px;
  padding: 2px 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--cyan);
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.18s, transform 0.24s cubic-bezier(0.3, 1.4, 0.5, 1);
  pointer-events: none;
}
.pixcat.is-talking .pixcat__bubble { opacity: 1; transform: translateX(-50%) translateY(0); }
.pixcat.is-sleep::after {
  content: 'z z z';
  position: absolute;
  left: 60%; bottom: calc(var(--cat-top, 96%) + 2px);
  color: var(--amber);
  font-size: 11px;
  letter-spacing: 2px;
  animation: zzz 2.6s ease-out infinite;
}
@keyframes zzz {
  0% { opacity: 0; transform: translate(0, 6px); }
  30% { opacity: 0.9; }
  100% { opacity: 0; transform: translate(12px, -22px); }
}
.pixcat.is-hop .pixcat__inner { animation: pixhop 0.52s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes pixhop {
  0%, 100% { transform: scaleX(var(--sx, 1)) translateY(0); }
  45% { transform: scaleX(var(--sx, 1)) translateY(-16px); }
}

/* --- 登場アニメ --------------------------------------------------------- */
.fade { opacity: 0; animation: fadein 0.6s ease forwards; }
@keyframes fadein { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .fade { animation: none; opacity: 1; }
  .cursor { animation: none; }
  .pixcat.is-sleep::after { animation: none; opacity: 0.9; }
}

/* --- 404 ---------------------------------------------------------------- */
.notfound { text-align: left; }
.notfound h1 { font-size: 26px; margin-bottom: 4px; }
.notfound .home {
  display: inline-block;
  margin-top: 14px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cyan);
  text-decoration: none;
  font-size: 13px;
}
.notfound .home:hover { background: rgba(53, 208, 186, 0.08); }

/* --- モバイル ----------------------------------------------------------- */
@media (max-width: 560px) {
  body { padding: 20px 14px 96px; font-size: 13px; }
  .term__body { padding: 16px 14px 18px; }
  .who { gap: 14px; }
  .avatar { width: 68px; height: 68px; }
  h1 { font-size: 24px; }
  .visitor { padding: 12px 12px; gap: 8px; }
  .visitor__num { font-size: 26px; }
  .visitor__text { font-size: 12.5px; }
  .row { grid-template-columns: 16px 22px 1fr auto; gap: 9px; }
  .row__val { display: none; }
}

/* Detailed tabby illustration. */
.pixcat__inner { width: 100%; padding: 0; border: 0; background: none; color: inherit; pointer-events: auto; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pixcat__inner:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 35%; }
.pixcat canvas { display: block; filter: drop-shadow(0 2px 2px #0003); transform-origin: 50% 100%; }
.pixcat[data-state="sleep"] canvas { animation: cat-breathe 3.6s ease-in-out infinite; }
.pixcat__bubble { color: #ffe4bc; border-color: #ad7a46; border-radius: 12px; padding: 5px 11px; }
@keyframes cat-breathe { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(1.025); } }
@media (prefers-reduced-motion: reduce) {
  .pixcat *, .pixcat *::after { animation: none !important; transition: none !important; }
}
