/* mzhkt ポータル。
   one-lms と同じ設計言語（白ベース・Noto Sans JP・ティール hue 195・oklch）。
   サイトが増えても崩れないよう、一覧はグリッドで組む。 */

:root {
  --primary-50: oklch(0.97 0.01 195);
  --primary-100: oklch(0.93 0.03 195);
  --primary-500: oklch(0.55 0.15 195);
  --primary-600: oklch(0.48 0.15 195);
  --primary-700: oklch(0.42 0.13 195);

  --gray-50: oklch(0.985 0.002 195);
  --gray-100: oklch(0.96 0.003 195);
  --gray-200: oklch(0.92 0.004 195);
  --gray-300: oklch(0.86 0.005 195);
  --gray-400: oklch(0.71 0.006 195);
  --gray-500: oklch(0.58 0.007 195);
  --gray-600: oklch(0.48 0.007 195);
  --gray-700: oklch(0.39 0.006 195);
  --gray-800: oklch(0.28 0.005 195);
  --gray-900: oklch(0.19 0.004 195);

  --surface: oklch(1 0 0);
  --ground: oklch(0.985 0.002 195);

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.04);
  --shadow-lg: 0 6px 20px oklch(0 0 0 / 0.07), 0 1px 3px oklch(0 0 0 / 0.04);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--gray-800);
  font-family: "Noto Sans JP", ui-sans-serif, system-ui, -apple-system,
    "Hiragino Sans", sans-serif;
  line-height: 1.7;
  font-feature-settings: "palt";
}

main {
  flex: 1;
}

:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap {
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== ヘッダー =====
   カテゴリサイト側のヘッダーと高さ・作りを揃える。
   トップに来たときと各サイトを見ているときで、
   同じ位置に同じものがある状態にする。 */

.masthead {
  background: var(--surface);
  border-bottom: 1px solid var(--gray-200);
}

.masthead__inner {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.125rem 1.5rem;
  display: flex;
  align-items: center;
}

/* ロゴ画像。高さだけ決めて幅は成り行きにする */
.masthead__logo {
  height: 1.25rem;
  width: auto;
  display: block;
}

/* ===== サイト一覧 ===== */

.sites {
  list-style: none;
  margin: 0;
  padding: 3rem 0 0;
  display: grid;
  /* 数が増えても列が増えるだけ。狭い画面では自然に1列へ落ちる */
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 1rem;
  /* 画像のあるカードと無いカードが混ざっても、
     背の低い方が引き伸ばされないよう上端に揃える */
  align-items: start;
}

.site__link {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease),
    transform 180ms var(--ease);
}

/* カードの中身。画像の有無にかかわらずここが本文側になる */
.site__body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.375rem 1.5rem 1.5rem;
}

/* ===== カード上部の画像 =====
   site.yml の image: を書いたときだけ出る。
   高さを固定して cover で切るので、元画像の比率は問わない。 */

.site__cover {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  overflow: hidden;
}

.site__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 400ms var(--ease);
}

.site__link:hover .site__cover img,
.site__link:focus-visible .site__cover img {
  transform: scale(1.03);
}

/* 画像を設定していないサイトの柄。
   --hue は slug から決まるので、サイトごとに違う色で固定される。
   画像ファイルを増やさずに、カードが並んだときの見分けを付ける。 */
.site__cover--generated {
  background:
    repeating-linear-gradient(
      115deg,
      transparent 0 22px,
      oklch(0.30 0.07 var(--hue) / 0.5) 22px 36px
    ),
    linear-gradient(
      135deg,
      oklch(0.62 0.13 var(--hue)),
      oklch(0.44 0.14 calc(var(--hue) + 20))
    );
}

.site__link:hover,
.site__link:focus-visible {
  border-color: var(--primary-500);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.site__title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--gray-900);
  letter-spacing: -0.01em;
  line-height: 1.5;
  padding-right: 1.75rem;
}

.site__desc {
  color: var(--gray-500);
  font-size: 0.875rem;
  line-height: 1.65;
}

/* 矢印はタイトル行の右端。説明の長さに影響されない
   （基準は .site__body なので、画像があっても位置は変わらない） */
.site__go {
  position: absolute;
  top: 1.375rem;
  right: 1.25rem;
  display: grid;
  place-items: center;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  color: var(--gray-400);
  font-size: 0.8125rem;
  transition: background-color 180ms var(--ease), color 180ms var(--ease),
    transform 180ms var(--ease);
}

.site__link:hover .site__go,
.site__link:focus-visible .site__go {
  color: var(--primary-600);
  transform: translateX(3px);
}

/* ===== 空の状態 ===== */

.empty {
  margin: 3rem 0 0;
  padding: 3rem 1.5rem;
  background: var(--surface);
  border: 1px dashed var(--gray-300);
  border-radius: 0.75rem;
  color: var(--gray-500);
  font-size: 0.9375rem;
  text-align: center;
}

.empty code {
  background: var(--gray-100);
  color: var(--gray-700);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  font-size: 0.9em;
}

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

.foot {
  margin-top: 4rem;
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
  border-top: 1px solid var(--gray-200);
  color: var(--gray-500);
  font-size: 0.8125rem;
}

.foot p {
  margin: 0;
}

/* ===== 読み込み時の演出 =====
   カードが順に現れる。数が増えても最後は同時に出す（待たせない） */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    animation: reveal 480ms var(--ease) backwards;
  }

  .site:nth-child(1) .reveal { animation-delay: 40ms; }
  .site:nth-child(2) .reveal { animation-delay: 80ms; }
  .site:nth-child(3) .reveal { animation-delay: 120ms; }
  .site:nth-child(4) .reveal { animation-delay: 160ms; }
  .site:nth-child(5) .reveal { animation-delay: 200ms; }
  .site:nth-child(6) .reveal { animation-delay: 240ms; }
  .site:nth-child(n + 7) .reveal { animation-delay: 280ms; }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 34rem) {
  .sites {
    padding-top: 2rem;
    gap: 0.75rem;
  }

  .site__body {
    padding: 1.25rem;
  }

  .site__go {
    top: 1.25rem;
    right: 1rem;
  }
}
