/* Abstiro shared stylesheet — used by /, /en, /jp */

:root {
  --bg: #f6f7fa;
  --bg-elev: #edeff4;
  --bg-card: #ffffff;
  --border: #dde1e9;
  --text: #14161c;
  --text-dim: #5b6172;
  --accent: #3559e0;
  --accent-2: #d97a1f;
  --money: #1f9d5a;
  --radius: 14px;
  --max-w: 960px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: radial-gradient(1200px 600px at 50% -10%, #ffffff 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

header.site-header {
  padding: 28px 0 0;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--money));
  flex-shrink: 0;
}

.lang-switch {
  display: flex;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  background: var(--bg-elev);
}

.lang-switch a {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
}

.lang-switch a.active,
.lang-switch a:hover {
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
}

main { flex: 1; }

.hero {
  padding: 72px 0 40px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}

.hero .lede {
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 620px;
  margin: 0 auto;
}

.badge-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text-dim);
  font-size: 0.85rem;
}

.badge:hover { color: var(--text); text-decoration: none; border-color: var(--accent); }

section { padding: 20px 0; }

.section-title {
  font-size: 1.4rem;
  margin: 0 0 6px;
}

.section-sub {
  color: var(--text-dim);
  margin: 0 0 24px;
  font-size: 0.95rem;
}

.section-subtitle {
  font-size: 1.05rem;
  margin: 24px 0 12px;
}

.section-subtitle:first-of-type {
  margin-top: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.card .icon {
  font-size: 1.6rem;
}

.card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  flex: 1;
}

.card .cta {
  margin-top: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card.money { border-color: rgba(79, 209, 139, 0.35); }
.card.money .cta { color: var(--money); }
.card.money:hover { border-color: var(--money); }

.card a.card-link {
  position: absolute;
  inset: 0;
}

.card { position: relative; }

/* Box-grid: exactly 4 columns on desktop, 2 on mobile (used by the top page's
   curated examples and by the articles/tools/data index pages). */
.box-grid {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 720px) {
  .box-grid { grid-template-columns: repeat(2, 1fr); }
}

.card.card-more {
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-dim);
}

.card.card-more .cta {
  color: var(--accent);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-tag {
  font-size: 0.72rem;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.tag-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

.tag-btn.active,
.tag-btn:hover {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--accent);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 44px 0;
}

.list-table-wrap {
  overflow-x: auto;
  margin-bottom: 32px;
}

.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.list-table th,
.list-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.list-table th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.list-table td.nowrap,
.list-table th.nowrap {
  white-space: nowrap;
}

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
  margin-top: 40px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer nav a {
  color: var(--text-dim);
  margin-left: 16px;
}

.site-footer nav a:first-child { margin-left: 0; }

/* Root language-picker page */
.lang-picker {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.lang-picker .wrap { max-width: 560px; }

.lang-picker h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.lang-picker .tagline {
  color: var(--text-dim);
  margin-bottom: 40px;
}

.lang-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.lang-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 16px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}

.lang-card small {
  display: block;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 6px;
  font-size: 0.8rem;
}

.lang-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-2px);
}

.source-row {
  margin-top: 48px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  .lang-cards { grid-template-columns: 1fr; }
}

/* Markdown articles */
.article {
  max-width: 720px;
  margin: 40px auto 80px;
}

.article-back {
  margin: 0 0 24px;
  font-size: 0.9rem;
}

.article-meta {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.article h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.article h2 {
  font-size: 1.4rem;
  margin: 40px 0 12px;
}

.article h3 {
  font-size: 1.15rem;
  margin: 28px 0 10px;
}

.article p,
.article li {
  color: var(--text);
}

.article ul,
.article ol {
  padding-left: 1.3em;
}

.article a {
  text-decoration: underline;
  text-decoration-color: var(--border);
}

.article code {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.9em;
}

.article pre {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
}

.article pre code {
  border: none;
  padding: 0;
  background: none;
}

.article blockquote {
  margin: 0;
  padding: 4px 18px;
  border-left: 3px solid var(--accent);
  color: var(--text-dim);
}

.article img {
  max-width: 100%;
  border-radius: var(--radius);
}

/* Tools (hand-written HTML+JS pages) */
.tool {
  max-width: 720px;
  margin: 40px auto 80px;
}

.tool-output {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
}

.tool textarea {
  width: 100%;
  min-height: 160px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 14px;
  resize: vertical;
}

.tool-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.tool-stats div {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.tool-stats strong {
  display: block;
  font-size: 1.4rem;
  color: var(--text);
}
