/* ============================================================
   Shiken Inc. — Tech × Wa (墨 × 朱 × Code) System v2
   Dark sumi-ink base, washi-white text, vermillion accent,
   terminal / code motifs. Same token names as v1 so all
   pages inherit the new theme.
   ============================================================ */

:root {
  /* Palette — sumi dark base */
  --paper:        #0b0d11;   /* 墨 — page base */
  --paper-2:      #11141a;   /* raised panel */
  --paper-deep:   #1a1e27;   /* deeper panel / watermark */
  --ink:          #ece7da;   /* 和紙 — primary text */
  --ink-soft:     #a9a698;   /* secondary text */
  --navy:         #16233c;
  --navy-deep:    #0d1420;   /* alt section bg */
  --vermillion:   #e8503a;   /* 朱 */
  --vermillion-2: #b83323;
  --muted:        #676c78;
  --line:         rgba(236, 231, 218, 0.13);
  --line-soft:    rgba(236, 231, 218, 0.07);
  --line-strong:  rgba(236, 231, 218, 0.4);

  /* Code syntax (Tokyo Night-ish, muted) */
  --code-bg:      #0e1016;
  --code-green:   #8fbe6a;
  --code-blue:    #7aa2f7;
  --code-cyan:    #6fc3c3;
  --code-orange:  #d9a35f;
  --code-purple:  #a98fd6;
  --code-comment: #565f6e;

  /* Type */
  --font-display: "Shippori Mincho B1", "Hiragino Mincho ProN", "YuMincho", serif;
  --font-body:    "Noto Sans JP", "Hiragino Kaku Gothic ProN", "YuGothic", sans-serif;
  --font-mono:    "JetBrains Mono", "Menlo", monospace;

  /* Rhythm */
  --maxw: 1280px;
  --pad-x: clamp(20px, 4vw, 56px);
}

/* Light (washi) mode — flips the base tokens */
body[data-mode="light"] {
  --paper:        #f6f2ea;
  --paper-2:      #ece6d8;
  --paper-deep:   #e2dbc8;
  --ink:          #131720;
  --ink-soft:     #3c4353;
  --navy-deep:    #0d1420;
  --muted:        #6e6a60;
  --line:         rgba(19, 23, 32, 0.16);
  --line-soft:    rgba(19, 23, 32, 0.08);
  --line-strong:  rgba(19, 23, 32, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow-x: hidden; }

::selection { background: var(--vermillion); color: #fff; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ------- Blueprint grid backdrop (whole page, ultra faint) ------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.5), rgba(0,0,0,0.15) 40%, rgba(0,0,0,0.4));
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.5), rgba(0,0,0,0.15) 40%, rgba(0,0,0,0.4));
}
body > * { position: relative; z-index: 1; }

/* ------- Editorial primitives ------- */

.rule { display: block; height: 1px; width: 100%; background: var(--ink); border: 0; }
.rule-soft { background: var(--line); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--vermillion);
  font-weight: 500;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
}

.h-display, .h-section {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: var(--ink);
  margin: 0;
  text-wrap: pretty;
}
.h-section { font-size: clamp(28px, 3.4vw, 44px); }

.lede {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.85;
  color: var(--ink-soft);
  max-width: 56ch;
  margin: 0;
}

/* Comment-style label:  // 01 — services */
.code-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--code-comment);
}
.code-label b { color: var(--vermillion); font-weight: 500; }

/* ------- Layout ------- */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad-x); }
.wrap-narrow { max-width: 920px; margin: 0 auto; padding: 0 var(--pad-x); }

.section { padding: clamp(72px, 9vw, 128px) 0; position: relative; }
.section-tight { padding: clamp(48px, 6vw, 80px) 0; }

/* ------- Section header (shared) ------- */
.sec-head {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  align-items: end;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: 56px;
}
@media (max-width: 800px) { .sec-head { grid-template-columns: 1fr; gap: 18px; } }
.sec-head .sec-num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--code-comment);
}
.sec-head .sec-num::before { content: "// "; color: var(--vermillion); }
.sec-head .sec-num strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 46px;
  color: var(--ink);
  line-height: 1.15;
  margin-top: 12px;
  letter-spacing: 0.04em;
}
.sec-head .sec-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(26px, 3.2vw, 40px);
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.sec-head .sec-side {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 32px;
}
@media (max-width: 800px) { .sec-head .sec-side { flex-direction: column; align-items: flex-start; } }
.sec-head .sec-desc {
  max-width: 44ch;
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-soft);
  margin: 0;
}

/* ------- Top bar / nav ------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 14px var(--pad-x);
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.brand .brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--vermillion);
  color: #fff;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}
.brand .brand-en {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
  margin-left: 2px;
}
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 13.5px;
  letter-spacing: 0.08em;
  counter-reset: navi;
}
.nav a:not(.nav-cta) {
  counter-increment: navi;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  color: var(--ink);
  padding: 8px 14px;
  position: relative;
  transition: color .2s;
}
.nav a:not(.nav-cta)::before {
  content: "0" counter(navi);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--code-comment);
  transition: color .2s;
}
.nav a:not(.nav-cta)::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 3px;
  height: 1px;
  background: var(--vermillion);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s cubic-bezier(.2,.7,.2,1);
}
.nav a:hover { color: var(--vermillion); }
.nav a:hover::before { color: var(--vermillion); }
.nav a:not(.nav-cta):hover::after { transform: scaleX(1); }
.nav a.is-current { color: var(--vermillion); }
.nav a.is-current::before { color: var(--vermillion); }
.nav a.is-current:not(.nav-cta)::after { transform: scaleX(1); }
.nav .nav-en {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
  display: block;
  text-transform: uppercase;
  font-weight: 400;
  margin-top: 1px;
}
.nav-cta {
  font-family: var(--font-mono);
  background: transparent;
  border: 1px solid var(--vermillion);
  color: var(--vermillion) !important;
  padding: 9px 16px !important;
  margin-left: 14px;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  transition: background .2s, color .2s;
}
.nav-cta::before { content: "$ "; opacity: 0.75; }
.nav-cta:hover { background: var(--vermillion); color: #fff !important; }
.nav-cta::after { display: none !important; }

/* Topbar — mobile: brand on top, nav becomes a horizontal scroll row */
@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; gap: 2px 16px; padding-top: 12px; padding-bottom: 0; }
  .brand { white-space: nowrap; }
  .nav {
    margin-left: -14px;
    width: calc(100% + 14px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0 10px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; flex: none; }
  .nav-cta { margin-left: 6px; margin-right: 2px; }
}
@media (max-width: 480px) {
  .brand .brand-en { display: none; }
}

/* ------- Buttons ------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  border: 1px solid var(--vermillion);
  background: var(--vermillion);
  color: #fff;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.btn:hover { background: var(--vermillion-2); border-color: var(--vermillion-2); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.btn .arrow { transition: transform .25s; }
.btn:hover .arrow { transform: translateX(4px); }

/* ------- Link with arrow ------- */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--ink);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-strong);
  transition: gap .2s, color .2s, border-color .2s;
}
.link-arrow:hover { gap: 14px; color: var(--vermillion); border-color: var(--vermillion); }

/* ------- Terminal window ------- */
.terminal {
  background: var(--code-bg);
  border: 1px solid var(--line);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.9;
  color: #c6cbd6;
  overflow: hidden;
}
body[data-mode="light"] .terminal { box-shadow: 0 24px 64px rgba(19,23,32,0.25); }
.terminal .t-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(236,231,218,0.08);
  background: rgba(236,231,218,0.03);
}
.terminal .t-bar .dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(236,231,218,0.15); }
.terminal .t-bar .dot.r { background: #3d3f45; }
.terminal .t-bar .t-title {
  margin-left: 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--code-comment);
}
.terminal .t-body { padding: 20px 22px 24px; min-height: 100px; }
.terminal .ln { display: block; white-space: pre-wrap; word-break: break-all; }
.terminal .prompt { color: var(--vermillion); }
.terminal .cmd { color: #e8e4d8; }
.terminal .ok { color: var(--code-green); }
.terminal .dim { color: var(--code-comment); }
.terminal .val { color: var(--code-blue); }
.terminal .str { color: var(--code-orange); }

.cursor {
  display: inline-block;
  width: 8px; height: 1.1em;
  background: var(--vermillion);
  vertical-align: text-bottom;
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

/* Inline code chip */
.code-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  color: var(--code-cyan);
}

/* ------- Cards / grid ------- */

.grid { display: grid; gap: 32px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ------- CTA band (shared) ------- */
.cta-band {
  background: var(--paper-2);
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  padding: clamp(64px, 8vw, 100px) 0;
  position: relative;
  overflow: hidden;
}
.cta-band::before {
  content: "問";
  position: absolute; left: -2vw; bottom: -10vw;
  font-family: var(--font-display); font-size: 34vw;
  line-height: 0.8; letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1px var(--line);
  pointer-events: none;
}
.cta-band-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: center;
}
@media (max-width: 800px) { .cta-band-inner { grid-template-columns: 1fr; } }
.cta-band h2 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(28px, 3.6vw, 44px);
  margin: 0; line-height: 1.3; letter-spacing: 0.02em;
  color: var(--ink);
}
.cta-band .cta-en {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em;
  color: var(--code-comment); text-transform: lowercase;
  margin-bottom: 16px; display: block;
}
.cta-band .cta-en::before { content: "// "; color: var(--vermillion); }
.cta-band p { color: var(--ink-soft); margin: 20px 0 0; line-height: 1.85; max-width: 46ch; }
.cta-band .cta-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 800px) { .cta-band .cta-actions { justify-content: flex-start; } }

/* ------- Footer ------- */
.footer {
  background: var(--navy-deep);
  color: #ece7da;
  padding: 72px 0 0;
  margin-top: 80px;
  font-size: 13px;
  border-top: 1px solid var(--line);
}
.footer a { color: #ece7da; opacity: 0.75; transition: opacity .2s, color .2s; }
.footer a:hover { opacity: 1; color: #fff; }
.footer .footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 56px;
  border-bottom: 1px solid rgba(236,231,218,0.14);
}
@media (max-width: 800px) {
  .footer .footer-grid { grid-template-columns: 1fr 1fr; }
}
.footer h5 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: rgba(236,231,218,0.5);
  margin: 0 0 18px;
  font-weight: 500;
}
.footer h5::before { content: "// "; color: var(--vermillion); }
.footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.footer .brand-block .brand-mark {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  background: var(--vermillion); color: #fff;
  font-family: var(--font-display); font-size: 20px;
}
.footer .brand-block .brand-jp { font-family: var(--font-display); font-size: 22px; letter-spacing: 0.04em; margin-top: 14px; }
.footer .brand-block .brand-en { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; opacity: 0.6; margin-top: 4px; text-transform: uppercase; }
.footer .brand-block p { opacity: 0.65; margin-top: 14px; max-width: 30ch; line-height: 1.85; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(236,231,218,0.45);
}
/* status-bar footer line */
.footer-status {
  border-top: 1px solid rgba(236,231,218,0.14);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(236,231,218,0.4);
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  padding: 14px 0;
}
.footer-status .st-ok { color: var(--code-green); }
.footer-status .st-dot { color: var(--vermillion); }

/* ------- Vertical text accent ------- */
.v-text {
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  letter-spacing: 0.4em;
  color: var(--muted);
  font-size: 12px;
}

/* ------- Fade-in (subtle) ------- */
.fade-in {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1);
}
.fade-in.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .fade-in { opacity: 1; transform: none; transition: none; }
}

/* ------- Page header (sub-pages) ------- */
.page-header {
  padding: clamp(80px, 11vw, 152px) 0 clamp(48px, 6vw, 80px);
  border-bottom: 1px solid var(--line-strong);
  position: relative;
  overflow: hidden;
}
.page-header::after {
  content: attr(data-glyph);
  position: absolute;
  right: -2vw; bottom: -14vw;
  font-family: var(--font-display);
  font-size: 30vw;
  line-height: 0.8;
  color: transparent;
  -webkit-text-stroke: 1px var(--line);
  pointer-events: none;
}
.page-header .ph-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 56px;
  align-items: end;
}
@media (max-width: 700px) { .page-header .ph-grid { grid-template-columns: 1fr; gap: 24px; } }
.page-header .ph-num {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: clamp(48px, 8vw, 110px);
  color: transparent;
  -webkit-text-stroke: 1px var(--line-strong);
  line-height: 0.9;
  letter-spacing: -0.02em;
}
.page-header h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(34px, 4.6vw, 58px);
  line-height: 1.2;
  letter-spacing: 0.02em;
  margin: 0;
}
.page-header .ph-en {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--code-comment);
  text-transform: lowercase;
  margin-bottom: 18px;
  display: block;
}
.page-header .ph-en::before { content: "// "; color: var(--vermillion); }
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 36px;
}
.breadcrumb::before { content: "~/"; color: var(--vermillion); margin-right: 2px; }
.breadcrumb a:hover { color: var(--vermillion); }
.breadcrumb .sep { margin: 0 8px; opacity: 0.5; }
