/* ─────────────────────────────────────────────────────────
   disclosure.org.za  –  Stylesheet
   Clean · Light · Poppins · Production
   ───────────────────────────────────────────────────────── */

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #ffffff;
  --bg-alt:      #f7f8fa;
  --bg-card:     #ffffff;
  --text:        #111827;
  --text-muted:  #6b7280;
  --border:      #e5e7eb;
  --accent:      #2563eb;
  --accent-light:#dbeafe;
  --green:       #059669;
  --green-bg:    #d1fae5;
  --orange:      #d97706;
  --orange-bg:   #fef3c7;
  --red:         #dc2626;
  --red-bg:      #fee2e2;
  --gray:        #9ca3af;
  --gray-bg:     #f3f4f6;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg:   0 4px 12px rgba(0,0,0,.08);
  --transition:  .2s ease;
  --font:        'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:        'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --max-w:       1200px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: #1d4ed8; }

img { max-width: 100%; display: block; }

/* ── Layout ───────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Navigation ───────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -.02em;
}

.nav-links { display: flex; gap: 28px; }

.nav-links a {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); }

/* ── Hero ─────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 56px 24px 40px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: 10px;
  color: var(--text);
}

.hero p {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 28px;
  font-weight: 400;
}

/* ── Search ───────────────────────────────────────────── */
.search-box {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
}

.search-box svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .9rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-box input::placeholder { color: var(--gray); }

.search-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .7rem;
  font-family: var(--mono);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Stats Bar ────────────────────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  padding: 28px 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: box-shadow var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-lg); }

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
}

.stat-label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stat-value.green { color: var(--green); }
.stat-value.orange { color: var(--orange); }
.stat-value.red { color: var(--red); }
.stat-value.accent { color: var(--accent); }

/* ── Controls ─────────────────────────────────────────── */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.controls-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.controls-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-btn .count {
  font-size: .7rem;
  opacity: .7;
}

select.sort-select {
  padding: 6px 28px 6px 12px;
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

select.sort-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-icon svg { width: 16px; height: 16px; }

.result-count {
  font-size: .82rem;
  color: var(--text-muted);
  padding: 12px 0 4px;
}

/* ── Company Grid ─────────────────────────────────────── */
.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  padding: 16px 0 48px;
}

/* ── Company Card ─────────────────────────────────────── */
.company-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
  position: relative;
}

.company-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-name {
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  flex: 1;
  padding-right: 12px;
}

.card-ticker {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: .03em;
}

.card-sector {
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card-domains {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
}

.domain-tag {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  font-size: .78rem;
  font-weight: 700;
  border-radius: 8px;
  line-height: 1;
}

.grade-Yes { background: var(--green-bg); color: var(--green); }
.grade-No { background: var(--red-bg); color: var(--red); }

.card-status {
  font-size: .78rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-full .status-dot,
.status-partial .status-dot,
.status-manual .status-dot { background: var(--green); }
.status-full,
.status-partial,
.status-manual { color: var(--green); }

.status-headers-only .status-dot { background: var(--orange); }
.status-headers-only { color: var(--orange); }

.status-minimal .status-dot,
.status-none .status-dot { background: var(--red); }
.status-minimal,
.status-none { color: var(--red); }

.card-links {
  display: flex;
  gap: 8px;
}

.card-link {
  font-size: .75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}

.card-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.card-link.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.card-link.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

/* ── Detail Overlay ───────────────────────────────────── */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.detail-overlay.open { display: flex; }

.detail-panel {
  background: var(--bg);
  border-radius: 16px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  padding: 32px;
  position: relative;
}

.detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}

.detail-close:hover { color: var(--text); border-color: var(--text-muted); }

.detail-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
  padding-right: 48px;
}

.detail-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section h3 {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.detail-checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
}

.check-icon { width: 16px; text-align: center; flex-shrink: 0; }
.check-found .check-icon { color: var(--green); }
.check-missing .check-icon { color: var(--gray); }

.check-path {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--text);
  flex: 1;
}

.check-missing .check-path { color: var(--text-muted); }

.detail-headers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.header-tag {
  font-family: var(--mono);
  font-size: .7rem;
  background: var(--green-bg);
  color: var(--green);
  padding: 3px 8px;
  border-radius: 4px;
}

.header-tag.missing {
  background: var(--gray-bg);
  color: var(--gray);
}

.security-txt-content {
  font-family: var(--mono);
  font-size: .75rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.5;
}

/* ── Sector Filter Dropdown ───────────────────────────── */
.sector-dropdown {
  position: relative;
  display: inline-block;
}

.sector-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  min-width: 200px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
}

.sector-dropdown-menu.open { display: block; }

.sector-option {
  padding: 8px 12px;
  font-size: .82rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.sector-option:hover { background: var(--bg-alt); }
.sector-option.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }

/* ── Empty State ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--gray);
  margin-bottom: 16px;
}

.empty-state h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: .88rem;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* ── Footer ───────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
}

.footer p {
  font-size: .8rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--text-muted);
  font-weight: 500;
}

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

.footer-links {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 8px;
}

/* ── Back to Top ──────────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  border: none;
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover { background: #1d4ed8; }
.back-to-top svg { width: 18px; height: 18px; }

/* ── Tooltip ──────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  font-size: .7rem;
  font-weight: 500;
  background: var(--text);
  color: #fff;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  margin-bottom: 4px;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ── Manual Badge ─────────────────────────────────────── */
.manual-badge {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ── About Page ───────────────────────────────────────── */
.about-content {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.about-content h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.about-content h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 8px;
}

.about-content p {
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.7;
}

.about-content ul {
  list-style: none;
  padding: 0;
  margin-bottom: 16px;
}

.about-content li {
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
  color: var(--text-muted);
  font-size: .9rem;
}

.about-content li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ── Grade Legend ──────────────────────────────────────── */
.grade-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
}

.grade-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  color: var(--text-muted);
}

.grade-legend-item .grade-badge {
  width: 24px;
  height: 24px;
  font-size: .72rem;
}

/* ── Toast notification ───────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 500;
  opacity: 0;
  transition: all .3s ease;
  z-index: 300;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Grade Distribution Bar ───────────────────────────── */
.grade-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-alt);
  margin-top: 8px;
}

.grade-bar-segment { height: 100%; transition: width .5s ease; }
.grade-bar-segment.Yes { background: var(--green); }
.grade-bar-segment.No { background: var(--red); }

/* ── Print ────────────────────────────────────────────── */
@media print {
  .nav, .controls, .search-box, .back-to-top, .footer,
  .btn-icon, .detail-overlay, .toast { display: none !important; }
  .company-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  body { background: #fff; }
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .company-grid { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 40px 16px 28px; }
  .hero h1 { font-size: 1.35rem; }
  .controls { flex-direction: column; align-items: stretch; }
  .controls-left { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .controls-right { justify-content: space-between; }
  .nav-inner { padding: 0 16px; }
  .search-shortcut { display: none; }
  .detail-panel { padding: 24px; margin: 0; border-radius: 12px 12px 0 0; max-height: 90vh; }
}

@media (max-width: 480px) {
  .stats-bar { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.4rem; }
  .nav-links { gap: 16px; }
  .nav-links a { font-size: .8rem; }
}
