/* ============================================================
   M50734SP Resource Site - Main Stylesheet
   Aesthetic: Retro-industrial / vintage electronics lab
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Rajdhani:wght@400;500;600;700&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,400&display=swap');

:root {
  --bg-dark:       #1a1d26;
  --bg-panel:      #252836;
  --bg-card:       #20242f;
  --border:        #2a3347;
  --border-bright: #3d5080;
  --accent:        #4a9eff;
  --accent2:       #00d4aa;
  --accent3:       #ff8c42;
  --text-primary:  #d4dbe8;
  --text-muted:    #6b7a99;
  --text-mono:     #a8c4ff;
  --amber:         #ffb74d;
  --green-crt:     #39ff84;
  --red-warn:      #ff4d6d;
  --shadow:        rgba(74, 158, 255, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Rajdhani', sans-serif;
  font-size: 17px;
  line-height: 1.7;
  min-height: 100vh;
}

/* Scanline overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.04) 2px,
    rgba(0,0,0,0.04) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ---- TYPOGRAPHY ---- */
h1, h2, h3, h4, h5 {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

h1 { font-size: 2.6rem; line-height: 1.15; }
h2 { font-size: 1.9rem; color: var(--accent); margin-bottom: 1rem; }
h3 { font-size: 1.4rem; color: var(--accent2); margin-bottom: 0.6rem; }
h4 { font-size: 1.15rem; color: var(--amber); }

p { margin-bottom: 1rem; font-weight: 400; }

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent2); }

code, .mono {
  font-family: 'Share Tech Mono', monospace;
  color: var(--text-mono);
  background: rgba(74, 158, 255, 0.07);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

pre {
  font-family: 'Share Tech Mono', monospace;
  background: #0a0d13;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  border-radius: 4px;
  color: var(--text-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 1.4rem;
}

pre .comment { color: #4a5a7a; }
pre .label   { color: var(--accent2); }
pre .opcode  { color: var(--amber); }
pre .operand { color: var(--text-primary); }
pre .string  { color: #c792ea; }

/* ---- LAYOUT ---- */
.site-wrapper {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ---- HEADER ---- */
.site-header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 64px;
  max-width: 1200px;
  margin: 0 auto;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
}

.logo-chip {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #1a2540, #0d1528);
  border: 1px solid var(--accent);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  color: var(--accent);
  text-align: center;
  line-height: 1.3;
  letter-spacing: 0;
  box-shadow: 0 0 12px rgba(74,158,255,0.25), inset 0 0 8px rgba(74,158,255,0.05);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-text .chip-id {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.logo-text .chip-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ---- NAVIGATION ---- */
.main-nav { display: flex; align-items: center; gap: 0; }

.main-nav a {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 1rem;
  height: 64px;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  position: relative;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown > a::after { content: ' ▾'; font-size: 0.7rem; }

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  min-width: 220px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.nav-dropdown:hover .dropdown-menu { display: block; }

.dropdown-menu a {
  height: auto;
  padding: 0.6rem 1.2rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  display: block;
}

.dropdown-menu a:last-child { border-bottom: none; }
.dropdown-menu a:hover { background: rgba(74,158,255,0.08); }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  border-radius: 3px;
  font-size: 1.2rem;
}

/* ---- HERO (homepage) ---- */
.hero {
  background: linear-gradient(160deg, #0d1528 0%, #0d0f14 60%);
  border-bottom: 1px solid var(--border);
  padding: 5rem 1.5rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: 'M50734SP';
  position: absolute;
  right: -1rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Share Tech Mono', monospace;
  font-size: 12rem;
  color: rgba(74,158,255,0.03);
  pointer-events: none;
  letter-spacing: -0.02em;
}

.hero-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: center;
}

.hero-badge {
  display: inline-block;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent2);
  border: 1px solid var(--accent2);
  padding: 0.2rem 0.7rem;
  border-radius: 2px;
  margin-bottom: 1.2rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: 3.2rem;
  margin-bottom: 0.4rem;
  background: linear-gradient(135deg, #d4dbe8 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .hero-sub {
  font-size: 1.3rem;
  color: var(--amber);
  font-weight: 600;
  margin-bottom: 1.2rem;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
}

.hero-actions { display: flex; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.6rem;
  border-radius: 3px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #5bb0ff; color: #fff; box-shadow: 0 0 20px rgba(74,158,255,0.4); }

.btn-outline {
  background: transparent;
  color: var(--accent2);
  border: 1px solid var(--accent2);
}
.btn-outline:hover { background: rgba(0,212,170,0.1); color: var(--accent2); }

.btn-sm { padding: 0.4rem 1rem; font-size: 0.82rem; }

/* Chip diagram in hero */
.hero-chip {
  width: 180px;
  height: 240px;
  background: linear-gradient(180deg, #1e2a3d, #111827);
  border: 2px solid var(--border-bright);
  border-radius: 6px;
  position: relative;
  box-shadow: 0 0 40px rgba(74,158,255,0.15), inset 0 0 20px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.3rem;
}

.chip-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-align: center;
}

.chip-mfr { font-size: 0.55rem; color: var(--text-muted); }

/* Chip pins */
.chip-pins-left, .chip-pins-right {
  position: absolute;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chip-pins-left { left: -18px; }
.chip-pins-right { right: -18px; }

.pin {
  width: 18px;
  height: 3px;
  background: var(--border-bright);
  border-radius: 1px;
}

/* ---- SPEC CARDS ---- */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 2rem 0;
}

.spec-item {
  background: var(--bg-card);
  padding: 1.2rem 1.4rem;
  transition: background 0.2s;
}

.spec-item:hover { background: #1d2535; }

.spec-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}

.spec-value {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--amber);
}

/* ---- CONTENT CARDS ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.6rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--border-bright);
  box-shadow: 0 4px 24px var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.card-icon {
  font-size: 1.4rem;
}

/* ---- INSTRUCTION REFERENCE ---- */
.instr-header {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.instr-mnemonic {
  font-family: 'Share Tech Mono', monospace;
  font-size: 3rem;
  color: var(--accent);
  line-height: 1;
  background: rgba(74,158,255,0.07);
  border: 1px solid var(--border-bright);
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
}

.instr-meta { flex: 1; min-width: 220px; }
.instr-full-name { font-size: 1.4rem; color: var(--amber); margin-bottom: 0.4rem; }
.instr-category {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Addressing mode table */
.addr-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.addr-table th {
  background: rgba(74,158,255,0.1);
  color: var(--accent);
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border-bright);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.addr-table td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.addr-table tr:hover td { background: rgba(74,158,255,0.04); }

.flag-indicator {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 700;
  margin: 0 2px;
}

.flag-set    { background: rgba(57,255,132,0.2); color: var(--green-crt); border: 1px solid var(--green-crt); }
.flag-clear  { background: rgba(255,77,109,0.15); color: var(--red-warn); border: 1px solid var(--red-warn); }
.flag-mod    { background: rgba(255,183,77,0.15); color: var(--amber); border: 1px solid var(--amber); }
.flag-nop    { background: rgba(74,158,255,0.08); color: var(--text-muted); border: 1px solid var(--border); }

/* ---- SIDEBAR ---- */
.page-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  align-items: start;
}

.sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  position: sticky;
  top: 80px;
}

.sidebar-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar nav a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  transition: all 0.15s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(74,158,255,0.05);
}

.sidebar nav .section-head {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent2);
  padding: 0.8rem 1rem 0.2rem;
  font-weight: 700;
}

/* ---- MAIN CONTENT AREA ---- */
.main-content { min-width: 0; }

.page-section {
  margin-bottom: 3rem;
}

.section-divider {
  height: 1px;
  background: var(--border);
  margin: 2.5rem 0;
  position: relative;
}

.section-divider::before {
  content: '◆';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-dark);
  color: var(--border);
  padding: 0 0.5rem;
  font-size: 0.6rem;
}

/* ---- DOWNLOAD TABLE ---- */
.dl-table {
  width: 100%;
  border-collapse: collapse;
}

.dl-table th {
  background: rgba(74,158,255,0.1);
  color: var(--accent);
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-bright);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dl-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.dl-table tr:hover td { background: rgba(74,158,255,0.04); }

.dl-table .file-type {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
}

.type-pdf  { background: rgba(255,77,77,0.15); color: #ff6b6b; border: 1px solid #ff4d4d44; }
.type-zip  { background: rgba(255,183,77,0.15); color: var(--amber); border: 1px solid #ffb74d44; }
.type-asm  { background: rgba(74,158,255,0.15); color: var(--accent); border: 1px solid #4a9eff44; }
.type-txt  { background: rgba(0,212,170,0.12); color: var(--accent2); border: 1px solid #00d4aa44; }
.type-exe  { background: rgba(255,183,77,0.12); color: var(--amber); border: 1px solid #ffb74d44; }
.type-hex  { background: rgba(200,100,255,0.12); color: #c792ea; border: 1px solid #c792ea44; }

/* ---- STATUS BAR / BREADCRUMB ---- */
.breadcrumb {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1.5rem;
}

.breadcrumb-inner {
  max-width: 1200px;
  margin: 0 auto;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border-bright); }
.breadcrumb .current { color: var(--accent2); }

/* ---- FOOTER ---- */
.site-footer {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.5rem;
  margin-top: 4rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
}

.footer-about p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.footer-col h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.footer-col a {
  display: block;
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 0.2rem 0;
  transition: color 0.15s;
}

.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'Share Tech Mono', monospace;
}

/* ---- NOTICES ---- */
.notice {
  border-left: 3px solid;
  padding: 0.9rem 1.2rem;
  border-radius: 0 4px 4px 0;
  margin-bottom: 1.2rem;
  font-size: 0.9rem;
}

.notice-info    { border-color: var(--accent);  background: rgba(74,158,255,0.07); }
.notice-warn    { border-color: var(--amber);   background: rgba(255,183,77,0.07); color: var(--amber); }
.notice-success { border-color: var(--accent2); background: rgba(0,212,170,0.07); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .page-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-chip { display: none; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 2.2rem; }
}

@media (max-width: 680px) {
  .main-nav { display: none; }
  .main-nav.open { display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg-panel); border-bottom: 1px solid var(--border); z-index: 200; }
  .main-nav.open a { height: 44px; border-bottom: 1px solid var(--border); }
  .nav-toggle { display: block; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 0.5rem; text-align: center; }
  h1 { font-size: 1.9rem; }
}

/* ---- UTILITY ---- */
.text-center { text-align: center; }
.text-mono   { font-family: 'Share Tech Mono', monospace; }
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-amber  { color: var(--amber); }
.text-green  { color: var(--green-crt); }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.gap-grid { display: grid; gap: 1.5rem; }
.two-col { grid-template-columns: 1fr 1fr; }
.three-col { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 680px) {
  .two-col, .three-col { grid-template-columns: 1fr; }
}
