/* ArtCorner Character Forge — brand system (spec G, H, U) */

:root {
  --ink: #0a0e17;
  --panel: #111e38;
  --titanium: #f8fafc;
  --gold: #ffb703;
  --cyan: #00e5ff;
  --crimson: #e63946;
  --violet: #8338ec;
  --emerald: #06d6a0;
  --border-gold: rgba(255, 183, 3, 0.25);
  --border-cyan: rgba(0, 229, 255, 0.2);
  --radius: 6px;
  --font-display: 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --font-body: 'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--titanium);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.display {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.1;
  margin: 0;
}

/* --- Buttons: hard graphic offsets, no fuzzy shadows --- */
button,
.btn {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 1rem;
  min-height: 48px;
  min-width: 48px;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border-gold);
  background: var(--panel);
  color: var(--titanium);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.btn-primary {
  background: var(--gold);
  color: var(--ink);
  border: 1px solid #000;
  box-shadow: 4px 4px 0px #000;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px #000;
}
.btn-primary:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px #000;
}

.btn-secondary {
  border: 1px solid var(--border-cyan);
  box-shadow: 4px 4px 0px #000;
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--cyan);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px #000;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- Accessibility: distinct gold focus rings (WCAG 2.1 AA) --- */
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* --- Cards & panels --- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 20px;
}

.chip {
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.92rem;
  padding: 10px 16px;
  min-height: 48px;
  border: 1px solid var(--border-cyan);
  background: rgba(10, 14, 23, 0.6);
  border-radius: var(--radius);
}
.chip[aria-pressed='true'] {
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.12);
  box-shadow: 3px 3px 0px #000;
  color: var(--cyan);
}

.character-card {
  text-align: left;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--border-gold);
  background: var(--panel);
  border-radius: var(--radius);
  min-height: 48px;
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
}
.character-card[aria-pressed='true'] {
  border-color: var(--gold);
  box-shadow: 4px 4px 0px #000;
  background: rgba(255, 183, 3, 0.08);
}

.layout {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen-title {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  margin: 8px 0 4px;
}

.subhead {
  color: rgba(248, 250, 252, 0.75);
  margin: 0 0 24px;
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* --- Forge loading animation: pulsating energy ring on diamond crest --- */
.forge-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 48px 0;
}

.crest {
  width: 160px;
  height: 160px;
}
.crest .ring {
  transform-origin: 80px 80px;
  animation: ringspin 2.4s linear infinite;
}
.crest .pulse {
  transform-origin: 80px 80px;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes ringspin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.12);
    opacity: 0.72;
  }
}

.status-text {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cyan);
  animation: statusfade 400ms ease;
  text-align: center;
  min-height: 1.5em;
}
@keyframes statusfade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- Reveal flash --- */
.reveal-flash {
  animation: revealflash 500ms ease-out;
}
@keyframes revealflash {
  0% {
    filter: brightness(4) contrast(0.4);
    clip-path: polygon(0 45%, 100% 40%, 100% 60%, 0 55%);
  }
  60% {
    filter: brightness(1.6);
    clip-path: polygon(0 5%, 100% 0, 100% 100%, 0 95%);
  }
  100% {
    filter: none;
    clip-path: none;
  }
}

.hero-output {
  width: 100%;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0px #000;
  background: var(--panel);
}

/* --- Upload zone --- */
.dropzone {
  border: 2px dashed var(--border-gold);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  background: rgba(17, 30, 56, 0.5);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
  width: 100%;
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
  color: var(--titanium);
}
.dropzone.dragover,
.dropzone:hover {
  border-color: var(--gold);
  background: rgba(255, 183, 3, 0.06);
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius);
  background: rgba(10, 14, 23, 0.5);
}
.consent-row input[type='checkbox'] {
  width: 24px;
  height: 24px;
  margin: 2px 0 0;
  accent-color: var(--gold);
  flex-shrink: 0;
}
.consent-row label {
  cursor: pointer;
}

.error-banner {
  border: 1px solid var(--crimson);
  background: rgba(230, 57, 70, 0.12);
  color: var(--titanium);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
}

.notice {
  font-size: 0.85rem;
  color: rgba(248, 250, 252, 0.65);
}

/* --- Welcome hero artwork --- */
.welcome-art {
  margin: 32px 0 0;
  position: relative;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0px #000;
  overflow: hidden;
  line-height: 0;
}
.welcome-art img {
  width: 100%;
  height: auto;
  display: block;
}
/* subtle vignette so the painting seats into the obsidian backdrop */
.welcome-art::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 48px rgba(10, 14, 23, 0.55);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-top: 28px;
  font-size: 0.9rem;
}
.footer-links a {
  color: var(--cyan);
  text-decoration: none;
  padding: 8px 4px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}
.footer-links a:hover {
  text-decoration: underline;
}

.crop-stage {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border-cyan);
  background: #000;
  touch-action: none;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--gold);
  min-height: 48px;
}

input[type='text'],
textarea {
  width: 100%;
  background: rgba(10, 14, 23, 0.7);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius);
  color: var(--titanium);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px 14px;
  min-height: 48px;
}

.mock-banner {
  background: rgba(131, 56, 236, 0.18);
  border: 1px solid var(--violet);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* --- prefers-reduced-motion: swap dynamic energy for alpha crossfades --- */
@media (prefers-reduced-motion: reduce) {
  .crest .ring,
  .crest .pulse {
    animation: none;
  }
  .status-text {
    animation: none;
  }
  .reveal-flash {
    animation: reducedfade 400ms ease;
  }
  @keyframes reducedfade {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
  .btn-primary:hover:not(:disabled),
  .btn-secondary:hover:not(:disabled) {
    transform: none;
  }
}
