/*
Theme Name: JustinPot
Theme URI: https://justinpot.com
Author: Justin Pot
Description: A clean, reading-focused theme for JustinPot.com
Version: 1.0
License: GNU General Public License v2 or later
Text Domain: justinpot
*/

/* ── Design tokens ────────────────────────────────────────── */
:root {
  --bg:            #faf8f5;
  --text:          #1c1916;
  --text-muted:    #6b6560;
  --border:        #e6e1da;
  --accent:        #b5451b;
  --accent-hover:  #8f3614;

  --font-heading:  'Playfair Display', Georgia, serif;
  --font-body:     system-ui, -apple-system, sans-serif;

  --size-base:     1.0625rem;   /* 17px */
  --lh-body:       1.7;
  --lh-heading:    1.2;

  --measure:       68ch;
  --col:           min(var(--measure), 100% - 3rem);
  --space:         1.5rem;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ─────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); }
html { font-size: 100%; }

body {
  font-family: var(--font-body);
  font-size: var(--size-base);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Shared layout column ─────────────────────────────────── */
.site-header,
.site-main,
.site-footer {
  width: var(--col);
  margin-inline: auto;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--border);
}

/* Logo */
.custom-logo-link { display: block; line-height: 1; }
.custom-logo      { height: 48px; width: auto; display: block; }

/* Text fallback */
.site-title a {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
  line-height: 1;
}
.site-title a:hover { color: var(--accent); }

/* ── Primary nav ──────────────────────────────────────────── */
.main-nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.main-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.main-nav a:hover,
.main-nav .current-menu-item a {
  color: var(--accent);
}

/* ── Main content area ────────────────────────────────────── */
.site-main { padding-block: 3.5rem; }

/* ── Post list (index / archive) ──────────────────────────── */
.post-list { list-style: none; }

.post-list-item {
  padding-block: 2.5rem;
  border-bottom: 1px solid var(--border);
}
.post-list-item:first-child { padding-top: 0; }

/* Featured image in list */
.post-thumbnail-link {
  display: block;
  margin-bottom: 1.25rem;
  border-radius: 3px;
  overflow: hidden;
  line-height: 0;
}
.post-thumbnail-link img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
}
.post-thumbnail-link:hover img { opacity: 0.9; }

.post-list-item .entry-title {
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 700;
  line-height: var(--lh-heading);
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.entry-title a {
  color: var(--text);
  text-decoration: none;
}
.entry-title a:hover { color: var(--accent); }

.post-meta {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.entry-excerpt { color: var(--text); line-height: var(--lh-body); }

/* Expand button — pill below the excerpt */
.expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
  padding: 0.4rem 0.9rem;
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: 2rem;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.expand-btn:hover {
  background: var(--accent);
  color: #fff;
}
.expand-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.expand-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

.post-list-item.is-loading .expand-btn svg {
  animation: jp-spin 0.7s linear infinite;
}
@keyframes jp-spin { to { transform: rotate(360deg); } }

/* Hide excerpt when expanded */
.post-list-item.is-expanded .entry-excerpt { display: none; }

/* Inline expand panel — grid trick for smooth height */
.post-expand-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s ease;
}
.post-expand-inner { overflow: hidden; }
.post-list-item.is-expanded .post-expand-panel { grid-template-rows: 1fr; }
.post-list-item.is-expanded .post-expand-inner { padding-top: 1.75rem; }

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

/* "View full post" link at the bottom of expanded content */
.expand-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.expand-full-link {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
}
.expand-full-link:hover { color: var(--accent); }

/* Infinite scroll sentinel */
#scroll-sentinel {
  padding: 2.5rem 0;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-muted);
  min-height: 5rem;
}

/* ── Single post ──────────────────────────────────────────── */
.entry-header { margin-bottom: 2.5rem; }

.single .entry-title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 5vw, 2.75rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

/* Thin rule between headline and content */
.single .entry-header::after {
  content: '';
  display: block;
  width: 3rem;
  height: 2px;
  background: var(--accent);
  margin-top: 1.5rem;
}

/* ── Featured image ───────────────────────────────────────── */
.entry-thumbnail {
  margin-bottom: 2.5rem;
}

.entry-thumbnail img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 3px;
}

/* ── Body copy ────────────────────────────────────────────── */
.entry-content { max-width: var(--measure); }

.entry-content > * + * { margin-top: 1.35em; }

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  font-family: var(--font-heading);
  line-height: var(--lh-heading);
  letter-spacing: -0.02em;
  margin-top: 2.25em;
  margin-bottom: 0.4em;
}
.entry-content h2 { font-size: 1.5rem; font-weight: 700; }
.entry-content h3 { font-size: 1.2rem; font-weight: 700; }

.entry-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.entry-content a:hover { color: var(--accent-hover); }

.entry-content strong { font-weight: 600; }

.entry-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-style: italic;
}

.entry-content img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
}

.entry-content figure { margin-block: 2em; }
.entry-content figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.entry-content pre {
  background: #f0ede8;
  padding: 1.25rem;
  overflow-x: auto;
  font-size: 0.875em;
  border-radius: 4px;
  line-height: 1.6;
}

.entry-content code {
  background: #f0ede8;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.875em;
}

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

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  padding-block: 3rem;
  border-top: 1px solid var(--border);
}

.footer-widgets { margin-bottom: 2rem; }

.footer-widget-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

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

/* ── Social icons ─────────────────────────────────────────── */
.social-icons {
  list-style: none;
  display: flex;
  gap: 0.875rem;
  align-items: center;
}

.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.15s;
}
.social-icons a:hover { color: var(--accent); }

.social-icons svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}

/* ── Next post preview ────────────────────────────────────── */
.next-post-wrap {
  margin-top: 3.5rem;
  padding-top: 3.5rem;
  border-top: 1px solid var(--border);
}

.next-post-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
}

.next-post-card {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  text-decoration: none;
  min-height: 220px;
  background: #d6cfc5; /* warm fallback when no image */
}

/* Blurred background image */
.next-post-bg {
  position: absolute;
  inset: -10%; /* overshoot to hide blur edges */
  width: 120%;
  height: 120%;
  object-fit: cover;
  filter: blur(18px);
  transform-origin: center;
  transition: filter 0.4s ease;
}
.next-post-card:hover .next-post-bg {
  filter: blur(10px); /* unblurs slightly on hover — draws the reader in */
}

/* Dark overlay for text legibility */
.next-post-overlay {
  position: relative;
  z-index: 1;
  padding: 2rem 2rem 1.75rem;
  background: linear-gradient(
    to bottom,
    rgba(20, 17, 14, 0.45) 0%,
    rgba(20, 17, 14, 0.72) 100%
  );
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.next-post-title {
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 3vw, 1.65rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 0.5rem;
}

.next-post-excerpt {
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.next-post-cta {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 2rem;
  padding: 0.35rem 0.875rem;
  transition: background 0.2s, border-color 0.2s;
}
.next-post-card:hover .next-post-cta {
  background: rgba(255, 255, 255, 0.18);
  border-color: #fff;
}

/* ── Pagination ───────────────────────────────────────────── */
.nav-links {
  display: flex;
  gap: 1rem;
  margin-top: 3rem;
  font-size: 0.875rem;
  font-weight: 500;
}

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

/* ── Utilities ────────────────────────────────────────────── */
.screen-reader-text {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ── Newsletter CTA ───────────────────────────────────────── */
.newsletter-cta {
  margin-top: 3.5rem;
  padding-top: 3.5rem;
  border-top: 1px solid var(--border);
}

.newsletter-cta__inner {
  background: #f2ede6;
  border-left: 4px solid var(--accent);
  padding: 2rem 2rem 2rem 1.75rem;
  border-radius: 0 4px 4px 0;
}

.newsletter-cta__heading {
  font-family: var(--font-heading);
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}

.newsletter-cta__description {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.newsletter-cta__form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.newsletter-cta__form input[type="email"] {
  flex: 1 1 16rem;
  padding: 0.6rem 0.875rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  outline: none;
}
.newsletter-cta__form input[type="email"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(181, 69, 27, 0.12);
}
.newsletter-cta__form input[type="email"]::placeholder {
  color: var(--text-muted);
}

.newsletter-cta__form button {
  padding: 0.6rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
}
.newsletter-cta__form button:hover {
  background: var(--accent-hover);
}

/* ── Fediverse reactions ──────────────────────────────────── */
.fediverse-reactions {
  margin-top: 3.5rem;
  padding-top: 3.5rem;
  border-top: 1px solid var(--border);
}

.reactions-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.reactions-group {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.reactions-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 5rem;
}

.reactions-avatars {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.reactions-avatars li a {
  display: block;
  border-radius: 50%;
  overflow: hidden;
  width: 36px;
  height: 36px;
  transition: opacity 0.15s, transform 0.15s;
}

.reactions-avatars li a:hover {
  opacity: 0.85;
  transform: scale(1.1);
}

.reactions-avatars img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

/* ── Comments & fediverse reactions ───────────────────────── */
.comments-area {
  margin-top: 3.5rem;
  padding-top: 3.5rem;
  border-top: 1px solid var(--border);
}

.comments-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 2rem;
}

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

.comment-list .comment,
.comment-list .pingback {
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.comment-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.comment-author img {
  border-radius: 50%;
  flex-shrink: 0;
}

.comment-author b { font-weight: 600; }
.comment-author a { color: var(--text); text-decoration: none; }

.comment-metadata {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.comment-metadata a { color: var(--text-muted); text-decoration: none; }

.comment-content > * + * { margin-top: 0.75em; }
.comment-content a { color: var(--accent); }

.reply { margin-top: 0.5rem; font-size: 0.875rem; }
.reply a { color: var(--text-muted); text-decoration: none; }
.reply a:hover { color: var(--accent); }

/* Comment form */
.comment-respond { margin-top: 3rem; }

.comment-respond h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.comment-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 0.6rem 0.875rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  outline: none;
  margin-bottom: 1rem;
}

.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(181, 69, 27, 0.12);
}

.comment-form textarea { min-height: 8rem; resize: vertical; }

.comment-form .form-submit { margin-top: 0.5rem; }

.comment-form input[type="submit"] {
  padding: 0.6rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
}
.comment-form input[type="submit"]:hover { background: var(--accent-hover); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 520px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .main-nav a  { font-size: 0.8125rem; }
  .footer-right { gap: 1rem; }
}
