/*
 * Final-Home — the styles its Tailwind classes can't express.
 *
 * The page itself lives in the WordPress site's page builder and is written in
 * Tailwind. This file holds its colours (one place, as custom properties the
 * builder's colour classes read), its fonts, and the motion: keyframes and the
 * few effects that need more than a class. Scripts: final-home.js, try-it.js,
 * pricing.js (which comes with the shared pricing component) and header.js
 * (which comes with the shared header component).
 */

.fh {
    /* The builder's colour classes (bg-background, text-muted, text-primary…) read these. */
    --color-background: #09080a;
    --color-foreground: #f3efec;
    --color-muted: #b8afb2;
    --color-primary: #f8678a;
    --color-secondary: #f6b35c;
    --color-accent: #6f9dff;
    --font-body: "Geist", ui-sans-serif, system-ui, sans-serif;
    --font-display: "Instrument Serif", Georgia, serif;

    /* Colours the six above don't cover. */
    --fh-rose-deep: #ea3c5e;
    --fh-ash: #857b7f;
    --fh-panel: #131114;
    --fh-panel-deep: #0e0c0f;
    --fh-grid-line: rgba(255, 255, 255, 0.06);
    /* Deep enough for white text to stay readable. */
    --fh-bubble: #dc3158;

    /* The editor's own timeline colours, for the hands-on editor and the drawn timelines. */
    --fh-video-clip: #1d3557;
    --fh-video-edge: #3f6aa6;
    --fh-audio-clip: #0f3b3a;
    --fh-audio-edge: #2c7a73;
    --fh-audio-wave: #8fe3d4;
    --fh-cut: rgba(239, 68, 68, 0.42);
    --fh-cut-edge: #ef4444;
    --fh-playhead: #ea3c5e;

    color: var(--color-foreground);
    font-family: var(--font-body);
    font-feature-settings: "ss01";
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/*
 * An editing grid behind the whole homepage. Kept off .fh itself because the
 * shared pricing and footer components carry .fh too, and on other pages they
 * sit on that page's own background.
 */
.fh-page {
    background-color: var(--color-background);
    background-image:
        linear-gradient(to right, var(--fh-grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--fh-grid-line) 1px, transparent 1px);
    background-size: 64px 64px;
}

html:has(.fh-page) {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
    background: #09080a;
}

.fh ::selection {
    background: rgba(234, 60, 94, 0.35);
    color: #fff;
}

.fh .font-mono {
    font-family: "Geist Mono", ui-monospace, monospace;
}

/* ── Headline: "that, um, like, edits for you" — the filler words are struck
      through, then the gap closes the way a deleted word does in the editor. ── */
.fh-filler {
    display: inline-grid;
    grid-template-columns: 1fr;
    vertical-align: baseline;
    color: var(--fh-ash);
    animation: fh-filler-close 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) 1.75s forwards;
}

.fh-filler > span {
    min-width: 0;
    overflow-x: clip;
    overflow-y: visible;
    white-space: pre;
}

.fh-strike {
    position: relative;
}

.fh-strike::after {
    content: "";
    position: absolute;
    left: 0.02em;
    right: 0.1em;
    top: 0.56em;
    height: 0.07em;
    border-radius: 10px;
    background: var(--fh-rose-deep);
    transform: scaleX(0);
    transform-origin: left center;
    animation: fh-cross-out 0.32s ease forwards;
}

.fh-strike-1::after { animation-delay: 0.8s; }
.fh-strike-2::after { animation-delay: 1.15s; }

@keyframes fh-cross-out { to { transform: scaleX(1); } }

@keyframes fh-filler-close {
    0% { grid-template-columns: 1fr; opacity: 1; }
    55% { opacity: 0.35; }
    100% { grid-template-columns: 0fr; opacity: 0; }
}

/* ── Surfaces ── */

/* Film grain over the whole page: a tiny tiled noise texture. */
.fh-grain {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Timeline ruler: a long tick every fifth mark, like the logo's ruler. */
.fh-ruler {
    background-image:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px 60px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 12px);
    background-size: 100% 100%, 100% 45%;
    background-position: 0 0, 0 100%;
    background-repeat: no-repeat;
}

/* "Things you can just ask for": each prompt is a sent chat message, tail and all.
   The bubble's bottom-right corner is square so the tail grows out of it. */
.fh-bubble {
    position: relative;
    background-color: var(--fh-bubble);
    /* A soft sheen that fades out before the bottom edge, so the tail still matches. */
    background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.12), transparent 70%);
}

.fh-bubble::after {
    content: "";
    position: absolute;
    right: -8px;
    bottom: 0;
    width: 14px;
    height: 18px;
    background-color: inherit;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 18'%3E%3Cpath d='M0 0H6C6 9 8 14 14 18C9 18 4 17.5 0 16Z'/%3E%3C/svg%3E") no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 18'%3E%3Cpath d='M0 0H6C6 9 8 14 14 18C9 18 4 17.5 0 16Z'/%3E%3C/svg%3E") no-repeat;
}

/* ── Scroll-in: content fades up as it arrives. Hidden only once the page's
      script has run, so the page reads fine without it. ── */
.fh.is-ready [data-reveal] {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1),
        transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
    transition-delay: var(--reveal-delay, 0ms);
}

.fh.is-ready [data-reveal].is-revealed {
    opacity: 1;
    transform: none;
}

/* ── Looping motion used by the toolkit's small illustrations ── */
.fh-marquee { animation: fh-marquee 60s linear infinite; }
.fh-marquee-reverse { animation: fh-marquee-reverse 60s linear infinite; }
.fh-marquee:hover, .fh-marquee-reverse:hover { animation-play-state: paused; }
.fh-sweep { animation: fh-sweep 7s linear infinite; }
.fh-wipe { animation: fh-wipe 6s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
.fh-wipe-line { animation: fh-wipe-line 6s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
.fh-collapse { animation: fh-collapse 5s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
.fh-speaker { animation: fh-speaker 6s steps(1) infinite; }
.fh-speaker-late { animation: fh-speaker 6s steps(1) -3s infinite; }
.fh-blink { animation: fh-blink 1s steps(1) infinite; }
.fh-bars path { transform-box: fill-box; transform-origin: center; animation: fh-bar 1.1s ease-in-out infinite; }

@keyframes fh-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes fh-marquee-reverse { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@keyframes fh-sweep { from { left: 0%; } to { left: 100%; } }
@keyframes fh-wipe {
    0%, 12% { clip-path: inset(0 100% 0 0); }
    45%, 62% { clip-path: inset(0 0 0 0); }
    95%, 100% { clip-path: inset(0 100% 0 0); }
}
@keyframes fh-wipe-line {
    0%, 12% { left: 0%; }
    45%, 62% { left: 100%; }
    95%, 100% { left: 0%; }
}
@keyframes fh-collapse {
    0%, 30% { flex-grow: 1; opacity: 1; }
    55%, 85% { flex-grow: 0; opacity: 0; }
    100% { flex-grow: 1; opacity: 1; }
}
@keyframes fh-speaker {
    0%, 45% { opacity: 1; }
    50%, 95% { opacity: 0; }
    100% { opacity: 1; }
}
@keyframes fh-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes fh-bar { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }

/* ── Site header (header.js): its menus drop in and its page dimmer fades in. ── */
@keyframes fh-nav-drop { from { opacity: 0; transform: translateY(-6px); } }
@keyframes fh-nav-fade { from { opacity: 0; } }

/* While the phone menu is open, the page behind it stays put. */
@media (max-width: 1023.98px) {
    html:has(.fh.is-menu-open) { overflow: hidden; }
}

/* The open/closed marker on FAQ answers is drawn by the page, not the browser. */
.fh summary { list-style: none; }
.fh summary::-webkit-details-marker { display: none; }

/* ── Hands-on transcript editor (try-it.js) ── */

/* Dragging across words picks them; it must not select the text itself. */
.fh-try-words {
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}

/* Dragging along the timeline scrubs it; a finger still scrolls the page up and down. */
[data-try-tracks] {
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}

/* ── Caption style (final-home.js): the phone's captions take the font, size,
      colour and place picked beside it. Sizes are in the video's own pixels
      (1080 wide), like the editor's, scaled to the phone's screen. ── */
.fh-caption-screen {
    container-type: inline-size;
}

.fh-caption {
    --caption-size: 136;
    position: absolute;
    left: 6%;
    right: 6%;
    top: 74%;
    transform: translateY(-50%);
    font-size: calc(var(--caption-size) * 100cqw / 1080);
    line-height: 1.05;
    text-align: center;
    color: #ffffff;
    filter: drop-shadow(0 0.55cqw 1.7cqw rgba(0, 0, 0, 0.85));
    pointer-events: none;
    transition: top 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.fh-caption[data-caption-color="yellow"] { color: var(--color-secondary); }
.fh-caption[data-caption-color="pink"] { color: var(--color-primary); }
.fh-caption[data-caption-position="top"] { top: 18%; }
.fh-caption[data-caption-position="middle"] { top: 50%; }

/* The captions and the font choices beside them both show each font. */
.fh [data-caption-font="bold"] { font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-weight: 700; font-style: normal; }
.fh [data-caption-font="modern"] { font-family: var(--font-body); font-weight: 600; font-style: normal; }
.fh [data-caption-font="classic"] { font-family: var(--font-display); font-weight: 400; font-style: italic; }

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

    .fh-caption { transition: none; }

    .fh-filler { display: none; animation: none; }
    .fh-strike::after { animation: none; }

    .fh.is-ready [data-reveal] {
        transform: none;
        transition: opacity 0.4s linear;
    }

    .fh-marquee, .fh-marquee-reverse, .fh-sweep, .fh-wipe, .fh-wipe-line,
    .fh-collapse, .fh-speaker, .fh-speaker-late, .fh-blink, .fh-bars path {
        animation: none;
    }
}
