/* ======================================================================
   FormlyX サポートサイト スタイル（リファイン版・KARTE風）
   - 落ち着いた白基調 + Xロゴ由来のグラデーション(青→紫→ピンク)を差し色
   - 余白を広く、タイポを洗練、シャドウは最小限
   ====================================================================== */
:root {
  /* Brand X gradient: Blue → Violet → Pink */
  --g-1: #3b82f6;
  --g-2: #7c3aed;
  --g-3: #ec4899;
  --grad: linear-gradient(135deg, var(--g-1) 0%, var(--g-2) 50%, var(--g-3) 100%);
  --grad-soft: linear-gradient(135deg, #eff4ff 0%, #f4ecff 50%, #fdebf3 100%);

  --p: #7c3aed;
  --p-dark: #6d28d9;
  --p-bg: #f4ecff;

  /* Neutrals */
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --border: #e5e7eb;
  --border-soft: #f1f5f9;
  --bg: #fafbfc;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;

  --warn-bg: #fff8e6;
  --warn-bd: #f3d98a;
  --warn-ink: #8a6300;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 14px rgba(15,23,42,.06);
  --shadow-hover: 0 8px 24px rgba(15,23,42,.08);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.005em;
}
a { color: var(--p-dark); text-decoration: none; transition: color .15s; }
a:hover { color: var(--g-3); text-decoration: none; }

/* ---------- Header ---------- */
.s-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.s-header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 28px;
  height: 64px; display: flex; align-items: center; gap: 24px;
}
.s-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; color: var(--ink); font-size: 17px;
  white-space: nowrap; line-height: 1;
}
.s-logo:hover { text-decoration: none; color: var(--ink); }
.s-logo img { height: 26px; width: auto; display: block; }
.s-logo small {
  font-weight: 600; color: var(--muted); font-size: 12px;
  margin-left: 4px; padding-left: 10px;
  border-left: 1px solid var(--border);
}
.s-header-spacer { flex: 1; }
.s-header-link {
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  white-space: nowrap; transition: color .15s;
}
.s-header-link:hover { color: var(--ink); text-decoration: none; }
.s-header-cta {
  font-size: 13.5px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #7c3aed 50%, #ec4899 100%);
  padding: 9px 18px; border-radius: 8px; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(124,58,237,.28);
  transition: transform .15s, box-shadow .2s;
}
.s-header-cta:hover {
  text-decoration: none; color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(124,58,237,.42);
}

/* ---------- Search ---------- */
.s-search { position: relative; width: 340px; max-width: 38vw; }
.s-search input {
  width: 100%; height: 40px; padding: 0 14px 0 40px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  font-size: 13.5px; font-family: var(--font); color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.s-search input::placeholder { color: var(--muted-light); }
.s-search input:focus { border-color: var(--p); box-shadow: 0 0 0 4px rgba(124,58,237,.12); }
.s-search::before {
  content: ""; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; opacity: .55;
  background: no-repeat center/contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
}
.s-search-results {
  position: absolute; top: 48px; left: 0; right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-hover); overflow: hidden; display: none;
  max-height: 70vh; overflow-y: auto;
}
.s-search-results.open { display: block; }
.s-search-results a {
  display: block; padding: 12px 16px; border-bottom: 1px solid var(--border-soft);
  color: var(--ink); font-size: 13.5px; font-weight: 500;
  transition: background .12s;
}
.s-search-results a:last-child { border-bottom: none; }
.s-search-results a:hover { background: var(--bg-subtle); text-decoration: none; }
.s-search-results a .cat {
  display: block; font-size: 11px; color: var(--muted);
  margin-top: 2px; font-weight: 500;
}
.s-search-empty { padding: 18px; color: var(--muted); font-size: 13px; }

/* ---------- Hero (home) ---------- */
.s-hero {
  position: relative; overflow: hidden;
  background: var(--grad-soft);
  padding: 76px 24px 84px;
  border-bottom: 1px solid var(--border-soft);
}
.s-hero::before,
.s-hero::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: .35; pointer-events: none;
}
.s-hero::before {
  width: 460px; height: 460px;
  background: radial-gradient(circle, var(--g-2), transparent 70%);
  top: -180px; left: -120px;
}
.s-hero::after {
  width: 480px; height: 480px;
  background: radial-gradient(circle, var(--g-3), transparent 70%);
  bottom: -200px; right: -140px;
}
.s-hero-inner {
  position: relative; z-index: 1;
  max-width: 760px; margin: 0 auto; text-align: center;
}
.s-hero-logo {
  display: block; margin: 0 auto 28px;
  height: 56px; width: auto; max-width: 90%;
}
.s-hero h1 {
  font-size: 26px; font-weight: 700; line-height: 1.5;
  margin: 0 0 28px; letter-spacing: 0.005em;
  color: var(--ink);
}
.s-hero-wave {
  display: inline-block; margin: 0 4px;
  animation: waveHand 2.2s ease-in-out infinite;
  transform-origin: 70% 70%;
}
@keyframes waveHand {
  0%, 60%, 100% { transform: rotate(0deg); }
  10%, 30%     { transform: rotate(14deg); }
  20%, 40%     { transform: rotate(-8deg); }
  50%          { transform: rotate(10deg); }
}
.s-hero h1 .grad-text {
  background: var(--grad); -webkit-background-clip: text;
  background-clip: text; color: transparent;
  -webkit-text-fill-color: transparent;
}
.s-hero .s-search { width: 100%; max-width: 580px; margin: 0 auto; }
.s-hero .s-search input {
  height: 56px; font-size: 15.5px; border: none;
  box-shadow: 0 4px 24px rgba(15,23,42,.08);
  padding-left: 52px;
  border-radius: 12px;
}
.s-hero .s-search::before {
  left: 20px; width: 20px; height: 20px; opacity: .6;
}
.s-hero .s-search-results { top: 64px; border-radius: 12px; }

/* ---------- Layout container ---------- */
.s-container { max-width: 1200px; margin: 0 auto; padding: 0 28px; }

/* ---------- Category tiles (home) ---------- */
.s-section-title {
  font-size: 11.5px; font-weight: 700;
  color: var(--muted); letter-spacing: .14em; text-transform: uppercase;
  margin: 56px 0 20px;
  display: flex; align-items: center; gap: 12px;
}
.s-section-title::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}
.s-tiles {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.s-tile {
  display: block; background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 24px 24px 22px;
  box-shadow: var(--shadow);
  transition: transform .2s cubic-bezier(.16,1,.3,1),
              box-shadow .2s cubic-bezier(.16,1,.3,1),
              border-color .15s;
  position: relative; overflow: hidden;
}
.s-tile::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0;
  height: 2px; background: var(--grad);
  transform: translateY(-100%);
  transition: transform .25s cubic-bezier(.16,1,.3,1);
}
.s-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border);
  text-decoration: none;
}
.s-tile:hover::before { transform: translateY(0); }
.s-tile-icon {
  width: 44px; height: 44px; border-radius: 11px;
  background: var(--grad-soft); color: var(--p-dark);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  border: 1px solid rgba(124,58,237,0.08);
  transition: transform .2s;
}
.s-tile:hover .s-tile-icon { transform: scale(1.05); }
.s-tile-icon svg { width: 22px; height: 22px; }
.s-tile h3 {
  font-size: 15.5px; font-weight: 700; color: var(--ink);
  margin: 0 0 6px; letter-spacing: -0.005em;
}
.s-tile p {
  font-size: 13px; color: var(--muted); margin: 0;
  line-height: 1.65;
}

/* ---------- Doc layout (article pages) ---------- */
.s-doc {
  display: grid; grid-template-columns: 268px 1fr;
  gap: 48px; align-items: start;
  padding: 36px 0 88px;
}
.s-sidebar { position: sticky; top: 88px; }
.s-sidebar-group { margin-bottom: 24px; }
.s-sidebar-group h4 {
  font-size: 10.5px; font-weight: 700;
  color: var(--muted-light); letter-spacing: .12em;
  text-transform: uppercase; margin: 0 0 8px; padding-left: 14px;
}
.s-sidebar a {
  display: block; padding: 8px 14px; border-radius: 8px;
  font-size: 13.5px; color: var(--text);
  margin-bottom: 2px; font-weight: 500;
  transition: background .12s, color .12s;
}
.s-sidebar a:hover {
  background: var(--bg-subtle); text-decoration: none; color: var(--ink);
}
.s-sidebar a.active {
  background: var(--grad-soft); color: var(--p-dark);
  font-weight: 600;
}

/* ---------- Article content ---------- */
.s-article {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 44px 48px 52px;
  box-shadow: var(--shadow); min-width: 0;
}
.s-breadcrumb {
  font-size: 12.5px; color: var(--muted);
  margin-bottom: 18px; font-weight: 500;
}
.s-breadcrumb a { color: var(--muted); }
.s-breadcrumb a:hover { color: var(--p-dark); }
.s-article h1 {
  font-size: 30px; font-weight: 800; color: var(--ink);
  margin: 0 0 10px; line-height: 1.3;
  letter-spacing: -0.01em;
}
.s-article > .lead {
  font-size: 15.5px; color: var(--muted); margin: 0 0 32px;
  line-height: 1.7;
}
.s-article h2 {
  font-size: 21px; font-weight: 700; color: var(--ink);
  margin: 44px 0 16px; padding-top: 10px;
  scroll-margin-top: 88px;
  letter-spacing: -0.005em;
}
.s-article h2::before {
  content: ""; display: block; width: 36px; height: 3px;
  background: var(--grad); border-radius: 2px; margin-bottom: 14px;
}
.s-article h3 {
  font-size: 16.5px; font-weight: 700; color: var(--ink);
  margin: 28px 0 12px; scroll-margin-top: 88px;
}
.s-article p { margin: 0 0 14px; }
.s-article ul, .s-article ol { margin: 0 0 16px; padding-left: 24px; }
.s-article li { margin-bottom: 7px; }
.s-article strong { color: var(--ink); font-weight: 700; }
.s-article code {
  background: var(--bg-subtle); color: var(--p-dark);
  padding: 2px 7px; border-radius: 5px;
  font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace;
  border: 1px solid var(--border-soft);
}
.s-article hr { border: none; border-top: 1px solid var(--border-soft); margin: 36px 0; }

/* numbered steps */
.s-steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 20px; }
.s-steps > li {
  position: relative; padding: 0 0 22px 48px; margin: 0;
}
.s-steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--grad); color: #fff;
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(124,58,237,.25);
}
.s-steps > li::after {
  content: ""; position: absolute; left: 14.5px; top: 34px; bottom: 0;
  width: 1.5px; background: linear-gradient(to bottom, var(--border), transparent);
}
.s-steps > li:last-child { padding-bottom: 0; }
.s-steps > li:last-child::after { display: none; }
.s-steps > li strong { display: block; color: var(--ink); margin-bottom: 3px; font-size: 14.5px; }

/* callout / note */
.s-note {
  border: 1px solid var(--border-soft); border-left: 3px solid var(--p);
  background: var(--grad-soft); border-radius: 8px;
  padding: 14px 20px; margin: 20px 0; font-size: 14px;
}
.s-note.warn {
  border-left-color: var(--warn-bd);
  background: var(--warn-bg); color: var(--warn-ink);
}
.s-note .s-note-title {
  font-weight: 700; color: var(--ink); margin-bottom: 4px; display: block;
}
.s-note.warn .s-note-title { color: var(--warn-ink); }

/* table */
.s-table {
  width: 100%; border-collapse: collapse; margin: 8px 0 22px;
  font-size: 13.5px;
}
.s-table th, .s-table td {
  border: 1px solid var(--border-soft); padding: 10px 14px;
  text-align: left; vertical-align: top;
}
.s-table th {
  background: var(--bg-subtle); font-weight: 700;
  color: var(--ink); white-space: nowrap;
}

/* tag chip */
.s-chip {
  display: inline-block; background: var(--bg-subtle); color: var(--p-dark);
  border-radius: 6px; padding: 1px 9px; font-size: 12.5px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  border: 1px solid var(--border-soft);
}

/* prev/next + related */
.s-article-foot {
  margin-top: 40px; padding-top: 24px;
  border-top: 1px solid var(--border-soft);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.s-article-foot a { font-size: 13.5px; font-weight: 600; }

/* ---------- Footer ---------- */
.s-footer {
  border-top: 1px solid var(--border-soft);
  background: #fff; margin-top: 48px;
}
.s-footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 32px 28px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px; font-size: 12.5px; color: var(--muted);
}
.s-footer-inner a {
  color: var(--muted); transition: color .15s;
}
.s-footer-inner a:hover { color: var(--p-dark); text-decoration: none; }
.s-footer-links { display: flex; gap: 22px; flex-wrap: wrap; }

/* ---------- Mobile ---------- */
.s-menu-btn {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: 8px; width: 40px; height: 40px; cursor: pointer;
  color: var(--ink);
}
@media (max-width: 920px) {
  .s-tiles { grid-template-columns: 1fr; }
  .s-doc { grid-template-columns: 1fr; gap: 0; }
  .s-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 280px; z-index: 60;
    background: #fff; padding: 80px 16px 24px; box-shadow: var(--shadow-hover);
    transform: translateX(-100%); transition: transform .2s; overflow-y: auto;
  }
  .s-sidebar.open { transform: translateX(0); }
  .s-sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; display: none; }
  .s-sidebar-backdrop.open { display: block; }
  .s-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .s-article { padding: 28px 22px 36px; }
  .s-search { width: 200px; }
  .s-header-link { display: none; }
  .s-hero { padding: 56px 20px 64px; }
  .s-hero h1 { font-size: 28px; }
}
@media (max-width: 560px) {
  .s-header-inner { gap: 12px; padding: 0 16px; }
  .s-container { padding: 0 16px; }
  .s-search { display: none; }
  .s-hero .s-search { display: block; }
}
