/* Appily thirtyeight — Field Codex policy */

.page-policy-sprout {
  --lab-ink: #0E241C;
  --lab-deep: #063D36;
  --lab-teal: #0F6B5C;
  --lab-mint: #7ED9B8;
  --lab-chart: #D6FF4B;
  --lab-coral: #FF5C35;
  --lab-paper: #F5FAF7;
  --lab-mist: #E3EFE8;
  --lab-line: rgba(14, 36, 28, 0.12);
  --font-display: "Syne", "Avenir Next", sans-serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
  --a38-ink: var(--lab-ink);
  --a38-muted: #4A6358;
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse 70% 35% at 18% 0%, rgba(126, 217, 184, 0.16), transparent 50%),
    linear-gradient(180deg, var(--lab-paper) 0%, #eef6f1 100%);
}

.page-policy-sprout .page-main { padding-top: 0; }

.a38-codex { padding-bottom: 3.5rem; }

/* ── Hero ── */
.a38-codex-hero {
  position: relative;
  isolation: isolate;
  padding: 2.3rem 0 2.85rem;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(214, 255, 75, 0.07) 25%, transparent 25.5%) 0 0 / 36px 36px,
    linear-gradient(155deg, var(--lab-deep) 0%, #0a5248 48%, #0d6b5c 100%);
  clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
}

.a38-codex-mesh {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.a38-codex-orb {
  position: absolute;
  border-radius: 42% 58% 50% 50% / 48% 40% 60% 52%;
  filter: blur(44px);
  opacity: 0.42;
  animation: a38CodexMorph 15s ease-in-out infinite;
}
.a38-codex-orb--1 {
  width: 280px; height: 280px;
  top: -80px; right: 8%;
  background: rgba(214, 255, 75, 0.4);
}
.a38-codex-orb--2 {
  width: 220px; height: 220px;
  bottom: -50px; left: 6%;
  background: rgba(255, 92, 53, 0.28);
  animation-delay: -6s;
}
@keyframes a38CodexMorph {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-14px, 12px) scale(1.08); }
}

.a38-codex-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 1.75rem;
  align-items: center;
}

.a38-codex-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  padding: 0.32rem 0.7rem 0.32rem 0.4rem;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lab-deep);
  background: var(--lab-chart);
  border-radius: 3px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.18);
}
.a38-codex-spark {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--lab-deep);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  animation: a38CodexSpark 1.8s ease-in-out infinite;
}
@keyframes a38CodexSpark {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(0.7) rotate(45deg); }
}

.a38-codex-hero-copy h1 {
  margin: 0 0 0.7rem;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.7rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.04em;
  max-width: 16ch;
}

.a38-codex-lede {
  margin: 0;
  max-width: 46ch;
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
}

.a38-codex-badge {
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 120px;
  padding: 1.15rem 1.25rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px 4px 12px 4px;
  backdrop-filter: blur(10px);
  box-shadow: 5px 5px 0 rgba(214, 255, 75, 0.35);
  animation: a38CodexSettle 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes a38CodexSettle {
  from { opacity: 0; transform: translateY(18px) rotate(2deg); }
  to { opacity: 1; transform: none; }
}
.a38-codex-badge > span {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}
.a38-codex-badge strong {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--lab-chart);
  line-height: 1;
}
.a38-codex-badge em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.6);
}

/* ── Body ── */
.a38-codex-body {
  position: relative;
  z-index: 2;
  margin-top: -1.1rem;
  max-width: 1100px;
}

.a38-codex-stage {
  display: grid;
  grid-template-columns: minmax(240px, 0.78fr) minmax(0, 1.22fr);
  gap: 1.25rem;
  align-items: start;
}

.a38-codex-tag {
  display: inline-block;
  margin-bottom: 0.35rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lab-deep);
  background: var(--lab-chart);
  border-radius: 3px;
}
.a38-codex-tag--on-dark {
  color: var(--lab-chart);
  background: rgba(214, 255, 75, 0.18);
}

/* Rail */
.a38-codex-rail {
  position: sticky;
  top: calc(var(--a38-header-offset, 120px) + 0.75rem);
  padding: 1.2rem 1.15rem 1.25rem;
  background: linear-gradient(160deg, var(--lab-deep) 0%, #0a5248 100%);
  color: #fff;
  border-radius: 12px 4px 12px 4px;
  box-shadow: 5px 5px 0 var(--lab-chart);
  animation: a38CodexSettle 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.a38-codex-rail h2 {
  margin: 0.35rem 0 0.95rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.a38-codex-rail-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.a38-codex-tab {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: center;
  padding: 0.7rem 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none !important;
  transition: transform 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
}
.a38-codex-tab:hover {
  transform: translateX(3px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(214, 255, 75, 0.35);
  color: #fff;
}
.a38-codex-tab.is-active {
  background: rgba(214, 255, 75, 0.14);
  border-color: rgba(214, 255, 75, 0.45);
  box-shadow: 3px 3px 0 rgba(214, 255, 75, 0.35);
  color: #fff;
}
.a38-codex-tab-num {
  display: inline-grid;
  place-items: center;
  min-width: 1.7rem;
  height: 1.7rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--lab-deep);
  background: var(--lab-chart);
  border-radius: 4px;
}
.a38-codex-tab-label {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3;
}

.a38-codex-rail-foot {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.a38-codex-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.9rem;
  border-radius: 4px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.2s, background 0.2s, color 0.2s, border-color 0.2s;
}
.a38-codex-btn--ghost {
  color: #fff;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.28);
  width: 100%;
}
.a38-codex-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--lab-chart);
  color: var(--lab-chart);
  transform: translateY(-1px);
}

/* Sheet */
.a38-codex-sheet {
  background: #fff;
  border: 1px solid var(--lab-line);
  border-radius: 4px 16px 4px 16px;
  box-shadow: 0 20px 48px rgba(6, 61, 54, 0.08);
  overflow: hidden;
  position: relative;
  animation: a38CodexSettle 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
}
.a38-codex-sheet::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--lab-teal), var(--lab-chart), var(--lab-coral));
}

.a38-codex-sheet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 1.15rem 1.4rem 0.5rem;
}
.a38-codex-sheet-meta {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--a38-muted);
}

.a38-codex-content {
  padding: 0.5rem 1.4rem 1.6rem;
  color: var(--lab-ink);
}

.a38-codex-content h1 {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.8vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--lab-deep);
}

.a38-codex-content .last-updated {
  margin: 0 0 1.35rem;
  padding-bottom: 0.95rem;
  border-bottom: 1px dashed var(--lab-line);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--a38-muted);
}

.a38-codex-content h2 {
  position: relative;
  margin: 1.6rem 0 0.7rem;
  padding-left: 0.85rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--lab-ink);
}
.a38-codex-content h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2em;
  bottom: 0.2em;
  width: 4px;
  border-radius: 2px;
  background: var(--lab-chart);
  box-shadow: 2px 0 0 rgba(6, 61, 54, 0.12);
}

.a38-codex-content p {
  margin: 0 0 0.85rem;
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--a38-muted);
}
.a38-codex-content p:last-child { margin-bottom: 0; }
.a38-codex-content strong { color: var(--lab-ink); }

.a38-codex-content ul {
  margin: 0 0 0.95rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.a38-codex-content li {
  position: relative;
  padding: 0.7rem 0.85rem 0.7rem 1.85rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--a38-muted);
  background: var(--lab-paper);
  border: 1px solid var(--lab-line);
  border-radius: 8px;
}
.a38-codex-content li::before {
  content: "";
  position: absolute;
  left: 0.75rem;
  top: 1em;
  width: 0.4rem;
  height: 0.4rem;
  background: var(--lab-chart);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
.a38-codex-content a {
  color: var(--lab-teal);
  font-weight: 700;
  text-underline-offset: 2px;
}
.a38-codex-content a:hover { color: var(--lab-deep); }

/* Responsive */
@media (max-width: 960px) {
  .a38-codex-hero-grid { grid-template-columns: 1fr; }
  .a38-codex-hero-copy h1 { max-width: none; }
  .a38-codex-badge { justify-self: start; }
  .a38-codex-stage { grid-template-columns: 1fr; }
  .a38-codex-rail { position: static; }
  .a38-codex-rail-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .a38-codex-hero { clip-path: polygon(0 0, 100% 0, 100% 94%, 0 100%); }
}

@media (max-width: 640px) {
  .a38-codex-rail-list { grid-template-columns: 1fr; }
  .a38-codex-content { padding: 0.35rem 1.05rem 1.3rem; }
  .a38-codex-sheet-head { padding: 1rem 1.05rem 0.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .a38-codex-orb,
  .a38-codex-spark,
  .a38-codex-badge,
  .a38-codex-rail,
  .a38-codex-sheet {
    animation: none;
  }
}
