/*
 * Tools hub styles — plain CSS, no build step.
 *
 * The design tokens (--color-paper, --color-ink, --color-accent, …) are already
 * published at :root by the site's compiled stylesheet, so this file only adds
 * tool-specific layout. Everything is prefixed .t- to avoid colliding with the
 * Tailwind utilities in the main build.
 *
 * Bump config('tools.asset_version') after editing.
 */

/* ---------------------------------------------------------------- layout */

/* The site navbar is position:fixed, so the first section has to clear it.
   These match the pt-28 / sm:pt-36 that x-page-hero uses on other pages. */
.t-head {
    padding: 7rem 0 0;
}

@media (min-width: 640px) {
    .t-head {
        padding-top: 9rem;
    }
}

.t-h1 {
    margin: 1.25rem 0 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2rem, 1.3rem + 2.6vw, 3.1rem);
    line-height: 1.06;
    letter-spacing: -0.025em;
    color: var(--color-ink);
    text-wrap: balance;
}

.t-intro {
    margin: 1rem 0 0;
    max-width: 62ch;
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--color-ink-2);
}

.t-intro-wide {
    max-width: 72ch;
}

.t-intro a {
    color: var(--color-accent);
}

.t-intro a:hover {
    text-decoration: underline;
}

.t-section {
    padding: 3rem 0;
}

.t-section-alt {
    background: var(--color-paper-2);
    border-top: 1px solid var(--color-line);
    border-bottom: 1px solid var(--color-line);
}

.t-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.t-h2 {
    margin: 0 0 1.5rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: -0.015em;
    color: var(--color-ink);
}

.t-section-head .t-h2 {
    margin-bottom: 0;
}

.t-more {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--color-accent);
}

.t-more:hover {
    text-decoration: underline;
}

/* ----------------------------------------------------------- trust strip */

.t-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
    font-family: var(--font-mono);
    font-size: 0.78125rem;
    color: var(--color-ink-3);
}

.t-trust li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.t-trust-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--color-ok);
    flex: none;
}

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

.t-stage {
    padding: 2rem 0 0;
}

.t-app {
    border: 1px solid var(--color-line);
    border-radius: 14px;
    background: var(--color-paper-card);
    padding: clamp(1rem, 0.5rem + 2vw, 1.75rem);
}

.t-noscript {
    margin: 0;
    color: var(--color-ink-2);
}

/* ------------------------------------------------------ loading state */

/* Shown while the widget's JavaScript is still arriving. Hidden the moment
   boot.js mounts the app, so on a fast connection it barely registers. */
.t-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    min-height: 190px;
    padding: 2.25rem 1.25rem;
    text-align: center;
}

.t-loader[hidden] {
    display: none;
}

/* The four squares of the Dynamb mark, breathing in sequence. */
.t-loader-mark {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    width: 38px;
    height: 38px;
}

.t-loader-mark span {
    border-radius: 3px;
    background: var(--color-accent);
    animation: t-tile 1.4s ease-in-out infinite;
}

.t-loader-mark span:nth-child(1) { animation-delay: 0s; }
.t-loader-mark span:nth-child(2) { animation-delay: 0.15s; }
.t-loader-mark span:nth-child(4) { animation-delay: 0.3s; }
.t-loader-mark span:nth-child(3) { animation-delay: 0.45s; background: var(--color-tile-sky); }

@keyframes t-tile {
    0%, 70%, 100% { opacity: 0.22; transform: scale(0.82); }
    35%           { opacity: 1;    transform: scale(1); }
}

.t-loader-msg {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.0625rem;
    color: var(--color-ink);
}

.t-loader-sub {
    margin: 0;
    max-width: 46ch;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--color-ink-3);
}

.t-loader.is-slow .t-loader-mark span {
    background: var(--color-warn);
}

.t-loader.is-failed .t-loader-mark {
    display: none;
}

.t-loader.is-failed .t-loader-msg {
    color: var(--color-error);
}

@media (prefers-reduced-motion: reduce) {
    .t-loader-mark span {
        animation-duration: 3s;
    }
}

/* Hide Vue templates until the app has compiled them, so raw markup never
   flashes on screen. */
[v-cloak] {
    display: none;
}

.t-controls-idle {
    opacity: 0.55;
    pointer-events: none;
}

/* --------------------------------------------------------- widget pieces */

.t-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 190px;
    padding: 1.75rem 1.25rem;
    border: 1.5px dashed var(--color-line-strong);
    border-radius: 12px;
    background: var(--color-paper-2);
    text-align: center;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease;
}

.t-drop:hover,
.t-drop.is-over {
    border-color: var(--color-accent);
    background: var(--color-accent-wash);
}

.t-drop:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
}

.t-drop-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.0625rem;
    color: var(--color-ink);
}

.t-drop-hint {
    font-size: 0.875rem;
    color: var(--color-ink-3);
}

.t-grid {
    display: grid;
    gap: 1.25rem;
}

/* Grid and flex items default to min-width:auto, so one wide child (a data
   table, a long unbroken string) stretches the whole page instead of
   scrolling inside its own box. This is the usual cause of mobile
   horizontal scroll. */
.t-grid > *,
.t-row > * {
    min-width: 0;
}

@media (min-width: 820px) {
    .t-grid-2 {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.t-field {
    display: block;
    margin-bottom: 0.875rem;
}

.t-label {
    display: block;
    margin-bottom: 0.3rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-ink-3);
}

.t-input,
.t-select,
.t-textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-line-strong);
    border-radius: 9px;
    background: var(--color-paper-card);
    color: var(--color-ink);
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.4;
}

.t-input:focus,
.t-select:focus,
.t-textarea:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
    border-color: var(--color-accent);
}

.t-input[type="number"] {
    font-variant-numeric: tabular-nums;
}

.t-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    align-items: center;
}

/* ------------------------------------------- number input with a slider */

/* The slider is deliberately quiet: a hairline track that only gains weight
   on hover or focus, so a form of six fields does not turn into six bars
   competing with the numbers. */
.t-numfield {
    margin-bottom: 1.1rem;
}

.t-numfield-row {
    position: relative;
    display: flex;
    align-items: center;
}

.t-numfield-suffix {
    position: absolute;
    right: 2.2rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--color-ink-3);
    pointer-events: none;
}

.t-slider {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 18px;
    margin: 0.3rem 0 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.t-slider::-webkit-slider-runnable-track {
    height: 3px;
    border-radius: 999px;
    background: var(--color-line-strong);
    transition: background-color 120ms ease;
}

.t-slider::-moz-range-track {
    height: 3px;
    border-radius: 999px;
    background: var(--color-line-strong);
}

.t-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -5.5px;
    border-radius: 999px;
    background: var(--color-paper-card);
    border: 2px solid var(--color-accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
    transition: transform 120ms ease;
}

.t-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: var(--color-paper-card);
    border: 2px solid var(--color-accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}

.t-slider:hover::-webkit-slider-runnable-track,
.t-slider:focus-visible::-webkit-slider-runnable-track {
    background: var(--color-accent-wash);
}

.t-slider:hover::-moz-range-track,
.t-slider:focus-visible::-moz-range-track {
    background: var(--color-accent-wash);
}

.t-slider:hover::-webkit-slider-thumb,
.t-slider:active::-webkit-slider-thumb {
    transform: scale(1.15);
}

.t-slider:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
    border-radius: 999px;
}

.t-numfield-hint {
    margin: 0.3rem 0 0;
    font-size: 0.78rem;
    color: var(--color-ink-3);
}

@media (prefers-reduced-motion: reduce) {
    .t-slider::-webkit-slider-thumb {
        transition: none;
    }
}

/* Coarse pointers get a bigger target — a 14px thumb is hard to grab. */
@media (pointer: coarse) {
    .t-slider {
        height: 26px;
    }

    .t-slider::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
        margin-top: -8.5px;
    }

    .t-slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }
}

.t-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.1rem;
    border: 1px solid var(--color-line-strong);
    border-radius: 999px;
    background: var(--color-paper-card);
    color: var(--color-ink);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.t-btn:hover:not(:disabled) {
    border-color: var(--color-ink-3);
}

.t-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.t-btn-primary {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

.t-btn-primary:hover:not(:disabled) {
    background: var(--color-accent-deep);
    border-color: var(--color-accent-deep);
}

.t-chip {
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--color-line-strong);
    border-radius: 999px;
    background: var(--color-paper-card);
    color: var(--color-ink-2);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    cursor: pointer;
}

.t-chip.is-on {
    background: var(--color-accent-wash);
    border-color: var(--color-accent);
    color: var(--color-accent-deep);
}

.t-note {
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
    color: var(--color-ink-3);
}

.t-error {
    margin: 0.75rem 0 0;
    padding: 0.7rem 0.9rem;
    border-radius: 9px;
    background: #FBEDEE;
    color: var(--color-error);
    font-size: 0.875rem;
}

.t-ok {
    color: var(--color-ok);
}

.t-result {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-line);
}

.t-preview {
    max-width: 100%;
    max-height: 340px;
    border-radius: 10px;
    border: 1px solid var(--color-line);
    background: var(--color-paper-2);
    display: block;
}

.t-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin: 0.9rem 0 0;
    padding: 0;
    list-style: none;
    font-variant-numeric: tabular-nums;
}

.t-stat-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-ink-3);
}

.t-stat-value {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--color-ink);
}

.t-busy {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-line-strong);
    border-top-color: var(--color-accent);
    border-radius: 999px;
    animation: t-spin 700ms linear infinite;
}

@keyframes t-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .t-busy { animation-duration: 2s; }
}

/* ------------------------------------------------------------ how-to/faq */

.t-steps {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: t-step;
}

.t-step {
    display: grid;
    grid-template-columns: 2rem 1fr;
    gap: 0.9rem;
    align-items: start;
}

.t-step-n {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--color-accent-wash);
    color: var(--color-accent-deep);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 600;
}

.t-step-title {
    margin: 0.25rem 0 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-ink);
}

.t-step-detail {
    margin: 0.25rem 0 0;
    max-width: 68ch;
    color: var(--color-ink-2);
    font-size: 0.9375rem;
}

.t-faq {
    display: grid;
    gap: 0.5rem;
    max-width: 78ch;
}

.t-faq-item {
    border: 1px solid var(--color-line);
    border-radius: 10px;
    background: var(--color-paper-card);
    padding: 0.9rem 1.1rem;
}

.t-faq-q {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-ink);
    cursor: pointer;
    list-style: none;
}

.t-faq-q::-webkit-details-marker {
    display: none;
}

.t-faq-q::before {
    content: "+";
    display: inline-block;
    width: 1.1rem;
    color: var(--color-accent);
    font-family: var(--font-mono);
}

.t-faq-item[open] .t-faq-q::before {
    content: "\2212";
}

.t-faq-a p {
    margin: 0.6rem 0 0 1.1rem;
    color: var(--color-ink-2);
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* ---------------------------------------------------------------- cards */

.t-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.t-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    height: 100%;
    padding: 1rem 1.1rem;
    border: 1px solid var(--color-line);
    border-radius: 11px;
    background: var(--color-paper-card);
    transition: border-color 120ms ease, transform 120ms ease;
}

.t-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-1px);
}

.t-card-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9875rem;
    color: var(--color-ink);
}

.t-card-desc {
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--color-ink-3);
}

/* ------------------------------------------------------------------ cta */

.t-cta {
    padding: 2rem 0 3.5rem;
}

.t-cta-slim {
    margin: 0;
    max-width: 70ch;
    font-size: 0.9375rem;
    color: var(--color-ink-3);
}

.t-cta-slim a {
    color: var(--color-accent);
}

.t-cta-slim a:hover {
    text-decoration: underline;
}

.t-cta-strong {
    padding: 3rem 0;
    background: var(--color-paper-2);
    border-top: 1px solid var(--color-line);
}

.t-cta-h {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.625rem;
    letter-spacing: -0.02em;
    color: var(--color-ink);
}

.t-cta-p {
    margin: 0.75rem 0 0;
    max-width: 62ch;
    color: var(--color-ink-2);
}

.t-cta-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.t-cta-mail {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--color-accent);
}

.t-cta-mail:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------- print */

@media print {
    body > header,
    body > footer,
    .t-head,
    .t-section,
    .t-cta,
    .t-trust,
    .t-noscript,
    [data-print-hide] {
        display: none !important;
    }

    .t-app {
        border: 0;
        padding: 0;
    }

    .t-stage {
        padding: 0;
    }
}
