:root {
  color-scheme: dark;
  --bg: #111210;
  --surface: #1a1b18;
  --surface-2: #242520;
  --text: #f4f2ea;
  --muted: #9b9c93;
  --line: #34362f;
  --accent: #d9ff52;
  --accent-text: #16180c;
  --danger: #ff716a;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, system-ui, sans-serif;
  letter-spacing: 0;
}
button, input, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; opacity: 0; pointer-events: none; }
.app-shell { width: min(100%, 760px); margin: 0 auto; padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom); }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.wordmark { font-size: 12px; font-weight: 800; color: var(--accent); }
.icon-button {
  width: 40px; height: 40px; padding: 0; display: grid; place-items: center;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.profile { min-height: 330px; display: grid; grid-template-columns: 96px 1fr; gap: 28px; align-items: center; padding: 48px 0; }
.avatar { width: 96px; height: 128px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar span { color: var(--accent); font-size: 24px; font-weight: 800; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; line-height: 1.3; font-weight: 800; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(34px, 10vw, 58px); line-height: 1; font-weight: 700; }
.bio { max-width: 480px; margin: 18px 0 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.contact { display: inline-flex; margin-top: 18px; color: var(--text); text-underline-offset: 4px; font-size: 14px; }
.work-section { padding: 32px 0 64px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
h2 { margin: 0; font-size: 24px; line-height: 1.2; }
h2 span { color: var(--muted); font-size: 13px; font-weight: 500; vertical-align: top; }
.primary-button, .danger-button {
  min-height: 42px; padding: 0 16px; border: 0; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; cursor: pointer;
}
.primary-button { color: var(--accent-text); background: var(--accent); }
.primary-button svg { width: 17px; height: 17px; }
.danger-button { color: var(--danger); background: transparent; border: 1px solid #5a312f; }
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.project-card { position: relative; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.project-image { aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; }
.project-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.project-card:hover .project-image img { transform: scale(1.025); }
.project-placeholder { color: #5f6258; font-size: 38px; font-weight: 800; }
.project-body { min-height: 154px; padding: 18px; display: flex; flex-direction: column; }
.project-body h3 { margin: 0; font-size: 18px; line-height: 1.3; }
.project-body p { margin: 10px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tag { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.tag + .tag::before { content: '/'; margin-right: 6px; color: #55574f; }
.card-link { position: absolute; inset: 0; z-index: 1; }
.edit-card { position: absolute; z-index: 2; top: 10px; right: 10px; width: 38px; height: 38px; border: 1px solid #55584e; border-radius: 5px; color: var(--text); background: rgba(17,18,16,.88); display: grid; place-items: center; cursor: pointer; }
.empty-state { padding: 52px 24px; border: 1px dashed var(--line); text-align: center; }
.empty-mark { width: 52px; height: 52px; margin: 0 auto 20px; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); font-weight: 800; }
.empty-state h3 { margin: 0; font-size: 18px; }
.empty-state p { margin: 10px auto 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
footer { min-height: 76px; padding: 24px 0; display: flex; justify-content: space-between; gap: 20px; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; text-transform: uppercase; }
dialog { width: 100%; max-width: 600px; max-height: calc(100dvh - 24px); margin: auto auto 0; padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px 8px 0 0; }
dialog::backdrop { background: rgba(0,0,0,.72); }
.modal { padding: 24px 20px max(24px, env(safe-area-inset-bottom)); overflow-y: auto; }
.modal-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; }
.modal label { display: grid; gap: 8px; margin-bottom: 16px; color: var(--muted); font-size: 12px; font-weight: 700; }
.modal input, .modal textarea { width: 100%; padding: 13px 14px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 5px; outline: none; font-size: 15px; resize: vertical; }
.modal input:focus, .modal textarea:focus { border-color: var(--accent); }
.modal small { color: #74766d; font-size: 10px; font-weight: 500; }
.upload-box { min-height: 84px; display: grid; place-content: center; text-align: center; border: 1px dashed #55584e; border-radius: 5px; cursor: pointer; background-position: center; background-size: cover; }
.upload-box.has-image { min-height: 170px; text-shadow: 0 1px 10px #000; }
.upload-box strong { color: var(--text); }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }
.grow { flex: 1; }.full { width: 100%; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 20; max-width: calc(100% - 32px); padding: 12px 16px; background: var(--text); color: var(--bg); border-radius: 5px; font-size: 13px; font-weight: 700; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 540px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
  .profile { min-height: 360px; grid-template-columns: 72px 1fr; gap: 18px; padding: 42px 0; }
  .avatar { width: 72px; height: 96px; }
  h1 { font-size: 36px; }
  .projects { grid-template-columns: 1fr; }
  .project-body { min-height: 140px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
