/* =========================================================
   Polline: inbreve.css
   "Un breve testo" (tema telegramma, "Ufficio telegrafico"). Variabili del design, la circolare da leggere,
   il pulsante "Vai dritto al punto" con il nastro del telegrafo, il telegramma che si scrive da solo
   e l'anteprima del post. I moduli email (.pl-*) arrivano da laboratorio.css.
   ========================================================= */

.ib {
  --pg: #FFF6EC; --card: #FFFFFF; --ink: #1A2B4A; --muted: rgba(26,43,74,0.78); --line: #E8E0D6;
  --yellow: #FCDE3D; --yellow-edge: #DDBC1C; --tool: #F6A48C; --tool-soft: #FCE2DA;
  --tape: #F6EED2; --hl: #FFF0A8; --miss: #F8D3CB; --ok: #2F7D5B;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --mono: 'Courier Prime', 'Courier New', monospace;
  color: var(--ink);
}
.ib [hidden] { display: none !important; }
.ib button:focus-visible, .ib a:focus-visible, .ib [tabindex]:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.ib h2[tabindex]:focus, .ib h2[tabindex]:focus-visible { outline: none; }

@keyframes ib-in { 0% { opacity: 0; transform: translateY(40px) scale(0.9); } 100% { opacity: 1; transform: none; } }
@keyframes ib-ring {
  0% { box-shadow: inset 0 -6px 0 var(--yellow-edge), 0 0 0 0 rgba(252,222,61,0.8); transform: scale(1); }
  12% { transform: scale(1.035); }
  24% { transform: scale(1); }
  70%, 100% { box-shadow: inset 0 -6px 0 var(--yellow-edge), 0 0 0 22px rgba(252,222,61,0); transform: scale(1); }
}
@keyframes ib-arrow { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(7px); } }
@keyframes ib-tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes ib-blink { 50% { opacity: 0; } }

/* pulsanti */
.ib-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: var(--yellow); color: var(--ink); border: 0; border-radius: 999px; padding: 17px 30px 21px; font: inherit; font-weight: 800; font-size: 1.12rem; cursor: pointer; box-shadow: inset 0 -6px 0 var(--yellow-edge); transition: transform 120ms; }
.ib-btn:hover { transform: translateY(-2px); }
.ib-btn:active { transform: translateY(1px); }
.ib-btn-o { display: inline-flex; align-items: center; background: transparent; color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 13px 24px; font: inherit; font-weight: 800; font-size: 1rem; cursor: pointer; transition: background-color 120ms; }
.ib-btn-o:hover { background: var(--tool-soft); }

/* la circolare */
.ib-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; align-items: start; }
@media (min-width: 900px) { .ib-grid { grid-template-columns: minmax(0, 700px) minmax(0, 1fr); } }
@media (max-width: 899px) { .ib-grid { padding-bottom: 120px; } }
.ib-paper { background: var(--card); padding: 34px clamp(20px, 5vw, 44px); border-radius: 8px; box-shadow: 0 1px 0 var(--line); font-family: var(--serif); font-size: 1.04rem; line-height: 1.75; color: var(--ink); }
.ib-paper p { margin: 0 0 1.15em; }
.ib-sent { cursor: pointer; border-radius: 2px; transition: background-color 0.15s; }
.ib-sent:hover { background: var(--hl); }
.ib-sent.is-miss, .ib-sent.is-miss:hover { background: var(--miss); }

/* "Vai dritto al punto": a destra sul computer, in basso fisso sul telefono, solo dopo qualche secondo */
.ib-aside { position: sticky; top: 96px; }
.ib-short-d, .ib-short-m { display: none; }
@media (min-width: 900px) { .ib[data-short] .ib-short-d { display: flex; } }
@media (max-width: 899px) { .ib[data-short] .ib-short-m { display: block; } }
.ib-short-d { flex-direction: column; gap: 14px; max-width: 21rem; animation: ib-in 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.ib-short-m { position: fixed; left: 0; right: 0; bottom: var(--ib-lift, 0px); z-index: 40; padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--pg); border-top: 1px solid var(--line); animation: ib-in 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.ib-skip { position: relative; overflow: hidden; display: block; width: 100%; border: 0; border-radius: 28px; background: var(--yellow); color: var(--ink); cursor: pointer; padding: 26px 24px 54px; text-align: left; font: inherit; box-shadow: inset 0 -6px 0 var(--yellow-edge); animation: ib-ring 2.2s ease-out 0.8s infinite; }
.ib-short-m .ib-skip { max-width: 520px; margin: 0 auto; border-radius: 24px; padding: 16px 18px 42px; }
.ib-skip-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.ib-skip-t { font-weight: 800; font-size: 1.8rem; line-height: 1.02; letter-spacing: -0.03em; text-wrap: balance; }
.ib-short-m .ib-skip-t { display: block; font-size: 1.45rem; line-height: 1.05; }
.ib-skip-s { display: block; margin-top: 3px; font-weight: 600; font-size: 0.88rem; line-height: 1.3; }
.ib-skip-go { flex: none; display: flex; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 50%; background: var(--ink); color: var(--yellow); font-size: 1.7rem; font-weight: 800; animation: ib-arrow 1.1s ease-in-out infinite; }
.ib-short-m .ib-skip-go { width: 46px; height: 46px; font-size: 1.5rem; }
.ib-skip-tape { position: absolute; left: 0; right: 0; bottom: 6px; height: 26px; background: var(--ink); overflow: hidden; display: flex; align-items: center; }
.ib-short-m .ib-skip-tape { height: 22px; }
.ib-skip-tape > span { display: flex; white-space: nowrap; animation: ib-tape 7s linear infinite; font-family: var(--mono); font-weight: 700; color: var(--yellow); font-size: 0.86rem; letter-spacing: 0.12em; }
.ib-short-m .ib-skip-tape > span { font-size: 0.8rem; }
.ib-skip-sub { margin: 0; font-size: 1rem; font-weight: 500; color: var(--muted); line-height: 1.4; }

/* messaggio breve (sbagliato / copiato) */
.ib-toast { position: fixed; left: 50%; bottom: calc(32px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 45; background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 0.95rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s; max-width: 90vw; text-align: center; }
.ib-toast[data-on] { opacity: 1; }
@media (max-width: 899px) { .ib[data-short] .ib-toast { bottom: calc(132px + var(--ib-lift, 0px) + env(safe-area-inset-bottom, 0px)); } }

/* il telegramma */
.ib-wire { display: grid; background: var(--tape); color: var(--ink); padding: 14px 16px; border-radius: 3px; box-shadow: 0 2px 0 rgba(26,43,74,0.12); transform: rotate(-0.6deg); }
.ib-wire > span { grid-area: 1 / 1; font-family: var(--mono); font-weight: 700; font-size: 1.4rem; line-height: 1.35; text-transform: uppercase; letter-spacing: 0.03em; }
.ib-wire > span:first-child { visibility: hidden; }
.ib-caret { animation: ib-blink 0.9s steps(1) infinite; }

/* anteprima del post (stessa grafica dell'immagine scaricabile) */
.pl-preview .ib-pv { container-type: inline-size; aspect-ratio: 1200 / 627; background: #F6A48C; border-radius: 20px; box-shadow: 0 0 0 2px rgba(26,43,74,0.08); position: relative; overflow: hidden; color: #1A2B4A; }
.pl-preview .pl-tag { z-index: 1; }
.ib-pv-in { position: absolute; inset: 0; padding: 7cqw 6cqw 5cqw; display: flex; flex-direction: column; align-items: flex-start; }

@media (prefers-reduced-motion: reduce) {
  .ib *, .ib *::before, .ib *::after { animation: none !important; transition: none !important; }
}

.pl-preview .ib-pv-in img { flex: none; width: auto; height: 4.6cqw; aspect-ratio: auto; object-fit: contain; border-radius: 0; box-shadow: none; }
