/*
 * EncodeLabel: the home page (index.php). Only what that page needs on top
 * of site.css and the two kit stylesheets it borrows the box and the paper
 * line from. Every colour is one of site.css's names, so light and dark both
 * work. Labels, sheets and barcode samples are always black on white, like
 * the printed thing; the grey "desk" around them follows the theme.
 *
 * Classes start with hp- (the shell already uses home- for its Add to Home
 * Screen pop-up). The scripts find things by data-hp-* attributes, never by
 * these classes.
 *
 *   1. The first screen: headline, the box, the live label, the button
 *   2. Sections and their headings
 *   3. Pictures on a desk
 *   4. The four tools, the three steps
 *   5. The barcode strip, the label paper, popular label paper and the guides
 *   6. Plain facts, questions, the closing box
 *   7. Narrower screens
 */

/* ==========================================================================
   1. The first screen
   ========================================================================== */
.page-home main.wrap { padding-top: 44px; }
.hp-hero {
  display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr); column-gap: 56px;
  grid-template-areas: "intro stage" "make stage" "go stage";
  grid-template-rows: auto auto 1fr;
  align-items: start;
}
.hp-intro { grid-area: intro; }
.hp-make { grid-area: make; }
.hp-stage { grid-area: stage; align-self: center; min-width: 0; }
.hp-go { grid-area: go; }

.hp-intro h1 { margin: 0 0 14px; font-size: clamp(2rem, 1.25rem + 2.6vw, 3.05rem); line-height: 1.06; letter-spacing: -.035em; }
.hp-intro .lead { margin: 0 0 26px; max-width: 34em; }

/* The box is the page's main control: a little taller than in the tools, and lifted off the page. */
.hp-box .ksym-input { margin: 0; }
.hp-box .ksym-box { box-shadow: var(--shadow); }
.hp-box .ksym-box:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent); }
.hp-box .ksym-field { min-height: 58px; padding: 16px 14px 14px; font-size: max(16px, 1.1rem); }
.hp-box .ksym-status { min-height: 1.5rem; }

.hp-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 2px 0 0; }
.hp-examples-label { color: var(--muted); font: 600 .75rem/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.hp-examples .chip-list { margin: 0; }

.hp-go { margin-top: 24px; }
.hp-go-button { min-width: min(100%, 300px); }
.hp-trust { margin: 12px 0 0; }

/* The live label, on a desk of a steady height so the page never jumps when the paper changes. */
.hp-stage > .marks { margin: 6px; }
.hp-desk { height: 300px; padding: 28px; }
.hp-desk .sheet-paper > svg { border-radius: inherit; }
.hp-desk.is-waiting .sheet-paper { opacity: .55; }
.hp-paper { margin: 14px 6px 0; }
.hp-paper .kpa-button { box-shadow: var(--shadow); }
.hp-paper-static { cursor: default; }
.hp-paper-static:hover { border-color: var(--line); }
/* Advice about the label (a barcode that is small for it): a sentence or two, so a block with its marker beside the first line. */
.hp-status { position: relative; display: block; margin: 10px 6px 0; padding-left: 16px; }
.hp-status::before { position: absolute; top: .52em; left: 0; }
.hp-status:empty { min-height: 0; margin-top: 0; padding-left: 0; }

/* ==========================================================================
   2. Sections and their headings
   ========================================================================== */
.hp-section { margin: 96px 0 0; }
.hp-head { margin: 0 0 28px; }
.hp-head h2 { margin: 0; font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem); letter-spacing: -.03em; }
.hp-head-text { max-width: 36em; margin: 10px 0 0; color: var(--muted); font-size: 1.05rem; }
/* A heading with a button at its right end ("See all 70 types": the number is counted in index.php). */
.hp-head-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; }
.hp-head-row > .btn { flex: none; }

/* ==========================================================================
   3. Pictures on a desk
   ========================================================================== */
/* The same grey cutting mat the label previews sit on; the picture itself is white labels and their shadows. */
.hp-pic {
  display: grid; place-items: center; overflow: hidden;
  border: 1px solid var(--desk-line); border-radius: var(--radius-small);
  background:
    linear-gradient(var(--desk-line) 1px, transparent 1px) -1px -1px / 24px 24px,
    linear-gradient(90deg, var(--desk-line) 1px, transparent 1px) -1px -1px / 24px 24px,
    var(--desk);
}
.hp-pic > img { display: block; width: 100%; height: auto; }

/* ==========================================================================
   4. The four tools, the three steps
   ========================================================================== */
a.hp-tool { display: flex; flex-direction: column; padding: 14px 14px 18px; }
.hp-tool h3 { margin: 16px 6px 6px; font-size: 1.2rem; }
.hp-tool-text { flex: 1 1 auto; margin: 0 6px 14px; color: var(--muted); font-size: .95rem; }
.hp-get { margin: 0 6px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .92rem; font-weight: 600; line-height: 1.35; }
.hp-get-label { display: block; margin-bottom: 2px; color: var(--muted); font: 600 .68rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; }

.hp-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin: 0; padding: 0; list-style: none; }
.hp-steps h3 { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; font-size: 1.15rem; }
.hp-steps p { margin: 0; color: var(--muted); }

/* ==========================================================================
   5. The barcode strip, the label paper
   ========================================================================== */
/* One long desk with a white label for each type: the sample, and its name printed under it. */
.hp-codes {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 20px; list-style: none;
  border: 1px solid var(--desk-line); border-radius: var(--radius);
  background:
    linear-gradient(var(--desk-line) 1px, transparent 1px) -1px -1px / 24px 24px,
    linear-gradient(90deg, var(--desk-line) 1px, transparent 1px) -1px -1px / 24px 24px,
    var(--desk);
}
.hp-codes > li { display: flex; min-width: 0; }
.hp-code {
  display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; gap: 14px; min-width: 0; padding: 18px 16px 12px;
  border-radius: 6px; background: var(--sheet); color: var(--sheet-ink); color-scheme: light;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 1px 3px rgba(0, 0, 0, .16), 0 6px 16px rgba(0, 0, 0, .1);
  text-decoration: none; transition: transform .15s, box-shadow .15s;
}
.hp-code:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 2px 5px rgba(0, 0, 0, .18), 0 12px 24px rgba(0, 0, 0, .16); }
.hp-code:focus-visible { outline-offset: 3px; }
.hp-code-pic { display: block; width: 100%; height: 84px; }
.hp-code-pic > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.hp-code-name { font: 700 .78rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; }

a.hp-sheet { display: flex; flex-direction: column; padding: 14px 14px 18px; }
.hp-pic-sheet { height: 200px; padding: 18px; }
.hp-pic-sheet > img { width: auto; max-width: 100%; height: 162px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .18)) drop-shadow(0 5px 10px rgba(0, 0, 0, .1)); }
.hp-sheet h3 { margin: 16px 6px 4px; }
.hp-sheet-text { margin: 0 6px; color: var(--muted); font-size: .92rem; }
.hp-sheet-text > span { white-space: nowrap; }
.hp-sheet-compat { margin: 4px 6px 0; color: var(--muted); font-size: .8rem; }

/* "Popular label paper" and "Common jobs": plain links in a grid, each a small card with the size or the
   guide's name, and a short line under it. Tall enough to tap (44 px at the least). */
.hp-popular { margin: 36px 0 0; }
.hp-popular h3 { margin: 0 0 6px; font-size: 1.15rem; }
.hp-popular-text { max-width: 40em; margin: 0 0 16px; color: var(--muted); }
.hp-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.hp-links > li { display: flex; min-width: 0; margin: 0; }
.hp-links-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hp-link {
  display: flex; flex: 1 1 auto; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; min-height: 44px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--card); color: var(--ink);
  text-decoration: none; transition: border-color .15s;
}
.hp-link:hover { border-color: var(--ink); }
.hp-link-name { font-weight: 650; line-height: 1.3; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.hp-link:hover .hp-link-name { text-decoration-color: currentColor; }
.hp-link-note { color: var(--muted); font-size: .88rem; line-height: 1.35; }
.hp-brands { max-width: 52em; margin: 14px 0 0; }

/* ==========================================================================
   6. Plain facts, questions, the closing box
   ========================================================================== */
/* Words on one side, a picture on the other. */
.hp-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 32px 48px; align-items: center; }
.hp-split-top { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: start; }
.hp-split-text > :last-child { margin-bottom: 0; }
.card.hp-split { padding: 32px; }
.card.hp-split h2 { font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem); letter-spacing: -.03em; }

.hp-points { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 32px; margin: 0; padding: 0; list-style: none; }
.hp-points > li { display: flex; align-items: flex-start; gap: 12px; }
.hp-point-icon {
  display: grid; flex: none; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--card); color: var(--ink);
}
.hp-points h3 { margin: 6px 0 4px; font-size: 1.02rem; }
.hp-points p { margin: 0; color: var(--muted); font-size: .95rem; }
.hp-more { margin: 24px 0 0; }

.hp-faq { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 24px 48px; align-items: start; }
.hp-faq .hp-head { margin: 0; }
.hp-faq .faq-list { margin: 0; }

.hp-close-text { color: var(--muted); font-size: 1.05rem; }
.hp-close .button-row { margin: 20px 0 0; }

/* ==========================================================================
   7. Narrower screens
   ========================================================================== */
@media (max-width: 1000px) {
  .hp-hero { column-gap: 36px; }
  .hp-desk { height: 260px; padding: 22px; }
  .hp-points { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
/* One column: the headline, the box, then the label it makes, then the button. */
@media (max-width: 860px) {
  .page-home main.wrap { padding-top: 28px; }
  .hp-hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "make" "stage" "go"; grid-template-rows: auto; }
  .hp-intro .lead { margin-bottom: 20px; }
  .hp-stage { margin-top: 18px; }
  .hp-desk { height: clamp(170px, 30vh, 240px); padding: 18px; }
  .hp-go { margin-top: 18px; }
  .hp-go-button { width: 100%; }
  .hp-trust { text-align: center; }

  .hp-section { margin-top: 72px; }
  .hp-steps { gap: 20px; }
  .hp-steps h3 { align-items: flex-start; font-size: 1.05rem; }
  .hp-steps p { font-size: .95rem; }
  .hp-sheets { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .hp-pic-sheet { height: 170px; padding: 14px; }
  .hp-pic-sheet > img { height: 140px; }
  .hp-split, .hp-split-top, .hp-faq { grid-template-columns: minmax(0, 1fr); }
  /* Only the top of the tall sheet picture, as a wide strip: enough to see what it is. */
  .hp-pic-tall > img { aspect-ratio: 2 / 1; object-fit: cover; object-position: 50% 0; }
  .card.hp-split { padding: 24px; }
  .card.hp-split .hp-pic { order: -1; }
  .hp-points { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 28px; }
  .hp-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Too narrow for three pictures side by side: each step is a picture with its words beside it. */
@media (max-width: 700px) {
  .hp-steps { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .hp-steps > li { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); column-gap: 16px; align-items: start; }
  .hp-steps > li > .hp-pic { grid-row: 1 / span 2; }
  .hp-steps h3 { margin-top: 2px; }
}
@media (max-width: 560px) {
  .hp-intro h1 { margin-bottom: 10px; font-size: 1.9rem; }
  .hp-intro .lead { margin-bottom: 16px; font-size: 1.05rem; }
  .hp-lead-more { display: none; }
  /* On a phone the line that says what is free sits under the first sentence, where it is read before any
     scrolling; under the button it would be off the bottom of the first screen. The button stays after the label. */
  .hp-hero { grid-template-areas: "intro" "trust" "make" "stage" "go"; }
  .hp-go { display: contents; }
  .hp-intro .lead { margin-bottom: 8px; }
  .hp-go .hp-trust { grid-area: trust; margin: 0 0 16px; color: var(--ink); font-size: .85rem; font-weight: 600; text-align: left; text-wrap: balance; }
  .hp-go-button { grid-area: go; margin-top: 18px; }
  .hp-box .ksym-field { min-height: 52px; padding: 14px 12px 12px; font-size: 16px; }
  /* Three examples on one line: the word "Try" is kept for screen readers only. */
  .hp-examples-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .hp-examples .chip-list { flex-wrap: nowrap; gap: 6px; width: 100%; }
  .hp-examples .chip-list > li { flex: 1 1 auto; min-width: 0; }
  .hp-examples a.chip { justify-content: center; width: 100%; padding: 6px 4px; font-size: .86rem; white-space: nowrap; }

  /* The four tools: a small picture beside the words, so all four are a short scroll. */
  a.hp-tool { display: grid; grid-template-columns: 116px minmax(0, 1fr); column-gap: 14px; align-items: start; padding: 12px; }
  .hp-tool > .hp-pic { grid-row: 1 / span 2; }
  .hp-tool h3 { margin: 2px 0 4px; font-size: 1.1rem; }
  .hp-tool-text { margin: 0; font-size: .92rem; }
  .hp-get { grid-column: 1 / -1; margin: 12px 0 0; padding-top: 10px; }
  .hp-section { margin-top: 60px; }
  .hp-head { margin-bottom: 20px; }
  .hp-head-row > .btn { width: 100%; }
  .hp-points { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .hp-pic-tall > img { aspect-ratio: 3 / 2; }
  .hp-steps > li { display: block; }
  .hp-steps h3 { margin-top: 16px; font-size: 1.15rem; }
  .hp-steps p { font-size: 1rem; }
  .card.hp-split { padding: 18px 16px; }
  .hp-close .button-row .btn { flex: 1 1 100%; }

  /* The barcode strip becomes a row that slides sideways inside its own box. */
  .hp-codes {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 132px; gap: 12px; padding: 16px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding: 16px;
    -webkit-overflow-scrolling: touch;
  }
  .hp-codes > li { scroll-snap-align: start; }
  /* Two kinds of label paper side by side. */
  .hp-sheets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  a.hp-sheet { padding: 10px 10px 14px; }
  .hp-pic-sheet { height: 150px; padding: 14px; }
  .hp-pic-sheet > img { height: 120px; }
  .hp-sheet h3 { margin: 12px 4px 4px; font-size: 1rem; }
  .hp-sheet-text, .hp-sheet-compat { margin-left: 4px; margin-right: 4px; }
  /* The popular sizes and the guides: one link per row. */
  .hp-popular { margin-top: 28px; }
  .hp-links, .hp-links-wide { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .hp-link { padding: 10px 12px; }
}
@media (max-width: 380px) {
  .hp-box .ksym-field { padding-left: 9px; padding-right: 9px; }
  .hp-examples a.chip { font-size: .82rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hp-code { transition: none; }
  .hp-code:hover { transform: none; }
}
