/* Card Maker · Daftlad Creations
   Standalone. No external fonts or requests. */

:root {
  --bg: #050505;
  --bg1: #0a0d0c;
  --bg2: #101614;
  --bg3: #171e1b;
  --line: #1f2b25;
  --ink: #e8f2ec;
  --dim: #94a89c;
  --faint: #5e7066;
  --green: #00ff99;
  --cyan: #34e2ff;
  --magenta: #ff2bd6;
  --orange: #ff9a3c;
  --gold: #ffd24a;
  --font: "Segoe UI", "Trebuchet MS", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  min-height: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.is-on { display: flex; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg1);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 36px; height: 36px; }
.brand h1 { margin: 0; font-size: 16px; letter-spacing: 0.1em; text-transform: uppercase; }
.brand small { color: var(--dim); display: block; font-size: 11px; letter-spacing: 0.06em; }
.nav { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

button {
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
}
button:hover { border-color: var(--green); }
.btn-go { background: var(--green); color: #04130c; border-color: var(--green); }
.btn-go:hover { filter: brightness(1.08); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; width: 100%; }
.tagline { text-align: center; color: var(--faint); letter-spacing: 0.12em; text-transform: uppercase; font-size: 11px; }

/* Home */
.title-hero { text-align: center; padding: 28px 16px 8px; }
.title-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 6vw, 3.4rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(0,255,153,0.25);
}
.title-hero .sub { color: var(--green); letter-spacing: 0.16em; text-transform: uppercase; font-size: 12px; font-weight: 700; }
.title-hero p { max-width: 560px; margin: 12px auto; color: var(--dim); }
.occ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.occ-tile {
  text-align: left;
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  min-height: 110px;
}
.occ-tile h2 { margin: 0 0 6px; font-size: 16px; color: var(--cyan); }
.occ-tile p { margin: 0; color: var(--dim); font-weight: 500; font-size: 13px; }
.occ-tile:hover { border-color: var(--magenta); box-shadow: 0 0 18px rgba(255,43,214,0.15); }

/* Editor layout */
.editor {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px;
}
@media (max-width: 860px) {
  .editor { grid-template-columns: 1fr; }
}

.stage-wrap { position: sticky; top: 12px; }
.stage {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 480px;
  margin: 0 auto;
}
#fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}
.book {
  position: relative;
  width: 100%;
  height: 100%;
  perspective: 1400px;
  cursor: pointer;
  font-family: var(--font);
}
.page {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: var(--paper, #0c1210);
  color: var(--ink, #e8f2ec);
  border: 2px solid var(--card-line, #1f2b25);
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  overflow: hidden;
}
.page::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid var(--accent, #00ff99);
  border-radius: 12px;
  pointer-events: none;
}
.front {
  z-index: 2;
  transform-origin: left center;
  transition: transform 1.1s ease;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px;
}
.book.is-open .front { transform: rotateY(-155deg); }
.inside {
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 28px;
  text-align: center;
}
.front-art {
  width: 72%;
  max-height: 290px;
  animation: bob 3s ease-in-out infinite;
}
.book.is-gentle .front-art { animation: none; }
.front-label {
  margin-top: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent, #00ff99);
}
.front-to, .inside-to, .inside-from { margin-top: 10px; }
.inside-phrase {
  font-style: italic;
  font-size: 1.15rem;
  opacity: 0;
  transform: translateY(8px);
}
.book.is-open .inside-phrase { animation: reveal 0.8s ease forwards 0.35s; }
.inside-msg { margin-top: 14px; opacity: 0; }
.book.is-open .inside-msg { animation: reveal 0.8s ease forwards 0.7s; }
.inside-from { opacity: 0; }
.book.is-open .inside-from { animation: reveal 0.8s ease forwards 1s; }
#inside-photo {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 14px;
  border: 2px solid var(--accent, #00ff99);
  opacity: 0;
}
.book.is-open #inside-photo { animation: reveal 0.8s ease forwards 1.1s; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes reveal {
  to { opacity: 1; transform: none; }
}
.stage-actions { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }

/* Controls */
.panel {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.panel h2 { margin: 0 0 10px; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cyan); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }
label { display: block; margin: 8px 0; color: var(--dim); font-size: 13px; }
input, select, textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}
textarea { min-height: 70px; resize: vertical; }
.hint { color: var(--dim); font-size: 12px; margin: 6px 0 0; }
.img-choices, .phrase-choices {
  display: grid;
  gap: 8px;
}
.img-choices {
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
}
.img-choice {
  padding: 6px;
  text-align: center;
  background: var(--bg2);
}
.img-choice .thumb { display: block; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 6px; background: #111; }
.img-choice .thumb svg { width: 100%; height: 100%; display: block; }
.img-choice .cap { display: block; font-size: 11px; color: var(--dim); margin-top: 4px; font-weight: 600; }
.img-choice.is-on { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.phrase-choices { grid-template-columns: 1fr; }
.phrase-choice {
  text-align: left;
  font-weight: 500;
  background: var(--bg2);
}
.phrase-choice.is-on { border-color: var(--green); color: var(--green); }
.export-row { display: flex; flex-wrap: wrap; gap: 8px; }

.help-list { max-width: 680px; }
.help-list ol { padding-left: 20px; color: var(--dim); }
.help-list b { color: var(--ink); }

#toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #04130c;
  color: var(--green);
  border: 1px solid var(--green);
  padding: 8px 16px;
  border-radius: 999px;
  z-index: 40;
}
#toast[hidden] { display: none !important; }

/* --- 3D card stage + Card style panel (card3d.js) --- */
.stage { max-width: none; height: auto; min-height: 260px; display: flex; justify-content: center; align-items: center; }
.stage .cm-book { flex: none; }
.sub-h { margin: 14px 0 8px; font-size: 13px; color: var(--cyan); letter-spacing: 0.06em; text-transform: uppercase; }
.sub-h small { color: var(--dim); text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
label.inline { display: flex; align-items: center; gap: 10px; }
label.inline input[type=color] { width: 48px; height: 32px; padding: 2px; }
.sticker-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.sticker-choice { padding: 5px; display: grid; place-items: center; }
.sticker-choice svg { width: 36px; height: 36px; }
.sticker-choice.is-on { border-color: var(--green); box-shadow: 0 0 0 1px var(--green), 0 0 12px rgba(0,255,153,.3); }
/* Wider preview column so the open two-page card stays readable. */
@media (min-width: 861px) {
  .editor { grid-template-columns: minmax(320px, 1.25fr) minmax(340px, 1fr); }
}
.stage { overflow: visible; }
@media (max-width: 860px) { .stage { overflow: hidden; } }

/* "Your photo" tile */
.img-photo .thumb { display: grid; place-items: center; background: repeating-linear-gradient(45deg, #101614 0 8px, #141c19 8px 16px); }
.img-photo .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-photo .plus { font-size: 34px; color: var(--green); font-weight: 300; }

.phrase-blank { font-style: italic; border-style: dashed; }
