/* ==========================================================================
   AWOOGA — The Flag Locker page styles (flags.html)
   The hoist scene, the "what you just said" decoder, the A–Z locker grid
   and the famous-hoists shelf. Reuses the shared system (.section, .eyebrow,
   .card, .btn, .on-navy, .next-links pattern).
   ========================================================================== */

/* Screen-reader-only helper (style.css doesn't ship one) */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Hero ---------------------------------------------------------- */
.flg-hero {
  background:
    radial-gradient(90% 70% at 85% 0%, rgba(201,162,39,0.20), transparent 55%),
    linear-gradient(165deg, var(--navy-800), var(--navy-900));
  color: var(--cream);
  text-align: center;
  padding: clamp(3rem, 6vw, 5rem) 0;
}
.flg-hero h1 { color: var(--cream); font-size: clamp(2.4rem, 5.5vw, 4rem); }
.flg-hero h1 em { font-style: normal; color: var(--brass-lt); }
.flg-hero .lead { margin-inline: auto; color: rgba(247,241,227,0.86); }
.flg-hero .eyebrow { color: var(--brass-lt); justify-content: center; }

/* A little decorative bunting under the hero title (pure CSS triangles). */
.flg-bunting {
  display: flex; justify-content: center; gap: 10px;
  margin: 1.4rem auto 0; padding: 0; list-style: none;
}
.flg-bunting li {
  width: 0; height: 0; border-left: 13px solid transparent; border-right: 13px solid transparent;
  border-top: 20px solid var(--brass-lt);
  animation: flg-sway 3.2s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.22s);
  transform-origin: top center;
}
.flg-bunting li:nth-child(3n)   { border-top-color: #d63c2f; }
.flg-bunting li:nth-child(3n+1) { border-top-color: #1c4f9c; }
@keyframes flg-sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

/* ---------- The hoist ----------------------------------------------------- */
.flg-hoist-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: clamp(1.4rem, 3.5vw, 2.2rem);
}
.flg-hoist-head { max-width: 64ch; margin-bottom: 1.2rem; }
.flg-hoist-head h2 { margin: 0.2rem 0 0.5rem; font-size: clamp(1.4rem, 3vw, 1.9rem); }
.flg-hoist-head p { color: var(--text-soft); margin: 0; }

/* The rope + flags scene. The rope is a repeating braid drawn with CSS. */
.flg-line-wrap {
  position: relative; border-radius: var(--radius);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255,255,255,0.06), transparent 60%),
    linear-gradient(180deg, var(--navy-800), var(--navy-900));
  padding: clamp(1.1rem, 3vw, 1.8rem) clamp(1rem, 3vw, 1.6rem) 1.2rem;
  overflow: hidden;
}
.flg-line-wrap::before { /* the halyard itself */
  content: ""; position: absolute; left: 0; right: 0; top: calc(clamp(1.1rem, 3vw, 1.8rem) + 7px);
  height: 3px; background: repeating-linear-gradient(90deg,
    #d9b98c 0 7px, #b5824f 7px 14px);
  border-radius: 2px; opacity: 0.9;
}
.flg-line {
  position: relative; display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: 0.55rem 0.5rem; min-height: 96px;
}
.fl-up { display: inline-flex; flex-direction: column; align-items: center; gap: 0.18rem; }
.fl-toggle { /* the little wooden toggle clipping each flag to the line */
  width: 4px; height: 15px; border-radius: 2px;
  background: linear-gradient(180deg, #d9b98c, #8a5e34);
}
.fl-flag {
  width: clamp(44px, 7vw, 64px); height: clamp(44px, 7vw, 64px);
  display: block; border-radius: 4px;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.35));
  transform-origin: top center;
  animation: fl-flutter 3.6s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.35s);
}
.fl-up { animation-delay: calc(var(--i, 0) * 0.35s); }
.fl-up b {
  font-family: var(--font-sans); font-weight: 800; font-size: 0.72rem;
  color: rgba(247,241,227,0.75); letter-spacing: 0.08em;
}
.fl-up .fl-flag { animation-delay: inherit; }
.fl-gap { width: clamp(16px, 3vw, 26px); }
.fl-empty {
  color: rgba(247,241,227,0.72); font-size: 0.95rem; font-style: italic;
  align-self: center; padding-top: 14px;
}
@keyframes fl-flutter {
  0%, 100% { transform: rotate(-2.2deg) skewY(-1deg); }
  50%      { transform: rotate(2.4deg)  skewY(1.2deg); }
}
/* Hoist-in: flags run up when a whole message is set at once. */
.is-hoisting .fl-up {
  animation: fl-hoist 0.55s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 0.09s);
}
@keyframes fl-hoist {
  from { transform: translateY(46px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.is-hoisting .fl-up .fl-flag { animation-delay: calc(var(--i, 0) * 0.35s + 0.55s); }

/* Input row + preset chips */
.flg-controls { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; margin-top: 1.1rem; }
.flg-input {
  flex: 1 1 240px; font-family: var(--font-sans); font-weight: 700;
  font-size: 1.05rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--navy-900); background: var(--paper);
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 0.75rem 1rem; min-width: 0;
}
.flg-input:focus-visible { outline: 3px solid var(--brass-lt); outline-offset: 2px; border-color: var(--brass); }
.flg-input::placeholder { color: var(--ink-soft); opacity: 0.55; letter-spacing: 0.06em; font-weight: 600; }
.flg-count {
  font-family: var(--font-sans); font-size: 0.8rem; font-weight: 700;
  color: var(--text-soft); white-space: nowrap;
}
.flg-presets { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.75rem; }
.flg-presets span {
  font-family: var(--font-sans); font-size: 0.76rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-soft);
  align-self: center; margin-right: 0.2rem;
}
.flg-chip {
  font: inherit; font-family: var(--font-sans); font-size: 0.82rem; font-weight: 700;
  letter-spacing: 0.06em; color: var(--navy-800);
  background: var(--cream-2); border: 1px solid rgba(201,162,39,0.45);
  border-radius: 999px; padding: 0.38rem 0.85rem; cursor: pointer;
  transition: transform 0.15s var(--ease), background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.flg-chip:hover { transform: translateY(-2px); background: var(--brass-lt); border-color: var(--brass); }
.flg-chip:focus-visible { outline: 3px solid var(--brass-lt); outline-offset: 2px; }

/* Decoder */
.flg-decode { margin-top: 1.4rem; }
.fl-decode__title { font-size: 1.05rem; margin: 0 0 0.7rem; }
.fl-decode__empty { color: var(--text-soft); font-size: 0.95rem; margin: 0; }
.fl-decode__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.fl-decode__list li {
  display: flex; align-items: center; gap: 0.7rem;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0.55rem 0.8rem;
  font-size: 0.92rem; line-height: 1.45;
}
.fl-decode__list b { color: var(--navy-800); }
.fl-mini { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 3px; }
.fl-callout {
  margin: 0.8rem 0 0; padding: 0.75rem 1rem; border-radius: var(--radius-sm);
  background: var(--navy-900); color: var(--cream); font-size: 0.94rem; line-height: 1.5;
}
.fl-callout b { color: var(--brass-lt); }
.fl-callout--gold { background: linear-gradient(120deg, #b28d1e, var(--brass)); color: var(--navy-900); }
.fl-callout--gold b { color: var(--navy-900); }
.fl-callout--soft { background: var(--cream-2); color: var(--ink); border: 1px dashed rgba(12,32,52,0.25); }
.flg-fine { margin: 1.1rem 0 0; font-size: 0.78rem; font-style: italic; color: var(--text-soft); }

/* ---------- The A–Z locker ------------------------------------------------ */
.flg-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.9rem; margin-top: 2.2rem;
}
.fl-card {
  display: flex; flex-direction: column; gap: 0.5rem; text-align: left;
  font: inherit; color: var(--cream); cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(247,241,227,0.14);
  border-radius: var(--radius); padding: 1rem 1.05rem;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease),
              background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.fl-card:hover { transform: translateY(-4px); border-color: var(--brass); background: rgba(255,255,255,0.08); box-shadow: 0 18px 40px rgba(0,0,0,0.35); }
.fl-card:focus-visible { outline: 3px solid var(--brass-lt); outline-offset: 2px; }
.fl-card__top { display: flex; align-items: center; gap: 0.75rem; }
.fl-card__flag { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 4px; }
.fl-card__id b {
  display: block; font-family: var(--font-display); font-size: 1.5rem;
  font-weight: 700; color: var(--cream); line-height: 1;
}
.fl-card__id i {
  font-style: normal; font-family: var(--font-sans); font-size: 0.74rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--brass-lt);
}
.fl-card__mean { font-size: 0.88rem; line-height: 1.45; color: rgba(247,241,227,0.92); }
.fl-card__quip {
  font-size: 0.82rem; line-height: 1.45; font-style: italic;
  color: rgba(247,241,227,0.62);
  border-top: 1px dashed rgba(247,241,227,0.18); padding-top: 0.45rem;
}
.fl-card__add {
  font-family: var(--font-sans); font-size: 0.72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--brass-lt);
  opacity: 0; transform: translateY(3px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.fl-card:hover .fl-card__add, .fl-card:focus-visible .fl-card__add { opacity: 1; transform: translateY(0); }
.fl-card.is-added { animation: fl-added 0.45s var(--ease); border-color: var(--brass-lt); }
@keyframes fl-added { 30% { transform: scale(0.965); } }

/* ---------- Famous hoists ------------------------------------------------- */
.flg-famous {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.1rem; margin-top: 2.2rem;
}
.flg-famous__card {
  display: flex; flex-direction: column; gap: 0.55rem; text-align: left;
  font: inherit; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.15rem 1.2rem; box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.flg-famous__card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--brass); }
.flg-famous__card:focus-visible { outline: 3px solid var(--brass-lt); outline-offset: 2px; }
.flg-famous__flags { display: flex; gap: 0.4rem; align-items: center; min-height: 44px; }
.flg-famous__flags .fl-mini { width: 42px; height: 42px; flex: 0 0 42px; box-shadow: var(--shadow-sm); }
.flg-famous__card h3 { font-size: 1.12rem; margin: 0; }
.flg-famous__card p { margin: 0; color: var(--text-soft); font-size: 0.92rem; line-height: 1.55; }
.flg-famous__try {
  font-family: var(--font-sans); font-size: 0.8rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--red); margin-top: 0.2rem;
}

/* ---------- Next links (same pattern as lineage) -------------------------- */
.next-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.2rem; }
.next-link { padding: 1.4rem; display: flex; flex-direction: column; gap: 0.3rem; }
.next-link h3 { font-size: 1.15rem; margin: 0; }
.next-link p { margin: 0; color: var(--text-soft); font-size: 0.92rem; }
.next-link .xcard__arrow { color: var(--red); font-weight: 700; font-size: 0.9rem; margin-top: 0.6rem; }

/* ---------- Reduced motion ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .flg-bunting li, .fl-flag, .is-hoisting .fl-up, .fl-card.is-added { animation: none; }
  .fl-card:hover, .flg-famous__card:hover, .flg-chip:hover { transform: none; }
}
