/* Wall4You - black / white / blue. Square corners echo the pixels. */

:root {
  --ink: #000;
  --paper: #fff;
  --blue: #1f4fff;
  --blue-dark: #1238c9;
  --tile: #e6e9ef;      /* an unused pixel */
  --line: #dfe3ea;
  --muted: #5b6270;
  --danger: #c0262d;
  --font: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
}

a { color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.logo-mark { width: 22px; height: 22px; display: block; }
.logo-mark .ink { fill: var(--ink); }
.logo-mark .blue { fill: var(--blue); }

.nav { display: flex; gap: 24px; }
.nav a {
  text-decoration: none;
  font-weight: 600;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { border-bottom-color: var(--ink); }
.nav a[aria-current="page"] { border-bottom-color: var(--blue); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 11px 20px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--paper); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-ghost { border-color: var(--line); }
.btn-large { padding: 18px 38px; font-size: 1.15rem; }
.btn[disabled] { opacity: 0.55; cursor: progress; }

/* ---------- Home / error hero ---------- */
.hero {
  min-height: calc(100vh - 62px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px 24px 64px;
  text-align: center;
}

/* Decorative strip of tiles: grey pixels with a few claimed ones */
.tiles {
  position: relative;
  width: min(100%, 576px);
  height: 96px;
  margin-bottom: 12px;
  background-color: var(--tile);
  background-image:
    linear-gradient(to right, var(--paper) 2px, transparent 2px),
    linear-gradient(to bottom, var(--paper) 2px, transparent 2px);
  background-size: 16px 16px;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
}
.tiles::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 14px;
  height: 14px;
  background: var(--blue);
  box-shadow:
    80px 0 0 #111,
    96px 0 0 #111,
    176px 16px 0 #e8452c,
    192px 16px 0 #e8452c,
    192px 32px 0 #e8452c,
    272px 48px 0 var(--blue),
    288px 48px 0 var(--blue),
    288px 64px 0 var(--blue),
    352px 16px 0 #1a9e6e,
    368px 32px 0 #1a9e6e,
    432px 64px 0 #111,
    448px 64px 0 #111,
    448px 80px 0 #111,
    128px 64px 0 #e0a100,
    144px 64px 0 #e0a100,
    336px 80px 0 #e0a100;
}

.hero-title {
  margin: 0;
  font-size: clamp(3.2rem, 11vw, 7.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
}
.hero-slogan {
  margin: 0 0 12px;
  font-size: clamp(1.1rem, 2.6vw, 1.5rem);
  color: var(--muted);
}

.hero-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  font-size: 1.05rem;
  font-weight: 600;
}
.hero-steps .free { color: var(--blue); }

.error-code {
  margin: 0;
  font-size: clamp(5rem, 22vw, 11rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--blue);
}
.error-title { margin: 0; font-size: clamp(1.6rem, 5vw, 2.4rem); letter-spacing: -0.03em; }

/* ---------- Wall page ---------- */
.wall-app { padding: 18px 24px 140px; }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  align-items: baseline;
  margin-bottom: 6px;
}
.stat { margin: 0; }
.stat strong { font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-percent { margin-left: auto; }

.hint { margin: 0 0 14px; color: var(--muted); font-size: 0.95rem; }

.wall-scroll {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  overflow: auto;                 /* mobile: scroll the wall sideways */
  border: 2px solid var(--ink);
  background: var(--paper);
  -webkit-overflow-scrolling: touch;
}
#wall-canvas { display: block; cursor: pointer; }

/* ---------- Tooltip / toast ---------- */
.tooltip {
  position: fixed;
  z-index: 30;
  max-width: 280px;
  padding: 7px 11px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.85rem;
  line-height: 1.35;
  white-space: pre-line;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.toast {
  position: fixed;
  z-index: 40;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(92vw, 520px);
  padding: 12px 18px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  text-align: center;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--blue); }

/* ---------- Claim panel ---------- */
.panel {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  padding: 14px 24px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  border-top: 2px solid var(--ink);
}
.panel-count { margin: 0; font-weight: 800; font-size: 1.05rem; align-self: center; }
.panel-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 280px; font-weight: 600; font-size: 0.9rem; }
.panel-field input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  font: inherit;
  font-weight: 400;
}
.panel-field input[aria-invalid="true"] { border-color: var(--danger); }
.panel-image { flex: 1 1 260px; }
.panel-image label { font-weight: 600; font-size: 0.9rem; }
.image-row { display: flex; align-items: center; gap: 12px; }
.image-row input[type="file"] { flex: 1; min-width: 0; padding: 0; border: 0; font: inherit; font-size: 0.85rem; font-weight: 400; }
.image-preview { width: 44px; height: 44px; object-fit: contain; border: 2px solid var(--ink); background: var(--tile); }
.image-note { color: var(--muted); font-weight: 400; min-height: 1.2em; }
.panel-actions { display: flex; gap: 10px; }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .site-header { padding: 12px 16px; }
  .wall-app { padding: 14px 12px 280px; }
  .stat-percent { margin-left: 0; flex-basis: 100%; }
  .panel { padding-left: 14px; padding-right: 14px; }
  .panel-actions { width: 100%; }
  .panel-actions .btn { flex: 1; }
}
