@font-face {
  font-family: "Silian Rail";
  src: url("../fonts/silian-rail.woff2");
  font-display: swap;
}

body {
  font-family: serif;
}

#preview-phone,
#preview-company,
#preview-department,
#preview-position,
#preview-address,
#preview-name {
  font-family: "Silian Rail", "Noto Serif SC", serif;
}

#card-generator-container {
  display: grid;
  grid-template-columns: 500px 1fr;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.controls-section {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 3rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.controls-section h3 {
  text-align: center;
  margin: 0rem;
  color: #2c3e50;
  font-size: 1.5rem;
  font-weight: 600;
  font-family: serif;
}

.form-grid {
  display: block;
  margin-top: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #34495e;
  font-size: 0.9rem;
}

.form-group input {
  font-family: serif;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background: white;
}

.form-group input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.card-preview-section {
  padding: 2rem;
  text-align: center;
}

.card-preview-section h3 {
  margin: 0rem;
  color: #2c3e50;
  font-size: 1.5rem;
  font-weight: 600;
  font-family: serif;
}

/* Business Card Styles */
.container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  border-radius: 12px;
  position: relative;
  left: -10%;
  line-height: 1.2;
}

.container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.card-stack {
  position: relative;
  max-width: 22.5rem;
  width: 100%;
  height: 12.5rem;
  z-index: 2;
}

.card-layer {
  position: absolute;
  max-width: 22.5rem;
  width: 100%;
  height: 12.5rem;
  background: linear-gradient(135deg, #fefefe 0%, #f8f8f8 100%),
    radial-gradient(circle at 30% 30%, rgba(0, 0, 0, 0.02) 0%, transparent 50%);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 1px rgba(255, 255, 255, 0.9);
  box-sizing: content-box;
  border: 1px solid rgba(238, 238, 238, 0.8);
  padding: 1.25rem;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-layer:nth-child(3) {
  bottom: -4rem;
  z-index: 1;
  transform: rotate(-4deg);
}

.card-layer:nth-child(3):hover {
  transform: rotate(-6deg) scale(1.02);
}

.card-layer:nth-child(2) {
  bottom: -3.5rem;
  z-index: 2;
  transform: rotate(-3deg);
}

.card-layer:nth-child(2):hover {
  transform: rotate(-5deg) scale(1.01);
}

.card-layer:nth-child(1) {
  bottom: -3rem;
  z-index: 3;
  transform: rotate(-2deg);
}

.card-layer:nth-child(1):hover {
  transform: rotate(-4deg) scale(1.01);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.3' numOctaves='7' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.3'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px;
  /* Adjust for grain scale; smaller for denser texture */
  opacity: 0.25;
  /* Low opacity for subtle effect; increase for more pronounced grain */
  mix-blend-mode: luminosity;
  pointer-events: none;
}

.card {
  position: relative;
  max-width: 22.5rem;
  width: 100%;
  height: 12.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%),
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.01) 0%, transparent 70%);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
  box-sizing: content-box;
  border: 1px solid rgba(221, 221, 221, 0.8);
  padding: 1.25rem;
  z-index: 4;
  font-family: "Silian Rail", serif;
  letter-spacing: 0.05rem;
  transition: transform 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
}

.card > div,
.card h1,
.card h2 {
  color: rgba(0, 0, 0, 0.8);
  text-shadow: 0px 0.5px 0.5px rgba(255, 255, 255, 0.9),
    0px -0.5px 0.5px rgba(0, 0, 0, 0.1);
  margin: 0%;
}

.top-left {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  font-size: 1rem;
  font-weight: 400;
}

.top-right {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  text-align: right;
  font-size: 1rem;
  font-weight: 400;
}

.top-right span {
  display: block;
  font-size: 0.75rem;
}

.name {
  width: 100%;
  position: absolute;
  top: calc(55% - 0.8rem);
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.1rem;
}

.position {
  width: 100%;
  position: absolute;
  top: calc(55% + 0.7rem);
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.25rem;
  text-align: center;
  font-weight: 400;
}

.bottom {
  width: 100%;
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translate(-50%);
  font-size: 0.625rem;
  text-align: center;
  line-height: 1.2;
}

.action-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 5rem 0 2rem 0;
}

.action-btn {
  font-family: serif;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.export-btn {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #2c3e50;
}

.export-btn:hover {
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.print-btn {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #2c3e50;
}

.print-btn:hover {
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

@media (max-width: 480px) {
  .action-buttons {
    flex-direction: column;
    align-items: center;
  }

  .action-btn {
    width: 200px;
  }
}

@media (max-width: 1280px) {
  #card-generator-container {
    grid-template-columns: 1fr;
  }

  .card-preview-section {
    order: 1;
    padding: 1rem;
  }

  .controls-section {
    order: 2;
    padding: 1.5rem;
    margin-bottom: 1rem;
  }

  .card-stack {
    max-width: 20rem;
  }

  .card,
  .card-layer {
    max-width: 20rem;
  }

  .name,
  .position {
    font-size: 1.1rem;
  }

  .top-left,
  .top-right {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .container {
    min-height: 300px;
  }

  .card-stack {
    height: 10rem;
    max-width: 18rem;
  }

  .card,
  .card-layer {
    height: 10rem;
    max-width: 18rem;
  }

  .name,
  .position {
    font-size: 1rem;
  }

  .bottom {
    font-size: 0.5rem;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }

  main.printable.card,
  main.printable.card * {
    visibility: visible !important;
  }

  main.printable.card {
    display: block;
    margin: 0 auto;
    transform: scale(1.2);
  }

  @page {
    margin: 0.5in;
    size: landscape;
  }
}
