*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  line-height: inherit;
}

:root {
  --font: "IBM Plex Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  --size: 14px;
  --lh: 1.8;
  --line: calc(var(--lh) * 1em); /* one line unit = 25.2px */
  --max: 560px;
  --ink: #111;
  --bg: #f7f6f4;
  --dim: #888;
}

html {
  font-size: var(--size);
  line-height: var(--lh);
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-weight: 300;
  color: var(--ink);
  background: var(--bg);
  max-width: var(--max);
  margin: 0 auto;
  padding: calc(var(--line) * 2) 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

a {
  color: var(--ink);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── Header ───────────────────────────────── */

.site-header {
  margin-bottom: calc(var(--line) * 2);
}

.site-title {
  font-weight: 300;
  font-size: var(--size);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.heartbeat-icon {
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

.heartbeat-shape {
  fill: #C8102E;
  stroke: none;
}

.heartbeat-ekg {
  fill: none;
  stroke: var(--bg);
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-desc {
  display: inline;
  color: var(--dim);
}

/* ── Homepage ─────────────────────────────── */

.status {
  display: block;
  color: var(--ink);
}

.status-empty {
  color: var(--dim);
}

/* ── Post ─────────────────────────────────── */

.post-title {
  font-size: var(--size);
  font-weight: 300;
}

.post-date {
  font-size: 0.8em;
  color: var(--dim);
  margin-bottom: var(--line);
}

.post-content {
  margin-bottom: var(--line);
}

.post-content p {
  margin-bottom: 0;
}

.post-content strong,
.post-content b {
  font-weight: 300;
}

.post-figure {
  margin-bottom: var(--line);
}

.post-image {
  width: 100%;
  height: auto;
  display: block;
}

.post-caption {
  color: var(--dim);
  font-style: italic;
}

.post-nav {
  margin-top: var(--line);
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.post-nav a {
  color: var(--dim);
}

.post-nav-next {
  margin-left: auto;
}

/* ── Archive ──────────────────────────────── */

.archive-list {
  list-style: none;
}

.archive-item {
  display: flex;
  gap: 24px;
  align-items: baseline;
}

.archive-date {
  font-size: 0.8em;
  flex-shrink: 0;
  white-space: nowrap;
  color: var(--dim);
}

.archive-title {
  min-width: 0;
}

@media (max-width: 480px) {
  .archive-item {
    flex-direction: column;
    gap: 0;
    margin-bottom: calc(var(--line) * 1.5);
  }

  .archive-item:last-child {
    margin-bottom: 0;
  }
}

.load-more-wrap {
  margin-top: var(--line);
}

.load-more {
  font-family: var(--font);
  font-size: var(--size);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--dim);
}

.load-more:hover {
  color: var(--ink);
}

.load-more:disabled {
  cursor: default;
}

/* ── Koenig editor ────────────────────────── */

.kg-image {
  max-width: 100%;
  height: auto;
  display: block;
}

.kg-width-wide {
  width: 85vw;
  max-width: 1200px;
  margin-left: calc(50% - 42.5vw);
  margin-right: calc(50% - 42.5vw);
}

.kg-width-full {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

/* ── Error ────────────────────────────────── */

.error-page {
  line-height: inherit;
}

/* ── Subscribe ────────────────────────────── */

.subscribe {
  margin-top: calc(var(--line) * 2);
}

.subscribe-form {
  display: flex;
}

.subscribe-input-wrap {
  width: 70%;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.5s ease;
}

.subscribe-input-wrap.collapsed {
  width: 0;
}

.subscribe-input {
  display: block;
  width: 100%;
  font-family: var(--font);
  font-size: var(--size);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--ink);
  border-right: none;
  padding: calc(var(--line) * 0.5) 10px;
  outline: none;
}

.subscribe-input:focus {
  background: #fff;
}

.subscribe-btn {
  flex: 1;
  font-family: var(--font);
  font-size: var(--size);
  color: var(--bg);
  background: var(--ink);
  border: 1px solid var(--ink);
  padding: calc(var(--line) * 0.5) 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.3s ease, border-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.subscribe-btn:hover:not(:disabled) {
  background: var(--dim);
  border-color: var(--dim);
}

.subscribe-btn:disabled {
  cursor: default;
}

.subscribe-btn--success {
  background: #2a7a2a;
  border-color: #2a7a2a;
}

.subscribe-btn--error {
  background: #b83232;
  border-color: #b83232;
}

.subscribe-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.icon-smiley { display: block; }
.icon-check  { display: none; }
.icon-cross  { display: none; }

.subscribe-btn--success .icon-smiley { display: none; }
.subscribe-btn--success .icon-check  { display: block; }

.subscribe-btn--error .icon-smiley   { display: none; }
.subscribe-btn--error .icon-cross    { display: block; }

.subscribe-btn--loading .subscribe-icon { display: none; }

/* ── About page ───────────────────────────── */

.page-content {
  margin-bottom: calc(var(--line) * 2);
}

.page-content p {
  margin-bottom: 0;
}

/* ── Footer ───────────────────────────────── */

.site-footer {
  margin-top: calc(var(--line) * 2);
}

.footer-nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.footer-nav a {
  color: var(--dim);
  display: inline-block;
  line-height: 0;
}

.footer-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.footer-nav svg {
  display: block;
}
