/* FIVESCUP - Modern site styles (fivescup.jp inspired) */
:root {
  --color-bg: #0f1419;
  --color-surface: #1a2332;
  --color-surface-hover: #243044;
  --color-border: #2d3a4d;
  --color-text: #e6edf3;
  --color-text-muted: #8b9cb3;
  --color-accent: #58a6ff;
  --color-accent-hover: #79b8ff;
  --color-badge: #238636;
  --color-badge-experimental: #8957e5;
  --color-badge-survive: #d29922;
  --color-badge-challenge: #1f6feb;
  --color-badge-open: #238636;
  --font-sans: "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  --container: min(100% - 2rem, 720px);
  --container-wide: min(100% - 2rem, 960px);
}

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----- Layout ----- */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.site-title a {
  color: var(--color-text);
  text-decoration: none;
}

.site-title a:hover {
  color: var(--color-accent);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--color-text);
  background: var(--color-surface-hover);
}

/* ----- Main ----- */
.main {
  flex: 1;
  width: 100%;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

/* ----- Home (index) ----- */
.hero {
  text-align: center;
  padding: 2rem 0 2.5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2rem;
}

.hero__title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
}

.hero__desc {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 1rem;
}

.link-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.link-cards a {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}

.link-cards a:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-accent);
}

/* ----- List (posts) ----- */
.list-header {
  margin-bottom: 1.5rem;
}

.list-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.post-card {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.post-card:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-accent);
}

.post-card__title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.post-card__meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.post-card__meta time {
  font-variant-numeric: tabular-nums;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.badges:empty {
  display: none;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-radius: 4px;
  background: var(--color-badge);
  color: #fff;
}

.badge--experimental { background: var(--color-badge-experimental); }
.badge--survive { background: var(--color-badge-survive); color: #0d1117; }
.badge--challenge { background: var(--color-badge-challenge); }
.badge--open { background: var(--color-badge-open); }
.badge--news { background: var(--color-border); color: var(--color-text-muted); }

/* ----- Single (article / page) ----- */
.article {
  max-width: var(--container);
  margin: 0 auto;
}

.article__header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.article__title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}

.article__meta {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.article__meta time {
  font-variant-numeric: tabular-nums;
}

/* Content (prose) */
.content {
  font-size: 0.9375rem;
}

.content > *:first-child {
  margin-top: 0;
}

.content > *:last-child {
  margin-bottom: 0;
}

.content h2 {
  margin: 1.75rem 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--color-border);
}

.content h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.0625rem;
  font-weight: 600;
}

.content h4 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.content p {
  margin: 0.75rem 0;
}

.content ul,
.content ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.content li {
  margin: 0.25rem 0;
}

.content a {
  color: var(--color-accent);
  text-decoration: none;
}

.content a:hover {
  text-decoration: underline;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.content th,
.content td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  text-align: left;
}

.content th {
  background: var(--color-surface);
  font-weight: 600;
}

.content img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

.content figure {
  margin: 1.25rem 0;
}

.content figure img {
  max-width: 100%;
  height: auto;
}

.content figcaption {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

.content blockquote {
  margin: 1rem 0;
  padding: 0.5rem 0 0.5rem 1rem;
  border-left: 3px solid var(--color-accent);
  color: var(--color-text-muted);
}

.content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.15rem 0.4rem;
  background: var(--color-surface);
  border-radius: 4px;
}

.content pre {
  margin: 1rem 0;
  padding: 1rem;
  overflow-x: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
}

.content pre code {
  padding: 0;
  background: none;
}

/* ----- Footer ----- */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.site-footer__inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.site-footer p {
  margin: 0;
}

/* ----- Utilities ----- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
