.hero .hero-character {
  inset: 0 0 0 auto;
  width: 65%;
  border-radius: inherit;
  mask-image: linear-gradient(90deg, transparent, #000 21%);
}

.hero .hero-character :is(img, .krul-portrait-motion) {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 12%;
}

.hero .hero-character img {
  mask-image: none;
  filter: none;
  animation: krul-portrait-sway 12s ease-in-out infinite alternate;
  transform-origin: 50% 40%;
}

.hero .hero-character .krul-portrait-motion {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.hero .hero-character.has-portrait-motion img {
  opacity: 0;
  animation: none;
}

@keyframes krul-portrait-sway {
  from { transform: scale(1.015); }
  to { transform: scale(1.045) translateY(3px); }
}

.krul-side-portraits {
  display: none;
}

@media (min-width: 1280px) {
  body {
    --krul-side-width: clamp(154px, 12vw, 260px);
  }

  main.shell {
    width: min(1280px, calc(100% - 2 * var(--krul-side-width) - 24px));
  }

  .krul-ornament.left-top,
  .krul-ornament.right-top {
    top: 78px;
  }

  .krul-side-portraits {
    position: fixed;
    inset: 76px 0 0;
    z-index: 0;
    display: block;
    pointer-events: none;
  }

  .krul-side-portraits img {
    position: absolute;
    top: 0;
    width: var(--krul-side-width);
    height: 100%;
    object-fit: cover;
    mask-image: linear-gradient(transparent, #000 8%, #000 82%, transparent);
    transform-origin: center 32%;
    animation: krul-side-float 8s ease-in-out infinite;
  }

  .krul-side-left {
    left: 0;
    object-position: 55% center;
    animation-direction: alternate;
  }

  .krul-side-right {
    right: 0;
    object-position: 67% center;
    animation-delay: -3.2s;
    animation-direction: alternate-reverse;
  }
}

@keyframes krul-side-float {
  from { transform: translateY(3px) scale(1.015); }
  to { transform: translateY(-9px) scale(1.04); }
}

.order-chat-launcher {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 90;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #e8a4c9;
  border-radius: 12px;
  background: #3b2445;
  color: #ffe5f3;
  font: 600 14px/1.3 system-ui;
  box-shadow: 0 4px 18px #130a1b99;
}

.order-chat-launcher:hover { background: #51334c; }

body .castle-dock {
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(max(12px, env(safe-area-inset-bottom)) + 52px);
}

body:has(.order-chat-launcher) {
  padding-bottom: calc(max(12px, env(safe-area-inset-bottom)) + 105px);
}

@media (max-width: 700px) {
  .order-chat-launcher {
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 82px);
  }

  body .castle-dock {
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 134px);
  }

  body:has(.order-chat-launcher) {
    padding-bottom: calc(max(8px, env(safe-area-inset-bottom)) + 186px);
  }
}

@media (max-width: 600px) {
  .hero .hero-character {
    inset: 0 0 52px;
    width: auto;
    mask-image: linear-gradient(#000 0 57%, transparent 100%);
  }

  .hero .hero-character :is(img, .krul-portrait-motion) { object-position: center top; }
}

@media (prefers-reduced-motion: reduce) {
  .hero .hero-character img,
  .krul-side-portraits img { animation: none; }
}

/* Interior pages */
body.krul-interior{color-scheme:dark;min-height:100vh;box-sizing:border-box;color:#f2e7ef;background:linear-gradient(110deg,#100d18f7 4%,#1e1425ef 56%,#221323cc),url('/castle/krul-hero.webp') center 26%/cover fixed;background-color:#100d18;font-family:system-ui,sans-serif}
.krul-interior :is(main,section.panel,body>section){background:linear-gradient(135deg,#2c2031f5,#19141ff5);border:1px solid #79586f;border-radius:16px;box-shadow:0 12px 40px #09060d55}
.krul-interior main{padding:clamp(18px,3vw,42px);box-sizing:border-box}
.krul-interior h1,.krul-interior h2{color:#ffe5ef;font-family:Georgia,serif;letter-spacing:-.025em}
.krul-interior h1{font-size:clamp(1.8rem,4vw,3rem)}
.krul-interior a{color:#f3bad6;text-underline-offset:.22em}
.krul-interior :is(input:not([type=checkbox]),textarea,select){background:#18131e;color:#faecf6;border:1px solid #77566f;border-radius:8px}
.krul-interior button{border:1px solid #a87d99;border-radius:8px;background:linear-gradient(#54344d,#392538);color:#fff0fa}
.krul-interior :is(a,button,input,textarea):focus-visible{outline:2px solid #ffc5e2;outline-offset:3px}
.krul-interior nav{display:flex;flex-wrap:wrap;gap:.8rem}
@media(min-width:1280px){
.krul-side-portraits{z-index:-1;overflow:hidden}
.krul-side-portraits img{width:auto;max-width:none;height:96%;top:2%;object-fit:contain;mask-image:linear-gradient(#000 84%,transparent);transform-origin:center}
.krul-side-left{left:0}.krul-side-right{right:0}
main.shell{position:relative;z-index:0}
}
.topbar .brand{color:#ffe2f2;filter:drop-shadow(0 1px 9px #dc83b644)}
#krul-welcome[open]{width:100vw;max-width:100vw!important;height:100dvh;max-height:100dvh!important;box-sizing:border-box;border:0;border-radius:0;display:flex;flex-direction:column;justify-content:center;align-items:center;background:radial-gradient(ellipse at center,#392438,#120f19 74%)}
.welcome-brand .brand,.krul-sign-flight .brand{display:inline-flex;align-items:center;gap:.32em;white-space:nowrap;font:inherit;color:#ffe1ee}
.welcome-brand .brand svg,.krul-sign-flight .brand svg{width:1.2em;height:1.2em}
.krul-sign-flight{position:fixed;inset:auto;margin:0;padding:0;border:0;background:transparent;pointer-events:none;color:#ffe1ee;font:700 clamp(38px,8vw,95px) Georgia,serif;transform-origin:top left;z-index:2000}
.krul-sign-flight::backdrop{background:transparent}
.hero .hero-character img{animation:krul-cinematic 12s ease-in-out infinite alternate;will-change:transform}
@keyframes krul-cinematic{from{transform:scale(1.005)}to{transform:scale(1.035) translateY(-2px)}}
@media(prefers-reduced-motion:reduce){.hero .hero-character img{animation:none}}

/* Keep the central portrait still, including the static and reduced-motion fallbacks. */
.hero .hero-character > img,.hero .hero-character.attentive > img{animation:none!important;transform:none!important;transition:none!important;will-change:auto}
