@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&family=Roboto+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap');

:root {
    /* Flexoki palette https://stephango.com/flexoki */
    --flexoki-white: #fffcf0;
    --flexoki-black: #100f0f;
    --bg: var(--flexoki-white);
    --bg-2: #f2f0e5;
    --ui: #e6e4d9;
    --ui-2: #dad8ce;
    --ui-3: #cecdc3;
    --tx-3: #b7b5ac;
    --tx-2: #6f6e69;
    --tx: var(--flexoki-black);
    --re-2: #d14d41;
    --or-2: #da702c;
    --ye-2: #d0a215;
    --gr-2: #879a39;
    --cy-2: #3aa99f;
    --bl-2: #4385be;
    --pu-2: #8b7ec8;
    --ma-2: #ce5d97;
    --re: #af3029;
    --or: #bc5215;
    --ye: #ad8301;
    --gr: #66800b;
    --cy: #24837b;
    --bl: #205ea6;
    --pu: #5e409d;
    --ma: #a02f6f;
    --accent: var(--ma);
    --accent-2: var(--pu);

    --font-body: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Roboto Serif', 'Iowan Old Style', 'Palatino Linotype', serif;
    --font-mono: 'Fira Code', 'JetBrains Mono', 'APL385 Unicode', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --radius-sm: 0.35rem;
    --radius-md: 0.65rem;
    --radius-lg: 1rem;
    --shadow-soft: 0 18px 32px -18px rgba(16, 15, 15, 0.35);
}

[data-theme="dark"] {
    --bg: #100f0f;
    --bg-2: #1c1b1a;
    --ui: #282726;
    --ui-2: #343331;
    --ui-3: #403e3c;
    --tx-3: #575653;
    --tx-2: #878580;
    --tx: #cecdc3;
    --re-2: #af3029;
    --or-2: #bc5215;
    --ye-2: #ad8301;
    --gr-2: #66800b;
    --cy-2: #24837b;
    --bl-2: #24837b;
    --pu-2: #5e409d;
    --ma-2: #a02f6f;
    --re: #d14d41;
    --or: #da702c;
    --ye: #d0a215;
    --gr: #879a39;
    --cy: #3aa99f;
    --bl: #4385be;
    --pu: #8b7ec8;
    --ma: #ce5d97;
    --accent: var(--ma);
    --accent-2: var(--pu);

    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--tx);
    line-height: 1.6;
    text-rendering: optimizeLegibility;
}

.page-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 3.5rem) clamp(1.25rem, 4vw, 2.75rem) clamp(3.25rem, 7vw, 4.5rem);
    display: grid;
    gap: clamp(2rem, 4vw, 3rem);
}

@media (max-width: 720px) {
    .page-shell {
        padding: clamp(1.5rem, 8vw, 2.25rem) clamp(1rem, 6vw, 1.5rem) clamp(2.5rem, 9vw, 3.25rem);
    }
}

.content-flow {
    display: grid;
    gap: var(--flow-space, 1.25rem);
}

.content-flow > * {
    margin: 0;
}

.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;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--tx);
    margin-top: 0;
    letter-spacing: -0.015em;
}

h1 {
    font-weight: 700;
}

h2,
h3,
h4 {
    font-weight: 600;
}

p,
li,
label,
figcaption,
small,
details,
summary {
    color: var(--tx);
}

a,
a:visited {
    color: var(--accent);
    text-decoration: none;
}

a:hover,
a:focus {
    color: var(--accent-2);
    text-decoration: underline;
}

button,
.button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 0.05rem solid var(--accent);
    background: var(--bg);
    color: var(--accent);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

button:hover,
.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
input[type="reset"]:hover {
    border-color: var(--accent-2);
    color: var(--accent-2);
    background: var(--bg-2);
}

button:disabled,
.button:disabled,
input[type="submit"]:disabled,
input[type="button"]:disabled,
input[type="reset"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button:focus,
.button:focus,
input[type="submit"]:focus,
input[type="button"]:focus,
input[type="reset"]:focus,
button:focus-visible,
.button:focus-visible,
input[type="submit"]:focus-visible,
input[type="button"]:focus-visible,
input[type="reset"]:focus-visible {
    border-color: var(--accent-2);
    color: var(--bg);
    background: var(--tx);
    outline: none;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: 1rem;
    border: 0.05rem solid var(--ui-2);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
    width: 100%;
    background: var(--bg-2);
    color: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.15rem rgba(160, 47, 111, 0.18);
    outline: none;
    background: var(--bg);
}

textarea {
    resize: vertical;
}

fieldset {
    border: 0.05rem solid var(--ui-2);
    border-radius: var(--radius-md);
    padding: 1rem;
}

legend {
    font-weight: 600;
}

.surface,
.card {
    background: var(--bg-2);
    border: 1px solid var(--ui-3);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: 1.5rem;
}

.recent-highlights {
    padding: clamp(1.25rem, 2vw, 2rem);
}

.recent-grid {
    display: grid;
    gap: clamp(1.25rem, 3vw, 1.75rem);
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.recent-card {
    display: grid;
    gap: 0.75rem;
}

.recent-card h2 {
    margin-bottom: 0.25rem;
}

.recent-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.6rem;
}

.recent-list a {
    font-weight: 600;
}

.recent-date,
.recent-empty {
    color: var(--tx-2);
    font-size: 0.95rem;
}

.tools-directory-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.55rem;
}

.tools-directory-list a {
    font-weight: 600;
}

.tools-directory-empty {
    color: var(--tx-2);
    font-size: 0.95rem;
}

.tool-search {
    display: grid;
    gap: 0.75rem;
    padding: clamp(1.25rem, 2.5vw, 1.75rem);
    position: relative;
}

.tool-search-input-wrapper {
    position: relative;
}

.tool-search-input-icon {
    position: absolute;
    top: 50%;
    left: clamp(0.85rem, 2vw, 1.1rem);
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--tx-2);
    pointer-events: none;
}

.tool-search-input-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

#tool-search-input {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--ui-2);
    background: var(--bg);
    padding: 0.75rem 1rem 0.75rem clamp(2.5rem, 7vw, 2.85rem);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    color: inherit;
}

#tool-search-input::placeholder {
    color: var(--tx-2);
}

.tool-search-hint {
    font-size: 0.9rem;
    color: var(--tx-2);
    margin: 0;
    max-width: 32rem;
}

.tool-search-results {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.65rem;
}

.tool-search-option {
    border-radius: var(--radius-md);
    border: 1px solid var(--ui-2);
    background: var(--bg);
    transition: border-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.tool-search-option:hover {
    border-color: var(--accent-2);
}

.tool-search-option.active {
    border-color: var(--accent);
    box-shadow: 0 10px 18px -12px rgba(16, 15, 15, 0.35);
    transform: translateY(-1px);
}

.tool-search-option-link {
    display: grid;
    gap: 0.35rem;
    color: inherit;
    padding: 0.75rem 0.9rem 0.85rem;
    text-decoration: none;
}

.tool-search-option-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.tool-search-option-description {
    font-size: 0.95rem;
    color: var(--tx-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-search-option-meta {
    font-size: 0.85rem;
    color: var(--tx-2);
}

.tool-search-empty {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px dashed var(--ui-3);
    color: var(--tx-2);
    background: var(--bg);
}

#tool-search-input:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

@media (max-width: 640px) {
    .tool-search {
        padding: clamp(1rem, 4vw, 1.35rem);
        gap: 0.65rem;
    }

    .tool-search-option-link {
        padding: 0.7rem 0.8rem 0.75rem;
    }
}

.tool-list {
    display: grid;
    gap: clamp(1.5rem, 3vw, 2.5rem);
}

.tool-entry {
    padding: clamp(1.25rem, 2.5vw, 1.85rem);
    display: grid;
    gap: 1rem;
}

.tool-entry-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 0.75rem;
}

.tool-entry-title {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-size: clamp(1.3rem, 3vw, 1.5rem);
    margin: 0;
}

.tool-entry-title a {
    color: inherit;
}

.tool-entry-anchor {
    color: var(--tx-2);
    font-size: 0.9rem;
}

.tool-entry-anchor:hover {
    color: var(--accent);
}

.tool-entry-links {
    display: flex;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.tool-entry-links a {
    color: var(--accent);
}

.tool-entry-links a:hover {
    color: var(--accent-2);
}

.tool-entry-docs {
    border-top: 1px solid var(--ui-2);
    padding-top: 0.75rem;
    display: grid;
    gap: 0.75rem;
}

.commit {
    background: var(--bg);
    border-left: 0.35rem solid var(--ui-3);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    display: grid;
    gap: 0.5rem;
}

.commit-hash {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent);
}

.commit-date {
    color: var(--tx-2);
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.commit-message {
    color: var(--tx);
}

details {
    border-top: 1px solid var(--ui-2);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

details[open] {
    padding-bottom: 0.25rem;
}

summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 600;
    list-style: none;
    padding: 0.25rem 0;
}

summary::-webkit-details-marker {
    display: none;
}

summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
}

details[open] summary::before {
    transform: rotate(90deg);
}

.tag,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(160, 47, 111, 0.12);
    color: var(--accent);
}

.status-message {
    border-left: 0.35rem solid var(--accent);
    border-radius: var(--radius-md);
    padding: 1rem;
    background: var(--bg-2);
}

.status-message.success {
    border-left-color: var(--gr);
}

.status-message.error {
    border-left-color: var(--re);
}

code,
pre,
kbd {
    font-family: var(--font-mono);
}

code {
    background: var(--ui);
    color: var(--tx);
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
}

pre {
    background: var(--ui);
    color: var(--tx);
    padding: 1rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    position: relative;
}

kbd {
    display: inline-block;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    background: var(--bg-2);
    border: 1px solid var(--ui-2);
    font-size: 0.7rem;
}

blockquote {
    border-left: 0.3rem solid var(--ui-3);
    margin: 0;
    padding: 0.5rem 1.25rem;
    background: var(--bg-2);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

hr {
    border: none;
    border-top: 1px solid var(--ui-3);
    margin: 2rem 0;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    color: var(--tx);
    background: var(--bg-2);
}

thead {
    color: var(--accent);
    border-bottom: 1px solid var(--tx);
}

th,
td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--ui-2);
    text-align: left;
}

tbody tr:nth-child(even) {
    background: var(--bg);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

:root {
    scroll-padding-top: 4rem;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
