/* TLSight — Government Report meets Apple Health */

:root {
  --bg: #fafaf8;
  --fg: #1c1917;
  --muted: #78716c;
  --border: #e7e5e4;
  --card: #ffffff;
  --accent: #292524;

  --grade-a: #059669;
  --grade-b: #0d9488;
  --grade-c: #d97706;
  --grade-d: #ea580c;
  --grade-f: #dc2626;

  --priority-high: #dc2626;
  --priority-medium: #d97706;
  --priority-low: #059669;
}

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

html {
  font-size: 16px;
}

body {
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, .display {
  font-family: "Sora", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.875rem;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

header {
  text-align: center;
  padding: 3rem 0 2.5rem;
}

header h1 {
  font-size: 2.25rem;
  font-weight: 700;
}

header .tagline {
  color: var(--muted);
  font-size: 1.125rem;
  margin-top: 0.25rem;
}

/* Input */
.scan-form {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  max-width: 560px;
  margin: 0 auto 2.5rem;
}

.scan-form input {
  flex: 1;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: "IBM Plex Sans", sans-serif;
  background: var(--card);
  color: var(--fg);
  outline: none;
  transition: border-color 0.15s ease;
}

.scan-form input:focus {
  border-color: var(--accent);
}

.scan-form button {
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--accent);
  color: #fff;
  font-family: "Sora", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.scan-form button:hover {
  background: #44403c;
}

.scan-form button:active {
  transform: translateY(1px);
}

/* AdSense */
.ad-section {
  max-width: 728px;
  margin: 0 auto 2.5rem;
  text-align: center;
}

.ad-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.5rem;
  opacity: 0.55;
}

.ad-wrap {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  min-height: 90px;
}

/* Results grid */
.results {
  display: none;
}

.results.active {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Grade card */
.grade-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  position: sticky;
  top: 1.5rem;
}

.grade-display {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 180px;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 0.5rem;
}

.grade-display.grade-A { color: var(--grade-a); }
.grade-display.grade-B { color: var(--grade-b); }
.grade-display.grade-C { color: var(--grade-c); }
.grade-display.grade-D { color: var(--grade-d); }
.grade-display.grade-F { color: var(--grade-f); }

.grade-label {
  font-family: "Sora", sans-serif;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.domain-name {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  color: var(--fg);
  word-break: break-all;
  margin-bottom: 0.25rem;
}

.scan-time {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.seal {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.seal svg {
  width: 18px;
  height: 18px;
}

.share-btn {
  margin-top: 1.25rem;
  width: 100%;
  padding: 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--fg);
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.share-btn:hover {
  background: var(--bg);
}

/* Report */
.report {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.panel {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
}

.panel h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel h2 .icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

/* Tables / lists */
.data-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

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

.data-row .key {
  color: var(--muted);
}

.data-row .value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  text-align: right;
  max-width: 60%;
  word-break: break-all;
}

/* Protocol checklist */
.checklist {
  list-style: none;
}

.checklist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.checklist li:last-child {
  border-bottom: none;
}

.checklist .status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.status.pass { color: var(--grade-a); }
.status.fail { color: var(--grade-f); }
.status.warn { color: var(--grade-c); }

/* Cipher list */
.cipher-list {
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
}

.cipher-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.cipher-list li:last-child {
  border-bottom: none;
}

.cipher-list .weak {
  color: var(--grade-f);
  font-weight: 600;
}

/* Fixes */
.fixes {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fix-item {
  border: 1.5px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  position: relative;
}

.fix-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 4px;
  border-radius: 0 2px 2px 0;
}

.fix-item.priority-critical::before { background: var(--priority-high); }
.fix-item.priority-high::before { background: var(--priority-high); }
.fix-item.priority-medium::before { background: var(--priority-medium); }
.fix-item.priority-low::before { background: var(--priority-low); }

.fix-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.fix-detail {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.fix-command {
  background: #f5f5f4;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.6rem 0.75rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-all;
  color: #44403c;
}

/* Loading */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: 1rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

/* Error */
.error-msg {
  text-align: center;
  padding: 2rem;
  color: var(--grade-f);
  font-weight: 600;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s ease;
}

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

/* Consent banner */
.consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--card);
  border-top: 1.5px solid var(--border);
  padding: 0.875rem 1.5rem;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.06);
}

.consent-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  text-align: center;
}

.consent-text {
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.5;
}

.consent-text p {
  margin: 0;
}

.consent-text a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

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

.consent-buttons {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.consent-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  font-family: "Sora", sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease, border-color 0.15s ease;
  border: 1.5px solid var(--border);
  white-space: nowrap;
}

.consent-btn:active {
  transform: translateY(1px);
}

.consent-accept {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.consent-accept:hover {
  background: #44403c;
  border-color: #44403c;
}

.consent-reject {
  background: transparent;
  color: var(--fg);
}

.consent-reject:hover {
  background: var(--bg);
}

/* Mobile */
@media (max-width: 860px) {
  .results.active {
    grid-template-columns: 1fr;
  }

  .grade-card {
    position: static;
    padding: 1.5rem;
  }

  .grade-display {
    font-size: 120px;
  }

  .scan-form {
    flex-direction: column;
  }

  .scan-form button {
    width: 100%;
  }

  .consent-inner {
    flex-direction: column;
    gap: 0.875rem;
  }

  .consent-text {
    font-size: 0.85rem;
  }

  .consent-buttons {
    width: 100%;
  }

  .consent-btn {
    flex: 1;
  }
}
