/* Home: welcome chat + module carousel (borrowed from HMEL's PhaseCarousel and HomeHero) */
body.on-home { overflow: hidden; }
body.on-home #clara, body.on-home #fab { display: none !important; }
#view.view-home { padding: var(--top) 0 0; max-width: none; margin: 0; height: 100vh; overflow: hidden; }

.home { position: relative; height: 100%; overflow: hidden; --ch: clamp(220px, calc((100vh - 56px - 336px) * .72), 380px); --cw: calc(var(--ch) * .88); }
.hexfield { position: absolute; inset: 0; opacity: .55; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='%233D8C84' stroke-opacity='.20'/%3E%3Cpath d='M28 0L28 34L0 50L0 84L28 100L56 84L56 50L28 34' fill='none' stroke='%233D8C84' stroke-opacity='.20'/%3E%3C/svg%3E");
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 38%, #000 0%, transparent 75%); mask-image: radial-gradient(ellipse 70% 60% at 50% 38%, #000 0%, transparent 75%);
  animation: hexdrift 90s linear infinite; }
@keyframes hexdrift { to { background-position: 56px 100px; } }
.home::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(700px 260px at 85% 0%, rgba(61,140,132,.10), transparent), radial-gradient(500px 220px at 5% 100%, rgba(160,132,92,.10), transparent); }

/* header (ready state) */
.hhead { position: absolute; top: 20px; left: 0; right: 0; text-align: center; z-index: 2; opacity: 0; transform: translateY(-8px); transition: .6s cubic-bezier(.22,1,.36,1); pointer-events: none; }
.home.is-ready .hhead { opacity: 1; transform: none; }
.hhead h1 { font-size: clamp(30px, 5vh, 46px); font-weight: 500; }
.hhead h1 em { color: var(--teal); }
.hhead .sub { margin: 6px 0 0; font-size: 13px; color: var(--t2); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; transition: opacity .3s; align-items: center; }
.hhead .hlink { pointer-events: auto; text-decoration: none; }
.hhead .hlink:hover { filter: brightness(.95); }
.home.card-open .hhead .sub { opacity: 0; }

/* carousel */
.cwrap { position: absolute; left: 0; right: 0; top: 92px; bottom: 236px; z-index: 1; transition: opacity .7s, filter .7s, transform .7s cubic-bezier(.22,1,.36,1); perspective: 1400px; perspective-origin: 50% 35%; }
.home.is-welcome .cwrap { opacity: .22; filter: blur(5px); transform: scale(.94); pointer-events: none; }
.home.chat-expanded .cwrap { opacity: .18; filter: blur(5px); pointer-events: none; }
.pc-scene { position: absolute; inset: 0; transform-style: preserve-3d; outline: none; }
.pc-card { position: absolute; left: 50%; bottom: 60px; width: var(--cw); height: var(--ch); margin-left: calc(var(--cw) / -2); transition: transform .65s cubic-bezier(.22,1,.36,1), opacity .5s; cursor: pointer; transform-style: preserve-3d; animation: materialize .8s cubic-bezier(.16,1,.3,1) both; animation-delay: var(--d, 0ms); }
@keyframes materialize { from { opacity: 0; translate: 0 26px; } to { opacity: 1; translate: 0 0; } }
.pc-card .pc-back { position: absolute; inset: 7% 0 0 0; background: var(--fc); filter: brightness(.82); border-radius: 12px; box-shadow: 0 18px 40px rgba(0,0,0,.14); }
.pc-card .pc-back::before { content: ''; position: absolute; left: 0; top: -7.5%; width: 38%; height: 9%; background: inherit; border-radius: 10px 10px 0 0; }
.pc-sheet { position: absolute; left: 6%; right: 6%; top: 8%; height: 92%; background: #fff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.10); padding: 14px 16px; z-index: 2; transition: top .6s cubic-bezier(.22,1,.36,1), height .6s cubic-bezier(.22,1,.36,1); overflow: hidden; display: flex; flex-direction: column; }
.pc-card.is-open .pc-sheet { top: -30%; height: 138%; z-index: 6; box-shadow: 0 14px 40px rgba(0,0,0,.18); }
.pc-card:not(.is-open) .pc-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-head { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--t3); }
.pc-title { font: 600 clamp(17px, 2.3vh, 22px)/1.15 'Cormorant Garamond', Georgia, serif; margin: 8px 0 6px; }
.pc-rule { height: 1px; background: var(--ln2); margin: 6px 0 8px; }
.pc-more { display: flex; flex-direction: column; gap: 5px; font-size: 12px; opacity: 0; transition: opacity .35s .15s; flex: 1; min-height: 0; }
.pc-card.is-open .pc-more { opacity: 1; }
.pc-more p { margin: 0; color: var(--t2); font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pc-step { display: flex; align-items: center; gap: 8px; font-size: 11.5px; line-height: 1.25; } .pc-step i { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--ln2); display: grid; place-items: center; font-style: normal; font-size: 9px; color: #fff; flex: none; }
.pc-step i.d { background: var(--green); border-color: var(--green); } .pc-step i.p { border-color: var(--amber); }
a.pc-step { color: inherit; text-decoration: none; padding: 4px 6px; margin: -4px -6px; border-radius: 8px; transition: background .15s; } a.pc-step:hover { background: rgba(61,139,128,.1); }
.pc-x { border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; color: var(--t3); margin-left: 10px; padding: 0 2px; } .pc-x:hover { color: var(--t1, #111); } .pc-card:not(.is-open) .pc-x { display: none; }
a.pc-badge.go { color: inherit; text-decoration: none; background: rgba(255,255,255,.28); font-weight: 600; transition: background .15s; } a.pc-badge.go:hover { background: rgba(255,255,255,.5); }
.pc-step em { margin-left: auto; font-style: normal; color: var(--t3); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.pc-topics { display: flex; flex-wrap: wrap; gap: 4px; } .pc-topics span { font-size: 10.5px; padding: 2px 8px; border-radius: 99px; background: var(--tint); color: var(--t2); }
.pc-cta { margin-top: auto; padding-top: 4px; } .pc-cta .btn { width: 100%; padding: 7px 10px; font-size: 12px; }
.pc-front { position: absolute; left: 0; right: 0; bottom: 0; height: 56%; background: var(--fc); border-radius: 8px 8px 12px 12px; z-index: 3; padding: 14px 16px; color: #fff; box-shadow: 0 -2px 14px rgba(0,0,0,.10); background-image: linear-gradient(180deg, rgba(255,255,255,.10), transparent 60%); transition: opacity .4s; }
.pc-card.is-open .pc-front { opacity: .0; pointer-events: none; }
.pc-lab { display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.pc-lab .ic { width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.16); display: grid; place-items: center; }
.pc-name { font: 600 clamp(15px, 2.1vh, 19px)/1.2 'Cormorant Garamond', Georgia, serif; margin-top: 10px; }
.pc-meta { font-size: 11px; opacity: .8; margin-top: 6px; }
.pc-badge { position: absolute; right: 12px; top: 12px; font-size: 10px; padding: 2px 9px; border-radius: 99px; background: rgba(255,255,255,.2); }
.pc-badge.gold { background: #A0845C; }
.pc-card.is-locked .pc-front { filter: saturate(.55); }
.pc-controls { position: absolute; left: 0; right: 0; bottom: 4px; display: flex; align-items: center; justify-content: center; gap: 14px; z-index: 8; }
.pc-nav { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--ln2); background: var(--card); display: grid; place-items: center; color: var(--t2); } .pc-nav:disabled { opacity: .35; cursor: default; } .pc-nav:hover:not(:disabled) { border-color: var(--teal); color: var(--teal-d); }
.pc-dots { display: flex; gap: 7px; } .pc-dot { width: 7px; height: 7px; border-radius: 99px; border: 0; padding: 0; background: var(--ln2); transition: .3s; } .pc-dot.on { width: 22px; background: var(--teal); }

/* chat column */
.chatcol { position: absolute; z-index: 10; left: 50%; width: min(700px, calc(100% - 32px)); transform: translateX(-50%); top: 16px; height: calc(100% - 32px); display: flex; flex-direction: column; transition: top .7s cubic-bezier(.22,1,.36,1), height .7s cubic-bezier(.22,1,.36,1), width .7s cubic-bezier(.22,1,.36,1); }
.home.is-ready .chatcol { top: calc(100% - 226px); height: 212px; width: min(820px, calc(100% - 32px)); }
.home.is-ready:not(.chat-expanded) #msgs > :not(:nth-last-child(-n+2)) { display: none; }
.home.is-ready.chat-expanded .chatcol { top: 16px; height: calc(100% - 32px); }
.chead { display: flex; align-items: center; gap: 10px; padding: 4px 6px 10px; }
.home.is-ready:not(.chat-expanded) .chead { display: none; }
.home.is-welcome #hredo, .home.is-welcome #hexp, .home.is-ready #hskip { display: none; }
.cbody { flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: 22px; background: rgba(255,255,255,.62); backdrop-filter: blur(14px); box-shadow: 0 10px 50px rgba(30,60,60,.10), 0 0 0 1px rgba(0,0,0,.05); overflow: hidden; }
.home.is-ready:not(.chat-expanded) .cbody { background: rgba(255,255,255,.78); }
.cbody #msgs { flex: 1; padding: 22px 26px 8px; gap: 14px; -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22px); mask-image: linear-gradient(180deg, transparent 0, #000 22px); scroll-behavior: smooth; }
.home.is-ready:not(.chat-expanded) .cbody #msgs { padding: 14px 20px 4px; }
.cbody .m { font-size: 14.5px; line-height: 1.6; max-width: 86%; border-radius: 18px; animation: materialize .45s cubic-bezier(.16,1,.3,1) both; }
.cbody .m.a { background: #fff; border: 0; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 0 0 1px rgba(0,0,0,.04); margin-left: 38px; position: relative; border-bottom-left-radius: 6px; }
.cbody .m.a::before { content: ''; position: absolute; left: -38px; top: 2px; width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #8fd0c8, var(--teal)); box-shadow: 0 0 0 4px var(--teal-soft); }
.cbody .m.u { border-bottom-right-radius: 6px; box-shadow: 0 6px 18px rgba(61,140,132,.25); }
.cbody .m.rich { max-width: 100%; padding: 0; background: transparent; box-shadow: none; }
.cbody .m.rich::before { display: none; }
.pills { margin: -4px 0 0 38px; display: flex; flex-wrap: wrap; gap: 8px; animation: materialize .4s both; }
.pills button { padding: 8px 16px; border-radius: 99px; border: 1px solid var(--ln2); background: #fff; font-size: 13.5px; color: var(--t1); transition: .15s; }
.pills button:hover { border-color: var(--teal); color: var(--teal-d); transform: translateY(-1px); }
.pills button.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.pills button.go { background: var(--t1); border-color: var(--t1); color: #fff; } .pills button.go:disabled { opacity: .35; }
.pills .hint { font-size: 12px; color: var(--t3); align-self: center; }
.pcard { background: #fff; border-radius: 16px; box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 8px 28px rgba(30,60,60,.08); padding: 16px 18px; margin-left: 38px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; }
.pcard .k { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--t3); } .pcard .v { font-size: 13.5px; font-weight: 500; }
.pcard .full { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--ln); }
.cbody #chips { padding: 0 22px 6px; }
.cbody #cform { border-top: 0; padding: 8px 18px 16px; }
.cbody #cform input { padding: 12px 18px; font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.cbody #cform .btn { border-radius: 99px; padding: 0 22px; }
.home.is-ready:not(.chat-expanded) .cbody #chips { padding: 0 20px 4px; }
.home.is-ready:not(.chat-expanded) .cbody #chips button { padding: 3px 10px; font-size: 11.5px; }

.userchip { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--t2); white-space: nowrap; }
.userchip b { width: 28px; height: 28px; border-radius: 50%; background: var(--teal-soft); color: var(--teal-d); display: grid; place-items: center; font-size: 11px; font-weight: 600; }
@media (max-width: 760px) { .home { --ch: 230px; } .pc-card { bottom: 60px; } }

/* Compact screens show one complete module at a time instead of clipping the 3D fan. */
@media (max-width: 900px) {
  body.on-home { overflow: auto; }
  #view.view-home { height: auto; min-height: calc(100dvh - var(--mobile-nav-h, 0px)); overflow: visible; }
  .home { height: auto; min-height: inherit; display: flex; flex-direction: column; gap: 20px; padding: 20px 16px; }
  .hhead { position: relative; top: auto; padding: 0 4px; }
  .hhead h1 { font-size: 34px; }
  .cwrap { position: relative; inset: auto; perspective: none; flex: none; }
  .pc-scene { position: relative; transform-style: flat; }
  .pc-card { display: none; position: relative; left: auto; bottom: auto; width: 100%; height: auto; margin: 0; transform-style: flat; animation: none; }
  .pc-card.is-active { display: block; }
  .pc-back, .pc-front, .pc-x { display: none; }
  .pc-sheet, .pc-card.is-open .pc-sheet { position: relative; inset: auto; height: auto; padding: 18px; border: 1px solid var(--ln); border-top: 4px solid var(--fc); border-radius: 18px; box-shadow: 0 8px 24px rgba(30,60,60,.08); overflow: visible; }
  .pc-card:not(.is-open) .pc-title { display: block; }
  .pc-title { font-size: 24px; }
  .pc-more { opacity: 1; gap: 10px; }
  .pc-more p { display: block; }
  a.pc-step { min-height: 44px; margin: 0; padding: 8px 0; font-size: 13px; }
  .pc-step em { flex: none; }
  .pc-cta { padding-top: 10px; }
  .pc-cta .btn { min-height: 44px; display: grid; place-items: center; }
  .pc-controls { position: relative; bottom: auto; margin-top: 16px; }
  .pc-nav { width: 44px; height: 44px; }
  .pc-dot { width: 24px; height: 24px; background: none; position: relative; }
  .pc-dot::before { content: ''; position: absolute; inset: 8px; border-radius: 99px; background: var(--ln2); }
  .pc-dot.on { width: 24px; background: none; }
  .pc-dot.on::before { inset: 8px 2px; background: var(--teal); }
  .chatcol, .home.is-ready .chatcol, .home.is-ready.chat-expanded .chatcol { position: relative; inset: auto; transform: none; width: 100%; height: 420px; flex: none; }
  .home.is-welcome .hhead, .home.is-welcome .cwrap { display: none; }
  .home.is-welcome .chatcol { height: calc(100dvh - var(--mobile-nav-h, 0px) - 40px); min-height: 280px; }
  .home.is-ready.chat-expanded .chatcol { height: max(420px, calc(100dvh - var(--mobile-nav-h, 0px) - 40px)); }
  .home.chat-expanded .cwrap { opacity: 1; filter: none; pointer-events: auto; }
  .home.is-ready:not(.chat-expanded) .chead { display: flex; }
  .chead { flex-wrap: wrap; }
  .cbody #msgs, .home.is-ready:not(.chat-expanded) .cbody #msgs { padding: 16px 12px 8px; }
  .cbody .m { max-width: 100%; font-size: 14px; }
  .cbody .m.a { margin-left: 0; }
  .cbody .m.a::before { display: none; }
  .pills { margin-left: 0; }
  .pcard { grid-template-columns: minmax(0, 1fr); }
  .cbody #cform { padding: 10px; gap: 6px; }
  .cbody #cform input { padding: 10px; }
  .cbody #cform .btn { padding: 0 12px; }
  .cbody #chips, .home.is-ready:not(.chat-expanded) .cbody #chips { padding: 0 12px 6px; }
}
