:root {
  --cream: #fff7eb;
  --cream-deep: #faead2;
  --paper: #fffdfa;
  --ink: #2e2a39;
  --ink-soft: #655f6e;
  --red: #c43f3f;
  --red-dark: #9f2e31;
  --line: rgba(46, 42, 57, 0.16);
  --white: #ffffff;
  --shadow: 0 24px 70px rgba(46, 42, 57, 0.2);
  --font: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--cream);
  font-family: var(--font);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
}

body.chat-open {
  overflow: hidden;
}

button,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(196, 63, 63, 0.38);
  outline-offset: 3px;
}

.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px clamp(20px, 5vw, 76px);
  color: var(--ink);
  background: rgba(255, 247, 235, 0.96);
  border-bottom: 1px solid rgba(46, 42, 57, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 64px;
  min-height: 60px;
}

.brand img {
  width: 76px;
  height: auto;
  display: block;
}

.shop-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.shop-link span {
  color: var(--red);
  font-size: 18px;
}

.hero {
  min-height: min(82vh, 820px);
  display: flex;
  align-items: center;
  padding: 126px clamp(20px, 7vw, 112px) 72px;
  position: relative;
  isolation: isolate;
  color: var(--white);
  background: #514c49 url("assets/japam-hero.jpg") center 44% / cover no-repeat;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(25, 22, 24, 0.76) 0%, rgba(25, 22, 24, 0.5) 40%, rgba(25, 22, 24, 0.08) 76%),
    linear-gradient(180deg, rgba(25, 22, 24, 0.12), rgba(25, 22, 24, 0.28));
}

.hero__content {
  width: min(100%, 670px);
}

.eyebrow {
  margin: 0 0 18px;
  color: #ffd596;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(48px, 7vw, 92px);
  font-weight: 750;
  line-height: 0.96;
  letter-spacing: 0;
  text-wrap: balance;
}

.hero__copy {
  max-width: 54ch;
  margin: 24px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(16px, 1.7vw, 20px);
  line-height: 1.55;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 24px;
  margin-top: 32px;
}

.primary-action {
  min-height: 48px;
  border: 1px solid var(--white);
  border-radius: 6px;
  padding: 0 20px;
  color: var(--ink);
  background: var(--white);
  font-weight: 700;
  cursor: pointer;
}

.primary-action:hover {
  color: var(--white);
  background: transparent;
}

.hero__actions a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--white);
  font-weight: 650;
  text-underline-offset: 5px;
}

.trust-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  background: var(--cream);
}

.trust-strip article {
  min-height: 176px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 16px;
  align-content: center;
  padding: 28px clamp(20px, 4vw, 58px);
  border-right: 1px solid var(--line);
}

.trust-strip article:last-child {
  border-right: 0;
}

.trust-strip__index {
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.trust-strip h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.trust-strip p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

.chat-launcher {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 20;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 7px;
  padding: 8px 18px 8px 9px;
  color: var(--white);
  background: var(--ink);
  box-shadow: 0 16px 38px rgba(46, 42, 57, 0.3);
  font-weight: 700;
  cursor: pointer;
}

.chat-launcher__mark,
.chat-identity__mark {
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--cream-deep);
  font-weight: 800;
}

.chat-launcher__mark {
  width: 40px;
  height: 40px;
  border-radius: 5px;
}

.chat-panel {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 30;
  width: min(410px, calc(100vw - 40px));
  height: min(700px, calc(100dvh - 40px));
  min-height: 520px;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.chat-panel:not([hidden]) {
  display: grid;
}

.chat-panel__header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  color: var(--white);
  background: var(--ink);
}

.chat-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-identity__mark {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 5px;
}

.chat-identity h2 {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-identity p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
  background: #8fcf97;
}

.chat-panel__tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  color: var(--white);
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chat-log {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px;
  overscroll-behavior: contain;
  background:
    linear-gradient(rgba(255, 253, 250, 0.93), rgba(255, 253, 250, 0.93)),
    url("assets/japam-logo.png") center 40% / 96px auto no-repeat;
}

.message {
  max-width: 86%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message--assistant {
  align-self: flex-start;
}

.message--user {
  align-self: flex-end;
}

.message__bubble {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 13px;
  background: var(--white);
  box-shadow: 0 7px 18px rgba(46, 42, 57, 0.07);
}

.message--user .message__bubble {
  color: var(--white);
  border-color: var(--ink);
  background: var(--ink);
}

.message__bubble p {
  margin: 0;
  font-size: 14px;
  line-height: 1.52;
  white-space: pre-wrap;
}

.message__sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.message__sources a {
  max-width: 100%;
  overflow: hidden;
  border-bottom: 1px solid rgba(196, 63, 63, 0.36);
  color: var(--red-dark);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message--thinking .message__bubble {
  color: var(--ink-soft);
}

.starter-prompts {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 12px 10px;
  scrollbar-width: none;
}

.starter-prompts::-webkit-scrollbar {
  display: none;
}

.starter-prompts button {
  min-height: 36px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--cream);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  padding: 10px 12px 8px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 112px;
  resize: none;
  border: 1px solid rgba(46, 42, 57, 0.22);
  border-radius: 6px;
  padding: 11px 12px;
  outline: none;
  color: var(--ink);
  background: var(--white);
  font-size: 14px;
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: #827b87;
}

.composer button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 6px;
  color: var(--white);
  background: var(--red);
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
}

.composer button:disabled {
  opacity: 0.52;
  cursor: progress;
}

.chat-disclaimer {
  margin: 0;
  padding: 0 12px 10px;
  color: #77717c;
  background: var(--paper);
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .site-header {
    min-height: 76px;
    padding-inline: 18px;
  }

  .brand img {
    width: 66px;
  }

  .hero {
    min-height: 76vh;
    padding: 116px 20px 58px;
    align-items: flex-end;
    background-position: 59% center;
  }

  .hero::before {
    background:
      linear-gradient(180deg, rgba(25, 22, 24, 0.1) 24%, rgba(25, 22, 24, 0.82) 88%),
      linear-gradient(90deg, rgba(25, 22, 24, 0.22), rgba(25, 22, 24, 0.04));
  }

  .hero h1 {
    font-size: clamp(44px, 13vw, 64px);
  }

  .trust-strip {
    grid-template-columns: 1fr;
  }

  .trust-strip article {
    min-height: 132px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .chat-panel {
    inset: 0;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .chat-panel__header {
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .chat-disclaimer {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
