/* Visual style follows kojilaunch.com (KoJi Academy): ink, orange, gold and cream with DM Sans. */
/* DM Sans (SIL OFL), bundled so the app also works offline. */
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 100 1000;
  src: url(../vendor/fonts/dm-sans-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 100 1000;
  src: url(../vendor/fonts/dm-sans-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  --ink: #081c25;
  --ink-deep: #07131c;
  --ink-soft: #263943;
  --orange: #f05216;
  --orange-hover: #d63b06;
  --gold: #f1b449;
  --cream: #faf8f1;
  --cream-deep: #f7f4ec;
  --card: #fcfaf4;
  --card-line: #e9e4d9;
  --muted: #4a5053;
  --on-ink: #c9d4d8;

  --bg: var(--cream);
  --panel: var(--card);
  --line: var(--card-line);
  --accent: var(--orange);
  --stage: var(--ink);
  --ok: #2f7d4f;
  --warn: #b5650c;
  --err: #c2321a;
  --radius: 12px;
  --sans: 'DM Sans', Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* Subtle paper grain, as on the site */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .025; z-index: 30;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 150 150' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23000' filter='url(%23n)' opacity='.5' d='M0 0h150v150H0z'/%3E%3C/svg%3E");
}

h1, h2, h3 { letter-spacing: -.04em; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--orange); outline-offset: 2px;
}

/* ---------- Header ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 66px;
  padding: 10px 24px;
  background: var(--ink-deep);
  color: #fff;
  border-bottom: 1px solid #ffffff20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { margin: 0; font-size: 24px; line-height: 1; font-weight: 800; letter-spacing: -.055em; }
.brand p {
  margin: 5px 0 0; color: var(--on-ink); font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .2em;
}
.brand-mark { position: relative; width: 34px; height: 32px; flex: none; }
.brand-mark::before {
  content: ''; position: absolute; left: 9px; top: 0; width: 25px; height: 30px;
  background: var(--orange); border-radius: 0 50% 50% 0;
}
.brand-mark::after {
  content: ''; position: absolute; left: 0; bottom: 0; width: 11px; height: 27px;
  background: #f9f5ec; border-radius: 0 8px 0 0;
}

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 99px; background: #ffffff10; border: 1px solid #ffffff1f; }
.tab {
  border: 0; background: transparent; color: var(--on-ink);
  padding: 8px 18px; border-radius: 99px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: color .2s, background .2s;
}
.tab:hover { color: #ff8247; }
.tab.active { background: linear-gradient(110deg, #fc601c, #e7450c); color: #fff; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 370px 1fr;
  height: calc(100vh - 66px);
}
.panel { overflow-y: auto; padding: 16px; border-right: 1px solid var(--line); background: var(--cream-deep); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 5px #1c211805;
  padding: 16px 18px 12px;
  margin-bottom: 12px;
}
.card h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 10.5px; margin: 0 0 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .2em; color: var(--ink);
}
.card h2::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex: none; }

label { display: block; margin-bottom: 10px; font-weight: 600; font-size: 13px; letter-spacing: -.01em; }
label.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 400; color: var(--muted); }
label.check input { margin-top: 2px; accent-color: var(--orange); width: 15px; height: 15px; flex: none; }
label.small { font-size: 12.5px; margin: 0; }

input[type=text], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: 5px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); font: inherit; font-weight: 400;
  transition: border-color .2s;
}
input[type=text]:hover, input[type=number]:hover, select:hover, textarea:hover { border-color: #d6cdbc; }
input[type=color] {
  display: block; width: 100%; height: 38px; margin-top: 5px; padding: 3px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
input[type=file] { display: block; margin-top: 6px; font-size: 12.5px; max-width: 100%; font-weight: 400; }
input[type=file]::file-selector-button {
  margin-right: 10px; padding: 6px 14px; border-radius: 99px; border: 1px solid var(--ink);
  background: transparent; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer;
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 10px; }
.opts:empty::after { content: "This template has no options."; color: var(--muted); font-size: 12.5px; }

/* ---------- Buttons ---------- */
button { font: inherit; cursor: pointer; }
.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 46px; padding: 11px 26px;
  border: 1px solid #ff8e51; border-radius: 99px;
  background: linear-gradient(110deg, #fc601c, #e7450c); color: #fff;
  font-size: 13px; font-weight: 700;
  transition: transform .2s, box-shadow .2s;
}
.primary::after { content: '→'; font-size: 19px; font-weight: 400; line-height: 1; }
.primary:hover { transform: translateY(-2px); box-shadow: 0 5px 15px #d8551930; }
.primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
textarea { resize: vertical; font-size: 12px; line-height: 1.45; }
.secondary {
  margin-top: 7px; border: 1px solid var(--ink); border-radius: 99px; padding: 7px 16px;
  background: transparent; color: var(--ink); font-weight: 700; font-size: 12px;
  transition: background .2s;
}
.secondary:hover { background: #f6e8d6; }
.link {
  display: block; border: 0; background: none; color: var(--orange); padding: 0; margin: 6px 0 0;
  font-size: 12.5px; font-weight: 600;
}
.link:hover { color: var(--orange-hover); }

/* ---------- Preview ---------- */
.preview { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.toolbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--cream);
}
.nav { display: flex; align-items: center; gap: 10px; }
.nav button {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--ink);
  background: transparent; color: var(--ink); font-size: 20px; line-height: 1;
  transition: background .2s, color .2s, border-color .2s;
}
.nav button:hover { background: var(--orange); border-color: var(--orange); color: #fff; }
.nav span { min-width: 120px; text-align: center; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.actions { margin-left: auto; display: flex; gap: 8px; }

.messages { list-style: none; margin: 0; padding: 10px 20px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.messages li {
  font-size: 11.5px; font-weight: 600; padding: 4px 11px; border-radius: 6px;
  border: 1px solid currentColor; background: #fffdf7;
}
.messages .ok { color: var(--ok); }
.messages .info { color: var(--ink); border-color: var(--gold); background: #fdf3df; }
.messages .warn { color: var(--warn); }
.messages .error { color: var(--err); }

.stage {
  position: relative; overflow: auto; isolation: isolate;
  flex: 1; min-height: 0;
  display: grid; place-items: center;
  padding: 24px; margin: 12px 20px 18px;
  background: var(--stage); border-radius: var(--radius);
}
/* Brand accents behind the pages: orange and gold half-circle, as in the site footer */
.stage::before {
  content: ''; position: sticky; z-index: -1; align-self: end; justify-self: end; grid-area: 1 / 1;
  width: 170px; height: 170px; margin: 0 -60px -100px 0; border-radius: 50%;
  background: linear-gradient(90deg, var(--orange) 50%, var(--gold) 50%); opacity: .9;
}
#canvas { grid-area: 1 / 1; box-shadow: 0 18px 40px #0006; background: #fff; max-width: 100%; height: auto; border-radius: 2px; }

.progress { display: flex; align-items: center; gap: 12px; padding: 0 20px 16px; font-size: 12.5px; font-weight: 600; }
.bar { flex: 1; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--orange), var(--gold)); transition: width .15s; }

.dims { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.dims dt { color: var(--muted); }
.dims dd { margin: 0; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

.prose { line-height: 1.6; color: var(--muted); }
.prose b, .prose i { color: var(--ink); }
.prose h3 { font-size: 17px; margin: 18px 0 8px; color: var(--ink); font-weight: 700; }
.prose ol, .prose ul { padding-left: 0; margin: 0; list-style: none; counter-reset: step; }
.prose li { position: relative; margin-bottom: 9px; padding-left: 22px; }
.prose ul li::before {
  content: ''; position: absolute; left: 2px; top: .55em; width: 8px; height: 8px; border-radius: 50%; background: var(--orange);
}
.prose ol li { padding-left: 32px; counter-increment: step; }
.prose ol li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 11px; font-weight: 700;
}

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .stage { min-height: 70vh; margin-inline: 16px; }
  .toolbar { padding-inline: 16px; }
  .topbar { padding-inline: 16px; }
  .actions { margin-left: 0; width: 100%; }
  .actions .primary { flex: 1; }
}

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