/* Tool pages: one calm screen for the tool, FAQs below the fold.
   Loaded after tools.css and faq.css and only on the tool pages. */

:root {
    --tool-ink: #111827;
    --tool-body: #475569;
    --tool-muted: #6b7280;
    --tool-line: #dfe5ec;
    --tool-accent: #34A9FF;
    --tool-accent-ink: #0b74d1;
    --tool-tint: #f3f9ff;
}

#tool,
#tool input,
#tool button,
#tool select,
#faq,
#faq button {
    font-family: "Poppins", sans-serif;
}

/* ---------- layout: the tool owns the first screen ---------- */

#tool {
    position: relative;
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr) minmax(0, 500px);
    gap: 4rem;
    align-items: center;
    max-width: 1140px;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0 auto;
    padding: 7rem 1.5rem 5rem;
}

/* ---------- left column: what this is, in one glance ---------- */

#hero-text {
    align-self: center;
    padding: 0;
    max-width: 30rem;
}

#hero-text p:empty,
#hero-text > div:has(> p:only-child:empty) {
    display: none;
}

#hero-text h3 {
    font-size: 1.5rem;
    line-height: 1.3;
    font-weight: 500;
    color: var(--tool-body);
}

#hero-text h3 b {
    display: block;
    margin-bottom: 1.25rem;
    font-size: clamp(2rem, 3.6vw, 2.75rem);
    line-height: 1.15;
}

#hero-text span {
    display: block;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--tool-body);
}

/* the cross-sell line reads as a footnote, not a second paragraph */
#hero-text > div:nth-last-of-type(2) span {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--tool-muted);
}

/* secondary to the tool's own button */
#hero-btns {
    margin-top: 1.5rem;
    column-gap: 0.75rem;
}

#hero-btns input[type=button] {
    width: auto;
    padding: 0.6rem 1.4rem;
    font-size: 0.9rem;
    font-weight: 600;
}

/* ---------- the tool card ---------- */

#form-container {
    align-self: center;
    padding: 2rem;
    border: 1px solid var(--tool-line);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
    transition: none;
}

#form-container:hover {
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
    transform: none;
}

#form-container > h1 {
    margin: 0 0 1.5rem;
    font-size: 1.25rem;
    line-height: 1.3;
    font-weight: 600;
    color: var(--tool-ink);
}

#form-container label {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--tool-ink);
}

#form-container .optional {
    margin-left: 0.35rem;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--tool-muted);
}

#form-container .field-hint {
    display: block;
    margin: -0.15rem 0 0.5rem;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--tool-muted);
}

#form-container input[type="text"],
#form-container select {
    width: 100%;
    height: 48px;
    padding: 0 0.9rem;
    margin-bottom: 1.1rem;
    border: 1px solid var(--tool-line);
    border-radius: 10px;
    background: #fff;
    font-size: 0.95rem;
    color: var(--tool-ink);
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

#form-container input[type="text"]::placeholder {
    color: #9aa3af;
}

#form-container input[type="text"]:focus,
#form-container select:focus {
    outline: none;
    border-color: var(--tool-accent);
    box-shadow: 0 0 0 3px rgba(52, 169, 255, 0.2);
}

#form-container .field-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1rem;
}

/* optional fields stay out of the way until asked for */
#form-container .more-fields {
    margin-bottom: 1.1rem;
}

#form-container .more-fields summary {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--tool-accent-ink);
    cursor: pointer;
    list-style: none;
}

#form-container .more-fields summary::-webkit-details-marker {
    display: none;
}

#form-container .more-fields summary::before {
    content: "+ ";
}

#form-container .more-fields[open] summary::before {
    content: "\2212  ";
}

#form-container .more-fields[open] summary {
    margin-bottom: 0.9rem;
}

#form-container .more-fields input {
    margin-bottom: 0;
}

/* one primary action */
#button-container {
    height: auto;
    margin-top: 0.4rem;
}

#button-container button {
    width: 100%;
    height: 48px;
    padding: 0 1rem;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

#button-container button:hover {
    transform: none;
    box-shadow: none;
    background: #1f2937;
    border-color: #1f2937;
}

#button-container button:focus-visible,
#copyBtn:focus-visible,
#downloadBtn:focus-visible,
.faq-question:focus-visible {
    outline: 3px solid rgba(52, 169, 255, 0.45);
    outline-offset: 2px;
}

/* ---------- results ---------- */

#result-container {
    padding: 0;
}

#result:empty {
    display: none;
}

#result {
    margin-top: 1.25rem;
    padding: 0.9rem 1rem;
    border: 1px solid #cfe8ff;
    border-radius: 10px;
    background: var(--tool-tint);
    font-size: 0.9rem;
    line-height: 1.6;
    text-align: left;
    color: var(--tool-body);
}

#result a {
    color: var(--tool-accent-ink);
}

#result.error {
    border-color: #fecaca;
    background: #fff5f5;
    color: #b91c1c;
}

#copy-section,
#qrcode-section {
    margin: 0;
}

#copyBtn,
#downloadBtn,
#qrcode {
    margin-top: 0.9rem;
}

#copyBtn,
#downloadBtn {
    width: auto;
    min-width: 180px;
    height: 40px;
    padding: 0 1rem;
    border: 1px solid var(--tool-accent);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--tool-accent-ink);
}

#copyBtn:hover,
#downloadBtn:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--tool-accent-ink);
    background: var(--tool-accent-ink);
    color: #fff;
}

#copyMsg,
#dlMsg {
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
}

#qrcode {
    margin-bottom: 0;
    padding: 12px;
    border: 1px solid var(--tool-line);
    border-radius: 12px;
    background: #fff;
}

#qrcode img,
#qrcode canvas {
    width: 180px;
    height: 180px;
}

/* button generator */
.code-container {
    margin-top: 1.25rem;
}

.code-container h3 {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--tool-ink);
}

.code-output {
    max-height: 200px;
    overflow: auto;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    background: #0f172a;
    font-size: 0.78rem;
    line-height: 1.6;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------- pricing calculator ---------- */

#form-container .slider-container:empty {
    display: none;
}

#form-container .select-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1rem;
    margin-bottom: 0.5rem;
}

#form-container .dropdown-container {
    width: auto;
    min-width: 0;
    padding: 0;
    row-gap: 0;
    overflow: visible;
}

#form-container .dropdown-container label {
    font-weight: 500;
}

#form-container .dropdown-container select:hover {
    box-shadow: none;
    border-color: var(--tool-accent);
}

/* room under each track for the value bubble */
#form-container .slider-container {
    margin-bottom: 1.9rem;
}

#form-container .slider-label {
    margin-bottom: 0;
    font-size: 0.92rem;
    font-weight: 600;
}

#form-container .slider-label span {
    font-variant-numeric: tabular-nums;
}

#form-container .slider-container p {
    margin: 0.1rem 0 0.45rem;
    font-size: 0.78rem;
    color: var(--tool-muted);
}

#form-container .slider {
    accent-color: var(--tool-accent-ink);
    cursor: pointer;
}

#form-container .slider-tooltip {
    top: auto;
    bottom: -1.6rem;
    z-index: 2;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
}

#form-container .results {
    margin-top: 0.5rem;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: var(--tool-tint);
}

#form-container .results h3 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--tool-body);
}

#form-container .results h3 span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tool-ink);
    font-variant-numeric: tabular-nums;
}

/* ---------- cue that FAQs sit below ---------- */

.faq-cue {
    position: absolute;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    row-gap: 0.15rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--tool-muted);
    text-decoration: none;
}

.faq-cue:hover {
    color: var(--tool-accent-ink);
}

.faq-cue svg {
    width: 18px;
    height: 18px;
}

/* ---------- FAQs: one readable column, revealed on scroll ---------- */

#faq {
    padding: 5rem 1.25rem 6rem;
    background: #f8fafc;
}

.faq-container {
    display: block;
    max-width: 760px;
}

.faq-image img {
    display: none;
}

.faq-image,
.faq-image h1 {
    width: auto;
}

.faq-image h1 {
    display: block;
    margin: 0 0 2rem;
    font-size: 1.75rem;
    line-height: 1.3;
    text-align: center;
    color: var(--tool-ink);
}

.faq-content {
    margin: 0;
}

.faq-item {
    margin-bottom: 0.75rem;
    border: 1px solid #e5e9ef;
    border-radius: 12px;
    box-shadow: none;
    overflow: hidden;
}

.faq-question {
    column-gap: 0.5rem;
    padding: 0.35rem 0.4rem 0.35rem 1.25rem;
    border-radius: 0;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--tool-ink);
}

.faq-question:hover {
    transform: none;
    box-shadow: none;
    background: #f8fafc;
}

.faq-question svg {
    width: 48px;
    height: 48px;
}

.faq-answer.active {
    padding: 0 1.25rem 1.1rem;
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--tool-body);
}

.faq-answer p {
    margin: 0 0 0.6rem;
    max-width: 65ch;
}

.faq-answer p:last-child {
    margin-bottom: 0;
}

@media (prefers-reduced-motion: no-preference) {
    .faq-reveal .faq-image h1,
    .faq-reveal .faq-item {
        opacity: 0;
        transform: translateY(18px);
        transition: opacity 0.45s ease, transform 0.45s ease;
        transition-delay: calc(var(--i, 0) * 70ms);
    }

    .faq-reveal.in-view .faq-image h1,
    .faq-reveal.in-view .faq-item {
        opacity: 1;
        transform: none;
    }
}

/* ---------- small screens: tool first, context after ---------- */

@media (max-width: 900px) {
    #tool {
        grid-template-columns: minmax(0, 1fr);
        gap: 2.5rem;
        max-width: 560px;
        min-height: 0;
        padding: 6rem 1.25rem 3rem;
    }

    #form-container {
        order: -1;
        padding: 1.5rem 1.25rem;
    }

    #hero-text {
        max-width: none;
        margin-bottom: 0;
        padding: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
    }

    #hero-text h3 {
        font-size: 1.15rem;
    }

    #hero-text h3 b {
        font-size: 1.75rem;
    }

    #hero-text span {
        font-size: 0.95rem;
    }

    #hero-btns {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.6rem;
    }

    #hero-btns input[type=button] {
        width: auto;
        font-size: 0.85rem;
    }

    .faq-cue {
        display: none;
    }

    #faq {
        padding: 3.5rem 1rem 4rem;
    }

    .faq-content {
        margin: 0;
    }

    .faq-image h1 {
        font-size: 1.4rem;
    }

    .faq-question {
        font-size: 0.95rem;
        padding-left: 1rem;
    }

    .faq-answer.active {
        padding: 0 1rem 1rem;
    }
}

@media (max-width: 420px) {
    #form-container .field-pair,
    #form-container .select-row {
        grid-template-columns: 1fr;
    }

    #form-container .more-fields .field-pair > div:first-child input {
        margin-bottom: 1.1rem;
    }
}

/* ---------- bot cost calculator ---------- */

#form-container .calc-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

#form-container .calc-head h1 {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.3;
    font-weight: 600;
    color: var(--tool-ink);
}

#form-container .seg-toggle,
#form-container .mini-toggle {
    display: flex;
    padding: 0.25rem;
    border-radius: 12px;
    background: #f1f4f8;
}

#form-container .seg-toggle button,
#form-container .mini-toggle button {
    flex: 1;
    justify-content: center;
    padding: 0.6rem 0.5rem;
    border: none;
    border-radius: 9px;
    background: none;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--tool-muted);
    cursor: pointer;
}

#form-container .mini-toggle button {
    padding: 0.3rem 0.8rem;
}

#form-container .seg-toggle button:hover,
#form-container .mini-toggle button:hover {
    transform: none;
    box-shadow: none;
    color: var(--tool-ink);
}

#form-container .seg-toggle button.active,
#form-container .mini-toggle button.active {
    background: #fff;
    box-shadow: 0 1px 4px rgba(16, 24, 40, 0.12);
    font-weight: 600;
    color: var(--tool-ink);
}

#form-container .calc-about {
    margin: 0.9rem 0 1.4rem;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--tool-muted);
}

#form-container [hidden] {
    display: none;
}

#form-container .results #cost-breakdown {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    font-weight: 400;
    text-align: right;
    color: var(--tool-muted);
}

@media (max-width: 900px) {
    #form-container .results h3 {
        flex-direction: column;
        row-gap: 0.2rem;
    }

    #form-container .results #cost-breakdown {
        text-align: left;
    }
}

#form-container .tool-note {
    margin: 0.9rem 0 0;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--tool-muted);
}

#form-container .tool-note a {
    color: var(--tool-accent-ink);
}
