:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #52606d;
  --primary: #2c5aa0;
  --border: #d9e2ec;
}

* {
  box-sizing: border-box;
}

/* Language toggle safety net: a class that sets `display` must never
   override the `hidden` attribute used by the EN/ES switch. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Verdana, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #e6eef9 0%, var(--bg) 40%);
  line-height: 1.55;
}

.container {
  width: min(980px, 94vw);
  margin: 2rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(44, 90, 160, 0.08);
  padding: 1.25rem;
}

.hero {
  position: relative;
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.hero img {
  max-width: 100%;
  height: auto;
}

.lang-switch {
  position: absolute;
  top: 0;
  right: 0;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--primary);
  background: #ffffff;
  border: 1px solid #1f4e92;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.lang-btn:hover {
  background: #eaf1fb;
}

h1 {
  margin: 0.75rem 0 0;
  color: var(--primary);
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
}

.project-folder-name {
  margin: 0.15rem 0 0;
  color: #334e68;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

h2 {
  color: var(--primary);
  margin-top: 1.4rem;
  margin-bottom: 0.6rem;
  font-size: 1.2rem;
}

h3 {
  color: var(--primary);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

p {
  margin: 0.65rem 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1rem;
  align-items: start;
}

/* Two side-by-side figures instead of text + figure: equal columns so both
   images render at exactly the same size. */
.grid-2.grid-equal {
  grid-template-columns: 1fr 1fr;
}

.grid-equal .figure img {
  width: 100%;
}

.figure {
  text-align: center;
  margin: 0.9rem 0;
}

.figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

ul,
ol {
  padding-left: 1.2rem;
}

.data-table {
  width: min(560px, 100%);
  border-collapse: collapse;
  margin: 0.8rem auto;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  border: 1px solid #bcccdc;
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #f0f4f8;
}

.notice {
  color: #b00020;
  font-weight: 700;
}

.video-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  margin: 0.9rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.video-caption {
  margin: 0.3rem 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* Print-only QR codes for the videos (hidden on screen) */
.print-video-qr-heading,
.print-video-qr-row {
  display: none;
}

.cta {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  align-items: center;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  padding-top: 1rem;
}

.order-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #ffffff;
  background: var(--primary);
  text-decoration: none;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid #1f4e92;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.order-link:hover {
  background: #234a84;
}

.order-link-icon {
  display: block;
}

.action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.print-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--primary);
  background: #ffffff;
  border: 1px solid #1f4e92;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.print-btn:hover {
  background: #eaf1fb;
}

.print-btn-icon {
  display: block;
}

.small {
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 820px) {
  .grid-2,
  .cta {
    grid-template-columns: 1fr;
  }

  .container {
    margin: 1rem auto;
    padding: 1rem;
  }

  .lang-switch {
    position: static;
    margin-bottom: 0.75rem;
    text-align: right;
  }

  .data-table {
    font-size: 0.82rem;
  }
}

/* Print-only order card (hidden on screen) */
.print-only-order-card {
  display: none;
}

.print-qr-code {
  width: 150px;
  height: 150px;
  border: 1px solid #333333;
  margin: 0 auto;
}

.print-qr-section {
  text-align: center;
}

/* Main image, pattern B (top): print-only copy placed right after the
   header, used when the introduction is too long to share space with it. */
.print-hero {
  display: none;
}

@media print {
  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .cta,
  .order-link,
  .print-btn,
  .video-wrap,
  .video-heading,
  .lang-switch,
  section > .video-caption {
    display: none !important;
  }

  .print-video-qr-heading {
    display: block;
    margin: 0.75rem 0 0.6rem;
    color: var(--primary);
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
  }

  .print-video-qr-row {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    margin: 0 auto 1rem;
    page-break-inside: avoid;
  }

  .print-video-qr-card {
    flex: 1 1 0;
    max-width: 260px;
    margin: 0;
    padding: 0.9rem;
    border: 2px solid var(--primary);
    border-radius: 10px;
    text-align: center;
    background: #ffffff;
  }

  .print-video-qr-title {
    margin: 0 0 0.6rem;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.95rem;
  }

  .print-video-qr-code {
    display: block;
    width: 140px;
    height: 140px;
    margin: 0 auto 0.6rem;
    border: 1px solid #333333;
  }

  .print-video-qr-card .video-caption {
    margin: 0;
    font-size: 0.8rem;
  }

  .print-only-order-card {
    display: block;
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    page-break-inside: avoid;
  }

  .print-only-order-card h2 {
    margin-top: 0;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--primary);
    text-align: center;
  }

  .print-order-content {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    align-items: center;
    margin-top: 1rem;
  }

  .print-info-section {
    font-size: 0.95rem;
    line-height: 1.4;
  }

  .print-title {
    font-size: 1rem;
    margin-top: 0;
  }

  .print-url {
    margin-bottom: 1rem;
    font-size: 0.9rem;
  }

  .print-url span {
    font-family: monospace;
    word-break: break-all;
    color: #0066cc;
  }

  .print-company {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  /* Halve the size of instruction photos on paper to save space */
  .figure img {
    max-width: 50%;
    height: auto;
  }

  /* Main image, pattern A (side): keep text and image side by side on paper
     (the 820px screen breakpoint would otherwise stack them) and let the
     image fill its column instead of being halved. */
  .grid-2.intro-hero {
    grid-template-columns: 1.4fr 1fr;
  }

  .intro-hero .hero-figure {
    margin-top: 0;
  }

  .intro-hero .hero-figure img {
    max-width: 100%;
    max-height: 10cm;
    width: auto;
  }

  /* Main image, pattern B (top): show the print-only copy on its own row
     before the introduction, and hide the screen copy inside the intro. */
  .print-hero {
    display: block;
    margin: 0 0 0.8rem;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-hero img {
    max-width: 60%;
    max-height: 9cm;
    width: auto;
  }

  .screen-only {
    display: none !important;
  }
}
