/* Fonts Config */

@supports (font-variation-settings: normal) {
  @font-face {
    font-family: "Inconsolata";
    src: url("fonts/Inconsolata-VariableFont_wdth,wght.ttf");
    font-weight: 1 1000;
    font-stretch: 50% 200%;
    font-style: normal;
  }
}

@supports not (font-variation-settings: normal) {
  @font-face {
    font-family: "Inconsolata";
    src: url("fonts/static/Inconsolata-Regular.ttf");
    font-weight: 400;
  }
  @font-face {
    font-family: "Inconsolata";
    src: url("fonts/static/Inconsolata-Medium.ttf");
    font-weight: 500;
  }
  @font-face {
    font-family: "Inconsolata";
    src: url("fonts/static/Inconsolata-Bold.ttf");
    font-weight: 700;
  }
  @font-face {
    font-family: "Inconsolata";
    src: url("fonts/static/Inconsolata-ExtraBold.ttf");
    font-weight: 800;
  }
}

/* Variables */

:root {
  --font-family: "Inconsolata";

  --orange-500: hsl(7, 88%, 67%);
  --orange-700: hsl(7, 71%, 60%);

  --neutral-0-num: 0, 0%, 100%;
  --neutral-0: hsl(var(--neutral-0-num));
  --neutral-300: hsl(252, 6%, 83%);
  --neutral-500: hsl(245, 15%, 58%);
  --neutral-700: hsl(245, 19%, 35%);
  --neutral-900: hsl(248, 70%, 10%);

  --gradient-text: linear-gradient(90deg, hsl(7, 86%, 67%), hsl(0, 0%, 100%));
}

/* Simple Reset */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family);
}

button {
  border: none;
  background: none;
}

/* Generator Style */

/* Background with patterns */
.background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("images/background-desktop.png") center/cover no-repeat;
  z-index: -1;
}

.background-patterns {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.pattern-circle {
  width: 200px;
  height: 200px;
  position: absolute;
  animation: float 6s ease-in-out infinite;
  background: url("images/pattern-circle.svg") center/contain no-repeat;
  &.left {
    top: -75px;
    left: 50px;
  }
  &.center {
    top: 50%;
    left: 65%;
  }
}

.pattern-lines {
  inset: 0;
  position: absolute;
  background: url("images/pattern-lines.svg") center/cover no-repeat;
}

.pattern-squiggly {
  position: absolute;
  background-size: contain;
  background-repeat: no-repeat;
  animation: float 8s ease-in-out infinite reverse;
  &.top {
    top: 6%;
    right: 0;
    width: 400px;
    height: 200px;
    background-image: url("images/pattern-squiggly-line-top.svg");
  }
  &.bottom {
    left: 0;
    width: 825px;
    bottom: -24px;
    height: 400px;
    background: url("images/pattern-squiggly-line-bottom-desktop.svg") no-repeat;
  }
}

/* Container */
.container {
  width: 850px;
  max-width: 100%;
  margin: 0 auto;
  padding-inline: 24px;
  position: relative;
}

/* Header */
.header {
  margin-top: 3.5rem;
  margin-bottom: 3em;
  text-align: center;
}

.hero {
  margin-top: 3rem;
}

.title {
  font-weight: 700;
  line-height: 1.2;
  font-size: 3.5rem;
  margin-bottom: 1rem;
  color: var(--neutral-0);
}

.subtitle {
  font-weight: 400;
  line-height: 1.5;
  font-size: 1.4rem;
  color: var(--neutral-300);
}

/* Initial Screen */

/* Form styles */
.form {
  max-width: 500px;
  margin-inline: auto;
  .form-hint {
    gap: 0.5rem;
    display: flex;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--neutral-500);
  }
  .hint-icon {
    opacity: 0.7;
  }
  .field-error {
    visibility: hidden;
    display: flex;
    column-gap: 10px;
    margin-top: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.875rem;
    padding-left: 0.25rem;
    color: var(--orange-500);
    animation: fadeIn 0.3s ease-out;
  }
  .error-message {
    visibility: hidden;
    display: flex;
    padding: 1rem;
    column-gap: 10px;
    margin-top: 1rem;
    text-align: center;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--orange-500);
    animation: slideDown 0.3s ease-out;
    border: 1px solid var(--orange-500);
    background: rgba(255, 68, 68, 0.1);
  }

  &.error {
    .form-group:has(.form-input:invalid, .file-input:invalid) {
      .form-label {
        color: var(--orange-700);
      }
      .form-hint {
        display: none;
      }
      .field-error {
        visibility: visible;
      }
      .form-input,
      upload-area {
        border-color: var(--orange-700);
      }
    }
    .submit-btn {
      outline: none;
      animation: shake 0.5s ease-in-out;
    }
    .error-message {
      visibility: visible;
      animation: slideDown 0.3s ease-out;
    }
  }
}

.form-label {
  display: block;
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 0.75rem;
  color: var(--neutral-0);
}

.form-input {
  width: 100%;
  padding: 1rem;
  font-weight: 400;
  font-size: 16px;
  border-radius: 12px;
  color: var(--neutral-0);
  caret-color: var(--neutral-0);
  border: 1px solid var(--neutral-500);
  transition: background-color 0.3s ease;
  background-color: hsl(var(--neutral-0-num), 10%);
  &:focus,
  &:has(.file-input:focus) {
    outline: 2px solid hsl(var(--neutral-0-num), 50%);
    background-color: hsl(var(--neutral-0-num), 10%) !important;
  }
  &:hover,
  &:has(.file-input:hover) {
    cursor: pointer;
    background-color: hsl(var(--neutral-0-num), 20%);
  }
}

.submit-btn {
  width: 100%;
  cursor: pointer;
  font-weight: 800;
  font-size: 1.4rem;
  padding: 1rem 2rem;
  position: relative;
  border-radius: 12px;
  color: var(--neutral-900);
  background-color: var(--orange-500);
  transition: background-color 0.3s ease;
  &:is(:hover, :focus-visible) {
    background-color: var(--orange-700);
  }
  &:focus {
    outline: 3px solid var(--neutral-900);
  }
  &:active {
    transform: translateY(1px);
  }
}

.upload-area {
  padding: 2rem;
  position: relative;
  text-align: center;
  border: 2px dashed var(--neutral-500);
  .file-input {
    inset: 0;
    opacity: 0;
    cursor: pointer;
    position: absolute;
  }
  .avatar-preview,
  .avatar-actions {
    display: none;
  }
  .upload-icon {
    width: 48px;
    height: 48px;
    padding: 12px;
    margin-bottom: 1rem;
    border-radius: 12px;
    border: 1px solid hsl(var(--neutral-0-num), 10%);
    background-color: hsl(var(--neutral-0-num), 10%);
  }
  .upload-text {
    font-size: 1rem;
    font-weight: 400;
    color: var(--neutral-500);
  }

  &.has-file {
    padding: 1rem;
    .upload-content,
    .file-input {
      display: none;
    }
    .avatar-preview,
    .avatar-actions {
      display: flex;
    }
  }
}
.avatar-preview {
  width: 60px;
  height: 60px;
  overflow: hidden;
  margin-inline: auto;
  border-radius: 16px;
  margin-bottom: 1rem;
  border: 3px solid hsl(var(--neutral-0-num), 20%);
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}
.avatar-actions {
  display: flex;
  column-gap: 0.5rem;
  margin-top: 0.5rem;
  justify-content: center;
  .avatar-btn {
    z-index: 9;
    cursor: pointer;
    position: relative;
    border-radius: 6px;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    color: var(--neutral-0);
    background-color: hsl(var(--neutral-0-num), 10%);
    &:is(:hover, :focus-visible) {
      outline: none;
      text-decoration: underline;
    }
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .background {
    background: url("images/background-tablet.png") center/cover no-repeat;
  }
  .title {
    font-size: 2rem;
  }
  .pattern-squiggly.top {
    width: 200px;
    height: 120px;
  }
  .pattern-squiggly.bottom {
    width: 250px;
    height: 100px;
    background: url("images/pattern-squiggly-line-bottom-mobile-tablet.svg")
      no-repeat;
  }
}
@media (max-width: 480px) {
  .background {
    background: url("images/background-mobile.png") center/cover no-repeat;
  }
  .title {
    font-size: 1.75rem;
  }
  .upload-area {
    padding: 1.5rem;
  }
}

/* Animations */
@keyframes float {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(2deg);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Success Screen */
.success-screen {
  .hero {
    margin-top: 5rem;
    margin-bottom: 8rem;
  }
  .success-title {
    font-weight: 700;
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--neutral-0);
  }
  .success-name {
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-image: var(--gradient-text);
  }
  .success-subtitle {
    font-size: 3.5rem;
    margin-bottom: 2rem;
    color: var(--neutral-0);
  }

  .success-message {
    width: 500px;
    margin: auto;
    line-height: 1.5;
    font-size: 1.5rem;
    margin-bottom: 3rem;
    color: var(--neutral-300);
  }
  .success-email {
    color: #ff6b6b;
    font-weight: 600;
  }
}

.digital-ticket {
  display: grid;
  width: 600px;
  height: 300px;
  padding: 2rem;
  max-width: 100%;
  overflow: hidden;
  position: relative;
  margin-inline: auto;
  background-size: contain;
  background-repeat: no-repeat;
  background-image: url("images/pattern-ticket.svg");
  .ticket-header {
    gap: 0.75rem;
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
  }
  .ticket-logo-text {
    font-weight: 600;
    font-size: 2.7rem;
    color: var(--neutral-0);
  }
  .ticket-details {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    margin-inline-start: 10%;
    color: var(--neutral-500);
  }
}

.ticket-attendee {
  display: flex;
  column-gap: 1rem;
  align-items: center;
  .ticket-avatar {
    width: 70px;
    height: 70px;
    border-radius: 10px;
    border: 3px solid hsl(var(--neutral-0-num), 20%);
  }
  .attendee-info .ticket-name {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 0.25rem;
    color: var(--neutral-0);
  }
  .attendee-github {
    display: flex;
    font-size: 1rem;
    column-gap: 0.5rem;
    align-items: center;
    color: var(--neutral-500);
  }
}

.ticket-number {
  top: 50%;
  right: 6%;
  font-weight: 700;
  font-size: 1.7rem;
  position: absolute;
  letter-spacing: 2px;
  text-orientation: mixed;
  color: var(--neutral-500);
  writing-mode: vertical-rl;
  transform: translateY(-50%);
}
