/* =================================================================
   PAYAZ VISUAL SOP SYSTEM — style.css

   Screen first, print second.
   Designed for shop-floor use on phones with gloves.

   Key specs (from the brief):
     Body text:        18–20 px, weight >= 500
     Step numbers:     32–40 px, heavy
     Step titles:      24 px bold
     Nav buttons:      >= 76 px tall (ideally 114 px)
     Target spacing:   >= 30 px
     Contrast:         7:1 AAA — #111 on #fff
     Line height:      1.5, measure <= 75 characters
   ================================================================= */


/* -----------------------------------------------------------------
   Reset
   ----------------------------------------------------------------- */

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

html {
  font-size: 18px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  font-weight: 500;
  color: #111;
  background: #fff;
  max-width: 75ch;
  margin: 0 auto;
  padding: 16px 16px 140px;
}


/* -----------------------------------------------------------------
   Typography
   ----------------------------------------------------------------- */

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0.4em 0;
}

h2 {
  font-size: 1.33rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0.5em 0 0.3em;
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0.5em 0 0.3em;
}

p {
  margin: 0.4em 0;
}

ul, ol {
  padding-left: 1.4em;
  margin: 0.4em 0;
}

li {
  margin: 0.25em 0;
}

a {
  color: #0055cc;
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #f0f0f0;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

strong {
  font-weight: 700;
}


/* -----------------------------------------------------------------
   Document header
   ----------------------------------------------------------------- */

.doc-header {
  border-bottom: 3px solid #111;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.doc-id-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.home-link {
  font-size: 1.4rem;
  text-decoration: none;
  color: #555;
  line-height: 1;
}

.doc-id {
  font-size: 1rem;
  font-weight: 700;
  background: #111;
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.doc-area {
  font-size: 0.8rem;
  font-weight: 600;
  background: #e4e4e4;
  padding: 3px 8px;
  border-radius: 4px;
}

.doc-rev {
  font-size: 0.8rem;
  font-weight: 600;
}

.est-time {
  font-size: 0.8rem;
  color: #555;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.8rem;
  color: #444;
  margin-top: 4px;
}

.applies-to {
  font-size: 0.8rem;
  color: #444;
  margin-top: 4px;
}


/* -----------------------------------------------------------------
   Safety panel
   ----------------------------------------------------------------- */

.safety-panel {
  background: #fff5f5;
  border: 2px solid #cc0000;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.stop-if {
  background: #cc0000;
  color: #fff;
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.stop-if h3 {
  color: #fff;
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.stop-if ul {
  list-style: none;
  padding: 0;
}

.stop-if li {
  padding: 3px 0;
  font-weight: 600;
}

.hazards {
  margin-bottom: 10px;
}

.hazards h3 {
  color: #cc0000;
}

.ppe h3 {
  color: #333;
}


/* -----------------------------------------------------------------
   Tools panel (collapsible)
   ----------------------------------------------------------------- */

.tools-panel {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
}

.tools-panel summary {
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 0;
}

.tools-panel h3 {
  margin-top: 12px;
}


/* -----------------------------------------------------------------
   Steps
   ----------------------------------------------------------------- */

.step {
  padding: 8px 0 20px;
}

.step h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 1.33rem;
  margin-bottom: 12px;
}

.step-number {
  font-size: 2rem;
  font-weight: 800;
  color: #111;
  line-height: 1;
  flex-shrink: 0;
}

.step-photo {
  margin: 12px 0;
}

.step-photo img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
}

.step-body {
  margin-top: 8px;
}

.step-body p {
  margin: 0.4em 0;
}


/* -----------------------------------------------------------------
   Caution blocks
   ----------------------------------------------------------------- */

.caution {
  background: #fff8e1;
  border: 2px solid #f9a825;
  border-radius: 6px;
  padding: 12px 14px;
  margin: 12px 0;
}

.caution-header {
  font-weight: 700;
  font-size: 1rem;
  color: #e65100;
  margin-bottom: 4px;
}

.caution p {
  margin: 0;
}


/* -----------------------------------------------------------------
   Key points — the most valuable content in the system
   ----------------------------------------------------------------- */

.key-points {
  margin: 14px 0;
}

.key-point {
  background: #e8f4fd;
  border-left: 5px solid #1565c0;
  border-radius: 0 6px 6px 0;
  padding: 10px 14px;
  margin: 8px 0;
}

.kp-point {
  margin-bottom: 4px;
}

.kp-reason {
  color: #333;
  font-size: 0.92rem;
}


/* -----------------------------------------------------------------
   Acceptance criteria
   ----------------------------------------------------------------- */

.accept {
  background: #e8f5e9;
  border-left: 5px solid #2e7d32;
  border-radius: 0 6px 6px 0;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 0.95rem;
}

.accept-label {
  font-weight: 700;
  color: #2e7d32;
}


/* -----------------------------------------------------------------
   Step navigation — fixed at bottom, in the thumb arc
   ----------------------------------------------------------------- */

.step-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #fff;
  border-top: 2px solid #ddd;
  z-index: 100;
}

.btn-prev, .btn-next {
  min-height: 76px;
  min-width: 100px;
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: #111;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-prev:disabled, .btn-next:disabled {
  background: #ccc;
  color: #888;
  cursor: default;
}

.btn-prev:active:not(:disabled),
.btn-next:active:not(:disabled) {
  background: #333;
}

.step-indicator {
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  min-width: 90px;
}


/* -----------------------------------------------------------------
   Photo overlay (tap-to-enlarge)
   ----------------------------------------------------------------- */

.photo-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
  padding: 16px;
}

.photo-overlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0;
  border: none;
}


/* -----------------------------------------------------------------
   Index page
   ----------------------------------------------------------------- */

.index-header {
  border-bottom: 3px solid #111;
  padding-bottom: 12px;
  margin-bottom: 24px;
}

.index-header p {
  color: #555;
  font-size: 0.95rem;
}

.area-section {
  margin-bottom: 28px;
}

.area-section h2 {
  font-size: 1.2rem;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  text-decoration: none;
  color: #111;
  min-height: 56px;
}

.doc-link:active {
  background: #e8e8e8;
}

.doc-link-id {
  font-weight: 700;
  font-size: 0.9rem;
  background: #111;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.doc-link-title {
  flex: 1;
  min-width: 0;
}

.doc-link-rev {
  font-size: 0.8rem;
  color: #666;
}


/* =================================================================
   PRINT
   ================================================================= */

@media print {
  body {
    max-width: none;
    padding: 0;
    font-size: 10pt;
    color: #000;
  }

  /* Show all steps in print, even those hidden on screen */
  .step[hidden] {
    display: block !important;
  }

  .step {
    break-inside: avoid;
    page-break-inside: avoid;
    margin: 0 0 8mm;
  }

  .step h2 {
    break-after: avoid;
  }

  .step-photo {
    break-inside: avoid;
  }

  .step-photo img {
    max-width: 100%;
    max-height: 95mm;
    height: auto;
    display: block;
  }

  p {
    orphans: 3;
    widows: 3;
  }

  .caution {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .key-point {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .accept {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  /* Hide interactive elements */
  .step-nav,
  .photo-overlay,
  .home-link {
    display: none !important;
  }

  /* Force tools panel open in print */
  .tools-panel {
    border: 1px solid #999;
    display: block !important;
  }

  .tools-panel > * {
    display: block !important;
  }
}
