/* TUGLA minisite - one construction, font-only material. Repo language: English. */
@font-face {
  font-family: 'TuglaVAR';
  src: url('tugla-var.woff2') format('woff2');
  font-display: block;
}
:root {
  --p: 4px; /* shared fine plane unit */
  --fvs: "WDTH" 140, "HGHT" 140, "STRK" 20, "FILL" 0, "CLAU" 0, "SYNC" 0;
  --fvs-brick: "WDTH" 140, "HGHT" 140, "STRK" 20, "FILL" 1, "CLAU" 0, "SYNC" 0;
  /* functional UI chrome stays at the default instance at every axis setting:
     control legibility is not a variable (axes preview the font on display) */
  --fvs-ui: "WDTH" 140, "HGHT" 140, "STRK" 50, "FILL" 0, "CLAU" 0, "SYNC" 0;
  --fvs-ui-brick: "WDTH" 140, "HGHT" 140, "STRK" 50, "FILL" 1, "CLAU" 0, "SYNC" 0;
}
html[data-mode="chrome"] {
  --bg: #252525; --ink: #b5b5b5; --brick: #e0e0e0; --accent: #e0e0e0;
  --line: rgba(224,224,224,0.10); --marginline: rgba(224,224,224,0.30);
}
html[data-mode="siyah"] {
  --bg: #000000; --ink: #F2EBDD; --brick: #F2EBDD; --accent: #E85D28;
  --line: rgba(242,235,221,0.10); --marginline: rgba(242,235,221,0.32);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  background: var(--bg); color: var(--ink);
  font-family: 'TuglaVAR', monospace;
  font-variation-settings: var(--fvs);
  padding: calc(var(--p)*4) calc(var(--p)*6) calc(var(--p)*10);
  min-height: 100vh;
  overflow-x: hidden;
}
/* construction lines: the shared plane, from the page origin */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px calc(var(--p)*5)),
    repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px calc(var(--p)*5));
}
html.grid-off body::before { background-image: none; }
.area { position: relative; z-index: 1; margin-bottom: calc(var(--p)*6); }
.area > .inner { outline: 1px solid var(--marginline); outline-offset: calc(var(--p)*1); }
html.grid-off .area > .inner { outline-color: transparent; }
.marker {
  font-variation-settings: var(--fvs-ui);
  font-size: 14px; letter-spacing: 0;
  margin: 0 0 calc(var(--p)*3) 0; color: var(--ink);
}
/* header */
header .inner {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: calc(var(--p)*4); flex-wrap: wrap; padding: calc(var(--p)*2) calc(var(--p)*3);
}
.wordmark { font-variation-settings: var(--fvs-ui-brick); font-size: 28px; color: var(--brick); }
header .inner, .legend, .ctl { font-variation-settings: var(--fvs-ui); }
.header-right { display: flex; align-items: baseline; gap: calc(var(--p)*6); flex-wrap: wrap; font-size: 15px; }
.legend { color: var(--ink); }
.ctl { cursor: pointer; color: var(--ink); position: relative; }
.ctl .knobtail { color: var(--accent); font-variation-settings: var(--fvs-ui-brick); }
.ctl:hover { color: var(--brick); }
/* hero */
#hero { padding: calc(var(--p)*2) calc(var(--p)*3); }
#hero-svg { display: block; }
.hero-glyph-text { fill: var(--brick); font-family: 'TuglaVAR'; }
#hero-readouts { position: relative; margin-top: calc(var(--p)*2); }
.hero-readout { font-variation-settings: var(--fvs-ui); font-size: 11px; color: var(--ink); white-space: nowrap; position: absolute; left: 0; top: 0; }
.hero-readout.two-line .ro-a, .hero-readout.two-line .ro-b { display: block; }
/* editor */
.editor-cols { display: flex; gap: calc(var(--p)*8); align-items: flex-start; padding: calc(var(--p)*2) calc(var(--p)*3); }
.editor-left { flex: 1 1 auto; min-width: 0; }
#charsets { display: flex; flex-direction: column; gap: calc(var(--p)*2); margin-bottom: calc(var(--p)*6); }
.charset-row { display: flex; flex-wrap: wrap; }
.charset-cell {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: calc(var(--p)*7); min-height: calc(var(--p)*7);
  outline: 1px solid var(--line); cursor: pointer; font-size: 18px; color: var(--ink);
  position: relative;
}
html.grid-off .charset-cell { outline-color: transparent; }
.charset-cell.sel { color: var(--accent); font-variation-settings: var(--fvs-brick); outline-color: var(--marginline); }
#canvas-wrap { position: relative; display: inline-block; max-width: 100%; }
#glyph-svg text { font-family: 'TuglaVAR'; }
#glyph-svg .glyph-text { fill: var(--brick); }
#glyph-svg .glyph-label { fill: var(--ink); }
#glyph-svg .svgl.margin { fill: none; stroke: var(--marginline); stroke-width: 1.5; }
#glyph-svg .svgl.cell { stroke: var(--ink); stroke-width: 1.2; opacity: 0.5; }
#glyph-svg .svgl.base { stroke: var(--marginline); stroke-width: 1.2; stroke-dasharray: 6 5; }
#glyph-svg .svgl.edit-fill { fill: var(--accent); }
#glyph-svg .svgl.edit-hollow { fill: none; stroke: var(--accent); stroke-width: 3; }
html.grid-off #glyph-svg .svgl.margin, html.grid-off #glyph-svg .svgl.cell, html.grid-off #glyph-svg .svgl.base { stroke: transparent; }
.canvas-label { position: absolute; font-size: 12px; color: var(--ink); }
#canvas-readout { font-variation-settings: var(--fvs-ui); font-size: 13px; margin-top: calc(var(--p)*2); white-space: nowrap; }
#ink-note { font-variation-settings: var(--fvs-ui); font-size: 13px; margin-top: calc(var(--p)*1); color: var(--accent); white-space: nowrap; }
.preview-note { font-variation-settings: var(--fvs-ui); font-size: 13px; margin-top: calc(var(--p)*1); color: var(--accent); }
/* axes */
.axes-col { flex: 0 0 280px; font-variation-settings: var(--fvs-ui); }
#hiz-row { font-size: 15px; margin-bottom: calc(var(--p)*3); }
#hiz-row .axis-value { display: inline-block; min-width: 3ch; }
.axis { position: relative; font-size: 18px; height: calc(var(--p)*9); margin-bottom: calc(var(--p)*3); }
.axis-stem { position: absolute; left: 0; top: 0; color: var(--ink); }
.axis-knob {
  position: absolute; top: 0; color: var(--accent); cursor: ew-resize;
  font-variation-settings: var(--fvs-ui-brick); user-select: none; touch-action: none;
  padding: 0 calc(var(--p)*2); margin-left: calc(var(--p)*-2);
}
.axis-knob:focus-visible, .ctl:focus-visible, .charset-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.axis-value { position: absolute; right: 0; top: 0; color: var(--ink); text-align: right; }
.axis-state { position: absolute; right: 0; top: calc(var(--p)*5); font-size: 13px; color: var(--accent); }
.axis-state .fsc { color: var(--ink); cursor: pointer; padding: 0 calc(var(--p)*1); }
.axis-state .fsc.on { color: var(--accent); font-variation-settings: var(--fvs-ui-brick); }
.axis.animating .axis-knob { text-decoration: underline; text-decoration-color: var(--accent); }
/* specimen */
.spec-head { display: flex; justify-content: space-between; font-size: 18px; color: var(--ink); margin-bottom: calc(var(--p)*4); }
#specimen-text { font-size: 30px; line-height: 1.55; color: var(--brick); white-space: pre-wrap; overflow-wrap: break-word; }
#specimen-text[contenteditable="true"] { outline: 1px dashed var(--accent); }
/* editable */
[data-edit] { caret-color: var(--accent); }
[contenteditable="true"] { outline: 1px dashed var(--accent); }
#font-error {
  position: fixed; inset: auto 0 0 0; z-index: 9; padding: calc(var(--p)*3) calc(var(--p)*6);
  background: var(--bg); color: var(--accent); font-family: monospace; font-size: 14px;
  border-top: 1px solid var(--accent);
}
/* responsive: column counts change, the plane and alignment rule do not */
@media (max-width: 1100px) {
  .editor-cols { flex-direction: column; }
  .axes-col { flex: 1 1 auto; width: 100%; max-width: 420px; }
}
@media (max-width: 640px) {
  body { padding: calc(var(--p)*3) calc(var(--p)*4) calc(var(--p)*8); }
  #specimen-text { font-size: 22px; }
  .wordmark { font-size: 20px; }
  .header-right { font-size: 13px; gap: calc(var(--p)*4); }
}
