/* ekplabz base — shared design tokens and chrome (header, footer, machine bed).
   Used by every page; page-specific styles live in each page. */
:root {
  --paper: #e8ecf1;
  --ink: #141c30;
  --ink-soft: #4d5873;
  --blue-900: #0d1c4a;
  --blue-700: #1d3d9c;
  --blue-500: #2c57c8;
  --steel-100: #f3f5f8;
  --steel-300: #c3cad5;
  --steel-500: #8b95a6;
  --steel-700: #4a5263;
  --cyan: #22e3ff;
  --magenta: #ff2bd6;
  --lime: #39ff88;
  --amber: #ffb020;
  --violet: #a24dff;
  --yellow: #ffe14d;
  --red: #ff3d6e;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --tech: "Rajdhani", "Noto Sans JP", sans-serif;
  --body: "Noto Sans JP", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }

/* ───────── header ───────── */
/* gunmetal band shared by header and footer */
.metal-band {
  position: relative;
  background:
    radial-gradient(circle, #e9edf2 0 2px, #6b7487 2.5px 3.5px, #2a2f3a 4px 5px, transparent 5.5px) 10px 50% / 24px 24px no-repeat,
    radial-gradient(circle, #e9edf2 0 2px, #6b7487 2.5px 3.5px, #2a2f3a 4px 5px, transparent 5.5px) calc(100% - 10px) 50% / 24px 24px no-repeat,
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .055) 0 1px, rgba(0, 0, 0, .06) 1px 2px, transparent 2px 4px),
    linear-gradient(180deg, #6a7385 0%, #474f60 18%, #343a47 50%, #262b35 82%, #1a1e26 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -1px 0 rgba(0, 0, 0, .6);
}
.top.metal-band {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 10px clamp(30px, 4vw, 48px);
  border-bottom: 1px solid #0b0d12;
}
.top.metal-band::after { /* neon rail */
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta), var(--amber), var(--lime), var(--violet), var(--cyan));
  background-size: 200% 100%; animation: rail 8s linear infinite; opacity: .85;
}
@keyframes rail { to { background-position: -200% 0; } }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img {
  width: 44px; height: 44px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px;
  box-shadow: 0 0 0 2px #1a1e26, 0 0 0 3px #7d8698, inset 0 0 0 1px rgba(0, 0, 0, .2);
}
.brand b { font-family: var(--tech); font-size: 26px; letter-spacing: .06em; color: #f2f5f9; text-shadow: 0 -1px 0 rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .15); }
.brand small { display: block; font-family: var(--mono); font-size: 10px; color: var(--cyan); letter-spacing: .14em; margin-top: -4px; text-shadow: 0 0 6px rgba(34, 227, 255, .6); }
.top.metal-band nav { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
/* machined push buttons */
.mbtn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--tech); font-weight: 700; font-size: 14px; letter-spacing: .12em;
  padding: 6px 14px 6px 12px; border-radius: 4px; color: #1d2433;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .25) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #f7f9fb 0%, #d5dbe3 48%, #b4bcc9 52%, #dde2e9 100%);
  border: 1px solid #3a4150;
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(0, 0, 0, .18), 0 3px 0 #15181f, 0 4px 6px rgba(0, 0, 0, .55);
  transition: transform .06s, box-shadow .06s;
}
.mbtn::before { /* indicator lamp */
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #bff8ff, var(--cyan) 50%, #0a7f93);
  box-shadow: 0 0 6px var(--cyan), inset 0 0 0 1px rgba(0, 0, 0, .3);
}
.mbtn:hover { color: var(--blue-700); }
.mbtn:active { transform: translateY(3px); box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(0, 0, 0, .18), 0 0 0 #15181f, 0 1px 2px rgba(0, 0, 0, .5); }

/* ───────── stage background: machine bed ───────── */
.stage {
  position: relative;
  padding: clamp(36px, 5vw, 60px) clamp(16px, 4vw, 48px) 40px;
  overflow: hidden;
  background:
    /* rivets at panel corners */
    radial-gradient(circle at 0 0, #6b7487 0 3px, #dfe4ea 3.5px 5px, transparent 5.5px) 0 0 / 240px 240px,
    /* panel seams */
    linear-gradient(rgba(60, 72, 96, .28) 2px, transparent 2px) 0 0 / 240px 240px,
    linear-gradient(90deg, rgba(60, 72, 96, .28) 2px, transparent 2px) 0 0 / 240px 240px,
    /* blueprint grid */
    linear-gradient(rgba(29, 61, 156, .12) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(29, 61, 156, .12) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(rgba(29, 61, 156, .05) 1px, transparent 1px) 0 0 / 8px 8px,
    linear-gradient(90deg, rgba(29, 61, 156, .05) 1px, transparent 1px) 0 0 / 8px 8px,
    /* brushed steel */
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .25) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #eef1f5, #dfe4ea);
}
/* rulers */
.ruler-x, .ruler-y { position: absolute; z-index: 1; pointer-events: none; font-family: var(--mono); font-size: 9px; color: var(--steel-700); }
.ruler-x {
  left: 0; right: 0; top: 0; height: 22px; border-bottom: 1px solid var(--steel-500);
  background:
    linear-gradient(90deg, var(--steel-700) 1px, transparent 1px) 0 100% / 50px 12px no-repeat repeat-x,
    linear-gradient(90deg, var(--steel-500) 1px, transparent 1px) 0 100% / 10px 6px repeat-x,
    linear-gradient(#f6f8fa, #d9dee5);
  background-repeat: repeat-x;
}
.ruler-y {
  left: 0; top: 22px; bottom: 0; width: 22px; border-right: 1px solid var(--steel-500);
  background:
    linear-gradient(var(--steel-700) 1px, transparent 1px) 100% 0 / 12px 50px repeat-y,
    linear-gradient(var(--steel-500) 1px, transparent 1px) 100% 0 / 6px 10px repeat-y,
    linear-gradient(90deg, #f6f8fa, #d9dee5);
}
.hazard {
  position: absolute; left: 22px; right: 0; bottom: 0; height: 12px; z-index: 1;
  background: repeating-linear-gradient(-45deg, #ffcf1f 0 14px, #1a1d26 14px 28px);
  box-shadow: 0 -1px 0 rgba(0, 0, 0, .3);
}
.deco { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.deco .trace { fill: none; stroke: rgba(29, 61, 156, .22); stroke-width: 2; }
.deco .pad { fill: #dfe4ea; stroke: rgba(29, 61, 156, .35); stroke-width: 1.5; }
.deco .gear { fill: none; stroke: rgba(60, 72, 96, .16); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: spin 60s linear infinite; }
.deco .gear.rev { animation-direction: reverse; animation-duration: 45s; }
.deco .mark { fill: none; stroke: var(--magenta); stroke-width: 1.5; opacity: .5; }
@keyframes spin { to { transform: rotate(360deg); } }

footer {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 22px clamp(30px, 4vw, 48px); font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  color: #c3cad5; text-shadow: 0 -1px 0 rgba(0, 0, 0, .7); border-top: 1px solid #0b0d12;
}
footer::before { /* neon rail on the top edge */
  content: ""; position: absolute; left: 0; right: 0; top: -2px; height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta), var(--amber), var(--lime), var(--violet), var(--cyan));
  background-size: 200% 100%; animation: rail 8s linear infinite;
}
footer .plate { padding: 3px 10px; border: 1px solid #1a1e26; background: linear-gradient(#2a2f3a, #1b1f28); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); color: var(--cyan); }

@media (max-width: 560px) {
  .top.metal-band nav { display: none; }
  .ruler-y { display: none; } /* it would sit on top of the content at phone width */
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ───────── footer navigation (same on every page) ───────── */
footer.metal-band { flex-direction: column; gap: 12px; }
.fnav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.fnav a {
  display: inline-block; padding: 5px 12px; font-family: var(--body); font-size: 12.5px; letter-spacing: .04em;
  color: #dfe6f3; text-shadow: 0 -1px 0 rgba(0, 0, 0, .7);
  background: linear-gradient(#3a4150, #252a34); border: 1px solid #13161c; border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 0 rgba(255, 255, 255, .06);
}
.fnav a:hover { color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 0 0 1px var(--cyan), 0 0 8px rgba(34, 227, 255, .5); }
.fmeta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }

/* ───────── tag cloud = keycaps in a parts bin ───────── */
.tagcloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tagcloud a {
  display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 8px; border-radius: 3px;
  font-size: var(--fs, 12px); line-height: 1.5; color: #1d2433;
  background: linear-gradient(#f7f9fb, #d3d9e1); border: 1px solid #1a1e26;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #13161c;
}
.tagcloud a small { font-family: var(--mono); font-size: 10px; color: var(--steel-500); }
.tagcloud a:hover { color: var(--blue-700); box-shadow: inset 0 1px 0 #fff, 0 2px 0 #13161c, 0 0 0 2px var(--acc, var(--cyan)); }
.tagcloud a:active { transform: translateY(2px); box-shadow: inset 0 1px 0 #fff; }
.tagcloud a.-gl { box-shadow: inset 0 1px 0 #fff, 0 2px 0 #13161c, 0 0 0 1px rgba(255, 43, 214, .55); }
.tagcloud .tg-gl { margin-left: 6px; padding: 0 4px; font-family: var(--mono); font-size: 9px; font-weight: 700; line-height: 15px; color: #fff; background: #ff2bd6; box-shadow: 0 0 6px #ff2bd6; }
.tagcloud .tg-gl:hover { background: #c4129f; }

/* OUTPUT cards (top page and unit pages, made by ekp_out_card): eyecatch on top, sized like SWELL's related posts */
.cards .card { padding-top: 0; }
.cards .card::before { z-index: 1; }
/* the centre ~80% of the image (scale 1.25 crops 10% off each side) */
.cards .card .eye { margin: 0 -12px 8px -15px; aspect-ratio: 16 / 9; overflow: hidden; background: repeating-linear-gradient(90deg, #d5dbe4 0 1px, transparent 1px 16px), repeating-linear-gradient(0deg, #d5dbe4 0 1px, #eef1f5 1px 16px); }
.cards .card .eye img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.25); transition: transform .3s; }
.cards .card:hover .eye img { transform: scale(1.32); }

/* ───────── unit selector (6 machined tabs, ekp_unit_selector): unit pages, the article list, tag pages ───────── */
.selector { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 26px; }
.selector a {
  --c: var(--cyan);
  position: relative; display: grid; gap: 1px; padding: 8px 10px 9px; color: #c8d0df;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 3px), linear-gradient(#3a4150, #1f232c);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
}
.selector a b { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; color: var(--c); }
.selector a span { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selector a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--c); opacity: .35; }
.selector a:hover { color: #fff; }
.selector a.cur { color: #fff; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 1px, transparent 1px 3px), linear-gradient(180deg, #4a72e0, #1d3a92 55%, #0d1d4f); }
.selector a.cur::after { opacity: 1; box-shadow: 0 0 8px var(--c); }
.selector a.planned span::after { content: " ·準備中"; font-weight: 400; font-size: 11px; color: #8d96a5; }
.selector a, .selector a:hover { text-decoration: none; }
.ekp-unitbar { padding-top: 24px; } /* the article list: full content width, above the sheet and the sidebar */
.ekp-unitbar .selector { margin-bottom: 0; }
/* phones and narrow columns: one row that scrolls sideways (the lit tab is scrolled into view by ekp-base.js) */
@media (max-width: 900px) {
  /* overflow-y hidden + a fixed tab height: the row must not move up and down (a sub-pixel vertical scroll range and the
     font swap on load made it wobble once the tabs drift, ekp-base.js) */
  .selector { display: flex; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: thin; padding-bottom: 4px; }
  .selector a { flex: 0 0 auto; min-width: 128px; height: 56px; box-sizing: border-box; align-content: center; }
}
