:root {
  color-scheme: dark;
  --bg: #01030a;
  --bg-rgb: 1, 3, 10;
  --bg-alpha: 0.82;
  --grid: rgba(255, 255, 255, 0.025);
  --text: #f5f7ff;
  --muted: #a9b2c8;
  --accent: #6f80ff;
  --accent-2: #8ba4c7;
  --signal: #d0a46d;
}

* {
  box-sizing: border-box;
}

/* ===== 背景・全体 ===== */

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Noto Sans JP", "Inter", system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: rgba(var(--bg-rgb), var(--bg-alpha));
  background: radial-gradient(
      circle at 15% 18%,
      rgba(32, 48, 108, 0.18),
      transparent 55%
    ),
    radial-gradient(
      circle at 75% -8%,
      rgba(43, 113, 132, 0.14),
      transparent 60%
    ),
    linear-gradient(
      160deg,
      rgba(1, 3, 10, var(--bg-alpha)) 0%,
      rgba(5, 7, 18, var(--bg-alpha)) 45%,
      rgba(9, 15, 29, var(--bg-alpha)) 100%
    );
  color: var(--text);
  line-height: 1.68;
  letter-spacing: 0.01em;
  padding: clamp(20px, 4vw, 72px);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(
      circle at 22% 22%,
      rgba(127, 124, 255, 0.09),
      transparent 50%
    ),
    radial-gradient(circle at 82% 3%, rgba(59, 245, 213, 0.08), transparent 60%),
    repeating-linear-gradient(90deg, transparent 0 98px, var(--grid) 98px 100px),
    repeating-linear-gradient(
      180deg,
      transparent 0 98px,
      var(--grid) 98px 100px
    );
  z-index: 0;
  pointer-events: none;
}

/* ===== 中央カラム（header / main / footer 共通） ===== */

body > header,
body > main,
body > footer {
  width: 100%;
  max-width: 780px;
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

/* ===== 記事カラム ===== */

article {
  max-width: 82ch; /* ここが本文カラム幅の基準 */
  margin: 0 auto;
  padding: clamp(0px, 0.2vw, 2px) clamp(8px, 1.4vw, 16px); /* 上下 / 左右 */
  margin-bottom: clamp(16px, 4vw, 28px);
}

/* ===== ヘッダー ===== */

header {
  padding-top: clamp(12px, 3vw, 22px);
  padding-bottom: clamp(12px, 3vw, 22px);
  text-align: center;
}

header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.6rem);
  letter-spacing: 0.16em;
  line-height: 1.35;
}

/* ===== セクション ===== */

main {
  display: flex;
  flex-direction: column;
}

main > section {
  padding-block: clamp(12px, 2vw, 18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

main > section:last-of-type {
  border-bottom: none;
}

/* ===== 見出し ===== */

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  letter-spacing: 0.04em;
  margin: 0;
}

h2 {
  margin: 0 0 clamp(0.8rem, 1.6vw, 1.1rem);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: 0.08em;
  position: relative;
  padding-bottom: 0.35rem;
}

h2::before {
  content: "/";
  font-family: "Space Mono", "IBM Plex Mono", Consolas, monospace;
  color: var(--accent-2);
  font-size: inherit;
  line-height: 1;
  letter-spacing: 0.25em;
  display: inline-flex;
  align-items: center;
}

h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.5rem;
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
  opacity: 0.85;
}

h3 {
  margin: clamp(0.8rem, 0.8vw, 1.2rem) 0 clamp(0.45rem, 1.2vw, 0.8rem);
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.12em;
  position: relative;
  padding-left: 1rem;
}

h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

/* ===== テキストカラム（article に従属） ===== */

main p,
main h2,
main h3,
main ul,
main ol,
main blockquote {
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* 本文 */
p {
  margin: 0;
  padding: 0 clamp(2px, 0.3vw, 4px);
  font-size: 1.02rem;
  line-height: 1.6;
}

p + p {
  margin-top: 0.6rem;
}

h2 + *,
h3 + * {
  margin-top: 0.5rem;
}

/* Google Docs 由来の span 潰し */

p span[style*="inline-block"][style*="width"] {
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
}

p span[style*="inline-block"][style*="height"] {
  height: auto !important;
}

/* ===== 画像 ===== */

article img {
  display: block;
  width: 100%; /* article の幅にフィット */
  max-width: 100%;
  height: auto;
  margin-block: clamp(1rem, 2vw, 1.8rem);
  margin-inline: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
}

/* ===== リンク ===== */

a {
  color: var(--accent);
  text-decoration: none;
  position: relative;
  padding-bottom: 3px;
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transition: transform 220ms ease;
  transform-origin: center;
}

a:hover::after,
a:focus-visible::after {
  transform: scaleY(1.8);
}

/* ===== リスト ===== */

ul,
ol {
  margin: 0;
  padding-left: 1.5rem;
}

li + li {
  margin-top: 0.4rem;
}

/* ===== 引用 ===== */

blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.5rem;
  margin: clamp(1.25rem, 3vw, 2rem) 0;
  color: var(--text);
  font-style: normal;
  letter-spacing: 0.12em;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0 10px 10px 0;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}

/* ===== 動画埋め込み ===== */

article .video-embed {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: clamp(1rem, 2vw, 1.8rem) 0;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.6);
}

article .video-embed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 0;
}

/* ===== リンクカード ===== */

.link-card {
  display: block;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(6, 8, 18, 0.8);
  color: var(--text);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  padding: clamp(1.1rem, 3vw, 1.8rem) clamp(1.3rem, 3vw, 2.1rem);
}

/* article 内のカードはカラム幅いっぱい */

article .link-card {
  width: 100%;
  max-width: 100%;
  margin: clamp(0.8rem, 3vw, 2.4rem) 0;
}

.link-card__brand {
  font-size: 0.9rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.link-card__title {
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.9rem;
}

.link-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
}

.link-card__meta {
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* カード・動画が連続したときの余白調整 */

article .video-embed,
article .link-card {
  margin: 1.2rem 0;
}

article .video-embed + .video-embed,
article .video-embed + .link-card,
article .link-card + .video-embed,
article .link-card + .link-card {
  margin-top: 0.5rem;
}

/* ===== フッター ===== */

footer {
  margin-top: clamp(1.8rem, 4vw, 2.8rem);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ===== 特定リスト内リンクカード ===== */

ul li .link-card {
  max-width: 100%;
  padding: 0.7rem 1rem;
  margin: 0;
  border-radius: 10px;
  font-size: 0.95rem;
  background: rgba(8, 10, 20, 0.7);
  border-color: rgba(255, 255, 255, 0.12);
}

#links ul {
  list-style: none;
  padding-left: 0;
}

#links li + li {
  margin-top: 0.6rem;
}

/* ===== レスポンシブ ===== */

@media (max-width: 720px) {
  body {
    padding: clamp(16px, 6vw, 42px);
  }

  header {
    padding-bottom: clamp(8px, 3vw, 16px);
  }

  header h1 {
    font-size: clamp(1.8rem, 7vw, 2.2rem);
    letter-spacing: 0.14em;
  }

  main > section {
    padding-block: clamp(8px, 3vw, 16px);
  }

  h2 {
    margin-bottom: 1rem;
    font-size: clamp(1.2rem, 5vw, 1.4rem);
    letter-spacing: 0.12em;
  }

  h3 {
    font-size: clamp(0.8rem, 4vw, 1rem);
  }

  article {
    padding-inline: 10px;
  }

  article p {
    font-size: 0.92rem;
  }

  article .link-card__brand {
    font-size: 0.8rem;
    margin-bottom: 0.9rem;
  }

  article .link-card__title {
    font-size: 0.9rem;
    margin-bottom: 0.9rem;
  }
  article .link-card__footer {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 14px;
  }

  header h1 {
    font-size: 1.4rem;
    letter-spacing: 0.1em;
  }

  h2 {
    font-size: 1.2rem;
    letter-spacing: 0.08em;
  }

  h3 {
    font-size: 0.94rem;
  }

  article {
    padding-inline: 6px;
  }

  article p {
    font-size: 0.82rem;
    line-height: 1.6;
  }

  article img,
  article .video-embed,
  article .link-card {
    width: 100%;
    max-width: 100%;
    margin-block: 0.8rem;
  }

  article .link-card__brand {
    font-size: 0.6rem;
    margin-bottom: 0.8rem;
  }

  article .link-card__title {
    font-size: 0.8rem;
    margin-bottom: 0.8rem;
  }
  article .link-card__footer {
    font-size: 0.6rem;
  }
}
.lang-switch {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin: 0;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;

  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(6, 8, 18, 0.55);
  color: var(--text);

  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  transition: transform 160ms ease, border-color 160ms ease,
    background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.lang-btn::after {
  content: none;
}

.lang-btn:hover,
.lang-btn:focus-visible {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(10, 14, 28, 0.62);
  box-shadow: 0 0 0 3px rgba(111, 128, 255, 0.14);
  transform: translateY(-1px);
  outline: none;
}

.lang-btn.is-active,
.lang-btn[aria-current="page"] {
  border-color: rgba(111, 128, 255, 0.55);
  background: rgba(111, 128, 255, 0.12);
  color: var(--text);
  font-weight: 700;
}

@media (max-width: 480px) {
  .lang-switch {
    justify-content: center;
  }
  .lang-btn {
    font-size: 0.78rem;
    padding: 0.38rem 0.6rem;
    letter-spacing: 0.1em;
  }
}

/* Small inline notes for Japan-specific terms */
.gloss {
  font-size: 0.85em;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .gloss {
    font-size: 0.82em;
    white-space: normal;
  }
}
