/* ==========================================================================
   The Awoogification (before/after schematic) — shared by build.php and
   design-lab.html. A drafting sheet taped to graph paper. The AWOOGA
   version sits on top of the original, clipped by --p (0–100%) which is
   set on .awgf__stagewrap by awoogify.js. The pencil rides the divider;
   an invisible range input covers the whole stage for drag / touch /
   keyboard.
   ========================================================================== */
.awgf {
  background-color: #fdfcf8;
  background-image:
    linear-gradient(rgba(12, 32, 52, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(12, 32, 52, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
}
.awgf__wrap { max-width: 1240px; margin: 0 auto; }
/* Sheet + pitch-meeting rail. Two independent columns on desktop (so the
   rail's height never pushes the credit line away from the sheet); on small
   screens the rail unwraps into the single-column flow (chips on top,
   buttons after the sheet). */
.awgf__layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 290px;
  gap: clamp(1.2rem, 2.5vw, 2rem); align-items: start;
}
.awgf__main { grid-column: 1; }
.awgf__rail { grid-column: 2; display: grid; gap: 0.9rem; align-content: start; }
.awgf__sheet {
  position: relative; margin: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: clamp(0.8rem, 2.4vw, 1.6rem);
  transform: rotate(-0.4deg);
}
/* Inner rule, like the border of a real drawing sheet */
.awgf__sheet::before {
  content: ""; position: absolute; inset: clamp(0.45rem, 1.4vw, 0.95rem);
  border: 1.5px solid rgba(12, 32, 52, 0.35); border-radius: 3px;
  pointer-events: none; z-index: 3;
}
.awgf__tape {
  position: absolute; top: -12px; width: 92px; height: 26px; z-index: 6;
  background: rgba(227, 195, 90, 0.45);
  border-left: 1px dashed rgba(138, 94, 52, 0.35);
  border-right: 1px dashed rgba(138, 94, 52, 0.35);
  box-shadow: 0 2px 5px rgba(12, 32, 52, 0.12);
}
.awgf__tape--l { left: 8%; transform: rotate(-5deg); }
.awgf__tape--r { right: 8%; transform: rotate(4deg); }

.awgf__stagewrap { position: relative; }
.awgf__stage {
  position: relative; overflow: hidden;
  aspect-ratio: 1448 / 1086; background: #fff;
}
.awgf__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; display: block; background: #fff;
}
.awgf__after {
  position: absolute; inset: 0;
  clip-path: inset(0 calc(100% - var(--p, 0%)) 0 0);
}

/* Divider + pencil + grip */
.awgf__divider {
  position: absolute; top: 0; bottom: 0; left: var(--p, 0%);
  width: 3px; margin-left: -1.5px; z-index: 4;
  background: linear-gradient(var(--brass), var(--wood));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7), 0 0 14px rgba(12, 32, 52, 0.25);
  pointer-events: none;
}
.awgf__pencil {
  position: absolute; bottom: calc(100% - 6px); left: 50%;
  width: clamp(26px, 4vw, 40px); height: clamp(26px, 4vw, 40px);
  transform: translateX(-14%) rotate(8deg); transform-origin: 12% 88%;
  filter: drop-shadow(0 3px 4px rgba(12, 32, 52, 0.25));
}
.awgf__pencil svg { width: 100%; height: 100%; display: block; }
/* While a sweep is running the pencil wiggles, like it's busy drawing */
.is-sweeping .awgf__pencil { animation: awgf-scribble 0.22s ease-in-out infinite; }
@keyframes awgf-scribble {
  0%, 100% { transform: translateX(-14%) rotate(3deg); }
  50% { transform: translateX(-14%) rotate(14deg); }
}
.awgf__grip {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy-900); color: var(--brass-lt);
  border: 2.5px solid var(--brass-lt);
  box-shadow: 0 6px 18px rgba(12, 32, 52, 0.4);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.awgf__grip svg { width: 22px; height: 22px; }
.awgf__stagewrap:hover .awgf__grip { transform: translate(-50%, -50%) scale(1.08); }
.awgf__stagewrap:focus-within .awgf__grip {
  box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.45), 0 6px 18px rgba(12, 32, 52, 0.4);
}

/* Invisible native range = free drag, touch and arrow-key support */
.awgf__range {
  position: absolute; inset: 0; z-index: 5;
  width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: ew-resize;
  touch-action: pan-y; /* vertical swipes still scroll the page on mobile */
  -webkit-appearance: none; appearance: none;
}

/* Era badges — fade with the divider position (JS sets the opacity) */
.awgf__badge {
  position: absolute; top: clamp(0.9rem, 2.4vw, 1.4rem); z-index: 4;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.3rem 0.7rem; border-radius: 999px; box-shadow: var(--shadow-sm);
  pointer-events: none; transition: opacity 0.25s var(--ease);
}
.awgf__badge--pre { right: clamp(0.9rem, 2.4vw, 1.4rem); background: var(--navy-900); color: var(--cream); }
/* Sits under the factory-spec pill (both are visible mid-drag) so it never
   covers the drawing's title lettering in the top-left corner. */
.awgf__badge--post {
  right: clamp(0.9rem, 2.4vw, 1.4rem);
  top: calc(clamp(0.9rem, 2.4vw, 1.4rem) + 2.1rem);
  background: var(--brass); color: var(--navy-900); opacity: 0;
}

/* "Read the minutes" — appears under the edition pill once a theme is drawn
   in. Sits above the invisible range (z-5) so it stays clickable. */
.awgf__minutes-btn {
  position: absolute; z-index: 6;
  right: clamp(0.9rem, 2.4vw, 1.4rem);
  top: calc(clamp(0.9rem, 2.4vw, 1.4rem) + 4.3rem);
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.34rem 0.75rem; border-radius: 999px; border: 1.5px solid var(--red);
  background: #fff; color: var(--red); cursor: pointer;
  box-shadow: var(--shadow-sm);
  opacity: 0; pointer-events: none; transform: translateY(-4px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), background-color 0.2s, color 0.2s;
}
.awgf__minutes-btn.is-shown { opacity: 1; pointer-events: auto; transform: none; }
.awgf__minutes-btn:hover, .awgf__minutes-btn:focus-visible {
  background: var(--red); color: #fff; outline: none;
}

/* The minutes modal — a typed memo pinned over the page */
.awgf-minutes { position: fixed; inset: 0; z-index: 1000; display: none; }
.awgf-minutes.is-open { display: block; }
.awgf-minutes__backdrop {
  position: absolute; inset: 0; background: rgba(12, 32, 52, 0.55);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.awgf-minutes__doc {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(-0.6deg);
  width: min(92vw, 560px); max-height: 86vh; overflow-y: auto;
  background: var(--paper); border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: clamp(1.4rem, 4vw, 2.2rem);
}
.awgf-minutes.is-open .awgf-minutes__doc { animation: awgf-minutes-in 0.3s var(--ease) both; }
@keyframes awgf-minutes-in {
  from { opacity: 0; transform: translate(-50%, -46%) rotate(-2deg) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) rotate(-0.6deg) scale(1); }
}
.awgf-minutes__tape {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%) rotate(-2deg);
  width: 110px; height: 26px; background: rgba(227, 195, 90, 0.5);
  border-left: 1px dashed rgba(138, 94, 52, 0.35);
  border-right: 1px dashed rgba(138, 94, 52, 0.35);
  box-shadow: 0 2px 5px rgba(12, 32, 52, 0.12);
}
.awgf-minutes__close {
  position: absolute; top: 0.6rem; right: 0.7rem;
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: rgba(12, 32, 52, 0.08); color: var(--navy-900);
  font-size: 1.3rem; line-height: 1; cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.awgf-minutes__close:hover { background: var(--navy-900); color: var(--cream); }
.awgf-minutes__org {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--wood-dk); margin: 0 0 0.4rem;
}
.awgf-minutes__title {
  font-family: var(--font-display); font-size: clamp(1.4rem, 4vw, 1.8rem);
  color: var(--navy-900); margin: 0 0 0.3rem;
}
.awgf-minutes__meta {
  font-size: 0.78rem; color: var(--text-soft); margin: 0 0 1.1rem;
  padding-bottom: 0.8rem; border-bottom: 1.5px solid rgba(12, 32, 52, 0.18);
}
.awgf-minutes__log { display: grid; gap: 0.55rem; }
.awgf-minutes__line {
  font-family: "Courier New", Courier, monospace; font-size: 0.88rem;
  line-height: 1.5; color: var(--ink); margin: 0;
}
.awgf-minutes__line b { font-weight: 700; letter-spacing: 0.04em; }
.awgf-minutes__line--a b { color: var(--navy-700); }
.awgf-minutes__line--t b { color: var(--red-dk); }
.awgf-minutes__line--t { padding-left: 1.1rem; }
.awgf-minutes__verdict {
  font-family: "Courier New", Courier, monospace; font-size: 0.9rem; font-weight: 700;
  color: var(--red); text-transform: uppercase; letter-spacing: 0.04em;
  margin: 1.2rem 0 0; padding-top: 0.9rem;
  border-top: 1.5px dashed rgba(12, 32, 52, 0.25);
}
.awgf-minutes__verdict.is-approved { color: #2e7d4f; }

@media (max-width: 620px) {
  .awgf__minutes-btn { font-size: 0.6rem; top: calc(clamp(0.9rem, 2.4vw, 1.4rem) + 3.4rem); padding: 0.3rem 0.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .awgf-minutes.is-open .awgf-minutes__doc { animation: none; }
}

/* Rubber stamp — slams in at 100% */
.awgf__stamp {
  position: absolute; right: 6%; bottom: 12%; z-index: 4;
  display: grid; justify-items: center; gap: 0.1rem;
  padding: 0.7rem 1.2rem;
  border: 3px solid var(--red); border-radius: 10px;
  box-shadow: inset 0 0 0 1.5px var(--red);
  color: var(--red); text-transform: uppercase; text-align: center;
  transform: rotate(-11deg);
  mix-blend-mode: multiply; pointer-events: none;
}
.awgf__stamp[hidden] { display: none; }
.awgf__stamp-sm { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.22em; }
.awgf__stamp-big { font-family: var(--font-display); font-size: clamp(1.2rem, 3vw, 1.9rem); font-weight: 700; letter-spacing: 0.06em; line-height: 1.05; }
.awgf__stamp.is-stamped { animation: awgf-slam 0.45s var(--ease) both; }
@keyframes awgf-slam {
  0% { opacity: 0; transform: rotate(-11deg) scale(2.4); }
  55% { opacity: 1; transform: rotate(-9deg) scale(0.92); }
  75% { transform: rotate(-12deg) scale(1.05); }
  100% { opacity: 1; transform: rotate(-11deg) scale(1); }
}

/* Bubbles from the bubble stack when the stamp lands */
.awgf__bubbles { position: absolute; inset: 0; overflow: visible; pointer-events: none; z-index: 4; }
.awgf-bubble {
  position: absolute; border-radius: 50%;
  border: 2px solid rgba(29, 77, 120, 0.55);
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.95), rgba(191, 219, 247, 0.4));
  animation: awgf-bubble-rise var(--dur, 1.6s) ease-out forwards;
}
@keyframes awgf-bubble-rise {
  0% { opacity: 0; transform: translateY(0) scale(0.4); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(calc(-1 * var(--rise, 110px))) translateX(var(--drift, 0px)) scale(1); }
}

/* Title block — the strip along the bottom of a real drawing sheet */
.awgf__titleblock {
  display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem;
  align-items: baseline; justify-content: space-between;
  margin: clamp(0.7rem, 1.8vw, 1rem) clamp(0.2rem, 1vw, 0.5rem) 0;
  padding-top: 0.7rem; border-top: 1.5px solid rgba(12, 32, 52, 0.35);
}
.awgf__tb-name {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--navy-800);
}
.awgf__tb-name b { font-family: var(--font-display); letter-spacing: 0.02em; }
.awgf__tb-rev {
  font-family: "Caveat", cursive; font-size: 1.15rem; font-weight: 600;
  color: var(--navy-700); transform: rotate(-0.6deg);
}
.awgf__tb-rev.is-final { color: var(--red); }

/* ---- The pitch meeting (variant selector rail) ---- */
.awgf__ideas {
  background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1rem 0.9rem;
  transform: rotate(0.4deg); /* counter-tilt to the sheet */
}
.awgf__ideas-title {
  font-family: "Caveat", cursive; font-size: 1.6rem; font-weight: 700;
  color: var(--navy-900); margin: 0 0 0.15rem;
}
.awgf__ideas-sub { font-size: 0.8rem; color: var(--text-soft); line-height: 1.45; margin: 0 0 0.8rem; }
.awgf__ideas-list { display: grid; gap: 0.35rem; }
.awgf-idea {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.45rem 0.55rem; border: 1.5px solid transparent; border-radius: 10px;
  background: transparent; text-align: left; cursor: pointer;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.awgf-idea:hover { background: rgba(12, 32, 52, 0.05); transform: translateX(3px); }
.awgf-idea:focus-visible { outline: none; border-color: var(--brass); }
.awgf-idea.is-active { background: var(--navy-900); border-color: var(--navy-900); }
.awgf-idea__rev {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--wood-dk); background: rgba(181, 130, 79, 0.14);
  padding: 0.22rem 0.45rem; border-radius: 6px; white-space: nowrap;
}
.awgf-idea.is-active .awgf-idea__rev { color: var(--navy-900); background: var(--brass-lt); }
.awgf-idea__body { display: grid; line-height: 1.2; min-width: 0; }
.awgf-idea__body b { font-size: 0.88rem; font-weight: 700; color: var(--navy-900); }
.awgf-idea__body i {
  font-family: "Caveat", cursive; font-style: normal; font-size: 0.98rem;
  color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.awgf-idea.is-active .awgf-idea__body b { color: var(--cream); }
.awgf-idea.is-active .awgf-idea__body i { color: var(--brass-lt); }
.awgf-idea__verdict {
  font-size: 0.56rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--red); border: 1.5px solid currentColor; border-radius: 4px;
  padding: 0.14rem 0.3rem; transform: rotate(-6deg); opacity: 0.75; white-space: nowrap;
}
.awgf-idea__verdict--yes { color: #2e7d4f; }
.awgf__ideas-foot {
  font-family: "Caveat", cursive; font-size: 1.02rem; color: var(--ink-soft);
  text-align: right; margin: 0.7rem 0.2rem 0; transform: rotate(-0.8deg);
}

/* Buttons sit centered under the credit line, beneath the sheet */
.awgf__controls {
  display: flex; flex-wrap: wrap; gap: 0.8rem; justify-content: center;
  margin-top: 1.1rem;
}
.awgf__credit {
  text-align: center; font-size: 0.82rem; color: var(--text-soft);
  margin: 1rem auto 0; max-width: 56ch;
}

@media (max-width: 900px) {
  /* Rail unwraps: chip strip above the sheet, buttons after it */
  .awgf__layout { grid-template-columns: 1fr; }
  .awgf__main { grid-column: auto; }
  .awgf__rail { display: contents; }
  .awgf__ideas { order: -1; transform: none; padding: 0.9rem 0.9rem 0.7rem; }
  .awgf__ideas-list {
    display: flex; gap: 0.45rem; overflow-x: auto;
    padding-bottom: 0.5rem; margin-inline: -0.2rem; padding-inline: 0.2rem;
    scrollbar-width: thin;
  }
  .awgf-idea { flex: 0 0 auto; width: auto; grid-template-columns: auto auto; }
  .awgf-idea:hover { transform: none; }
  .awgf-idea__body i, .awgf-idea__verdict { display: none; }
  .awgf__ideas-foot { display: none; }
}
@media (max-width: 620px) {
  .awgf__sheet { transform: none; }
  .awgf__badge { font-size: 0.6rem; }
  .awgf__grip { width: 34px; height: 34px; }
  .awgf__grip svg { width: 17px; height: 17px; }
  .awgf__stamp { padding: 0.45rem 0.8rem; border-width: 2px; right: 4%; bottom: 8%; }
  .awgf__stamp-sm { font-size: 0.52rem; }
  .awgf__titleblock { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .is-sweeping .awgf__pencil { animation: none; }
  .awgf__stamp.is-stamped { animation: none; opacity: 1; }
  .awgf-bubble { display: none; }
}
