/*
 * Free Tools shared styles. Loaded after Pico CSS (pico.blue.min.css 2.1.1).
 *
 * Pico styles plain HTML (forms, buttons, tables). This file adds the site
 * chrome, page layout and a small set of components the tool pages share.
 * Colors come from the --ft-* tokens below, which switch with the light/dark
 * theme. Pages should use these tokens, never hard-coded colors.
 *
 * Layout        .page, .page--narrow, .page--wide, .page-header, .lead,
 *               .split, .split--aside, .cols
 * Surfaces      .panel, .card (inset), .tips, .table-wrap
 * Controls      .chips/.chip, .choices/.choice, .tabs, .btn-row, button.small,
 *               button.ghost, [data-state=copied|error] on any button
 * Output        .stats/.stat, .stat-value, .stat-label, .result-big, .output
 * Messages      .msg (+ --error/--success/--info/--warning), .error (inline text)
 * Utilities     .muted, .mono, .sr-only, .text-center
 */

/* ---- Tokens ---- */

:root {
    --pico-font-size: 100%;
    --pico-font-family-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans",
        "Noto Sans Devanagari", "Noto Sans Bengali", "Noto Sans Arabic", "Noto Sans Hebrew", sans-serif,
        var(--pico-font-family-emoji);
    --pico-border-radius: 0.5rem;
    --pico-form-element-spacing-vertical: 0.625rem;
    --pico-form-element-spacing-horizontal: 0.875rem;

    --ft-gutter: clamp(1rem, 4vw, 2rem);
    --ft-header-h: 3.75rem;
    --ft-chrome-max: 1180px;
    --ft-radius: 0.875rem;
    --ft-radius-sm: 0.5rem;
}

/* Chinese, Japanese and Korean share characters but draw them differently,
   so each gets its own font list (the page's lang attribute selects it). */
:root:lang(zh) {
    --pico-font-family-sans-serif: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
        "Noto Sans SC", sans-serif, var(--pico-font-family-emoji);
}
:root:lang(ja) {
    --pico-font-family-sans-serif: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI",
        "Yu Gothic", Meiryo, "Noto Sans JP", sans-serif, var(--pico-font-family-emoji);
}
:root:lang(ko) {
    --pico-font-family-sans-serif: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR",
        sans-serif, var(--pico-font-family-emoji);
}

:root:not([data-theme="dark"]),
:root[data-theme="light"] {
    --pico-background-color: #f5f7fb;
    --pico-card-background-color: #ffffff;
    --ft-bg: #f5f7fb;
    --ft-surface: #ffffff;
    --ft-surface-2: #f2f4f8;
    --ft-header-bg: rgba(255, 255, 255, 0.86);
    --ft-border: #e2e6ee;
    --ft-text: #2b313c;
    --ft-heading: #10151f;
    --ft-muted: #5d6677;
    --ft-accent: #2060df;
    --ft-accent-soft: rgba(32, 96, 223, 0.09);
    --ft-success: #16803c;
    --ft-success-soft: #e9f7ee;
    --ft-danger: #c4271f;
    --ft-danger-soft: #fdeeed;
    --ft-warning: #9a5b00;
    --ft-warning-soft: #fff5e1;
    --ft-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    --ft-shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --pico-background-color: #0e1117;
        --pico-card-background-color: #161a22;
        --ft-bg: #0e1117;
        --ft-surface: #161a22;
        --ft-surface-2: #1c212b;
        --ft-header-bg: rgba(14, 17, 23, 0.82);
        --ft-border: #29303c;
        --ft-text: #c9ced8;
        --ft-heading: #f1f3f7;
        --ft-muted: #98a1b1;
        --ft-accent: #8b9cff;
        --ft-accent-soft: rgba(139, 156, 255, 0.13);
        --ft-success: #4ade80;
        --ft-success-soft: rgba(74, 222, 128, 0.12);
        --ft-danger: #ff7b72;
        --ft-danger-soft: rgba(255, 123, 114, 0.12);
        --ft-warning: #fbbf24;
        --ft-warning-soft: rgba(251, 191, 36, 0.12);
        --ft-shadow: none;
        --ft-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
    }
}

:root[data-theme="dark"] {
    --pico-background-color: #0e1117;
    --pico-card-background-color: #161a22;
    --ft-bg: #0e1117;
    --ft-surface: #161a22;
    --ft-surface-2: #1c212b;
    --ft-header-bg: rgba(14, 17, 23, 0.82);
    --ft-border: #29303c;
    --ft-text: #c9ced8;
    --ft-heading: #f1f3f7;
    --ft-muted: #98a1b1;
    --ft-accent: #8b9cff;
    --ft-accent-soft: rgba(139, 156, 255, 0.13);
    --ft-success: #4ade80;
    --ft-success-soft: rgba(74, 222, 128, 0.12);
    --ft-danger: #ff7b72;
    --ft-danger-soft: rgba(255, 123, 114, 0.12);
    --ft-warning: #fbbf24;
    --ft-warning-soft: rgba(251, 191, 36, 0.12);
    --ft-shadow: none;
    --ft-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
}

/* ---- Base ---- */

html {
    scroll-padding-top: calc(var(--ft-header-h) + 1rem);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--ft-bg);
}

.i18n-loading body {
    visibility: hidden;
}

[hidden] {
    display: none !important;
}

h1, h2, h3, h4 {
    letter-spacing: -0.015em;
}

label,
legend {
    font-weight: 500;
}

legend {
    margin-bottom: 0.5rem;
}

a {
    text-underline-offset: 0.18em;
}

::selection {
    background: var(--ft-accent-soft);
}

/* ---- Header ---- */

.skip-link {
    position: absolute;
    inset-inline-start: -9999px;
    top: 0.5rem;
    z-index: 100;
    padding: 0.5rem 1rem;
    background: var(--ft-surface);
    border: 1px solid var(--ft-border);
    border-radius: var(--ft-radius-sm);
}
.skip-link:focus {
    inset-inline-start: 1rem;
}

body > header.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0;
    min-height: var(--ft-header-h);
    background: var(--ft-surface);
    background: var(--ft-header-bg);
    -webkit-backdrop-filter: saturate(1.6) blur(12px);
    backdrop-filter: saturate(1.6) blur(12px);
    border-bottom: 1px solid var(--ft-border);
}

.site-header .bar,
.tools-menu-inner,
.tools-menu-footer,
.footer-inner,
.footer-bottom {
    width: min(100% - 2 * var(--ft-gutter), var(--ft-chrome-max));
    margin-inline: auto;
}

.site-header .bar {
    height: var(--ft-header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--ft-heading);
    text-decoration: none;
    white-space: nowrap;
}
.brand:hover {
    color: var(--ft-heading);
}
.brand-mark {
    width: 1.75rem;
    height: 1.75rem;
    flex: none;
    color: #2060df; /* brand blue, same as favicon.svg, in both themes */
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

button.ghost,
.lang-picker {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: auto;
    margin: 0;
    padding: 0.45rem 0.7rem;
    font-size: 0.925rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ft-text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--ft-radius-sm);
    box-shadow: none;
}
button.ghost:hover,
button.ghost[aria-expanded="true"],
.lang-picker:hover,
.lang-picker:focus-within {
    color: var(--ft-heading);
    background: var(--ft-surface-2);
    border-color: var(--ft-border);
}

.site-header svg {
    width: 1.1rem;
    height: 1.1rem;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.site-header .brand-mark {
    width: 1.75rem;
    height: 1.75rem;
    stroke: none;
}
.menu-toggle svg:last-child {
    transition: transform 0.2s ease;
}
.menu-toggle[aria-expanded="true"] svg:last-child {
    transform: rotate(180deg);
}

.icon-btn {
    padding: 0.5rem;
}
/* Show the moon in light mode (switch to dark) and the sun in dark mode. */
.theme-toggle svg:first-child {
    display: none;
}
:root[data-theme="dark"] .theme-toggle svg:first-child {
    display: block;
}
:root[data-theme="dark"] .theme-toggle svg:last-child {
    display: none;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle svg:first-child {
        display: block;
    }
    :root:not([data-theme="light"]) .theme-toggle svg:last-child {
        display: none;
    }
}

.lang-picker {
    padding-block: 0;
    padding-inline: 0.6rem 0.15rem;
    cursor: pointer;
}
.lang-picker select {
    width: auto;
    height: auto;
    margin: 0;
    padding-block: 0.45rem;
    padding-inline: 0.15rem 1.6rem;
    font-size: 0.925rem;
    color: inherit;
    background-color: transparent;
    background-position: center right 0.3rem;
    border: 0;
    box-shadow: none;
    cursor: pointer;
}
.lang-picker select:focus {
    box-shadow: none;
}

.tools-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - var(--ft-header-h));
    overflow-y: auto;
    background: var(--ft-surface);
    border-bottom: 1px solid var(--ft-border);
    box-shadow: var(--ft-shadow-lg);
}
.tools-menu-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.25rem 2rem;
    padding: 1.5rem 0 0.75rem;
}
.tools-menu-footer {
    padding: 0.25rem 0.55rem 1.25rem;
    margin-block: 0;
    font-size: 0.9rem;
}

.menu-group h3 {
    margin: 0 0 0.5rem;
    padding-inline: 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ft-muted);
}
.menu-group ul,
.related-tools ul,
.tool-grid {
    margin: 0;
    padding: 0;
    list-style: none;
}
.menu-group li,
.related-tools li,
.tool-grid > li {
    display: block;
    margin: 0;
    padding: 0;
    list-style: none;
}
/* Pico lays out every <nav> as a horizontal bar; the menus here are columns. */
.tools-menu {
    display: block;
}
.menu-group ul,
.menu-group ul:first-of-type {
    display: block;
    margin: 0;
}
.menu-group li::before {
    content: none;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    padding: 0.45rem 0.55rem;
    font-size: 0.95rem;
    color: var(--ft-text);
    text-decoration: none;
    border-radius: var(--ft-radius-sm);
}
.menu-link:hover {
    color: var(--ft-accent);
    background: var(--ft-surface-2);
}
.menu-link[aria-current="page"] {
    font-weight: 600;
    color: var(--ft-accent);
    background: var(--ft-accent-soft);
}

/* The grid icon stands in for the "Tools" label on narrow screens. */
.menu-toggle .menu-icon {
    display: none;
}

@media (max-width: 520px) {
    .brand span {
        font-size: 0.95rem;
    }
    .menu-toggle .menu-label {
        display: none;
    }
    .menu-toggle .menu-icon {
        display: block;
    }
    .lang-picker select {
        max-width: 8.5rem;
        text-overflow: ellipsis;
    }
    .lang-picker > svg {
        display: none;
    }
    .lang-picker {
        padding-inline-start: 0.3rem;
    }
}

/* Very small phones: keep the logo, drop the wordmark so the controls fit. */
@media (max-width: 400px) {
    .site-header .brand span {
        display: none;
    }
}

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

main.page {
    width: min(100% - 2 * var(--ft-gutter), 960px);
    margin-inline: auto;
    padding: 1.5rem 0 3rem;
    flex: 1 0 auto;
}
main.page--narrow {
    width: min(100% - 2 * var(--ft-gutter), 760px);
}
main.page--wide {
    width: min(100% - 2 * var(--ft-gutter), var(--ft-chrome-max));
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--ft-muted);
}
.breadcrumb a {
    color: var(--ft-muted);
    text-decoration: none;
}
.breadcrumb a:hover {
    color: var(--ft-accent);
    text-decoration: underline;
}

.page-header {
    margin-bottom: 1.5rem;
}
.page-header h1 {
    margin-bottom: 0.5rem;
    font-size: clamp(1.7rem, 1.25rem + 1.6vw, 2.35rem);
    letter-spacing: -0.025em;
    line-height: 1.15;
}
.lead {
    max-width: 68ch;
    margin-bottom: 0;
    font-size: 1.0625rem;
    color: var(--ft-muted);
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr); /* let long translated text wrap instead of widening the page */
    gap: 1.25rem;
    align-items: start;
}
@media (min-width: 900px) {
    .split {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .split--aside {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    }
}
.split > .panel {
    margin-bottom: 0;
}
.split + * {
    margin-top: 1.25rem;
}

.cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 0 1.25rem;
}

/* ---- Surfaces ---- */

.panel,
main.page > article {
    margin-bottom: 1.25rem;
    padding: clamp(1.1rem, 3vw, 1.75rem);
    background: var(--ft-surface);
    border: 1px solid var(--ft-border);
    border-radius: var(--ft-radius);
    box-shadow: var(--ft-shadow);
}
.panel > :last-child,
main.page > article > :last-child {
    margin-bottom: 0;
}
.panel h2,
.panel-title {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}
.panel h3 {
    font-size: 1.05rem;
}
/* Headings that start a new section inside a panel need room above them. */
.panel * + :is(h2, h3) {
    margin-top: 1.5rem;
}

.card {
    margin-block: 1rem;
    padding: 1rem 1.15rem;
    background: var(--ft-surface-2);
    border: 1px solid var(--ft-border);
    border-radius: var(--ft-radius-sm);
}
.card > :last-child {
    margin-bottom: 0;
}

.tips {
    margin-top: 1.25rem;
    padding: 1.15rem 1.4rem;
    background: var(--ft-surface-2);
    border: 1px solid var(--ft-border);
    border-radius: var(--ft-radius);
    font-size: 0.95rem;
}
.tips h2,
.tips h3 {
    margin-bottom: 0.6rem;
    font-size: 1rem;
}
.tips > :last-child,
.tips ul:last-child {
    margin-bottom: 0;
}

.table-wrap {
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--ft-border);
    border-radius: var(--ft-radius-sm);
}
.table-wrap table {
    margin: 0;
}
.table-wrap :is(th, td) {
    padding-inline: 0.85rem;
}
table {
    font-variant-numeric: tabular-nums;
}
thead th {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ft-muted);
}

/* ---- Controls ---- */

.btn-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: var(--pico-spacing);
}
.btn-row > * {
    width: auto;
    margin: 0;
}

button.small,
[role="button"].small {
    width: auto;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

button[data-state="copied"],
button[data-state="copied"]:hover {
    color: #fff;
    background-color: var(--ft-success);
    border-color: var(--ft-success);
}
button[data-state="error"],
button[data-state="error"]:hover {
    color: #fff;
    background-color: var(--ft-danger);
    border-color: var(--ft-danger);
}

/* Wrap chip sets in <fieldset><legend>, not role="group" (Pico turns that
   into a joined button bar). */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: var(--pico-spacing);
}
.chip {
    width: auto;
    margin: 0;
    padding: 0.4rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--ft-text);
    background: var(--ft-surface-2);
    border: 1px solid var(--ft-border);
    border-radius: 999px;
    box-shadow: none;
}
.chip:hover {
    color: var(--ft-accent);
    border-color: var(--ft-accent);
}
.chip[aria-pressed="true"],
.chip.active {
    color: var(--ft-accent);
    background: var(--ft-accent-soft);
    border-color: var(--ft-accent);
}

.choices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
    gap: 0.75rem;
    margin-bottom: var(--pico-spacing);
}
.choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    margin: 0;
    padding: 0.85rem 1rem;
    text-align: start;
    color: var(--ft-text);
    background: var(--ft-surface-2);
    border: 1px solid var(--ft-border);
    border-radius: var(--ft-radius-sm);
    box-shadow: none;
}
.choice strong {
    font-size: 0.95rem;
    color: var(--ft-heading);
}
.choice small {
    font-size: 0.8rem;
    color: var(--ft-muted);
}
.choice:hover {
    border-color: var(--ft-accent);
}
.choice[aria-pressed="true"],
.choice.active {
    background: var(--ft-accent-soft);
    border-color: var(--ft-accent);
    box-shadow: inset 0 0 0 1px var(--ft-accent);
}

.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    padding: 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--ft-surface-2);
    border: 1px solid var(--ft-border);
    border-radius: calc(var(--ft-radius-sm) + 0.25rem);
}
.tabs::-webkit-scrollbar {
    display: none;
}
.tabs [role="tab"] {
    flex: 1 0 auto;
    width: auto;
    margin: 0;
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    color: var(--ft-muted);
    background: transparent;
    border: 0;
    border-radius: var(--ft-radius-sm);
    box-shadow: none;
}
.tabs [role="tab"]:hover {
    color: var(--ft-heading);
}
.tabs [role="tab"][aria-selected="true"] {
    color: var(--ft-heading);
    background: var(--ft-surface);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}

/* ---- Output ---- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
    gap: 0.75rem;
    margin-bottom: var(--pico-spacing);
}
.stat {
    padding: 0.85rem 1rem;
    background: var(--ft-surface-2);
    border: 1px solid var(--ft-border);
    border-radius: var(--ft-radius-sm);
    min-width: 0;
}
.stat-value {
    display: block;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    color: var(--ft-heading);
    overflow-wrap: anywhere;
}
.stat-label {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.8rem;
    color: var(--ft-muted);
}
.stat--accent .stat-value {
    color: var(--ft-accent);
}

.result-big {
    display: block;
    font-size: clamp(1.9rem, 1.4rem + 2vw, 2.75rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: var(--ft-heading);
    overflow-wrap: anywhere;
}

.output {
    min-height: 3rem;
    margin-bottom: 0.75rem;
    padding: 0.85rem 1rem;
    font-family: var(--pico-font-family-monospace);
    font-size: 0.95rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: var(--ft-surface-2);
    border: 1px solid var(--ft-border);
    border-radius: var(--ft-radius-sm);
}

/* ---- Messages ---- */

.msg {
    margin-block: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 1px solid transparent;
    border-radius: var(--ft-radius-sm);
}
.msg > :last-child {
    margin-bottom: 0;
}
.msg--error {
    color: var(--ft-danger);
    background: var(--ft-danger-soft);
    border-color: color-mix(in srgb, var(--ft-danger) 30%, transparent);
}
.msg--success {
    color: var(--ft-success);
    background: var(--ft-success-soft);
    border-color: color-mix(in srgb, var(--ft-success) 30%, transparent);
}
.msg--warning {
    color: var(--ft-warning);
    background: var(--ft-warning-soft);
    border-color: color-mix(in srgb, var(--ft-warning) 30%, transparent);
}
.msg--info {
    color: var(--ft-text);
    background: var(--ft-accent-soft);
    border-color: color-mix(in srgb, var(--ft-accent) 25%, transparent);
}

.error {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--ft-danger);
}

/* ---- Utilities ---- */

.muted {
    color: var(--ft-muted);
}
.mono {
    font-family: var(--pico-font-family-monospace);
}
.text-center {
    text-align: center;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Related tools ---- */

.related-tools {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--ft-border);
}
.related-tools h2 {
    margin-bottom: 0.85rem;
    font-size: 1rem;
}
.related-tools ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.chip-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.9rem;
    color: var(--ft-text);
    text-decoration: none;
    background: var(--ft-surface);
    border: 1px solid var(--ft-border);
    border-radius: 999px;
}
.chip-link:hover {
    color: var(--ft-accent);
    border-color: var(--ft-accent);
}

/* ---- Footer ---- */

body > footer.site-footer {
    margin-top: auto;
    padding: 2.5rem 0 1.5rem;
    font-size: 0.9rem;
    background: var(--ft-surface);
    border-top: 1px solid var(--ft-border);
}
.footer-inner {
    display: grid;
    gap: 2rem;
}
@media (min-width: 900px) {
    .footer-inner {
        grid-template-columns: minmax(220px, 1fr) 3fr;
        gap: 3rem;
    }
}
.footer-about p {
    margin: 0.75rem 0 0;
    max-width: 34ch;
}
.footer-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
}
.footer-links .menu-group h3 {
    padding-inline: 0;
}
.footer-link {
    display: block;
    margin: 0;
    padding: 0.2rem 0;
    font-size: 0.875rem;
    color: var(--ft-muted);
    text-decoration: none;
}
.footer-link:hover {
    color: var(--ft-accent);
}
.footer-link .tool-icon {
    display: none;
}
.footer-bottom {
    margin-top: 2rem;
    margin-bottom: 0;
    padding-top: 1.25rem;
    font-size: 0.8rem;
    color: var(--ft-muted);
    border-top: 1px solid var(--ft-border);
}

/* ---- Home page ---- */

.hero {
    padding: clamp(1.5rem, 6vw, 3.5rem) 0 1rem;
    text-align: center;
}
.hero h1 {
    margin-bottom: 0.75rem;
    font-size: clamp(2rem, 1.3rem + 3vw, 3.1rem);
    letter-spacing: -0.035em;
    line-height: 1.1;
}
.hero .lead {
    margin: 0 auto 1.25rem;
    font-size: 1.125rem;
}
.hero-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 1.25rem;
    margin: 0 0 1.75rem;
    padding: 0;
    font-size: 0.9rem;
    color: var(--ft-muted);
}
.hero-badges li {
    margin: 0;
    list-style: none;
}
.hero-badges li::before {
    content: "✓";
    margin-inline-end: 0.4rem;
    font-weight: 700;
    color: var(--ft-success);
}
.tool-search {
    max-width: 520px;
    margin: 0 auto;
}
.tool-search input {
    margin-bottom: 0;
}

.tool-section {
    margin-top: 2.25rem;
}
.tool-section h2 {
    margin-bottom: 0.9rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ft-muted);
}
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
    gap: 1rem;
}
.tool-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    height: 100%;
    padding: 1.1rem 1.15rem;
    color: inherit;
    text-decoration: none;
    background: var(--ft-surface);
    border: 1px solid var(--ft-border);
    border-radius: var(--ft-radius);
    box-shadow: var(--ft-shadow);
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.tool-card:hover,
.tool-card:focus-visible {
    border-color: var(--ft-accent);
    box-shadow: var(--ft-shadow-lg);
    transform: translateY(-2px);
}
.tool-card .tool-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.35rem;
    background: var(--ft-accent-soft);
    border-radius: 0.7rem;
}
.tool-card strong {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 1rem;
    color: var(--ft-heading);
}
.tool-card small {
    display: -webkit-box;
    overflow: hidden;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--ft-muted);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.no-results {
    margin-top: 2rem;
    text-align: center;
    color: var(--ft-muted);
}

/* ---- Right-to-left languages (Arabic, Hebrew, Urdu, Persian) ----
   The layout mirrors through logical properties and flexbox. Code, URLs,
   addresses and other machine text stay left-to-right. */

[dir="rtl"] .lang-picker select {
    background-position: center left 0.3rem;
}
[dir="rtl"] :is(code, kbd, samp, pre, .mono, .output) {
    direction: ltr;
    unicode-bidi: isolate;
}
[dir="rtl"] :is(input[type="url"], input[type="email"], input[type="tel"], input.ltr, textarea.ltr) {
    direction: ltr;
}
[dir="rtl"] :is(pre, .output) {
    text-align: left;
}
/* What visitors type, and data cells (which may hold English place names),
   take their direction from their own first letter, so "Hello, World!" keeps
   its punctuation in place. Translated UI text follows the page direction. */
[dir="rtl"] :is(input, textarea, td, dd) {
    unicode-bidi: plaintext;
}

/* ---- Motion & print ---- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}

@media print {
    .site-header,
    .site-footer,
    .skip-link,
    .breadcrumb,
    .related-tools,
    .tools-menu {
        display: none !important;
    }
    body {
        background: #fff;
    }
    .panel,
    main.page > article {
        box-shadow: none;
    }
}
