/* Create page and read page: options, messages, result panel.
   Sits next to leesogen.css (face, eyes, textarea, .btn), which is not changed. */

[hidden] { display: none !important; }

/* ---- Logo (replaces the text title) ---- */

.page__title { margin-bottom: 12px; }

.page__logo {
  display: block;
  width: min(100%, 400px);
  height: auto;
  margin: -12px auto 0;        /* the image has a transparent fade margin around the burst */
}

.page__home { display: block; margin-bottom: 12px; }

/* ---- Footer and the Security & privacy page ---- */

.site-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 0.85rem;
}

.site-footer a,
.prose a:not(.btn) { color: #8fa6ff; text-underline-offset: 3px; }
.site-footer a:hover,
.prose a:not(.btn):hover { color: #b3c3ff; }

.embed .site-footer { display: none; }

.prose {
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}

.prose h1 { margin: 8px 0 12px; font-size: 1.8rem; line-height: 1.2; }
.prose h2 { margin: 32px 0 8px; font-size: 1.2rem; color: #ffd479; }
.prose p, .prose ul { margin: 0 0 12px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 8px; }
.prose code { padding: 1px 5px; background: var(--field-bg); border-radius: 4px; }
.prose__lead { font-size: 1.1rem; color: var(--text); }
.prose__back { margin-top: 32px; }

/* ---- Form controls ---- */

.input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: var(--field-bg);
  color: var(--text);
  border: 1px solid var(--field-border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.95rem;
  color-scheme: dark;
}

.input:focus {
  outline: none;
  border-color: #5b7cff;
  box-shadow: 0 0 0 1px #5b7cff;
}

/* ---- Options under the letter ---- */

.options {
  display: grid;
  gap: 12px 16px;
  margin-top: 16px;
}

.opt__label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.opt--check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  cursor: pointer;
}

.opt--check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #5b7cff;
}

@container (min-width: 440px) {
  .options { grid-template-columns: 1fr 1fr; }
  .opt--check { grid-column: 1 / -1; }
}

/* ---- Messages ---- */

.msg {
  margin: 14px 0 0;
  min-height: 1.4em;
  font-size: 0.92rem;
  color: var(--muted);
}

.msg:empty { display: none; }

.msg--error { color: #ff8787; }
.msg--warn  { color: #ffd479; }

/* ---- Button variants ---- */

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn--secondary {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--field-border);
}

.btn--secondary:hover { background: rgba(255, 255, 255, 0.06); }

/* ---- Result panel (create page) ---- */

.result {
  padding: 4px 0 0;
}

.result__title {
  margin: 0 0 14px;
  font-size: 1.25rem;
  text-align: center;
}

.result__link {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
}

.result__summary {
  margin: 16px 0 0;
  font-size: 0.92rem;
  color: var(--muted);
  text-align: center;
}

.result__note {
  margin: 10px 0 0;
  font-size: 0.92rem;
  color: #ffd479;
  text-align: center;
}

/* "Test the link yourself": the read page in an iframe, in a modal, at 75% (see create.js) */
/* A button that looks like a text link, inside a sentence */
.text-link {
  display: inline;
  margin: 0;
  padding: 0;
  font: inherit;
  color: #8fa6ff;
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.text-link:hover { color: #b3c3ff; }
.text-link:focus-visible { outline: 2px solid #5b7cff; outline-offset: 2px; border-radius: 4px; }

.modal {
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  padding: 12px 16px 16px;
  overflow: auto;
  background: var(--page-bg);
  color: var(--text);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
}

.modal::backdrop { background: rgba(4, 7, 18, 0.75); }

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.modal__close {
  width: 36px;
  height: 36px;
  padding: 0;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.modal__close:hover { background: rgba(255, 255, 255, 0.08); }
.modal__close:focus-visible { outline: 2px solid #5b7cff; }

.modal__frame {
  display: block;
  zoom: 0.75;                  /* the page inside is laid out at full size, then shown at 75% */
  width: min(520px, calc((100vw - 66px) / 0.75));
  height: 900px;               /* until the frame reports its real height */
  border: 0;
}

.embed { overflow: hidden; }     /* the parent sizes the frame; a scrollbar would change the width and height */
.embed body { min-height: 0; }
.embed .page { padding: 0; }
.embed .page__title { display: none; }

/* ---- Read page ---- */

.panel {
  margin-top: 16px;
}

.panel p {
  margin: 0 0 10px;
}

.panel__lead {
  font-size: 1.05rem;
  font-weight: 600;
}

.panel__small {
  font-size: 0.9rem;
  color: var(--muted);
}

.panel .opt { margin-top: 14px; }

/* Read page: the received text can be read, scrolled, selected and copied until the timer runs out */
.secret--read {
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: text;
}

/* Countdown on the read page: the text disappears when it reaches 00:00 */
.timer {
  margin: 0 0 6px;
  font-size: 1rem;
}

.timer strong {
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  color: #ff8787;
}

/* ---- Read page: closed envelope, destroy video ---- */

.btn--link {
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

/* Laid exactly over the letter photo (same crop, same aspect), above the face and the textarea. */
.envelope {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 700ms ease;
}

.envelope--open {
  opacity: 0;
  pointer-events: none;
}

/* "Copy and destroy!": the video takes the place of the photo, in the same box. */
.field--destroyed .strip,
.field--destroyed .secret {
  visibility: hidden;
}

.destroy-video {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

@media (prefers-reduced-motion: reduce) {
  .envelope { transition: none; }
}
