/* Melavern 公式サイト。判断の理由は ../DESIGN.md、値の正本はこのファイル。 */

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/newsreader-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #1d1a3a;         /* 本文 */
  --ink-2: #3a3560;       /* 説明文・ナビ */
  --muted: #6d64a3;       /* 補足ラベル・フッター（白地 5.25:1、淡色地 4.86:1） */
  --brand: #2b1f80;       /* ワードマーク・hover */
  --heading: #1f1766;     /* 見出し */
  --accent: #4a36c4;      /* リンク・矢印 */
  --line: #e6e1f7;        /* 区切り線・カード枠 */
  --line-hover: #b9acee;
  --tint: #f7f5fd;        /* ページ下部の淡いラベンダー */
  --tint-2: #efeafd;      /* 矢印の丸 */
  --glow-1: rgba(196, 182, 247, 0.5);
  --glow-2: rgba(232, 225, 251, 0.3);
  --shadow-rest: 0 1px 2px rgba(43, 31, 128, 0.04);
  --shadow-hover: 0 12px 32px rgba(43, 31, 128, 0.1);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;

  --gutter: 32px;
  --max: 1120px;
  --radius-card: 20px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: #ffffff;
  -webkit-text-size-adjust: 100%;
}

/* hero の glow はコンテナの外へ柔らかく抜ける。角で切ると硬い縁が見えるので、
   横方向のはみ出しだけを viewport で止める（clip はスクロールコンテナを作らない） */
html, body {
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  /* 白を大きく使い、下へ行くほど淡いラベンダーへ。控えめなグラデーションはここと hero の glow だけ */
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 55%, var(--tint) 100%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

/* --- ヘッダー --------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 88px;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--brand);
  /* 文字の高さは小さいので、タップ領域だけ 44px に広げる */
  padding: 12px 0;
  margin: -12px 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
  font-weight: 500;
}

.nav-link {
  color: var(--ink-2);
  padding: 12px 2px;
  margin: -12px -2px;
}

.nav-link:hover { color: var(--brand); }

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -14px; /* アイコンの右端を本文の右端に揃える */
  color: var(--muted);
}

.nav-icon:hover { color: var(--brand); }

/* --- ヒーロー --------------------------------------------------------- */

.hero {
  position: relative;
  padding: 48px 0 64px;
}

.hero-glow {
  position: absolute;
  right: -140px;
  top: -120px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow-1), var(--glow-2) 55%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

.hero-body {
  position: relative;
  max-width: 720px;
}

.hero-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(48px, 6.5vw, 80px);
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--heading);
  /* グラデーションは文字幅に合わせる。ブロック幅（720px）に張ると文字は左半分の暗い部分しか
     使えず単色に見える。深い青紫（M）から紫（vern）へ。終端は --muted と同じ 5.25:1 以上を保つ */
  width: fit-content;
  background: linear-gradient(100deg, #15134f 0%, #2b1f80 38%, #5a42c8 68%, #7556cf 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 英字ワードマークの読み。主役にしないので小さく、補足ラベルと同じ色 */
.hero-reading {
  margin: 14px 0 0;
  font-size: 13px;
  letter-spacing: 0.14em;
  line-height: 1;
  color: var(--muted);
}

.hero-lead {
  margin: 20px 0 0;
  max-width: 560px;
  font-size: 17px;
  line-height: 1.9;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* --- Products --------------------------------------------------------- */

.products {
  padding: 0 0 112px;
  scroll-margin-top: 24px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.section-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 36px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--heading);
}

.section-note {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.product-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 20px;
}

.product {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
  padding: 36px 36px 32px;
  border-radius: var(--radius-card);
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-rest);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.product:hover,
.product:focus-visible {
  color: var(--ink);
  border-color: var(--line-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.product:focus-visible {
  outline-offset: 4px;
  border-radius: var(--radius-card);
}

.product-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.product-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  letter-spacing: -0.015em;
  line-height: 1.1;
  color: var(--heading);
}

.product-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--tint-2);
  color: var(--accent);
}

.product-desc {
  display: block;
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-2);
  text-wrap: pretty;
}

.product-host {
  display: block;
  margin-top: auto;
  padding-top: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent);
  overflow-wrap: anywhere;
}

/* --- フッター --------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  padding: 32px 0 max(40px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.footer-copy { font-size: inherit; }

/* 補助リンク。Products や X アイコンより弱く、本文色の小さな文字リンクに留める */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 24px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ink-2);
}

.footer-link:hover { color: var(--brand); }

/* フッターの X はアイコンだけ。44×44 の箱でタップ領域を保ち、負のマージンで
   アイコンの見た目の位置（右端と Ko-fi との間隔）を文字リンク時と揃える */
.footer-icon {
  width: 44px;
  justify-content: center;
  margin: 0 -15px;
}

/* --- スマホ幅 ------------------------------------------------------------ */

@media (max-width: 640px) {
  :root { --gutter: 20px; }

  .site-header { height: 72px; }
  .wordmark { font-size: 24px; }

  .hero { padding: 32px 0 48px; }
  .hero-glow {
    width: 360px;
    height: 360px;
    right: -150px;
    top: -140px;
  }
  .hero-lead { font-size: 16px; }

  .products { padding-bottom: 80px; }
  .section-title { font-size: 30px; }

  .product { padding: 28px 24px 24px; gap: 16px; }
  .product-name { font-size: 28px; }

  .site-footer { padding-top: 24px; }
}

/* --- 環境設定への追従 ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .product { transition: none; }
  .product:hover,
  .product:focus-visible { transform: none; }
}

@media (forced-colors: active) {
  .hero-title {
    background: none;
    -webkit-text-fill-color: CanvasText;
    color: CanvasText;
  }
  .product { border-color: CanvasText; }
}
