/* Header: always centered */
.header-nav {
  justify-content: center !important;
}
.logo {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 !important;   /* override PaperMod's margin: auto 24px */
}
.logo a {
  font-size: 2rem;
}
.logo-switches {
  margin-top: 2px;
}
/* No nav menu items on this site — remove ul from flex layout so it
   doesn't offset the logo. :empty won't match due to whitespace text nodes. */
#menu {
  display: none;
}
@media (max-width: 767px) {
  :root {
    --header-height: 72px;
  }
  .logo a {
    font-size: 1.6rem;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
  }
}

/* Restore paragraph spacing (PaperMod reset.css zeroes all p margins) */
.post-content p { margin-bottom: var(--content-gap, 20px); }

/* Post title size */
.post-title {
  font-size: 1.3rem;
}
@media (min-width: 768px) {
  .post-title {
    font-size: 1.5rem;
  }
}

/* Japanese-friendly font stack */
body, .post-content, .post-title, .entry-content {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Meiryo", sans-serif;
}

/* Post date — centered */
.post-single .post-meta {
  text-align: center;
}

/* Top prev/next arrows */
.post-arrows {
  display: flex;
  justify-content: space-between;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.85rem;
}
.post-arrows a { color: var(--secondary, #888); text-decoration: none; }
.post-arrows a:hover { color: var(--primary, #333); }
.arrow-disabled { color: #ccc; }

/* Post images */
.post-images a {
  display: block;
  line-height: 0;
  outline: none;
  margin: 0 auto;
}
.post-images {
  margin: 1.5rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  /* prevent flex children from overflowing on narrow viewports */
  min-width: 0;
}
.post-images img {
  max-width: 100%;
  max-height: 50vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 4px;
  display: block;
}
@media (min-width: 768px) {
  .post-images img {
    max-height: 500px;
  }
}

/* Attachment link-preview card */
.attachment-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 6px;
  padding: 0;
  margin: 1rem 0;
  background: var(--entry, #f9f9f9);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
}
.attachment-card:hover {
  border-color: var(--primary, #aaa);
}
img.attachment-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  background: #ddd;
}
div.attachment-thumb {
  display: none;
}
.attachment-body {
  padding: 0.75rem;
  min-width: 0;
}
.attachment-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary, #333);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-desc {
  font-size: 0.8rem;
  color: var(--secondary, #666);
  margin-top: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.attachment-url {
  font-size: 0.75rem;
  color: var(--secondary, #888);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Quote card (Bluesky): same box as .attachment-card, with the quoted post's
   text and images in the body. */
.quote-card .attachment-body {
  flex: 1;
}
.quote-handle {
  font-weight: 400;
  color: var(--secondary, #666);
}
.quote-text {
  font-size: 0.85rem;
  margin-top: 0.25rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.quote-images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
img.quote-image {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  display: block;
}

/* "In reply to" line above a reply's text */
.reply-to {
  font-size: 0.85rem;
  color: var(--secondary, #666);
  margin: 0.5rem 0;
}

/* Notice box: shared content Facebook will not show us. Same border and
   background as .attachment-card; links to the original post when it can. */
.shared-unavailable {
  display: block;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 6px;
  padding: 0.75rem;
  margin: 1rem 0;
  background: var(--entry, #f9f9f9);
  font-size: 0.9rem;
  color: var(--secondary, #666);
  text-decoration: none;
  max-width: 100%;
  box-sizing: border-box;
}
a.shared-unavailable:hover {
  border-color: var(--primary, #aaa);
}

/* Post body links, the home-page welcome link and the "View original post" links (Facebook and Bluesky) */
.post-content a,
.home-intro a,
.fb-desktop-link,
.original-link {
  color: #0645ad;
  text-decoration: underline;
}
.post-content a:visited,
.home-intro a:visited,
.fb-desktop-link:visited,
.original-link:visited {
  color: #663366;
  text-decoration: underline;
}

/* Home-page welcome blurb: no rule of its own, so it inherits PaperMod's body
   18px / 1.6. On phones that is larger than the post card titles (0.9rem), so
   set it to card-title size with ordinary line spacing. Size and line-height
   only; desktop is unchanged. */
@media (max-width: 768px) {
  .home-intro {
    font-size: 0.95rem;
    line-height: 1.5;
  }
}

/* "View original post" link, shared by Facebook (.fb-desktop-link) and
   Bluesky (.original-link). Only the Facebook one is hidden on narrow screens. */
.fb-desktop-link,
.original-link {
  display: inline-block;
  margin: 0.5rem 0 1.5rem;
  font-size: 0.85rem;
}

/* Facebook — mobile fallback message */
.fb-mobile-note {
  display: none;
  margin: 0.5rem 0 1.5rem;
  font-size: 0.85rem;
  color: var(--secondary, #666);
}
@media (max-width: 768px) {
  .fb-desktop-link { display: none; }
  .fb-mobile-note  { display: block; }
}

/* Engagement metadata (reactions · comments · shares) */
.engagement-meta {
  font-size: 0.85rem;
  color: var(--secondary, #666);
  margin: 0.5rem 0 1.5rem;
}

/* Event details — demoted quiet block */
.event-details {
  font-size: 0.8rem;
  color: var(--secondary, #666);
  margin: 1.5rem 0 0.5rem;
}
.event-details h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--secondary, #666);
  margin: 0 0 0.3rem;
}
.event-details dl {
  margin: 0;
}
.event-details dt {
  font-weight: 600;
  display: inline;
  margin-right: 0.2rem;
}
.event-details dd {
  display: inline;
  margin: 0 1rem 0 0;
}

/* Time machine navigation */
.time-machine {
  margin: 2.5rem 0 1rem;
  border-top: 1px solid var(--border, #e0e0e0);
  padding-top: 1.5rem;
}
.time-machine h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary, #888);
  margin-bottom: 1rem;
}

.tm-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tm-timeline li {
  font-size: 0.82rem;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--border, #f0f0f0);
  overflow: hidden;
}
.tm-timeline li a {
  color: inherit;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tm-timeline li a:hover { text-decoration: underline; }
.tm-og-title {
  font-weight: normal;
  color: var(--secondary, #888);
  font-size: 0.78rem;
}
.tm-timeline .tm-date {
  color: var(--secondary, #888);
  margin-right: 0.4rem;
  font-variant-numeric: tabular-nums;
}
.tm-current {
  font-weight: 600;
  background: var(--entry, #f5f5f5);
  border-radius: 3px;
}
.tm-this {
  font-weight: 400;
  color: var(--secondary, #888);
  font-size: 0.78rem;
  margin-left: 0.3rem;
}

/* Post list cards */
.entry-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.entry-text {
  flex: 1;
  min-width: 0;
}
.entry-header h2 {
  font-size: 0.9rem !important;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
}
@media (min-width: 768px) {
  .entry-header h2 {
    font-size: 0.95rem !important;
    -webkit-line-clamp: 4;
  }
}

.listing-og-title,
.listing-og-description {
  font-weight: normal;
  color: var(--secondary, #666);
}

.entry-thumb {
  flex-shrink: 0;
  width: 140px !important;
  height: 140px !important;
  object-fit: cover;
  border-radius: 4px;
}

/* Ensure the stretched-link overlay sits above all card content */
.post-entry .entry-link {
  z-index: 1;
}
.post-entry:hover {
  background: var(--code-bg, #f0f0f0);
}
@media (min-width: 768px) {
  .entry-thumb {
    width: 108px !important;
    height: 108px !important;
  }
}

/* Archive page */
.archive-year { margin-bottom: 2rem; }
.archive-year h2 { margin-bottom: 0.5rem; }
.archive-month { margin: 0.5rem 0 0.5rem 1rem; }
.archive-month h3 { font-size: 0.95rem; margin-bottom: 0.25rem; }
.archive-post-list { list-style: none; padding: 0; margin: 0 0 0 1rem; }
.archive-post-list li { font-size: 0.85rem; padding: 0.15rem 0; }
.archive-post-list .a-date {
  color: var(--secondary, #888);
  font-variant-numeric: tabular-nums;
  margin-right: 0.5rem;
}

/* Self-replies shown under their thread root's text (Bluesky): one indented
   block with a thin line at its left edge, so it reads as part of the post. */
.thread-replies {
  margin: 1.5rem 0 0;
  padding-left: 0.9rem;
  border-left: 2px solid var(--border, #e0e0e0);
  margin-bottom: 1rem;   /* with the link's 0.5rem top margin: 1.5rem, as above the heading */
}
.thread-replies-heading {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary, #888);
  margin: 0 0 0.25rem;
}
.thread-reply {
  margin: 1.25rem 0 0;
}
.thread-reply-time {
  display: block;
  font-size: 0.85rem;
  color: var(--secondary, #666);
  margin-bottom: 0.1rem;
}
/* PaperMod gives .post-content a 30px vertical margin; tighten it here so the
   label sits directly above its text. */
.thread-reply .post-content {
  margin: 0 0 0.75rem;
}
.thread-reply .post-content:last-child {
  margin-bottom: 0;   /* a text-only comment ends at its text */
}
.thread-reply .post-content p:last-child {
  margin-bottom: 0;
}

/* Home-page link wording by primary pointer: "click" for mouse/trackpad (also
   the fallback), "tap" for touch. display:none keeps the hidden word from
   screen readers as well. */
.hint-touch { display: none; }
@media (pointer: coarse) {
  .hint-mouse { display: none; }
  .hint-touch { display: inline; }
}
