/* Paddie — board styling. Every board colour arrives from the API as a CSS
   custom property on :root, so theming is just re-setting variables. */

:root {
  --board-bg: #f7c948;
  --board-ink: #1c1917;
  --accent: #7c3aed;
  --accent-ink: #ffffff;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16, 15, 14, .08), 0 6px 18px rgba(16, 15, 14, .10);
  --shadow-lifted: 0 2px 4px rgba(16, 15, 14, .10), 0 14px 32px rgba(16, 15, 14, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--board-ink);
  background-color: var(--board-bg);
  /* Subtle dotted texture, like the reference boards. */
  background-image: radial-gradient(rgba(0, 0, 0, .08) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  opacity: 0;
  transition: opacity .25s ease;
}
body.ready { opacity: 1; }
body.plain { background-image: none; }

/* ---------- Header ---------- */

.board-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 14px;
  background: color-mix(in srgb, var(--board-bg) 82%, black 8%);
  backdrop-filter: saturate(140%) blur(8px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}
.board-header__inner {
  display: flex;
  gap: 16px;
  align-items: center;
  max-width: 1500px;
  margin: 0 auto;
}
.board-header__back {
  font-size: 26px;
  line-height: 1;
  text-decoration: none;
  color: inherit;
  opacity: .6;
}
.board-header__back:hover { opacity: 1; }
.board-header__members { margin-left: auto; }
.board-header__icon { font-size: 40px; line-height: 1; }
.board-header__title {
  margin: 0;
  font-size: clamp(22px, 3.2vw, 32px);
  font-weight: 800;
  letter-spacing: -.02em;
}
.board-header__description {
  margin: 2px 0 0;
  font-size: 15px;
  opacity: .72;
}

/* ---------- Wall (masonry) ---------- */

.wall {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px 20px 120px;
  columns: 4 280px;
  column-gap: 20px;
}
.wall__empty {
  column-span: all;
  margin-top: 12vh;
  text-align: center;
  font-size: 17px;
  opacity: .7;
}

/* ---------- Card ---------- */

.card {
  position: relative;
  display: block;
  break-inside: avoid;
  margin: 0 0 20px;
  background: var(--card-bg, #fff);
  color: var(--card-ink, #1c1917);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .18s ease, transform .18s ease;
}
.card:hover { box-shadow: var(--shadow-lifted); transform: translateY(-2px); }
.card--dragging { opacity: .45; }

.card__drop {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
  z-index: 3;
}
.card__drop--before { top: 0; }
.card__drop--after { bottom: 0; }

.card__image { display: block; width: 100%; cursor: zoom-in; }
.card__embed { position: relative; aspect-ratio: 16 / 9; background: #000; }
.card__embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.card__content { position: relative; padding: 14px 16px 10px; }
.card__title {
  margin: 0 22px 6px 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.3;
}
.card__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.card__author { margin: 8px 0 0; font-size: 12px; opacity: .55; overflow-wrap: anywhere; }

.card__menu { position: absolute; top: 8px; right: 8px; }
.icon-button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  opacity: .55;
}
.icon-button:hover { opacity: 1; background: rgba(125, 125, 125, .18); }

.menu {
  position: absolute;
  top: 28px;
  right: 0;
  z-index: 5;
  min-width: 132px;
  padding: 6px;
  background: #fff;
  color: #1c1917;
  border-radius: 12px;
  box-shadow: var(--shadow-lifted);
}
.menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.menu button:hover { background: #f4f4f5; }
.menu__danger { color: #dc2626; }

.card__footer {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px 12px 10px;
}
.chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  opacity: .8;
}
.chip:hover { background: rgba(125, 125, 125, .16); opacity: 1; }
.chip--liked { opacity: 1; font-weight: 600; }

/* ---------- Comments ---------- */

.thread {
  padding: 4px 14px 14px;
  border-top: 1px solid rgba(125, 125, 125, .22);
}
.comment { padding: 8px 0; border-bottom: 1px solid rgba(125, 125, 125, .14); }
.comment__head { display: flex; justify-content: space-between; align-items: baseline; }
.comment__author { font-size: 12px; font-weight: 700; opacity: .75; }
.comment__delete {
  border: 0; background: transparent; color: inherit;
  font-size: 15px; line-height: 1; cursor: pointer; opacity: .35;
}
.comment__delete:hover { opacity: .9; }
.comment__body { margin: 2px 0 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }

.comment-form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.comment-form input {
  flex: 1 1 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(125, 125, 125, .35);
  border-radius: 10px;
  background: rgba(255, 255, 255, .6);
  font: inherit;
  font-size: 14px;
  color: inherit;
}
.comment-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- Buttons ---------- */

.button {
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button:disabled { opacity: .5; cursor: progress; }
.button--ghost { background: transparent; color: #57534e; }
.button--small { padding: 7px 14px; font-size: 13px; }
.button--block { display: block; width: 100%; }
.button--danger { background: #dc2626; color: #fff; }

.link {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 4px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: inherit;
  opacity: .6;
  text-decoration: underline;
  cursor: pointer;
}

.fab {
  position: fixed;
  right: max(24px, env(safe-area-inset-right, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-lifted);
  transition: transform .15s ease;
}
.fab:hover { transform: scale(1.06); }

/* ---------- Modal ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 25, 23, .45);
  backdrop-filter: blur(3px);
}
.backdrop--dark { background: rgba(0, 0, 0, .82); cursor: zoom-out; }
.lightbox { max-width: 92vw; max-height: 88vh; border-radius: 10px; }

.modal {
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px;
  background: #fff;
  color: #1c1917;
  border-radius: 22px;
  box-shadow: var(--shadow-lifted);
}
.modal__title { margin: 0 0 14px; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.modal__error { margin: 10px 0 0; color: #dc2626; font-size: 14px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.field {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 11px 13px;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  background: #fafaf9;
  font: inherit;
  font-size: 15px;
  color: inherit;
  resize: vertical;
}
.field:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: #fff; }
.field--title { font-size: 17px; font-weight: 700; }
.field--select { appearance: auto; }
.field--small { padding: 6px 8px; font-size: 13px; margin-bottom: 0; }
.field--code { font-size: 28px; letter-spacing: .4em; text-align: center; font-weight: 700; }
.field--icon { width: 64px; text-align: center; font-size: 20px; }
.field--color { width: 64px; padding: 4px; }

.attach { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.attach__file {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px dashed #d6d3d1;
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
}
.attach__file:hover { border-color: var(--accent); color: var(--accent); }
.attach__file input { display: none; }
.attach .field--url { flex: 1 1 200px; margin-bottom: 0; }
.attach__preview { margin-top: 4px; }
.attach__preview img { display: block; width: 100%; border-radius: 12px; margin-bottom: 8px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.swatch {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}
.swatch--on { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Home and login ---------- */

body.centred { display: grid; place-items: center; }

.top-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 14px;
  background: color-mix(in srgb, var(--board-bg) 82%, black 8%);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}
.top-bar__brand { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.top-bar__right { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.top-bar__email { font-size: 14px; opacity: .7; }

.page {
  display: grid;
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.panel {
  padding: 22px;
  background: #fff;
  color: #1c1917;
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.panel--narrow { width: min(380px, 92vw); }
.panel__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel__title { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.panel__head .button { margin-left: auto; }
.panel__hint { margin: 12px 0 0; font-size: 13px; opacity: .65; line-height: 1.5; }
.panel__error { margin: 12px 0 0; color: #dc2626; font-size: 14px; }
.panel--narrow .panel__title { margin-bottom: 14px; }

.board-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
}
.board-tile {
  display: block;
  padding: 16px;
  border-radius: var(--radius);
  border-top: 5px solid var(--tile-accent);
  background: var(--tile-bg);
  color: var(--tile-ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: box-shadow .18s ease, transform .18s ease;
}
.board-tile:hover { box-shadow: var(--shadow-lifted); transform: translateY(-2px); }
.board-tile__icon { font-size: 28px; line-height: 1; }
.board-tile__title { margin: 8px 0 4px; font-size: 16px; font-weight: 700; }
.board-tile__description {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  opacity: .72;
  overflow-wrap: anywhere;
}
.board-tile__foot { margin-top: 12px; font-size: 12px; opacity: .6; }

.invite { display: flex; flex-wrap: wrap; gap: 8px; align-items: start; }
.invite .field { flex: 1 1 200px; margin-bottom: 0; }
.invite .field--select { flex: 0 1 180px; }

.people { width: 100%; border-collapse: collapse; margin-top: 16px; }
.people td { padding: 8px 6px; border-top: 1px solid #f0efee; vertical-align: middle; }
.people__email { font-size: 14px; overflow-wrap: anywhere; }
.people__name { font-size: 14px; opacity: .65; overflow-wrap: anywhere; }
.people__actions { width: 34px; text-align: right; }

.welcome {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.welcome__name { overflow-wrap: anywhere; }
.welcome__input { width: 14ch; margin: 0; font-size: 20px; font-weight: 700; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f4f4f5;
  font-size: 12px;
  font-weight: 600;
  color: #57534e;
}

.theme-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; }
.theme-row label { font-size: 13px; opacity: .7; }
.theme-row .field { margin-bottom: 0; margin-top: 4px; }

@media (max-width: 640px) {
  .wall { padding: 16px 14px 110px; column-gap: 14px; }
  .card { margin-bottom: 14px; }
  .top-bar__email { display: none; }
}
