/* Enclave — "How it works" demo. Builds on the tokens in styles.css. */

.demo {
    max-width: var(--max);
    margin: 0 auto;
    padding: clamp(7rem, 14vh, 9rem) var(--gutter) clamp(4rem, 10vh, 7rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: clamp(2.5rem, 6vw, 6rem);
    align-items: center;
}

.demo__title {
    margin-top: 1.25rem;
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2.8rem, 6vw, 5rem);
    line-height: 0.98;
    letter-spacing: -0.02em;
}

.demo__title em { color: var(--claret-hi); }

.demo__lede {
    margin-top: 1.25rem;
    max-width: 30rem;
    color: var(--muted);
}

/* ---------- Steps ---------- */
.steps {
    list-style: none;
    margin: 2.5rem 0;
    display: grid;
    gap: 0.4rem;
    max-width: 30rem;
}

.step {
    display: flex;
    gap: 1.1rem;
    padding: 1rem 1.1rem;
    border-left: 2px solid var(--line);
    opacity: 0.5;
    transition: opacity 0.5s var(--ease), border-color 0.5s var(--ease), background 0.5s var(--ease);
}

.step.is-active {
    opacity: 1;
    border-left-color: var(--claret-hi);
    background: rgba(200, 55, 77, 0.06);
}

.step.is-done { opacity: 0.8; border-left-color: var(--line-strong); }

.step__num {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--claret-hi);
    min-width: 1rem;
}

.step__text { display: grid; gap: 0.2rem; }
.step__text strong { font-weight: 500; }
.step__text span { color: var(--muted); font-size: 0.92rem; }

/* ---------- Phone ---------- */
.phone {
    width: min(360px, 88vw);
    padding: 10px;
    border-radius: 44px;
    background: linear-gradient(160deg, #2a2224, #120e0f);
    box-shadow: 0 0 0 1px rgba(239, 230, 216, 0.12), 0 40px 90px rgba(0, 0, 0, 0.6), 0 0 120px rgba(200, 55, 77, 0.12);
}

.phone__screen {
    position: relative;
    height: min(700px, 78vh);
    min-height: 560px;
    border-radius: 34px;
    overflow: hidden;
    background: var(--ink);
    display: flex;
    flex-direction: column;
}

.statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.5rem 0.4rem;
    font-size: 0.75rem;
    color: var(--ivory);
}

.statusbar__dots { display: flex; gap: 4px; }
.statusbar__dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--ivory); opacity: 0.7; }

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0.5rem 1.1rem 1.1rem;
    animation: screen-in 0.6s var(--ease);
}

.screen[hidden] { display: none; }

@keyframes screen-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Portrait (drawing in the brand arch) ---------- */
.portrait {
    --blur: 12px;
    position: relative;
    overflow: hidden;
    /* brand arch shape */
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 260' preserveAspectRatio='none'%3E%3Cpath d='M0 260 V110 C0 62 42 46 100 6 C158 46 200 62 200 110 V260 Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 260' preserveAspectRatio='none'%3E%3Cpath d='M0 260 V110 C0 62 42 46 100 6 C158 46 200 62 200 110 V260 Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.portrait svg {
    display: block;
    width: 100%;
    height: 100%;
    transition: filter 1.6s var(--ease), transform 1.6s var(--ease);
}

.portrait.is-blurred svg { filter: blur(var(--blur)); transform: scale(1.12); }
.chat__avatar { --blur: 4px; }

/* ---------- Step 1: profile ---------- */
.profile { flex: 1; overflow-y: auto; scrollbar-width: none; }
.profile::-webkit-scrollbar { display: none; }

.profile__photo {
    position: relative;
    width: 62%;
    margin: 0.2rem auto 0.9rem;
    aspect-ratio: 200 / 260;
}

.profile__photo .portrait { width: 100%; height: 100%; }

.tag {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

.tag--verified { top: 34%; background: rgba(12, 10, 11, 0.7); color: var(--ivory); border: 1px solid var(--line-strong); }
.tag--lock { bottom: 8%; background: rgba(12, 10, 11, 0.7); color: var(--muted); }

.profile__name {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.9rem;
    line-height: 1;
    text-align: center;
}

.profile__meta { margin-top: 0.35rem; text-align: center; font-size: 0.8rem; color: var(--muted); }

.profile__looking {
    margin-top: 0.8rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
}

.profile__looking strong { color: var(--ivory); font-weight: 500; }

.voice {
    margin-top: 1rem;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(239, 230, 216, 0.03);
    color: var(--ivory);
    font-family: var(--sans);
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s;
}

.voice:hover, .voice[aria-pressed="true"] { border-color: var(--claret-hi); background: rgba(200, 55, 77, 0.08); }

.voice__play {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--claret);
    position: relative;
}

.voice__play::after {
    content: '';
    position: absolute;
    left: 11px;
    top: 9px;
    border-left: 10px solid var(--ivory);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

.voice[aria-pressed="true"] .voice__play::after {
    left: 10px;
    top: 10px;
    width: 10px;
    height: 10px;
    border: 0;
    background: var(--ivory);
}

.voice__wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 22px; }
.voice__wave i { flex: 1; height: 30%; border-radius: 2px; background: rgba(239, 230, 216, 0.35); }
.voice__wave i:nth-child(3n) { height: 70%; }
.voice__wave i:nth-child(4n) { height: 50%; }
.voice__wave i:nth-child(5n) { height: 90%; }

.voice[aria-pressed="true"] .voice__wave i { background: var(--claret-hi); animation: wave 0.9s ease-in-out infinite alternate; }
.voice[aria-pressed="true"] .voice__wave i:nth-child(2n) { animation-delay: -0.3s; }
.voice[aria-pressed="true"] .voice__wave i:nth-child(3n) { animation-delay: -0.6s; }

@keyframes wave {
    from { transform: scaleY(0.4); }
    to { transform: scaleY(1.1); }
}

.voice__label { flex-shrink: 0; color: var(--muted); }

.voice__line {
    margin-top: 0.6rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1rem;
    line-height: 1.35;
    text-align: center;
    color: var(--ivory);
    animation: screen-in 0.5s var(--ease);
}

.prompt {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: var(--ink-3);
}

.prompt span { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.prompt p { margin-top: 0.3rem; font-family: var(--serif); font-size: 1.1rem; line-height: 1.3; }

.actions {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 0.6rem;
    padding-top: 0.9rem;
}

/* ---------- Shared app buttons ---------- */
.act {
    min-height: 48px;
    padding: 0 1rem;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--ivory);
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s, transform 0.2s;
}

.act:active { transform: scale(0.97); }
.act--like { background: var(--claret); border-color: var(--claret); }
.act--like:hover { background: var(--claret-hi); }
.act--pass:hover, .act--ghost:hover { border-color: var(--ivory); }

/* ---------- Step 2: chat ---------- */
.chat__head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
}

.chat__avatar { width: 40px; height: 52px; flex-shrink: 0; }
.chat__who { flex: 1; display: grid; line-height: 1.25; }
.chat__who strong { font-weight: 500; }
.chat__who span { font-size: 0.72rem; color: var(--muted); }

.reveal-btn {
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--claret-hi);
    background: rgba(200, 55, 77, 0.1);
    color: var(--ivory);
    font-family: var(--sans);
    font-size: 0.75rem;
    cursor: pointer;
}

.reveal-btn:disabled { opacity: 0.35; cursor: default; }

.chat__shield {
    margin: 0.6rem 0 0.4rem;
    text-align: center;
    font-size: 0.7rem;
    color: var(--muted);
}

.chat__log {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.4rem 0;
    scrollbar-width: none;
}

.chat__log::-webkit-scrollbar { display: none; }

.msg {
    max-width: 82%;
    padding: 0.6rem 0.85rem;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.4;
    animation: screen-in 0.45s var(--ease);
}

.msg--me { align-self: flex-end; background: var(--claret); border-bottom-right-radius: 4px; }
.msg--them { align-self: flex-start; background: var(--ink-3); border-bottom-left-radius: 4px; }

.msg--system {
    align-self: center;
    max-width: 92%;
    background: transparent;
    border: 1px dashed var(--line-strong);
    color: var(--muted);
    font-size: 0.74rem;
    text-align: center;
}

.msg .hidden-num {
    display: inline-block;
    padding: 0 0.35rem;
    border-radius: 4px;
    background: rgba(239, 230, 216, 0.12);
    letter-spacing: 0.1em;
}

.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: typing 1s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
}

.chat__suggest { display: grid; gap: 0.4rem; padding-top: 0.6rem; }

.suggest {
    padding: 0.7rem 0.9rem;
    border-radius: 14px;
    border: 1px solid var(--line-strong);
    background: rgba(239, 230, 216, 0.03);
    color: var(--ivory);
    font-family: var(--sans);
    font-size: 0.82rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.3s;
}

.suggest:hover { border-color: var(--claret-hi); }
.suggest::before { content: 'Tap to send · '; color: var(--muted); font-size: 0.72rem; }

/* ---------- Step 3: reveal ---------- */
.reveal {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
}

.reveal__status { font-size: 0.78rem; color: var(--muted); min-height: 1.2em; }
.reveal__pair { width: 58%; aspect-ratio: 200 / 260; }
.reveal__pair .portrait { width: 100%; height: 100%; }

.reveal__title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.5rem;
    line-height: 1.15;
    padding: 0 0.5rem;
}

.reveal__title em { color: var(--claret-hi); }
.reveal .act { width: 80%; }

/* ---------- Overlay + toast ---------- */
.overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(12, 10, 11, 0.86);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: screen-in 0.4s var(--ease);
}

.overlay[hidden] { display: none; }

.match { text-align: center; display: grid; gap: 0.9rem; justify-items: center; }
.match h3 { font-family: var(--serif); font-weight: 400; font-size: 2.2rem; line-height: 1; }
.match h3 em { color: var(--claret-hi); }
.match p { color: var(--muted); font-size: 0.9rem; max-width: 16rem; }
.match .act { width: 14rem; }

.toast {
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 6;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    background: var(--ivory);
    color: var(--ink);
    font-size: 0.8rem;
    line-height: 1.4;
    animation: screen-in 0.4s var(--ease);
}

.toast[hidden] { display: none; }

.demo-footer { padding-top: 2rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .demo { grid-template-columns: 1fr; justify-items: center; }
    .demo__intro { max-width: 34rem; }
    .demo__join { display: none; }                 /* the phone comes next; the nav keeps a join link */
    .steps { margin-bottom: 0; }
}

@media (max-width: 640px) {
    .phone { padding: 6px; border-radius: 36px; }
    .phone__screen { border-radius: 30px; height: 640px; }
}

/* ---------- Main-page teaser (used on index.html) ---------- */
.teaser {
    max-width: var(--max);
    margin: 0 auto;
    padding: clamp(1rem, 4vh, 3rem) var(--gutter) clamp(3rem, 8vh, 5rem);
}

.teaser__card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(1.25rem, 4vw, 3rem);
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 1px solid var(--line);
    background: linear-gradient(120deg, var(--ink-2), var(--ink));
    text-decoration: none;
    transition: border-color 0.5s var(--ease);
}

.teaser__card:hover { border-color: var(--claret-hi); }

.teaser__art { width: 84px; aspect-ratio: 200 / 260; }
.teaser__art .portrait { width: 100%; height: 100%; }

.teaser__text h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(1.7rem, 3.4vw, 2.6rem);
    line-height: 1.05;
}

.teaser__text h2 em { color: var(--claret-hi); }
.teaser__text p { margin-top: 0.5rem; color: var(--muted); }

@media (max-width: 640px) {
    .teaser__card { grid-template-columns: auto minmax(0, 1fr); }
    .teaser__card .btn { grid-column: 1 / -1; justify-content: center; }
    .teaser__art { width: 64px; }
}
