/* ========================================
   LOAFPICKLE WORLDWIDE — Journal Styles
   Tactical Cartridge Dispatches & Reader Monolith
   ======================================== */

.journal-grid-section {
  padding-top: calc(var(--unit) * 8);
  padding-bottom: calc(var(--unit) * 12);
  background: var(--bg-primary);
  position: relative;
  z-index: 5;
}

.journal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(var(--unit) * 3.5);
  margin-bottom: calc(var(--unit) * 8);
}

@media (max-width: 1024px) {
  .journal-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Expand / See More Button for Mobile Journal (Hidden on desktop) */
.journal-expand-wrap {
  display: none;
}

@media (max-width: 768px) {
  .journal-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: calc(var(--unit) * 3) !important;
    margin-bottom: calc(var(--unit) * 4) !important;
  }

  .journal-cartridge-card.journal-card-hidden-mobile {
    display: none !important;
  }

  .journal-expand-wrap {
    display: flex !important;
    justify-content: center;
    margin-top: calc(var(--unit) * 2);
    margin-bottom: calc(var(--unit) * 5);
  }

  .btn-journal-expand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #141414;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 13px 22px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    box-shadow: 4px 4px 0 #000;
    transition: all var(--trans-fast);
    width: 100%;
    max-width: 360px;
    user-select: none;
  }

  .btn-journal-expand:hover {
    background: #202020;
    border-color: var(--accent-brine);
    color: var(--accent-brine);
    box-shadow: 4px 4px 0 #000, 0 0 15px rgba(0, 237, 78, 0.2);
  }

  .btn-journal-expand:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #000;
  }

  .expand-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-brine);
    box-shadow: 0 0 6px var(--accent-brine);
  }

  .expand-icon {
    font-size: 0.75rem;
    color: var(--accent-brine);
  }
}

.journal-cartridge-card {
  cursor: pointer;
}

.journal-thumb-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0d0d0d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
}

.journal-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.5) contrast(1.1);
  transition: transform var(--trans-med), filter var(--trans-fast);
}

.journal-cartridge-card:hover .journal-thumb-img {
  transform: scale(1.05);
  filter: grayscale(0) contrast(1.05);
}

.journal-card-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1.25;
  color: #ffffff;
  margin-bottom: calc(var(--unit) * 1.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- STORY MONOLITH ---- */
.story-monolith {
  padding: calc(var(--unit) * 10) 0;
  background: var(--bg-primary);
  min-height: 80vh;
}

.story-title-max {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: calc(var(--unit) * 3) 0;
  color: #ffffff;
}

.story-image-full {
    width: 100%;
    max-height: 60vh;
    overflow: hidden;
    margin-bottom: calc(var(--unit) * 8);
    border: var(--border-main);
}

.story-image-full img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-content-live {
    font-size: 1.2rem;
    line-height: 1.8;
    color: rgba(245, 245, 233, 0.8);
}

.story-content-live h1, .story-content-live h2 {
    font-size: 2.2rem;
    margin: calc(var(--unit) * 6) 0 calc(var(--unit) * 2);
    color: var(--accent-brine);
}

.story-content-live h3, .story-content-live h4 {
    font-size: 1.5rem;
    margin: calc(var(--unit) * 4) 0 calc(var(--unit) * 1);
    color: var(--accent-crust);
}

.story-content-live p {
    margin-bottom: calc(var(--unit) * 3);
}

.story-content-live figure {
    margin: calc(var(--unit) * 6) 0;
    width: 100%;
}

.story-content-live img {
    width: 100%;
    height: auto;
    border: var(--border-main);
}

/* Hide stat tracking pixels from Medium RSS */
.story-content-live img[src*="stat?"],
.story-content-live img[src*="medium.com/_/stat"],
.story-content-live img[width="1"],
.story-content-live img[height="1"],
.story-content-live img[src=""] {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.story-content-live blockquote {
    border-left: 2px solid var(--accent-brine);
    padding-left: calc(var(--unit) * 4);
    margin: calc(var(--unit) * 4) 0;
    font-style: italic;
    color: var(--accent-brine);
    background: rgba(212, 255, 0, 0.02);
    padding: calc(var(--unit) * 2) calc(var(--unit) * 4);
}

.story-content-live a {
    color: var(--accent-brine);
    text-decoration: underline;
    transition: color var(--trans-med);
}

.story-content-live a:hover {
    color: var(--accent-crust);
}

.story-content-live ul, .story-content-live ol {
    margin-bottom: calc(var(--unit) * 4);
    padding-left: calc(var(--unit) * 4);
}

.story-content-live li {
    margin-bottom: var(--unit);
}

.dropcap {
    float: left;
    font-family: 'Playfair Display', serif;
    font-size: 5.5rem;
    line-height: 0.65;
    margin: 0.1em 0.1em 0.1em 0;
    color: var(--accent-brine);
}

/* ---- CODE SNIPPETS & TERMINAL FRAME ---- */
.story-content-live pre,
.code-terminal-frame pre {
    margin: 0;
    padding: 1.25rem 1.5rem;
    background: #0d0d0d !important;
    border-radius: 0 0 6px 6px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.92rem;
    line-height: 1.6;
    color: #e0e0e0;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
    tab-size: 4;
}

.story-content-live code,
.code-terminal-frame code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.9em;
    background: rgba(212, 255, 0, 0.08);
    color: var(--accent-brine);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

.story-content-live pre code,
.code-terminal-frame pre code {
    background: transparent !important;
    color: inherit;
    padding: 0;
    border-radius: 0;
}

.code-terminal-frame {
    margin: calc(var(--unit) * 5) 0;
    border: 1px solid rgba(212, 255, 0, 0.25);
    background: #0d0d0d;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(212, 255, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.code-terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #161616;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.code-terminal-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.code-terminal-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.code-terminal-dots span:nth-child(1) { background: #ff5f56; }
.code-terminal-dots span:nth-child(2) { background: #ffbd2e; }
.code-terminal-dots span:nth-child(3) { background: #27c93f; }

.code-terminal-title {
    color: var(--accent-brine);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.code-copy-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 3px 10px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 2px;
}

.code-copy-btn:hover {
    background: var(--accent-brine);
    color: #000;
    border-color: var(--accent-brine);
}

.code-copy-btn.copied {
    background: #27c93f;
    color: #000;
    border-color: #27c93f;
}

/* Prism syntax highlighting custom tokens */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #6a737d; font-style: italic; }
.token.punctuation { color: #89ddff; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol { color: var(--accent-orange, #ff4000); }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin { color: var(--accent-brine, #d4ff00); }
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string { color: #89ddff; }
.token.atrule, .token.attr-value, .token.keyword { color: #c792ea; font-weight: bold; }
.token.function, .token.class-name { color: #82aaff; }
.token.regex, .token.important, .token.variable { color: #f78c6c; }

/* ---- MEDIUM SUBSCRIBE CARD ---- */
.medium-subscribe-card {
    background: #141414;
    border: 2px solid var(--accent-brine);
    padding: calc(var(--unit) * 6);
    margin: calc(var(--unit) * 8) 0 calc(var(--unit) * 4);
    box-shadow: 10px 10px 0px rgba(0, 0, 0, 0.8), 0 0 25px rgba(212, 255, 0, 0.1);
    position: relative;
}

.medium-subscribe-card::before {
    content: 'EMAIL_DISPATCH';
    position: absolute;
    top: -12px;
    right: 20px;
    background: var(--accent-brine);
    color: #000;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 8px;
    letter-spacing: 0.1em;
}

.subscribe-header h3 {
    font-family: var(--font-marker);
    font-size: 1.8rem;
    color: #fff;
    margin: var(--unit) 0;
}

.subscribe-form {
    display: flex;
    gap: calc(var(--unit) * 2);
    margin-top: calc(var(--unit) * 4);
    flex-wrap: wrap;
}

.subscribe-input {
    flex: 1;
    min-width: 260px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 12px 16px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.subscribe-input:focus {
    border-color: var(--accent-brine);
    box-shadow: 0 0 10px rgba(212, 255, 0, 0.2);
}

.subscribe-btn {
    background: var(--accent-brine);
    color: #000;
    border: none;
    padding: 12px 24px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.subscribe-btn:hover {
    background: var(--accent-orange);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 4px 4px 0 #000;
}

/* ---- RESPONSIVE: JOURNAL & STORY READER ---- */
@media (max-width: 900px) {
  .journal-node-precision {
    grid-column: span 12;
    margin-top: 0 !important;
  }
  .story-title-max {
    font-size: clamp(2rem, 6.5vw, 3rem);
    line-height: 1.1;
    word-break: break-word;
  }
  .subscribe-form {
    flex-direction: column;
  }
  .subscribe-btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .journal-grid-section {
    padding-top: calc(var(--unit) * 5);
    padding-bottom: calc(var(--unit) * 8);
  }

  .story-monolith {
    padding: calc(var(--unit) * 6) 0;
  }

  .story-title-max {
    font-size: clamp(1.75rem, 6.5vw, 2.4rem);
    margin: calc(var(--unit) * 2) 0 calc(var(--unit) * 3);
  }

  .story-content-live {
    font-size: 1.05rem;
    line-height: 1.7;
  }

  .story-content-live h1,
  .story-content-live h2 {
    font-size: 1.6rem;
    margin: calc(var(--unit) * 4) 0 calc(var(--unit) * 1.5);
    line-height: 1.2;
    word-break: break-word;
  }

  .story-content-live h3,
  .story-content-live h4 {
    font-size: 1.3rem;
    margin: calc(var(--unit) * 3) 0 calc(var(--unit) * 1);
    word-break: break-word;
  }

  .dropcap {
    font-size: 3.6rem;
    line-height: 0.8;
    margin-right: 0.12em;
  }

  .story-content-live pre,
  .code-terminal-frame pre {
    padding: 12px 14px;
    font-size: 0.8rem;
    border-radius: 0;
  }

  .story-content-live blockquote {
    padding: 12px 14px;
    font-size: 0.95rem;
    margin: 16px 0;
  }

  .subscribe-input {
    font-size: 16px; /* iOS Auto-zoom prevention */
    min-width: 0;
    width: 100%;
  }

  .story-monolith .cartridge-actions-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .story-monolith #story-back-btn,
  .story-monolith #story-back-btn-bottom,
  .story-monolith .btn-cartridge-inquire {
    width: 100%;
    justify-content: center;
    text-align: center;
    margin-left: 0 !important;
    padding: 12px 18px;
    box-sizing: border-box;
  }
}