/* ============================================================
   wtfont.eu — design tokens
   Paleta "inkwell": ciemna obudowa narzędzia + biały "papier"
   pod właściwym rysowaniem. Fraunces (display) + Inter (body)
   + JetBrains Mono (dane / etykiety techniczne).
   ============================================================ */
:root{
  --ink-950: #0d0d14;
  --ink-900: #12121a;
  --ink-800: #1b1b28;
  --ink-700: #262636;
  --ink-600: #34344a;
  --ink-line: #33334a;
  --paper: #fcfaf4;
  --paper-line: #ddd6c4;
  --text-hi: #f2efe8;
  --text-mid: #b8b6c6;
  --text-low: #7c7a91;
  --wax: #c1442d;
  --wax-hi: #e05a3f;
  --gold: #d4a73c;
  --ok: #4caf82;

  --font-display: "Fraunces", "Iowan Old Style", serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow-soft: 0 20px 60px -20px rgba(0,0,0,.55);
}

*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  background: var(--ink-900);
  color: var(--text-hi);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg{ display:block; max-width:100%; }
a{ color: inherit; }
h1,h2,h3{ font-family: var(--font-display); font-weight: 600; margin: 0; }
p{ margin: 0; }
button, input, textarea{ font-family: inherit; color: inherit; }

.grain{
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- layout shell ---------- */
.topbar{
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(20px, 5vw, 56px);
  background: rgba(13,13,20,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ink-line);
}
.brand{ display:flex; align-items:center; gap:8px; text-decoration:none; font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--text-hi); }
.brand__nib{ width:18px; height:18px; stroke: var(--wax); stroke-width: 1.6; fill: none; }
.brand__dot{ color: var(--gold); }
.topbar__nav{ display:flex; align-items:center; gap: 24px; font-size: 14px; }
.topbar__nav a{ text-decoration:none; color: var(--text-mid); transition: color .15s; }
.topbar__nav a:hover{ color: var(--text-hi); }
.topbar__cta{
  background: var(--wax); color: #fff !important; padding: 8px 16px; border-radius: 999px;
  font-weight: 600;
}
.topbar__cta:hover{ background: var(--wax-hi); }

main{ position: relative; z-index: 2; }

/* ---------- hero ---------- */
.hero{
  position: relative;
  padding: clamp(64px, 12vh, 128px) clamp(20px, 6vw, 64px) 96px;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}
.hero__ink{ position:absolute; inset: -20px 0 auto 0; height: 320px; opacity:.5; z-index:-1; }
.hero__signature path{
  fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round;
  stroke-dasharray: 1400; stroke-dashoffset: 1400;
  animation: draw-sig 2.6s ease-out .3s forwards;
}
@keyframes draw-sig{ to{ stroke-dashoffset: 0; } }
.hero__eyebrow{
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 18px;
}
.hero__title{
  font-size: clamp(40px, 7vw, 72px); letter-spacing: -.01em; color: var(--text-hi);
}
.hero__lead{
  display:block; max-width: 560px; margin: 22px auto 0; color: var(--text-mid); font-size: 17px;
}
.hero__actions{ display:flex; gap:14px; justify-content:center; margin-top: 32px; flex-wrap: wrap; }
.hero__facts{
  list-style:none; display:flex; gap: 40px; justify-content:center; margin: 56px 0 0; padding:0;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-low);
}
.hero__facts span{ display:block; font-family: var(--font-display); font-size: 26px; color: var(--text-hi); margin-bottom:4px; }

/* buttons */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border-radius: 999px; padding: 13px 26px; font-size: 15px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; text-decoration:none;
  transition: transform .12s ease, background .15s, border-color .15s, opacity .15s;
}
.btn:active{ transform: translateY(1px); }
.btn--primary{ background: var(--wax); color:#fff; }
.btn--primary:hover{ background: var(--wax-hi); }
.btn--ghost{ background: transparent; border-color: var(--ink-line); color: var(--text-hi); }
.btn--ghost:hover{ border-color: var(--gold); color: var(--gold); }
.btn--sm{ padding: 9px 16px; font-size: 13px; }
.btn--icon{ background: var(--ink-800); border: 1px solid var(--ink-line); color: var(--text-mid); padding: 8px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn--icon:hover{ color: var(--text-hi); border-color: var(--gold); }
.btn--icon--active{ color: var(--gold); border-color: var(--gold); }
.btn--danger{ background: transparent; border-color:#8a3232; color:#e0908f; }
.btn--danger:hover{ background:#3a1a1a; border-color:#c94f4f; color:#ffb3b0; }

/* ---------- how it works ---------- */
.how{ padding: 40px clamp(20px, 6vw, 64px) 100px; max-width: 1080px; margin: 0 auto; }
.section-title{ font-size: clamp(26px, 3.4vw, 34px); text-align:center; margin-bottom: 44px; color: var(--text-hi); }
.how__grid{ display:grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.how__step{
  background: var(--ink-800); border: 1px solid var(--ink-line); border-radius: var(--radius);
  padding: 28px; color: var(--text-mid); font-size: 14.5px;
}
.how__mark{
  display:block; font-family: var(--font-display); font-style: italic; font-size: 22px;
  color: var(--gold); margin-bottom: 12px;
}

/* ---------- studio (app) ---------- */
.studio{
  background: var(--ink-950);
  border-top: 1px solid var(--ink-line);
  padding: 48px clamp(16px, 4vw, 48px) 96px;
}
.studio__header{
  max-width: 1240px; margin: 0 auto 24px;
  display:flex; align-items:flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.studio__title-group{ display:flex; align-items:flex-end; gap: 28px; flex-wrap: wrap; }
.studio__field{ display:flex; flex-direction:column; gap:6px; font-size: 12px; color: var(--text-low); font-family: var(--font-mono); text-transform: uppercase; letter-spacing:.06em; }
.studio__field input[type="text"], .studio__field textarea{
  background: var(--ink-800); border: 1px solid var(--ink-line); border-radius: var(--radius-sm);
  padding: 10px 12px; font-family: var(--font-body); font-size: 15px; color: var(--text-hi); text-transform:none; letter-spacing: normal;
}
.studio__field input:focus, .studio__field textarea:focus, input:focus-visible, button:focus-visible, .glyphgrid__btn:focus-visible{
  outline: 2px solid var(--gold); outline-offset: 2px;
}
.studio__progress{ display:flex; align-items:center; gap:10px; }
.studio__progress-bar{ width: 160px; height: 6px; border-radius: 4px; background: var(--ink-700); overflow:hidden; }
.studio__progress-fill{ height:100%; width:0%; background: linear-gradient(90deg, var(--wax), var(--gold)); transition: width .25s; }
#progressLabel{ font-family: var(--font-mono); font-size: 12px; color: var(--text-low); white-space:nowrap; }
.studio__actions{ display:flex; gap: 10px; flex-wrap: wrap; }

.studio__body{
  max-width: 1240px; margin: 0 auto;
  display:grid; grid-template-columns: 220px minmax(0,1fr) 340px; gap: 22px;
  align-items: start;
}

/* glyph grid */
.glyphgrid{
  display:grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  background: var(--ink-800); border:1px solid var(--ink-line); border-radius: var(--radius);
  padding: 12px; max-height: 640px; overflow-y: auto;
}
.glyphgrid__btn{
  aspect-ratio: 1; display:flex; align-items:center; justify-content:center;
  background: var(--ink-700); border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 16px; cursor:pointer; color: var(--text-mid); position: relative;
}
.glyphgrid__btn:hover{ border-color: var(--ink-line); color: var(--text-hi); }
.glyphgrid__btn.is-active{ border-color: var(--gold); color: var(--text-hi); background: var(--ink-600); }
.glyphgrid__btn.is-done::after{
  content:""; position:absolute; bottom:4px; right:4px; width:5px; height:5px; border-radius:50%; background: var(--ok);
}
.glyphgrid__group-label{
  grid-column: 1 / -1; font-family: var(--font-mono); font-size: 10px; letter-spacing:.08em; text-transform:uppercase;
  color: var(--text-low); margin: 10px 2px 2px;
}

/* draw panel */
.drawpanel{
  background: var(--ink-800); border: 1px solid var(--ink-line); border-radius: var(--radius);
  padding: 18px; display:flex; flex-direction:column; gap: 14px;
}
.drawpanel__toolbar{ display:flex; align-items:center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.drawpanel__current{ font-size: 14px; color: var(--text-mid); }
.drawpanel__current strong{ font-family: var(--font-display); font-size: 20px; color: var(--text-hi); }
.drawpanel__tools{ display:flex; align-items:center; gap: 8px; flex-wrap: wrap; }
.tool{ display:flex; flex-direction:column; gap:2px; font-family: var(--font-mono); font-size: 10px; color: var(--text-low); text-transform: uppercase; }
.tool--block{ width: 100%; }
.tool input[type="range"]{ width: 110px; accent-color: var(--wax); }
.tool--block input[type="range"]{ width: 100%; }

.canvasWrap{ position: relative; align-self:center; }
#glyphCanvas{
  background: var(--paper); border-radius: 10px; box-shadow: var(--shadow-soft);
  touch-action: none; cursor: crosshair; display:block;
}
.canvasWrap__hint{
  position:absolute; bottom: 10px; left: 0; right: 0; text-align:center;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-low); pointer-events:none;
}
.canvasWrap.has-ink .canvasWrap__hint{ display:none; }

.drawpanel__nav{ display:flex; align-items:center; justify-content: space-between; }
.drawpanel__position{ font-family: var(--font-mono); font-size: 12px; color: var(--text-low); }

/* preview panel */
.previewpanel{
  background: var(--ink-800); border: 1px solid var(--ink-line); border-radius: var(--radius);
  padding: 18px; display:flex; flex-direction:column; gap: 12px;
}
.previewpanel textarea{ resize: vertical; }
#previewCanvas{ background: var(--paper); border-radius: 10px; width:100%; height:auto; }
.previewpanel__note{ font-family: var(--font-mono); font-size: 11px; color: var(--text-low); }

/* modal */
.modal{
  border:none; border-radius: var(--radius); padding:0; background: var(--ink-800); color: var(--text-hi);
  box-shadow: var(--shadow-soft); max-width: 420px; width: 92vw;
}
.modal::backdrop{ background: rgba(8,8,12,.65); backdrop-filter: blur(2px); }
.modal__box{ padding: 26px; display:flex; flex-direction:column; gap: 14px; margin:0; border:none; }
.modal__box h3{ font-size: 20px; }
.modal__actions{ display:flex; justify-content:flex-end; gap: 10px; margin-top: 6px; }
.codebox{
  font-family: var(--font-mono); font-size: 22px; letter-spacing: .12em; text-align:center;
  background: var(--ink-900); border: 1px dashed var(--gold); border-radius: var(--radius-sm);
  padding: 14px; color: var(--gold);
}
.modal__box input[type="text"]{
  background: var(--ink-900); border: 1px solid var(--ink-line); border-radius: var(--radius-sm);
  padding: 10px 12px; font-family: var(--font-mono); font-size: 16px; letter-spacing: .1em; text-align:center;
  color: var(--text-hi); text-transform: uppercase;
}

.sitefooter{
  text-align:center; padding: 32px; color: var(--text-low); font-size: 13px;
  border-top: 1px solid var(--ink-line);
}

/* ---------- responsive ---------- */
@media (max-width: 980px){
  .studio__body{ grid-template-columns: 1fr; }
  .glyphgrid{ max-height: 220px; }
}
@media (max-width: 600px){
  .how__grid{ grid-template-columns: 1fr; }
  #glyphCanvas{ width: 100%; height: auto; aspect-ratio: 1; }
  .hero__facts{ gap: 20px; }
}

@media (prefers-reduced-motion: reduce){
  .hero__signature path{ animation: none; stroke-dashoffset: 0; }
  html{ scroll-behavior: auto; }
}
