@font-face {
  font-family: "Magic Hand";
  src: url("./assets/KCMagicHand.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Shadofax";
  src: url("./assets/KCShadofax.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  /* "Brand" Colors */
  --nam-header: #ed4250;
  --terra: #884c21;
  --dead-cactus: #052400;
  --nam-og: #1c1d20;
  --sunny: #ffae13;
  --purp: #7d388e;
  --floor: #e0e0e0;
  --esoteric-sage: #8aaa6fcc;
  --color-border: #333;
  --color-text-dim: #999;
  --color-primary-hover: #00b8e6;
  --color-success: #00ff88;

  /* Spacing */
  --border-radius: 6px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 20px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Magic Hand", sans-serif !important;
  background-color: rgb(255, 252, 228);
  color: var(--floor);
  line-height: 1.6;
  min-height: 100vh;
  opacity: 1;
  background-position:
    4px 0,
    4px 0,
    0 0,
    0 0;
  background-size: 4px 4px;
  background-repeat: repeat;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--spacing-md);
}

main {
  padding: 0;
}

h1 {
  font-family: "Magic Hand", sans-serif !important;
  font-size: 8em;
  color: var(--nam-header);
  transform: skew(-4deg, -1deg);
  text-shadow: 5px 5px 0px var(--purp);
  margin-bottom: var(--spacing-sm);

  span {
    text-decoration: 30px dotted var(--sunny) underline;
    background: var(--esoteric-sage) text;
  }
}

h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-sm);
  color: var(--dead-cactus);
  font-size: 2rem;
  font-weight: 600;

  .toggle-switch {
    margin-left: auto;
  }
}

h3 {
  margin: var(--spacing-md) 0 var(--spacing-sm) 0;
  color: var(--dead-cactus);
  font-size: 1.2em;
  font-weight: 600;
}

.subtitle {
  font-size: 1em;
  color: var(--color-text-dim);
  margin-bottom: var(--spacing-sm);
}

.small {
  font-size: 0.85em;
}

header {
  text-align: center;
  padding: var(--spacing-lg) 0;
  margin-bottom: var(--spacing-md);

  .sample-rate {
    font-size: 0.85em;
    color: var(--color-text-dim);
    margin-top: var(--spacing-sm);

    #sample-rate-text {
      color: var(--dead-cactus);
      font-weight: 600;
    }
  }
}

footer {
  text-align: center;
  padding: var(--spacing-md) 0;
  margin-top: var(--spacing-md);
  color: var(--color-text-dim);

  p {
    margin: 5px 0;
  }

  a {
    color: var(--nam-og);
    text-decoration: none;
    font-weight: 600;
    text-shadow: 3px 3px 0 var(--sunny);

    &:hover {
      text-decoration: underline;
    }
  }
}

.footertext {
  font-family: "Magic Hand", sans-serif !important;
  color: var(--nam-header);
  transform: skew(-4deg, 1deg);
  text-shadow: 3px 3px 0px var(--purp);
  font-size: 3rem;
}

section {
  background: #cc733e4f;
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  border-radius: var(--border-radius);
  box-shadow: 3px 3px 0 var(--purp);
}

.init-section {
  text-align: center;
}

button {
  padding: 12px 24px;
  margin: 5px;
  font-size: 1em;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;

  &:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
  }

  &:focus-visible {
    outline: 2px solid var(--dead-cactus);
    outline-offset: 2px;
  }
}

.btn-primary,
.btn-secondary {
  font-size: 3rem;

  &:hover {
    transform: translate(-3px, -3px);
    box-shadow: 3px 3px 0px var(--dead-cactus);
  }
}

.btn-primary {
  background: var(--sunny);
  color: var(--dead-cactus);
}

.btn-secondary {
  background: var(--nam-header);
  color: white;
}

.btn-large {
  padding: 16px 32px;
  font-size: 2.5rem;
}

.button-group {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
  margin-bottom: var(--spacing-md);
}

input[type="range"] {
  flex: 1;
  height: 8px;
  background: linear-gradient(
    90deg,
    var(--esoteric-sage) 0%,
    var(--terra) 100%
  );
  border-radius: 4px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;

  &:disabled {
    opacity: 0.4;
    cursor: not-allowed;

    &::-webkit-slider-thumb {
      cursor: not-allowed;
    }

    &::-moz-range-thumb {
      cursor: not-allowed;
    }
  }

  &:focus-visible {
    outline: 2px solid var(--dead-cactus);
    outline-offset: 2px;
  }

  /* Webkit (Chrome, Safari, Edge) */
  &::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--esoteric-sage);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0px 0px 15px var(--sunny);
  }

  /* Firefox */
  &::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--esoteric-sage);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0px 0px 15px var(--sunny);
  }
}

.slider-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.value-display {
  font-family: "Shadofax", sans-serif;
  min-width: 105px;
  text-align: right;
  color: var(--dead-cactus);
  font-size: 2rem;
}

select {
  width: 100%;
  padding: 10px;
  background: #1a1a1a;
  color: var(--sunny);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 1.5rem;
  font-family: inherit;
  cursor: pointer;

  &:hover:not(:disabled) {
    border-color: var(--dead-cactus);
  }

  &:focus {
    outline: none;
    border-color: var(--dead-cactus);
    box-shadow: 0 0 0 5px var(--esoteric-sage);
  }

  &:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }

  &:focus-visible {
    outline: 2px solid var(--dead-cactus);
    outline-offset: 2px;
  }
}

.file-input-wrapper {
  position: relative;
  margin-bottom: 10px;

  input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
    pointer-events: none;

    &:disabled {
      cursor: not-allowed;
    }
  }

  label {
    font-size: 2.5rem;
    display: block;
    padding: 16px;
    background: var(--sunny);
    color: var(--dead-cactus);
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;

    &:hover {
      background: var(--nam-header);
      color: white;
      transform: translate(-3px, -3px);
      box-shadow: 3px 3px 0px var(--dead-cactus);
    }
  }
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  cursor: pointer;
  vertical-align: middle;

  &:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }

  &:focus-visible + .toggle-slider {
    outline: 2px solid var(--dead-cactus);
    outline-offset: 2px;
  }

  /* Toggle Switch Styles */
  &:checked + .toggle-slider {
    background-color: var(--dead-cactus);

    &:before {
      background-color: var(--sunny);
      transform: translateX(24px);
    }
  }
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  margin-left: var(--spacing-md);
  vertical-align: middle;

  input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
  }
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #404040;
  border-radius: 26px;
  transition: 0.3s;
  min-width: 50px;

  &:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #666;
    border-radius: 50%;
    transition: 0.3s;
  }
}

input[type="checkbox"]:disabled + .toggle-slider {
  opacity: 0.4;
  cursor: not-allowed;
}

.info-display {
  background: #1a1a1a;
  padding: var(--spacing-sm);
  border-radius: 6px;
  min-height: 40px;
  border: 1px solid var(--color-border);

  p {
    margin: 5px 0;
    font-size: 1.5rem;
    color: var(--sunny);
  }
}

.model-info-content {
  p {
    margin: 8px 0;
  }

  strong {
    color: var(--dead-cactus);
  }
}

.info-text {
  color: var(--color-text-dim);
  font-size: 0.9em;
  margin-top: var(--spacing-sm);
}

.error {
  color: var(--nam-header);
}

.status {
  padding: var(--spacing-md);
  background: #1a1a1a;
  border-radius: 6px;
  text-align: center;
  border: 1px solid var(--color-border);

  strong {
    color: var(--dead-cactus);
  }

  #status-text {
    color: var(--floor);
    font-weight: 500;
  }
}

.control-group {
  margin-bottom: var(--spacing-md);

  label {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    font-size: 3rem;
    color: var(--nam-header);
    /* cursor: pointer; */
    text-shadow: 3px 3px 0 var(--dead-cactus);
    text-decoration: 4px dotted underline var(--nam-header);
    text-underline-offset: 5px;
  }
}

.info-section {
  p {
    margin-bottom: var(--spacing-md);
    line-height: 1.7;
  }

  ul {
    margin-left: var(--spacing-md);
    margin-top: var(--spacing-sm);
  }

  li {
    margin-bottom: 8px;
    line-height: 1.6;
  }
}

.features,
.limitations {
  margin-top: var(--spacing-md);
}

.record-section {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: var(--spacing-md);
  background: transparent;
  box-shadow: none;
  padding: var(--spacing-sm);
}

.btn-record {
  font-size: 3rem;
  background: var(--sunny);
  color: var(--dead-cactus);
  padding: 12px 32px;

  &:hover:not(:disabled) {
    transform: translate(-3px, -3px);
    box-shadow: 3px 3px 0px var(--dead-cactus);
  }

  &.recording {
    background: var(--nam-header);
    color: white;
    animation: pulse-record 1.5s ease-in-out infinite;
  }
}

.record-time {
  font-family: "Shadofax", sans-serif;
  font-size: 2rem;
  position: absolute;
  right: 0;
  color: var(--nam-header);
  min-width: 80px;
}

@keyframes pulse-record {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(237, 66, 80, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(237, 66, 80, 0);
  }
}

@media (max-width: 768px) {
  .container {
    padding: var(--spacing-sm);
  }

  h1 {
    font-size: 4rem;
    span {
      text-decoration: none;
    }
  }

  section {
    padding: var(--spacing-md);
  }

  .control-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;

    .slider-container {
      width: 100%;
      flex-direction: column;
      align-items: stretch;
    }
  }

  .button-group {
    flex-direction: column;

    button {
      width: 100%;
    }
  }

  .value-display {
    text-align: center;
  }
}

@media (max-width: 360px) {
  /* This is arbitrary and no I will not elaborate */
  body {
    background-color: #99f;
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Keyboard navigation focus indicators */
button:focus-visible,
input[type="range"]:focus-visible,
select:focus-visible {
  outline: 2px solid var(--dead-cactus);
  outline-offset: 2px;
}
