/*!
 * WaarningYou — styles for the on-device personalisation surfaces.
 *
 * Owner: agent A (frontend/assets/you.js + you.css).
 * Uses the site tokens from site.css (with parchment/ink/rust fallbacks) so it
 * can be loaded on any page without redefining the design language.
 * Nothing here gates content: an empty mount is simply empty.
 */

/* ------------------------------------------------------------------ *
 * Shared bits                                                        *
 * ------------------------------------------------------------------ */

.you-kicker {
  margin: 0 0 6px;
  font: 600 9px/1.4 var(--mono, "IBM Plex Mono", monospace);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--rust, #b7472a);
}

.you-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong, rgba(23, 35, 29, .38));
  border-radius: 8px;
  background: transparent;
  color: var(--ink, #17231d);
  font: 700 9.5px/1 var(--mono, "IBM Plex Mono", monospace);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.you-btn:hover {
  background: rgba(23, 35, 29, .06);
}

.you-btn:focus-visible,
.you-intro-close:focus-visible,
.you-privacy-keys summary:focus-visible {
  outline: 2px solid var(--rust, #b7472a);
  outline-offset: 2px;
}

.you-btn-primary {
  background: var(--ink, #17231d);
  border-color: var(--ink, #17231d);
  color: var(--paper-2, #f8f2e3);
}

.you-btn-primary:hover {
  background: var(--ink-2, #2b3a31);
  border-color: var(--ink-2, #2b3a31);
}

.you-btn-ghost {
  background: transparent;
  border-color: var(--line-strong, rgba(23, 35, 29, .38));
}

.you-btn-ghost:hover {
  background: rgba(23, 35, 29, .06);
}

.you-btn-quiet {
  border-color: transparent;
  color: var(--muted, #657064);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.you-btn-quiet:hover {
  color: var(--rust, #b7472a);
  background: transparent;
}

.you-btn-danger {
  background: var(--rust, #b7472a);
  border-color: var(--rust, #b7472a);
  color: #fff8ec;
}

.you-btn-danger:hover {
  background: var(--rust-dark, #8e321d);
  border-color: var(--rust-dark, #8e321d);
}

.you-btn[disabled] {
  opacity: .55;
  cursor: progress;
}

.you-status {
  min-height: 1.2em;
  margin: 8px 0 0;
  font: 500 10px/1.45 var(--mono, "IBM Plex Mono", monospace);
  letter-spacing: .02em;
  color: var(--muted, #657064);
}

.you-status.is-error {
  color: var(--rust, #b7472a);
}

.you-note {
  margin: 8px 0 0;
  font: 500 9px/1.45 var(--mono, "IBM Plex Mono", monospace);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--soft, #8b9182);
}

.you-pin {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--rust, #b7472a);
}

/* ------------------------------------------------------------------ *
 * Mount: saved place                                                 *
 * ------------------------------------------------------------------ */

/* Mounts keep the host's own layout; they only need to be allowed to shrink. */
[data-you-place],
[data-you-privacy],
[data-you-first-visit] {
  min-width: 0;
}

[data-you-first-visit][hidden] {
  display: none !important;
}

.you-place {
  display: block;
  min-width: 0;
}

.you-place-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.you-place-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 100%;
  padding: 8px 11px;
  background: var(--paper-2, #f8f2e3);
  border: 1px solid var(--line, rgba(23, 35, 29, .18));
  border-left: 3px solid var(--rust, #b7472a);
  border-radius: 10px;
}

.you-place-body {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.you-place-name {
  display: block;
  font: 600 14px/1.25 var(--display, "Bricolage Grotesque", sans-serif);
  letter-spacing: -.01em;
  color: var(--ink, #17231d);
}

.you-place-detail {
  display: block;
  margin-top: 1px;
  font: 500 8.5px/1.4 var(--mono, "IBM Plex Mono", monospace);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted, #657064);
  overflow-wrap: anywhere;
}

.you-place-none {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted, #657064);
}

.you-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.you-place.is-empty .you-actions {
  margin-bottom: 2px;
}

/* ------------------------------------------------------------------ *
 * Mount: first-visit sheet                                           *
 * ------------------------------------------------------------------ */

.you-intro {
  position: fixed;
  z-index: 90;
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  width: min(392px, calc(100vw - 36px));
  max-height: 78vh;
  max-height: 78svh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 18px 15px;
  background: var(--paper-2, #f8f2e3);
  color: var(--ink, #17231d);
  border: 1px solid var(--line-strong, rgba(23, 35, 29, .38));
  border-radius: 15px;
  box-shadow: 0 22px 60px rgba(49, 38, 20, .24), 0 1px 0 rgba(255, 255, 255, .7) inset;
  animation: you-rise .24s ease-out both;
  scrollbar-width: thin;
}

@keyframes you-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.you-intro:focus {
  outline: none;
}

.you-intro-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #657064);
  font: 400 21px/1 var(--sans, "Manrope", system-ui, sans-serif);
  cursor: pointer;
}

.you-intro-close:hover {
  background: rgba(23, 35, 29, .07);
  color: var(--ink, #17231d);
}

.you-intro-title {
  margin: 0 30px 8px 0;
  font: 600 23px/1.06 var(--display, "Bricolage Grotesque", sans-serif);
  letter-spacing: -.04em;
  color: var(--ink, #17231d);
}

.you-intro-lede {
  margin: 0 0 12px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-2, #2b3a31);
}

.you-intro-list {
  margin: 0 0 14px;
  padding: 12px 0 0;
  list-style: none;
  border-top: 1px solid var(--line, rgba(23, 35, 29, .18));
  counter-reset: you-step;
}

.you-intro-list li {
  position: relative;
  margin: 0 0 9px;
  padding-left: 24px;
}

.you-intro-list li:last-child {
  margin-bottom: 0;
}

.you-intro-list li::before {
  counter-increment: you-step;
  content: counter(you-step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 2px;
  font: 700 8px/1.4 var(--mono, "IBM Plex Mono", monospace);
  letter-spacing: .04em;
  color: var(--rust, #b7472a);
}

.you-intro-list b {
  display: block;
  font: 700 9px/1.4 var(--mono, "IBM Plex Mono", monospace);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink, #17231d);
}

.you-intro-list span {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted, #657064);
}

.you-intro-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.you-intro-actions .you-btn {
  flex: 1 1 140px;
  min-width: 0;
}

.you-intro-status {
  margin: 0 0 2px;
  font: 500 10px/1.5 var(--mono, "IBM Plex Mono", monospace);
  color: var(--muted, #657064);
}

.you-intro-status:empty {
  display: none;
}

.you-intro-status.is-error {
  color: var(--rust, #b7472a);
}

.you-intro-note {
  margin: 10px 0 0;
  padding-top: 9px;
  border-top: 1px dotted var(--line, rgba(23, 35, 29, .18));
  font: 500 9px/1.5 var(--mono, "IBM Plex Mono", monospace);
  letter-spacing: .03em;
  color: var(--muted, #657064);
}

.you-intro-note a {
  color: var(--rust, #b7472a);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.you-intro-note a:hover {
  color: var(--rust-dark, #8e321d);
}

/* ------------------------------------------------------------------ *
 * Mount: privacy panel                                               *
 * ------------------------------------------------------------------ */

.you-privacy {
  padding: 18px 19px 16px;
  background: var(--paper-2, #f8f2e3);
  border: 1px solid var(--line, rgba(23, 35, 29, .18));
  border-radius: 14px;
  min-width: 0;
}

.you-privacy-title {
  margin: 0 0 6px;
  font: 600 24px/1.05 var(--display, "Bricolage Grotesque", sans-serif);
  letter-spacing: -.04em;
  color: var(--ink, #17231d);
}

.you-privacy-lede {
  margin: 0 0 12px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted, #657064);
  max-width: 60ch;
}

.you-privacy-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line, rgba(23, 35, 29, .18));
}

.you-privacy-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px dotted var(--line, rgba(23, 35, 29, .18));
}

.you-privacy-term {
  margin: 0;
  font: 700 8px/1.5 var(--mono, "IBM Plex Mono", monospace);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted, #657064);
}

.you-privacy-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-2, #2b3a31);
  overflow-wrap: anywhere;
}

.you-privacy-desc b {
  font-weight: 700;
}

.you-privacy-meta {
  display: block;
  margin-top: 2px;
  font: 500 8.5px/1.5 var(--mono, "IBM Plex Mono", monospace);
  letter-spacing: .03em;
  color: var(--soft, #8b9182);
  overflow-wrap: anywhere;
}

.you-privacy-keys {
  margin: 12px 0 0;
  border-top: 1px solid var(--line, rgba(23, 35, 29, .18));
}

.you-privacy-keys summary {
  padding: 9px 0;
  cursor: pointer;
  font: 700 8px/1.4 var(--mono, "IBM Plex Mono", monospace);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--teal, #2f6f68);
}

.you-privacy-keys ul {
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
}

.you-privacy-keys li {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  padding: 4px 0;
  border-bottom: 1px dotted var(--line, rgba(23, 35, 29, .18));
  font: 500 9px/1.5 var(--mono, "IBM Plex Mono", monospace);
  color: var(--soft, #8b9182);
}

.you-privacy-keys code {
  font: 500 9px/1.5 var(--mono, "IBM Plex Mono", monospace);
  color: var(--ink-2, #2b3a31);
  overflow-wrap: anywhere;
}

.you-privacy-keys span {
  margin-left: auto;
  text-align: right;
}

.you-privacy-storage {
  margin: 12px 0 0;
  font: 500 9px/1.5 var(--mono, "IBM Plex Mono", monospace);
  letter-spacing: .03em;
  color: var(--muted, #657064);
}

.you-privacy-actions {
  margin-top: 12px;
}

.you-privacy-actions .you-btn-danger {
  flex: 1 1 auto;
}

/* ------------------------------------------------------------------ *
 * Narrow screens (390 px is the reference)                           *
 * ------------------------------------------------------------------ */

@media (max-width: 620px) {
  .you-intro {
    left: max(10px, env(safe-area-inset-left, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: 84vh;
    max-height: 84svh;
    padding: 16px 15px 13px;
    border-radius: 14px;
  }

  .you-intro-title {
    font-size: 21px;
    margin-right: 34px;
  }

  .you-intro-actions .you-btn {
    flex: 1 1 100%;
  }

  .you-place-row {
    align-items: stretch;
  }

  .you-place-chip {
    flex: 1 1 100%;
  }

  .you-place-row .you-actions {
    width: 100%;
    justify-content: space-between;
  }

  .you-place-row .you-actions .you-btn {
    flex: 0 1 auto;
  }

  .you-privacy {
    padding: 15px 14px 13px;
  }

  .you-privacy-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 7px 0;
  }

  .you-privacy-title {
    font-size: 21px;
  }

  .you-privacy-actions .you-btn {
    flex: 1 1 100%;
  }
}

@media (max-width: 400px) {
  .you-intro {
    left: 8px;
    right: 8px;
  }

  .you-intro-lede {
    font-size: 11px;
  }

  .you-privacy-keys span {
    margin-left: 0;
    text-align: left;
    flex-basis: 100%;
  }
}

/* ------------------------------------------------------------------ *
 * Reduced motion                                                     *
 * ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .you-intro {
    animation: none;
  }

  .you-btn,
  .you-intro-close {
    transition: none;
  }
}
