/* The release banner: a strip of birch plywood that floats out from under the
   header. Its left end is cut on a slope, like the front of the box it announces.
   The outer element moves and casts the shadow; the plank inside is clipped to
   the sloped shape. (A clip-path would cut away a shadow on the same element.) */
.announce {
  --slope: 26px;
  --edge: #6b4524; /* the plank's end grain, between the birch and the burnt --char */
  --deep: #9c2d0b; /* the beam, darkened: 4.48:1 on birch, 3.12:1 at the plank's darkest edge (fine for 24px text), 6.43:1 under ink */
  position: fixed; z-index: 2; /* under the header, which it slides out of, and under the panels */
  top: calc(var(--header) + 12px); left: 0; right: 0;
  width: fit-content; max-width: min(860px, calc(100vw - 2 * var(--gutter))); margin-inline: auto;
  filter: drop-shadow(0 10px 18px rgb(0 0 0 / 0.45));
  opacity: 0;
  transform: translateY(-28px);
  transition: opacity 0.5s ease-out, transform 0.7s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.announce[hidden] { display: none; }
.announce.in { opacity: 1; transform: none; transition-delay: 0.6s; }
.announce.out { opacity: 0; transform: translateY(-28px); transition-duration: 0.3s; transition-delay: 0s; }

/* Once it has landed it rocks gently like a seesaw about its middle, as if it hung
   in the air: as the right end rises the left end sinks, and back. ±0.45º moves each
   end of the wide banner about 6.4px. */
.announce.in { animation: bob 4.2s ease-in-out 1.4s infinite; }
@keyframes bob {
  0%, 100% { rotate: 0.45deg; }
  50% { rotate: -0.45deg; }
}

.announce .plank {
  position: relative;
  /* Wide: one row of sketch, release, line, buttons and close, with the small
     print under the line, its checkbox lined up with the line's first word. */
  display: grid; align-items: center; gap: 6px 14px;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  grid-template-areas: "sketch release line actions close" ".  .  never . .";
  padding: 10px 12px 8px calc(var(--slope) + 10px);
  /* Its thickness shows along the right and bottom, so it reads as a board, not a sticker. */
  border-right: 6px solid var(--edge); border-bottom: 6px solid var(--edge);
  color: var(--char);
  background:
    repeating-linear-gradient(97deg, rgb(255 255 255 / 0.07) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, var(--birch-light), var(--birch) 60%, var(--birch-dark));
  /* The left end is cut on the slope; the top-right corner is mitred at 45º, so the
     right edge reads as the board's thickness seen from an angle. */
  clip-path: polygon(var(--slope) 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
}

/* The burnt edge along the slope, where the laser cut it, down through the bottom edge. */
.announce .plank::before {
  content: ""; position: absolute; inset: 0 0 -6px 0;
  clip-path: polygon(var(--slope) 0, calc(var(--slope) + 3px) 0, 3px 100%, 0 100%);
  background: var(--char); opacity: 0.85;
}

/* The little side view is drawn by the beam, then the sloped front glows. */
.announce .sketch { grid-area: sketch; overflow: visible; }
.announce .trace {
  fill: none; stroke: var(--char); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100;
}
.announce.in .trace { animation: trace 1.1s ease-in-out 1s forwards; }
.announce.in .slope { stroke: var(--beam); animation: trace 0.5s ease-out 2.1s forwards, glow 2.4s ease-in-out 2.6s infinite; }
@keyframes trace { to { stroke-dashoffset: 0; } }
@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 1px var(--beam)); }
  50% { filter: drop-shadow(0 0 4px var(--amber)); }
}

/* Wide, the release and the line are cells of the plank's grid; narrower, they stack in one. */
.announce .words { display: contents; }
.announce .release {
  grid-area: release; font: 600 24px/1 "Barlow Condensed", "Archivo", sans-serif; letter-spacing: 0.02em;
  color: var(--deep); text-shadow: 0 1px 0 rgb(255 255 255 / 0.35);
}
.announce .release .v { font-size: 0.7em; margin-right: 1px; }
.announce .line { grid-area: line; font-size: 15px; line-height: 1.3; text-wrap: balance; } /* no lone last word once it wraps */
.announce .line b { font-weight: 750; }

.announce button { flex: none; cursor: pointer; border: 0; }
.announce .actions { grid-area: actions; display: flex; gap: 8px; }
.announce .try, .announce .comment {
  padding: 7px 14px; border-radius: 3px;
  font: 600 16px/1 "Barlow Condensed", "Archivo", sans-serif; letter-spacing: 0.04em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
}
.announce .try { color: var(--ink); background: var(--char); }
.announce .try:hover { background: var(--deep); }
/* The second call to action: the same shape, drawn in outline. */
.announce .comment { padding: 5px 12px; color: var(--char); border: 2px solid var(--char); }
.announce .comment:hover { color: var(--deep); border-color: var(--deep); }

/* Small print along the bottom edge. */
.announce .never {
  grid-area: never; justify-self: start;
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; line-height: 1; color: var(--char); opacity: 0.8; cursor: pointer;
}
.announce .never:hover { opacity: 1; }
.announce .never input { width: 13px; height: 13px; margin: 0; accent-color: var(--deep); cursor: pointer; }
.announce .close {
  grid-area: close; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  font-size: 22px; line-height: 1; color: var(--char); background: transparent;
}
.announce .close:hover { background: rgb(61 38 20 / 0.12); }
.announce :focus-visible { outline-color: var(--char); }

/* Where it would cover the heading, it stops floating and takes its place in the
   page instead: above the h1, lined up with it. */
@media (max-width: 1180px) {
  .announce {
    position: relative; z-index: 1; top: auto; left: auto; right: auto;
    margin: 14px var(--gutter) 0; max-width: calc(100% - 2 * var(--gutter));
  }
}

/* Narrower, the line wraps in a column about half the banner wide, the buttons
   stay on its right, and the small print moves to the centre. */
@media (max-width: 900px) {
  .announce { width: auto; }
  .announce .plank {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "sketch words actions close" "never never never never";
  }
  .announce .words { grid-area: words; display: flex; flex-direction: column; gap: 2px; }
  .announce .never { justify-self: center; }
}

@media (max-width: 640px) {
  .announce { --slope: 18px; }
  .announce.in { animation: none; } /* no rocking on a phone: it sits in the page, still */
  .announce .plank { gap: 6px 10px; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "words actions close" "never never never"; }
  .announce .sketch { display: none; }
  .announce .line { font-size: 14px; }
}

/* A phone has no room for half: the buttons go under the line, close keeps the corner. */
@media (max-width: 480px) {
  .announce .plank { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "words close" "actions actions" "never never"; }
  .announce .close { align-self: start; }
}

/* base.css already turns every animation and transition off; this puts the
   banner and its drawing in their finished state. */
@media (prefers-reduced-motion: reduce) {
  .announce, .announce.in, .announce.out { transform: none; }
  .announce .trace { stroke-dashoffset: 0; animation: none !important; }
  .announce .slope { stroke: var(--beam); }
}
