/*
  mesh-stage1.css — single canonical Stage 1 stylesheet.

  Loaded by every mesh.* TLD bootstrap (mesh.wiki, mesh.art, mesh.city,
  …) so the inline Stage 1 paint can render hero + tab strip + status
  pill BEFORE the heavy m-mask-renderer.mutual + m-mask-header.mutual
  + m-mask-tabs.mutual finish downloading and parsing.

  Authoritative source for the selectors below — m-mask-header.mutual,
  m-mask-tabs.mutual and m-mask-renderer.mutual reference the same
  rules either by linking to this file or by maintaining a marked
  duplicate. When you edit a Stage 1 selector here, search the three
  mutuals above for the same selector and update both, or drop the
  mutual copy entirely.
*/

/* ── Hero scaffold (subset of m-mask-header.mutual's .profile-* basics).
   Just enough to make a single-image hero render correctly. The
   collage / credit overlay / initials / metarow / geo styles stay
   in m-mask-header.mutual since they're only needed once the
   mutual is loaded. */

.m-mask-stage1-skeleton { max-width: 980px; margin: 0 auto; padding: 1.6rem 1rem 1rem; }
.m-mask-stage1-skeleton .profile-section { margin: 1.5rem 0 1rem; }
.m-mask-stage1-skeleton .profile-back {
  display: inline-flex; align-items: center; gap: .35rem;
  margin: 0 0 .8rem;
  font-size: .86rem; color: #5a5a5a; text-decoration: none; line-height: 1.4;
}
.m-mask-stage1-skeleton .profile-back:hover { color: #1a1a1a; }
.m-mask-stage1-skeleton .profile-header { display: flex; gap: 2rem; margin: 0; align-items: flex-start; }
.m-mask-stage1-skeleton .profile-img-stack {
  position: relative;
  width: 340px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #d5d0c9;
  box-shadow: 0 6px 28px rgba(0, 0, 0, .12);
}
.m-mask-stage1-skeleton .profile-img-stack img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
/* The hero image is clickable from the first paint — the bootstrap
   wires a delegated click handler that opens MeshLightbox even
   with a single image. Cursor cue matches what the mutual sets
   after Stage 3 takes over. */
.m-mask-stage1-skeleton .profile-img-stack .profile-img-lead { cursor: zoom-in; }
.m-mask-stage1-skeleton .profile-info { min-width: 0; flex: 1; }
.m-mask-stage1-skeleton .profile-info .role {
  font-size: .72rem; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: #8b6914; margin-bottom: .4rem;
  font-family: "Lato", sans-serif;
}
.m-mask-stage1-skeleton .profile-info h1 {
  font-family: "Lato", sans-serif;
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 900; color: #1a1a1a;
  margin: 0 0 .3rem; line-height: 1.1;
}
.m-mask-stage1-skeleton .profile-info .subtitle {
  font-size: 1rem; color: #3a3a3a; font-style: italic;
  margin: 0 0 .6rem; line-height: 1.4;
}

/* ── Single-pane body (no real tab switching — the static strip
   shows one active "About" tab). */
.m-mask-stage1-skeleton .stage1-pane { display: block; position: relative; }
.m-mask-stage1-skeleton .stage1-extract { font-size: 1rem; line-height: 1.65; color: #2a2a2a; }
.m-mask-stage1-skeleton .stage1-extract p { margin: 0 0 .8rem; }

/* ── Tab strip — visual copy of m-mask-tabs's .aet-tabs.
   Once the mutual mounts later, its rules redefine the same selectors
   with identical values (same source). */
.m-mask-stage1-skeleton .aet-tabs {
  display: flex; flex-wrap: wrap; gap: 0;
  border-bottom: 2px solid rgba(139, 105, 20, .1);
  margin: 1.6rem 0 1.4rem;
}
.m-mask-stage1-skeleton .aet-tab {
  padding: .6rem 1.2rem;
  font-family: inherit; font-size: .72rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: #8a8a8a;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  white-space: nowrap;
}
.m-mask-stage1-skeleton .aet-tab.active {
  color: #8b6914; border-bottom-color: #8b6914;
}
/* Skeleton tab placeholders — show next to the active "About" tab so
   the strip communicates "more tabs are coming" while Stage 2
   composes. Same height as a real .aet-tab; shimmer fills the slot
   where the label will be. */
.m-mask-stage1-skeleton .aet-tab-skeleton {
  padding: .6rem 1.2rem;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  display: inline-flex; align-items: center;
}
.m-mask-stage1-skeleton .aet-tab-skeleton .sk-bar {
  height: 10px; border-radius: 3px;
}

/* ── "Composing more content" status pill — copy of the rules
   m-mask-renderer.mutual's ensureStageStatusCss() injects. */
.m-mask-stage1-skeleton .m-mask-stage-status {
  display: inline-flex; align-items: center; gap: .45rem;
  margin: 1.4rem 0 0;
  padding: .32rem .72rem;
  border-radius: 999px;
  background: rgba(139, 105, 20, .06);
  border: 1px solid rgba(139, 105, 20, .16);
  color: #6a6253;
  font: 500 .74rem/1 Inter, -apple-system, sans-serif;
  letter-spacing: .02em;
  pointer-events: none;
}
.m-mask-stage1-skeleton .m-mask-stage-spin {
  display: inline-block;
  width: 11px; height: 11px;
  border: 1.6px solid rgba(139, 105, 20, .18);
  border-top-color: rgba(139, 105, 20, .7);
  border-radius: 50%;
  animation: m-mask-stage-spin .9s linear infinite;
}
@keyframes m-mask-stage-spin { to { transform: rotate(360deg); } }

/* Error variant — same pill shape, red tint, no spinner, retry button.
   Used in place of the "composing more content" pill when something
   failed AFTER an earlier stage already painted (a full-page error
   would throw away the content the reader already sees). */
.m-mask-stage1-skeleton .m-mask-stage-status.is-error {
  background: rgba(196, 73, 56, .08);
  border-color: rgba(196, 73, 56, .28);
  color: #8a3326;
  pointer-events: auto;
}
.m-mask-stage1-skeleton .m-mask-stage-status.is-error .m-mask-stage-icon {
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: rgba(196, 73, 56, .85);
  flex-shrink: 0;
}
.m-mask-stage1-skeleton .m-mask-stage-status.is-error .m-mask-stage-retry {
  margin-left: .55rem;
  padding: .12rem .6rem;
  font: 600 .68rem/1 inherit;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  background: #8a3326;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s;
}
.m-mask-stage1-skeleton .m-mask-stage-status.is-error .m-mask-stage-retry:hover {
  background: #6e2a20;
}

/* ── Hero meta-row skeleton. Sits inside .profile-info below the
   subtitle, holding the layout slot that Stage 2's .profile-meta
   (Born / Died / Country / Population …) will eventually fill. Each
   row pairs a short label-shaped bar with a longer value-shaped
   bar, mirroring m-mask-header's "Label: Value" structure. */
.m-mask-stage1-skeleton .profile-meta-skeleton {
  margin-top: .85rem;
  display: flex; flex-direction: column; gap: .35rem;
}
.m-mask-stage1-skeleton .profile-meta-skeleton .sk-row {
  display: flex; align-items: center; gap: .55rem;
}
.m-mask-stage1-skeleton .profile-meta-skeleton .sk-label {
  width: 64px; height: 11px; border-radius: 3px;
}
.m-mask-stage1-skeleton .profile-meta-skeleton .sk-value {
  height: 11px; border-radius: 3px;
}

/* ── License box + composition-evidence skeleton. The renderer's
   m-license-grant-and-composition-evidence mutual paints these at
   the bottom of the article during Stage 2 (warm-tinted licence
   block + collapsible "evidence" panel). We hold their layout slots
   during Stage 1 with shimmer placeholders that match the visual
   shape of the real boxes, so the page bottom never looks abruptly
   truncated and Stage 2 fills the existing rectangles. */
.m-mask-stage1-skeleton .stage1-licence-skeleton {
  margin: 2rem 0 0;
  padding: .85rem 1.1rem;
  background: rgba(139, 105, 20, .04);
  border-left: 2px solid rgba(139, 105, 20, .18);
  border-radius: 4px;
  display: flex; flex-direction: column; gap: .45rem;
}
.m-mask-stage1-skeleton .stage1-licence-skeleton .sk-bar { height: 11px; border-radius: 3px; }

.m-mask-stage1-skeleton .stage1-evidence-skeleton {
  margin: 1.5rem 0 2rem;
  border-top: 1px solid rgba(139, 105, 20, .12);
  padding-top: 1.2rem;
  display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap;
}
.m-mask-stage1-skeleton .stage1-evidence-skeleton .sk-bar { height: 11px; border-radius: 3px; }
.m-mask-stage1-skeleton .stage1-evidence-skeleton .sk-pill {
  height: 18px; border-radius: 16px; margin-left: auto;
}

/* ── Skeleton shimmer — only used during the Stage 1 paint, no
   counterpart in the mutuals. */
.sk-bar {
  background: linear-gradient(90deg, rgba(0, 0, 0, .045) 25%, rgba(0, 0, 0, .085) 50%, rgba(0, 0, 0, .045) 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
  display: block;
}
.sk-block {
  background: linear-gradient(90deg, rgba(0, 0, 0, .045) 25%, rgba(0, 0, 0, .085) 50%, rgba(0, 0, 0, .045) 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
  width: 100%; height: 100%;
}
@keyframes sk-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Friendly error block. Replaces the skeleton when Stage 1 REST
   fails (Wikipedia returns 4xx/5xx, network out, body not JSON).
   Plain language ("Couldn't load this article right now"), single
   retry action, no error codes or stack traces — those go to the
   dev console. */
.m-mask-stage1-skeleton .stage1-error {
  margin: 3rem auto;
  max-width: 540px;
  padding: 1.6rem 1.8rem;
  background: rgba(139, 105, 20, .04);
  border: 1px solid rgba(139, 105, 20, .18);
  border-radius: 8px;
  text-align: center;
  font-family: inherit;
}
.m-mask-stage1-skeleton .stage1-error h2 {
  margin: 0 0 .55rem;
  font-family: "Lato", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #3a3a3a;
}
.m-mask-stage1-skeleton .stage1-error p {
  margin: 0 0 1.1rem;
  font-size: .88rem;
  line-height: 1.55;
  color: #5a5a5a;
}
.m-mask-stage1-skeleton .stage1-error button {
  display: inline-block;
  padding: .5rem 1.1rem;
  font: 600 .8rem/1 "Lato", sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  background: #8b6914;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s;
}
.m-mask-stage1-skeleton .stage1-error button:hover { background: #6f5310; }

/* ── Mobile. */
@media (max-width: 768px) {
  .m-mask-stage1-skeleton .profile-header { flex-direction: column; align-items: center; text-align: center; }
  .m-mask-stage1-skeleton .profile-img-stack { width: min(280px, 86vw); }
  .m-mask-stage1-skeleton .aet-tab { padding: .5rem .8rem; font-size: .65rem; }
}
