/* /little-everything — the example-children page (spec 098). This page's own
   stylesheet; it reuses main.css's shared tokens (--ink, --font, --radius,
   .btn, .field/.hint/.error from field-copy.js's buildField(), and the
   .plate-canvas box /make already ships) rather than redeclaring them. */

.little-everything-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 24px 96px;
}

.le-intro {
  max-width: 640px;
  margin: 0 0 32px;
}

.le-intro h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.1;
}

.le-lede {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--ink);
}

/* Sits below the scenes, the last thing on the page: when the module shows or
   hides it, nothing the visitor is looking at moves (WEB_BUILD_GUIDE.md §3's
   CLS budget). */
.le-placeholder-note {
  margin: 28px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: #fff4d6;
  border: 2px solid #e8c460;
  font-size: 0.95rem;
  line-height: 1.5;
}

.le-placeholder-note[hidden] {
  display: none;
}

/* The module mounts the field into this box; its resting height (the label's
   line with its "i", 6px, the 56px input: 89.2px at 375px and 1440px wide) is
   held here so the chooser and scenes below do not move when it arrives
   (WEB_BUILD_GUIDE.md §3's CLS budget). */
.le-name-field {
  max-width: 360px;
  min-height: 90px;
  margin: 0 0 36px;
}

.le-chooser {
  margin: 0 0 40px;
}

/* Set like the name field's label above it (main.css `.field > .field-label`):
   the body face at body size, bold. */
.le-chooser-heading {
  margin: 0 0 10px;
  font: inherit;
  font-weight: 700;
}

.le-chooser-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
  max-width: 720px;
  /* One row of tiles at their resting height; the four tiles stop fitting one
     row below a 468px viewport, where the grid wraps to two. */
  min-height: 118px;
}

@media (max-width: 467px) {
  .le-chooser-tiles {
    min-height: 248px;
  }
}

.le-chooser-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  min-height: 56px;
  border: 3px solid transparent;
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition:
    border-color 300ms ease,
    transform 300ms ease;
}

.le-chooser-tile:hover {
  transform: translateY(-2px);
}

.le-chooser-tile:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.le-chooser-tile[aria-pressed='true'] {
  border-color: var(--ink);
}

.le-chooser-tile img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: calc(var(--radius) / 2);
}

.le-chooser-label {
  font-size: 0.85rem;
  text-align: center;
  line-height: 1.3;
}

.le-scenes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
}

.le-scene {
  margin: 0;
}

/* The box is final before any image, placeholder or real, paints into it:
   the aspect-ratio is set inline per scene from the manifest's own canvas
   (WEB_BUILD_GUIDE.md §3's CLS budget). */
.le-plate-box {
  background: #1a1a1a;
}

/* Every mounted plate starts hidden; `createCompositeController` reveals the
   chosen child's after its decode gate. A switch fades the incoming plate in
   over the outgoing one, which stays opaque (`.is-leaving`) until the fade
   has landed, so the dark box behind never shows through mid-swap
   (WEB_BUILD_GUIDE.md §5). 360ms pairs with PLATE_FADE_MS in the module and
   with make-stack-swap.js's own default (docs/motion-principles.md). */
.le-plate {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 360ms ease;
}

.le-plate.is-leaving {
  z-index: 1;
  opacity: 1;
  transition: none;
}

.le-plate.is-visible {
  z-index: 2;
  opacity: 1;
}

.le-cover-title {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 3;
  margin: 0;
  padding: 26px 24px 44px;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--ink);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--paper-raised) 94%, transparent) 0%,
    color-mix(in srgb, var(--paper-raised) 82%, transparent) 55%,
    transparent 100%
  );
}

.le-cover-title em {
  font-style: inherit;
  font-weight: inherit;
  color: inherit;
}

.le-caption {
  min-height: calc(2 * 1.55 * 0.95rem);
  margin: 10px 2px 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
}

/* The label's one line: the words at the left, the "i" at the right edge,
   over the input's right edge. The field's resting height is unchanged. */
.le-name-field .field > .field-label {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

/* The name field's length limit: a small "i", its tip shown on hover above
   it. */
.le-info {
  position: relative;
  /* The circle shares the label's baseline, raised 1px; the padding centres
     the "i" in the circle (measured with the body face). */
  top: -1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: auto;
  padding-top: 2px;
  border: 1.5px solid var(--ink-soft);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink-soft);
  cursor: help;
}

.le-info-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  /* Right-aligned to the "i", which sits at the field's right edge, so the
     tip opens leftward and never past the page's edge. */
  right: -4px;
  z-index: 5;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 150ms ease,
    visibility 150ms;
  pointer-events: none;
}

.le-info:hover .le-info-tip {
  opacity: 1;
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .le-plate,
  .le-chooser-tile,
  .le-info-tip {
    transition: none;
  }
}
