/*
Theme Name: Moodboard
Theme URI: https://example.com/moodboard
Author: Your Name
Author URI: https://example.com
Description: A media-library-powered masonry image board with a full-bleed hero, click-to-open overlay (share, download, caption, comments), and native notification and messaging panels.
Version: 1.4.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: moodboard
Tags: one-column, custom-logo, featured-images, full-width-template, photography, portfolio
*/

/* ==========================================================================
   1. CSS Custom Properties
   ========================================================================== */

:root {
  --color-bg: #f0f0f0;
  --color-white: #ffffff;
  --color-text: #111111;
  --color-text-secondary: #767676;
  --color-text-light: #b0b0b0;
  --color-accent: #ff62d3;
  --color-accent-hover: #e04cba;
  --color-accent-rgb: 255, 98, 211;
  --color-accent-soft: #ffc2e8;
  --color-accent-soft-rgb: 255, 194, 232;
  --color-overlay: rgba(0, 0, 0, 0.5);
  --color-overlay-light: rgba(0, 0, 0, 0.3);
  --color-border: #cdcdcd;
  --color-search-bg: #e9e9e9;
  --color-search-bg-hover: #dcdcdc;
  --font-primary: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-weight-bold: 700;
  --font-weight-semibold: 600;
  --font-weight-normal: 400;
  --radius-pin: 16px;
  --radius-pill: 24px;
  --radius-circle: 50%;
  --gutter: 16px;
  --header-height: 56px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* ==========================================================================
   2. Reset & Base
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: var(--font-weight-normal);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ==========================================================================
   3. Header — Pinterest-Authentic
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--header-height);
  padding: 0 16px;
  background: var(--color-white);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-fast);
}

.site-header.scrolled {
  border-bottom-color: var(--color-border);
}

/* Brand wordmark: [text] [logo] [text], centered in the header.
   On mobile the anchor becomes a two-row grid internally so the
   logo sits on top and both text words sit centered beneath it. */
.header-brand {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-self: center;
  gap: clamp(8px, 1.2vw, 14px);
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
}

.header-brand-text {
  font-family: 'Orbitron', 'Segoe UI', Roboto, sans-serif;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text);
  line-height: 1;
  font-size: clamp(0.8rem, 1.4vw, 1.1rem);
}

.header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.header-logo svg {
  width: 48px;
  height: 48px;
  fill: var(--color-accent);
}

/* Tighten header icon size on tablet so the message icon doesn't
   crowd the right edge. */
@media (max-width: 992px) {
  .header-icon-btn { width: 44px; height: 44px; }
}

/* Mobile: hide the brand text entirely. Just logo (centered) + icons. */
@media (max-width: 480px) {
  .site-header      { padding: 0 4px; }
  .header-brand-text { display: none; }
  .header-brand      { gap: 0; }

  .header-logo       { width: 44px; height: 44px; }
  .header-logo svg   { width: 36px; height: 36px; }

  .header-icon-btn   { width: 36px; height: 36px; }
  .header-icon-btn svg { width: 22px; height: 22px; }
  .header-menu[data-pt-menu="notifications"] .header-icon-btn svg {
    width: 20px; height: 20px;
  }
}

/* Right Icons (right-aligned column) */
.header-actions {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 0;
}

/* The bell SVG has a taller span (bell + clapper) than the message
   bubble, so at the same 24px container it reads visually larger.
   Shave it slightly so the two icons look the same size. */
.header-menu[data-pt-menu="notifications"] .header-icon-btn svg {
  width: 22px;
  height: 22px;
}

.header-menu {
  position: relative;
}

.header-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-white);
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  border-radius: 10px;
  border: 2px solid var(--color-white);
  pointer-events: none;
}

.header-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 24px);
  max-height: min(520px, calc(100vh - 80px));
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  z-index: 1100;

  /* Closed state — invisible, non-interactive, scaled down */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.96);
  transform-origin: top right;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    visibility 0s linear 0.22s;
}

.header-menu.is-open .header-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition:
    opacity 0.16s ease,
    transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    visibility 0s;
}

.header-menu.is-open .header-icon-btn {
  background: var(--color-search-bg);
  color: var(--color-text);
}

.header-dropdown-head {
  padding: 14px 16px 6px;
}

.header-dropdown-head h3 {
  font-size: 14px;
  font-weight: var(--font-weight-bold);
  margin: 0;
}

.header-dropdown-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.header-dropdown-empty {
  padding: 18px 16px;
  color: var(--color-text-secondary);
  font-size: 13px;
  margin: 0;
  text-align: center;
}

.header-dropdown-cta {
  display: block;
  text-align: center;
  padding: 10px 16px;
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
}

/* Notification list */
.header-notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-notif-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  transition: background var(--transition-fast);
  color: inherit;
}

.header-notif-item a:hover {
  background: var(--color-search-bg);
}

.header-notif-item.is-new a {
  background: rgba(var(--color-accent-rgb), 0.05);
}

.header-notif-thumb {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--color-search-bg) center / cover no-repeat;
}

.header-notif-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-notif-body strong {
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-notif-body small {
  font-size: 11px;
  color: var(--color-text-light);
}

/* Messages */
.header-msg-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.header-msg-item {
  max-width: 85%;
  padding: 8px 10px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.4;
}

.header-msg-item.from-user {
  background: var(--color-search-bg);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.header-msg-item.from-admin {
  background: var(--color-accent);
  color: var(--color-white);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.header-msg-meta {
  font-size: 10px;
  opacity: 0.75;
  margin-bottom: 2px;
}

.header-msg-text p { margin: 0 0 4px; }
.header-msg-text p:last-child { margin-bottom: 0; }

.header-msg-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 12px 12px;
}

.header-msg-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 12px;
  background: var(--color-search-bg);
  font-family: inherit;
  font-size: 13px;
  resize: none;
  transition: background var(--transition-fast);
}

.header-msg-form textarea:focus {
  outline: none;
  background: var(--color-search-bg-hover);
}

.header-msg-form .pt-btn-primary {
  align-self: flex-end;
  padding: 8px 18px;
  background: var(--color-accent);
  color: var(--color-white);
  font-weight: var(--font-weight-bold);
  font-size: 13px;
  border-radius: var(--radius-pill);
  transition: background var(--transition-fast);
}

.header-msg-form .pt-btn-primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.header-msg-form .pt-btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.header-msg-status {
  margin: 0;
  font-size: 12px;
  color: var(--color-accent);
}

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-circle);
  color: #000000;
  transition: background var(--transition-fast);
}

.header-icon-btn:hover {
  background: var(--color-search-bg);
}

.header-icon-btn svg {
  width: 24px;
  height: 24px;
}

/* ==========================================================================
   4. Hero Section
   ========================================================================== */

.hero {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 400px;
  max-height: 700px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      to top,
      rgba(0, 0, 0, 0.65) 0%,
      rgba(0, 0, 0, 0.4) 45%,
      rgba(0, 0, 0, 0.2) 100%
    );
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 48px 40px;
  max-width: 680px;
  color: var(--color-white);
}

.hero-tag {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(var(--color-accent-soft-rgb), 0.18);
  color: var(--color-accent-soft);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(var(--color-accent-soft-rgb), 0.45);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 16px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: var(--font-weight-bold);
  line-height: 1.1;
  margin-bottom: 12px;
}

.hero-description {
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: var(--font-weight-normal);
  line-height: 1.5;
  opacity: 0.9;
  margin-bottom: 24px;
  max-width: 480px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 28px;
  background: var(--color-accent);
  color: var(--color-white);
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: var(--font-weight-bold);
  transition: background var(--transition-fast);
}

.hero-cta:hover {
  background: var(--color-accent-hover);
}

/* ==========================================================================
   5. Pin Grid — 6-Column CSS Masonry
   ========================================================================== */

.pin-grid-section {
  padding: var(--gutter);
}

.pin-grid {
  columns: 6;
  column-gap: var(--gutter);
}

/* ==========================================================================
   6. Pin Card
   ========================================================================== */

.pin {
  break-inside: avoid;
  margin-bottom: var(--gutter);
  cursor: pointer;
}

/* Image container */
.pin-media {
  position: relative;
  border-radius: var(--radius-pin);
  overflow: hidden;
  background: var(--color-search-bg);
}

.pin-media img {
  width: 100%;
  height: auto;
  display: block;
  transition: filter var(--transition-normal);
}

.pin-media video {
  width: 100%;
  height: auto;
  display: block;
}

/* Hover overlay — share + download buttons, bottom-right */
.pin-overlay {
  position: absolute;
  inset: 0;
  background: var(--color-overlay-light);
  opacity: 0;
  transition: opacity var(--transition-normal);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 12px;
  pointer-events: none;
}

/* Only apply hover-reveal on devices that actually have a hover
   pointer. On touch screens (iOS, Android) :hover is emulated and
   a first tap lands on the hover state instead of firing the click,
   which is why every pin needed two taps to open the overlay. */
@media (hover: hover) and (pointer: fine) {
  .pin:hover .pin-overlay {
    opacity: 1;
    pointer-events: auto;
  }
}

.pin:focus-within .pin-overlay {
  opacity: 1;
  pointer-events: auto;
}

.pin-actions {
  display: flex;
  gap: 8px;
}

.pin-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-circle);
  background: var(--color-white);
  color: var(--color-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.pin-action-btn:hover {
  background: var(--color-search-bg);
  transform: scale(1.06);
}

.pin-action-btn svg {
  width: 16px;
  height: 16px;
}

.pin-download-btn {
  background: var(--color-accent);
  color: var(--color-white);
}

.pin-download-btn:hover {
  background: var(--color-accent-hover);
}

/* Pin info row — below image */
.pin-info {
  padding: 8px 4px 4px;
}

.pin-details { min-width: 0; }

.pin-title {
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin-category {
  display: inline-block;
  font-size: 12px;
  color: var(--color-text-secondary);
  text-decoration: none;
  margin-top: 2px;
}

.pin-category:hover {
  color: var(--color-text);
  text-decoration: underline;
}

/* Keyboard focus ring on pins */
.pin:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 4px;
  border-radius: var(--radius-pin);
}

/* Carousel indicator badge on pin cards */
.pin-carousel-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  pointer-events: none;
}
.pin-carousel-badge svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   7. Footer
   ========================================================================== */

.site-footer {
  padding: 24px var(--gutter);
  text-align: center;
  border-top: 1px solid var(--color-border);
  background: var(--color-white);
}

.footer-nav-list {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-bottom: 12px;
}

.footer-nav-list li a {
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

.footer-nav-list li a:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.footer-copyright {
  font-size: 12px;
  color: var(--color-text-light);
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
  line-height: 1.6;
}

@media (max-width: 480px) {
  .footer-copyright {
    padding: 0 32px;
    line-height: 1.7;
  }
}

/* ==========================================================================
   8. Responsive Breakpoints
   ========================================================================== */

/* 5 columns */
@media (max-width: 1400px) {
  .pin-grid {
    columns: 5;
  }
}

/* 4 columns */
@media (max-width: 1200px) {
  .pin-grid {
    columns: 4;
  }
}

/* 3 columns */
@media (max-width: 992px) {
  .pin-grid {
    columns: 3;
  }
}

/* 2 columns — tablet */
@media (max-width: 768px) {
  .pin-grid {
    columns: 2;
    column-gap: 8px;
  }

  .pin {
    margin-bottom: 8px;
  }

  .pin-grid-section {
    padding: 8px;
  }

  .hero {
    height: 55vh;
    min-height: 300px;
  }

  .hero-content {
    padding: 32px 20px;
  }

  .hero-title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
  }
}

/* 2 columns — small mobile */
@media (max-width: 480px) {
  :root {
    --header-height: 52px;
  }

  .pin-grid {
    columns: 2;
    column-gap: 6px;
  }

  .pin {
    margin-bottom: 6px;
  }

  .pin-grid-section {
    padding: 6px;
  }

  .hero {
    height: 45vh;
  }

  .hero-content {
    padding: 24px 16px;
  }

  .pin-info {
    padding: 6px 2px 2px;
  }

  .pin-title {
    font-size: 12px;
  }

  .pin-category {
    font-size: 11px;
  }

  .pin-action-btn {
    width: 32px;
    height: 32px;
  }
}

/* ==========================================================================
   9. Utility / WordPress overrides
   ========================================================================== */

/* Remove default WP admin bar spacing if logged in */
body.admin-bar .site-header {
  top: 32px;
}

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

/* Ensure videos fill card */
.pin-media iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  display: block;
}

/* ==========================================================================
   Sign Up page template
   ========================================================================== */

.signup-page {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  background: var(--color-bg);
}

.signup-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-white);
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
}

.signup-title {
  font-size: 28px;
  font-weight: var(--font-weight-bold);
  text-align: center;
  margin: 0 0 8px;
}

.signup-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  margin: 0 0 24px;
  font-size: 14px;
}

.signup-errors {
  background: rgba(var(--color-accent-rgb), 0.08);
  border: 1px solid rgba(var(--color-accent-rgb), 0.25);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  color: var(--color-accent);
  font-size: 13px;
}

.signup-errors p {
  margin: 0;
}

.signup-errors p + p {
  margin-top: 4px;
}

.signup-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.signup-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.signup-field > span {
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.signup-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-white);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.signup-field input:focus {
  outline: none;
  border-color: var(--color-text);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.signup-field small {
  font-size: 11px;
  color: var(--color-text-light);
}

.signup-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text);
  user-select: none;
  cursor: pointer;
}

.signup-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-accent);
  margin: 0;
}

.signup-submit {
  margin-top: 6px;
  padding: 14px 24px;
  background: var(--color-accent);
  color: var(--color-white);
  font-size: 15px;
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-pill);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.signup-submit:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.signup-footer {
  text-align: center;
  margin: 20px 0 0;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.signup-footer a {
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
}

.signup-footer a:hover {
  text-decoration: underline;
}

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

/* ==========================================================================
   10. Pin Overlay Modal
   ========================================================================== */

.pt-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}

.pt-modal.is-open {
  display: block;
}

body.pt-modal-open {
  overflow: hidden;
}

.pt-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  animation: pt-fade-in 0.18s ease both;
}

.pt-modal-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  background: var(--color-white);
  border-radius: 32px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
  animation: pt-zoom-in 0.2s ease both;
}

@keyframes pt-fade-in {
  from { opacity: 0; } to { opacity: 1; }
}

@keyframes pt-zoom-in {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Close button in the top-right corner of the post. */
.pt-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-circle);
  background: rgba(255, 255, 255, 0.95);
  color: var(--color-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: background var(--transition-fast);
}

.pt-modal-close:hover { background: var(--color-search-bg); }
.pt-modal-close svg { width: 20px; height: 20px; }

/* Media side */
.pt-modal-media {
  position: relative;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  max-height: calc(100vh - 48px);
  overflow: hidden;
}

.pt-modal-image {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 48px);
  object-fit: contain;
  background: #000;
}

/* Sidebar */
.pt-modal-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 28px;
  overflow-y: auto;
  max-height: calc(100vh - 48px);
}

/* Share + Download buttons overlayed on the image (top-right corner) */
.pt-modal-media-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 2;
}

/* Carousel navigation arrows */
.pt-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-circle);
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 2;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.pt-modal-nav:hover {
  background: var(--color-white);
  transform: translateY(-50%) scale(1.05);
}
.pt-modal-nav svg { width: 22px; height: 22px; }
.pt-modal-prev { left: 12px; }
.pt-modal-next { right: 12px; }

/* Respect the `hidden` attribute even when display is overridden above. */
.pt-modal-nav[hidden],
.pt-modal-counter[hidden] {
  display: none !important;
}

/* Image index counter */
.pt-modal-counter {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-pill);
  z-index: 2;
  pointer-events: none;
}

.pt-modal-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-circle);
  background: rgba(255, 255, 255, 0.95);
  color: var(--color-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.pt-modal-action:hover {
  background: var(--color-white);
  transform: scale(1.06);
}

.pt-modal-action svg {
  width: 18px;
  height: 18px;
}

.pt-modal-download {
  background: var(--color-accent);
  color: var(--color-white);
}

.pt-modal-download:hover {
  background: var(--color-accent-hover);
}

.pt-modal-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pt-modal-title {
  font-size: 22px;
  font-weight: var(--font-weight-bold);
  line-height: 1.25;
  color: var(--color-text);
  margin: 0;
}

.pt-modal-category {
  font-size: 13px;
  color: var(--color-text-secondary);
  text-decoration: none;
}

.pt-modal-category:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.pt-modal-caption {
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  white-space: pre-wrap;
}

.pt-modal-caption:empty { display: none; }

.pt-modal-toast {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--color-text);
  color: var(--color-white);
  font-size: 13px;
}

/* Comments */
.pt-modal-comments {
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pt-comments-heading {
  font-size: 15px;
  font-weight: var(--font-weight-bold);
  margin: 0;
}

.pt-comments-count {
  font-weight: var(--font-weight-normal);
  color: var(--color-text-secondary);
  margin-left: 4px;
}

.pt-comments-empty {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0;
}

.pt-comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pt-comment {
  list-style: none;
  position: relative;
}

.pt-comment-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.pt-comment-avatar { flex-shrink: 0; }
.pt-comment-avatar img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-circle);
  display: block;
}

.pt-comment-body { flex: 1; min-width: 0; }

.pt-comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  padding-left: 2px;
}

.pt-comment-author {
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

.pt-comment-author a { color: inherit; }
.pt-comment-author a:hover { text-decoration: underline; }

.pt-comment-date {
  font-size: 11px;
  color: var(--color-text-light);
}

/* Chat-bubble chip for the message body */
.pt-comment-text {
  display: inline-block;
  max-width: 100%;
  padding: 10px 14px;
  background: var(--color-search-bg);
  border-radius: 16px;
  border-top-left-radius: 4px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--color-text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.pt-comment-text p { margin: 0 0 6px; }
.pt-comment-text p:last-child { margin-bottom: 0; }

/* Owner/admin replies (WordPress sets .bypostauthor when the commenter
   is the post author). Tinted in the brand pink + small badge. */
.pt-comment.bypostauthor .pt-comment-text {
  background: rgba(var(--color-accent-soft-rgb), 0.45);
  border: 1px solid rgba(var(--color-accent-rgb), 0.22);
}

.pt-comment.bypostauthor .pt-comment-author::after {
  content: 'owner';
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-white);
  font-size: 9px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Threaded replies: indent with a vertical thread line and a short
   horizontal tick connecting each child to the line. */
.pt-comment-list .children {
  list-style: none;
  margin: 12px 0 0 18px;
  padding: 0 0 0 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
}

.pt-comment-list .children::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 18px;
  width: 2px;
  background: var(--color-border);
  border-radius: 2px;
}

.pt-comment-list .children > .pt-comment::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 18px;
  width: 18px;
  height: 14px;
  border-left: 2px solid var(--color-border);
  border-bottom: 2px solid var(--color-border);
  border-bottom-left-radius: 10px;
}

/* Comment form */
.pt-comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

/* Sign-up gate shown in place of the comment section for logged-out
   visitors — designed as an inviting little card, not a form label. */
.pt-comment-gate {
  position: relative;
  overflow: hidden;
  padding: 28px 24px;
  margin-top: 12px;
  text-align: center;
  border-radius: 20px;
  background:
    linear-gradient(135deg,
      rgba(var(--color-accent-rgb), 0.10) 0%,
      rgba(var(--color-accent-soft-rgb), 0.22) 100%);
  border: 1px solid rgba(var(--color-accent-rgb), 0.18);
  animation: pt-gate-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

/* Soft glow in the top-right corner */
.pt-comment-gate::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle,
    rgba(var(--color-accent-rgb), 0.25),
    transparent 70%);
  pointer-events: none;
}

@keyframes pt-gate-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.pt-comment-gate-icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: var(--radius-circle);
  background: var(--color-accent);
  color: var(--color-white);
  box-shadow: 0 6px 16px rgba(var(--color-accent-rgb), 0.35);
}

.pt-comment-gate-icon svg {
  width: 26px;
  height: 26px;
}

.pt-comment-gate-title {
  position: relative;
  z-index: 1;
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  line-height: 1.25;
}

.pt-comment-gate-msg {
  position: relative;
  z-index: 1;
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.pt-comment-gate-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pt-comment-gate-cta {
  display: inline-block;
  padding: 11px 28px;
  background: var(--color-accent);
  color: var(--color-white);
  font-size: 14px;
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-pill);
  box-shadow: 0 6px 16px rgba(var(--color-accent-rgb), 0.3);
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.pt-comment-gate-cta:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(var(--color-accent-rgb), 0.38);
}

.pt-comment-gate-alt {
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
}

.pt-comment-gate-alt:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.pt-comment-identity {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0;
}

.pt-comment-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pt-comment-fields input,
.pt-comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-white);
  resize: vertical;
}

.pt-comment-fields input:focus,
.pt-comment-form textarea:focus {
  outline: none;
  border-color: var(--color-text);
}

.pt-comment-submit {
  align-self: flex-end;
  padding: 10px 20px;
  background: var(--color-accent);
  color: var(--color-white);
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-pill);
  font-size: 14px;
  transition: background var(--transition-fast);
}

.pt-comment-submit:hover:not(:disabled) { background: var(--color-accent-hover); }
.pt-comment-submit:disabled { opacity: 0.6; cursor: default; }

/* Responsive modal */
@media (max-width: 900px) {
  /* On mobile the *modal* is the scroll container — the dialog flows
     naturally inside it. This sidesteps iOS Safari bugs where touch
     scrolling fails on a flex-centered child with max-height. */
  .pt-modal.is-open {
    display: block;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pt-modal-dialog {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    max-height: none;
    height: auto;
    width: calc(100% - 16px);
    max-width: 100%;
    margin: 8px auto;
    border-radius: 18px;
    overflow: visible;
    animation: none;
  }

  .pt-modal-media {
    max-height: none;
    min-height: auto;
    overflow: visible;
  }

  .pt-modal-image {
    width: 100%;
    height: auto;
    max-height: 75vh;
    object-fit: contain;
    background: #000;
  }

  .pt-modal-panel {
    padding: 16px 18px 20px;
    max-height: none;
    overflow: visible;
  }

  /* Share / download on the top-left of the image, leaving the right
     side clear for the close button. */
  .pt-modal-media-actions {
    top: 8px;
    left: 8px;
    right: auto;
  }

  /* Close button: a touch closer to the corner on small screens. */
  .pt-modal-close {
    top: 12px;
    right: 12px;
  }
}

@media (max-width: 480px) {
  .pt-modal-title { font-size: 18px; }
  .pt-comment-fields { grid-template-columns: 1fr; }
}
