/* avatar-style.css
   Shared styles for the cuckoo-alley site + avatar creator.
   Your existing style.css still loads too — put base resets there.
*/

/* ── Fonts ─────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Nunito:wght@400;600&display=swap');

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:        #f0ebe3;
  --surface:   #ffffff;
  --border:    #d6cfc6;
  --text:      #2a2420;
  --muted:     #7a7068;
  --accent:    #e07a40;
  --accent2:   #5b8dd9;
  --pixel:     'Press Start 2P', monospace;
  --body-font: 'Nunito', sans-serif;
  --radius:    8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  font-family: var(--body-font);
  color: var(--text);
  min-height: 100vh;
}

/* ── Site header ───────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 2px solid var(--text);
  flex-wrap: wrap;
  gap: 12px;
}

.site-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-title h1 {
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--text);
  letter-spacing: -0.5px;
}

.mascot-small {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
}

.site-nav {
  display: flex;
  gap: 8px;
}

.nav-link {
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  transition: all 0.1s;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  border-color: var(--text);
  background: var(--bg);
}

/* ── Home page ─────────────────────────────────────────────────────────── */
.home-main {
  max-width: 680px;
  margin: 60px auto;
  padding: 0 24px;
  text-align: center;
}

.construction-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.construction-banner p {
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--muted);
  line-height: 1.8;
}

.home-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
}

.home-content p { margin-bottom: 12px; }

.home-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Avatar page layout ─────────────────────────────────────────────────── */
.avatar-main {
  padding: 24px;
}

.avatar-layout {
  display: flex;
  gap: 28px;
  max-width: 1100px;
  margin: 0 auto;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* ── Preview panel ─────────────────────────────────────────────────────── */
.preview-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 24px;
}

.canvas-wrap {
  background: var(--surface);
  border: 2px solid var(--text);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 4px 4px 0 var(--text);
}

#avatar-canvas {
  display: block;
  width: 280px;
  height: 280px;
  image-rendering: pixelated;
}

.preview-actions {
  display: flex;
  gap: 10px;
}

.btn-primary, .btn-secondary {
  font-family: var(--pixel);
  font-size: 9px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--text);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
  box-shadow: 3px 3px 0 var(--text);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
}

.btn-primary:hover, .btn-secondary:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--text);
}

.btn-primary:active, .btn-secondary:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--text);
}

/* ── Controls panel ────────────────────────────────────────────────────── */
.controls-panel {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-section {
  background: var(--surface);
  border: 2px solid var(--text);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 3px 3px 0 var(--text);
}

.section-heading {
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--text);
  margin-bottom: 14px;
  text-transform: lowercase;
}

/* ── Sliders ───────────────────────────────────────────────────────────── */
.colour-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-row label {
  font-size: 12px;
  color: var(--muted);
  width: 68px;
  flex-shrink: 0;
}

.slider-row input[type=range] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.slider-val {
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--text);
  min-width: 30px;
  text-align: right;
}

/* ── Swatch presets ────────────────────────────────────────────────────── */
.preset-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}

.swatch-btn:hover {
  transform: scale(1.15);
}

.swatch-btn.active {
  border-color: var(--text);
  transform: scale(1.1);
  outline: 2px solid white;
  outline-offset: -4px;
}

/* ── Option grids (eyes / beak / hats / gestures) ──────────────────────── */
.option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  width: 68px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.1s, transform 0.1s;
}

.option-btn:hover {
  border-color: var(--accent2);
  transform: translateY(-2px);
}

.option-btn.selected {
  border-color: var(--accent);
  background: #fff5f0;
  box-shadow: 0 0 0 2px var(--accent);
}

.option-btn img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  image-rendering: pixelated;
}

.none-label {
  font-family: var(--pixel);
  font-size: 7px;
  color: var(--muted);
  height: 44px;
  display: flex;
  align-items: center;
}

.option-label {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}

/* ── Layer panel ───────────────────────────────────────────────────────── */
.layer-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  width: 70px;
}

.layer-panel-title {
  font-family: var(--pixel);
  font-size: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  text-align: center;
}

.layer-panel-hint {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 8px;
  text-align: center;
}

.layer-thumb-btn {
  width: 58px;
  height: 58px;
  padding: 3px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.1s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layer-thumb-btn:hover {
  border-color: var(--accent2);
  transform: translateX(-2px);
}

.layer-thumb-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.layer-thumb-canvas {
  width: 50px;
  height: 50px;
  image-rendering: pixelated;
  display: block;
}

/* ── Transform panel ───────────────────────────────────────────────────── */
.transform-panel {
  border-color: var(--accent2);
  box-shadow: 3px 3px 0 var(--accent2);
}

.tx-layer-name {
  color: var(--accent2);
  font-family: var(--pixel);
  font-size: 9px;
}

.btn-ghost {
  font-family: var(--pixel);
  font-size: 8px;
  padding: 7px 12px;
  margin-top: 10px;
  border-radius: var(--radius);
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.1s, color 0.1s;
}

.btn-ghost:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}

/* ── Canvas hint ───────────────────────────────────────────────────────── */
.canvas-hint {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  max-width: 280px;
}

/* ── Profile meta bar (avatar editor top strip) ─────────────────────── */
.profile-meta-bar {
  background: var(--surface);
  border-bottom: 2px solid var(--text);
  padding: 10px 24px;
}

.profile-meta-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.profile-meta-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-meta-field label {
  font-family: var(--pixel);
  font-size: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.profile-meta-field input {
  font-family: var(--body-font);
  font-size: 14px;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  width: 180px;
}

.profile-meta-field input[readonly] {
  opacity: 0.6;
  cursor: default;
  width: 130px;
}

.profile-meta-field input:focus {
  outline: none;
  border-color: var(--accent2);
}

.save-btn { margin-left: auto; white-space: nowrap; }

.save-feedback {
  font-family: var(--pixel);
  font-size: 8px;
  margin-top: 6px;
  padding: 4px 0;
}
.save-feedback.ok    { color: #3b6d11; }
.save-feedback.error { color: #a32d2d; }

/* ── Profiles grid (home page) ─────────────────────────────────────────── */
.profiles-status {
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  padding: 40px 0;
}
.profiles-status.error { color: #a32d2d; }
.profiles-status a { color: var(--accent); }

.profiles-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-top: 32px;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  width: 160px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  box-shadow: 3px 3px 0 var(--border);
  transition: transform 0.1s, box-shadow 0.1s, border-color 0.1s;
}

.profile-card:hover {
  border-color: var(--accent);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--accent);
}

.profile-card-avatar {
  image-rendering: pixelated;
  width: 100px;
  height: 100px;
}

.profile-card-info { text-align: center; }

.profile-card-name {
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--text);
  margin-bottom: 4px;
}

.profile-card-status {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Profile view page ─────────────────────────────────────────────────── */
.profile-view-main {
  max-width: 700px;
  margin: 48px auto;
  padding: 0 24px;
}

.profile-view-content {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.profile-view-avatar-wrap {
  background: var(--surface);
  border: 2px solid var(--text);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--text);
  overflow: hidden;
  flex-shrink: 0;
}

#pv-canvas {
  display: block;
  width: 240px;
  height: 240px;
  image-rendering: pixelated;
}

.profile-view-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
}

.profile-view-name {
  font-family: var(--pixel);
  font-size: 16px;
  color: var(--text);
  line-height: 1.4;
}

.profile-view-status {
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
}

.profile-view-meta {
  font-family: var(--pixel);
  font-size: 8px;
  color: var(--muted);
}

.profile-edit-btn {
  display: inline-block;
  margin-top: 8px;
  text-decoration: none;
}

/* ── New profile page ──────────────────────────────────────────────────── */
.new-profile-main {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 60px);
  padding: 24px;
}

.new-profile-card {
  background: var(--surface);
  border: 2px solid var(--text);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--text);
  padding: 36px 40px;
  text-align: center;
  max-width: 340px;
  width: 100%;
}

.new-profile-mascot {
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
  margin-bottom: 16px;
}

.new-profile-title {
  font-family: var(--pixel);
  font-size: 13px;
  margin-bottom: 8px;
}

.new-profile-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
}

.new-profile-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.name-input {
  font-family: var(--body-font);
  font-size: 18px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.1s;
}

.name-input:focus {
  outline: none;
  border-color: var(--accent2);
}

.name-error {
  font-family: var(--pixel);
  font-size: 8px;
  color: #a32d2d;
}

.profile-card-new {
  border-style: dashed;
  color: var(--muted);
  justify-content: center;
}

.profile-card-new:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 5px 5px 0 var(--accent);
}

.profile-card-plus {
  font-family: var(--pixel);
  font-size: 32px;
  line-height: 1;
  margin-bottom: 4px;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .avatar-layout { flex-direction: column; align-items: center; }
  .preview-panel { position: static; }
  #avatar-canvas { width: 240px; height: 240px; }
}