/* Banner layout and carved appearance are owned by this stylesheet. */
.codex-motto-chiseled {
  --hylian-gold: #d4af37;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: 750px;
  margin: 40px auto 64px;
  padding: 20px;
  position: static;
  float: none;
  clear: both;
  transform: none;
}

.codex-triforce-side,
.codex-text-side {
  position: static;
  inset: auto;
  transform: none;
  float: none;
  min-width: 0;
  box-sizing: border-box;
}

.codex-triforce-side {
  flex: 0 0 140px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 140px;
  height: 120px;
}

.codex-triforce-side svg {
  display: block;
  flex: 0 0 auto;
  width: 140px;
  height: 120px;
  max-width: none;
  overflow: visible;
}

.codex-text-side {
  flex: 1 1 0;
  text-align: left;
}

.codex-text-side svg {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  overflow: visible;
}

.codex-motto-chiseled .chisel-path {
  fill: url(#solidGoldFill);
  stroke: url(#chiseledGoldGrad);
  stroke-width: 3;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.9))
          drop-shadow(0 -1px 1px rgba(255, 225, 140, 0.35));
}

.codex-motto-chiseled .chisel-text {
  font-family: 'Courier New', monospace;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-anchor: middle;
  fill: #0b1110;
  stroke: url(#chiseledGoldGrad);
  stroke-width: 1.1;
  paint-order: stroke;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.95))
          drop-shadow(0 -1px 0.5px rgba(255, 225, 140, 0.45));
}

/* Color-coded carved sacred words */
.codex-motto-chiseled .tri-power { stroke: url(#powerGrad) !important; }
.codex-motto-chiseled .text-power {
  fill: #0b1110 !important;
  stroke: url(#powerGrad) !important;
  paint-order: stroke;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.95))
          drop-shadow(0 -1px 0.5px rgba(255, 160, 140, 0.55));
}

.codex-motto-chiseled .tri-wisdom { stroke: url(#wisdomGrad) !important; }
.codex-motto-chiseled .text-wisdom {
  fill: #0b1110 !important;
  stroke: url(#wisdomGrad) !important;
  paint-order: stroke;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.95))
          drop-shadow(0 -1px 0.5px rgba(140, 210, 255, 0.55));
}

.codex-motto-chiseled .tri-courage { stroke: url(#courageGrad) !important; }
.codex-motto-chiseled .text-courage {
  fill: #0b1110 !important;
  stroke: url(#courageGrad) !important;
  paint-order: stroke;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.95))
          drop-shadow(0 -1px 0.5px rgba(140, 255, 160, 0.55));
}

/* Hide and prep strokes for drawing animation. */
.codex-motto-chiseled .chisel-path {
  fill: url(#solidGoldFill);
  stroke: var(--hylian-gold);
  stroke-width: 1.5px;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  transition: stroke-dashoffset 1.5s ease-out, opacity 0.5s ease-out;
  opacity: 0;
}

.codex-motto-chiseled text {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 22px;
  fill: transparent;
  stroke: var(--hylian-gold);
  stroke-width: 0.8px;
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  transition: stroke-dashoffset 2s ease-out 0.5s, opacity 0.3s ease-out 0.5s;
  opacity: 0;
}

.chisel-courage { stroke: #2ecc71 !important; }
.chisel-wisdom { stroke: #3498db !important; }
.chisel-power { stroke: #e74c3c !important; }

.codex-motto-chiseled.is-carving .chisel-path,
.codex-motto-chiseled.is-carving text {
  stroke-dashoffset: 0;
  opacity: 1;
}

@media(max-width: 768px) {
  .codex-motto-chiseled {
    flex-direction: column;
    text-align: center;
    gap: 20px;
    margin: 20px auto 48px;
  }
  .codex-triforce-side {
    flex: 0 0 auto;
    width: 110px;
    height: 94.286px;
    margin: 0 auto;
  }
  .codex-triforce-side svg {
    width: 110px;
    height: 94.286px;
  }
  .codex-text-side {
    flex: 0 0 auto;
    width: 100%;
    text-align: center;
  }
}

@media(prefers-reduced-motion:reduce) {
  .codex-motto-chiseled .chisel-path,
  .codex-motto-chiseled text {
    stroke-dashoffset: 0 !important;
    opacity: 1 !important;
    transition: none !important;
  }
}

/* Decorative royal banners: empty pseudo-elements have no accessible text.
   Dedicated grid columns reserve space instead of overlaying the content. */
@media(min-width: 901px) {
  #codex > .wrap {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) 120px;
    column-gap: 24px;
    max-width: 1408px;
  }
  #codex > .wrap > * {
    grid-column: 2;
    min-width: 0;
  }
  #codex > .wrap > .codex-motto-chiseled { grid-row: 1; }
  #codex > .wrap > .section-head { grid-row: 2; flex-wrap: wrap; }
  #codex > .wrap > .two { grid-row: 3; }
  #codex > .wrap > .virtues { grid-row: 4; }
  #codex > .wrap::before,
  #codex > .wrap::after {
    content: '';
    display: block;
    grid-row: 2 / 4;
    align-self: start;
    justify-self: center;
    width: 120px;
    height: 240px;
    background: url('Hyrule_Emblem.png') center top / contain no-repeat;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .65))
            drop-shadow(0 0 4px rgba(212, 175, 55, .12));
    pointer-events: none;
    user-select: none;
  }
  #codex > .wrap::before { grid-column: 1; }
  #codex > .wrap::after { grid-column: 3; }
}

@media(max-width: 900px) {
  #codex > .wrap::before,
  #codex > .wrap::after {
    content: none;
    display: none;
  }
}
