@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300..700;1,14..32,300..400&display=swap");

/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Palette */
  --navy:    #011936;
  --coral:   #ff715b;
  --white:   #ffffff;
  --teal:    #1ea896;

  /* Surface */
  --bg:            #011936;
  --bg-elevated:   #ffffff;
  --fg:            #ffffff;
  --fg-on-card:    #011936;
  --muted:         rgba(255, 255, 255, 0.55);
  --muted-on-card: rgba(1, 25, 54, 0.5);
  --border:        rgba(255, 255, 255, 0.1);
  --border-card:   rgba(1, 25, 54, 0.08);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.25);
  --shadow-md:     0 6px 24px rgba(0,0,0,0.35);
  --shadow-hover:  0 12px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,113,91,0.2);
  --accent:        #ff715b;
  --accent-alt:    #1ea896;
  --radius-card:   12px;
  --radius-pill:   999px;
  --font:          "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --focus-ring:    0 0 0 3px rgba(255, 113, 91, 0.3);

  /* Status badges — on white card surface */
  --status-idea:         rgba(1, 25, 54, 0.06);
  --status-idea-fg:      rgba(1, 25, 54, 0.55);
  --status-prototype:    rgba(30, 168, 150, 0.1);
  --status-prototype-fg: #1ea896;
  --status-active:       rgba(255, 113, 91, 0.1);
  --status-active-fg:    #ff715b;
  --status-archived:     rgba(1, 25, 54, 0.04);
  --status-archived-fg:  rgba(1, 25, 54, 0.35);
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Dotted surface background ─────────────────────────────────────────────── */
#dotted-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
#dotted-bg canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* All content above the backgrounds */
body > * {
  position: relative;
  z-index: 1;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.container {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Site header ────────────────────────────────────────────────────────────── */
.site-header {
  padding: 52px 0 0;
}
.site-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 12px 5px 10px;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.profile-btn:hover {
  color: var(--fg);
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.05);
}
.wordmark {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
}
.site-header h1 {
  margin: 18px 0 10px;
  font-size: clamp(26px, 5vw, 40px);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--white);
}
.site-header .lead {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 300;
  max-width: 480px;
  line-height: 1.6;
}

/* ── Cards section ──────────────────────────────────────────────────────────── */
.cards-section {
  padding: 44px 0 88px;
}
.section-label {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

/* ── Idea card ──────────────────────────────────────────────────────────────── */
.idea-card {
  display: flex;
  flex-direction: column;
  position: relative;
  background:
    radial-gradient(circle, rgba(1,25,54,0.03) 0.5px, transparent 0.5px),
    var(--bg-elevated);
  background-size: 16px 16px, auto;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 32px 22px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  cursor: pointer;
  color: var(--fg-on-card);
  overflow: visible;
}
.idea-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}
.idea-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Corner accent squares (border.txt inspired) */
.card-corner {
  position: absolute;
  width: 7px;
  height: 7px;
}
.card-corner.tl { top: -3px; left: -3px; background: var(--coral); }
.card-corner.tr { top: -3px; right: -3px; background: var(--teal); }
.card-corner.bl { bottom: -3px; left: -3px; background: var(--teal); }
.card-corner.br { bottom: -3px; right: -3px; background: var(--coral); }

.card-header {
  margin-bottom: 10px;
}
.card-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--navy);
}

/* Status icon — bottom-right of card */
.status-icon {
  position: absolute;
  bottom: 16px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  transition: background 0.15s;
}
.status-icon:hover { background: rgba(1,25,54,0.05); }
.status-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.status-icon.idea      svg { stroke: var(--muted-on-card); }
.status-icon.prototype svg { stroke: var(--teal); }
.status-icon.active    svg { stroke: var(--coral); }
.status-icon.archived  svg { stroke: var(--muted-on-card); opacity: 0.45; }

/* Keep .status-badge for detail page */
.status-badge {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  text-transform: capitalize;
  line-height: 1.5;
}
.status-badge.idea      { background: var(--status-idea);      color: var(--status-idea-fg); }
.status-badge.prototype { background: var(--status-prototype); color: var(--status-prototype-fg); }
.status-badge.active    { background: var(--status-active);    color: var(--status-active-fg); }
.status-badge.archived  { background: var(--status-archived);  color: var(--status-archived-fg); }

.card-desc {
  font-size: 13.5px;
  color: var(--muted-on-card);
  line-height: 1.6;
  flex: 1;
  margin: 0 0 18px;
  font-weight: 300;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tag {
  font-size: 11px;
  color: var(--muted-on-card);
  background: rgba(1, 25, 54, 0.04);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  font-weight: 400;
}
.card-date {
  font-size: 11px;
  color: var(--muted-on-card);
  white-space: nowrap;
  font-weight: 300;
}
/* Date box — top-right of card */
.card-date-box {
  position: absolute;
  top: -1px;
  right: 16px;
  background: var(--navy);
  color: var(--white);
  border-radius: 0 0 6px 6px;
  padding: 6px 10px 7px;
  text-align: center;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.card-date-box .date-month {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: block;
}
.card-date-box .date-year {
  font-size: 11px;
  font-weight: 300;
  display: block;
  margin-top: 2px;
  opacity: 0.6;
}

/* ── Empty state ────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 0;
  color: var(--muted);
}
.empty-state p { margin: 0; font-size: 15px; font-weight: 300; }

/* ── Divider ────────────────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
}

/* ── Idea detail page ───────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
  margin-bottom: 28px;
  font-weight: 300;
  transition: color 0.12s;
}
.back-link:hover { color: var(--fg); }
.back-link svg { width: 14px; height: 14px; }

.idea-detail-header { margin-bottom: 28px; }
.idea-detail-header h1 {
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 300;
  letter-spacing: -0.02em;
  margin: 14px 0 10px;
  line-height: 1.2;
}
.idea-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 300;
}
/* Tags on detail page are on dark bg */
.idea-meta .tag {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
}
/* Status badges on detail page are on dark bg */
.idea-meta .status-badge.idea      { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }
.idea-meta .status-badge.prototype { background: rgba(30,168,150,0.15);  color: var(--teal); }
.idea-meta .status-badge.active    { background: rgba(255,113,91,0.15);  color: var(--coral); }
.idea-meta .status-badge.archived  { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.35); }

.idea-body {
  max-width: 660px;
}
.idea-body p {
  margin: 0 0 1.2em;
  color: var(--muted);
  font-size: 15px;
  font-weight: 300;
}

/* ── QR overlay ─────────────────────────────────────────────────────────────── */
.qr-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 25, 54, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.qr-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
  padding: 36px 28px 28px;
  width: min(360px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  text-align: center;
  color: var(--fg-on-card);
}
.qr-card h2 {
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 8px;
  letter-spacing: -0.015em;
  color: var(--navy);
}
.qr-card p {
  font-size: 14px;
  color: rgba(1, 25, 54, 0.72);
  margin: 0 0 24px;
  line-height: 1.6;
  font-weight: 400;
}
#qr-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  border-radius: 8px;
  overflow: hidden;
}
#qr-canvas img,
#qr-canvas canvas {
  display: block;
  margin: 0 auto;
}
.qr-status {
  font-size: 14px;
  color: rgba(1, 25, 54, 0.72);
  min-height: 20px;
  font-weight: 400;
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(1, 25, 54, 0.5);
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(1, 25, 54, 0.12);
}
.passkey-hint {
  font-size: 13px;
  color: rgba(1, 25, 54, 0.65);
  margin: 10px 0 0;
  line-height: 1.5;
  font-weight: 400;
}
.qr-card .btn.passkey-btn {
  width: 100%;
  justify-content: center;
  margin: 0;
  color: var(--navy);
  border-color: rgba(1, 25, 54, 0.22);
  background: #fff;
  font-weight: 400;
}
.qr-card .btn.passkey-btn:hover {
  background: #f5f7fa;
  border-color: rgba(1, 25, 54, 0.32);
}
.qr-card .btn.secondary {
  justify-content: center;
  margin: 0;
  color: var(--navy);
  border-color: rgba(1, 25, 54, 0.22);
  background: #fff;
  font-weight: 400;
}
.qr-card .btn.secondary:hover {
  background: #f5f7fa;
  border-color: rgba(1, 25, 54, 0.32);
}
.pw-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(1, 25, 54, 0.22);
  background: #fff;
  color: var(--navy);
  font: 400 15px/1.2 var(--font);
  box-sizing: border-box;
}
.pw-input::placeholder { color: rgba(1, 25, 54, 0.4); }
.pw-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(244, 102, 65, 0.18);
}
.pw-status {
  font-size: 14px;
  min-height: 18px;
  font-weight: 400;
  margin: 0;
}
.pw-status.error { color: #b91c1c; }
.pw-status.success { color: #15803d; }

/* ── Button ─────────────────────────────────────────────────────────────────── */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  font: 300 14px/1 var(--font);
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s;
}
.btn:hover { background: rgba(255, 255, 255, 0.1); box-shadow: var(--shadow-sm); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 400;
}
.btn.primary:hover { background: #e5613f; border-color: #e5613f; }

/* ── Utility ────────────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
