/*
  ROI Case Study Template — Tailark hero-section/one (1:1 structure)
  Scope: body.roi-case-study-template only
*/

@media (prefers-reduced-motion: no-preference) {
  html:has(body.roi-case-study-template) {
    scroll-behavior: smooth;
  }
}

@property --border-angle {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0turn;
}

@keyframes rcst-border-spin {
  to { --border-angle: 1turn; }
}

body.roi-case-study-template {
  --rcst-primary: #4f46e5;
  --rcst-primary-hover: #4338ca;
  --rcst-claude: #d97757;
  --rcst-foreground: #09090b;
  --rcst-muted: #71717a;
  --rcst-border: rgba(9, 9, 11, 0.1);
  --rcst-surface: rgba(9, 9, 11, 0.05);

  margin: 0;
  padding: 0;
  background: #f6f0e9;
  color: var(--rcst-foreground);
  font-family: var(--ds-font-body);
}

body.roi-case-study-template .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.roi-case-study-template .rcst-main {
  background: #f6f0e9;
}

/* ── Sticky bar (shared with prototype-ready) ───────────────────── */
body.roi-case-study-template .pr-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 247, 244, 0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.875rem 0;
}

body.roi-case-study-template .pr-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 90%;
  max-width: 1040px;
  margin: 0 auto;
}

body.roi-case-study-template .pr-bar__wordmark {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 0;
}

body.roi-case-study-template .pr-bar__wordmark img {
  display: block;
  width: 69px;
  height: 20px;
  transition: filter 0.2s ease;
}

body.roi-case-study-template .pr-bar__wordmark:hover {
  opacity: 0.65;
}

body.roi-case-study-template .pr-bar__meta {
  font-family: var(--ds-font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ds-color-muted);
  text-align: center;
  transition: color 0.2s ease;
}

body.roi-case-study-template .pr-bar__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  background: #000000;
  color: #ffffff !important;
  border: 1px solid #000000;
  font-family: var(--ds-font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

body.roi-case-study-template .pr-bar__cta:visited,
body.roi-case-study-template .pr-bar__cta:focus,
body.roi-case-study-template .pr-bar__cta:focus-visible,
body.roi-case-study-template .pr-bar__cta:active,
body.roi-case-study-template .pr-bar__cta:hover {
  color: #ffffff !important;
  text-decoration: none;
}

body.roi-case-study-template .pr-bar__cta:hover {
  background: #1a1a1a;
}

body.roi-case-study-template .pr-bar--on-dark .pr-bar__wordmark img {
  filter: invert(1);
}

body.roi-case-study-template .pr-bar--on-dark .pr-bar__meta {
  color: rgba(255, 255, 255, 0.75);
}

body.roi-case-study-template .pr-bar--on-dark .pr-bar__cta,
body.roi-case-study-template .pr-bar--on-dark .pr-bar__cta:visited {
  background: #ffffff;
  color: #000000 !important;
  border-color: #ffffff;
}

body.roi-case-study-template .pr-bar--on-dark .pr-bar__cta:hover,
body.roi-case-study-template .pr-bar--on-dark .pr-bar__cta:focus-visible {
  background: rgba(255, 255, 255, 0.88);
  color: #000000 !important;
}

/* ── Hero stage (Tailark section structure) ─────────────────────── */
body.roi-case-study-template .rcst-hero {
  position: relative;
  overflow: visible;
}

body.roi-case-study-template .rcst-hero__stage {
  position: relative;
  padding: clamp(0.875rem, calc(8vw - 50px), 2.875rem) 0 2rem;
}

body.roi-case-study-template .rcst-hero__copy {
  position: relative;
  z-index: 2;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  text-align: center;
}

body.roi-case-study-template .rcst-eyebrow {
  margin: 0 0 1.125rem;
  font-family: var(--ds-font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ds-color-muted);
}

body.roi-case-study-template .rcst-hero__title {
  margin: 0 auto;
  max-width: 36rem;
  font-family: var(--ds-font-body) !important;
  font-weight: 600 !important;
  font-size: clamp(2.25rem, 5vw, 3rem) !important;
  line-height: 1 !important;
  letter-spacing: normal !important;
  color: var(--rcst-foreground) !important;
  text-wrap: balance;
}

body.roi-case-study-template .rcst-hero__sub {
  margin: 1rem auto 2rem;
  max-width: 36rem;
  font-family: var(--ds-font-body);
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--rcst-muted);
  text-wrap: balance;
}

body.roi-case-study-template .rcst-hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  max-height: 4rem;
  transition:
    opacity 350ms ease,
    max-height 350ms ease,
    margin 350ms ease;
}

body.roi-case-study-template .rcst-hero--engaged .rcst-hero__actions {
  opacity: 0;
  max-height: 0;
  margin: 0;
  pointer-events: none;
  visibility: hidden;
}

/* Animated border ring (matches home page .home-hero__cta-ring) */
body.roi-case-study-template .home-hero__cta-ring {
  display: inline-block;
  border-radius: 999px;
  padding: 1.5px;
  background: conic-gradient(from var(--border-angle), transparent 25%, #c59060, #f5d9b0 75%, transparent);
  animation: rcst-border-spin 3s linear infinite;
  vertical-align: middle;
}

body.roi-case-study-template .home-hero__cta-ring:hover {
  animation-play-state: paused;
}

body.roi-case-study-template .rcst-hero__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 28px;
  border: none;
  border-radius: 999px;
  background: #ffffff;
  color: #000000;
  font-family: var(--ds-font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease;
}

body.roi-case-study-template .rcst-hero__cta:hover,
body.roi-case-study-template .rcst-hero__cta:active {
  background: #f5f5f5;
  color: #000000;
}

body.roi-case-study-template .rcst-hero__cta:focus-visible {
  outline: 2px solid #c59060;
  outline-offset: 4px;
}

/* ── Visual scene + background image ────────────────────────────── */
body.roi-case-study-template .rcst-hero__visual {
  position: relative;
  z-index: 1;
  margin-top: 0;
  overflow: visible;
  padding: 0 1.5rem 1rem;
}

body.roi-case-study-template .rcst-hero {
  margin-bottom: 4rem;
}

body.roi-case-study-template .rcst-hero__scene-bg {
  position: absolute;
  inset: 0;
  width: min(66.666%, 56rem);
  margin: 0 auto;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(65% 65% at 50% 35%, #000 20%, transparent 72%);
  mask-image: radial-gradient(65% 65% at 50% 35%, #000 20%, transparent 72%);
}

body.roi-case-study-template .rcst-hero__scene-bg img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 28rem;
  object-fit: cover;
  object-position: center center;
  mix-blend-mode: normal;
  opacity: 0.92;
}

/* ── Chat card frame (Tailark hero-section/one computed styles) ─ */
body.roi-case-study-template .rcst-chat-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 384px;
  margin: 0 auto;
  padding-bottom: 1.5rem;
  transform: translateY(48px);
  scroll-margin-top: calc(64px + 1.5rem);
  scroll-margin-bottom: 1.5rem;
}

body.roi-case-study-template .rcst-chat__window {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: clamp(560px, 70vh, 720px);
  width: 100%;
  max-width: 384px;
  padding: 24px;
  border: 1px solid transparent;
  border-radius: 16px;
  background-color: rgba(255, 255, 255, 0.75);
  background-color: oklab(0.999994 0.0000455678 0.0000200868 / 0.75);
  backdrop-filter: blur(64px);
  -webkit-backdrop-filter: blur(64px);
  box-shadow:
    rgba(0, 0, 0, 0) 0 0 0 0,
    rgba(0, 0, 0, 0) 0 0 0 0,
    rgba(0, 0, 0, 0) 0 0 0 0,
    oklab(0.141 0.00136173 -0.00480696 / 0.075) 0 0 0 1px,
    oklab(0 0 0 / 0.065) 0 20px 25px -5px,
    oklab(0 0 0 / 0.065) 0 8px 10px -6px;
  -webkit-font-smoothing: antialiased;
  transition: box-shadow 0.45s ease;
}

body.roi-case-study-template .rcst-chat-shell--guided .rcst-chat__window {
  box-shadow:
    rgba(0, 0, 0, 0) 0 0 0 0,
    rgba(0, 0, 0, 0) 0 0 0 0,
    rgba(197, 144, 96, 0.28) 0 0 0 3px,
    oklab(0.141 0.00136173 -0.00480696 / 0.075) 0 0 0 1px,
    oklab(0 0 0 / 0.065) 0 20px 25px -5px,
    oklab(0 0 0 / 0.08) 0 8px 10px -6px;
}

@media (prefers-reduced-motion: reduce) {
  body.roi-case-study-template .rcst-chat__window {
    transition: none;
  }
}

body.roi-case-study-template .rcst-chat__dots {
  display: flex;
  flex-shrink: 0;
  gap: 0.25rem;
}

body.roi-case-study-template .rcst-chat__dots span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: rgba(9, 9, 11, 0.1);
}

body.roi-case-study-template .rcst-chat__intro {
  flex-shrink: 0;
  margin-top: 1.5rem;
  text-align: center;
}

body.roi-case-study-template .rcst-chat__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

body.roi-case-study-template .rcst-chat__icon {
  display: inline-flex;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

body.roi-case-study-template .rcst-chat__icon img {
  display: block;
  width: 100%;
  height: 100%;
}

body.roi-case-study-template .rcst-chat__brand-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--rcst-foreground);
}

body.roi-case-study-template .rcst-chat__panel-copy {
  margin: 0.75rem auto 0;
  max-width: 10rem;
  font-size: 0.9375rem;
  line-height: 1.25;
  color: rgba(9, 9, 11, 0.75);
  text-wrap: balance;
}

body.roi-case-study-template .rcst-chat__divider {
  display: inline-flex;
  width: 5rem;
  height: 2px;
  margin-top: 0.75rem;
  border-bottom: 1px solid #ffffff;
  background: rgba(9, 9, 11, 0.1);
}

/* ── Message thread ───────────────────────────────────────────── */
body.roi-case-study-template .rcst-chat__thread {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 0;
  margin: 1rem 0 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

body.roi-case-study-template .rcst-chat__msg {
  animation: rcst-msg-in 0.32s ease both;
}

@keyframes rcst-msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.roi-case-study-template .rcst-chat__msg--assistant {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: flex-start;
  width: fit-content;
  max-width: 85%;
}

body.roi-case-study-template .rcst-chat__msg--user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  align-self: flex-end;
  width: fit-content;
  max-width: 85%;
}

body.roi-case-study-template .rcst-chat__bubble-text {
  margin: 0;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  line-height: 1.55;
}

body.roi-case-study-template .rcst-chat__msg--assistant .rcst-chat__bubble-text {
  background: #ffffff;
  color: var(--rcst-foreground);
  border: 1px solid rgba(9, 9, 11, 0.08);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(9, 9, 11, 0.06);
}

body.roi-case-study-template .rcst-chat__msg--user .rcst-chat__bubble-text {
  background: var(--rcst-claude);
  color: #ffffff;
  border: none;
  border-radius: 16px 16px 0 16px;
  box-shadow: 0 2px 10px rgba(217, 119, 87, 0.28);
}

body.roi-case-study-template .rcst-chat__time {
  display: block;
  font-size: 0.6875rem;
  line-height: 1.2;
  color: var(--rcst-muted);
}

body.roi-case-study-template .rcst-chat__time--above {
  margin-bottom: 0.375rem;
  text-align: left;
}

body.roi-case-study-template .rcst-chat__msg--user .rcst-chat__time {
  margin-top: 0.375rem;
  text-align: right;
}

body.roi-case-study-template .rcst-chat__msg--error .rcst-chat__bubble-text {
  color: #8f1f14;
  background: rgba(180, 35, 24, 0.08);
  border: 1px solid rgba(180, 35, 24, 0.15);
  box-shadow: none;
}

body.roi-case-study-template .rcst-chat__error {
  flex-shrink: 0;
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  color: #b42318;
}

/* ── Composer (Tailark Ask Anything panel) ──────────────────────── */
body.roi-case-study-template .rcst-chat__composer {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 1rem;
}

body.roi-case-study-template .rcst-chat__composer-panel {
  margin: 0 -0.75rem -0.75rem;
  padding: 0.75rem;
  min-height: 5.5rem;
  border-radius: 0.5rem;
  background: var(--rcst-surface);
}

body.roi-case-study-template .rcst-chat__composer--hidden {
  visibility: hidden;
  pointer-events: none;
}

body.roi-case-study-template .rcst-chat__composer-idle {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--rcst-muted);
}

body.roi-case-study-template .rcst-chat--active .rcst-chat__composer-idle {
  display: none;
}

body.roi-case-study-template .rcst-chat__input {
  display: none;
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0;
  border: none;
  background: transparent;
  font-family: var(--ds-font-body);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--rcst-foreground);
  box-sizing: border-box;
}

body.roi-case-study-template .rcst-chat--active .rcst-chat__input {
  display: block;
}

body.roi-case-study-template .rcst-chat__input::placeholder {
  color: var(--rcst-muted);
}

body.roi-case-study-template .rcst-chat__input:focus {
  outline: none;
}

body.roi-case-study-template .rcst-chat__input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

body.roi-case-study-template .rcst-chat__composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

body.roi-case-study-template .rcst-chat__composer-tools {
  display: flex;
  gap: 0.5rem;
}

body.roi-case-study-template .rcst-chat__tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 1rem;
  background: transparent;
  color: var(--rcst-muted);
  box-shadow: 0 0 0 1px var(--rcst-border);
  cursor: default;
  opacity: 0.55;
}

body.roi-case-study-template .rcst-chat__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  background: var(--rcst-foreground);
  color: #ffffff;
  cursor: pointer;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--rcst-foreground) 85%, #000 15%),
    0 4px 6px -1px rgba(0, 0, 0, 0.15),
    0 2px 4px -2px rgba(0, 0, 0, 0.15);
  transition: background 0.15s ease, opacity 0.15s ease;
}

body.roi-case-study-template .rcst-chat__send:hover:not(:disabled) {
  background: #1a1a1a;
}

body.roi-case-study-template .rcst-chat__send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

body.roi-case-study-template .rcst-chat__send:focus-visible {
  outline: 2px solid var(--rcst-primary);
  outline-offset: 2px;
}

body.roi-case-study-template .rcst-chat--success .rcst-chat__composer {
  visibility: hidden;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  body.roi-case-study-template.rcst-page--exit {
    opacity: 0;
    transition: opacity 320ms ease;
  }
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media screen and (max-width: 767px) {
  body.roi-case-study-template .pr-bar__meta {
    display: none;
  }

  body.roi-case-study-template .pr-bar__inner {
    width: 92%;
  }

  body.roi-case-study-template .rcst-hero__visual {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  body.roi-case-study-template .rcst-hero__scene-bg {
    width: 100%;
  }

  body.roi-case-study-template .rcst-chat__window {
    min-height: clamp(480px, 62vh, 580px);
  }
}
