/* ============================================================
   CANVAS DESIGN SYSTEM — chan602.com
   Shared across index.html (canvas) and all sub-pages.
   Load before any page-specific styles.
   ============================================================ */

:root {
  --bg:     #f0f4f8;
  --ink:    #0f1e2e;
  --muted:  #5a6e82;
  --accent: #1a6db5;
  --line:   #ccd9e8;
  --card:   #ffffff;
  --dot:    #c0d0e0;

  --r-sm: 4px;
  --r-md: 6px;
}

/* ── DOT GRID (canvas homepage background) ── */
.canvas-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--dot) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
}

/* ── SUB-PAGE BODY (windowed pages) ── */
body.canvas-page {
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--dot) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  min-height: 100vh;
}

/* ── DASHED THREAD (sub-pages — implies connection to home canvas) ── */
.canvas-thread {
  position: fixed;
  top: 50%;
  left: 0;
  width: 56px;
  border-top: 2px dashed var(--line);
  z-index: 5;
  pointer-events: none;
  opacity: 0.6;
  transform: translateY(-50%);
}

/* ── PAGE HEADER CARD (sub-pages — section intro sits in a card on the dot grid) ── */
.page-header-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 2rem 2.5rem;
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.page-header-text {
  flex: 1;
  min-width: 0;
}
.page-header-icon {
  flex-shrink: 0;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-header-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── SUB-PAGE ENTRANCE ANIMATION ── */
/* Canvas pan on index sells the exit. Sub-pages just need a clean arrival. */
body.canvas-page main {
  animation: page-enter 0.45s ease-out both;
}
@keyframes page-enter {
  from { opacity: 0; transform: translateY(14px); }
}

/* ── CANVAS RETURN INDICATOR (sub-pages) ── */
/* Directional arrow pointing toward canvas home. Angle + position set per-page inline. */
.canvas-return {
  position: fixed;
  z-index: 200;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s;
  user-select: none;
  /* Arrive after page content, beacon rings draw attention */
  animation: return-arrive 0.4s ease 0.8s both;
}
.canvas-return:hover { color: var(--accent); }
.canvas-return svg { overflow: visible; display: block; }

/* First beacon ring: drops in from above, then sonar-pulses outward */
.canvas-return::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
  animation: beacon-drop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 1.1s both,
             beacon-pulse 1.6s ease-out 1.7s 2 normal forwards;
}

/* Second ring: delayed slightly, gives overlapping sonar effect */
.canvas-return::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
  animation: beacon-pulse 1.6s ease-out 2.4s 1 normal forwards;
}

@keyframes return-arrive {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes beacon-drop {
  from { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(0.4); }
  70%  { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.08); }
  to   { opacity: 0.65; transform: translateX(-50%) scale(1); }
}
@keyframes beacon-pulse {
  from { opacity: 0.65; transform: translateX(-50%) scale(1); }
  to   { opacity: 0;    transform: translateX(-50%) scale(3); }
}
