/* ============================================================
   RM-Engineering — Design System (Site-wide SSOT)
   ============================================================
   設計方針:
   - cyber-terminal テーマを全ページ共通化
   - 配色: blue (#050810) 基調 + 5 アクセントカラー
   - フォント: Inter (sans) + Space Mono (mono)
   - スキャンライン + グリッド bg はサイト全体の前景/背景演出
   ============================================================ */

/* ── DESIGN TOKENS ────────────────────────── */
:root {
  /* Background scale (dark → light) */
  --bg:      #050810;
  --bg1:     #080c18;
  --bg2:     #0c1220;
  --bg3:     #101828;

  /* Borders */
  --border:  #182035;
  --border2: #223050;

  /* Text scale (bright → dim) */
  --text-bright: #dce8ff;
  --text:        #b8ccec;
  --text2:       #6a84aa;
  --text3:       #384c68;

  /* Accent palette (5 colors) */
  --green:   #00e676;
  --blue:    #4a9eff;
  --cyan:    #00bcd4;
  --purple:  #b388ff;
  --amber:   #ffc107;
  --red:     #ff5252;

  /* Typography */
  --mono: 'Space Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing / radius */
  --radius-sm: 2px;
  --radius:    4px;
  --radius-lg: 6px;
  --max-w:     1400px;
}

/* ── RESET ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ── FOREGROUND TEXTURES (scanlines + grid) ──── */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9000;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0, 0, 0, .15) 2px, rgba(0, 0, 0, .15) 4px
  );
  opacity: .4;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(74, 158, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 158, 255, .025) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ── NAV (fixed top) ──────────────────────── */
nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  height: 48px;
  padding: 0 40px;
  display: flex; align-items: center;
  background: rgba(5, 8, 16, .9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.nav-logo {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  margin-right: auto;
  letter-spacing: 2px;
}
.nav-logo em { color: var(--text3); font-style: normal; }

.nav-links { display: flex; gap: 32px; list-style: none; align-items: center; }
.nav-links a {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 1.5px;
  transition: color .12s;
  padding: 4px 0;
}
.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a.active { color: var(--text); outline: none; }
.nav-links a.active { color: var(--blue); }

.nav-pill {
  display: inline-flex; align-items: center; gap: 5px;
  margin-left: 32px;
  background: rgba(0, 230, 118, .06);
  border: 1px solid rgba(0, 230, 118, .18);
  border-radius: 20px;
  padding: 3px 10px 3px 8px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--green);
  letter-spacing: 1px;
}
.pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2.4s ease infinite;
}
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--border2);
  color: var(--text); font-size: 14px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

/* ── PAGE HERO (sub pages) ────────────────── */
.page-hero {
  padding: 140px 40px 60px;
  max-width: var(--max-w);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.page-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.page-eyebrow::after {
  content: '';
  flex: 1; height: 1px;
  background: var(--border);
  max-width: 120px;
}
.page-title {
  font-family: var(--mono);
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 16px;
}
.page-title .g {
  background: linear-gradient(120deg, var(--blue), var(--cyan) 50%, var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-desc {
  font-size: 15px;
  color: var(--text2);
  max-width: 640px;
  line-height: 1.75;
}

/* ── SECTION COMMON ───────────────────────── */
.section {
  padding: 80px 80px;
  max-width: var(--max-w);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.sec-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 36px;
  display: flex; align-items: center; gap: 12px;
}
.sec-label .sl-num { color: var(--border2); }
.sec-label::after {
  content: '';
  flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
  max-width: 200px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  max-width: var(--max-w);
  margin: 0 auto;
  position: relative; z-index: 1;
}

/* ── BUTTONS ──────────────────────────────── */
.btn {
  font-family: var(--mono);
  font-size: 11px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  letter-spacing: 1.5px;
  transition: all .12s;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid;
}
.btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-primary:hover {
  background: #6ab8ff;
  box-shadow: 0 0 24px rgba(74, 158, 255, .35);
}
.btn-ghost {
  background: transparent;
  color: var(--text2);
  border-color: var(--border2);
}
.btn-ghost:hover {
  border-color: var(--blue);
  color: var(--text);
}

/* ── FOOTER ───────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}
.foot-logo {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 2px;
}
.foot-links { display: flex; gap: 24px; flex-wrap: wrap; }
.foot-links a {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 1px;
  transition: color .12s;
}
.foot-links a:hover,
.foot-links a:focus-visible { color: var(--text); outline: none; }
.foot-copy {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text3);
}

/* ── TERMINAL CARD (shared component) ─────── */
.term-card {
  background: var(--bg1);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 11.5px;
  box-shadow:
    0 0 60px rgba(74, 158, 255, .08),
    inset 0 1px 0 rgba(255, 255, 255, .03);
}
.term-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, .4);
  border-bottom: 1px solid var(--border);
}
.td { width: 11px; height: 11px; border-radius: 50%; }
.td-r { background: #ff5f57; }
.td-y { background: #febc2e; }
.td-g { background: #28c840; }
.term-title {
  font-size: 10px;
  color: var(--text3);
  margin-left: 4px;
  letter-spacing: 1px;
}
.term-body { padding: 20px; line-height: 2; color: var(--text2); }

/* Syntax tokens (used inside term-body) */
.t-prompt  { color: var(--text3); }
.t-cmd     { color: var(--green); }
.t-kw      { color: var(--purple); }
.t-fn      { color: var(--cyan); }
.t-str     { color: var(--amber); }
.t-num     { color: var(--blue); }
.t-comment { color: var(--text3); }
.t-ok      { color: var(--green); }
.t-dim     { color: var(--text3); }
.t-err     { color: var(--red); }
.t-blank   { display: block; height: 10px; }

/* ── TAG / BADGE (shared) ─────────────────── */
.tag {
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 1px;
  border: 1px solid var(--border);
  color: var(--text3);
}
.tag-blue   { color: var(--blue);   border-color: rgba(74,158,255,.25);  background: rgba(74,158,255,.08); }
.tag-green  { color: var(--green);  border-color: rgba(0,230,118,.25);   background: rgba(0,230,118,.08); }
.tag-purple { color: var(--purple); border-color: rgba(179,136,255,.25); background: rgba(179,136,255,.1); }
.tag-cyan   { color: var(--cyan);   border-color: rgba(0,188,212,.25);   background: rgba(0,188,212,.08); }
.tag-amber  { color: var(--amber);  border-color: rgba(255,193,7,.25);   background: rgba(255,193,7,.08); }

/* ── ANIMATIONS ───────────────────────────── */
@keyframes pulse {
  0%, 100% { transform: scale(1);  opacity: 1; }
  50%      { transform: scale(.7); opacity: .5; }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ───────────────────────────── */
@media (max-width: 1100px) {
  .section { padding: 60px 40px; }
  .site-footer { padding: 24px 40px; }
  .page-hero { padding: 120px 40px 48px; }
}
@media (max-width: 768px) {
  .nav { padding: 0 20px; }
  .nav-pill { display: none; }
  .nav-links { gap: 18px; }
  .section { padding: 48px 20px; }
  .site-footer {
    padding: 24px 20px;
    flex-direction: column;
    text-align: center;
  }
  .page-hero { padding: 100px 20px 40px; }
}
@media (max-width: 480px) {
  .nav-links a { font-size: 9px; }
}

/* ── A11Y ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--bg1);
  color: var(--blue);
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  left: 16px;
  top: 8px;
  outline: 2px solid var(--blue);
}

/* Visually-hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
