/* ============================================
   R3O Works - 和洋・エンジニア配色（2026-10）
   style.css の後に読み込み、配色・書体・トップページを上書きする
   ============================================ */

/* --- Tokens --- */
:root {
  --sumi: #0E1114;
  --sumi-deep: #0A0D10;
  --ai-deep: #141B26;
  --ai-bar: #0F151E;
  --ai-line: #263244;
  --kinari: #EDE6D6;
  --nezu: #8B93A1;
  --nezu-dim: #5A6577;
  --shu: #E4572E;
  --shu-hover: #F06A42;
  --matcha: #A3BE6C;
  --ai: #6FA3E0;
  --yamabuki: #E8B23A;
  --grid: #161B22;

  --color-primary: var(--shu);
  --color-secondary: var(--yamabuki);
  --color-accent1: var(--ai);
  --color-accent2: var(--matcha);
  --color-bg: var(--sumi);
  --color-surface: var(--ai-deep);
  --color-text: var(--kinari);
  --color-text-muted: var(--nezu);
  --color-footer-bg: var(--sumi-deep);

  --font-heading: 'Shippori Mincho', 'Zen Kaku Gothic New', serif;
  --font-body: 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --container-max: 1240px;
  --radius: 4px;
  --radius-lg: 4px;
}

/* --- Base --- */
body {
  background-color: var(--sumi);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 80px 80px;
  line-height: 1.9;
}

a {
  color: var(--ai);
}

a:hover {
  color: var(--kinari);
}

:focus-visible {
  outline: 2px solid var(--yamabuki);
  outline-offset: 3px;
}

.comment {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--matcha);
}

/* --- Header --- */
.site-header {
  background: rgba(14, 17, 20, 0.92);
  border-bottom: 1px solid var(--ai-line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-img {
  height: 30px;
}

.logo-path {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--nezu);
}

@media (min-width: 1024px) {
  .logo-path {
    display: inline;
  }
}

.menu-bar {
  background: var(--kinari);
  border-radius: 0;
}

.nav-list a {
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.03em;
}

.nav-list a::after {
  background: var(--shu);
}

.nav-list a:hover {
  color: var(--kinari);
}

.lang-switch a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--kinari);
  border: 1px solid var(--ai-line);
  border-radius: 0;
  padding: 6px 12px;
}

.lang-switch a:hover {
  color: var(--kinari);
  border-color: var(--nezu);
}

@media (min-width: 768px) {
  .nav-list a {
    font-size: 0.8125rem;
  }
}

/* --- Buttons --- */
.btn {
  font-family: var(--font-body);
  border-radius: 0;
  border-width: 1px;
  letter-spacing: 0.02em;
}

.btn--lg {
  padding: 16px 32px;
  font-size: 1rem;
}

/* 朱の地に白文字はコントラスト比が足りないため、文字は墨色にする */
.btn--primary {
  background: var(--shu);
  border-color: var(--shu);
  color: var(--sumi);
}

.btn--primary:hover {
  background: var(--shu-hover);
  border-color: var(--shu-hover);
  color: var(--sumi);
  transform: none;
  box-shadow: none;
}

.btn--outline {
  color: var(--kinari);
  border-color: var(--nezu);
}

.btn--outline:hover {
  background: transparent;
  color: var(--kinari);
  border-color: var(--kinari);
  transform: none;
  box-shadow: none;
}

.btn__arrow {
  font-family: var(--font-mono);
  margin-left: 20px;
}

/* --- Shared panel (editor / terminal look) --- */
.panel {
  background: var(--ai-deep);
  border: 1px solid var(--ai-line);
  min-width: 0;
}

.panel__tabs {
  display: flex;
  background: var(--ai-bar);
  border-bottom: 1px solid var(--ai-line);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1;
}

.panel__tab {
  padding: 13px 20px;
  color: var(--nezu);
}

.panel__tab.is-active {
  background: var(--ai-deep);
  color: var(--kinari);
  box-shadow: inset 0 2px 0 var(--shu);
  margin-bottom: -1px;
}

.panel__status {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  background: var(--ai-bar);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--nezu);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--matcha);
  margin-right: 8px;
}

.code {
  margin: 0;
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 2;
  color: var(--kinari);
  overflow-x: auto;
  counter-reset: line;
  white-space: pre;
}

.code__line {
  display: block;
  min-height: 2em;
}

.code--numbered .code__line::before {
  counter-increment: line;
  content: counter(line, decimal-leading-zero);
  display: inline-block;
  width: 2.5em;
  margin-right: 1em;
  color: #3C4757;
}

.tk-kw { color: var(--shu); }
.tk-str { color: var(--yamabuki); }
.tk-fn { color: var(--ai); }
.tk-cm { color: var(--matcha); }
.tk-pn { color: var(--nezu); }
.tk-dim { color: #3C4757; }

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.2em;
  vertical-align: text-bottom;
  background: rgba(237, 230, 214, 0.7);
}

@media (prefers-reduced-motion: no-preference) {
  .cursor {
    animation: wayo-blink 1.2s steps(1) infinite;
  }
}

@keyframes wayo-blink {
  50% { opacity: 0; }
}

.hanko {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--shu);
  color: #fff;
  border-radius: 6px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.125rem;
  line-height: 1.05;
  letter-spacing: 0.05em;
  text-align: center;
}

.hanko--sm {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.6875rem;
}

/* --- Hero --- */
.hero-c {
  padding: 56px 0 0;
}

.hero-c__inner {
  display: grid;
  gap: 48px;
  align-items: center;
}

.hero-c__copy {
  min-width: 0;
}

.hero-c__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(3rem, 11vw, 6.5rem);
  line-height: 1.25;
  letter-spacing: 0.02em;
  margin-top: 20px;
  color: var(--kinari);
}

.maru {
  color: var(--shu);
}

.hero-c__lead {
  margin-top: 28px;
  max-width: 36em;
  font-size: 1.0625rem;
  line-height: 2;
  color: var(--nezu);
}

.hero-c__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 36px;
}

.editor__stage {
  position: relative;
  padding: 40px 32px 44px;
  border-bottom: 1px solid var(--ai-line);
}

.editor__logo {
  width: min(100%, 440px);
  margin: 0 auto;
}

.editor__hanko {
  position: absolute;
  right: 24px;
  bottom: -1px;
}

.tategaki {
  display: none;
}

@media (min-width: 1024px) {
  .hero-c {
    padding-top: 72px;
  }

  .hero-c__inner {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 72px;
    min-height: 560px;
  }
}

@media (min-width: 1360px) {
  .hero-c {
    position: relative;
  }

  .tategaki {
    display: block;
    position: absolute;
    top: 260px;
    right: calc((100vw - var(--container-max)) / 2 - 28px);
    writing-mode: vertical-rl;
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    letter-spacing: 0.5em;
    color: #4A5565;
  }
}

/* --- Spec strip --- */
.spec {
  display: grid;
  margin-top: 64px;
  border: 1px solid var(--ai-line);
  border-width: 1px 0;
}

.spec__cell {
  padding: 20px 0 22px;
  border-bottom: 1px solid var(--ai-line);
}

.spec__cell:last-child {
  border-bottom: 0;
}

.spec__no {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--yamabuki);
  line-height: 1.4;
}

.spec__no--status {
  color: var(--matcha);
}

.spec__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1875rem;
  line-height: 1.6;
  color: var(--kinari);
}

.spec__desc {
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--nezu);
}

.spec__desc--mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

@media (min-width: 640px) {
  .spec {
    grid-template-columns: repeat(2, 1fr);
  }

  .spec__cell {
    padding: 20px 28px 22px;
    border-left: 1px solid var(--ai-line);
  }

  .spec__cell:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }

  .spec__cell:nth-last-child(-n+2) {
    border-bottom: 0;
  }
}

@media (min-width: 1024px) {
  .spec {
    grid-template-columns: repeat(4, 1fr);
  }

  .spec__cell,
  .spec__cell:nth-child(odd) {
    border-bottom: 0;
    border-left: 1px solid var(--ai-line);
    padding-left: 28px;
  }

  .spec__cell:first-child {
    border-left: 0;
    padding-left: 0;
  }
}

/* --- Sections (top page) --- */
.sec {
  padding: 88px 0;
  border-bottom: 1px solid var(--ai-line);
  scroll-margin-top: 64px;
}

.sec:last-of-type {
  border-bottom: 0;
}

.sec__title {
  position: relative;
  margin-top: 8px;
  padding-bottom: 24px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--kinari);
}

.sec__title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 3px;
  background: var(--shu);
}

.sec__lead {
  margin-top: 36px;
  max-width: 32em;
  font-size: 1.0625rem;
  line-height: 2;
  color: var(--nezu);
}

.split {
  display: grid;
  gap: 48px;
}

@media (min-width: 1024px) {
  .sec {
    padding: 112px 0;
  }

  .split {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 72px;
  }
}

/* --- Mission --- */
.mission-c__quote {
  margin-top: 48px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(2rem, 4.2vw, 3.5rem);
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--kinari);
}

.mission-c__body {
  display: grid;
  gap: 36px;
  align-content: start;
  font-size: 1.0625rem;
  line-height: 2.1;
}

.mission-c__body p:first-child {
  color: var(--kinari);
}

.mission-c__body p {
  color: var(--nezu);
}

.diff {
  margin-top: 48px;
  max-width: 560px;
}

.diff__line {
  display: flex;
  gap: 16px;
  padding: 10px 24px;
  font-size: 1rem;
  line-height: 1.6;
}

.diff__line:first-of-type {
  margin-top: 12px;
}

.diff__line:last-of-type {
  margin-bottom: 28px;
}

.diff__sign {
  font-family: var(--font-mono);
  flex: none;
}

.diff__line--minus {
  color: var(--nezu);
}

.diff__line--minus .diff__sign {
  color: var(--shu);
}

.diff__line--plus {
  background: rgba(163, 190, 108, 0.1);
  color: var(--kinari);
  font-weight: 700;
}

.diff__line--plus .diff__sign {
  color: var(--matcha);
}

@media (min-width: 1024px) {
  .mission-c__body {
    padding-top: 176px;
  }
}

/* --- About --- */
.about-c {
  display: grid;
  gap: 32px;
  margin-top: 48px;
}

.about-c__body {
  position: relative;
  padding: 32px 28px 40px;
}

.about-c__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.5;
  color: var(--kinari);
}

.about-c__body p {
  margin-top: 20px;
  font-size: 1rem;
  line-height: 2.1;
  color: var(--nezu);
}

.about-c__more {
  display: inline-block;
  margin-top: 24px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.about-c__face {
  width: 120px;
  margin-top: 28px;
  opacity: 0.9;
}

.about-c__hanko {
  position: absolute;
  right: 24px;
  bottom: 24px;
}

@media (min-width: 768px) {
  .about-c {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .about-c__body--with-face {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 140px;
    column-gap: 24px;
    align-items: start;
  }

  .about-c__body--with-face .about-c__title,
  .about-c__body--with-face p {
    grid-column: 1;
  }

  .about-c__face {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 140px;
    margin-top: 56px;
  }
}

/* --- Sub pages: surfaces --- */
.page-title,
.blog-card__title,
.product-list__title,
.list-item h2,
.prose h2,
.prose h3 {
  font-family: var(--font-heading);
  letter-spacing: 0.03em;
}

.product-card,
.product-list__item,
.about-block,
.blog-card {
  background: var(--ai-deep);
  border: 1px solid var(--ai-line);
  border-radius: 0;
  box-shadow: none;
}

.product-card:hover,
.product-list__item:hover,
.blog-card:hover {
  border-color: var(--nezu);
  box-shadow: none;
  transform: none;
}

.product-card__badge {
  font-family: var(--font-mono);
  border-radius: 0;
  background: rgba(228, 87, 46, 0.14);
  color: var(--shu);
}

.blog-card__date,
.page-date,
.blog-card__more {
  font-family: var(--font-mono);
}

.product-back,
.blog-nav,
.list-item {
  border-color: var(--ai-line);
}

.prose a {
  color: var(--ai);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--kinari);
}

.prose strong {
  color: var(--kinari);
}

.prose blockquote {
  border-left-color: var(--shu);
}

.prose code {
  font-family: var(--font-mono);
  color: var(--yamabuki);
}

.prose pre {
  background: var(--ai-deep);
  border: 1px solid var(--ai-line);
  color: var(--kinari);
  border-radius: 0;
}

.prose pre code {
  color: inherit;
}

.prose th,
.prose td {
  border-color: var(--ai-line);
}

.empty-state {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--nezu);
  text-align: left;
  padding: 24px;
  border: 1px dashed var(--ai-line);
}

/* --- Footer --- */
.site-footer {
  background: var(--sumi-deep);
  border-top: 1px solid var(--ai-line);
  color: var(--nezu);
}

.site-footer .logo-text {
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: var(--kinari);
}

.footer-tagline {
  font-family: var(--font-heading);
  color: var(--nezu);
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.8125rem;
  text-transform: none;
  letter-spacing: 0.03em;
  color: var(--matcha);
}

.footer-col a,
.footer-col span {
  color: var(--kinari);
  font-size: 0.875rem;
}

.footer-col a:hover {
  color: var(--ai);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  border-top-color: var(--ai-line);
  text-align: left;
  font-family: var(--font-mono);
}

.footer-bottom p {
  font-size: 0.75rem;
  color: var(--nezu);
}

.footer-bottom .footer-exit {
  color: #3C4757;
}

/* --- English: 欧文は字幅が広いため見出しを一段小さくする --- */
:lang(en) .hero-c__title {
  font-size: clamp(2.5rem, 6.2vw, 4.75rem);
  letter-spacing: 0;
}

:lang(en) .mission-c__quote {
  letter-spacing: 0;
}

/* ============================================
   Motion
   動きは補助。内容はJavaScriptなしでも、動きを減らす設定でも読める。
   ============================================ */

/* --- ポインタの灯り --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 30%), rgba(111, 163, 224, 0.09), transparent 70%);
  transition: opacity 0.6s ease;
}

.has-pointer body::before {
  opacity: 1;
}

/* --- 小さな反応 --- */
.btn__arrow {
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.btn:hover .btn__arrow {
  transform: translateX(6px);
}

.panel {
  transition: border-color 0.3s ease;
}

.panel:hover {
  border-color: #3A4A63;
}

.spec__cell {
  position: relative;
}

.spec__cell::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--shu);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.spec__cell:hover::before {
  transform: scaleX(1);
}

.about-c__more span {
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.about-c__more:hover span {
  transform: translateX(4px);
}

@media (prefers-reduced-motion: no-preference) {
  /* --- 読み込み時: ヒーロー --- */
  .rise {
    animation: wayo-rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: var(--d, 0s);
  }

  .hero-c__title .line {
    display: block;
    overflow: hidden;
    padding-bottom: 0.08em;
  }

  .hero-c__title .line > span {
    display: inline-block;
    animation: wayo-line 0.9s cubic-bezier(0.16, 0.8, 0.2, 1) both;
    animation-delay: var(--d, 0s);
  }

  .hero-c__title .maru {
    display: inline-block;
    animation: wayo-stamp 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
    animation-delay: 1.05s;
  }

  .editor__logo {
    animation: wayo-wipe 1.1s cubic-bezier(0.6, 0, 0.2, 1) both;
    animation-delay: 0.55s;
  }

  .editor__hanko {
    animation: wayo-stamp 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
    animation-delay: 1.7s;
  }

  .dot {
    animation: wayo-pulse 2.6s ease-out infinite;
  }

  /* --- スクロールでの出現（JavaScriptが動くときだけ隠す） --- */
  .js .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s ease-out, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
    transition-delay: var(--d, 0s);
  }

  .js .reveal.is-in {
    opacity: 1;
    transform: none;
  }

  .js .reveal .sec__title::after,
  .js .sec__title.reveal::after {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.35s;
  }

  .js .reveal.is-in .sec__title::after,
  .js .sec__title.reveal.is-in::after {
    transform: scaleX(1);
  }

  /* --- 使命: 句点の判、差分の塗り --- */
  .js .reveal .mission-c__quote .maru {
    display: inline-block;
    opacity: 0;
  }

  .js .reveal.is-in .mission-c__quote .maru {
    animation: wayo-stamp 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) 0.7s both;
  }

  .js .diff.reveal .diff__line {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  }

  .js .diff.reveal.is-in .diff__line {
    opacity: 1;
    transform: none;
  }

  .js .diff.reveal.is-in .diff__line--minus { transition-delay: 0.45s; }
  .js .diff.reveal.is-in .diff__line--plus { transition-delay: 1s; }

  .js .diff.reveal .diff__line--plus {
    background-image: linear-gradient(rgba(163, 190, 108, 0.1), rgba(163, 190, 108, 0.1));
    background-color: transparent;
    background-repeat: no-repeat;
    background-size: 0% 100%;
    transition: opacity 0.4s ease-out, transform 0.4s ease-out, background-size 0.7s cubic-bezier(0.6, 0, 0.2, 1);
  }

  .js .diff.reveal.is-in .diff__line--plus {
    background-size: 100% 100%;
    transition-delay: 1s, 1s, 1.25s;
  }

  .js .reveal .about-c__hanko {
    opacity: 0;
  }

  .js .reveal.is-in .about-c__hanko {
    animation: wayo-stamp 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) 0.9s both;
  }
}

@keyframes wayo-rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes wayo-line {
  from { transform: translateY(110%); }
  to { transform: none; }
}

@keyframes wayo-stamp {
  0% { opacity: 0; transform: scale(1.9) rotate(-10deg); }
  60% { opacity: 1; transform: scale(0.92) rotate(1deg); }
  100% { opacity: 1; transform: none; }
}

@keyframes wayo-wipe {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes wayo-pulse {
  0% { box-shadow: 0 0 0 0 rgba(163, 190, 108, 0.45); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(163, 190, 108, 0); }
}
