/* ───────────── Reset + tokens ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

:root {
  --bg: #070707;
  --bg-elev: rgba(255, 255, 255, 0.03);
  --bg-elev-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);
  --ink: #f4f4f4;
  --ink-soft: #a8a8a8;
  --ink-faint: #6e6e6e;
  --accent: #caff00;        /* Sinapps lime */
  --accent-hot: #3500f7;    /* Sinapps blue (glow) */
  --status-wip: #caff00;
  --status-ready: #2800ed;
  --status-archived: #6e6e6e;
  --radius: 16px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body {
  background:
    radial-gradient(680px circle at 12% 8%, rgba(53, 0, 247, 0.38), transparent 60%),
    radial-gradient(760px circle at 88% 2%, rgba(53, 0, 247, 0.26), transparent 55%),
    radial-gradient(720px circle at 78% 78%, rgba(53, 0, 247, 0.22), transparent 60%),
    radial-gradient(600px circle at 8% 92%, rgba(53, 0, 247, 0.18), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "ss02";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}

/* Subtle film grain overlay */
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 3.5vw, 2.5rem);
}

/* ───────────── Hero ───────────── */
.hero {
  padding-top: clamp(3rem, 7vw, 5.5rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.logo-mark {
  display: inline-block;
  width: 31px; height: 21px;
  background: var(--accent);
  -webkit-mask: url("logo-mark.svg") no-repeat center / contain;
  mask: url("logo-mark.svg") no-repeat center / contain;
}
.logo-word {
  display: inline-block;
  width: 96px; height: 25px;
  background: var(--ink);
  -webkit-mask: url("logo-word.svg") no-repeat left center / contain;
  mask: url("logo-word.svg") no-repeat left center / contain;
}
.brand-sep {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 1rem;
  margin: 0 0.1rem;
}
.brand-section {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(2.4rem, 6.5vw, 5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0 0 1.25rem;
  max-width: 20ch;
  color: var(--ink);
}

.hero-title .accent {
  color: #070707;
  background: var(--accent);
  padding: 0 0.15em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  font-style: normal;
  font-weight: 700;
}

.hero-sub {
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 56ch;
  margin: 0 0 clamp(2.5rem, 5vw, 3.5rem);
}

/* ───────────── Search ───────────── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.35rem 0.4rem 0.35rem 1.5rem;
  max-width: 720px;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.search-wrap:focus-within {
  border-color: var(--accent);
  background: var(--bg-elev-2);
}

.search-icon {
  font-size: 1.35rem;
  color: var(--ink-faint);
  margin-right: 0.75rem;
  line-height: 1;
}

.search-wrap:focus-within .search-icon { color: var(--accent-hot); }

#search {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  padding: 0.9rem 0;
  letter-spacing: -0.01em;
}

#search::placeholder { color: var(--ink-faint); }

.search-hint {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255,0.04);
  margin-left: 0.5rem;
  white-space: nowrap;
}

/* ───────────── Grid + cards ───────────── */
.grid-wrap {
  padding: clamp(2.5rem, 5vw, 4rem) 0 clamp(5rem, 8vw, 7rem);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: clamp(1rem, 1.8vw, 1.5rem);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.25rem;
  color: inherit;
  isolation: isolate;
  overflow: hidden;
  transition: transform 0.4s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
  min-height: 200px;
}

/* Invisible full-card link → click anywhere goes to Board */
.card-bg-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  text-decoration: none;
  border-radius: inherit;
}

/* Foreground interactive elements above the bg-link */
.card-head,
.card-desc,
.card-foot { position: relative; z-index: 2; }

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 100% 0%, rgba(202, 255, 0, 0.07), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  z-index: -1;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: var(--bg-elev-2);
}

.card:hover::before { opacity: 1; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.15;
}

.status {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.32rem 0.6rem;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}

.status-wip { background: var(--accent); color: #070707; }
.status-ready { background: var(--accent-hot); color: #fff; }
.status-archived { background: rgba(255, 255, 255, 0.08); color: var(--ink-faint); }

.card-desc {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 auto;
  flex: 1;
}

.card-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  gap: 1rem;
  flex-wrap: wrap;
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

.card-meta strong {
  color: var(--ink-soft);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.62rem;
}

.card-actions {
  display: flex;
  gap: 0.4rem;
}

.card-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease), transform 0.3s var(--ease);
  cursor: pointer;
  white-space: nowrap;
}

.card-action span {
  font-size: 0.95em;
  transition: transform 0.3s var(--ease);
  display: inline-block;
}

.card-action:hover span { transform: translateX(2px); }

.card-action-ghost {
  color: var(--ink-soft);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.02);
}

.card-action-ghost:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.05);
}

.card-action-primary {
  color: #fff;
  border-color: var(--accent-hot);
  background: var(--accent-hot);
}

.card-action-primary:hover {
  border-color: var(--accent-hot);
  background: #4a1aff;
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .card-foot { flex-direction: column; align-items: flex-start; }
  .card-actions { width: 100%; }
  .card-action { flex: 1; justify-content: center; }
}

/* ───────────── Empty ───────────── */
.empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--ink-faint);
  font-size: 1rem;
}

/* ───────────── Footer ───────────── */
.foot {
  border-top: 1px solid var(--line);
  padding: 2rem 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.foot .container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.foot .sep { opacity: 0.5; }

/* ───────────── Reveal on load ───────────── */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.brand, .hero-title, .hero-sub, .search-wrap {
  opacity: 0;
  animation: rise 0.9s var(--ease) forwards;
}

.hero-title { animation-delay: 0.05s; }
.hero-sub { animation-delay: 0.18s; }
.search-wrap { animation-delay: 0.3s; }

.card {
  opacity: 0;
  animation: rise 0.7s var(--ease) forwards;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ───────────── Responsive ───────────── */
@media (max-width: 640px) {
  .search-hint { display: none; }
  .card-head { flex-direction: column; align-items: flex-start; }
}

/* ───── Cronologia (orologio sulle card + modale) ───── */
.card-date { display: inline-flex; align-items: center; gap: 0.4rem; }
.card-history {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: transparent; color: var(--ink-faint); cursor: pointer;
  transition: color .2s, border-color .2s, background .2s; position: relative; z-index: 3;
}
.card-history:hover { color: var(--accent); border-color: var(--accent); background: rgba(202, 255, 0,0.08); }

#history-modal {
  position: fixed; inset: 0; z-index: 1000; display: none;
  align-items: center; justify-content: center;
  background: rgba(10,10,11,0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
#history-modal.show { display: flex; }
#history-modal .hist-sheet {
  background: var(--bg-elev, #14161a); border: 1px solid var(--line);
  border-radius: var(--radius, 14px); width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px); overflow: auto; padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.hist-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 14px; }
.hist-eyebrow { font-family: var(--font-mono, monospace); font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-faint); }
.hist-head h3 { margin: 4px 0 0; font-size: 1.3rem; font-weight: 500; letter-spacing: -0.02em; color: var(--ink); }
.hist-close { background: transparent; border: 1px solid var(--line); color: var(--ink-soft); border-radius: 999px; width: 30px; height: 30px; cursor: pointer; transition: all .2s; }
.hist-close:hover { color: var(--ink); border-color: var(--line-strong); }
.hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.hist-item { padding: 12px 0; border-top: 1px solid var(--line); }
.hist-item:first-child { border-top: none; }
.hist-msg { font-size: 0.95rem; color: var(--ink); line-height: 1.45; }
.hist-meta { display: flex; align-items: center; gap: 0.8rem; margin-top: 5px; font-family: var(--font-mono, monospace); font-size: 0.72rem; color: var(--ink-faint); }
.hist-author { color: var(--accent); }
.hist-sha { color: var(--ink-faint); opacity: 0.7; }
.hist-empty { padding: 1.5rem 0; color: var(--ink-faint); text-align: center; font-size: 0.9rem; }
