/* ic2 TOOLS — リンク一覧と設定ページの共通スタイル */

:root {
    --bg: #f3f1ec;
    --surface: #fffdf9;
    --surface-2: #f8f6f1;
    --ink: #1a1813;
    --muted: #6d685d;
    --faint: #a29d91;
    --line: #e2ddd2;
    --line-strong: #cfc8ba;
    --accent: #e0362a;
    --accent-ink: #ffffff;
    --focus: #2f6fe4;
    --ok: #1f8a4c;
    --shadow: 0 1px 0 rgba(26, 24, 19, .04), 0 8px 24px -12px rgba(26, 24, 19, .18);

    --hue-0: #e0362a;
    --hue-1: #2f6fe4;
    --hue-2: #1f8a4c;
    --hue-3: #b26a00;
    --hue-4: #7a4fd6;

    --radius: 14px;
    --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #121110;
        --surface: #1b1a17;
        --surface-2: #22201d;
        --ink: #f0ece3;
        --muted: #a39e93;
        --faint: #6f6b62;
        --line: #2d2b27;
        --line-strong: #3d3a35;
        --accent: #ff5747;
        --focus: #6d9cff;
        --ok: #4cc17f;
        --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .7);
        --hue-0: #ff5747;
        --hue-1: #6d9cff;
        --hue-2: #4cc17f;
        --hue-3: #e7a23c;
        --hue-4: #a98bff;
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

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

[hidden] { display: none !important; }

.sr-only {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 40px 24px 32px;
}

/* ---------- ヘッダー ---------- */

.masthead {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 28px;
    border-bottom: 2px solid var(--ink);
}

.brand { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }

.lamp {
    width: 14px; height: 14px; margin-top: 12px; flex: none;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

.masthead h1 {
    margin: 0;
    font-size: clamp(28px, 5vw, 40px);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.subtitle { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 300px;
    max-width: 100%;
    padding: 0 10px 0 12px;
    height: 42px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    color: var(--faint);
    cursor: text;
}
.search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.search input {
    flex: 1; min-width: 0; height: 100%;
    border: 0; background: none; outline: none;
    color: var(--ink); font: inherit;
}
.search input::-webkit-search-cancel-button { display: none; }
kbd {
    font: 12px/1 var(--mono);
    padding: 4px 7px;
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    color: var(--muted);
}
.search:focus-within kbd { display: none; }
@media (hover: none) { .search kbd { display: none; } }

/* ---------- カテゴリの絞り込み ---------- */

.filters {
    display: flex;
    gap: 8px;
    padding: 18px 0 4px;
    overflow-x: auto;
    scrollbar-width: none;
}
.chip {
    flex: none;
    display: inline-flex; align-items: center; gap: 8px;
    height: 34px; padding: 0 14px;
    font: inherit; font-size: 13px; font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    cursor: pointer;
}
.chip span { font: 11px var(--mono); color: var(--faint); }
.chip:hover { color: var(--ink); border-color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.is-active span { color: color-mix(in srgb, var(--bg) 65%, transparent); }

/* ---------- 一覧 ---------- */

.group { margin-top: 36px; }

.group h2 {
    display: flex; align-items: baseline; gap: 12px;
    margin: 0 0 14px;
    font-size: 13px; font-weight: 700;
    letter-spacing: .08em;
    color: var(--muted);
}
.group h2 .num { font: 600 12px var(--mono); color: var(--hue); }
.group h2::after { content: ""; flex: 1; height: 1px; background: var(--line); align-self: center; }

.grid {
    list-style: none; margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.card {
    position: relative;
    display: flex; align-items: flex-start; gap: 14px;
    height: 100%;
    padding: 16px 44px 16px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }

.mark {
    width: 40px; height: 40px; flex: none;
    display: grid; place-items: center;
    border-radius: 10px;
    font-weight: 800; font-size: 17px;
    color: var(--hue);
    background: color-mix(in srgb, var(--hue) 12%, var(--surface));
}

.body { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.name { font-weight: 700; font-size: 15.5px; line-height: 1.4; }
.desc {
    color: var(--muted); font-size: 13px; line-height: 1.55;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.place {
    margin-top: 4px;
    font: 11.5px/1.4 var(--mono);
    color: var(--faint);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.go {
    position: absolute; top: 16px; right: 16px;
    font-size: 15px; color: var(--faint);
    transition: color .15s, transform .15s;
}
.card:hover .go { color: var(--hue); transform: translate(2px, -1px); }
.card:hover .name { color: var(--ink); }

.empty { margin: 48px 0; text-align: center; color: var(--muted); }

/* ---------- フッター ---------- */

.foot {
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    margin-top: 56px; padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 12.5px; color: var(--faint);
}
.foot a {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--muted); text-decoration: none;
}
.foot a:hover { color: var(--ink); }
.foot svg { width: 15px; height: 15px; }

@media (max-width: 640px) {
    .page { padding: 28px 16px 24px; }
    .masthead { flex-direction: column; align-items: stretch; gap: 18px; padding-bottom: 20px; }
    .search { width: 100%; }
    .grid { grid-template-columns: 1fr; gap: 10px; }
    .group { margin-top: 28px; }
    .lamp { margin-top: 9px; width: 12px; height: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .card, .go { transition: none; }
    .card:hover { transform: none; }
}
