@import "tailwindcss";

@page {
  size: A4;
  margin: 0;
}

@utility page-a4 {
  width: 210mm;
  height: 297mm;
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  background: white;
  box-sizing: border-box;
}

@utility page-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

@utility page-content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 15mm;
  box-sizing: border-box;
}

@utility problem-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

@utility problem-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

@utility problem-text {
  font-size: 1.25rem;
  font-weight: 500;
}

@utility answer-line {
  display: inline-block;
  width: 3rem;
  border-bottom: 2px solid currentColor;
  text-align: center;
  margin-left: 0.25rem;
}

@utility page-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@utility page-header-reverse {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@utility hero-image {
  width: 33%;
  flex-shrink: 0;
  object-fit: contain;
}

@utility header-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 0.5rem;
}

@utility page-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #1e1b4b;
}

@utility page-subtitle {
  font-size: 1.1rem;
  font-weight: 500;
  color: #6366f1;
  margin-top: 0.25rem;
}

@utility page-meta {
  display: flex;
  gap: 2rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #64748b;
}

@utility problem-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.2rem;
  border: 2px solid #e0e7ff;
  border-radius: 999px;
  background: linear-gradient(135deg, #fefefe 0%, #f0f0ff 100%);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
  width: fit-content;
  max-width: 85%;
}

@utility problem-card-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  object-fit: contain;
}

@utility problem-card-text {
  font-size: 1.4rem;
  font-weight: 600;
  color: #1e1b4b;
  white-space: nowrap;
}

@utility problem-card-answer {
  display: inline-block;
  width: 3.5rem;
  border-bottom: 2.5px solid #a5b4fc;
  text-align: center;
  margin-left: 0.5rem;
}

@utility problem-align-left {
  display: flex;
  justify-content: flex-start;
  padding: 0.3rem 0;
}

@utility problem-align-right {
  display: flex;
  justify-content: flex-end;
  padding: 0.3rem 0;
}

@utility problem-align-center {
  display: flex;
  justify-content: center;
  padding: 0.3rem 0;
}

@utility problems-area {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

@utility page-content-themed {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 10mm 15mm 85mm 15mm;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

@utility page-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80mm;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

@utility page-footer-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

@utility page-footer-fade {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(to bottom, white, transparent);
  pointer-events: none;
  z-index: 1;
}

@media print {
  body {
    margin: 0;
    padding: 0;
  }

  .page-a4 {
    break-after: page;
    page-break-after: always;
  }

  .page-a4:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}
