/* Studio_Aoi ai-org site — ターミナル風シンプル
   Vercel × overreacted 系のミニマル路線、ダーク/ライト両対応 */

:root {
  --bg: #fafaf9;
  --bg-elevated: #ffffff;
  --bg-code: #f3f4f6;
  --fg: #1a1a1a;
  --fg-muted: #6b7280;
  --fg-subtle: #9ca3af;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e5e7eb;
  --border-subtle: #f3f4f6;
  --selection: #bfdbfe;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --bg-code: #1a1a1a;
  --fg: #e5e5e5;
  --fg-muted: #a3a3a3;
  --fg-subtle: #737373;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --border: #262626;
  --border-subtle: #1a1a1a;
  --selection: #1e40af;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0a0a0a;
    --bg-elevated: #141414;
    --bg-code: #1a1a1a;
    --fg: #e5e5e5;
    --fg-muted: #a3a3a3;
    --fg-subtle: #737373;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --border: #262626;
    --border-subtle: #1a1a1a;
    --selection: #1e40af;
  }
}

* { box-sizing: border-box; }

::selection { background: var(--selection); color: var(--fg); }

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

body {
  font-family: system-ui, -apple-system, 'Hiragino Sans', 'Noto Sans JP', 'Helvetica Neue', sans-serif;
  font-size: 18px;
  line-height: 1.75;
  color: var(--fg);
  background: var(--bg);
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  font-feature-settings: 'palt';
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

/* ====== Header ====== */
.site-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 48px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.site-header .brand { flex: 1; min-width: 0; }

.site-title {
  font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;
  font-size: 0.95em;
  font-weight: 600;
  text-decoration: none;
  color: var(--fg);
  letter-spacing: -0.01em;
  display: inline-block;
}

.site-title::before { content: '$ '; color: var(--fg-subtle); }

.site-tagline {
  color: var(--fg-muted);
  font-size: 0.85em;
  margin: 6px 0 0;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  padding: 6px 12px;
  font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;
  font-size: 0.8em;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--fg-muted); }

/* ====== Main / Content ====== */
.container { min-height: 60vh; }

h1, h2, h3, h4 {
  color: var(--fg);
  font-weight: 700;
  line-height: 1.35;
  margin-top: 2em;
  margin-bottom: 0.6em;
  letter-spacing: -0.015em;
}
h1 { font-size: 1.6em; margin-top: 0; }
h2 { font-size: 1.25em; padding-top: 0.4em; }
h3 { font-size: 1.05em; }
h4 { font-size: 1em; color: var(--fg-muted); }

p { margin: 1.1em 0; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
a:hover { border-bottom-color: var(--accent); }

strong { font-weight: 700; }
em { font-style: italic; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3em 0;
}

ul, ol { padding-left: 1.5em; margin: 1em 0; }
li { margin: 0.4em 0; }

blockquote {
  border-left: 3px solid var(--border);
  padding: 0 1em;
  margin: 1.5em 0;
  color: var(--fg-muted);
}

/* ====== Code ====== */
code {
  font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', 'Hiragino Sans', monospace;
  font-size: 0.88em;
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--fg);
}

pre {
  background: var(--bg-code);
  padding: 16px 20px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 0.85em;
  line-height: 1.6;
  border: 1px solid var(--border-subtle);
}
pre code { background: none; padding: 0; font-size: 1em; }

/* ====== Tables ====== */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
  font-size: 0.92em;
}
th, td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
th { background: var(--bg-code); font-weight: 600; }

/* ====== Index ページ：カード式 ====== */
.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.article-list li {
  border-bottom: 1px solid var(--border-subtle);
  padding: 24px 0;
}
.article-list li:last-child { border-bottom: none; }

.article-list a {
  font-size: 1.15em;
  font-weight: 600;
  color: var(--fg);
  border-bottom: none;
  display: block;
  margin-bottom: 6px;
}
.article-list a:hover { color: var(--accent); }

.article-list small {
  color: var(--fg-subtle);
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.75em;
  letter-spacing: 0.02em;
}

.article-list p {
  color: var(--fg-muted);
  margin: 8px 0 0;
  font-size: 0.95em;
  line-height: 1.65;
}

/* ====== Article 詳細 ====== */
article .meta {
  color: var(--fg-subtle);
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.8em;
  letter-spacing: 0.02em;
  margin-top: -0.5em;
  margin-bottom: 2.5em;
}

article .body { margin-top: 2em; }

article .body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1.5em 0;
}

.footer-note {
  color: var(--fg-subtle);
  font-size: 0.8em;
  margin-top: 4em;
  padding-top: 1.5em;
  border-top: 1px dashed var(--border);
  text-align: center;
}

.back-link {
  display: inline-block;
  margin-top: 2em;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.85em;
  color: var(--fg-muted);
  border-bottom: none;
}
.back-link:hover { color: var(--accent); }

/* ====== Footer ====== */
.site-footer {
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--fg-subtle);
  font-size: 0.78em;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  text-align: center;
  letter-spacing: 0.02em;
}

/* ====== Responsive ====== */
@media (max-width: 640px) {
  body { font-size: 17px; padding: 20px 16px 60px; }
  h1 { font-size: 1.4em; }
  h2 { font-size: 1.15em; }
  .site-header { flex-direction: column; align-items: stretch; }
  .theme-toggle { align-self: flex-end; }
}

/* ====== 404 page ====== */
.error-page {
  text-align: center;
  padding: 60px 0;
}
.error-code {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 4em;
  color: var(--fg-subtle);
  margin: 0;
  letter-spacing: -0.04em;
}
.error-message {
  color: var(--fg-muted);
  margin: 1em 0 2em;
}
