/* ═══════════════════════════════════════════════════════════════════
   JITTER Security Seal — style.css
   ═══════════════════════════════════════════════════════════════════ */

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

:root {
  --navy:       #0F172A;
  --navy-mid:   #1E293B;
  --navy-lt:    #334155;
  --slate:      #64748B;
  --slate-lt:   #94A3B8;
  --border:     #E2E8F0;
  --surface:    #F8FAFC;
  --white:      #FFFFFF;
  --cyan:       #06B6D4;
  --cyan-dim:   rgba(6, 182, 212, 0.10);
  --cyan-glow:  rgba(6, 182, 212, 0.22);
  --green:      #10B981;
  --red:        #EF4444;
  --font:       'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:       'JetBrains Mono', 'Fira Code', monospace;
  --r-card:     22px;
  --r-sm:       10px;
  --shadow:     0 20px 60px rgba(15,23,42,0.07), 0 6px 20px rgba(15,23,42,0.05), 0 1px 4px rgba(15,23,42,0.04);
  --shadow-xl:  0 32px 80px rgba(15,23,42,0.11), 0 10px 30px rgba(15,23,42,0.07);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: #EDF2FB;
  background-image:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(6,182,212,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 100%, rgba(99,102,241,0.05) 0%, transparent 55%);
  background-attachment: fixed;
  color: var(--navy);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

/* Subtle dot grid overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(15,23,42,0.035) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
  z-index: 0;
}

main, header, footer { position: relative; z-index: 1; }
.hidden { display: none !important; }

/* ─── Header ─── */
header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(226,232,240,0.8);
}

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

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.logo-mark { width: 34px; height: 34px; flex-shrink: 0; }

.logo-name {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: var(--navy);
}

/* Status badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  color: var(--navy-lt);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  position: relative;
}

.pulse-dot::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: rgba(16,185,129,0.25);
  animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
  0%   { transform: scale(0.7); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ─── Main layout ─── */
main {
  flex: 1;
  padding: 64px 24px 88px;
}

.portal-container {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--slate);
  text-align: center;
  text-transform: uppercase;
}

/* ─── Portal Card ─── */
.portal-card {
  width: 100%;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,255,255,0.65);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: box-shadow 0.35s ease, border-color 0.35s ease;
  overflow: hidden;
  position: relative;
}

/* Protocol version tag */
.card-version {
  position: absolute;
  bottom: 14px;
  right: 18px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.09em;
  color: var(--slate-lt);
  opacity: 0.65;
  pointer-events: none;
  user-select: none;
  z-index: 10;
}

/* Top accent bar — rendered by pseudo-element on state classes */
.portal-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--r-card) var(--r-card) 0 0;
  background: linear-gradient(90deg, var(--cyan) 0%, #818CF8 100%);
  opacity: 0.6;
  transition: opacity 0.4s;
}

.portal-card.drag-active::before { opacity: 1; }
.portal-card.state-success::before { background: linear-gradient(90deg, var(--green), var(--cyan)); opacity: 1; }
.portal-card.state-failure::before { background: var(--red); opacity: 0.8; }

.portal-card.drag-active {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-glow), var(--shadow-xl);
}

.portal-card.state-success { border-color: rgba(16,185,129,0.3); box-shadow: var(--shadow-xl); }
.portal-card.state-failure { border-color: rgba(239,68,68,0.2);  box-shadow: var(--shadow); }

/* ─── Card State wrapper ─── */
.card-state {
  padding: 56px 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: fadeUp 0.45s cubic-bezier(0.16,1,0.3,1) forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════
   STATE: IDLE
══════════════════════════════════════ */
.portal-icon-wrap {
  width: 76px;
  height: 76px;
  background: linear-gradient(145deg, rgba(6,182,212,0.09), rgba(15,23,42,0.03));
  border: 1px solid rgba(6,182,212,0.2);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  box-shadow: 0 4px 16px rgba(6,182,212,0.1);
}

.portal-icon-wrap svg { width: 40px; height: 40px; }

h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 12px;
}

h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 15px;
  color: var(--slate);
  font-weight: 400;
  line-height: 1.75;
  margin-bottom: 32px;
}

/* Drop Zone */
.drop-zone {
  width: 100%;
  border: 2px dashed var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  margin-bottom: 18px;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
  position: relative;
  overflow: hidden;
}

.drop-zone:hover,
.drag-active .drop-zone {
  border-color: var(--cyan);
  background: var(--cyan-dim);
  box-shadow: 0 0 0 4px var(--cyan-glow);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.drop-zone-inner {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 38px 24px 34px;
}

.drop-primary {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}

.drop-secondary {
  font-size: 13px;
  color: var(--slate);
}

.drop-link { color: var(--cyan); }

.file-note {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--slate-lt);
}

/* QR link */
.qr-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--slate-lt);
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font);
  padding: 0;
  transition: color 0.2s;
  margin-top: 2px;
}
.qr-link:hover { color: var(--cyan); }
.qr-link svg { flex-shrink: 0; }

/* ── .audit-active: drop icon morphs into spinner ── */
.drop-icon-slot {
  position: relative;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
}

.drop-icon {
  width: 44px;
  height: 44px;
  color: var(--slate-lt);
  transition: color 0.25s, transform 0.3s, opacity 0.3s;
}

.drop-zone:hover .drop-icon,
.drag-active .drop-icon { color: var(--cyan); transform: translateY(-3px); }

.drop-spinner {
  position: absolute;
  inset: 4px;
  border: 2px solid rgba(6,182,212,0.18);
  border-top-color: var(--cyan);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.55);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.audit-active .drop-icon {
  opacity: 0;
  transform: scale(0.45) !important;
}

.audit-active .drop-spinner {
  opacity: 1;
  transform: scale(1);
  animation: spin-cw 0.85s linear infinite;
}

.audit-active .drop-primary,
.audit-active .drop-secondary,
.audit-active .qr-link {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

/* ══════════════════════════════════════
   STATE: AUDITING
══════════════════════════════════════ */
.spinner-wrap { margin-bottom: 32px; }

.spinner-rings {
  position: relative;
  width: 128px;
  height: 128px;
}

.ring {
  position: absolute;
  border-radius: 50%;
  border-style: solid;
}

.ring-a {
  inset: 0;
  border-width: 1.5px;
  border-color: var(--cyan) rgba(6,182,212,0.4) rgba(6,182,212,0.15) transparent;
  animation: spin-cw 3.6s linear infinite;
}

.ring-b {
  inset: 20px;
  border-width: 1.5px;
  border-color: transparent transparent var(--navy-mid) rgba(30,41,59,0.35);
  animation: spin-ccw 2.2s linear infinite;
}

.ring-c {
  inset: 42px;
  border-width: 1.5px;
  border-color: var(--cyan) transparent transparent transparent;
  animation: spin-cw 1.1s linear infinite;
}

.spinner-core {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 34px; height: 34px;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(15,23,42,0.12);
}

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

/* Audit steps */
.audit-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  width: 100%;
  max-width: 360px;
  margin-top: 28px;
}

.audit-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: var(--slate-lt);
  transition: color 0.4s;
}

.audit-step.done { color: var(--navy); }

.audit-step svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   STATE: SUCCESS
══════════════════════════════════════ */
.success-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-bottom: 32px;
}

.check-wrap { width: 84px; height: 84px; }

.check-svg { width: 84px; height: 84px; }

.check-bg  { fill: rgba(16,185,129,0.08); }

.check-ring {
  fill: none;
  stroke: rgba(16,185,129,0.3);
  stroke-width: 1.5;
  stroke-dasharray: 251;
  stroke-dashoffset: 251;
  animation: draw-ring 0.7s ease forwards;
}

.check-mark {
  fill: none;
  stroke: var(--green);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 54;
  stroke-dashoffset: 54;
  animation: draw-check 0.45s ease forwards 0.6s;
}

@keyframes draw-ring  { to { stroke-dashoffset: 0; } }
@keyframes draw-check { to { stroke-dashoffset: 0; } }

/* Authenticity badge */
.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16,185,129,0.09);
  color: #059669;
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 100px;
  padding: 7px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* Certificate divider */
.cert-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}

.cert-divider::before,
.cert-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.cert-divider-label {
  padding: 0 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--slate-lt);
  white-space: nowrap;
}

/* Certificate fields */
.cert-fields {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
  margin-bottom: 32px;
}

.cert-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.cert-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cert-full { width: 100%; }

.cert-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--slate-lt);
  text-transform: uppercase;
}

.cert-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.4;
}

.cert-value.mono {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--cyan);
  letter-spacing: 0.02em;
}

.cert-value.hash {
  font-size: 11px;
  color: var(--navy-lt);
  word-break: break-all;
  line-height: 1.7;
  letter-spacing: 0.03em;
}

/* Certificate footer */
.cert-footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* JITTER seal */
.jitter-seal {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.seal-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.seal-name {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--navy);
  line-height: 1;
}

.seal-sub {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--slate);
  line-height: 1;
}

/* Reset button */
.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--r-sm);
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(15,23,42,0.25);
}

.btn-reset:hover  { background: #1E293B; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(15,23,42,0.3); }
.btn-reset:active { transform: translateY(0); }

.btn-reset-fail {
  margin-top: 24px;
  background: var(--navy);
}

/* Download Audit Receipt button */
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: var(--white);
  border: 1.5px solid transparent;
  border-radius: var(--r-sm);
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(15,23,42,0.25);
  width: 100%;
  justify-content: center;
  margin-top: 20px;
}

.btn-download:hover {
  background: rgba(15,23,42,0.0);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-glow);
  transform: translateY(-1px);
}

.btn-download:active { transform: translateY(0); }

/* ══════════════════════════════════════
   STATE: FAILURE
══════════════════════════════════════ */
.fail-icon-wrap {
  width: 84px;
  height: 84px;
  margin-bottom: 24px;
}

.fail-notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.18);
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 13px;
  color: #DC2626;
  margin: 8px 0 0;
  text-align: left;
  line-height: 1.55;
}

.fail-notice svg { flex-shrink: 0; margin-top: 1px; }

/* ══════════════════════════════════════
   STATE: BREACH
══════════════════════════════════════ */
.portal-card.state-breach {
  border-color: rgba(239,68,68,0.4);
}

.portal-card.state-breach::before {
  background: linear-gradient(90deg, #EF4444, #DC2626);
  opacity: 1;
  animation: breach-bar-flash 1.4s ease-in-out infinite alternate;
}

@keyframes breach-bar-flash {
  from { opacity: 0.65; }
  to   { opacity: 1; }
}

.breach-icon-wrap {
  width: 84px;
  height: 84px;
  margin-bottom: 20px;
  animation: breach-pulse 1.1s ease-in-out infinite alternate;
}

@keyframes breach-pulse {
  from { transform: scale(0.96); filter: drop-shadow(0 0 0px rgba(239,68,68,0)); }
  to   { transform: scale(1.04); filter: drop-shadow(0 0 10px rgba(239,68,68,0.35)); }
}

.breach-title {
  font-size: 18px;
  font-weight: 800;
  color: #DC2626;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.breach-notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: rgba(239,68,68,0.07);
  border: 1px solid rgba(239,68,68,0.22);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #DC2626;
  margin: 10px 0 24px;
  text-align: left;
  line-height: 1.6;
  max-width: 420px;
}

/* ─── Trust Grid ─── */
.trust-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--border);
  gap: 1px;
  box-shadow: 0 2px 12px rgba(15,23,42,0.05);
}

.trust-item {
  background: var(--white);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trust-idx {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.06em;
}

.trust-item h3 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--navy);
}

.trust-item p {
  font-size: 12.5px;
  color: var(--slate);
  line-height: 1.65;
}

/* ─── Footer ─── */
footer {
  padding: 22px 32px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  z-index: 1;
}

.footer-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

footer span {
  font-size: 11.5px;
  color: var(--slate-lt);
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .header-inner { padding: 0 20px; }
  .status-text { display: none; }

  main { padding: 40px 16px 64px; }

  .card-state { padding: 40px 28px; }

  h1 { font-size: 23px; }

  .br-break { display: none; }

  .cert-row { grid-template-columns: 1fr; gap: 16px; }

  .trust-grid { grid-template-columns: 1fr; }

  .cert-footer {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }

  .btn-reset { justify-content: center; }

  .footer-right { display: none; }
}

@media (max-width: 400px) {
  .card-state { padding: 32px 20px; }
  h1 { font-size: 20px; }
}
