/* ===========================
   @font-face Declarations
   Expecting .woff2 files in /fonts/
   =========================== */

@font-face { font-family: 'Dancing Script'; src: url('fonts/dancing-script-v29-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Caveat'; src: url('fonts/caveat-v23-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Pacifico'; src: url('fonts/pacifico-v23-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Shadows Into Light'; src: url('fonts/shadows-into-light-v22-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Sacramento'; src: url('fonts/sacramento-v17-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Great Vibes'; src: url('fonts/great-vibes-v21-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Alex Brush'; src: url('fonts/alex-brush-v23-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Petit Formal Script'; src: url('fonts/petit-formal-script-v19-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Rochester'; src: url('fonts/rochester-v24-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Allura'; src: url('fonts/allura-v23-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Handlee'; src: url('fonts/handlee-v20-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Kalam'; src: url('fonts/kalam-v18-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Mr De Haviland'; src: url('fonts/mr-de-haviland-v15-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Pinyon Script'; src: url('fonts/pinyon-script-v24-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Parisienne'; src: url('fonts/parisienne-v14-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Marck Script'; src: url('fonts/marck-script-v22-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Bad Script'; src: url('fonts/bad-script-v18-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Herr Von Muellerhoff'; src: url('fonts/herr-von-muellerhoff-v23-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Mrs Saint Delafield'; src: url('fonts/mrs-saint-delafield-v14-latin-regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Satisfy'; src: url('fonts/satisfy-v22-latin-regular.woff2') format('woff2'); font-display: swap; }


/* ===========================
   Reset & Base
   =========================== */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #0f0f1a;
  color: #e0e0e8;
  min-height: 100vh;
  line-height: 1.6;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}


/* ===========================
   App Layout (Two-Column)
   =========================== */

.app {
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: 100vh;
}


/* ===========================
   Sidebar
   =========================== */

.sidebar {
  background: #16162a;
  border-right: 1px solid rgba(255,255,255,.06);
  padding: 2rem 1.5rem;
  overflow-y: auto;
  max-height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
  margin-bottom: .35rem;
}

.subtitle {
  font-size: .85rem;
  color: #8888a4;
  line-height: 1.5;
}


/* Input */

.input-group {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.input-group label {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #9999b3;
}

.input-group input {
  padding: .75rem 1rem;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  background: #1e1e38;
  color: #fff;
  font-size: 1rem;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.input-group input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.25);
}

.input-group input::placeholder {
  color: #5e5e7e;
}


/* Font List */

.font-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  flex: 1;
  overflow-y: auto;
  padding-right: .25rem;
}

.font-list::-webkit-scrollbar {
  width: 5px;
}

.font-list::-webkit-scrollbar-track {
  background: transparent;
}

.font-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.1);
  border-radius: 10px;
}

.font-card {
  padding: 0.6rem 1rem 0.75rem;
  background: #1e1e38;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s ease;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  overflow: visible;
}

.font-card:hover {
  background: #262650;
  border-color: rgba(99,102,241,.3);
  transform: translateY(-1px);
}

.font-card.active {
  background: linear-gradient(135deg, #2d2d60, #1e1e50);
  border-color: #6366f1;
  box-shadow: 0 0 12px rgba(99,102,241,.2);
}

.font-card-label {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #7777a0;
}

.font-card-preview {
  font-size: 1.4rem;
  color: #e8e8f0;
  white-space: nowrap;
  overflow: visible;
  text-overflow: ellipsis;
  line-height: 2;
  padding: 0.15rem 0;
}


/* ===========================
   Main Area
   =========================== */

.main {
  padding: 2.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  justify-content: center;
  min-height: 100vh;
}


/* Preview */

.preview-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}

.canvas-wrapper {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow:
    0 4px 24px rgba(0,0,0,.35),
    0 0 0 1px rgba(255,255,255,.04);
  width: 100%;
  max-width: 720px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  overflow: hidden;
}

#signatureCanvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.active-font-label {
  font-size: .8rem;
  color: #7777a0;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}


/* Controls */

.controls-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  background: #16162a;
  padding: 1.5rem 2rem;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.06);
}

.control-row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.control-group {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.control-group label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #9999b3;
}

.slider-with-value {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.slider-value {
  font-size: .8rem;
  font-weight: 600;
  color: #6366f1;
  min-width: 40px;
  text-align: right;
}


/* Range slider styling */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: #2a2a50;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #6366f1;
  border: 3px solid #0f0f1a;
  box-shadow: 0 0 6px rgba(99,102,241,.5);
  cursor: pointer;
  transition: transform .15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #6366f1;
  border: 3px solid #0f0f1a;
  box-shadow: 0 0 6px rgba(99,102,241,.5);
  cursor: pointer;
}


/* Color options */

.color-options {
  display: flex;
  gap: .6rem;
  align-items: center;
}

.color-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: var(--btn-color);
  cursor: pointer;
  transition: all .2s;
  position: relative;
}

.color-btn:hover {
  transform: scale(1.12);
}

.color-btn.active {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.3);
}


/* Download */

.download-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.trim-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .85rem;
  color: #9999b3;
  user-select: none;
}

.trim-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #6366f1;
  cursor: pointer;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  padding: 1rem 2.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all .25s;
  box-shadow: 0 4px 20px rgba(99,102,241,.35);
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99,102,241,.45);
}

.download-btn:active {
  transform: translateY(0);
}

.download-btn svg {
  flex-shrink: 0;
}


/* Footer */

.app-footer {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.06);
}

.app-footer p {
  font-size: .75rem;
  color: #5e5e7e;
}


/* ===========================
   Responsive – Mobile
   =========================== */

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,.06);
  }

  .font-list {
    flex-direction: row;
    flex-wrap: wrap;
    overflow-y: visible;
    overflow-x: auto;
  }

  .font-card {
    min-width: 180px;
    flex: 0 0 auto;
  }

  .main {
    padding: 1.5rem;
    min-height: auto;
  }

  .controls-section {
    padding: 1.25rem;
  }
}

@media (max-width: 500px) {
  .sidebar {
    padding: 1.25rem 1rem;
  }

  .sidebar-header h1 {
    font-size: 1.15rem;
  }

  .font-list {
    flex-direction: column;
  }

  .font-card {
    min-width: 100%;
  }

  .main {
    padding: 1rem;
  }

  .canvas-wrapper {
    padding: 1rem;
    border-radius: 12px;
  }

  .download-btn {
    width: 100%;
    justify-content: center;
    padding: .9rem 1.5rem;
  }

  .control-row {
    flex-direction: column;
    gap: 1rem;
  }

  .controls-section {
    padding: 1rem;
  }
}
