/**
 * Innet Seal — shared tile for soft gate + local QR
 * Canon: docs/BRAND-BOOK.md §3a
 */

:root {
  --seal-qr-bg: #fcfaf5;
}

html[data-theme="dim"],
html[data-theme="dark"] {
  --seal-qr-bg: #fcfaf5;
}

.innet-seal {
  --seal-radius: 0.85rem;
  --seal-pad: 0.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  padding: var(--seal-pad);
  max-width: 22rem;
  background: var(--surface, #fcfaf5);
  border: 1px solid var(--border-subtle, #d0c8bc);
  border-radius: var(--seal-radius);
  box-shadow: none;
}

.innet-seal__caption {
  margin: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted, #5c574f);
}

.innet-seal--qr {
  align-items: center;
  text-align: center;
  padding: 0.35rem;
  max-width: none;
}

.innet-seal--qr .innet-seal__canvas,
.innet-seal--qr canvas.innet-seal__canvas {
  display: none;
}

.innet-seal--qr .innet-seal__picture,
.qr-tile .qr-wrap img.innet-seal__picture {
  display: block;
  width: 12.5rem;
  max-width: 100%;
  height: auto;
  background: var(--seal-qr-bg, var(--surface, #fcfaf5));
  border-radius: 0;
}

/* Dense purpose tile: QR | kind + why + actions */
.qr-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem 0.75rem;
  width: 100%;
  max-width: 100%;
  margin: 0.45rem 0 0;
  padding: 0.4rem 0.65rem 0.4rem 0.4rem;
  box-sizing: border-box;
  background: var(--surface, #fcfaf5);
  border: 1px solid var(--border-subtle, #d0c8bc);
  border-radius: 0.85rem;
}

.qr-tile[hidden] {
  display: none !important;
}

.qr-tile .qr-wrap,
.qr-tile .qr-wrap.innet-seal,
.qr-tile .qr-wrap.innet-seal--qr,
.qr-wrap.qr-wrap--fit {
  margin: 0;
  padding: 0.2rem;
  width: auto;
  max-width: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  gap: 0;
}

.qr-tile .qr-wrap canvas,
.qr-wrap--fit canvas {
  display: block;
}

.qr-tile .qr-wrap canvas.innet-seal__canvas,
.qr-wrap--fit canvas.innet-seal__canvas,
.innet-seal--qr canvas.innet-seal__canvas {
  display: none;
}

.qr-tile__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  min-width: 0;
}

.qr-tile__kind {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.2;
  color: var(--text, #2a2a2a);
}

.qr-tile__why {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--text-muted, #5c574f);
}

.qr-tile__role {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text, #2a2a2a);
}

.qr-tile__site {
  margin: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--text-muted, #5c574f);
}

.qr-tile__note {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--text-muted, #5c574f);
}

.qr-tile__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.qr-tile__actions .btn {
  min-height: 2.75rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.8125rem;
}

.qr-tile.is-qr-error .qr-tile__why {
  color: var(--text, #2a2a2a);
}

/* Legacy wraps adopt Seal look — keep tight */
.qr-wrap.innet-seal--qr,
.qr-wrap {
  background: var(--surface, #fcfaf5);
  border: 1px solid var(--border-subtle, #d0c8bc);
  border-radius: var(--seal-radius, 0.85rem);
  padding: 0.4rem;
}

.qr-wrap figcaption,
.innet-seal--qr figcaption {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted, #5c574f);
}

@media (max-width: 420px) {
  .qr-tile {
    grid-template-columns: 1fr;
    justify-items: start;
    padding: 0.45rem;
  }
}

html[dir="rtl"] .qr-tile {
  padding: 0.4rem 0.4rem 0.4rem 0.65rem;
}

html[dir="rtl"] .qr-tile__meta {
  align-items: flex-end;
}

html[dir="rtl"] .qr-tile__actions {
  justify-content: flex-end;
}

/* Gate mode */
.innet-seal--gate,
.gate-block.innet-seal--gate {
  max-width: 28rem;
}

/* Privacy toolbar keeps editorial grid; Seal only for tone + honey */
.privacy-schema__toolbar.innet-seal {
  display: grid;
  max-width: none;
  width: 100%;
  padding: 0.5rem 0 0;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-subtle, #d0c8bc);
  border-radius: 0;
  box-shadow: none;
}

.gate-block {
  /* alias: keep layout if seal.css loads after styles */
}

.innet-seal__consent,
.gate-block__label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--text, #2a2a2a);
  cursor: pointer;
}

.innet-seal__consent input,
.gate-block__label input {
  margin-top: 0.2rem;
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent, #7a665e);
  flex-shrink: 0;
}

.innet-seal__cta,
.innet-seal--gate .btn,
.gate-block .btn {
  align-self: stretch;
  min-height: 2.5rem;
  justify-content: center;
}

/* Honeypot — off-screen, not display:none (bots fill it) */
.innet-seal__honey {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (max-width: 767px) {
  .innet-seal {
    max-width: none;
    width: 100%;
  }

  .innet-seal__cta,
  .innet-seal--gate .btn,
  .gate-block .btn {
    min-height: 2.5rem;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .innet-seal {
    background: var(--surface, #fcfaf5);
  }
}

.innet-seal:focus-within {
  outline: 2px solid var(--focus, var(--accent, #7a665e));
  outline-offset: 2px;
}

.innet-seal--stir {
  max-width: none;
  width: 100%;
}

.innet-seal--form {
  max-width: 36rem;
}

.form-seal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.1rem;
  align-items: center;
  margin-top: 0.75rem;
}

.innet-seal--form .stir-pad {
  width: 12.5rem;
  height: 12.5rem;
  min-width: 12.5rem;
  min-height: 12.5rem;
  aspect-ratio: 1;
  flex: 0 0 12.5rem;
  cursor: pointer;
  background: var(--surface, #fcfaf5);
}

.form-mark {
  position: absolute;
  inset: 18%;
  width: auto;
  height: auto;
  overflow: visible;
  pointer-events: none;
}

.form-mark__wave {
  fill: none;
  stroke: #0b1f3a;
  stroke-width: 14;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  opacity: 0.4;
  transition: stroke-dashoffset 0.32s ease-out, opacity 0.32s ease-out;
}

html[data-theme="dark"] .form-mark__wave,
html[data-theme="dim"] .form-mark__wave {
  stroke: #f5f5f0;
}

.form-mark__node {
  opacity: 0;
  transition: opacity 0.28s ease-out;
}

.form-mark__lime {
  fill: #c5f000;
  stroke: none;
}

.form-mark__pupil {
  fill: #0b1f3a;
}

.form-mark__glint {
  fill: #ffffff;
  opacity: 0.85;
}

.stir-pad[data-form-stage="1"] .form-mark__wave {
  stroke-dashoffset: 92;
  opacity: 0.45;
}

.stir-pad[data-form-stage="2"] .form-mark__wave {
  stroke-dashoffset: 75;
  opacity: 1;
}

.stir-pad[data-form-stage="3"] .form-mark__wave {
  stroke-dashoffset: 50;
  opacity: 1;
}

.stir-pad[data-form-stage="4"] .form-mark__wave {
  stroke-dashoffset: 22;
  opacity: 1;
}

.stir-pad[data-form-stage="5"] .form-mark__wave {
  stroke-dashoffset: 0;
  opacity: 1;
}

.stir-pad[data-form-stage="5"] .form-mark__node {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .form-mark__wave,
  .form-mark__node {
    transition: none;
  }
}

.form-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1 1 12rem;
  min-width: 0;
}

.form-chip {
  margin: 0;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-subtle, #d0c8bc);
  border-radius: 999px;
  background: var(--surface, #fcfaf5);
  color: var(--text-muted, #5c574f);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.form-chip.is-in {
  color: var(--text, #2a2a2a);
  border-color: var(--border, #b8b0a4);
}

.stir-pad:focus-visible {
  outline: 3px solid var(--accent, #7a665e);
  outline-offset: 2px;
}

.stir-lead {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.4;
  color: var(--text, #2a2a2a);
}

.stir-pad {
  position: relative;
  width: 100%;
  min-height: 12.5rem;
  aspect-ratio: 16 / 10;
  border-radius: calc(var(--seal-radius) - 0.35rem);
  border: 1px solid var(--border-subtle, #d0c8bc);
  background: var(--surface-muted, #f5f2ec);
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
}

.stir-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.stir-ring {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(
    var(--accent, #7a665e) calc(var(--stir, 0) * 1%),
    color-mix(in srgb, var(--border-subtle, #d0c8bc) 55%, transparent) 0
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  opacity: 0.85;
}

@media (max-width: 767px) {
  .stir-pad {
    min-height: 11rem;
  }
  .innet-seal--form .stir-pad {
    min-height: 12.5rem;
    margin-inline: auto;
  }
  .form-seal-row {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stir-pad {
    cursor: default;
  }
}
