@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans+KR:wght@400;500;600;700&display=swap');

/* ---------- Design tokens ---------- */
:root {
  --paper: #f4f2ec;
  --surface: #fdfcf9;
  --surface-2: #eeece5;
  --surface-3: #e5e3da;
  --ink: #252620;
  --text-2: #5a5c54;
  --muted: #696a61;
  --rule: #d4d3c9;
  --rule-strong: #a7a89b;
  --blue: #3347bf;
  --blue-soft: #e1e5fa;
  --focus: #3347bf;
  --white: #fdfcf9;
  --danger: #a04432;
  --selection-bg: #dfe2fa;
  --selection-fg: #1b2e9b;
  --bar-bg: rgba(244, 242, 236, .84);
  --chip-bg: rgba(253, 252, 249, .9);
  --backdrop: rgba(37, 38, 32, .42);
  --shadow-1: 0 1px 2px rgba(37, 38, 32, .06);
  --shadow-2: 0 12px 28px -14px rgba(37, 38, 32, .32), 0 2px 6px rgba(37, 38, 32, .07);
  --shadow-3: 0 24px 60px -24px rgba(37, 38, 32, .45);
  --status-published-fg: #1d6b3a; --status-published-bg: #dcf1e2; --status-published-dot: #2f9e5b;
  --status-development-fg: #7a4d04; --status-development-bg: #fbebc8; --status-development-dot: #d99a1a;
  --status-external-fg: #2d3fab; --status-external-bg: #e1e5fa; --status-external-dot: #4d63e0;
  --status-source-fg: #4d4f47; --status-source-bg: #e8e7df; --status-source-dot: #8a8c82;
  --warn-fg: #8d3f1d; --warn-bg: #fbe5d8; --warn-dot: #d8692f;
  --cat-0: #0b6b74; --cat-0-a: #d7ecec; --cat-0-b: #eef6f3;
  --cat-1: #3347bf; --cat-1-a: #dde2fa; --cat-1-b: #eef0fb;
  --cat-2: #5f3fb0; --cat-2-a: #e4ddf6; --cat-2-b: #f1edfa;
  --cat-3: #7a5a2a; --cat-3-a: #efe4d2; --cat-3-b: #f6f0e6;
  --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23696a61' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --radius-card: 12px;
  --radius-thumb: 8px;
  --radius-control: 8px;
  --content-max: 1392px;
  --gutter: 56px;
  --toolbar-offset: 0px;
  color-scheme: light;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1b19;
    --surface: #232420;
    --surface-2: #2c2d29;
    --surface-3: #35362f;
    --ink: #ecebe4;
    --text-2: #c0c1b8;
    --muted: #a1a299;
    --rule: #35362f;
    --rule-strong: #4e4f48;
    --blue: #97a4ff;
    --blue-soft: rgba(151, 164, 255, .18);
    --focus: #aeb9ff;
    --white: #1a1b19;
    --danger: #f09a8a;
    --selection-bg: #35407a;
    --selection-fg: #ecebe4;
    --bar-bg: rgba(26, 27, 25, .82);
    --chip-bg: rgba(35, 36, 32, .88);
    --backdrop: rgba(0, 0, 0, .6);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 12px 28px -14px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-3: 0 24px 60px -24px rgba(0, 0, 0, .8);
    --status-published-fg: #8fdca8; --status-published-bg: rgba(74, 222, 128, .14); --status-published-dot: #4ade80;
    --status-development-fg: #f0c56a; --status-development-bg: rgba(245, 180, 60, .14); --status-development-dot: #f5b43c;
    --status-external-fg: #aeb9ff; --status-external-bg: rgba(140, 160, 255, .16); --status-external-dot: #8ca0ff;
    --status-source-fg: #c6c7bd; --status-source-bg: rgba(255, 255, 255, .08); --status-source-dot: #8e8f87;
    --warn-fg: #f1a586; --warn-bg: rgba(240, 120, 80, .16); --warn-dot: #f07850;
    --cat-0: #8fdbe0; --cat-0-a: #16393c; --cat-0-b: #1f2a2b;
    --cat-1: #aeb9ff; --cat-1-a: #232a4a; --cat-1-b: #22242e;
    --cat-2: #c9b3f7; --cat-2-a: #2c2440; --cat-2-b: #24222b;
    --cat-3: #e0c396; --cat-3-a: #3a2f1f; --cat-3-b: #282521;
    --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a299' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
.category-0 { --cat: var(--cat-0); --cat-a: var(--cat-0-a); --cat-b: var(--cat-0-b); }
.category-1 { --cat: var(--cat-1); --cat-a: var(--cat-1-a); --cat-b: var(--cat-1-b); }
.category-2 { --cat: var(--cat-2); --cat-a: var(--cat-2-a); --cat-b: var(--cat-2-b); }
.category-3 { --cat: var(--cat-3); --cat-a: var(--cat-3-a); --cat-b: var(--cat-3-b); }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-size: 14px; line-height: 1.6; background: var(--paper); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; background: transparent; border: 0; padding: 0; }
button:disabled { opacity: .45; cursor: wait; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--selection-bg); color: var(--selection-fg); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg use { pointer-events: none; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.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; }
.skip-link { position: fixed; top: -80px; left: 24px; z-index: 100; padding: 12px 20px; border-radius: var(--radius-control); background: var(--ink); color: var(--white); box-shadow: var(--shadow-2); }
.skip-link:focus { top: 16px; }

/* ---------- Header ---------- */
.site-header {
  width: min(100% - var(--gutter) * 2, var(--content-max));
  margin: 0 auto;
  min-height: 96px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 32px;
  border-bottom: 1px solid var(--ink);
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: fit-content; padding: 8px 0; }
.brand strong { font-size: 21px; font-weight: 600; letter-spacing: -.85px; line-height: 1.2; }
.brand span { font-size: 11px; letter-spacing: .02em; color: var(--muted); }
.main-nav { display: flex; align-items: center; gap: 4px; align-self: stretch; }
.nav-item { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--radius-control); font-size: 13px; color: var(--muted); transition: color .15s ease, background-color .15s ease; }
.nav-item:hover { color: var(--ink); background: var(--surface-2); }
.nav-item.is-active { color: var(--ink); font-weight: 500; }
.nav-item.is-active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; border-radius: 2px; background: var(--blue); }
.header-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.profile-link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border-radius: var(--radius-control); font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.profile-link svg { width: 13px; height: 13px; color: var(--blue); }
.profile-link:hover { color: var(--blue); background: var(--surface-2); }
.data-menu { position: relative; font-size: 12px; }
.data-menu summary { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--surface); cursor: pointer; list-style: none; white-space: nowrap; font-weight: 500; transition: border-color .15s ease, background-color .15s ease; }
.data-menu summary::-webkit-details-marker { display: none; }
.data-menu summary::after { content: ''; width: 14px; height: 14px; background: var(--chevron) center / 14px no-repeat; transition: transform .15s ease; }
.data-menu summary:hover { border-color: var(--rule-strong); }
.data-menu[open] summary { background: var(--surface-2); border-color: var(--rule-strong); }
.data-menu[open] summary::after { transform: rotate(180deg); }
.data-menu-content { position: absolute; top: calc(100% + 8px); right: 0; width: 208px; z-index: 40; padding: 6px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-2); animation: pop .14s ease-out; }
.data-menu-content::before { content: ''; position: absolute; top: -6px; right: 18px; width: 10px; height: 10px; border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); background: var(--surface); transform: rotate(45deg); }
.data-menu-content button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px; font-size: 13px; text-align: left; }
.data-menu-content button svg { width: 16px; height: 16px; color: var(--muted); }
.data-menu-content button:hover { background: var(--surface-2); color: var(--ink); }
.data-menu-content button:hover svg { color: var(--blue); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Layout ---------- */
.app-shell { max-width: calc(var(--content-max) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
main { padding-top: 40px; }
.welcome { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; padding-bottom: 32px; }
.eyebrow { margin: 0 0 12px; font-size: 11px; font-weight: 400; color: var(--muted); }
h1 { margin: 0; font-size: clamp(46px, 5vw, 67px); font-weight: 500; letter-spacing: -.065em; line-height: 1.05; }
.project-total { position: relative; top: -1.4em; margin-left: 16px; font-family: var(--mono); font-size: 15px; letter-spacing: -.05em; color: var(--blue); font-weight: 400; }
.welcome-description { margin: 0 0 8px; color: var(--text-2); font-size: 14px; }
.welcome-copy { display: flex; align-items: flex-end; gap: 40px; }
.welcome-note { margin: 0 0 3px; color: var(--muted); font-size: 11px; }

/* ---------- Quick access ---------- */
.quick-section { display: flex; align-items: center; gap: 24px; padding: 16px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.minor-heading { flex-shrink: 0; }
.minor-heading h2 { margin: 0; font-size: 11px; font-weight: 500; letter-spacing: .02em; color: var(--muted); }
.quick-projects { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.quick-project { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; min-height: 40px; padding: 0 12px 0 8px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); font-size: 13px; transition: border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease; }
.quick-project:hover { color: var(--blue); border-color: var(--rule-strong); box-shadow: var(--shadow-1); }
.quick-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--cat-a, var(--surface-2)); color: var(--cat, var(--muted)); }
.quick-icon svg { width: 13px; height: 13px; }
.quick-project strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.quick-project > svg { width: 12px; height: 12px; color: var(--muted); }
.quick-project:hover > svg { color: var(--blue); }
.quick-empty { font-size: 12px; color: var(--muted); margin: 0; }

/* ---------- Library toolbar (sticky) ---------- */
.library { margin-top: 24px; scroll-margin-top: 16px; }
.library-toolbar {
  position: sticky; top: var(--toolbar-offset); z-index: 20;
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: 'search selects add' 'tabs tabs view';
  column-gap: 16px; row-gap: 4px;
  padding: 12px 0 0;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--rule);
}
.toolbar-row, .filter-row, .controls-row { display: contents; }
.search-box { grid-area: search; display: flex; align-items: center; gap: 10px; width: 100%; max-width: 440px; min-width: 0; min-height: 40px; padding: 0 10px 0 12px; border: 1px solid var(--rule-strong); border-radius: var(--radius-control); background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease; }
.search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.search-box > svg { width: 16px; height: 16px; color: var(--muted); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 0; background: transparent; font-size: 13px; line-height: 24px; -webkit-appearance: none; appearance: none; }
.search-box input::placeholder { color: var(--muted); }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-box kbd { font: 10px/1 var(--mono); color: var(--muted); padding: 4px 5px; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface-2); }
.select-tools { grid-area: selects; display: flex; align-items: center; gap: 8px; }
.select-tools select { -webkit-appearance: none; appearance: none; min-height: 40px; padding: 0 30px 0 12px; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--surface) var(--chevron) no-repeat right 9px center / 16px; font-size: 12px; font-weight: 500; color: var(--text-2); cursor: pointer; transition: border-color .15s ease; }
.select-tools select:hover { border-color: var(--rule-strong); color: var(--ink); }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: var(--radius-control); font-size: 13px; font-weight: 500; border: 1px solid var(--ink); background: var(--ink); color: var(--white); white-space: nowrap; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.primary-button svg { width: 14px; height: 14px; }
.primary-button:hover { background: var(--blue); border-color: var(--blue); color: #fdfcf9; }
.secondary-button { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.secondary-button:hover { border-color: var(--ink); background: var(--surface-2); }
#add-project { grid-area: add; padding-right: 16px; }
.category-tabs { grid-area: tabs; display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; margin-bottom: -1px; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border-bottom: 2px solid transparent; white-space: nowrap; color: var(--muted); font-size: 13px; transition: color .15s ease; }
.category-tab:hover { color: var(--ink); }
.category-tab.is-active { color: var(--blue); font-weight: 500; border-bottom-color: var(--blue); }
.category-count { display: inline-flex; align-items: center; min-height: 18px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); font: 500 10px/1 var(--mono); color: var(--muted); }
.category-tab.is-active .category-count { background: var(--blue-soft); color: var(--blue); }
.view-tools { grid-area: view; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-bottom: 6px; }
#result-count { font: 11px var(--mono); color: var(--muted); white-space: nowrap; }
.view-toggle { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--surface); }
.view-toggle button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 30px; border-radius: 6px; color: var(--muted); transition: background-color .15s ease, color .15s ease; }
.view-toggle button:hover { color: var(--ink); }
.view-toggle button.is-active { color: var(--ink); background: var(--surface-2); box-shadow: var(--shadow-1); }
.view-toggle button svg { width: 16px; height: 16px; }

/* ---------- List header (list view only) ---------- */
.list-header { display: none; grid-template-columns: 32px 48px minmax(0, 1fr) 184px 88px 140px; column-gap: 16px; padding: 10px 8px; font: 500 11px var(--mono); letter-spacing: .02em; color: var(--muted); border-bottom: 1px solid var(--ink); }
.list-header span:first-child { grid-column: 1 / 3; }
.list-header span:last-child { text-align: right; }
.library.is-list-view .list-header { display: grid; }

/* ---------- Project grid ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; padding-top: 20px; scroll-margin-top: 120px; }
.project-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto 1fr auto auto auto; grid-template-areas: 'media' 'meta' 'title' 'desc' 'domain' 'related' 'footer'; border: 1px solid var(--rule); border-radius: var(--radius-card); background: var(--surface); overflow: clip; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--rule-strong); }
.project-card:focus-within { border-color: var(--rule-strong); }
.card-body { display: contents; }
.project-order { position: absolute; top: 10px; left: 10px; z-index: 2; pointer-events: none; padding: 5px 7px; border-radius: 6px; background: var(--chip-bg); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); font: 500 11px/1 var(--mono); color: var(--text-2); box-shadow: var(--shadow-1); }
.card-media { grid-area: media; position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); border-bottom: 1px solid var(--rule); container-type: inline-size; }
.card-visual-link { display: block; position: absolute; inset: 0; overflow: hidden; }
.card-visual-link:focus-visible { outline-offset: -3px; border-radius: 0; }
.card-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: center top; z-index: 1; filter: saturate(.85); transition: transform .35s ease, filter .35s ease; }
.project-card:hover .card-image { filter: saturate(1); transform: scale(1.025); }
.card-fallback { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(135deg, var(--cat-a) 0%, var(--cat-b) 100%); color: var(--cat); }
.card-fallback::before { content: ''; position: absolute; right: -18%; bottom: -45%; width: 70%; aspect-ratio: 1; border-radius: 50%; border: 1.5px solid currentColor; opacity: .14; }
.card-fallback::after { content: ''; position: absolute; right: 6%; bottom: -70%; width: 48%; aspect-ratio: 1; border-radius: 50%; border: 1.5px solid currentColor; opacity: .1; }
.card-fallback > svg { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; stroke-width: 1.4; opacity: .9; }
.fallback-initial { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(12px, 22cqw, 64px); font-weight: 600; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.fallback-name { display: none; }
.fallback-category { position: absolute; left: 12px; bottom: 10px; font-size: 11px; font-weight: 500; letter-spacing: .02em; }
.card-toolbar { display: none; }
.card-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 16px 0; min-height: 22px; font-size: 11px; }
.chip, .category-label, .status-label, .availability-label, .private-label { display: inline-flex; align-items: center; gap: 6px; min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 500; line-height: 1; white-space: nowrap; }
.category-label { background: var(--cat-a, var(--surface-2)); color: var(--cat, var(--text-2)); }
.status-label { background: var(--status-bg, var(--surface-2)); color: var(--status-fg, var(--text-2)); padding-left: 7px; }
.status-label::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--status-dot, var(--muted)); flex-shrink: 0; }
.status-published { --status-fg: var(--status-published-fg); --status-bg: var(--status-published-bg); --status-dot: var(--status-published-dot); }
.status-development { --status-fg: var(--status-development-fg); --status-bg: var(--status-development-bg); --status-dot: var(--status-development-dot); }
.status-external { --status-fg: var(--status-external-fg); --status-bg: var(--status-external-bg); --status-dot: var(--status-external-dot); }
.status-source { --status-fg: var(--status-source-fg); --status-bg: var(--status-source-bg); --status-dot: var(--status-source-dot); }
.availability-label { background: var(--warn-bg); color: var(--warn-fg); padding-left: 7px; }
.availability-label::before { content: '!'; display: inline-grid; place-items: center; width: 12px; height: 12px; border-radius: 50%; background: var(--warn-dot); color: #fdfcf9; font: 700 9px/1 var(--mono); }
.private-label { gap: 4px; padding: 0 8px 0 6px; border: 1px solid var(--rule); color: var(--muted); font-weight: 400; }
.private-label svg { width: 11px; height: 11px; }
.card-title { grid-area: title; margin: 10px 16px 0; font-size: 17px; font-weight: 600; letter-spacing: -.02em; line-height: 1.4; overflow-wrap: anywhere; }
.card-title a { transition: color .15s ease; }
.card-title a:hover { color: var(--blue); }
.card-description { grid-area: desc; margin: 6px 16px 0; font-size: 13px; line-height: 1.6; color: var(--text-2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.card-domain { grid-area: domain; margin: 12px 16px 0; font-family: var(--mono); font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-related-links { grid-area: related; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 8px 16px 0; font-size: 12px; }
.card-related-link { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; min-width: 0; max-width: 100%; color: var(--blue); overflow-wrap: anywhere; }
.card-related-link svg { width: 13px; height: 13px; }
.card-related-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.github-visibility { color: var(--muted); font-size: 10px; margin-left: 1px; }
.github-visibility::before { content: '('; }
.github-visibility::after { content: ')'; }
.card-footer { grid-area: footer; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 10px 10px 16px; padding-top: 10px; border-top: 1px solid var(--rule); }
.card-date { color: var(--muted); font: 11px var(--mono); white-space: nowrap; }
.project-actions { display: flex; align-items: center; gap: 2px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-control); color: var(--muted); transition: background-color .15s ease, color .15s ease; }
.icon-button svg { width: 15px; height: 15px; }
.icon-button:hover { color: var(--blue); background: var(--surface-2); }
.favorite-button.is-active { color: var(--blue); }
.favorite-button.is-active svg { fill: var(--blue-soft); }
.card-open { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 6px 0 10px; border-radius: var(--radius-control); white-space: nowrap; font-size: 12px; font-weight: 500; color: var(--ink); transition: background-color .15s ease, color .15s ease; }
.card-open svg { width: 15px; height: 15px; color: var(--blue); }
.card-open:hover { color: var(--blue); background: var(--surface-2); }
.card-open:disabled { cursor: not-allowed; opacity: .55; color: var(--muted); }

/* ---------- List view ---------- */
.project-grid.is-list { display: block; padding-top: 0; }
.is-list .project-card { grid-template-columns: 32px 48px minmax(0, 1fr) 184px 88px 140px; grid-template-rows: auto auto; grid-template-areas: 'order media title meta date actions' 'order media desc meta date actions'; column-gap: 16px; row-gap: 2px; align-items: center; min-height: 64px; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; background: transparent; overflow: visible; }
.is-list .project-card:hover { transform: none; box-shadow: none; background: var(--surface-2); }
.is-list .project-order { position: static; grid-area: order; padding: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--muted); font-size: 11px; }
.is-list .card-media { grid-area: media; width: 48px; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.is-list .card-visual-link:focus-visible { outline-offset: 1px; border-radius: 6px; }
.is-list .card-fallback > svg, .is-list .fallback-category, .is-list .card-fallback::before, .is-list .card-fallback::after { display: none; }
.is-list .fallback-initial { font-size: 13px; }
.is-list .card-title { grid-area: title; margin: 0; font-size: 14px; line-height: 1.4; }
.is-list .card-description { grid-area: desc; margin: 0; font-size: 12px; line-height: 1.5; -webkit-line-clamp: 1; }
.is-list .card-meta { grid-area: meta; margin: 0; gap: 4px; }
.is-list .card-domain, .is-list .card-related-links { display: none; }
.is-list .card-footer { display: contents; }
.is-list .card-date { grid-area: date; }
.is-list .project-actions { grid-area: actions; justify-self: end; }
.empty-state { margin-top: 20px; padding: 72px 20px; text-align: center; border: 1px dashed var(--rule-strong); border-radius: var(--radius-card); background: var(--surface); }
.empty-state h3 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 8px; }
.empty-state p { margin: 0 0 24px; color: var(--text-2); font-size: 13px; }
.catalog-help { font-size: 11px; color: var(--muted); margin: 24px 0 0; }

/* ---------- Footer ---------- */
.page-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 64px; padding: 20px 0 40px; border-top: 1px solid var(--ink); font-size: 11px; color: var(--muted); }
.page-footer b { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--ink); }
.footer-meta { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 11px; }
.snapshot { display: inline-flex; align-items: center; gap: 7px; min-height: 26px; padding: 0 10px 0 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-weight: 500; white-space: nowrap; }
.snapshot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.snapshot[data-state='checked'] { background: var(--status-published-bg); color: var(--status-published-fg); }
.snapshot[data-state='checked']::before { background: var(--status-published-dot); }
.snapshot[data-state='unavailable'] { background: var(--status-development-bg); color: var(--status-development-fg); }
.snapshot[data-state='unavailable']::before { background: var(--status-development-dot); }
.snapshot[data-state='checking']::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* ---------- Dialog & toast ---------- */
#project-dialog { width: min(600px, calc(100% - 32px)); max-height: calc(100dvh - 56px); margin: auto; padding: 28px; border: 1px solid var(--rule); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); overflow: auto; }
#project-dialog::backdrop { background: var(--backdrop); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.dialog-header .eyebrow { margin: 0 0 6px; font-size: 11px; }
.dialog-header h2 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.03em; }
.dialog-header .icon-button { margin: -4px -6px 0 0; width: 36px; height: 36px; }
.form-fields { display: flex; flex-direction: column; gap: 16px; }
.form-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; }
.form-fields label > span { display: none; }
.form-fields input, .form-fields textarea, .form-fields select { width: 100%; min-width: 0; min-height: 42px; padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: var(--radius-control); background: var(--paper); font-size: 14px; font-weight: 400; transition: border-color .15s ease, box-shadow .15s ease; }
.form-fields select { -webkit-appearance: none; appearance: none; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; }
.form-fields textarea { resize: vertical; line-height: 1.5; }
.form-fields input:focus, .form-fields textarea:focus, .form-fields select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); outline: none; }
.form-fields input::placeholder, .form-fields textarea::placeholder { color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.storage-note { display: flex; align-items: center; gap: 8px; margin: 20px 0; padding: 10px 12px; border-radius: var(--radius-control); background: var(--surface-2); font-size: 11px; color: var(--text-2); }
.storage-note svg { width: 13px; height: 13px; color: var(--muted); }
.dialog-footer { border-top: 1px solid var(--rule); padding-top: 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.dialog-footer-right { display: flex; justify-content: flex-end; gap: 8px; margin-left: auto; }
.danger-button { min-height: 40px; padding: 0 10px; border-radius: var(--radius-control); font-size: 12px; font-weight: 500; color: var(--danger); }
.danger-button:hover { background: var(--surface-2); }
#toast { position: fixed; bottom: 24px; left: 50%; z-index: 60; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 10px; font-size: 13px; color: var(--white); background: var(--ink); box-shadow: var(--shadow-2); }
.noscript-message { background: var(--ink); color: var(--white); padding: 16px; text-align: center; }

/* ---------- Responsive ---------- */
@media (min-width: 1600px) {
  .project-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
}
@media (max-width: 1100px) {
  :root { --gutter: 32px; }
  .site-header { gap: 20px; }
  .brand strong { font-size: 19px; }
  .header-actions { gap: 8px; }
  .main-nav { gap: 2px; }
  .nav-item { padding: 0 10px; }
  .quick-project strong { max-width: 220px; }
  .project-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
  .list-header, .is-list .project-card { grid-template-columns: 32px 48px minmax(0, 1fr) 150px 84px 128px; column-gap: 12px; }
}
@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .site-header { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'brand actions' 'nav nav'; row-gap: 8px; column-gap: 12px; padding-top: 12px; }
  .brand { grid-area: brand; padding: 4px 0; }
  .brand strong { font-size: 19px; }
  .brand span { font-size: 10px; }
  .header-actions { grid-area: actions; margin-left: auto; }
  .header-actions > .profile-link { display: none; }
  .data-menu summary { font-size: 12px; }
  .data-menu-content { width: 200px; }
  .main-nav { grid-area: nav; width: 100%; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 10px; background: var(--surface-2); }
  .nav-item { flex: 1 1 0; justify-content: center; min-height: 36px; padding: 0 8px; border-radius: 7px; font-size: 13px; }
  .nav-item:hover { background: transparent; }
  .nav-item.is-active { background: var(--surface); box-shadow: var(--shadow-1); }
  .nav-item.is-active::after { display: none; }
  main { padding-top: 28px; }
  .welcome { padding-bottom: 24px; }
  .welcome-copy { display: block; }
  .eyebrow { margin-bottom: 12px; font-size: 10px; }
  h1 { font-size: 56px; }
  .project-total { font-size: 13px; margin-left: 12px; top: -1.3em; }
  .welcome-description { font-size: 13px; margin: 12px 0 0; }
  .welcome-note { display: none; }
  .quick-section { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 0; }
  .quick-projects { gap: 6px; }
  .quick-project { min-height: 36px; font-size: 12px; }
  .quick-project strong { max-width: 240px; }
  .library { margin-top: 20px; }
  .library-toolbar { display: contents; }
  .toolbar-row { position: sticky; top: var(--toolbar-offset); z-index: 20; display: flex; align-items: center; gap: 8px; margin: 0 calc(-1 * var(--gutter)); padding: 8px var(--gutter); background: var(--bar-bg); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); }
  .filter-row { position: sticky; top: calc(var(--toolbar-offset) + 56px); z-index: 19; display: flex; align-items: center; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); background: var(--bar-bg); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); border-bottom: 1px solid var(--rule); }
  .controls-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0 0; }
  .search-box { flex: 1 1 auto; max-width: none; }
  .search-box kbd { display: none; }
  #add-project { flex-shrink: 0; padding: 0 12px; font-size: 12px; }
  .select-tools { gap: 6px; }
  .select-tools select { min-height: 36px; font-size: 12px; padding: 0 26px 0 10px; background-position: right 7px center; }
  .category-tabs { width: 100%; gap: 2px; margin-bottom: 0; }
  .category-tab { min-height: 44px; padding: 0 8px; font-size: 13px; }
  .view-tools { padding-bottom: 0; gap: 8px; }
  .view-toggle button { width: 36px; height: 30px; }
  .list-header { display: none !important; }
  .project-grid { grid-template-columns: 1fr; gap: 12px; padding-top: 16px; scroll-margin-top: 112px; }
  .project-card { grid-template-columns: 112px minmax(0, 1fr); grid-template-rows: auto auto 1fr auto auto auto; grid-template-areas: 'media meta' 'media title' 'media domain' 'desc desc' 'related related' 'footer footer'; column-gap: 12px; row-gap: 0; align-items: start; padding: 12px; }
  .project-card:hover { transform: none; }
  .project-order { top: 16px; left: 16px; padding: 3px 5px; font-size: 10px; }
  .card-media { align-self: start; border: 1px solid var(--rule); border-radius: var(--radius-thumb); overflow: hidden; }
  .card-visual-link:focus-visible { outline-offset: 1px; border-radius: var(--radius-thumb); }
  .card-fallback > svg { top: 8px; right: 8px; width: 16px; height: 16px; }
  .fallback-category { display: none; }
  .card-meta { margin: 0; min-height: 0; }
  .card-title { margin: 6px 0 0; font-size: 15px; line-height: 1.4; }
  .card-domain { margin: 4px 0 0; font-size: 10px; }
  .card-description { margin: 10px 0 0; font-size: 13px; }
  .card-related-links { margin: 8px 0 0; }
  .card-footer { margin: 10px 0 0; padding-top: 8px; }
  .icon-button { width: 36px; height: 36px; }
  .card-open { min-height: 36px; }
  .is-list .project-card { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-rows: auto auto; grid-template-areas: 'media title actions' 'media meta actions'; column-gap: 12px; row-gap: 4px; min-height: 60px; padding: 10px 0; }
  .is-list .project-order, .is-list .card-date, .is-list .card-description { display: none; }
  .is-list .card-media { align-self: center; }
  .is-list .card-title { font-size: 14px; }
  .is-list .project-actions { gap: 0; }
  .is-list .project-actions .icon-button { width: 36px; height: 36px; }
  .is-list .card-open { min-width: 36px; padding: 0 8px; }
  .is-list .card-open > span { display: none; }
  .empty-state { padding: 56px 16px; }
  .empty-state h3 { font-size: 18px; }
  .catalog-help { font-size: 10px; line-height: 1.8; }
  .page-footer { margin-top: 40px; padding: 16px 0 28px; align-items: flex-start; flex-direction: column; gap: 12px; }
  .footer-meta { gap: 10px; font-size: 10px; }
  #project-dialog { padding: 20px; max-height: calc(100dvh - 24px); border-radius: 14px; }
  .dialog-header h2 { font-size: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .storage-note { align-items: flex-start; }
}
@media (max-width: 380px) {
  .brand strong { font-size: 18px; }
  .project-card { grid-template-columns: 96px minmax(0, 1fr); }
  .card-title { font-size: 14px; }
  .card-footer { flex-wrap: wrap; }
  #add-project > span { display: none; }
  #add-project { padding: 0 12px; }
  #add-project svg { width: 16px; height: 16px; }
}
@media (hover: none) {
  .search-box kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  .project-card:hover { transform: none; }
  .project-card:hover .card-image { transform: none; }
}
