:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1c1c1e;
  --muted: #6b6b70;
  --border: #e6e6e8;
  --accent: #2f6fed;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.05), 0 16px 32px rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113;
    --surface: #1b1b1f;
    --text: #ededef;
    --muted: #9a9aa2;
    --border: #2c2c32;
    --accent: #6b9bff;
    --shadow: none;
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  --bg: #111113;
  --surface: #1b1b1f;
  --text: #ededef;
  --muted: #9a9aa2;
  --border: #2c2c32;
  --accent: #6b9bff;
  --shadow: none;
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.5);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Sans JP", system-ui, -apple-system, sans-serif;
  line-height: 1.7;
  transition: background-color 0.2s, color 0.2s;
}

a {
  color: inherit;
}

.container {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}
:root[data-theme="dark"] .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }
}

/* Main */
main {
  flex: 1;
}

.intro {
  padding: 64px 0 32px;
}

.intro h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.intro p {
  margin: 0;
  color: var(--muted);
}

/* App grid */
.app-grid {
  list-style: none;
  margin: 0;
  padding: 0 0 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.app-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.app-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.app-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--icon-bg, var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: 1.3rem;
}

/* 画像付きカード：画像をカード上部に全幅で表示 */
.app-card.has-thumb {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.app-thumb {
  display: block;
  aspect-ratio: 1200 / 630;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--border);
}

.app-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.app-card:hover .app-thumb img {
  transform: scale(1.03);
}

.has-thumb .app-body {
  padding: 20px 24px 24px;
}

.app-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.app-name {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.app-desc {
  margin-top: 6px;
  flex: 1;
  color: var(--muted);
  font-size: 0.92rem;
}

.app-link {
  margin-top: 16px;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
}

.app-link::after {
  content: " ↗";
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }
  .intro {
    padding: 40px 0 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
