/* ============================================================
   Machine-to-Market — Fix My Listing
   Design: Yellow Iron Yard brand system
   Light industrial · YIY yellow accent · clean & readable
   ============================================================ */

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

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Anton&family=Inter:wght@400;500;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* MTM brand palette */
  --mtm-yellow:   #EAB308;
  --mtm-yellow-dim: #ca9a07;
  --mtm-yellow-bg: rgba(234,179,8,0.09);
  --mtm-black:    #1A1A1A;
  --mtm-charcoal: #2D2D2D;
  --mtm-page-bg:  #F5F5F3;
  --mtm-card-white: #FFFFFF;
  --mtm-border:   #D1D0CB;
  --mtm-text-muted: #555550;

  /* Legacy YIY vars — still used in header/footer dark areas */
  --yiy-yellow:     #EAB308;
  --yiy-yellow-dim: #ca9a07;
  --yiy-yellow-bg:  rgba(234,179,8,0.09);
  --navy:           #1A1A1A;
  --navy-mid:       #2D2D2D;
  --navy-panel:     #FFFFFF;
  --navy-card:      #FFFFFF;
  --navy-border:    #D1D0CB;
  --navy-border-hi: #AAAAAA;
  --white:          #F5F5F3;
  --white-dim:      #888880;
  --muted:          #777772;
  --error:          #E05252;
  --success:        #3DB87A;

  --mono:    'IBM Plex Mono', monospace;
  --display: 'Bebas Neue', 'Anton', 'Arial Narrow', sans-serif;
  --body:    'Inter', sans-serif;
  --radius: 4px;
  --max:    1140px;
}

html { font-size: 16px; }

body {
  background: var(--mtm-page-bg);
  color: var(--mtm-black);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ──────────────────────────────────────────────── */

header {
  background: linear-gradient(to bottom, rgba(30,30,30,0.95), rgba(15,15,15,0.88));
  border-bottom: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 32px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  padding: 10px 0;
  text-decoration: none;
}

.logo img {
  height: 72px;
  width: auto;
  object-fit: contain;
  display: block;
  mix-blend-mode: screen;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
}

@media (max-width: 768px) {
  .logo img {
    height: 56px;
  }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-badge {
  font-family: var(--mono);
  font-size: 10px;
  color: #888880;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 2px;
}

/* ── MAIN ────────────────────────────────────────────────── */

main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 32px 24px 72px;
}

/* ── HERO ────────────────────────────────────────────────── */

.hero {
  padding: 56px 0 44px;
  border-bottom: 1px solid var(--mtm-border);
  margin-bottom: 40px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.hero-left { flex: 1; }

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mtm-yellow);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 2px;
  background: var(--mtm-yellow);
}

.hero h1 {
  font-family: var(--body);
  font-size: clamp(40px, 5.5vw, 64px);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: 0.01em;
  color: var(--mtm-black);
  margin-bottom: 16px;
}

.hero h1 em {
  font-style: normal;
  color: var(--mtm-yellow);
}

.sub {
  font-size: 15px;
  color: var(--mtm-text-muted);
  max-width: 420px;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  gap: 32px;
  flex-shrink: 0;
}

.hero-stat {
  text-align: center;
}

.hero-stat-val {
  font-family: var(--body);
  font-size: 28px;
  font-weight: 600;
  color: var(--mtm-yellow);
  line-height: 1;
  display: block;
}

.hero-stat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mtm-text-muted);
  margin-top: 4px;
  display: block;
  max-width: 100px;
  text-align: center;
  line-height: 1.4;
}

/* OEM credibility line in listing output */
.oem-source-line {
  font-size: 11px;
  color: var(--mtm-text-muted);
  display: block;
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* Machine identity headline in listing output */
.listing-headline {
  display: block;
  font-family: var(--body);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--mtm-black);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--mtm-border);
  margin-bottom: 4px;
}

/* ── TOOL GRID ───────────────────────────────────────────── */

.tool {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: var(--mtm-border);
  border: 1px solid var(--mtm-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel {
  background: var(--mtm-card-white);
  display: flex;
  flex-direction: column;
}

/* ── PANEL HEADER ────────────────────────────────────────── */

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--mtm-border);
  background: var(--mtm-card-white);
}

.step {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--mtm-yellow-dim);
  letter-spacing: 0.1em;
  font-weight: 500;
  background: var(--mtm-yellow-bg);
  padding: 2px 7px;
  border: 1px solid rgba(234,179,8,0.25);
  border-radius: 2px;
}

.panel-title {
  font-family: var(--body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mtm-black);
  flex: 1;
}

.btn-example {
  background: transparent;
  border: 1px solid var(--mtm-border);
  color: var(--mtm-text-muted);
  padding: 5px 12px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: var(--radius);
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  white-space: nowrap;
}

.btn-example:hover {
  border-color: var(--mtm-yellow);
  color: var(--mtm-yellow-dim);
  background: var(--mtm-yellow-bg);
}

/* ── TEXTAREA ────────────────────────────────────────────── */

textarea#raw-input {
  flex: 1;
  min-height: 430px;
  background: var(--mtm-card-white);
  border: none;
  outline: none;
  resize: vertical;
  padding: 22px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--mtm-black);
  caret-color: var(--mtm-yellow);
  transition: background 0.15s;
}

textarea#raw-input::placeholder {
  color: var(--mtm-border);
  font-style: italic;
}

textarea#raw-input:focus {
  background: #FDFDFB;
  outline: 2px solid rgba(234,179,8,0.35);
  outline-offset: -2px;
}

/* ── INPUT FOOTER ────────────────────────────────────────── */

.input-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--mtm-border);
  background: var(--mtm-card-white);
}

.char-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mtm-text-muted);
}

/* ── BUTTONS ─────────────────────────────────────────────── */

.btn-primary {
  background: var(--mtm-yellow);
  color: var(--mtm-black);
  border: 1px solid var(--mtm-yellow);
  padding: 11px 24px;
  font-family: var(--body);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s, transform 0.08s, box-shadow 0.12s;
  border-radius: var(--radius);
}

.btn-primary:hover {
  background: #ca9a07;
  box-shadow: 0 2px 12px rgba(234,179,8,0.30);
}

.btn-primary:active { transform: scale(0.97); }

.btn-primary:disabled {
  background: var(--mtm-border);
  color: var(--mtm-text-muted);
  border-color: var(--mtm-border);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.arrow { font-size: 16px; transition: transform 0.15s; }
.btn-primary:hover .arrow { transform: translateX(3px); }

.btn-copy {
  background: var(--mtm-card-white);
  border: 1px solid var(--mtm-border);
  color: var(--mtm-text-muted);
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.btn-copy:hover {
  border-color: var(--mtm-yellow);
  color: var(--mtm-yellow-dim);
  background: var(--mtm-yellow-bg);
}

.btn-copy.copied {
  color: var(--success);
  border-color: var(--success);
}

/* ── OUTPUT STATES ───────────────────────────────────────── */

.output-idle,
.output-loading,
.output-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 20px;
  gap: 14px;
  text-align: center;
}

.idle-icon {
  width: 52px;
  height: 52px;
  border: 2px solid var(--mtm-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mtm-text-muted);
  font-size: 22px;
  animation: spin-slow 10s linear infinite;
}

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

.output-idle p {
  color: var(--mtm-text-muted);
  font-size: 13px;
  font-family: var(--mono);
}

.output-idle .hint {
  font-family: var(--mono);
  font-size: 10px;
  color: #AAAAAA;
  letter-spacing: 0.06em;
}

/* Loading */
.loader {
  width: 180px;
  height: 2px;
  background: var(--mtm-border);
  border-radius: 2px;
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  width: 40%;
  background: var(--mtm-yellow);
  animation: slide 1.1s ease-in-out infinite alternate;
}

@keyframes slide {
  from { transform: translateX(-100%); }
  to   { transform: translateX(350%); }
}

.loading-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mtm-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Error */
.output-error {
  flex-direction: row;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 20px 22px;
  background: rgba(224,82,82,0.05);
  border-left: 3px solid var(--error);
}

.err-icon { color: var(--error); font-size: 16px; flex-shrink: 0; margin-top: 2px; }
#error-msg { font-family: var(--mono); font-size: 13px; color: var(--error); line-height: 1.55; }

/* ── LISTING OUTPUT ──────────────────────────────────────── */

.listing-out {
  flex: 1;
  padding: 22px;
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.8;
  color: var(--mtm-black);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--mtm-card-white);
  border: none;
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ── SPECS PANEL ─────────────────────────────────────────── */

.specs-wrap {
  margin-top: 3px;
  border: 1px solid var(--mtm-border);
  border-top: 3px solid var(--mtm-yellow);
  background: var(--mtm-card-white);
  border-radius: 0 0 var(--radius) var(--radius);
  animation: fade-in 0.3s ease;
}

.specs-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--mtm-border);
  flex-wrap: wrap;
  background: var(--mtm-card-white);
}

.specs-badge {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--mtm-yellow);
  color: var(--mtm-black);
  padding: 3px 7px;
  border-radius: 2px;
}

.specs-title {
  font-family: var(--body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mtm-black);
}

.specs-note {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--mtm-text-muted);
  margin-left: auto;
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.spec-item {
  padding: 16px 22px;
  border-right: 1px solid var(--mtm-border);
  border-bottom: 1px solid var(--mtm-border);
}

.spec-key {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mtm-text-muted);
  margin-bottom: 5px;
}

.spec-val {
  font-family: var(--body);
  font-size: 20px;
  font-weight: 700;
  color: var(--mtm-black);
  letter-spacing: 0.01em;
}

/* ── PARSED DATA DETAILS ─────────────────────────────────── */

.parsed-wrap {
  margin-top: 3px;
  border: 1px solid var(--mtm-border);
  border-radius: var(--radius);
  animation: fade-in 0.3s ease;
}

.parsed-wrap summary {
  padding: 12px 22px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mtm-text-muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--mtm-card-white);
  transition: color 0.12s;
  border-radius: var(--radius);
}

.parsed-wrap summary:hover { color: var(--mtm-black); }
.parsed-wrap summary::before { content: '▶'; font-size: 8px; transition: transform 0.15s; }
.parsed-wrap[open] summary::before { transform: rotate(90deg); }

.parsed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  background: var(--mtm-page-bg);
  border-top: 1px solid var(--mtm-border);
}

.parsed-item {
  padding: 12px 22px;
  border-right: 1px solid var(--mtm-border);
  border-bottom: 1px solid var(--mtm-border);
}

.parsed-key {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mtm-text-muted);
  margin-bottom: 3px;
}

.parsed-val {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--mtm-yellow-dim);
}

/* ── FOOTER ──────────────────────────────────────────────── */

footer {
  border-top: 1px solid rgba(0,0,0,0.2);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: #888880;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--mtm-charcoal);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-logo {
  font-family: var(--body);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--mtm-yellow);
  text-transform: uppercase;
}

.sep { opacity: 0.35; }

.footer-right a {
  color: #888880;
  text-decoration: none;
  transition: color 0.12s;
}

.footer-right a:hover { color: #CCCCCC; }

/* ── SPEC TIER TOGGLE ────────────────────────────────────── */

.tier-toggle {
  display: flex;
  gap: 4px;
}

.tier-btn {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 13px;
  border: 1px solid var(--mtm-border);
  border-radius: var(--radius);
  background: var(--mtm-card-white);
  color: var(--mtm-text-muted);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.tier-btn:hover {
  border-color: var(--mtm-yellow);
  color: var(--mtm-black);
}

.tier-btn.active {
  background: var(--mtm-yellow);
  border-color: var(--mtm-yellow);
  color: var(--mtm-black);
}

.spec-dl {
  width: 100%;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--mtm-border);
}

.spec-row:last-child {
  border-bottom: none;
}

.spec-row dt {
  font-size: 13px;
  color: var(--mtm-text-muted);
  font-weight: 400;
}

.spec-row dd {
  font-size: 13px;
  color: var(--mtm-black);
  font-weight: 600;
  text-align: right;
}

.spec-tier-count {
  font-size: 11px;
  color: var(--mtm-text-muted);
  margin-top: 12px;
  text-align: right;
  letter-spacing: 0.04em;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */

@media (max-width: 800px) {
  .tool { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; padding: 36px 0 28px; }
  .hero-stats { gap: 24px; }
  textarea#raw-input { min-height: 260px; }
  .specs-note { display: none; }
  .specs-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 500px) {
  main { padding: 0 16px 56px; }
  .header-inner { padding: 0 16px; }
  .hero-stats { display: none; }
  footer { flex-direction: column; gap: 8px; text-align: center; }
}
