/* ==========================================================================
   tools.css - Tool-Specific Styles
   tools.middleman.tv

   Styles for the SCTE 35/104 parser pages, timecode utilities, and
   landing page effects. Depends on tokens.css and site.css.

   Usage: Include after site.css.
   ========================================================================== */


/* ==========================================================================
   Tool Header
   Page title area with description text.
   ========================================================================== */

.tool-header {
  padding: var(--mm-space-xl) 0 var(--mm-space-lg);
  text-align: center;
}

.tool-header h1 {
  margin-bottom: var(--mm-space-sm);
}

.tool-header p {
  font-size: var(--mm-font-size-lg);
  color: var(--mm-text-secondary);
  max-width: 640px;
  margin-inline: auto;
}


/* ==========================================================================
   Tool Input Area
   Large textarea container with format selector and options.
   ========================================================================== */

.tool-input-area {
  background-color: var(--mm-surface);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-lg);
  padding: var(--mm-space-lg);
  margin-bottom: var(--mm-space-lg);
}

.tool-input-area textarea.mm-input {
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-sm);
  min-height: 4rem;
  line-height: 1.6;
  background-color: var(--mm-bg-primary);
}


/* ==========================================================================
   Options Row
   Standard version dropdown + enriched toggle, inline layout.
   ========================================================================== */

.options-row {
  display: flex;
  align-items: center;
  gap: var(--mm-space-md);
  margin-top: var(--mm-space-md);
  flex-wrap: wrap;
}

.options-row label {
  font-size: var(--mm-font-size-sm);
  font-weight: var(--mm-weight-medium);
  color: var(--mm-text-secondary);
  white-space: nowrap;
}

.options-row select.mm-input {
  width: auto;
  min-width: 160px;
}


/* ==========================================================================
   Enriched Toggle
   Custom toggle switch for enriched mode.
   ========================================================================== */

.enriched-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--mm-space-sm);
  cursor: pointer;
  user-select: none;
}

.enriched-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.enriched-toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background-color: var(--mm-surface-raised);
  border-radius: 10px;
  border: 1px solid var(--mm-border);
  transition: background-color var(--mm-transition-fast),
              border-color var(--mm-transition-fast);
}

.enriched-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background-color: var(--mm-text-secondary);
  border-radius: 50%;
  transition: transform var(--mm-transition-fast),
              background-color var(--mm-transition-fast);
}

.enriched-toggle input:checked + .enriched-toggle-track {
  background-color: rgba(0, 164, 228, 0.2);
  border-color: var(--mm-accent);
}

.enriched-toggle input:checked + .enriched-toggle-track::after {
  transform: translateX(16px);
  background-color: var(--mm-accent);
}

.enriched-toggle input:focus-visible + .enriched-toggle-track {
  outline: 2px solid var(--mm-accent);
  outline-offset: 2px;
}

.enriched-toggle-label {
  font-size: var(--mm-font-size-sm);
  color: var(--mm-text-secondary);
}


/* ==========================================================================
   Format Pills
   Radio button group styled as selectable pills (base64/hex/xml).
   ========================================================================== */

.format-pills {
  display: inline-flex;
  gap: 2px;
  background-color: var(--mm-bg-primary);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-md);
  padding: 2px;
}

.format-pill {
  position: relative;
}

.format-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.format-pill label {
  display: block;
  padding: 0.375rem 0.875rem;
  font-size: var(--mm-font-size-sm);
  font-weight: var(--mm-weight-medium);
  color: var(--mm-text-muted);
  border-radius: calc(var(--mm-radius-md) - 2px);
  cursor: pointer;
  transition: background-color var(--mm-transition-fast),
              color var(--mm-transition-fast);
  white-space: nowrap;
  user-select: none;
}

.format-pill label:hover {
  color: var(--mm-text-secondary);
}

.format-pill input:checked + label {
  background-color: var(--mm-accent);
  color: var(--mm-code-white);
}

.format-pill input:focus-visible + label {
  outline: 2px solid var(--mm-accent);
  outline-offset: 1px;
}


/* ==========================================================================
   Input Group
   Text input with a format suffix badge on the right side.
   ========================================================================== */

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .mm-input {
  flex: 1;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.input-group-suffix {
  display: flex;
  align-items: center;
  padding: 0 var(--mm-space-md);
  background-color: var(--mm-bg-tertiary);
  border: 1px solid var(--mm-border);
  border-left: none;
  border-radius: 0 var(--mm-radius-md) var(--mm-radius-md) 0;
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-sm);
  color: var(--mm-text-muted);
  white-space: nowrap;
  min-width: 60px;
  justify-content: center;
}


/* ==========================================================================
   Advanced Options Panel
   Collapsible panel for frame rate and standard version dropdowns.
   ========================================================================== */

.status-advanced-row {
  display: flex;
  align-items: center;
  margin-top: var(--mm-space-sm);
}

.advanced-toggle {
  display: block;
  margin-left: auto;
  padding: var(--mm-space-xs) var(--mm-space-md);
  background: none;
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-sm);
  color: var(--mm-text-muted);
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-sm);
  cursor: pointer;
  transition: color var(--mm-transition-fast), border-color var(--mm-transition-fast);
}

.advanced-toggle:hover {
  color: var(--mm-text-primary);
  border-color: var(--mm-text-muted);
}

.advanced-panel {
  padding: var(--mm-space-md) 0;
}

.advanced-options-row {
  display: flex;
  align-items: center;
  gap: var(--mm-space-md);
  flex-wrap: wrap;
}

.advanced-options-row label {
  font-size: var(--mm-font-size-sm);
  color: var(--mm-text-secondary);
  white-space: nowrap;
}

.advanced-options-row select.mm-input {
  width: auto;
  min-width: 160px;
}


/* ==========================================================================
   Parse Button
   Large action button with loading spinner state.
   ========================================================================== */

.parse-btn {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: var(--mm-space-sm);
  padding: 0.75rem 2rem;
  font-size: var(--mm-font-size-base);
  font-weight: var(--mm-weight-bold);
  color: var(--mm-code-white);
  background-color: var(--mm-accent);
  border: none;
  border-radius: var(--mm-radius-md);
  cursor: pointer;
  transition: background-color var(--mm-transition-fast),
              box-shadow var(--mm-transition-fast);
  margin-top: var(--mm-space-md);
  min-width: 140px;
}

.parse-btn:hover:not(:disabled) {
  background-color: #0090c8;
  box-shadow: 0 0 16px rgba(0, 164, 228, 0.25);
}

.parse-btn:active:not(:disabled) {
  background-color: #007dae;
}

.parse-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.parse-btn:focus-visible {
  outline: 2px solid var(--mm-accent);
  outline-offset: 2px;
}

/* Loading spinner state */
.parse-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.parse-btn.loading::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--mm-code-white);
  border-radius: 50%;
  animation: mm-spin 0.6s linear infinite;
}

@keyframes mm-spin {
  to {
    transform: rotate(360deg);
  }
}


/* ==========================================================================
   Output Panel
   Code output area for parsed results.
   ========================================================================== */

.output-panel {
  position: relative;
  background: none;
  border: none;
  border-radius: 0;
  overflow: visible;
  margin-bottom: var(--mm-space-lg);
}

/* --- Output Tabs -------------------------------------------------------- */

.output-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--mm-border);
  background: none;
  overflow-x: auto;
}

.output-tab {
  padding: 0.625rem 1.25rem;
  font-size: var(--mm-font-size-sm);
  font-weight: var(--mm-weight-medium);
  color: var(--mm-text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--mm-transition-fast),
              border-color var(--mm-transition-fast);
  white-space: nowrap;
}

.output-tab:hover {
  color: var(--mm-text-secondary);
}

.output-tab.active {
  color: var(--mm-accent);
  border-bottom-color: var(--mm-accent);
}

.output-tab:focus-visible {
  outline: 2px solid var(--mm-accent);
  outline-offset: -2px;
}

/* Convert button — sits inside .output-tabs, pushed to the right */
.convert-btn {
  margin-left: auto;
  padding: 0.4rem 1rem;
  font-size: var(--mm-font-size-sm);
  font-weight: var(--mm-weight-medium);
  color: #fff;
  background: linear-gradient(135deg, #00A4E4, #4CB7A3);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.convert-btn:hover {
  box-shadow: 0 0 14px rgba(0, 164, 228, 0.35);
  transform: translateY(-1px);
}

.convert-btn:active {
  transform: translateY(0);
}

.convert-btn:focus-visible {
  outline: 2px solid var(--mm-accent);
  outline-offset: 2px;
}

.convert-btn-icon {
  display: inline-block;
  margin-right: 0.3em;
  font-weight: 700;
}

/* --- Output Content ----------------------------------------------------- */

.output-content {
  padding: var(--mm-space-sm) 0;
  overflow: auto;
  max-height: 600px;
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-sm);
  line-height: 1.6;
  color: var(--mm-text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}


/* ==========================================================================
   Copy Button
   Positioned top-right of output panel.
   ========================================================================== */

.copy-btn {
  position: absolute;
  top: var(--mm-space-sm);
  right: var(--mm-space-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  font-size: var(--mm-font-size-xs);
  font-weight: var(--mm-weight-medium);
  color: var(--mm-text-muted);
  background-color: var(--mm-surface);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-sm);
  cursor: pointer;
  transition: color var(--mm-transition-fast),
              border-color var(--mm-transition-fast),
              background-color var(--mm-transition-fast);
  z-index: 1;
}

.copy-btn:hover {
  color: var(--mm-text-primary);
  border-color: var(--mm-accent);
}

.copy-btn:focus-visible {
  outline: 2px solid var(--mm-accent);
  outline-offset: 1px;
}

/* Brief "Copied!" confirmation state */
.copy-btn.copied {
  color: var(--mm-success);
  border-color: var(--mm-success);
}


/* ==========================================================================
   Status Indicator
   Parse result feedback: success (green pulse) or error (red).
   ========================================================================== */

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--mm-space-sm);
  font-size: var(--mm-font-size-sm);
  font-weight: var(--mm-weight-medium);
}

.status-indicator::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-indicator-success {
  color: var(--mm-success);
}

.status-indicator-success::before {
  background-color: var(--mm-success);
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
  animation: mm-pulse-green 2s ease-in-out infinite;
}

@keyframes mm-pulse-green {
  0%, 100% {
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
  }
  50% {
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.9);
  }
}

.status-indicator-error {
  color: var(--mm-error);
}

.status-indicator-error::before {
  background-color: var(--mm-error);
  box-shadow: 0 0 6px rgba(244, 67, 54, 0.6);
}


/* ==========================================================================
   Parse Summary Card
   Description of the parsed message, shown above the output tabs.
   ========================================================================== */

/* ==========================================================================
   Parse Results Wrapper
   Groups the summary, errors, and output panel with a shared background.
   ========================================================================== */

.parse-results {
  background: none;
  border: none;
  padding: 0;
  margin-bottom: var(--mm-space-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--mm-space-sm);
}


.parse-summary {
  background-color: transparent;
  border: 1px solid var(--mm-border);
  border-left: 3px solid var(--mm-accent);
  border-radius: var(--mm-radius-md);
  padding: var(--mm-space-md) var(--mm-space-lg);
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-sm);
  font-weight: var(--mm-weight-bold);
  color: var(--mm-text-primary);
}


/* ==========================================================================
   Parse Error Cards
   Individual error cards that stack below the summary card.
   ========================================================================== */

.parse-errors {
  display: flex;
  flex-direction: column;
  gap: var(--mm-space-sm);
}

.parse-error-card {
  background-color: transparent;
  border: 1px solid var(--mm-border);
  border-left: 3px solid var(--mm-error);
  border-radius: var(--mm-radius-md);
  padding: var(--mm-space-md) var(--mm-space-lg);
  display: flex;
  align-items: baseline;
  gap: var(--mm-space-sm);
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-sm);
  color: var(--mm-text-primary);
}

.parse-error-card .mm-badge {
  flex-shrink: 0;
}


/* ==========================================================================
   Sample Messages + CTA
   Clickable sample message cards and call-to-action section.
   ========================================================================== */

.sample-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--mm-space-lg);
  margin: var(--mm-space-2xl) 0;
}

.samples-cta-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--mm-space-lg);
  margin: var(--mm-space-2xl) 0;
  align-items: start;
}

.sample-card {
  display: flex;
  flex-direction: column;
  background-color: var(--mm-bg-tertiary);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-lg);
  padding: var(--mm-space-lg);
  cursor: pointer;
  transition: border-color var(--mm-transition-fast), box-shadow var(--mm-transition-fast);
}

.sample-card:hover {
  border-color: var(--mm-accent);
  box-shadow: 0 0 0 1px var(--mm-accent);
}

.sample-card-badge {
  display: inline-block;
  background-color: var(--mm-accent);
  color: #fff;
  font-size: var(--mm-font-size-xs);
  font-weight: var(--mm-weight-bold);
  padding: 2px 8px;
  border-radius: var(--mm-radius-sm);
  margin-bottom: var(--mm-space-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sample-card h3 {
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-base);
  color: var(--mm-accent);
  margin-bottom: 2px;
}

.sample-card h3 + p {
  font-size: var(--mm-font-size-sm);
  color: var(--mm-text-secondary);
  margin-bottom: var(--mm-space-sm);
}

.sample-card-description {
  flex: 1;
  font-size: var(--mm-font-size-sm);
  color: var(--mm-text-secondary);
  margin-bottom: var(--mm-space-md);
  line-height: 1.5;
}

.sample-card-data {
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-xs);
  color: var(--mm-pulse-orange);
  word-break: break-all;
  border-top: 1px solid var(--mm-border);
  padding-top: var(--mm-space-sm);
  line-height: 1.4;
}

.cta-card {
  background-color: var(--mm-surface);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-lg);
  padding: var(--mm-space-xl);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.cta-card p {
  font-size: var(--mm-font-size-lg);
  font-weight: var(--mm-weight-medium);
  margin-bottom: var(--mm-space-md);
  line-height: 1.4;
}

.cta-card .mm-btn-cta {
  font-size: var(--mm-font-size-base);
  padding: var(--mm-space-sm) var(--mm-space-xl);
}

@media (max-width: 900px) {
  .samples-cta-row {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   Error List
   Styled error messages from parse results.
   ========================================================================== */

/* ==========================================================================
   SEO Section
   Below-tool content area for "What is SCTE 35/104?" copy.
   ========================================================================== */

.seo-section {
  padding: var(--mm-space-3xl) 0;
  border-top: 1px solid var(--mm-border);
  margin-top: var(--mm-space-3xl);
}

.seo-section h2 {
  font-size: var(--mm-font-size-2xl);
  margin-bottom: var(--mm-space-md);
}

.seo-section p {
  max-width: 720px;
  line-height: 1.7;
}

.seo-section p + p {
  margin-top: var(--mm-space-md);
}


/* ==========================================================================
   JSON Syntax Highlighting
   ========================================================================== */

.json-key {
  color: #8CDCFE;
}

.json-string {
  color: #CE9178;
}

.json-number {
  color: #B5CEA8;
}

.json-boolean {
  color: #569CD6;
}

.json-null {
  color: #569CD6;
  font-style: italic;
}


/* ==========================================================================
   JSON Collapsible Sections
   ========================================================================== */

.json-collapse {
  cursor: pointer;
  user-select: none;
}

.json-collapse:hover > .json-collapse-arrow {
  color: var(--mm-accent);
}

.json-collapse:focus-visible {
  outline: 2px solid var(--mm-accent);
  outline-offset: 1px;
  border-radius: 2px;
}

.json-collapse-arrow {
  display: inline-block;
  width: 1em;
  font-size: 0.7em;
  color: var(--mm-text-muted);
  transition: color var(--mm-transition-fast);
  vertical-align: middle;
  margin-right: 0.125em;
}


/* ==========================================================================
   XML Syntax Highlighting
   ========================================================================== */

.xml-tag {
  color: #569CD6;
}

.xml-attr {
  color: #9CDCFE;
}

.xml-value {
  color: #CE9178;
}

.xml-comment {
  color: #6A9955;
  font-style: italic;
}


/* ==========================================================================
   Matrix Overlay
   Subtle scanline effect for the landing page hero section.
   ========================================================================== */

.matrix-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.matrix-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 164, 228, 0.015) 2px,
    rgba(0, 164, 228, 0.015) 4px
  );
}


/* ==========================================================================
   Typing Cursor
   Blinking cursor for the GSAP typing effect on the hero tagline.
   ========================================================================== */

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background-color: var(--mm-accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: mm-blink 1s step-end infinite;
}

@keyframes mm-blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}


/* ==========================================================================
   Timecode Tool Cards
   Card layout for timecode converter, calculator, and frame counter.
   ========================================================================== */

.tc-card {
  background-color: var(--mm-surface);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-lg);
  padding: var(--mm-space-lg);
  box-shadow: var(--mm-shadow-sm);
}

.tc-card h3 {
  font-size: var(--mm-font-size-xl);
  margin-bottom: var(--mm-space-md);
}

/* Label + input pair */
.tc-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--mm-space-xs);
  margin-bottom: var(--mm-space-md);
}

.tc-input-group label {
  font-size: var(--mm-font-size-sm);
  font-weight: var(--mm-weight-medium);
  color: var(--mm-text-secondary);
}

.tc-input-group .mm-input {
  font-family: var(--mm-font-mono);
}

/* Result display */
.tc-result {
  padding: var(--mm-space-md);
  background-color: var(--mm-bg-primary);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-md);
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-lg);
  font-weight: var(--mm-weight-bold);
  color: var(--mm-accent);
  text-align: center;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tc-result:empty::after {
  content: '\2014'; /* em-dash placeholder */
  color: var(--mm-text-muted);
  font-weight: var(--mm-weight-normal);
}

/* --- Grid layout for timecode tool cards -------------------------------- */

.tc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--mm-space-lg);
  margin-bottom: var(--mm-space-lg);
}

/* --- Spacing for pill fieldsets inside timecode cards -------------------- */

.tc-operation-pills,
.tc-mode-pills {
  margin-bottom: var(--mm-space-md);
}


/* ==========================================================================
   Landing Page - Hero
   Full-width dark section with matrix canvas and centered content.
   ========================================================================== */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 520px;
  padding: var(--mm-space-4xl) var(--mm-space-lg);
  background-color: var(--mm-bg-primary);
  overflow: hidden;
}

.hero #matrix-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-content h1 {
  font-size: var(--mm-font-size-6xl);
  margin-bottom: var(--mm-space-md);
}

.hero-tagline {
  font-size: var(--mm-font-size-2xl);
  font-family: var(--mm-font-mono);
  color: var(--mm-accent);
  margin-bottom: var(--mm-space-md);
  min-height: 1.6em;
  text-align: right;
  opacity: 0.5;
}

.hero-subtitle {
  font-size: var(--mm-font-size-lg);
  color: var(--mm-text-secondary);
  margin-bottom: var(--mm-space-xl);
}

.hero-cta {
  font-size: var(--mm-font-size-lg);
  padding: 0.75rem 2rem;
}

.hero-compact {
  min-height: auto;
  padding: var(--mm-space-2xl) var(--mm-space-lg) var(--mm-space-lg);
}

.hero-compact .hero-subtitle {
  margin-bottom: 0;
}

.hero-compact + main > .landing-section:first-child {
  padding-top: var(--mm-space-lg);
}

/* Featured Tool Spotlight */
.featured-tool {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--mm-space-xl);
  background-color: var(--mm-bg-tertiary);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-lg);
  padding: var(--mm-space-xl);
  cursor: pointer;
  transition: border-color var(--mm-transition-fast), box-shadow var(--mm-transition-fast);
}

.featured-tool:hover {
  border-color: var(--mm-accent);
  box-shadow: 0 0 0 1px var(--mm-accent);
}

.featured-tool .mm-btn::after {
  content: '';
  position: absolute;
  inset: 0;
}

.featured-tool-info {
  flex: 1;
}

.featured-tool-info h2 {
  font-size: var(--mm-font-size-xl);
  margin-bottom: var(--mm-space-xs);
}

.featured-tool-info p {
  color: var(--mm-text-secondary);
  font-size: var(--mm-font-size-sm);
}

.featured-tool-badge {
  display: inline-block;
  background: linear-gradient(135deg, #00A4E4, #4CB7A3);
  color: #fff;
  font-size: var(--mm-font-size-xs);
  font-weight: var(--mm-weight-bold);
  padding: 2px 8px;
  border-radius: var(--mm-radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--mm-space-sm);
}


/* ==========================================================================
   Landing Page - Sections
   ========================================================================== */

.landing-section {
  padding: var(--mm-space-2xl) 0;
}

.landing-section-alt {
  background-color: var(--mm-bg-section-alt);
}

.landing-section-heading {
  margin-bottom: var(--mm-space-lg);
}

.landing-section-intro {
  font-size: var(--mm-font-size-lg);
  color: var(--mm-text-secondary);
  max-width: 640px;
  margin-inline: auto;
  margin-bottom: var(--mm-space-2xl);
}


/* ==========================================================================
   Landing Page - Card Grids
   ========================================================================== */

.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--mm-space-lg);
}

.landing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color var(--mm-transition-fast), box-shadow var(--mm-transition-fast);
  align-items: flex-start;
  gap: var(--mm-space-sm);
  padding: var(--mm-space-xl);
}

.landing-card-new-badge {
  position: absolute;
  top: var(--mm-space-sm);
  right: var(--mm-space-sm);
  padding: 2px var(--mm-space-sm);
  background-color: var(--mm-accent);
  color: #fff;
  font-size: var(--mm-font-size-xs);
  font-weight: var(--mm-weight-bold);
  border-radius: var(--mm-radius-sm);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.landing-card h3 {
  font-size: var(--mm-font-size-xl);
}

.landing-card p {
  flex: 1;
}

.landing-card:hover {
  border-color: var(--mm-accent);
  box-shadow: 0 0 0 1px var(--mm-accent);
}

/* Stretched link: the button/link covers the entire card */
.landing-card .mm-btn {
  margin-top: var(--mm-space-sm);
}

.landing-card .mm-btn::after {
  content: '';
  position: absolute;
  inset: 0;
}

.landing-card-icon {
  color: var(--mm-accent);
  margin-bottom: var(--mm-space-sm);
}

/* Smaller variant for open source cards on landing page */
.landing-grid-sm {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.landing-card-sm {
  padding: var(--mm-space-lg);
}

.landing-card-sm h3 {
  font-size: var(--mm-font-size-lg);
}


/* ==========================================================================
   Landing Page - CTA Section
   ========================================================================== */

.landing-cta-section {
  padding: var(--mm-space-2xl) 0;
  border-top: 1px solid var(--mm-border);
}

.landing-cta-text {
  font-size: var(--mm-font-size-2xl);
  font-weight: var(--mm-weight-bold);
  color: var(--mm-text-primary);
  margin-bottom: var(--mm-space-lg);
}


/* ==========================================================================
   Open Source Landing - Library Cards
   ========================================================================== */

.oss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--mm-space-lg);
  margin-bottom: var(--mm-space-3xl);
}

.oss-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--mm-space-xl);
  cursor: pointer;
  transition: border-color var(--mm-transition-fast), box-shadow var(--mm-transition-fast);
}

.oss-card:hover {
  border-color: var(--mm-accent);
  box-shadow: 0 0 0 1px var(--mm-accent);
}

/* "Learn More" stretched link covers the whole card */
.oss-card .mm-btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
}

/* GitHub button sits above the stretched link */
.oss-card .mm-btn-secondary {
  position: relative;
  z-index: 1;
}

.oss-card h2 {
  font-size: var(--mm-font-size-2xl);
  margin-bottom: var(--mm-space-sm);
}

.oss-card p {
  flex: 1;
}

.oss-features {
  list-style: none;
  padding: 0;
  margin: var(--mm-space-md) 0;
}

.oss-features li {
  position: relative;
  padding-left: var(--mm-space-lg);
  margin-bottom: var(--mm-space-sm);
  font-size: var(--mm-font-size-sm);
  color: var(--mm-text-secondary);
  line-height: 1.5;
}

.oss-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--mm-accent);
}

.oss-card-links {
  display: flex;
  gap: var(--mm-space-sm);
  margin-top: var(--mm-space-md);
  flex-wrap: wrap;
}


/* ==========================================================================
   Open Source Detail Pages - Library Documentation
   ========================================================================== */

.oss-badges {
  display: flex;
  gap: var(--mm-space-sm);
  justify-content: center;
  margin-bottom: var(--mm-space-md);
  flex-wrap: wrap;
}

.oss-detail-section {
  margin-bottom: var(--mm-space-2xl);
}

.oss-detail-section h2 {
  font-size: var(--mm-font-size-2xl);
  margin-bottom: var(--mm-space-md);
}

.oss-features-detail li {
  font-size: var(--mm-font-size-base);
  margin-bottom: var(--mm-space-md);
  line-height: 1.6;
}

.oss-detail-links {
  display: flex;
  gap: var(--mm-space-md);
  flex-wrap: wrap;
  padding-top: var(--mm-space-lg);
  border-top: 1px solid var(--mm-border);
}

.oss-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}


/* ==========================================================================
   SCTE 104/35 Explorer
   Visual message explorer with dual-panel field trees and mapping lines.
   ========================================================================== */


.explorer-page .tool-input-area {
  padding: var(--mm-space-md);
  margin-bottom: var(--mm-space-sm);
}

.explorer-page .tool-input-area textarea.mm-input {
  min-height: 4rem;
}

.explorer-page .parse-summary {
  margin-top: var(--mm-space-lg);
  margin-bottom: var(--mm-space-sm);
  padding: var(--mm-space-sm) var(--mm-space-md);
}

.explorer-page .parse-results {
  background: none;
  border: none;
  padding: 0;
  margin-bottom: var(--mm-space-md);
}

.explorer-page main {
  padding-bottom: var(--mm-space-xl);
}

/* Explorer Container */
.explorer-container {
  position: relative;
}

.explorer-panels {
  display: flex;
  gap: var(--mm-space-xl);
  position: relative;
  align-items: flex-start;
}

.explorer-panel {
  flex: 1;
  background-color: var(--mm-bg-tertiary);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Panel Header */
.explorer-panel-header {
  display: flex;
  align-items: center;
  gap: var(--mm-space-sm);
  padding: var(--mm-space-md) var(--mm-space-lg);
  border-bottom: 1px solid var(--mm-border);
  background-color: rgba(0, 164, 228, 0.03);
}

.explorer-panel-badge {
  display: inline-block;
  background-color: var(--mm-accent);
  color: #fff;
  font-size: var(--mm-font-size-xs);
  font-weight: var(--mm-weight-bold);
  padding: 2px 8px;
  border-radius: var(--mm-radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.explorer-panel-badge-35 {
  background-color: var(--mm-accent);
}

.explorer-panel-title {
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-sm);
  color: var(--mm-text-secondary);
}

/* Field Tree */
.field-tree {
  padding: var(--mm-space-md);
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-sm);
  max-height: 80vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--mm-border) transparent;
}

/* Field Tree - Single Panel (parser pages, no mapping lines)
   Overrides the base .field-tree max-height so the outer .output-content
   container is the sole scroll region, preventing nested scroll bars. */
.field-tree-single {
  max-height: none;
  overflow: visible;
}

/* Field Node */
.field-node {
  padding: 3px 0 3px var(--mm-space-sm);
  transition: background-color var(--mm-transition-fast);
  border-radius: 2px;
}

.field-node:hover {
  background-color: rgba(0, 164, 228, 0.04);
}

.field-node.mapped-active {
  background-color: rgba(0, 164, 228, 0.08);
}

.field-node.field-edited {
  background-color: rgba(245, 132, 38, 0.05);
}

.field-node.field-violation > .field-header .field-name,
.field-node.field-violation > .field-header .field-value {
  color: var(--mm-error);
}

.field-badge-violation {
  border-color: var(--mm-error) !important;
  color: var(--mm-error) !important;
}

.field-node-nested {
  margin-left: var(--mm-space-md);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

/* Field Header */
.field-header {
  display: flex;
  align-items: center;
  gap: var(--mm-space-xs);
  cursor: default;
  min-height: 24px;
}

.field-expand {
  width: 16px;
  text-align: center;
  font-size: 10px;
  color: var(--mm-text-muted);
  cursor: pointer;
  user-select: none;
  transition: transform var(--mm-transition-fast);
  flex-shrink: 0;
}

.field-expand.expanded {
  transform: rotate(90deg);
}

.field-name {
  color: #4ec9b0;
  white-space: nowrap;
}

.field-separator {
  color: var(--mm-text-muted);
}

.field-value {
  color: var(--mm-accent);
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 2px;
  transition: background-color var(--mm-transition-fast);
}

.field-value:hover {
  background-color: rgba(0, 164, 228, 0.1);
}

.field-name-enum {
  color: var(--mm-success, #4caf50);
  font-style: italic;
}

.field-value-input {
  background-color: var(--mm-surface);
  border: 1px solid var(--mm-accent);
  color: var(--mm-accent);
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-sm);
  padding: 1px 4px;
  border-radius: 2px;
  outline: none;
  width: auto;
  min-width: 60px;
}

.field-drag-handle {
  color: var(--mm-text-muted);
  cursor: grab;
  opacity: 0;
  transition: opacity var(--mm-transition-fast);
  margin-left: auto;
  padding: 0 4px;
  user-select: none;
}

.field-node:hover .field-drag-handle {
  opacity: 0.5;
}

.field-drag-handle:hover {
  opacity: 1 !important;
  color: var(--mm-text-primary);
}

/* Field Meta (description tooltip) */
.field-meta {
  display: none;
  margin-top: 2px;
  padding: var(--mm-space-xs) var(--mm-space-sm);
  font-size: var(--mm-font-size-xs);
  color: var(--mm-text-secondary);
  line-height: 1.4;
}

.field-node.meta-visible .field-meta {
  display: block;
}

.field-description {
  margin-bottom: 2px;
}

.field-badge {
  display: inline-block;
  background-color: var(--mm-surface);
  border: 1px solid var(--mm-border);
  color: var(--mm-text-muted);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--mm-radius-sm);
}

/* Mapping SVG */
.mapping-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.mapping-line {
  fill: none;
  stroke: var(--mm-accent);
  stroke-width: 1.5;
  opacity: 0.4;
  transition: opacity var(--mm-transition-fast);
}

.mapping-line.mapping-computed {
  stroke-dasharray: 6 4;
}

.mapping-line.mapping-active {
  opacity: 1;
  stroke-width: 3;
  stroke: #00d4ff;
  filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.6));
}

/* Panel Actions */
.explorer-panel-actions {
  padding: var(--mm-space-sm) var(--mm-space-lg);
  border-top: 1px solid var(--mm-border);
}

/* Export Bar */
.explorer-export-bar {
  padding: var(--mm-space-sm) var(--mm-space-lg);
  border-top: 1px solid var(--mm-border);
  background-color: rgba(0, 0, 0, 0.2);
}

.export-output {
  margin-top: var(--mm-space-sm);
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-xs);
  color: var(--mm-pulse-orange);
  word-break: break-all;
  padding: var(--mm-space-sm);
  background-color: var(--mm-surface);
  border-radius: var(--mm-radius-sm);
  max-height: 80px;
  overflow-y: auto;
}

/* Scanline overlay for matrix effect */
.explorer-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 0, 0.01) 2px,
    rgba(0, 255, 0, 0.01) 4px
  );
  pointer-events: none;
  z-index: 0;
}

.explorer-panel > * {
  position: relative;
  z-index: 1;
}

/* New message buttons */
.input-actions {
  display: flex;
  gap: var(--mm-space-sm);
  align-items: center;
  flex-wrap: wrap;
}

.mm-btn-sm {
  padding: var(--mm-space-xs) var(--mm-space-md);
  font-size: var(--mm-font-size-sm);
}

/* Explorer JSON/XML Sub-Tabs */
.json-sub-tabs,
.xml-sub-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: var(--mm-space-sm) var(--mm-space-md);
  background-color: var(--mm-bg-tertiary);
  border-bottom: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-md) var(--mm-radius-md) 0 0;
}

.json-sub-tab,
.xml-sub-tab {
  padding: var(--mm-space-xs) var(--mm-space-lg);
  border: none;
  background: none;
  color: var(--mm-text-muted);
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-sm);
  font-weight: var(--mm-weight-medium);
  border-radius: var(--mm-radius-sm);
  cursor: pointer;
  transition: all var(--mm-transition-fast);
}

.json-sub-tab.active,
.xml-sub-tab.active {
  background-color: var(--mm-accent);
  color: #fff;
}

.json-sub-tab:hover:not(.active),
.xml-sub-tab:hover:not(.active) {
  color: var(--mm-text-primary);
}

.json-copy-btn,
.xml-copy-btn {
  margin-left: auto;
  padding: var(--mm-space-xs) var(--mm-space-md);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-sm);
  background: none;
  color: var(--mm-text-muted);
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-sm);
  cursor: pointer;
  transition: color var(--mm-transition-fast), border-color var(--mm-transition-fast);
}

.json-copy-btn:hover,
.xml-copy-btn:hover {
  color: var(--mm-text-primary);
  border-color: var(--mm-text-muted);
}

.json-output-panel,
.xml-output-panel {
  background-color: var(--mm-bg-tertiary);
  border: 1px solid var(--mm-border);
  border-top: none;
  border-radius: 0 0 var(--mm-radius-md) var(--mm-radius-md);
  padding: var(--mm-space-lg);
  font-family: var(--mm-font-mono);
  font-size: var(--mm-font-size-sm);
  color: var(--mm-text-primary);
  overflow-x: auto;
  max-height: 80vh;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}


/* Explorer Responsive */
@media (max-width: 900px) {
  .explorer-panels {
    flex-direction: column;
  }

  .mapping-svg {
    display: none;
  }
}


/* ==========================================================================
   Responsive - Mobile (max-width: 768px)
   ========================================================================== */

@media (max-width: 768px) {

  /* Hero shrinks */
  .hero {
    min-height: 400px;
    padding: var(--mm-space-3xl) var(--mm-space-md);
  }

  .hero-compact {
    min-height: auto;
    padding: var(--mm-space-xl) var(--mm-space-md);
  }

  .hero-content h1 {
    font-size: var(--mm-font-size-3xl);
  }

  .hero-tagline {
    font-size: var(--mm-font-size-lg);
    text-align: right;
  }

  .hero-subtitle {
    font-size: var(--mm-font-size-base);
  }

  .featured-tool {
    flex-direction: column;
    text-align: center;
  }

  /* Landing sections tighten */
  .landing-section {
    padding: var(--mm-space-xl) 0;
  }

  .landing-card {
    padding: var(--mm-space-lg);
  }

  .landing-cta-text {
    font-size: var(--mm-font-size-xl);
  }

  /* Open source grid stacks */
  .oss-grid {
    grid-template-columns: 1fr;
  }

  .oss-card {
    padding: var(--mm-space-lg);
  }

  /* Tool header tightens */
  .tool-header {
    padding: var(--mm-space-lg) 0 var(--mm-space-md);
  }

  .tool-header p {
    font-size: var(--mm-font-size-base);
  }

  /* Input area reduces padding */
  .tool-input-area {
    padding: var(--mm-space-md);
  }

  .tool-input-area textarea.mm-input {
    min-height: 8rem;
  }

  /* Options row stacks */
  .options-row {
    flex-direction: column;
    align-items: stretch;
  }

  .options-row select.mm-input {
    width: 100%;
  }

  /* Format pills scroll if needed */
  .format-pills {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Output panel full width, shorter max height */
  .output-content {
    max-height: 400px;
    padding: var(--mm-space-md);
  }

  /* Output tabs scroll */
  .output-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Copy button adjusts */
  .copy-btn {
    position: static;
    margin: var(--mm-space-sm) var(--mm-space-sm) 0;
    align-self: flex-end;
  }

  /* Timecode cards stack */
  .tc-card {
    padding: var(--mm-space-md);
  }

  .tc-result {
    font-size: var(--mm-font-size-base);
  }

  /* SEO section tightens */
  .seo-section {
    padding: var(--mm-space-2xl) 0;
    margin-top: var(--mm-space-2xl);
  }
}


/* ==========================================================================
   Mobile Notice Banner
   Hidden by default, shown only on small screens.
   ========================================================================== */

.mobile-notice {
  display: none;
}

@media (max-width: 768px) {
  .mobile-notice {
    display: block;
    position: sticky;
    bottom: 0;
    z-index: 100;
    background-color: var(--mm-bg-tertiary);
    border-top: 1px solid var(--mm-border);
    padding: var(--mm-space-sm) var(--mm-space-md);
    text-align: center;
    font-size: var(--mm-font-size-xs);
    color: var(--mm-text-muted);
  }
}
