/* ==========================================================================
   Beekon Studio — page styles (loaded only on /studio/)
   Same chunky language as the rest of the site: ink borders, drop shadows,
   candy accents. The board itself is drawn to look like the light.
   ========================================================================== */

.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;
}

.studio-hero { padding-bottom: 26px; }
.studio-section { padding: 0 0 56px; }

.studio {
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 8px 0 var(--ink);
  padding: 20px 22px 22px; display: grid; gap: 14px;
  grid-template-columns: minmax(0, 1fr);   /* the swipeable phone palette must not widen the card */
}
.studio .ico { display: inline-flex; }
.studio .ico svg { width: 20px; height: 20px; }

/* ----- name + file actions ----- */
.studio-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px;
  padding-bottom: 16px; border-bottom: 2px dashed var(--line);
}
.design-name { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; }
.design-name input {
  font-family: var(--font-body); font-weight: 600; font-size: 1rem; color: var(--ink); background: #fff;
  border: 2px solid var(--ink); border-radius: 999px; padding: 8px 16px; width: 240px; max-width: 100%;
}
.studio-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.studio-actions .btn { font-size: 1rem; padding: 10px 18px; gap: 8px; }

/* ----- toolbar ----- */
.studio-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.tool-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tool-group-label {
  font-family: var(--font-display); font-weight: 700; font-size: 0.74rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); margin-right: 2px;
}
.tool {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; line-height: 1.1; color: var(--ink);
  background: #fff; border: 2px solid var(--ink); border-radius: 14px;
  padding: 7px 12px; min-height: 40px; cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}
.tool:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }
.tool:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.tool[aria-pressed="true"] { background: var(--honey); }
.tool[disabled] { opacity: 0.4; cursor: default; transform: none; box-shadow: 0 3px 0 var(--ink); }
.tool--icon { padding: 7px 9px; min-width: 40px; }
.tool--small { font-size: 0.84rem; min-height: 32px; padding: 4px 10px; border-radius: 11px; box-shadow: 0 2px 0 var(--ink); }
.tool--small.is-armed { background: var(--coral); color: #fff; }

.size-dot { display: block; border-radius: 3px; background: var(--ink); }
.size-dot--1 { width: 6px; height: 6px; }
.size-dot--2 { width: 11px; height: 11px; }
.size-dot--3 { width: 16px; height: 16px; border-radius: 4px; }

/* ----- palette ----- */
.studio-palette { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.current-color {
  display: inline-flex; align-items: center; gap: 9px; min-width: 128px;
  font-family: var(--font-display); font-weight: 700;
}
.current-chip {
  width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--ink);
  box-shadow: 0 2px 0 var(--ink); flex-shrink: 0;
}
.swatches { display: grid; grid-template-columns: repeat(18, 26px); gap: 5px; }
.swatch {
  position: relative; width: 26px; height: 26px; padding: 0; flex-shrink: 0;
  border: 2px solid var(--ink); border-radius: 7px; cursor: pointer;
  transition: transform 0.1s;
}
.swatch:hover { transform: translateY(-2px); }
.swatch[aria-pressed="true"], .swatch.is-selected {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink);
}
.swatch--rainbow { background: linear-gradient(135deg, #ff004c, #ff7f00, #ffe600, #48dc60, #00d1ff, #7657ff); }
.swatch--custom {
  display: inline-block; overflow: hidden;
  background: conic-gradient(#ff004c, #ffe600, #48dc60, #00d1ff, #7657ff, #ff4ecd, #ff004c);
}
.swatch--custom::after {
  content: "+"; position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); pointer-events: none;
}
.swatch--custom input {
  position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px);
  opacity: 0; cursor: pointer; border: 0; padding: 0;
}
.swatch--custom:focus-within { outline: 3px solid var(--honey-deep); outline-offset: 2px; }

/* ----- per-tool options ----- */
.tool-options { min-height: 46px; display: flex; align-items: center; }
.tool-options > [hidden] { display: none !important; }
.tool-tip { margin: 0; color: var(--ink-soft); font-size: 0.96rem; }
.sticker-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.sticker-btn {
  width: 46px; height: 46px; padding: 5px; cursor: pointer;
  background: #0c0a18; border: 2px solid var(--ink); border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink); transition: transform 0.1s;
}
.sticker-btn:hover { transform: translateY(-2px); }
.sticker-btn[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--honey), 0 3px 0 var(--ink); transform: translateY(-2px); }
.sticker-btn canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.words-option { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.words-option label { font-family: var(--font-display); font-weight: 700; }
.words-option input {
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink); background: #fff;
  border: 2px solid var(--ink); border-radius: 999px; padding: 7px 16px; width: 240px; max-width: 100%;
}
.words-option input:focus, .design-name input:focus { outline: 3px solid var(--honey); outline-offset: 2px; }
.words-fit { color: var(--ink-soft); font-size: 0.92rem; }
.words-fit.is-warning { color: #c2410c; font-weight: 700; }

/* ----- the board, dressed as a Beekon Light ----- */
.studio-device {
  /* as big as fits: the board shrinks on short laptop screens so it stays in view */
  position: relative; width: 100%; max-width: min(100%, max(600px, calc((100vh - 400px) * 2)));
  margin: 4px auto 6px;
  background: linear-gradient(180deg, #2a2447 0%, #15121f 100%);
  border: 3px solid var(--ink); border-radius: 22px;
  padding: clamp(8px, 1.5vw, 16px);
  box-shadow: 0 8px 0 var(--ink), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.studio-device.is-dropping { box-shadow: 0 8px 0 var(--ink), 0 0 0 5px var(--honey); }
.board-scroll {
  position: relative; aspect-ratio: 2 / 1; overflow: hidden;
  background: #0c0a18; border-radius: 9px;
  scrollbar-width: thin; scrollbar-color: #4a4370 #0c0a18;
}
.board-scroll.is-zoomed { overflow: auto; overscroll-behavior: contain; }
.board-stack { position: relative; width: calc(100% * var(--zoom, 1)); aspect-ratio: 2 / 1; }
.board-stack canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.board-glow {
  filter: blur(calc(var(--cell, 14px) * 0.5)); opacity: 0.85;
  image-rendering: auto;
}
.board-ui { touch-action: none; cursor: crosshair; outline: none; }
.board-stack:has(.board-ui:focus-visible) { outline: 3px solid var(--honey); outline-offset: -3px; }
.board-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  margin: 0; pointer-events: none; white-space: nowrap;
  font-family: var(--font-display); font-weight: 800; font-size: clamp(0.95rem, 2.4vw, 1.5rem);
  color: #fff8ee; letter-spacing: 0.02em;
  text-shadow: 0 0 14px rgba(255, 181, 40, 0.8), 0 0 4px rgba(255, 181, 40, 0.6);
  animation: hint-glow 2.4s ease-in-out infinite;
  transition: opacity 0.2s;
}
.studio-device:hover .board-hint { opacity: 0; animation: none; }   /* out of the way of sticker previews */
@keyframes hint-glow { 50% { opacity: 0.55; } }

/* ----- under the board ----- */
.board-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.zoom { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.zoom output { min-width: 3.3em; text-align: center; font-family: var(--font-display); font-weight: 700; }
.rotate-tip { display: none; margin: 0; width: 100%; font-size: 0.9rem; color: var(--ink-soft); }
.idea-bubble {
  position: relative; margin: 0 0 0 6px; max-width: 30em;
  background: var(--lilac); color: var(--ink); border: 2px solid var(--ink); border-radius: 14px;
  padding: 7px 14px; font-family: var(--font-display); font-weight: 700; line-height: 1.3;
  box-shadow: 0 3px 0 var(--ink);
}
.idea-bubble::before {
  content: ""; position: absolute; left: -8px; top: 50%; width: 12px; height: 12px;
  background: var(--lilac); border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  transform: translateY(-50%) rotate(45deg);
}

/* ----- sketchbook ----- */
.book-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.book-head h2 { margin-bottom: 0; }
.book-count {
  font-family: var(--font-display); font-weight: 800; font-size: 0.9rem;
  background: var(--ink); color: var(--honey); padding: 5px 14px; border-radius: 999px;
}
.sketchbook { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 16px; margin-top: 22px; }
.book-empty {
  grid-column: 1 / -1; margin: 0; padding: 26px; text-align: center; color: var(--ink-soft);
  border: 2px dashed var(--line); border-radius: 18px; background: var(--paper);
}
.book-card {
  display: grid; gap: 9px; padding: 12px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 var(--ink);
}
.book-card.is-open { box-shadow: 0 0 0 3px var(--honey), 0 4px 0 var(--ink); }
.book-card canvas {
  width: 100%; height: auto; aspect-ratio: 2 / 1; display: block; image-rendering: pixelated;
  border: 2px solid var(--ink); border-radius: 10px; background: #0c0a18;
}
.book-name { margin: 0; font-family: var(--font-display); font-weight: 700; overflow-wrap: anywhere; line-height: 1.25; }
.book-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.book-fine { font-size: 0.9rem; color: var(--ink-soft); margin: 16px 0 0; max-width: 46em; }

/* ----- grown-ups band ----- */
.file-card { display: grid; gap: 6px; align-self: center; }
.file-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.file-buttons .btn { font-size: 0.95rem; padding: 11px 18px; }

/* ----- small screens ----- */
@media (max-width: 660px) {
  /* phones: keep the controls compact so the board shows up on the first screen */
  .studio { padding: 12px 12px 14px; gap: 10px; border-radius: 18px; }
  .studio-head { gap: 8px; padding-bottom: 10px; }
  .design-name { width: 100%; }
  .design-name input { flex: 1; width: auto; min-width: 0; padding: 7px 14px; }
  .studio-actions { width: 100%; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
  .studio-actions .btn { padding: 9px 6px; font-size: 0.92rem; gap: 5px; box-shadow: 0 3px 0 var(--ink); }
  .studio-toolbar { gap: 8px; }
  .tool-group { gap: 4px; }
  .tool-group--tools { width: 100%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .tool-group--tools .tool { flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 0.78rem; min-height: 52px; border-radius: 12px; }
  .tool--icon { min-width: 38px; min-height: 38px; padding: 5px 7px; }
  .tool-group-label, .current-color, .tool-tip { display: none; }
  .tool-options { min-height: 0; }
  .swatches {
    width: 100%; min-width: 0; grid-auto-flow: column; grid-template-columns: none;
    grid-template-rows: repeat(2, 30px); grid-auto-columns: 30px;
    overflow-x: auto; padding: 5px 5px 9px; scrollbar-width: thin;
    /* a soft fade at the edge says "there are more colors this way" */
    -webkit-mask-image: linear-gradient(90deg, #000 80%, transparent);
    mask-image: linear-gradient(90deg, #000 80%, transparent);
  }
  .swatch { width: 30px; height: 30px; }
  .studio-device { border-radius: 16px; }
  .sticker-btn { width: 42px; height: 42px; }
  .idea-bubble { margin: 0; width: 100%; max-width: none; order: 3; }
  .idea-bubble::before { left: 22px; top: -8px; transform: rotate(135deg); }
}
@media (max-width: 660px) and (orientation: portrait) {
  .rotate-tip { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .board-hint { animation: none; }
}
