/* =========================================================================
   Rifiru Oi 合同会社 — corporate site styles
   Design tokens (color / spacing / type) live in :root for easy theming.
   ========================================================================= */

:root {
  /* Color system */
  --primary: #0f1c3f;          /* deep indigo/navy — trust */
  --primary-600: #1a2c5b;
  --primary-300: #4a5a86;
  --accent: #142a4e;           /* muted vermillion — CTAs/highlights */
  /* --accent: #e85d3d;           */
  --accent-600: #3d6aa7;
  /* --accent-600: #cf4a2c; */

  --bg: #fafaf8;               /* off-white */
  --bg-alt: #f2f2ee;           /* subtle gray section */
  --surface: #ffffff;
  --border: #e3e3dc;
  --line: #d8d8d0;

  --text: #1c2333;
  --text-muted: #5c6478;
  --on-dark: #eef0f6;
  --on-dark-muted: #a7b0c8;

  /* Typography */
  --font-latin: "Inter", "Noto Sans JP", system-ui, sans-serif;
  --font-jp: "Noto Sans JP", "Inter", system-ui, sans-serif;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 40px;
  --space-6: 64px;
  --space-7: 96px;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(15, 28, 63, 0.06), 0 8px 24px rgba(15, 28, 63, 0.06);
  --shadow-hover: 0 4px 8px rgba(15, 28, 63, 0.08), 0 16px 40px rgba(15, 28, 63, 0.1);

  --header-h: 68px;
  --max-w: 1160px;
}

/* Japanese line spacing when JP is active */
html[lang="ja"] body {
  line-height: 1.9;
  letter-spacing: 0.01em;
  font-family: var(--font-jp);
}

/* ---------------------------------------------------------------- Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-latin);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

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

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 13px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff; 
   /* box-shadow: 0 4px 14px rgba(232, 93, 61, 0.28); */
  box-shadow: 0 4px 14px rgba(20, 42, 78, 0.28);
}
.btn-primary:hover {
  background: var(--accent-600);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border-color: var(--line);
}
.btn-ghost:hover {
  border-color: var(--primary);
  background: rgba(15, 28, 63, 0.03);
}

.btn-block {
  width: 100%;
}

/* ---------------------------------------------------------------- Header */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  background: rgba(250, 250, 248, 0.85);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--primary);
}
.brand-mark {
  color: var(--primary);
  display: inline-flex;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-name {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--primary);
}
.brand-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-left: auto;
}
.main-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  padding: 6px 2px;
  position: relative;
  transition: color 0.2s ease;
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.2s ease;
}
.main-nav a:hover {
  color: var(--primary);
}
.main-nav a:hover::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Language switcher pill */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  background: var(--surface);
}
.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 5px 11px;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}
.lang-btn[aria-pressed="true"] {
  background: var(--primary);
  color: #fff;
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 0 auto;
  background: var(--primary);
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------------------------------------------------------------- Hero */
.hero {
  position: relative;
  padding-top: calc(var(--header-h) + var(--space-7));
  padding-bottom: var(--space-7);
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 60% at 85% 10%, rgba(232, 93, 61, 0.08), transparent 60%),
    radial-gradient(70% 70% at 10% 20%, rgba(15, 28, 63, 0.06), transparent 60%),
    linear-gradient(180deg, #ffffff, var(--bg));
  background-size: 200% 200%, 200% 200%, 100% 100%;
  animation: heroShift 18s ease-in-out infinite alternate;
  z-index: -1;
}
/* subtle grid line motif */
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.25;
  mask-image: radial-gradient(70% 60% at 50% 30%, #000, transparent 80%);
}
@keyframes heroShift {
  0% { background-position: 0% 0%, 0% 0%, 0 0; }
  100% { background-position: 100% 100%, 100% 50%, 0 0; }
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: var(--space-6);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.hero-copy h1 {
  font-size: clamp(1.9rem, 4.2vw, 3rem);
  line-height: 1.3;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.01em;
}
.hero-sub {
  margin-top: var(--space-4);
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 44ch;
}
.hero-cta {
  margin-top: var(--space-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* Network SVG */
.hero-visual {
  justify-self: center;
}
.network-svg {
  width: 100%;
  max-width: 420px;
}
.node-label {
  font-family: var(--font-latin);
  font-size: 13px;
  font-weight: 600;
  fill: var(--primary);
}
.net-line {
  stroke-dasharray: 6 6;
  animation: dash 6s linear infinite;
  opacity: 0.7;
}
@keyframes dash {
  to { stroke-dashoffset: -120; }
}
.node-pulse {
  fill: var(--accent);
  opacity: 0.15;
  transform-origin: center;
  animation: pulse 3s ease-in-out infinite;
}
.net-nodes .node:nth-child(2) .node-pulse { animation-delay: 1s; }
.net-nodes .node:nth-child(3) .node-pulse { animation-delay: 2s; }
@keyframes pulse {
  0%, 100% { transform: scale(0.7); opacity: 0.1; }
  50% { transform: scale(1.15); opacity: 0.28; }
}

/* ---------------------------------------------------------------- Sections */
.section {
  padding: var(--space-7) 0;
}
.section-alt {
  background: var(--bg-alt);
}
.section-head {
  max-width: 640px;
  margin: 0 auto var(--space-6);
  text-align: center;
}
.section-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--primary);
  font-weight: 700;
  line-height: 1.35;
}
.section-lead {
  margin-top: var(--space-3);
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- Grids */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

/* ---------------------------------------------------------------- Service cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-4);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary-300);
}
.card-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(15, 28, 63, 0.06);
  color: var(--primary);
  margin-bottom: var(--space-3);
}
.card-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.card h3 {
  font-size: 1.08rem;
  color: var(--primary);
  margin-bottom: var(--space-2);
  font-weight: 600;
}
.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------- Stepper */
.stepper {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.step-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.step h3 {
  font-size: 1rem;
  color: var(--primary);
  margin: var(--space-1) 0 var(--space-2);
  font-weight: 600;
}
.step p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ---------------------------------------------------------------- Features */
.features .feature {
  padding: var(--space-4);
  border-top: 2px solid var(--line);
}
.feature-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}
.feature h3 {
  font-size: 1.05rem;
  color: var(--primary);
  margin-bottom: var(--space-2);
  font-weight: 600;
}
.feature p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------- Network (dark) */
.section-dark {
  background: var(--primary);
  color: var(--on-dark);
}
.network-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-6);
  align-items: center;
}
.network-copy .eyebrow {
  color: var(--accent);
}
.network-copy h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  color: #fff;
  margin-bottom: var(--space-4);
  line-height: 1.4;
}
.network-copy p {
  color: var(--on-dark-muted);
  margin-bottom: var(--space-3);
}
.network-list {
  list-style: none;
  padding: 0;
  margin-top: var(--space-4);
  display: grid;
  gap: var(--space-2);
}
.network-list li {
  position: relative;
  padding-left: var(--space-4);
  color: var(--on-dark);
  font-size: 0.95rem;
}
.network-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
}

.network-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.node-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  min-width: 150px;
}
.node-jp {
  border-color: var(--accent);
  background: rgba(232, 93, 61, 0.12);
}
.node-region {
  display: block;
  font-weight: 700;
  color: #fff;
  font-size: 1.05rem;
}
.node-role {
  display: block;
  font-size: 0.82rem;
  color: var(--on-dark-muted);
  margin-top: var(--space-1);
}
.node-connector {
  width: 2px;
  height: 40px;
  background: linear-gradient(var(--accent), rgba(255, 255, 255, 0.2));
}
.node-row {
  display: flex;
  gap: var(--space-4);
  position: relative;
}
.node-row::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 25%;
  right: 25%;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
}

/* ---------------------------------------------------------------- Overview */
.overview {
  max-width: 760px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}
.ov-row {
  display: grid;
  grid-template-columns: 220px 1fr;
}
.ov-row + .ov-row {
  border-top: 1px solid var(--border);
}
.ov-row dt {
  background: var(--bg-alt);
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  color: var(--primary);
  font-size: 0.9rem;
  border-right: 1px solid var(--border);
}
.ov-row dd {
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------- Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: var(--space-6);
  align-items: start;
}
.contact-intro h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  color: var(--primary);
  margin-bottom: var(--space-3);
  line-height: 1.4;
}
.contact-intro p {
  color: var(--text-muted);
}
.contact-alt {
  margin-top: var(--space-4);
  font-size: 0.95rem;
}
.contact-alt a {
  color: var(--accent);
  font-weight: 600;
}

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow);
  display: grid;
  gap: var(--space-4);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}
.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 93, 61, 0.15);
}
.field textarea {
  resize: vertical;
}
.field .error {
  display: none;
  font-size: 0.78rem;
  color: var(--accent-600);
}
.field.invalid input,
.field.invalid textarea {
  border-color: var(--accent-600);
}
.field.invalid .error {
  display: block;
}
.form-success {
  background: rgba(46, 160, 105, 0.1);
  border: 1px solid rgba(46, 160, 105, 0.4);
  color: #1f7a4d;
  border-radius: var(--radius);
  padding: var(--space-3);
  font-size: 0.9rem;
  text-align: center;
}

/* ---------------------------------------------------------------- Footer */
.site-footer {
  background: var(--primary);
  color: var(--on-dark);
  padding-top: var(--space-6);
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: var(--space-5);
  align-items: start;
  padding-bottom: var(--space-5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.footer-brand .brand-name {
  color: #fff;
  font-size: 1.05rem;
}
.footer-brand p {
  color: var(--on-dark-muted);
  font-size: 0.9rem;
  margin-top: var(--space-2);
  max-width: 34ch;
}
.footer-nav {
  display: grid;
  gap: var(--space-2);
}
.footer-nav a {
  color: var(--on-dark-muted);
  font-size: 0.9rem;
  transition: color 0.2s ease;
}
.footer-nav a:hover {
  color: #fff;
}
.footer-lang .lang-switch {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}
.footer-lang .lang-btn {
  color: var(--on-dark-muted);
}
.footer-lang .lang-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}
.footer-bottom {
  padding: var(--space-4) var(--space-4);
  text-align: center;
}
.footer-bottom p {
  color: var(--on-dark-muted);
  font-size: 0.82rem;
}

/* ---------------------------------------------------------------- Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .hero-visual {
    order: -1;
    max-width: 340px;
  }
  .grid-3,
  .stepper {
    grid-template-columns: repeat(2, 1fr);
  }
  .network-grid,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .main-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--space-2) var(--space-4) var(--space-4);
    transform: translateY(-120%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow);
  }
  .main-nav.open {
    transform: translateY(0);
  }
  .main-nav a {
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
  }
  .nav-toggle {
    display: flex;
  }
  .grid-3,
  .stepper {
    grid-template-columns: 1fr;
  }
  .ov-row {
    grid-template-columns: 130px 1fr;
  }
  .footer-inner {
    grid-template-columns: 1fr;
  }
  .section {
    padding: var(--space-6) 0;
  }
  .hero {
    padding-top: calc(var(--header-h) + var(--space-5));
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
