/* EditorUltra home page styles. Shared by /, /en/ and /zh/. */

:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #eef0f4;
    --border: #e1e4eb;
    --border-strong: #c9ceda;
    --text: #10141d;
    --text-2: #4d5666;
    --text-3: #657082;
    --accent: #4338ca;
    --accent-contrast: #ffffff;
    --grid-dot: rgba(16, 20, 29, 0.09);
    --shadow-card: 0 1px 2px rgba(16, 20, 29, 0.04);
    --shadow-card-hover: 0 14px 32px -12px rgba(16, 20, 29, 0.22);

    --cat-data: #b45309;
    --cat-writing: #1d4ed8;
    --cat-code: #047857;
    --cat-media: #be185d;

    --icon-sun-display: none;
    --icon-moon-display: block;

    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

    --radius-small: 8px;
    --radius-medium: 12px;
    --radius-large: 16px;
    --page-padding: 24px;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0a0c10;
        --surface: #12151b;
        --surface-2: #1a1e26;
        --border: #232833;
        --border-strong: #353c4a;
        --text: #eceef2;
        --text-2: #a7afbd;
        --text-3: #8c95a6;
        --accent: #9a9bff;
        --accent-contrast: #0a0c10;
        --grid-dot: rgba(236, 238, 242, 0.08);
        --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-card-hover: 0 16px 36px -14px rgba(0, 0, 0, 0.75);

        --cat-data: #fbbf24;
        --cat-writing: #7cb0ff;
        --cat-code: #4ade80;
        --cat-media: #f472b6;

        --icon-sun-display: block;
        --icon-moon-display: none;

        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0a0c10;
    --surface: #12151b;
    --surface-2: #1a1e26;
    --border: #232833;
    --border-strong: #353c4a;
    --text: #eceef2;
    --text-2: #a7afbd;
    --text-3: #8c95a6;
    --accent: #9a9bff;
    --accent-contrast: #0a0c10;
    --grid-dot: rgba(236, 238, 242, 0.08);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 16px 36px -14px rgba(0, 0, 0, 0.75);

    --cat-data: #fbbf24;
    --cat-writing: #7cb0ff;
    --cat-code: #4ade80;
    --cat-media: #f472b6;

    --icon-sun-display: block;
    --icon-moon-display: none;

    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s ease, color 0.25s ease;
}

main {
    flex: 1 0 auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
    color: inherit;
}

ul {
    list-style: none;
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.container {
    width: 100%;
    max-width: 1168px;
    margin: 0 auto;
    padding: 0 var(--page-padding);
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -48px;
    z-index: 100;
    padding: 8px 14px;
    border-radius: var(--radius-small);
    background: var(--text);
    color: var(--bg);
    font-size: 14px;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 12px;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 60px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--text);
    color: var(--bg);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    transition: transform 0.25s ease;
}

.logo:hover .logo-mark {
    transform: rotate(-8deg) scale(1.06);
}

.logo-accent {
    color: var(--accent);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-switcher {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}

.lang-switcher a {
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-2);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.lang-switcher a:hover {
    color: var(--text);
}

.lang-switcher a[aria-current="true"] {
    background: var(--text);
    color: var(--bg);
    font-weight: 600;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.icon-button:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.icon-button:active {
    transform: scale(0.92);
}

.icon-button svg {
    width: 16px;
    height: 16px;
}

.icon-sun {
    display: var(--icon-sun-display);
}

.icon-moon {
    display: var(--icon-moon-display);
}

.header-link {
    padding: 6px 10px;
    font-size: 14px;
    color: var(--text-2);
    border-radius: var(--radius-small);
    transition: color 0.2s ease;
}

.header-link:hover {
    color: var(--text);
}

/* Hero */
.hero {
    position: relative;
    padding: 72px 0 28px;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(ellipse 75% 90% at 22% 0%, #000 0%, transparent 72%);
    mask-image: radial-gradient(ellipse 75% 90% at 22% 0%, #000 0%, transparent 72%);
    pointer-events: none;
}

.hero .container {
    position: relative;
}

.hero-eyebrow {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin-bottom: 20px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-3);
    animation: rise 0.5s ease both;
}

.hero-eyebrow .separator {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--border-strong);
}

.hero-title {
    font-size: clamp(34px, 8vw, 72px);
    font-weight: 750;
    line-height: 1.04;
    letter-spacing: -0.035em;
    animation: rise 0.55s ease 0.05s both;
}

.hero-line {
    display: block;
}

.hero-line-typed {
    white-space: nowrap;
}

.hero-line-muted {
    color: var(--text-3);
}

.typed {
    color: var(--accent);
}

.caret {
    display: inline-block;
    width: 0.07em;
    height: 0.86em;
    margin-left: 0.06em;
    vertical-align: -0.06em;
    border-radius: 2px;
    background: var(--accent);
    animation: caret-blink 1.05s steps(1) infinite;
}

.hero-subtitle {
    max-width: 560px;
    margin-top: 22px;
    font-size: 17px;
    color: var(--text-2);
    animation: rise 0.55s ease 0.1s both;
}

/* Finder: search + filters */
.finder {
    margin-top: 34px;
    animation: rise 0.55s ease 0.15s both;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 620px;
    height: 54px;
    padding: 0 12px 0 16px;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-card);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.search-icon {
    flex: none;
    width: 18px;
    height: 18px;
    color: var(--text-3);
}

.search-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 12px;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 16px;
}

.search-input::placeholder {
    color: var(--text-3);
}

.search-input::-webkit-search-cancel-button {
    display: none;
}

.search-hint {
    flex: none;
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-3);
}

.search-clear {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-2);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.search-clear:hover {
    background: var(--border);
}

.search-clear:active {
    transform: scale(0.9);
}

.search-clear svg {
    width: 12px;
    height: 12px;
}

.filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
}

.filter-chips {
    display: flex;
    gap: 8px;
    min-width: 0;
    padding: 2px;
    margin: -2px;
    overflow-x: auto;
    scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 14px;
    color: var(--text-2);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.chip:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.chip:active {
    transform: scale(0.96);
}

.chip[aria-pressed="true"] {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
    font-weight: 600;
}

.chip-count {
    font-family: var(--font-mono);
    font-size: 12px;
    opacity: 0.65;
}

.chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cat);
}

.result-count {
    flex: none;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-3);
    white-space: nowrap;
}

/* Recent tools */
.recent {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    animation: rise 0.4s ease both;
}

.recent-label {
    margin-right: 2px;
    font-size: 13px;
    color: var(--text-3);
}

.recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 11px 0 9px;
    border: 1px dashed var(--border-strong);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-2);
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.recent-link:hover {
    color: var(--text);
    border-style: solid;
    border-color: var(--cat);
    background: var(--surface);
}

/* Category colors */
[data-category="data"] {
    --cat: var(--cat-data);
}

[data-category="writing"] {
    --cat: var(--cat-writing);
}

[data-category="code"] {
    --cat: var(--cat-code);
}

[data-category="media"] {
    --cat: var(--cat-media);
}

/* Tools grid */
.tools {
    padding: 12px 0 88px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
    gap: 16px;
}

.tool-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 188px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    background: var(--surface);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    animation: rise 0.5s ease both;
    animation-delay: calc(0.18s + var(--i, 0) * 0.035s);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Once the entrance has played, filtering must not replay it. */
.tools-grid.is-ready .tool-card {
    animation: none;
}

.tool-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--cat) 13%, transparent), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tool-card:hover,
.tool-card:focus-visible {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--cat) 55%, var(--border));
    box-shadow: var(--shadow-card-hover);
}

.tool-card:hover::before,
.tool-card:focus-visible::before {
    opacity: 1;
}

.tool-card:active {
    transform: translateY(-1px) scale(0.99);
}

.tool-card > * {
    position: relative;
}

.tool-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.tool-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 46px;
    height: 46px;
    border: 1px solid color-mix(in srgb, var(--cat) 28%, transparent);
    border-radius: 11px;
    background: color-mix(in srgb, var(--cat) 11%, transparent);
    color: var(--cat);
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tool-card:hover .tool-glyph,
.tool-card:focus-visible .tool-glyph {
    transform: rotate(-5deg) scale(1.07);
}

.tool-arrow {
    width: 18px;
    height: 18px;
    color: var(--text-3);
    opacity: 0.45;
    transition: transform 0.25s ease, opacity 0.25s ease, color 0.25s ease;
}

.tool-card:hover .tool-arrow,
.tool-card:focus-visible .tool-arrow {
    transform: translate(3px, -3px);
    opacity: 1;
    color: var(--cat);
}

.tool-title {
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.tool-desc {
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-2);
}

.tool-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
    padding-top: 16px;
}

.tool-tags li {
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-2);
}

/* Empty state */
.empty-state {
    padding: 56px 20px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-large);
    text-align: center;
    animation: rise 0.3s ease both;
}

.empty-title {
    font-size: 18px;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.empty-text {
    margin-top: 6px;
    font-size: 14px;
    color: var(--text-2);
}

.empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.button {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.15s ease;
}

.button:hover {
    border-color: var(--text);
}

.button:active {
    transform: scale(0.97);
}

.button-primary {
    border-color: var(--text);
    background: var(--text);
    color: var(--bg);
}

/* Principles */
.principles {
    padding: 72px 0 80px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.section-title {
    max-width: 620px;
    font-size: clamp(26px, 3.6vw, 36px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.section-lead {
    max-width: 560px;
    margin-top: 12px;
    color: var(--text-2);
}

.principles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 32px;
    margin-top: 44px;
}

.principle {
    padding-top: 18px;
    border-top: 2px solid var(--text);
}

.principle-title {
    font-size: 16px;
    font-weight: 650;
}

.principle-text {
    margin-top: 8px;
    font-size: 14.5px;
    color: var(--text-2);
}

/* Footer */
.site-footer {
    flex: none;
    padding: 48px 0 32px;
    border-top: 1px solid var(--border);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr repeat(4, 1fr);
    gap: 32px;
}

.footer-about {
    max-width: 260px;
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-2);
}

.footer-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
}

.footer-links li + li {
    margin-top: 8px;
}

.footer-links a {
    font-size: 14px;
    color: var(--text-2);
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--text);
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-3);
}

.footer-bottom a {
    color: var(--text-2);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-bottom a:hover {
    color: var(--text);
}

/* Animations */
@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes caret-blink {
    0%, 55% {
        opacity: 1;
    }
    56%, 100% {
        opacity: 0;
    }
}

::view-transition-group(*) {
    animation-duration: 0.28s;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Responsive */
@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    :root {
        --page-padding: 16px;
    }

    .hero {
        padding: 44px 0 20px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .header-link,
    .search-hint,
    .result-count {
        display: none;
    }

    .finder {
        margin-top: 26px;
    }

    .filter-chips {
        margin: -2px calc(var(--page-padding) * -1);
        padding: 2px var(--page-padding);
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Compact row layout so more tools fit on one phone screen. */
    .tool-card {
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 14px;
        min-height: 0;
        padding: 16px;
    }

    .tool-top {
        grid-row: 1 / span 3;
        margin-bottom: 0;
    }

    .tool-arrow {
        display: none;
    }

    .tool-title,
    .tool-desc,
    .tool-tags {
        grid-column: 2;
    }

    .tool-tags {
        padding-top: 10px;
    }

    .tools {
        padding-bottom: 56px;
    }

    .principles {
        padding: 52px 0 56px;
    }

    .principles-grid {
        gap: 24px;
        margin-top: 32px;
    }
}

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

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .caret {
        animation: none;
    }
}
