/* ============================================================
   FlexiblueDesign — dark cinematic B2B 3DCG studio
   Design tokens + base layer. Theme + accent are driven by
   CSS variables set on :root by the Tweaks layer.
   ============================================================ */

:root {
  /* accent is injected by JS (tweaks); these are fallbacks */
  --accent: #32a2d3;
  --on-accent: #04161b;
  --accent-soft: color-mix(in srgb, var(--accent) 15%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 38%, transparent);

  /* dark theme (default) */
  --bg:        #0a0b0d;
  --bg-1:      #101216;
  --bg-2:      #15181d;
  --bg-3:      #1b1f25;
  --text:      #eef1f3;
  --text-dim:  #9aa2ab;
  --text-faint:#646b74;
  --border:    rgba(255, 255, 255, 0.09);
  --border-2:  rgba(255, 255, 255, 0.14);
  --shadow:    rgba(0, 0, 0, 0.55);
  --grid-line: rgba(255, 255, 255, 0.035);
  --placeholder-1: #14171c;
  --placeholder-2: #181c22;

  --maxw: 1240px;
  --gutter: clamp(20px, 5vw, 72px);
  --radius: 14px;
  --radius-sm: 9px;

  /* density (driven by tweak) */
  --section-pad: clamp(88px, 11vw, 168px);
  --space: 1;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --font-latin: "Helvetica Neue", Helvetica, "Hanken Grotesk", Arial, sans-serif;
  --font: var(--font-latin), "Noto Sans JP", sans-serif;
  --font-mono: "Space Mono", "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

[data-theme="light"] {
  --bg:        #f3f4f5;
  --bg-1:      #ffffff;
  --bg-2:      #ffffff;
  --bg-3:      #eef0f2;
  --text:      #14171a;
  --text-dim:  #555d66;
  --text-faint:#8b929b;
  --border:    rgba(15, 20, 25, 0.10);
  --border-2:  rgba(15, 20, 25, 0.16);
  --shadow:    rgba(20, 28, 38, 0.10);
  --grid-line: rgba(15, 20, 25, 0.04);
  --placeholder-1: #e7eaed;
  --placeholder-2: #dde1e5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "palt" 1;
  /* overflow-x: hidden だと Safari が body をスクロールコンテナ化し、
     position: sticky とスクロール連動が壊れる。clip なら視覚効果は同じで
     スクロールは viewport のまま（古いブラウザは hidden にフォールバック）。 */
  overflow-x: hidden;
  overflow-x: clip;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

::selection { background: var(--accent); color: var(--on-accent); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }

/* ---------- layout helpers ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-pad); position: relative; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--accent-line);
}

.section-title {
  font-size: clamp(30px, 4.2vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin-top: 22px;
  max-width: 20ch;
}
.lang-en .section-title { letter-spacing: -0.028em; }

.lead {
  font-size: clamp(16px, 1.5vw, 19px);
  color: var(--text-dim);
  max-width: 56ch;
  margin-top: 22px;
  text-wrap: pretty;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 26px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), background 0.3s, border-color 0.3s, color 0.3s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 0 0 var(--accent-soft);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px -10px var(--accent), 0 0 0 1px var(--accent-line);
}
.btn-ghost {
  border: 1px solid var(--border-2);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

.btn .arrow { transition: transform 0.4s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }

/* ---------- reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- render placeholder ---------- */
.ph {
  position: relative;
  background:
    repeating-linear-gradient(
      135deg,
      var(--placeholder-1) 0px, var(--placeholder-1) 11px,
      var(--placeholder-2) 11px, var(--placeholder-2) 22px
    );
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  isolation: isolate;
}
.ph::after {
  /* soft accent glow so renders feel like they emit light */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 70% 20%, var(--accent-soft), transparent 60%);
  z-index: -1;
}
.ph-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  margin: 14px;
}

.divider { height: 1px; background: var(--border); border: none; }

/* selection-safe focus rings */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* shared modal entrance */
@keyframes fb-modal-in { from { opacity: 0; } to { opacity: 1; } }

/* Terms modal */
.terms-modal-overlay {
  position: fixed; inset: 0; z-index: 9100;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
  animation: fb-modal-in 0.2s ease;
}
.terms-modal-box {
  background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: var(--radius); width: min(100%, 680px); max-height: 82vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,0.5);
}
.terms-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border); flex: none;
}
.terms-modal-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.terms-modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text-dim); padding: 0; appearance: none; -webkit-appearance: none;
  transition: color 0.2s, background 0.2s;
}
.terms-modal-close:hover { color: var(--text); background: var(--bg); }
.terms-modal-body {
  padding: 24px 28px; overflow-y: auto; flex: 1;
  line-height: 1.82; color: var(--text-dim); font-size: 14px;
}
.terms-modal-body h3 {
  font-size: 14.5px; font-weight: 600; color: var(--text);
  margin: 22px 0 8px; letter-spacing: -0.01em;
}
.terms-modal-body h3:first-child { margin-top: 0; }
.terms-modal-body p { text-wrap: pretty; margin: 0; }
.terms-modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-top: 1px solid var(--border); flex: none;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-faint);
}

/* inline anchor links */
.terms-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; transition: opacity 0.2s; }
.terms-link:hover { opacity: 0.75; }
