:root {
  --ink: #170b0c;
  --ink-2: #23100f;
  --maroon-900: #3d0f12;
  --maroon-700: #5c1a1e;
  --maroon-500: #7a2226;
  --gold: #d9a441;
  --gold-soft: #f0c876;
  --teal: #3f8f86;
  --clay: #b45a52;
  --paper: #f6ece0;
  --cream: #ffffff;
  --text-muted: #d9bdb9;
  --text-faint: #a98784;
  --border: rgba(246, 236, 224, 0.14);
  --border-strong: rgba(246, 236, 224, 0.24);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  background: radial-gradient(ellipse 900px 500px at 25% -10%, var(--maroon-700) 0%, transparent 60%),
              linear-gradient(180deg, var(--ink-2) 0%, var(--ink) 40%);
  color: var(--cream);
  min-height: 100vh;
  position: relative;
}

a { color: inherit; }

/* subtle film-grain texture so flat dark areas don't feel sterile */
.grain-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 1000;
  opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* NAV */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(23, 11, 12, 0.72);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-decoration: none;
  font-size: 1.15rem;
}
.brand-mark {
  width: 20px; height: 20px; border-radius: 50%;
  background: conic-gradient(from 200deg, var(--gold), var(--clay), var(--teal), var(--gold));
  box-shadow: 0 0 0 1px var(--border-strong);
  flex-shrink: 0;
}
.brand-sub { font-family: var(--font-body); font-weight: 400; color: var(--text-muted); font-size: 0.75rem; letter-spacing: 0.3px; }

.nav-right { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.nav-right > a:not(.btn) {
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  position: relative;
  padding-bottom: 2px;
}
.nav-right > a:not(.btn)::after {
  content: ""; position: absolute; left: 0; bottom: -2px; width: 0; height: 1.5px;
  background: var(--gold); transition: width 0.25s ease;
}
.nav-right > a:not(.btn):hover { color: var(--cream); }
.nav-right > a:not(.btn):hover::after { width: 100%; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.nav-user img { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong); }

/* BUTTONS */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-size: 0.85rem;
  font-family: var(--font-body);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  position: relative;
  overflow: visible;
}
.btn:active { transform: scale(0.96); }
.btn-discord { background: #5865F2; color: #fff; }
.btn-discord:hover { background: #4752c4; box-shadow: 0 4px 16px rgba(88,101,242,0.35); }
.btn-primary { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: var(--maroon-900); }
.btn-primary:hover { box-shadow: 0 4px 18px rgba(217,164,65,0.35); }
.btn-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--cream); padding: 8px 16px; font-size: 0.8rem; }
.btn-outline:hover { background: rgba(246,236,224,0.08); border-color: var(--gold); }
.btn-delete {
  background: transparent;
  border: 1px solid var(--clay);
  color: #e29089;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: background 0.15s ease;
}
.btn-delete:hover { background: rgba(180,90,82,0.18); }

@keyframes splat {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0.9; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1); opacity: 0; }
}
.splat-dot {
  position: absolute;
  width: 7px; height: 7px; border-radius: 50%;
  pointer-events: none;
  animation: splat 0.5s ease-out forwards;
  z-index: 5;
}

.page { max-width: 1100px; margin: 0 auto; padding: 0 24px 64px; position: relative; }

/* HERO */
.archive-hero {
  position: relative;
  padding: 64px 8px 40px;
  overflow: hidden;
}
.hero-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 32px;
  position: relative; z-index: 2;
}
.hero-text { flex: 1; min-width: 280px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin: 0 0 12px;
}
.archive-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 600;
  margin: 0 0 12px;
  max-width: 620px;
  position: relative;
}
.stroke-underline {
  display: block;
  margin-top: -6px;
  overflow: visible;
}
.stroke-underline path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: draw-stroke 1.1s 0.3s cubic-bezier(.3,.8,.3,1) forwards;
}
@keyframes draw-stroke {
  to { stroke-dashoffset: 0; }
}
.hero-sub { color: var(--text-muted); max-width: 480px; margin: 14px 0 0; font-size: 1rem; }

.hero-art { width: 320px; flex-shrink: 0; position: relative; z-index: 2; }
.palette-illustration { width: 100%; height: auto; overflow: visible; }
.palette-body {
  fill: var(--maroon-700);
  stroke: var(--border-strong);
  stroke-width: 2;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,0.35));
}
.paint-dab circle {
  animation: dab-pulse 3.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.4s);
  transform-origin: center;
  transform-box: fill-box;
}
@keyframes dab-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
.brush {
  animation: brush-sway 5s ease-in-out infinite;
  transform-origin: 230px 196px;
}
@keyframes brush-sway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-2.5deg); }
}
@media (prefers-reduced-motion: reduce) {
  .stroke-underline path { animation: none; stroke-dashoffset: 0; }
  .paint-dab circle, .brush { animation: none; }
}

.paint-canvas {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
}

.blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.35;
  pointer-events: none; z-index: 0;
  animation: drift 22s ease-in-out infinite;
}
.blob-a { width: 320px; height: 320px; background: var(--gold); top: -80px; left: 10%; animation-delay: 0s; }
.blob-b { width: 260px; height: 260px; background: var(--teal); top: 60px; right: 5%; animation-delay: -7s; animation-duration: 26s; }
.blob-c { width: 220px; height: 220px; background: var(--clay); bottom: -100px; left: 40%; animation-delay: -14s; animation-duration: 30s; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.08); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

@media (max-width: 720px) {
  .hero-inner { flex-direction: column; align-items: flex-start; }
  .hero-art { width: 220px; align-self: center; }
}

/* SCROLL REVEAL */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; transition-delay: var(--delay, 0ms); }
.reveal-in { opacity: 1; transform: translateY(0); }

/* GRID / CARDS */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.card {
  background: linear-gradient(165deg, rgba(246,236,224,0.07), rgba(246,236,224,0.03));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  text-decoration: none;
  color: var(--cream);
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1), border-color 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(217,164,65,0.14) 50%, transparent 60%);
  clip-path: polygon(-20% 0, 0% 0, -30% 100%, -50% 100%);
  transition: clip-path 0.55s cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}
.card:hover::before {
  clip-path: polygon(100% 0, 130% 0, 90% 100%, 60% 100%);
}
.card:hover {
  transform: translateY(-5px);
  border-color: var(--border-strong);
  box-shadow: 0 16px 32px rgba(0,0,0,0.35);
}
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-avatar, .card-avatar-img { width: 44px; height: 44px; border-radius: 50%; }
.card-avatar {
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  color: var(--maroon-900);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700;
}
.card-avatar-img { object-fit: cover; border: 1px solid var(--border-strong); }

.palette-swatch { display: inline-flex; gap: 3px; }
.palette-swatch .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 1px rgba(0,0,0,0.2); }

.card-name { font-family: var(--font-display); margin: 0 0 2px; font-size: 1.1rem; font-weight: 600; }
.card-role { margin: 0 0 8px; color: var(--gold-soft); font-size: 0.78rem; font-family: var(--font-mono); }
.card-about { color: var(--text-muted); font-size: 0.87rem; flex-grow: 1; line-height: 1.5; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tag {
  background: rgba(63,143,134,0.16);
  border: 1px solid rgba(63,143,134,0.3);
  color: #9fd2cb;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
}
.view-link {
  font-size: 0.78rem; font-weight: 600; margin-top: 10px;
  border-top: 1px dashed var(--border); padding-top: 10px;
  color: var(--gold-soft);
}
.arrow { display: inline-block; transition: transform 0.2s ease; }
.card:hover .arrow, a:hover .arrow { transform: translateX(3px); }

.empty-state {
  grid-column: 1/-1; text-align: center; color: var(--text-muted);
  padding: 48px 20px; border: 1px dashed var(--border); border-radius: 14px;
}
.empty-illustration { width: 140px; height: auto; color: var(--gold-soft); margin-bottom: 16px; }
.empty-title { font-family: var(--font-display); font-size: 1.3rem; color: var(--cream); margin-bottom: 6px; }

/* SHEET (single portfolio) */
.sheet { background: rgba(246,236,224,0.04); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.sheet-banner { height: 100px; position: relative; }
.sheet-banner::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(23,11,12,0.4) 100%);
}
.sheet-header {
  display: flex; align-items: flex-end; gap: 18px;
  padding: 0 28px; margin-top: -34px;
  position: relative; z-index: 2;
}
.sheet-avatar, .sheet-avatar-img {
  width: 72px; height: 72px; border-radius: 50%;
  border: 4px solid var(--ink);
}
.sheet-avatar {
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  color: var(--maroon-900); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.5rem;
}
.sheet-avatar-img { object-fit: cover; }
.sheet-name-row { display: flex; align-items: center; gap: 10px; }
.sheet-header h1 { margin: 0; font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; }
.sheet-role { margin: 4px 0 0; color: var(--gold-soft); font-family: var(--font-mono); font-size: 0.85rem; }
.sheet-meta { margin: 2px 0 0; color: var(--text-faint); font-size: 0.72rem; font-family: var(--font-mono); }
.sheet-edit-btn { margin-left: auto; }
.sheet-about { padding: 24px 28px 0; color: var(--text-muted); line-height: 1.6; font-size: 1rem; max-width: 640px; }
.sheet .tag-row { padding: 0 28px; margin-top: 18px; }
.section-title { padding: 0 28px; margin: 28px 0 14px; font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 16px; padding: 0 28px 28px; }
.project-card {
  background: rgba(246,236,224,0.05); border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.project-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.project-img { width: 100%; border-radius: 8px; margin-bottom: 10px; max-height: 140px; object-fit: cover; }
.project-card h4 { margin: 0 0 6px; font-family: var(--font-display); font-weight: 600; }
.project-card p { color: var(--text-muted); font-size: 0.85rem; line-height: 1.5; }
.project-card a { font-size: 0.8rem; font-weight: 600; color: var(--gold-soft); text-decoration: none; }
.contact-row { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 28px 28px; }

/* FORMS (edit + panel) */
.form-row { display: flex; gap: 20px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 220px; }
.field { margin-bottom: 20px; }
.field label {
  display: block; font-size: 0.7rem; letter-spacing: 0.6px;
  color: var(--text-faint); margin-bottom: 6px; text-transform: uppercase;
  font-family: var(--font-mono);
}
.field input[type="text"], .field input[type="url"], .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--maroon-900);
  color: var(--cream); font-size: 0.9rem; font-family: var(--font-body);
  transition: border-color 0.2s ease;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--gold); }
.field input[type="color"] { width: 100%; height: 44px; border: none; border-radius: 8px; background: var(--maroon-900); cursor: pointer; }
.field textarea { resize: vertical; }
.upload-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 0.8rem; color: var(--text-muted); }
.upload-row input[type="file"] { color: var(--text-muted); }
.current-preview { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 0.8rem; color: var(--text-muted); }
.current-preview img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }

.project-row, .contact-row-edit {
  border: 1px dashed var(--border); border-radius: 10px;
  padding: 16px; margin-bottom: 14px; position: relative;
}
.contact-row-edit { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.contact-row-edit input { flex: 1; min-width: 160px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--maroon-900); color: var(--cream); }
.remove-row-btn {
  background: none; border: none; color: #e29089; cursor: pointer;
  font-size: 0.75rem; font-weight: 600; margin-top: 6px;
}

.edit-form { max-width: 720px; padding-top: 8px; }

/* PANEL */
.panel-box { background: rgba(246,236,224,0.04); border: 1px solid var(--border); border-radius: 14px; padding: 24px; margin: 24px 0 32px; }
.panel-box h2 { font-family: var(--font-display); margin-top: 0; }
.panel-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.panel-table th { text-align: left; color: var(--text-faint); font-size: 0.7rem; letter-spacing: 0.5px; padding: 10px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); text-transform: uppercase; }
.panel-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); }
.panel-table a { text-decoration: none; font-weight: 600; color: var(--gold-soft); }
