/* medaka.app トップページ
   テーマは CSS 変数で切り替える。
   既定は OS 設定 (prefers-color-scheme) に従い、
   利用者が明示的に選んだ場合だけ html[data-theme] で上書きする。 */

:root {
  --bg: #ffffff;
  --panel: #f6f8fa;
  --line: #d8dee4;
  --fg: #1f2328;
  --muted: #636c76;
  --accent: #0969da;
  --code-bg: #eff2f5;
  --shadow: 0 1px 2px rgba(31, 35, 40, 0.08);
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --panel: #161b22;
  --line: #21262d;
  --fg: #e6edf3;
  --muted: #8b949e;
  --accent: #4aa8ff;
  --code-bg: #0d1117;
  --shadow: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --panel: #161b22;
    --line: #21262d;
    --fg: #e6edf3;
    --muted: #8b949e;
    --accent: #4aa8ff;
    --code-bg: #0d1117;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans",
               "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.8;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

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

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 2rem;
}

.logo {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}

.dot { color: var(--accent); }

.controls {
  display: flex;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.btn:hover { border-color: var(--accent); }

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

.btn-icon {
  width: 2.25rem;
  padding: 0;
}

.icon {
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}

.icon-moon { fill: currentColor; stroke: none; }

/* 明るいテーマでは「暗くする」月を、暗いテーマでは「明るくする」太陽を出す */
.icon-sun { display: none; }
.icon-moon { display: block; }

: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; }
}

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

.hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.belu {
  width: 180px;
  height: auto;
  flex-shrink: 0;
}

.lead {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.sub {
  color: var(--muted);
  margin: 0;
  font-size: 0.9375rem;
}

/* ---- パネル ---- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.panel h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.subs { margin: 0; }

.subs dt {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9375rem;
  color: var(--fg);
  margin-top: 0.75rem;
}

.subs dt:first-of-type { margin-top: 0; }

.subs dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.0625rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.6875rem;
  color: var(--muted);
  vertical-align: 0.0625rem;
  white-space: nowrap;
}

.note p {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
}

.note p:last-child { margin-bottom: 0; }

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  padding: 0.0625rem 0.3125rem;
  /* break-all だと "medaka.app" が "med / aka.app" と割れる。
     収まらない長い文字列だけ折り返す */
  word-break: normal;
  overflow-wrap: break-word;
}

b { color: var(--fg); font-weight: 600; }

.foot {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
}

.foot p { margin: 0; }

/* ---- 狭い画面 ---- */

@media (max-width: 34rem) {
  .hero {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  .belu { width: 150px; }
  .lead { font-size: 1.25rem; }
}
