/* GLOBALS */
:root {
  --white: rgb(238, 222, 197);
  --light-grey: rgb(190, 180, 165);
  --grey: rgb(113, 128, 150);
  --black: rgb(37, 39, 41);
  --red: rgb(155, 76, 50);

  --textCol: var(--black);
  --backgroundCol: var(--white);

  --globalCol: darkred;
  --strokeCol: darkslateblue;
  --radiusCol: chocolate;
  --serifCol: darkslategrey;
  --metricsCol: rebeccapurple;
}

*,
*::before,
*::after {
  font-family: "Courier Prime", monospace;
  font-weight: 400;
  font-style: normal;
  box-sizing: border-box;
  /* scrollbar-color: var(--textCol) transparent; */
  /* scrollbar-width: thin; */
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

/* Firefox */
/* * {
  scrollbar-width: thin;
  scrollbar-color: var(--textCol) transparent;
} */

/* Chrome, Edge, Safari */
::-webkit-scrollbar {
  width: 0.5rem;
  border-radius: 0.5rem;
}
::-webkit-scrollbar-track {
  background: transparent;
  margin: 0.5rem 0;
  border: 0.125rem solid var(--textCol);
}
::-webkit-scrollbar-thumb {
  background: var(--textCol);
}

/* STRUCTURE */
html,
body {
  height: 100%;
  margin: 0;
  font-size: 16px;
  overscroll-behavior: none;
}

body {
  padding: 3rem;
  padding-bottom: 1rem;
  background-color: var(--backgroundCol);
  color: var(--textCol);
}

main {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
}

p {
  margin: 0;
}

a {
  color: var(--textCol);
  font-weight: bold;
  text-decoration: none;
  transition: all 0.2s;
}

a:hover {
  color: var(--grey);
  font-style: italic;
}

i {
  font-style: italic;
}

b {
  font-weight: bold;
}

.title {
  height: 2rem;
  font-weight: bold;
  padding: 0.5rem 1rem;
  outline: 0.125rem solid var(--textCol);
  z-index: 10;
}

.info-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;

  height: 1rem;
  aspect-ratio: 1;
  margin-left: 0.5rem;

  font-size: 0.8rem;
  cursor: pointer;

  background-color: var(--textCol);
  color: var(--backgroundCol);
  border-radius: 50vh;
}

.info-box {
  top: 3rem;
  position: absolute;
  display: none;
  background-color: var(--backgroundCol);
  padding: 0.5rem;
  border: 0.125rem solid var(--textCol);
  border-radius: 0.5rem;
  height: fit-content;
  z-index: 100;
}

#generator {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 1rem;
  min-height: 0;
  > * {
    border: 0.125rem solid var(--textCol);
    border-radius: 0.5rem;
    overflow: hidden;
  }
}

/* HEADER */
#header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  margin-top: -2rem;
  flex-wrap: wrap-reverse;
  gap: 1rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 0;
}

#languages {
  display: flex;
  flex-direction: row;
  gap: 1rem;

  .language {
    padding: 0.25rem 1rem;
  }

  .selected {
    background-color: var(--textCol);
    color: var(--backgroundCol);
    font-weight: bold;
  }
}

/* FOOTER */
#copyright {
  margin: 0;
  font-size: 1rem;
  text-align: center;
}

/* FONT-CANVAS */
#font {
  flex: 1;
  min-height: 20%;
  overflow: hidden;
  padding: 0;
}

#container {
  height: calc(100% - 2rem);
  margin-right: -2rem;
  margin-left: 0.5rem;
  overflow-x: hidden;
  overflow-y: scroll;
  direction: rtl;
  z-index: 0;
}

#grid {
  max-width: 100% !important;
  padding: 1rem 2.5rem 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: baseline;
  direction: ltr;
}

canvas {
  display: block;
}

/* PARAMETERS */
#parameters {
  display: flex;
  flex-direction: column;
  width: 20rem;
  min-height: 0;
  padding: 0;
  z-index: 1;
}

#values {
  flex: 1;
  margin-right: 0.5rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: scroll;
  gap: 1rem;
  padding: 1rem;
}

/* INPUTS */
#font-name {
  font-size: 2rem;
}

#preview-text {
  font-size: 2rem;
  outline: none;
}

.inactive {
  opacity: 0.5;
  pointer-events: none;
}

.label {
  margin: 0;
  padding-left: 0.5rem;
}

/* BUTTONS */
button {
  background-color: transparent;
  border: 0.125rem solid var(--textCol);
  outline: 0rem solid var(--textCol);
  color: var(--textCol);
  border-radius: 50vh;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.1s ease-out;
}

button:hover {
  background-color: var(--textCol);
  outline: 0.125rem solid var(--textCol);
  color: var(--backgroundCol);
  font-weight: bold;
}

#export-btn:hover {
  background-color: var(--metricsCol);
  border: 0.125rem solid var(--metricsCol);
  outline: 0.25rem solid var(--metricsCol);
  color: var(--white);
}

#reset-btn:hover {
  background-color: var(--grey);
  border: 0.125rem solid var(--grey);
  outline: 0.25rem solid var(--grey);
  color: var(--white);
}

/* TEXT */
input[type="text"] {
  color: var(--textCol);
  background-color: transparent;
  border: 0.125rem solid var(--textCol);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
}

input[type="text"]:focus-visible {
  outline-style: none;
  font-style: italic;
}

input[type="text"]::placeholder {
  color: var(--light-grey);
}

/* CHECKBOXES */
input[type="checkbox"] {
  display: none;
}

.switch-wrapper {
  position: relative;
  display: flex;
  flex-direction: row;
  box-sizing: border-box;
  .switch {
    flex: 1;
  }

  .info-trigger {
    margin-top: 0.2rem;
  }
}

.switch-wrapper:not(:has(~ .switch-wrapper)) .info-box {
  top: initial;
  bottom: 2rem;
}

.switch {
  position: relative;
  padding-left: 2rem;
  padding-right: 0.5rem;
  height: 1.5rem;
  min-height: 1.5rem;
  overflow: hidden;
  align-content: center;
  border-radius: 50vh;
  color: var(--black);
  background-color: transparent;
  cursor: pointer;
  transition: all 0.4s;
}

.switch:has(input:checked) {
  color: var(--white);
  padding-left: 0.5rem;
  padding-right: 2rem;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-color: var(--light-grey);
  z-index: -2;
}

.switch span::before {
  content: "";
  position: absolute;
  width: 1.5rem;
  height: 1.5rem;
  top: 0;
  left: 0rem;
  background-color: var(--white);
  border: 0.25rem solid var(--globalCol);
  box-shadow: -25.75rem 0 0 25rem var(--globalCol);
  border-radius: 50vh;
  transition:
    all 0.2s,
    left 0.4s;
  z-index: -1;
}

input:hover + span::before {
  border: 0.125rem solid var(--globalCol);
}

input:checked + span::before {
  left: calc(100% - 1.5rem);
  background-color: var(--white);
  transition:
    all 0.2s,
    left 0.4s;
}

/* CHECKBOXES - VARIANTS */
.stroke {
  span::before {
    border: 0.25rem solid var(--strokeCol);
    box-shadow: -25.75rem 0 0 25rem var(--strokeCol);
  }

  input:hover + span::before {
    border: 0.125rem solid var(--strokeCol);
  }
}

.radius {
  span::before {
    border: 0.25rem solid var(--radiusCol);
    box-shadow: -25.75rem 0 0 25rem var(--radiusCol);
  }
  input:hover + span::before {
    border: 0.125rem solid var(--radiusCol);
  }
}

.serif {
  span::before {
    border: 0.25rem solid var(--serifCol);
    box-shadow: -25.75rem 0 0 25rem var(--serifCol);
  }
  input:hover + span::before {
    border: 0.125rem solid var(--serifCol);
  }
}

/* ============================================================
   RANGE-BOX
   ============================================================ */

.range-box {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  position: relative;
}

.range-box .info-trigger {
  position: absolute;
  top: -0.125rem;
  padding-top: 0.125rem;
}

.info-trigger:hover + .info-box {
  display: block;
}

.range-box:not(:has(~ .range-box)) .info-box {
  top: auto; /* 'auto' instead of 'initial' — wider support */
  bottom: 3.5rem;
}

.range {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 0.5rem;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

/* ============================================================
   RANGE-SLIDER
   ============================================================ */

input[type="range"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  cursor: pointer;
  border-radius: 50vh;
  /* overflow:hidden enables the box-shadow fill trick in WebKit;
     Firefox uses ::-moz-range-progress instead. */
  overflow: hidden;
  background: transparent; /* prevents a default UA background */
}

/* — WebKit track (Chrome, Edge ≥79, Safari) — */
input[type="range"]::-webkit-slider-runnable-track {
  height: 1.5rem;
  background-color: var(--light-grey);
  border-radius: 50vh;
}

/* — Firefox track — */
input[type="range"]::-moz-range-track {
  height: 1.5rem;
  background-color: var(--light-grey);
  border-radius: 50vh;
}

/* — WebKit thumb — */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 1.5rem;
  width: 1.5rem;
  background-color: var(--white);
  border-radius: 50vh;
  border: 0.25rem solid var(--globalCol);
  /* Giant negative box-shadow fakes a filled left track in WebKit */
  box-shadow: -25.5rem 0 0 25rem var(--globalCol);
  -webkit-transition: all 0.2s;
  transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  border: 0.125rem solid var(--globalCol);
}

input[type="range"]::-webkit-slider-thumb:active {
  border: 0.375rem solid var(--globalCol);
}

/* — Firefox thumb — */
input[type="range"]::-moz-range-thumb {
  background-color: var(--white);
  border-radius: 50vh;
  border: 0.25rem solid var(--globalCol);
  -moz-transition: all 0.2s;
  transition: all 0.2s;
  /* box-model: Firefox sizes the thumb from its border edge, so
     no extra correction needed here. */
}

input[type="range"]::-moz-range-thumb:hover {
  border-width: 0.125rem;
}

input[type="range"]::-moz-range-thumb:active {
  border-width: 0.375rem;
}

/* — Firefox filled progress track — */
input[type="range"]::-moz-range-progress {
  height: 1.5rem;
  background-color: var(--globalCol);
  border-radius: 50vh;
}

/* ============================================================
   RANGE-SLIDER
   ============================================================ */

/* stroke */
.stroke input[type="range"]::-webkit-slider-thumb {
  border-color: var(--strokeCol);
  box-shadow: -25.5rem 0 0 25rem var(--strokeCol);
}
.stroke input[type="range"]::-moz-range-thumb {
  border-color: var(--strokeCol);
}
.stroke input[type="range"]::-moz-range-progress {
  background-color: var(--strokeCol);
}

/* radius */
.radius input[type="range"]::-webkit-slider-thumb {
  border-color: var(--radiusCol);
  box-shadow: -25.5rem 0 0 25rem var(--radiusCol);
}
.radius input[type="range"]::-moz-range-thumb {
  border-color: var(--radiusCol);
}
.radius input[type="range"]::-moz-range-progress {
  background-color: var(--radiusCol);
}

/* serif */
.serif input[type="range"]::-webkit-slider-thumb {
  border-color: var(--serifCol);
  box-shadow: -25.5rem 0 0 25rem var(--serifCol);
}
.serif input[type="range"]::-moz-range-thumb {
  border-color: var(--serifCol);
}
.serif input[type="range"]::-moz-range-progress {
  background-color: var(--serifCol);
}

/* metrics */
.metrics input[type="range"]::-webkit-slider-thumb {
  border-color: var(--metricsCol);
  box-shadow: -25.5rem 0 0 25rem var(--metricsCol);
}
.metrics input[type="range"]::-moz-range-thumb {
  border-color: var(--metricsCol);
}
.metrics input[type="range"]::-moz-range-progress {
  background-color: var(--metricsCol);
}

/* ============================================================
   NUMERICAL INPUT
   ============================================================ */

input[type="number"] {
  text-align: right;
  width: 5rem;
  color: var(--textCol);
  background-color: transparent;
  border: 0.125rem solid var(--textCol);
  border-radius: 50vh;
  font-size: 1rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  height: 1.5rem;
  /* Normalise box-sizing so height is predictable across browsers */
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  /* Hide spin buttons — Firefox */
  -moz-appearance: textfield;
}

input[type="number"]:focus-visible {
  outline: none;
  font-style: italic;
}

/* Hide spin buttons — WebKit */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0; /* Safari sometimes adds margin */
}

/* INSTRUCTIONS */
#instructions {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0.125rem solid var(--textCol);
  border-radius: 0.5rem;
  overflow: hidden;
}

#instructions-label {
  cursor: pointer;
}

#instructions-label::after {
  display: inline-block;
  margin-left: 0.5rem;
  height: 1rem;
  aspect-ratio: 1;

  content: "+";
  text-align: center;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;

  background-color: var(--textCol);
  color: var(--backgroundCol);
  border-radius: 50vh;

  transform-origin: center;
  transition: all 0.4s;
}

#instructions-trigger:checked ~ #instructions-label:hover::after {
  transform: rotate(45deg) scale(1.25);
}

#instructions-trigger:checked ~ #instructions-label::after {
  transform: rotate(45deg);
}

#instructions-trigger:not(:checked) ~ #instructions-label:hover::after {
  transform: scale(1.25);
}

#instructions-label:hover {
  font-style: italic;
}

#instructions-text {
  max-height: 0rem;
  margin: 0 1rem;
  padding: 0 0.5rem;
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  overflow-y: scroll;
  transition: all 0.4s ease-in-out;
}

#instructions-trigger:checked ~ #instructions-text {
  margin-top: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 1rem;
  max-height: 5rem;
  opacity: 1;
}

/* FOR ALL VARIANTS */
#values > .stroke:not(.stroke ~ *) {
  margin-top: 2rem;
}

#values > .stroke:not(:has(~ .stroke)) {
  margin-bottom: 2rem;
}

#values > .radius:not(:has(~ .radius)) {
  margin-bottom: 2rem;
}

#values > .serif:not(:has(~ .serif)) {
  margin-bottom: 2rem;
}

#values > .metrics:not(:has(~ .metrics)) {
  margin-bottom: 2rem;
}

/* ERROR */

.errors {
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding-bottom: 2rem;
}

.error {
  align-items: center;
  justify-self: center;
  text-align: center;
  line-height: 2rem;
}

/* RESPONSIVE DESIGN */

/* Vertical screen-ratios */
@media (orientation: portrait) {
  #generator {
    flex-direction: column;
  }
  /* #container {
    height:;
  } */
  #font {
    margin-left: 0;
  }
  #parameters {
    width: 100%;
    max-height: 30%;
  }

  /* Extra small devices (phones, 600px and down) */
  @media only screen and (max-width: 600px) {
    html,
    body {
      font-size: 14px;
    }
  }

  /* Small devices (portrait tablets and large phones, 600px and up) */
  @media only screen and (min-width: 600px) {
    html,
    body {
      font-size: 15px;
    }
  }

  /* Medium devices (landscape tablets, 768px and up) */
  @media only screen and (min-width: 768px) {
    html,
    body {
      font-size: 16px;
    }
  }
}

/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {
  html,
  body {
    font-size: 12px;
  }
}

/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {
  html,
  body {
    font-size: 13px;
  }
}

/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {
  html,
  body {
    font-size: 14px;
  }
}

/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {
  html,
  body {
    font-size: 15px;
  }
}

/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {
  html,
  body {
    font-size: 16px;
  }
}

/* CONTACT INFORMATIONS */

.contact {
  display: none;
}

/* © 2026 NICOLAS SCHOFFERS – TYPOIESIS */
