/* crest: cloned from Manodo Home 06 Crest.dc.html. Generated by tools/clone.js. */

/* The brief's own ground, which is what the design was drawn on.
 *
 * Two vocabularies on purpose. The brief's markup reads its own names (--desk,
 * --bord, --papermut); the site's chrome, the shared sections appended under
 * the brief, hover states and focus outlines read the site's names
 * (--accent-ink, --on-accent, --line-2, --well). The first cut of this block
 * carried only the brief's names, and every consumer of the other vocabulary
 * quietly resolved to nothing: hovers that never changed, buttons whose text
 * did not paint, wells with no ground. A palette is only a palette here if
 * BOTH vocabularies resolve, and the site's names are derived from the brief's
 * own values so the two cannot disagree.
 *
 * Deliberately NOT :root-scoped. On a normal page these attributes sit on the
 * html element and nothing changes; on the sampler, one page carries all seven
 * themes at once, each section wrapped in a div bearing its own theme's
 * data-design and data-palette, and custom properties cascade from whatever
 * element defines them. :root would have pinned every theme's colours to the
 * one document. */
[data-design="crest"][data-palette="own"] {
  --paper: #F6F1E7;
  --ink: #2B1D2E;
  --accent: #7B2D43;
  --accent2: #C89AA6;
  --desk: #EAE4DC;
  --line: #DED8D1;
  --bord: #C1BAB7;
  --faint: #B5ADAC;
  --strike: #A59C9D;
  --mut: #6C6169;
  --soft: #584C57;
  --papermut: #BDB6B3;
  --pmut2: #9D9496;
  --stone: #DAD3CD;
  --inkline: #453946;
  --glass: rgba(246,241,231,0.94);
  --scrim: rgba(43,29,46,0.72);
  --paper-2:   color-mix(in srgb, var(--paper) 55%, var(--desk));
  --paper-3:   var(--desk);
  --well:      var(--stone);
  --well-dim:  color-mix(in srgb, var(--stone) 82%, var(--ink));
  --ink-2:     var(--inkline);
  --line-2:    var(--bord);
  --accent-2:  var(--accent2);
  --accent-ink: var(--accent);
  --on-accent: var(--paper);
}

/* The brief's own base rules, which lived in its <helmet> and were otherwise
   lost with it: the desk tone outside the sheet, and plain ink links that turn
   accent on hover. Scoped to the cloned surfaces (the chrome and the brief's
   own unclassed sections); the shared sections keep the site's styling, and
   anything the brief set inline still wins outright. */
:root[data-design="crest"] body { background: var(--paper-3); }
[data-design="crest"] :is(header, footer, section:not([class])) a { color: var(--ink); text-decoration: none; }
[data-design="crest"] :is(header, footer, section:not([class])) a:hover { color: var(--accent); }

/* The same names, driven by whichever of the 24 palettes is chosen, so the
   colour switcher works on cloned markup without touching a single style="". */
[data-design="crest"]:not([data-palette="own"]) {
  --accent2: var(--accent-2);
  --desk: var(--paper-3);
  --bord: var(--line-2);
  --papermut: var(--faint);
  --pmut2: var(--strike);
  --inkline: var(--ink-2);
  --glass: color-mix(in srgb, var(--paper) 94%, transparent);
  --scrim: color-mix(in srgb, var(--ink) 72%, transparent);
}

/* style-hover="..." is an authoring attribute no browser implements. These are
   the brief's own hover declarations, moved into rules that actually fire. */
[data-design="crest"] .dc-crest-h0:hover { background: var(--accent); color: var(--paper) }
[data-design="crest"] .dc-crest-h1:hover { border-color: var(--ink) }
[data-design="crest"] .dc-crest-h2:hover { background: var(--accent2) }
[data-design="crest"] .dc-crest-h3:hover { background: var(--accent); color: var(--paper) }
[data-design="crest"] .dc-crest-h4:hover { border-color: var(--ink) }

/* The ambient layer: above the sheet's own ground, below everything on it. */
[data-design="crest"] .dc-orn {
  position: absolute; inset: 0; overflow: hidden;
  pointer-events: none; z-index: -1;
}
/* An inserted ornament band clips its own overhang so a vine that runs off the
   edge cannot widen the page. */
[data-design="crest"] .dc-ins { overflow: hidden; }


/* -- the ambient ground ---------------------------------------------------
   Two counter-blooms, one at the head of the sheet and one at the foot, both
   turned down well under the copy. bloom() already counter-rotates its own
   pair; the speeds here are halved again so the whole thing reads as a slow
   procession rather than as a wheel. */
[data-design="crest"] .dc-crest-veil { position: absolute; left: 0; right: 0; overflow: hidden; }
[data-design="crest"] .dc-crest-veil--head { top: 0; height: 68%; }
[data-design="crest"] .dc-crest-veil--foot { bottom: 0; height: 58%; }

/* -- konia: the two corner pieces that frame the top of the sheet ---------- */
[data-design="crest"] .dc-orn .dc-crest-konia {
  position: absolute; display: block;
  width: clamp(66px, 9.5vw, 148px); aspect-ratio: 1;
  opacity: calc(.11 * var(--pattern-intensity, 1));
}
[data-design="crest"] .dc-orn .dc-crest-konia--tl {
  inset: clamp(10px, 1.6vw, 24px) auto auto clamp(10px, 1.6vw, 24px);
}
[data-design="crest"] .dc-orn .dc-crest-konia--tr {
  inset: clamp(10px, 1.6vw, 24px) clamp(10px, 1.6vw, 24px) auto auto;
}
[data-design="crest"] .dc-orn .dc-crest-konia svg {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  animation: dc-crest-glow 58s ease-in-out infinite;
}
[data-design="crest"] .dc-orn .dc-crest-konia--tr svg { animation-delay: -29s; }

/* -- the bel, set after the calendar ---------------------------------------
   One wine stroke that travels the border: dasharray 1000 against the
   pathLength the engine stamps on every stroked path, offset walked from 1000
   to 0 and on out to -1000 so the tail leaves the way the head arrived. Slow,
   because this design does not hurry. */
[data-design="crest"] .dc-crest-bel {
  padding: clamp(14px, 2.2vw, 30px) clamp(48px, 8.33vw, 120px) clamp(4px, 0.9vw, 12px);
}
[data-design="crest"] .dc-crest-bel .belband > span {
  opacity: calc(.72 * var(--pattern-intensity, 1));
}
[data-design="crest"] .dc-crest-bel .belband svg {
  height: clamp(34px, 4.4vw, 68px);
}
[data-design="crest"] .dc-crest-bel .kl-line {
  stroke-dasharray: 1000;
  animation: dc-crest-draw 44s cubic-bezier(.42, 0, .36, 1) infinite;
}
[data-design="crest"] .dc-crest-bel .kl-line--under { animation-delay: -1.8s; }

/* -- the medallion divider, set after the ink band -------------------------
   Centred, because the whole design is. A twelve fold mandala turning as one
   piece between two hairlines that breathe with it. */
[data-design="crest"] .dc-crest-medal {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(16px, 2.6vw, 40px);
  padding: clamp(30px, 5vw, 72px) clamp(48px, 8.33vw, 120px);
}
[data-design="crest"] .dc-crest-medal__rule {
  display: block; flex: 1 1 0; max-width: 26ch; height: 1px;
  background: linear-gradient(to right,
    color-mix(in srgb, var(--accent) 0%, transparent),
    color-mix(in srgb, var(--accent) 52%, transparent));
  animation: dc-crest-glow 34s ease-in-out infinite;
}
[data-design="crest"] .dc-crest-medal__rule:last-child {
  background: linear-gradient(to left,
    color-mix(in srgb, var(--accent) 0%, transparent),
    color-mix(in srgb, var(--accent) 52%, transparent));
  animation-delay: -17s;
}
[data-design="crest"] .dc-crest-medal__disc {
  display: block; flex: 0 0 auto;
  width: clamp(112px, 17vw, 224px); aspect-ratio: 1;
  opacity: calc(.82 * var(--pattern-intensity, 1));
  animation: dc-crest-turn 300s linear infinite;
}
[data-design="crest"] .dc-crest-medal__disc svg { width: 100%; height: 100%; display: block; }
/* Every band on the same clock and the same direction: ceremonial means the
   whole thing turns together, not that its rings drift against each other. */
[data-design="crest"] .dc-crest-medal__disc .mz { animation: dc-crest-turn 460s linear infinite; }
[data-design="crest"] .dc-crest-medal__disc .mz-rings { animation: dc-crest-glow 40s ease-in-out infinite; }

@keyframes dc-crest-turn { to { transform: rotate(360deg); } }
@keyframes dc-crest-glow { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes dc-crest-draw {
  0%   { stroke-dashoffset: 1000; }
  34%  { stroke-dashoffset: 0; }
  68%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -1000; }
}

/* A drawing that never finishes is a line nobody ever sees, so stopped motion
   gets the finished ornament rather than a frozen fragment of it. */
@media (prefers-reduced-motion: reduce) {
  [data-design="crest"] .dc-crest-medal__disc,
  [data-design="crest"] .dc-crest-medal__disc .mz,
  [data-design="crest"] .dc-crest-medal__disc .mz-rings,
  [data-design="crest"] .dc-crest-medal__rule,
  [data-design="crest"] .dc-orn .dc-crest-konia svg,
  [data-design="crest"] .dc-crest-bel .kl-line {
    animation: none !important; transform: none !important; opacity: 1 !important;
  }
  [data-design="crest"] .dc-crest-bel .kl-line {
    stroke-dasharray: none !important; stroke-dashoffset: 0 !important;
  }
}

