/*
Theme Name: ProductShifu
Theme URI: https://www.productshifu.com
Author: Rajat Gupta
Author URI: https://www.productshifu.com
Description: A clean, editorial theme for ProductShifu. Warm, minimal, no-nonsense.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: productshifu
*/

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

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

body {
  background: #ffffff;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.75;
  color: #1A1A1A;
  -webkit-font-smoothing: antialiased;
  padding-top: 104px;
}

/* Shift fixed header down when WordPress admin bar is present */
.admin-bar .site-header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  .admin-bar .site-header {
    top: 46px;
  }
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
}

/* ─────────────────────────────────────────
   SITE WRAPPER
───────────────────────────────────────── */
.site-wrapper {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 52px;
  background: #ffffff;
  min-height: calc(100vh - 200px);
}

/* ─────────────────────────────────────────
   HEADER — fixed
───────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid #E5E4E2;
}

.header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 24px clamp(24px, 4vw, 64px);
  gap: 24px;
  background: #ffffff;
}

.site-branding {
  flex-shrink: 0;
}

.site-title-link {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: #111111;
  text-decoration: none;
  display: inline-block;
  line-height: 1.2;
  letter-spacing: -0.01em;
  position: relative;
}

.site-title-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: #111111;
  transition: width 0.25s ease;
}

.site-title-link:hover::after {
  width: 100%;
}

.site-tagline {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  color: #6B7280;
  margin-top: 5px;
  font-style: italic;
  letter-spacing: 0.01em;
}

/* ─────────────────────────────────────────
   BURGER BUTTON (mobile only)
───────────────────────────────────────── */
.nav-toggle {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.burger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.burger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: #1A1A1A;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Burger → X when open */
.nav-toggle:checked + .burger-btn span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle:checked + .burger-btn span:nth-child(2) {
  opacity: 0;
}
.nav-toggle:checked + .burger-btn span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ─────────────────────────────────────────
   NAVIGATION
───────────────────────────────────────── */
.primary-nav {
  flex-shrink: 0;
  margin-left: auto;
}

.primary-nav .nav-menu {
  list-style: none;
  display: flex;
  gap: 28px;
  align-items: center;
}

.primary-nav .nav-menu li {
  position: relative;
}

.primary-nav .nav-menu a {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: #1A1A1A;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.primary-nav .nav-menu a:hover,
.primary-nav .nav-menu .current-menu-item > a,
.primary-nav .nav-menu .current_page_item > a {
  color: #6B7280;
}

/* Dropdown */
.primary-nav .nav-menu .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #ffffff;
  border: 1px solid #E5E4E2;
  min-width: 180px;
  padding: 20px 0 8px;
  z-index: 100;
  list-style: none;
}

.primary-nav .nav-menu li:hover > .sub-menu {
  display: block;
}

.primary-nav .nav-menu .sub-menu a {
  display: block;
  padding: 9px 18px;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.82rem;
}

.primary-nav .nav-menu .sub-menu a:hover {
  background: #FAFAFA;
}

/* ─────────────────────────────────────────
   MAIN CONTENT AREA
───────────────────────────────────────── */
.site-main {
  padding: 52px 0;
}

/* ─────────────────────────────────────────
   POST CARDS (index / archive)
───────────────────────────────────────── */
.post-card {
  display: flex;
  gap: 28px;
  padding: 36px 0;
  border-bottom: 1px solid #E5E4E2;
}

.post-card:first-of-type {
  padding-top: 0;
}

.post-card-thumbnail {
  flex: 0 0 200px;
}

.post-card-thumbnail a {
  display: block;
}

.post-card-thumbnail img {
  width: 200px;
  height: 133px;
  object-fit: cover;
}

.post-card-body {
  flex: 1;
  min-width: 0;
}

.post-card-meta {
  font-size: 0.75rem;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.post-card-meta a {
  color: #6B7280;
  text-decoration: none;
}

.post-card-meta a:hover {
  color: #1A1A1A;
}

.post-card-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.post-card-title a {
  color: #111111;
  text-decoration: none;
}

.post-card-title a:hover {
  color: #4B5563;
}

.post-card-excerpt {
  font-size: 0.92rem;
  color: #4B5563;
  line-height: 1.65;
}

.post-card-excerpt p {
  margin: 0;
}

/* ─────────────────────────────────────────
   SINGLE POST
───────────────────────────────────────── */
.entry-header {
  padding-bottom: 36px;
  border-bottom: 1px solid #E5E4E2;
  margin-bottom: 40px;
}

.entry-category {
  display: inline-block;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6B7280;
  text-decoration: none;
  margin-bottom: 16px;
}

.entry-category:hover {
  color: #1A1A1A;
}

.entry-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  color: #111111;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.entry-meta {
  font-size: 0.8rem;
  color: #6B7280;
}

.entry-featured-image {
  margin-bottom: 44px;
}

.entry-featured-image img {
  width: 100%;
  height: auto;
}

/* ─────────────────────────────────────────
   POST CONTENT
───────────────────────────────────────── */
.entry-content {
  font-size: 1.05rem;
  line-height: 1.82;
  color: #1A1A1A;
}

.entry-content > * + * {
  margin-top: 1.5rem;
}

.entry-content h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  color: #111111;
  margin-top: 3rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.015em;
}

.entry-content h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111111;
  margin-top: 2.5rem;
  margin-bottom: 0.5rem;
}

.entry-content h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #111111;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

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

.entry-content a {
  color: #1A1A1A;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: #9CA3AF;
}

.entry-content a:hover {
  text-decoration-color: #1A1A1A;
}

.entry-content blockquote {
  border-left: 3px solid #1A1A1A;
  padding-left: 1.5rem;
  font-style: italic;
  color: #4B5563;
  margin: 2.5rem 0;
}

.entry-content blockquote p {
  margin: 0;
}

.entry-content ul,
.entry-content ol {
  padding-left: 1.6rem;
}

.entry-content li {
  margin-bottom: 0.4rem;
}

.entry-content li:last-child {
  margin-bottom: 0;
}

.entry-content code {
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
  font-size: 0.88em;
  background: #F3F4F6;
  padding: 2px 6px;
  border-radius: 3px;
  color: #111111;
}

.entry-content pre {
  background: #F3F4F6;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
  border-left: 3px solid #E5E4E2;
}

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

.entry-content hr {
  border: none;
  border-top: 1px solid #E5E4E2;
  margin: 3rem 0;
}

.entry-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.entry-content th,
.entry-content td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid #E5E4E2;
}

.entry-content th {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6B7280;
}

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

/* Gutenberg block alignment */
.entry-content .alignleft {
  float: left;
  margin-right: 1.5rem;
  margin-bottom: 1rem;
}

.entry-content .alignright {
  float: right;
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.entry-content .aligncenter {
  margin-left: auto;
  margin-right: auto;
}

/* ─────────────────────────────────────────
   EMOJI REACTIONS — floating pill
───────────────────────────────────────── */
.reactions-float {
  position: fixed;
  bottom: 28px;
  left: 0;
  right: 0;
  z-index: 9999;
  text-align: center;
  pointer-events: none;
}

.reactions-float-pill {
  display: inline-block;
  background: #ffffff;
  border: 1px solid #E5E4E2;
  border-radius: 100px;
  padding: 5px 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
  transform: translateY(calc(100% + 28px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.25s ease;
}

.reactions-float.is-visible .reactions-float-pill {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.reaction-btn {
  display: inline-block !important;
  vertical-align: middle;
  background: none;
  border: none;
  border-radius: 100px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.5;
  white-space: nowrap;
  transition: background 0.15s ease;
  font-family: 'Inter', sans-serif;
}

.reaction-btn:hover {
  background: #F3F4F6;
}

.reaction-btn.reacted {
  background: #1A1A1A;
}

.reaction-btn.reacted .reaction-count {
  color: #ffffff;
}

.reaction-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9CA3AF;
  font-family: 'Inter', sans-serif;
  vertical-align: middle;
}

.reaction-btn img.emoji {
  display: inline;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.15em;
  margin: 0;
}

/* ─────────────────────────────────────────
   POST NAVIGATION (single)
───────────────────────────────────────── */
.post-navigation {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 44px 0 0;
  margin-top: 48px;
  border-top: 1px solid #E5E4E2;
  font-size: 0.85rem;
}

.post-navigation a {
  color: #1A1A1A;
  text-decoration: none;
}

.post-navigation a:hover {
  color: #6B7280;
}

.post-nav-prev,
.post-nav-next {
  max-width: 48%;
}

.post-nav-next {
  text-align: right;
}

/* ─────────────────────────────────────────
   PAGINATION (blog list)
───────────────────────────────────────── */
.posts-pagination {
  display: flex;
  justify-content: space-between;
  padding: 40px 0 0;
  font-size: 0.85rem;
  font-weight: 500;
}

.posts-pagination a {
  color: #1A1A1A;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}

.posts-pagination a:hover {
  color: #6B7280;
}

/* ─────────────────────────────────────────
   STATIC PAGES
───────────────────────────────────────── */
.page-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: #111111;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid #E5E4E2;
  letter-spacing: -0.02em;
}

/* ─────────────────────────────────────────
   ARCHIVE HEADER
───────────────────────────────────────── */
.archive-header {
  margin-bottom: 44px;
  padding-bottom: 28px;
  border-bottom: 1px solid #E5E4E2;
}

.archive-label {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6B7280;
  margin-bottom: 8px;
  display: block;
}

.archive-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: #111111;
  letter-spacing: -0.015em;
}

.archive-description {
  font-size: 0.92rem;
  color: #6B7280;
  margin-top: 10px;
  line-height: 1.65;
}

/* ─────────────────────────────────────────
   404 PAGE
───────────────────────────────────────── */
.error-404 {
  padding: 80px 0;
}

.error-404 .page-title {
  border: none;
  margin-bottom: 16px;
}

.error-404 p {
  color: #6B7280;
  font-size: 1rem;
}

.error-404 a {
  color: #1A1A1A;
}

/* ─────────────────────────────────────────
   FOOTER — floating / full width
───────────────────────────────────────── */
.site-footer {
  width: 100%;
  background: #ffffff;
  border-top: 1px solid #E5E4E2;
  margin-top: 60px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 28px clamp(24px, 4vw, 64px);
  font-size: 0.8rem;
  color: #9CA3AF;
  background: #ffffff;
}

.site-footer a {
  color: #9CA3AF;
  text-decoration: none;
}

.site-footer a:hover {
  color: #6B7280;
}

.footer-nav {
  display: flex;
  gap: 20px;
}

.footer-nav-list {
  list-style: none;
  display: flex;
  gap: 20px;
}

.footer-nav-list a {
  font-size: 0.8rem;
  color: #9CA3AF;
  text-decoration: none;
}

.footer-nav-list a:hover {
  color: #6B7280;
}

/* ─────────────────────────────────────────
   HEADING FONT OVERRIDE — Inter everywhere
   (site title keeps Playfair Display)
───────────────────────────────────────── */
.post-card-title,
.entry-title,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.page-title,
.archive-title,
.error-404 .page-title {
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: -0.02em;
}

/* ─────────────────────────────────────────
   SELECTION
───────────────────────────────────────── */
::selection {
  background: #1A1A1A;
  color: #ffffff;
}

/* ─────────────────────────────────────────
   FOCUS (accessibility)
───────────────────────────────────────── */
:focus-visible {
  outline: 2px solid #1A1A1A;
  outline-offset: 3px;
}

/* ─────────────────────────────────────────
   ULTRAWIDE SCREENS (3440px+ monitors)
───────────────────────────────────────── */
@media (min-width: 1800px) {
  .site-wrapper {
    max-width: 1230px;
  }
}

/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 720px) {
  .site-wrapper {
    padding: 0 24px;
  }

  .primary-nav .nav-menu {
    gap: 16px;
  }
}

@media (max-width: 600px) {
  /* Show burger, hide desktop nav */
  .burger-btn {
    display: flex;
  }

  .primary-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid #E5E4E2;
    padding: 20px clamp(24px, 4vw, 64px) 24px;
    z-index: 99;
    margin-left: 0;
  }

  /* Open state */
  .nav-toggle:checked ~ .primary-nav {
    display: block;
  }

  .primary-nav .nav-menu {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  /* Sub-menu flat on mobile */
  .primary-nav .nav-menu .sub-menu {
    position: static;
    display: block;
    border: none;
    padding: 8px 0 0 16px;
    min-width: auto;
    box-shadow: none;
  }

  .primary-nav .nav-menu .sub-menu a {
    padding: 4px 0;
  }

  .post-card {
    flex-direction: column;
    gap: 16px;
  }

  .post-card-thumbnail {
    flex: none;
  }

  .post-card-thumbnail img {
    width: 100%;
    height: 200px;
  }

  .entry-title {
    font-size: 1.7rem;
  }
}

@media (max-width: 480px) {
  .primary-nav .nav-menu {
    gap: 16px;
    flex-wrap: wrap;
  }

  .entry-title {
    font-size: 1.5rem;
  }

  .reactions-float {
    bottom: 16px;
  }

  .reactions-float-pill {
    padding: 4px 6px;
  }

  .reaction-btn {
    padding: 7px 10px;
    font-size: 0.95rem;
  }
}

/* ─────────────────────────────────────────
   TOC PROGRESS INDICATOR
───────────────────────────────────────── */

@media (max-width: 999px) {
  #toc-widget { display: none; }
}

#toc-widget {
  position: fixed;
  left: calc((100vw - 820px) / 2 - 36px);
  top: calc(50% + 52px); /* 52px = half of the 104px fixed header, so widget centers in the reading area below it */
  transform: translateY(-50%);
  z-index: 200;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
}

.admin-bar #toc-widget {
  top: calc(50% + 68px); /* 104px header + 32px admin bar = 136px total offset, half = 68px */
}

@media (min-width: 1800px) {
  #toc-widget {
    left: calc((100vw - 1230px) / 2 - 36px);
  }
}

.toc-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.toc-bars:hover {
  background: rgba(0, 0, 0, 0.04);
}

.toc-bars:hover .toc-bar:not(.is-active) {
  background: #C9C8C6;
}

.toc-bar {
  width: 20px;
  height: 2px;
  background: #E8E7E5;
  border-radius: 2px;
  transition: background 0.2s ease;
}

.toc-bar.is-active {
  background: #9CA3AF;
}

.toc-panel {
  position: absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  min-width: 200px;
  max-width: 240px;
  max-height: 60vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #E5E4E2;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.10);
  border-radius: 6px;
  padding: 16px 0;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toc-panel.is-open {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
  pointer-events: auto;
}

.toc-panel[hidden] {
  display: none !important;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-empty {
  padding: 6px 20px;
  font-size: 0.8rem;
  color: #9CA3AF;
  font-style: italic;
}

.toc-link {
  display: block;
  padding: 6px 20px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #6B7280;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}

.toc-link:hover {
  color: #1A1A1A;
}

.toc-item--h1 .toc-link {
  font-weight: 500;
}

.toc-item--h2 .toc-link {
  padding-left: 32px;
}

.toc-item--h3 .toc-link {
  padding-left: 44px;
  font-size: 0.75rem;
}
