@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@400;700;900&family=IBM+Plex+Mono:wght@400;500;600&family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

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

:root {
  --bg:          #080c16;
  --bg2:         #0d1220;
  --surface:     #111827;
  --surface2:    #1a2235;
  --border:      rgba(245,158,11,0.15);
  --border-dim:  rgba(255,255,255,0.07);
  --gold:        #f59e0b;
  --gold-dim:    rgba(245,158,11,0.6);
  --gold-glow:   rgba(245,158,11,0.15);
  --green:       #10b981;
  --red:         #ef4444;
  --text:        #e2e8f0;
  --text-muted:  #64748b;
  --text-dim:    #94a3b8;
  --mono:        'IBM Plex Mono', 'Courier New', monospace;
  --serif:       'Noto Serif KR', Georgia, serif;
  --sans:        'Noto Sans KR', sans-serif;
  --radius:      8px;
  --transition:  0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Ticker tape ── */
.ticker-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
  overflow: hidden;
  white-space: nowrap;
}
.ticker-track {
  display: inline-flex;
  gap: 0;
  animation: ticker-scroll 30s linear infinite;
}
.ticker-bar:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 32px;
  font-family: var(--mono);
  font-size: 12px;
  border-right: 1px solid var(--border-dim);
}
.ticker-name { color: var(--text-dim); font-weight: 500; }
.ticker-price { color: var(--text); font-weight: 600; }
.ticker-change.up   { color: var(--green); }
.ticker-change.down { color: var(--red); }
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Header ── */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border-dim);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner { max-width: 1280px; margin: 0 auto; height: 58px; display: flex; align-items: center; gap: 20px; }

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.logo-icon {
  width: 32px; height: 32px;
  background: var(--gold);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--bg); font-size: 15px; font-weight: 900;
  font-family: var(--mono);
}
.logo-text { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; }
.logo-text span { color: var(--gold); }

.search-form { display: flex; flex: 1; max-width: 380px; gap: 0; position: relative; }
.search-input {
  flex: 1; padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border-dim);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 13px; font-family: var(--sans);
  color: var(--text); outline: none;
  transition: border-color var(--transition);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--gold-dim); }
.search-btn {
  padding: 8px 16px;
  background: var(--gold); color: var(--bg);
  border: none; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px; font-weight: 700; font-family: var(--sans);
  cursor: pointer; transition: background var(--transition);
}
.search-btn:hover { background: #d97706; }

.header-nav { display: flex; gap: 12px; margin-left: auto; align-items: center; }
.header-nav a { text-decoration: none; color: var(--text-muted); font-size: 13px; transition: color var(--transition); }
.header-nav a:hover { color: var(--gold); }
.back-link {
  padding: 5px 12px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  color: var(--text-dim) !important;
}
.back-link:hover { border-color: var(--border) !important; }

/* ── Main ── */
.main-content { min-height: calc(100vh - 120px); }

/* ── Hero ── */
.hero {
  position: relative;
  background: var(--bg);
  padding: 80px 2rem 88px;
  text-align: center;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 50% 0%, rgba(245,158,11,0.08) 0%, transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(255,255,255,0.02) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(255,255,255,0.02) 40px);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 600px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}
.hero-inner { position: relative; max-width: 640px; margin: 0 auto; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(245,158,11,0.08);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  color: var(--gold); letter-spacing: 1.5px; text-transform: uppercase;
  margin-bottom: 24px;
  font-family: var(--mono);
}
.hero-eyebrow::before { content: '●'; font-size: 8px; animation: pulse-dot 2s infinite; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 18px;
  color: #fff;
  letter-spacing: -0.5px;
}
.hero h1 em { color: var(--gold); font-style: normal; }
.hero-sub {
  font-size: 15px; color: var(--text-muted);
  line-height: 1.8; margin-bottom: 36px;
  font-weight: 400;
}

.hero-search {
  display: flex; gap: 0;
  max-width: 480px; margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.hero-search:focus-within {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.hero-search input {
  flex: 1; padding: 14px 20px;
  background: transparent;
  border: none; outline: none;
  font-size: 15px; font-family: var(--sans);
  color: var(--text);
}
.hero-search input::placeholder { color: var(--text-muted); }
.hero-search button {
  padding: 14px 24px;
  background: var(--gold); color: var(--bg);
  border: none; font-size: 15px; font-weight: 700;
  font-family: var(--sans);
  cursor: pointer; transition: background var(--transition);
  white-space: nowrap;
}
.hero-search button:hover { background: #d97706; }

/* ── Sections ── */
.section-inner { max-width: 1280px; margin: 0 auto; padding: 0 2rem; }
.section-title {
  font-family: var(--serif);
  font-size: 20px; font-weight: 700;
  margin-bottom: 18px; color: var(--text);
}
.section-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.section-title-row .section-title { margin-bottom: 0; }
.section-divider { flex: 1; height: 1px; background: var(--border-dim); }

/* ── Market filter buttons ── */
.home-markets { padding: 28px 0 0; }
.market-btns { display: flex; gap: 8px; }
.market-btn {
  padding: 6px 16px;
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  text-decoration: none; color: var(--text-muted);
  font-size: 12px; font-weight: 700;
  font-family: var(--mono);
  background: transparent;
  transition: all var(--transition);
  letter-spacing: 0.5px;
}
.market-btn.active,
.market-btn:hover {
  background: var(--gold-glow);
  color: var(--gold);
  border-color: var(--border);
}

/* ── Company grid (홈) ── */
.home-section { padding: 36px 0; }
.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1px;
  background: var(--border-dim);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
.company-card {
  background: var(--surface);
  padding: 22px 20px;
  text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; gap: 6px;
  transition: background var(--transition);
  position: relative;
}
.company-card::after {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 2px; height: 0;
  background: var(--gold);
  transition: height var(--transition);
}
.company-card:hover { background: var(--surface2); }
.company-card:hover::after { height: 100%; }
.card-market {
  font-size: 10px; font-weight: 700;
  color: var(--gold); font-family: var(--mono);
  letter-spacing: 1px;
}
.card-name { font-size: 15px; font-weight: 700; color: #fff; }
.card-code { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }
.card-sector { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.card-arrow { margin-top: auto; font-size: 12px; color: var(--text-muted); padding-top: 12px; }
.company-card:hover .card-arrow { color: var(--gold); }

.view-all-wrap { text-align: center; padding-top: 8px; }
.view-all-btn {
  display: inline-block; padding: 10px 28px;
  border: 1px solid var(--border);
  color: var(--gold); border-radius: var(--radius);
  text-decoration: none; font-weight: 700; font-size: 13px;
  font-family: var(--mono);
  transition: all var(--transition);
  letter-spacing: 0.5px;
}
.view-all-btn:hover {
  background: var(--gold-glow);
  box-shadow: 0 0 20px var(--gold-glow);
}

/* ── Features ── */
.home-features { padding: 36px 0 72px; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.feature-card {
  padding: 28px 24px;
  background: var(--surface);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  transition: border-color var(--transition), background var(--transition);
}
.feature-card:hover {
  border-color: var(--border);
  background: var(--surface2);
}
.feature-icon { font-size: 26px; margin-bottom: 14px; }
.feature-card h3 {
  font-size: 15px; font-weight: 700;
  margin-bottom: 8px; color: #fff;
}
.feature-card p { font-size: 13px; color: var(--text-muted); line-height: 1.7; }

/* ── Company List Page ── */
.page-header { max-width: 1280px; margin: 0 auto; padding: 36px 2rem 20px; }
.page-header h1 {
  font-family: var(--serif);
  font-size: 26px; font-weight: 700;
  margin-bottom: 6px; color: #fff;
}
.page-header p { color: var(--text-muted); font-size: 14px; }
.page-header p strong { color: var(--gold); font-family: var(--mono); }

.filter-bar { max-width: 1280px; margin: 0 auto; padding: 0 2rem 24px; display: flex; gap: 8px; }
.filter-btn {
  padding: 6px 16px;
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  text-decoration: none; color: var(--text-muted);
  font-size: 12px; font-weight: 700; font-family: var(--mono);
  background: transparent; transition: all var(--transition); letter-spacing: 0.5px;
}
.filter-btn.active, .filter-btn:hover {
  background: var(--gold-glow); color: var(--gold); border-color: var(--border);
}

.company-table-wrap { max-width: 1280px; margin: 0 auto; padding: 0 2rem; overflow-x: auto; }
.company-table {
  width: 100%; border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius); overflow: hidden;
}
.company-table th {
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 11px; font-weight: 700;
  padding: 12px 18px; text-align: left;
  font-family: var(--mono); letter-spacing: 0.5px; text-transform: uppercase;
  border-bottom: 1px solid var(--border-dim);
}
.company-table td {
  padding: 14px 18px; font-size: 14px;
  border-bottom: 1px solid var(--border-dim);
}
.company-table tr:last-child td { border-bottom: none; }
.company-table tbody tr { cursor: pointer; transition: background var(--transition); }
.company-table tbody tr:hover td { background: var(--surface2); }
.company-table td strong { color: #fff; font-weight: 700; }
.company-table td:nth-child(2),
.company-table td:nth-child(6) { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }

.badge-market {
  display: inline-block; padding: 2px 8px;
  background: var(--gold-glow); color: var(--gold);
  border: 1px solid var(--border);
  border-radius: 3px; font-size: 11px; font-weight: 700;
  font-family: var(--mono); letter-spacing: 0.5px;
}

.pagination { display: flex; gap: 6px; justify-content: center; padding: 32px 2rem; }
.page-btn {
  padding: 7px 13px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  text-decoration: none; color: var(--text-muted);
  font-size: 13px; font-family: var(--mono);
  background: var(--surface); transition: all var(--transition);
}
.page-btn.active, .page-btn:hover {
  background: var(--gold-glow); color: var(--gold); border-color: var(--border);
}

.empty-state { text-align: center; padding: 80px 2rem; color: var(--text-muted); }
.empty-state a { color: var(--gold); text-decoration: none; }
.loading { text-align: center; padding: 60px; color: var(--text-muted); font-family: var(--mono); font-size: 13px; }

/* ── Company Detail ── */
.company-detail { max-width: 1080px; margin: 0 auto; padding: 36px 2rem 80px; }

.detail-header { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border-dim); }
.detail-title-wrap { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.detail-market-badge {
  padding: 4px 10px;
  background: var(--gold-glow); color: var(--gold);
  border: 1px solid var(--border);
  border-radius: 4px; font-size: 11px; font-weight: 700;
  font-family: var(--mono); letter-spacing: 1px;
}
.detail-title-wrap h1 {
  font-family: var(--serif);
  font-size: 32px; font-weight: 900; color: #fff;
}
.detail-code { font-size: 16px; color: var(--text-muted); font-family: var(--mono); }
.detail-meta {
  display: flex; gap: 20px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-muted);
}
.detail-meta span::before { content: ''; }
.detail-meta a { color: var(--gold); text-decoration: none; }
.detail-meta a:hover { text-decoration: underline; }

.detail-desc {
  background: var(--surface);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 22px;
  margin-bottom: 28px;
  font-size: 14px; line-height: 1.85; color: var(--text-dim);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px; margin-bottom: 36px;
}
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition);
}
.detail-card:hover { border-color: var(--border); }
.detail-card.full-width { grid-column: 1 / -1; }
.detail-card h3 {
  font-size: 13px; font-weight: 700;
  margin-bottom: 16px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.8px;
  font-family: var(--mono);
}

.fin-table { width: 100%; border-collapse: collapse; }
.fin-table tr { border-bottom: 1px solid var(--border-dim); }
.fin-table tr:last-child { border-bottom: none; }
.fin-table td { padding: 9px 0; font-size: 13px; }
.fin-table td:first-child { color: var(--text-muted); width: 45%; }
.fin-table td:last-child {
  font-weight: 600; text-align: right;
  font-family: var(--mono); color: var(--text);
}
.fin-table tr:hover td:last-child { color: var(--gold); }

.data-source { margin-top: 14px; font-size: 11px; color: var(--text-muted); font-family: var(--mono); }

.ai-report p { font-size: 14px; line-height: 1.9; color: var(--text-dim); }
.ai-meta { margin-top: 14px; font-size: 11px; color: var(--text-muted); font-family: var(--mono); }

/* ── News ── */
.detail-news { margin-bottom: 28px; }
.detail-news h3 {
  font-size: 13px; font-weight: 700;
  margin-bottom: 14px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.8px;
  font-family: var(--mono);
}
.news-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.news-item {
  background: var(--surface);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: border-color var(--transition), background var(--transition);
}
.news-item:hover { background: var(--surface2); border-color: var(--border); }
.news-category {
  display: inline-block; padding: 2px 8px;
  background: var(--gold-glow); color: var(--gold);
  border: 1px solid var(--border);
  border-radius: 3px; font-size: 10px; font-weight: 700;
  font-family: var(--mono); letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.news-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: #fff; }
.news-summary { font-size: 13px; color: var(--text-muted); line-height: 1.65; margin-bottom: 8px; }
.news-meta { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }

.back-nav { max-width: 1080px; margin: 0 auto; padding: 0 2rem 40px; }
.back-nav a {
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 600; font-family: var(--mono);
  transition: color var(--transition);
}
.back-nav a:hover { color: var(--gold); }

/* ── Footer ── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border-dim);
  text-align: center; padding: 28px 2rem;
  font-size: 12px; color: var(--text-muted);
  font-family: var(--mono);
}
.site-footer a { color: var(--gold); text-decoration: none; }
.footer-sub { margin-top: 6px; font-size: 11px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .search-form { display: none; }
  .header-nav .back-link { display: none; }
  .hero { padding: 60px 1.5rem 72px; }
  .hero-search { flex-direction: column; gap: 8px; border-radius: var(--radius); }
  .hero-search button { border-radius: var(--radius); text-align: center; }
  .ticker-bar { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ── Utility ── */
.up   { color: var(--green) !important; }
.down { color: var(--red)   !important; }
