/* ==========================================================================
   LOBORCA — TMI ARCHIVE command-center interface
   Magenta HUD system. Mirrors TOOL MATRIX (tool-matrix.css) 1:1,
   recolored. Continues the LOBORCA GATEWAY visual language.
   ========================================================================== */

:root {
  --navy-deep:    #020309;
  --navy:         #05060f;
  --mag:          #ff2fd0;
  --mag-dim:      #b23a9c;
  --mag-soft:     rgba(255, 47, 208, 0.35);
  --mag-faint:    rgba(255, 47, 208, 0.12);
  --text:         #fdeaf9;
  --text-dim:     #a98fb0;
  --glass-bg:     rgba(20, 8, 26, 0.42);
  --glass-bg-hi:  rgba(20, 8, 26, 0.26);
  --glass-border: rgba(255, 47, 208, 0.22);
  --ease-out:     cubic-bezier(.16, .8, .24, 1);
  --ease-soft:    cubic-bezier(.4, 0, .2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--navy-deep);
  color: var(--text);
  font-family: 'Rajdhani', 'Noto Sans JP', system-ui, sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body.tmi-locked { overflow: hidden; height: 100vh; }

/* ==========================================================================
   Background layers: grid floor, glow blobs, particles, scanlines
   ========================================================================== */

.tmi-grid-bg {
  position: fixed;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--mag-faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--mag-faint) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: .4;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 40%, transparent 85%);
  animation: grid-drift 16s linear infinite;
  will-change: transform, background-position;
}

@keyframes grid-drift {
  0%   { background-position: 0 0; }
  100% { background-position: 46px 92px; }
}

.tmi-glow {
  position: fixed;
  z-index: 0;
  width: 55vw;
  height: 55vw;
  max-width: 720px;
  max-height: 720px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(90px);
  opacity: .28;
  will-change: transform;
}
.tmi-glow--a { top: -18%; right: -14%; background: radial-gradient(circle, var(--mag), transparent 70%); }
.tmi-glow--b { bottom: -22%; left: -16%; background: radial-gradient(circle, #2a0a30, transparent 70%); opacity: .35; }

#tmiParticles {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: screen;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0) 0px, rgba(0,0,0,.15) 1px, rgba(0,0,0,0) 3px);
  mix-blend-mode: multiply;
  opacity: .5;
}

@media (prefers-reduced-motion: reduce) {
  .tmi-grid-bg { animation: none; }
}

/* ==========================================================================
   Boot / loading sequence
   ========================================================================== */

.tmi-loader {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--navy-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .6s var(--ease-soft), visibility .6s;
}

.tmi-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.tmi-loader-inner {
  width: min(360px, 84vw);
  text-align: center;
}

.tmi-loader-glyph {
  font-size: 1.6rem;
  color: var(--mag);
  text-shadow: 0 0 18px var(--mag-soft);
  margin-bottom: 6px;
  animation: loader-pulse 1.6s ease-in-out infinite;
}

@keyframes loader-pulse {
  0%, 100% { opacity: .6; } 50% { opacity: 1; }
}

.tmi-loader-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  letter-spacing: .35em;
  font-size: .95rem;
  color: var(--text);
  margin-bottom: 20px;
}

.tmi-loader-bar {
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
  margin-bottom: 16px;
}

.tmi-loader-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--mag-dim), var(--mag));
  box-shadow: 0 0 12px var(--mag-soft);
  transition: width .35s var(--ease-soft);
}

.tmi-loader-log {
  list-style: none;
  text-align: left;
  font-family: 'Rajdhani', monospace;
  font-size: .74rem;
  letter-spacing: .04em;
  color: var(--text-dim);
  min-height: 84px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tmi-loader-log li {
  opacity: 0;
  transform: translateY(4px);
  animation: log-in .35s var(--ease-out) forwards;
}

.tmi-loader-log li::before {
  content: '> ';
  color: var(--mag);
}

@keyframes log-in {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .tmi-loader { transition: none; }
}

/* ==========================================================================
   Shell / layout
   ========================================================================== */

.tmi-shell {
  position: relative;
  z-index: 5;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 40px) 80px;
}

.tmi-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: clamp(30px, 6vh, 56px);
  font-family: 'Orbitron', sans-serif;
  font-size: .64rem;
  letter-spacing: .28em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.tmi-brand { color: var(--mag); text-shadow: 0 0 10px var(--mag-soft); }
.tmi-session span { color: var(--text); }

/* ---- hero ---- */

.tmi-hero {
  text-align: center;
  margin-bottom: clamp(36px, 7vh, 64px);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
}

body.tmi-ready .tmi-hero { opacity: 1; transform: translateY(0); }

.tmi-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  font-family: 'Orbitron', sans-serif;
  font-size: .66rem;
  letter-spacing: .22em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 20px;
}

.tmi-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #33ffb0;
  box-shadow: 0 0 8px #33ffb0;
  animation: status-pulse 1.8s ease-in-out infinite;
}
@keyframes status-pulse { 0%, 100% { opacity: .5; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }

.tmi-status-sep { color: rgba(255,255,255,.2); }

.tmi-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 6vw, 3.6rem);
  letter-spacing: .14em;
  color: var(--text);
  text-shadow: 0 0 16px rgba(253,234,249,.3), 0 0 44px var(--mag-soft);
}

.tmi-subtitle {
  margin-top: 10px;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 300;
  font-size: clamp(.85rem, 1.6vw, 1.05rem);
  letter-spacing: .22em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ==========================================================================
   Module grid
   ========================================================================== */

.tmi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(16px, 2.4vw, 26px);
}

.tmi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(20px, 2.6vw, 28px);
  border-radius: 12px;
  background: var(--glass-bg);
  border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out),
              border-color .35s ease, box-shadow .35s ease, background .35s ease;
  transition-delay: var(--card-delay, 0s);
}

body.tmi-ready .tmi-card {
  opacity: 1;
  transform: translateY(0);
}

/* HUD corner brackets */
.tmi-card-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--mag-soft);
  opacity: .55;
  transition: opacity .35s ease, border-color .35s ease, width .35s ease, height .35s ease;
  z-index: 2;
  pointer-events: none;
}
.tmi-card-corner--tl { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.tmi-card-corner--tr { top: 8px; right: 8px; border-left: none; border-bottom: none; }
.tmi-card-corner--bl { bottom: 8px; left: 8px; border-right: none; border-top: none; }
.tmi-card-corner--br { bottom: 8px; right: 8px; border-left: none; border-top: none; }

/* scanline sweep on hover */
.tmi-card-scan {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(255,47,208,.10) 48%, transparent 52%);
  background-size: 100% 240%;
  background-position: 0 -70%;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}

.tmi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle at 18% 0%, var(--mag-soft), transparent 62%);
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
}

.tmi-card:hover,
.tmi-card:focus-visible {
  border-color: var(--mag-soft);
  background: var(--glass-bg-hi);
  box-shadow: 0 0 42px -12px var(--mag-soft), inset 0 0 28px -16px var(--mag-soft);
  transform: translateY(14px) scale(1.012);
}
.tmi-card:hover::before { opacity: .6; }
.tmi-card:hover .tmi-card-corner { opacity: 1; width: 20px; height: 20px; border-color: var(--mag); }
.tmi-card:hover .tmi-card-scan { opacity: 1; animation: tmi-scan-sweep 2.2s linear infinite; }

@keyframes tmi-scan-sweep {
  0% { background-position: 0 -70%; }
  100% { background-position: 0 170%; }
}

.tmi-card > * { position: relative; z-index: 1; }

/* icon */
.tmi-card-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 47, 208, .06);
  border: 1px solid var(--glass-border);
  color: var(--mag);
  transition: box-shadow .35s ease, background .35s ease;
}
.tmi-card-icon svg { width: 24px; height: 24px; }
.tmi-card:hover .tmi-card-icon {
  background: rgba(255, 47, 208, .12);
  box-shadow: 0 0 20px -4px var(--mag-soft);
}

/* body */
.tmi-card-body { display: flex; flex-direction: column; gap: 6px; flex: 1; }

.tmi-card-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: .03em;
  color: var(--text);
  word-break: break-word;
}

.tmi-card-desc {
  font-size: .88rem;
  line-height: 1.55;
  color: var(--text-dim);
}

/* footer row: status + CTA */
.tmi-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.tmi-card-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Orbitron', sans-serif;
  font-size: .6rem;
  letter-spacing: .18em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.tmi-card-status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--mag);
  box-shadow: 0 0 6px var(--mag);
  animation: status-pulse 2s ease-in-out infinite;
}

.tmi-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Orbitron', sans-serif;
  font-size: .66rem;
  letter-spacing: .18em;
  color: var(--mag);
  text-transform: uppercase;
}
.tmi-card-cta .arrow { transition: transform .3s var(--ease-out); }
.tmi-card:hover .tmi-card-cta .arrow { transform: translateX(4px); }

/* ==========================================================================
   Footer
   ========================================================================== */

.tmi-footer {
  margin-top: clamp(48px, 8vh, 80px);
  display: flex;
  justify-content: center;
  opacity: 0;
  transition: opacity .8s ease .3s;
}
body.tmi-ready .tmi-footer { opacity: 1; }

.tmi-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-family: 'Orbitron', sans-serif;
  font-size: .7rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.12);
  padding: 12px 26px;
  border-radius: 999px;
  transition: color .3s ease, border-color .3s ease, background .3s ease, box-shadow .3s ease;
}
.tmi-back:hover {
  color: var(--mag);
  border-color: var(--mag-soft);
  background: rgba(255,47,208,.06);
  box-shadow: 0 0 24px -8px var(--mag-soft);
}
.tmi-back .arrow-back { transition: transform .3s var(--ease-out); }
.tmi-back:hover .arrow-back { transform: translateX(-4px); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 760px) {
  .tmi-grid { grid-template-columns: 1fr; }
  .tmi-topbar { font-size: .58rem; }
  .tmi-session { display: none; }
}

@media (max-width: 420px) {
  .tmi-card-desc { font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
