/* =========================
   共通フォント＆リセット
   ========================= */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  font-family: 
    "Hiragino Sans GB",
    "Noto Sans SC",
    "Noto Sans JP",
    "Noto Sans TC",
    sans-serif;
}

/* =========================
   ヘッダー（fixed）
   ========================= */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  height: 56px;
  background: transparent;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: none;
  display: block;
  flex-shrink: 0;
}

.nav-header {
  width: 100%;
  height: 56px;
  background: var(--md-sys-color-surface-container-highest, rgb(17 69 20));
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  position: relative;
  font-family: inherit;
}

.nav-logo {
  font-weight: bold;
  font-size: 1.2em;
  margin-left: 1.2em;
  color: var(--md-sys-color-on-primary-container, rgb(125 179 117));
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.nav-icon-links {
  display: flex;
  gap: 2em;
  margin-right: 1.5em;
  align-items: center;
}

.nav-icon-links a img {
  width: 40px;
  height: 40px;
  display: block;
  filter: brightness(0.98);
  transition: filter 0.2s, transform 0.2s;
}

/* =========================
   メインコンテンツ
   ========================= */
body {
  min-height: 100vh;
  background: var(--md-sys-color-background, rgb(248 250 242));
  color: var(--md-sys-color-on-background, rgb(25 28 24));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 1 auto;
  max-width: 100%;
  margin: 56px auto 0 auto;
  padding: 1.5em 1.5em 2.5em;
  border-radius: 16px;
  color: var(--md-sys-color-on-surface, rgb(25 28 24));
  background: var(--md-sys-color-surface-container, rgb(237 239 231));
  text-align: center;
  font-size: 17px;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  position: relative;
}

@media (prefers-color-scheme: dark) {
  main {
    background:
      linear-gradient(
        rgba(0, 0, 0, 0.50),
        rgba(0, 0, 0, 0.50)
      ),
      url("https://embed.pixiv.net/decorate.php?illust_id=85669957&mdate=1605360435")
        center top / contain repeat-y,
      var(--md-sys-color-surface-container);
  }
}

@media (prefers-color-scheme: light) {
  main {
    background:
      linear-gradient(
        rgba(255, 255, 255, 0.45),
        rgba(255, 255, 255, 0.45)
      ),
      url("https://embed.pixiv.net/decorate.php?illust_id=85669957&mdate=1605360435")
        center top / contain repeat-y,
      var(--md-sys-color-surface-container);
  }
}

/* 各リンクに対してこれが重要 */
main a.container {
  display: inline-block; /* インラインブロックで要素として認識させる */
  position: relative;    /* Rippleの基準点 */
  overflow: hidden;
  text-decoration: none;
  cursor: pointer;
  /* 必要であればここでサイズを明示的に指定 */
  padding: 4px;          /* クリック範囲を少し広げると押しやすいよ */
}

main h2 {
   font-size: 22px;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--md-sys-color-tertiary, rgb(0 40 68));
  transition: color 0.2s;
}

a:hover {
  color: var(--md-sys-color-primary, rgb(0 45 5));
}

/* banner付きlinkはMarkdownだけで管理し、render-link.htmlでMWC card化 */
main p:has(md-elevated-button.banner-link-card) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  width: min(1040px, 100%);
  margin: 1.25rem auto 0;
}

md-elevated-button.banner-link-card {
  width: 100%;
  min-width: 0;
  white-space: normal;
  text-wrap: wrap;
  --md-elevated-button-container-height: auto;
  --md-elevated-button-leading-space: 0;
  --md-elevated-button-trailing-space: 0;
  --md-elevated-button-container-shape: 24px;
  --md-elevated-button-container-color: color-mix(in srgb, var(--md-sys-color-surface-container-high, rgb(231 233 225)) 90%, transparent);
  --md-elevated-button-container-elevation: 1;
  --md-elevated-button-hover-container-elevation: 2;
  --md-elevated-button-focus-container-elevation: 2;
  --md-elevated-button-pressed-container-elevation: 1;
  --md-elevated-button-label-text-color: var(--md-sys-color-on-surface, rgb(25 28 24));
  --md-elevated-button-hover-label-text-color: var(--md-sys-color-on-surface, rgb(25 28 24));
  --md-elevated-button-focus-label-text-color: var(--md-sys-color-on-surface, rgb(25 28 24));
  --md-elevated-button-pressed-label-text-color: var(--md-sys-color-on-surface, rgb(25 28 24));
  --md-elevated-button-label-text-size: 1rem;
  --md-elevated-button-label-text-line-height: 1.4;
  --md-elevated-button-label-text-weight: 700;
}

.banner-link-card__inner {
  display: flex;
  width: 100%;
  min-height: 100%;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant, rgb(193 201 187)) 72%, transparent);
  border-radius: 24px;
  white-space: normal;
  text-wrap: wrap;
  box-sizing: border-box;
}

md-elevated-button.banner-link-card:hover .banner-link-card__inner,
md-elevated-button.banner-link-card:focus-within .banner-link-card__inner {
  border-color: color-mix(in srgb, var(--md-sys-color-primary, rgb(0 45 5)) 70%, transparent);
}

.banner-link-card__media {
  display: grid;
  min-height: 104px;
  padding: 0.85rem;
　background:
    color-mix(in srgb, var(--md-sys-color-primary-container) 22%, transparent),
    color-mix(in srgb, var(--md-sys-color-surface-container-highest) 92%, transparent);
  place-items: center;
}

.banner-link-card__media img {
  display: block;
  width: min(100%, 250px);
  max-height: 92px;
  object-fit: contain;
  border-radius: 12px;
}

.banner-link-card__media img[src*="google.com/s2/favicons"] {
  width: 64px;
  height: 64px;
  max-height: none;
  padding: 0.65rem;
  border-radius: 18px;
  background: var(--md-sys-color-surface, rgb(248 250 242));
}

.banner-link-card__body {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem;
}

.banner-link-card__title {
  display: block;
  color: var(--md-sys-color-on-surface, rgb(25 28 24));
  font-weight: 700;
  white-space: normal;
  text-wrap: wrap;
  overflow-wrap: anywhere;
}

.banner-link-card__text {
  display: block;
  color: var(--md-sys-color-on-surface-variant, rgb(65 73 63));
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.7;
  white-space: normal;
  text-wrap: wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  main p:has(md-elevated-button.banner-link-card) {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .banner-link-card__media {
    min-height: 96px;
    padding: 0.75rem;
  }
}


@media (max-width: 700px) {
  main { margin-top: 44px; }
}
@media (min-width: 701px) {
  main { margin-top: 56px; }
}

/* Discord風 隠し文字 */
.spoiler {
  background: #000;
  color: transparent;
  border-radius: 4px;
  padding: 2px 4px;
  transition: color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

/* ホバー時に文字を見せる */
.spoiler:hover {
  background: #222;
  color: inherit;
}



/* =========================
   フッター
   ========================= */
footer {
  background: var(--md-sys-color-surface-container-highest, rgb(225 227 220));
  color: var(--md-sys-color-on-surface, rgb(25 28 24));
  padding: 40px 0 30px 0;
  text-align: center;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

.footer-social-container {
  margin-bottom: 20px;
  text-align: center;
}

.footer-social-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  text-align: center;
  gap: 20px;
}

.footer-social-links a {
  display: flex;
  width: 48px;
  height: 48px;
  background: var(--md-sys-color-surface-container-high, rgb(231 233 225));
  border-radius: 50%;
  transition: all 0.3s ease;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.footer-social-links a:hover {
  background: var(--md-sys-color-surface-variant, rgb(221 229 215));
  transform: translateY(-3px);
}

.footer-social-links img {
  width: 24px;
  height: 24px;
  filter: brightness(0.9);
  transition: filter 0.3s;
}

.footer-social-links a:hover img {
  filter: brightness(1.2);
}

/* フッター個人リンクのカラーテーマ対応 */
@media (prefers-color-scheme: light) {
  .footer-social-links a {
    background: var(--md-sys-color-surface-container-high, rgb(231 233 225));
  }
  .footer-social-links a:hover {
    background: var(--md-sys-color-secondary-fixed, rgb(209 233 201));
  }
  .footer-social-links img {
    /* 白→黒→マテリアルプライマリカラー(緑 #006E1C 相当) */
    filter: brightness(0) saturate(100%) invert(41%) sepia(93%) saturate(748%) hue-rotate(87deg) brightness(98%) contrast(103%);
  }
  .footer-social-links a:hover img {
    /* ホバー時はより明るく鮮やかに */
    filter: brightness(0) saturate(100%) invert(68%) sepia(39%) saturate(638%) hue-rotate(87deg) brightness(105%) contrast(102%);
  }
}

@media (prefers-color-scheme: dark) {
  .footer-social-links a {
    background: var(--md-sys-color-surface-container-high, rgb(40 43 38));
  }
  .footer-social-links a:hover {
    background: var(--md-sys-color-secondary-fixed, rgb(209 233 201));
  }
  .footer-social-links img {
    /* 白→黒→マテリアルプライマリカラー(緑 #006E1C 相当) */
    filter: brightness(0) saturate(100%) invert(41%) sepia(93%) saturate(748%) hue-rotate(87deg) brightness(98%) contrast(103%);
  }
  .footer-social-links a:hover img {
    /* ホバー時はより明るく鮮やかに */
    filter: brightness(0) saturate(100%) invert(68%) sepia(39%) saturate(638%) hue-rotate(87deg) brightness(105%) contrast(102%);
  }
}

.footer-divider {
  width: 80%;
  max-width: 600px;
  height: 1px;
  background: var(--md-sys-color-outline-variant, rgb(193 201 187));
  margin: 20px auto;
  text-align: center;
}

.footer-legal {
  font-size: 14px;
  line-height: 1.6;
  color: var(--md-sys-color-on-surface-variant, rgb(65 73 63));
  text-align: center;
}

.footer-copyright {
  margin-bottom: 8px;
  font-weight: 500;
  text-align: center;
}

.footer-license a {
  color: var(--md-sys-color-tertiary, rgb(0 40 68));
  text-decoration: none;
  transition: color 0.2s;
  text-align: center;
}

.footer-license a:hover {
  color: var(--md-sys-color-on-tertiary-container, rgb(125 169 215));
  text-decoration: underline;
  text-align: center;
}

/* =========================
   レスポンシブ
   ========================= */
@media (max-width: 600px) {
  .nav-logo {
    font-size: 1em;
    margin-left: 0.6em;
  }
  .nav-icon-links {
    gap: 1em;
    margin-right: 0.6em;
  }
  .nav-icon-links a img {
    width: 32px;
    height: 32px;
  }
  header, .nav-header {
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
  }
  main {
    margin-top: 44px !important;
  }
  footer.footer-main {
    padding: 1.5em 0.6em 1em;
  }
}

@media (max-width: 700px), (orientation: portrait) {
  footer.footer-main {
    padding: 30px 20px;
  }
  .footer-social-links {
    gap: 15px;
  }
  .footer-social-links a {
    width: 42px;
    height: 42px;
  }
  .footer-social-links img {
    width: 20px;
    height: 20px;
  }
  .footer-legal {
    font-size: 13px;
  }
}
