:root {
  --bg: #F4F3EF;
  --surface: #ECEBE6;
  --surface-2: #E5E4DE;
  --ink: #303838;
  --muted: #737A76;
  --line: #D5D5CE;
  --accent: #739068;
  --accent-strong: #637D5A;
  --accent-soft: #E3EADF;
  --danger: #6E4640;
  --shadow: 0 18px 50px rgba(48, 56, 56, .08);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 13px;
}
html[data-theme="dark"] {
  --bg: #171C1C;
  --surface: #202626;
  --surface-2: #272E2E;
  --ink: #F0EFEA;
  --muted: #A8AEAA;
  --line: #343C3C;
  --accent: #86A37C;
  --accent-strong: #98B18E;
  --accent-soft: #29362B;
  --danger: #C98D83;
  --shadow: 0 22px 60px rgba(0, 0, 0, .22);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100svh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
svg { width: 1.35em; height: 1.35em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-shell { width: min(1240px, 100%); margin: 0 auto; padding: 0 28px 64px; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  padding-top: env(safe-area-inset-top, 0px);
}
.app-header__inner {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 0 28px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-size: 22px; font-weight: 760; letter-spacing: -.02em; }
.brand img { width: 38px; height: 38px; object-fit: contain; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.main { min-height: calc(100svh - 130px); }
.icon-button {
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: transparent; display: inline-grid; place-items: center; cursor: pointer; transition: .2s ease;
}
.icon-button:hover { background: var(--surface); transform: translateY(-1px); }
.button {
  min-height: 48px; border: 1px solid transparent; border-radius: 15px; padding: 0 18px; display: inline-flex; gap: 9px; align-items: center; justify-content: center; font-weight: 720; cursor: pointer; transition: .22s ease; background: var(--ink); color: var(--bg);
}
.button:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.button--compact { min-height: 44px; padding-inline: 15px; }
.button--outline { background: transparent; color: var(--ink); border-color: var(--line); }
.button--accent { background: var(--accent); color: #fff; }
.button--ghost { background: transparent; color: var(--ink); border-color: transparent; }
.button svg { width: 18px; height: 18px; }
.hero-empty { min-height: calc(100svh - 160px); display: grid; place-items: center; text-align: center; padding: 44px 0; }
.hero-empty__inner { max-width: 560px; display: flex; flex-direction: column; align-items: center; }
.hero-empty__logo { width: 126px; height: 126px; object-fit: contain; margin-bottom: 25px; }
.hero-empty h1 { margin: 0; font-size: clamp(34px, 6vw, 58px); letter-spacing: -.055em; line-height: 1; }
.hero-empty p { max-width: 470px; margin: 18px auto 28px; color: var(--muted); font-size: 17px; line-height: 1.85; }
.hero-empty .button { min-width: 190px; }
.section-head { padding: 48px 0 24px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-head h1 { margin: 0; font-size: clamp(30px, 5vw, 48px); letter-spacing: -.045em; }
.section-head p { margin: 9px 0 0; color: var(--muted); }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 22px; }
.project-card { position: relative; border: 1px solid var(--line); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--bg) 72%, var(--surface)); transition: .25s ease; }
/* Not `overflow: hidden` — that clipped the card's own menu. The cover clips
   itself and rounds its own top corners, which is all the hiding was for. */
.project-card:has(.popover) { z-index: 30; }
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }
.project-cover { aspect-ratio: 16 / 10; background: var(--surface); display: grid; place-items: center; overflow: hidden; position: relative; border-bottom: 1px solid var(--line); border-start-start-radius: calc(var(--radius-lg) - 1px); border-start-end-radius: calc(var(--radius-lg) - 1px); }
.project-cover__img { width: 100%; height: 100%; object-fit: cover; }
.project-cover__img[data-fit="contain"] {
  width: auto; height: auto;
  max-width: 58%; max-height: 58%;
  object-fit: contain;
  image-rendering: auto;
}
.project-cover__fallback { display: grid; place-items: center; width: 100%; height: 100%; background: radial-gradient(circle at 70% 30%, var(--accent-soft), transparent 35%), var(--surface); }
.project-cover__fallback img { width: 94px; height: 94px; object-fit: contain; }
.project-card__body { padding: 18px; }
.project-card__head { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.project-card__id { min-width: 0; }
.project-card h2 { overflow-wrap: anywhere; }
.project-card h2 { margin: 0; font-size: 21px; letter-spacing: -.03em; }
.project-meta { color: var(--muted); font-size: 13px; margin-top: 7px; display: flex; gap: 8px; flex-wrap: wrap; }
.project-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.kebab { width: 38px; height: 38px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; display: grid; place-items: center; }
.kebab:hover { background: var(--surface); }
.kebab svg { width: 20px; height: 20px; }
.kebab-wrap { position: relative; flex: 0 0 auto; }
/* Anchored under its own trigger. The old `top: calc(100% - 96px)` was measured
   from the card's foot, so it drifted the moment the menu gained an item. */
.popover { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 40; min-width: 190px; padding: 7px; border: 1px solid var(--line); border-radius: 15px; background: var(--bg); box-shadow: var(--shadow); animation: pop .16s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-5px) scale(.98); } }
.popover button { width: 100%; border: 0; background: transparent; border-radius: 10px; padding: 11px 12px; text-align: start; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.popover button:hover { background: var(--surface); }

/* A plated cover carries the same tone in both themes — the mark's legibility
   depends on the mark, not on what the viewer set. */
.project-cover[data-plate="light"] { background: #EFEEE9; }
.project-cover[data-plate="dark"]  { background: #1C2222; }
