/* The inks and the typeface the prints are set in.
   Every value comes from photoprep/config.sh, which drives what is physically
   printed on the back of a card — so the shop and the product do not disagree.
   Avenir is BACK_FONT; it ships on iOS and macOS, and falls back elsewhere. */
:root {
  --ink: #1c232c;
  --soft: #55616e;
  --faint: #8b97a3;
  --rule: #d7dee4;
  --line: #e2e7eb;
  --paper: #fbfbfc;
  --marker: #d4552e;      /* the "you were here" pin. Rare, on purpose. */
  --sheet-radius: 2px;    /* photo paper is cut square, not 16px rounded */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14171a; --ink: #e8ecef; --soft: #a8b3bd;
    --faint: #71808c; --line: #252b31;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 Avenir-Book, Avenir, -apple-system, BlinkMacSystemFont,
        system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

main { max-width: 34rem; margin: 0 auto; padding: 22px 22px 48px; }

.wordmark {
  font-family: Avenir-Black, Avenir, system-ui, sans-serif;
  font-weight: 900; font-size: 15px; letter-spacing: .16em;
  color: var(--soft); text-align: center; padding: 10px 0 4px;
}
/* FOUR and SIX in Black, BY in Light, or it reads "FOURBY SIX" (www/site.css). */
.wordmark .by, .mark .by { font-family: Avenir-Light, Avenir, system-ui, sans-serif; font-weight: 300; }

h1 {
  font: 400 27px/1.25 Avenir-Book, Avenir, system-ui, sans-serif;
  margin: 0 0 10px;
}
p { color: var(--soft); margin: 0 0 14px; }

/* A stack of prints. The product's proportion is the layout grid.
   The inline padding is not decoration: the sheets are rotated and offset, so
   without it the back one hangs off the left edge on a narrow screen. */
.stack {
  position: relative; margin: 24px 0 30px; padding: 0 18px 6px;
}
.sheet {
  aspect-ratio: 3 / 2;
  background: #fff;
  border: .5px solid var(--rule);
  border-radius: var(--sheet-radius);
  /* Paper resting on paper: short and tight, not a soft grey card shadow. */
  box-shadow: 0 3px 5px rgba(28, 35, 44, .14);
  overflow: hidden;
}
.sheet-art { display: block; width: 100%; height: auto; }
.stack .sheet:first-child {
  position: absolute; inset: 0 18px; transform: rotate(-6deg) translate(-10px, 10px);
  box-shadow: 0 2px 4px rgba(28, 35, 44, .10);
}
.stack .sheet:last-child { position: relative; transform: rotate(2.5deg); }

/* The thank-you screen, with their own photos as the stack. Every sheet is
   centred in a fixed box and fanned by its place in the pile (--i, 0 on top),
   so one, two or three photos and any mix of orientations all sit the same. */
.done { padding-top: 8px; }
.done h1 { margin-top: 6px; }
.done p { margin-bottom: 0; }
.done p strong { color: var(--ink); font-weight: 800; }
.done .actions { margin-top: 28px; }
.stack.photos {
  position: relative; height: clamp(220px, 58vw, 300px);
  margin: 18px 0 34px; padding: 0;
}
.stack.photos .sheet {
  position: absolute; left: 50%; top: 50%;
  width: 78%; aspect-ratio: 3 / 2;
  background: #fff center / cover no-repeat;
  transform: translate(-50%, -50%)
             rotate(calc(2.5deg - var(--i) * 5deg))
             translate(calc(var(--i) * -14px), calc(var(--i) * 8px));
}
/* A photograph printed borderless has no edge but the photo's own. The
   hairline the drawn card needs, at .5px and rotated, antialiased into
   something that looked dashed. */
.stack.photos .sheet { border: 0; }
.stack.photos .sheet.portrait { width: auto; height: 84%; aspect-ratio: 2 / 3; }
.stack.photos .sheet:not(:last-child) { box-shadow: 0 2px 4px rgba(28, 35, 44, .10); }

button, .button {
  display: block; width: 100%; padding: 16px; border: 0;
  border-radius: 4px; cursor: pointer;
  font: 500 15px Avenir-Medium, Avenir, system-ui, sans-serif;
  letter-spacing: .02em;
  /* A school's storefront sets --accent; Four by Six's own shop does not. */
  background: var(--accent, var(--ink)); color: var(--paper);
}
/* Element-agnostic: the picker's control is a <label> wrapping a hidden file
   input, so a `button.quiet` selector silently did nothing and left two
   equally loud primary buttons on the cart. */
.quiet {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line);
}
button[disabled] { opacity: .45; cursor: default; }
button + button, .button + button, button + .button { margin-top: 10px; }

.actions { margin-top: 22px; }
/* A text link under the buttons, for the thing nobody should tap by accident. */
button.link {
  display: block; width: auto; margin: 18px auto 0; padding: 6px 10px;
  background: none; color: var(--faint);
  font: 400 14px Avenir, system-ui, sans-serif; letter-spacing: 0;
  text-decoration: underline; text-underline-offset: 3px;
}
button.link:hover { color: var(--ink); }
/* "Edit crop" in the line under a cart item's name: a text link, because a
   thumbnail on its own does not read as something you can tap. */
button.edit {
  display: block; width: auto; padding: 0; margin: 0; border: 0;
  background: none; color: var(--soft); font: inherit; letter-spacing: 0;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
button.edit:hover { color: var(--ink); }
button.edit[hidden] { display: none; }
/* The wordmark inside running text: one word, caps, set the way it prints. */
.mark {
  font-family: Avenir-Black, Avenir, system-ui, sans-serif;
  font-weight: 900; font-size: .88em; letter-spacing: .16em; margin-left: .15em;
}

.status {
  font-size: 13px; color: var(--faint);
  padding: 10px 0; min-height: 1.5em;
}
.status.bad { color: var(--marker); }

/* A cart change in flight: taps are held, nothing is dimmed. Dimming every
   button for a request this short is what made the cart flash. */
#app.busy { pointer-events: none; }

/* Photos handed over from the homepage, uploading. */
.uploading { padding-top: 12vh; }
.uploading .bar {
  height: 3px; margin: 22px 0 4px; background: var(--line);
  border-radius: 2px; overflow: hidden;
}
.uploading .bar span {
  display: block; height: 100%; width: 4%; background: var(--ink);
  transition: width .35s ease; position: relative; overflow: hidden;
}
/* A light sweeping across the filled part while anything is in flight, so a
   connection that stalls for a few seconds still looks like work. */
.uploading .bar.busy span::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  transform: translateX(-100%); animation: sweep 1.4s ease-in-out infinite;
}
@keyframes sweep { to { transform: translateX(100%); } }

/* One sheet per photo while it uploads, each with its own thin line. */
.upload-tiles {
  list-style: none; padding: 0; margin: 22px 0 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px;
}
.upload-tile {
  position: relative; aspect-ratio: 1; background: #fff;
  border-radius: var(--sheet-radius, 2px); overflow: hidden;
  box-shadow: 0 1px 3px rgba(20,23,26,.14);
}
.upload-tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity .3s;
}
.upload-tile img.ready { opacity: .55; }
.upload-tile[data-stage="done"] img.ready { opacity: 1; }
.upload-tile .tile-bar {
  position: absolute; left: 6px; right: 6px; bottom: 6px; height: 3px;
  background: rgba(255,255,255,.7); border-radius: 2px; overflow: hidden;
}
.upload-tile .tile-bar span {
  display: block; height: 100%; width: 0; background: var(--ink);
  transition: width .3s ease;
}
.upload-tile[data-stage="done"] .tile-bar { display: none; }
.upload-tile[data-stage="done"]::after {
  content: "✓"; position: absolute; right: 6px; bottom: 4px;
  font-size: 13px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.upload-tile[data-stage="failed"]::after {
  content: "!"; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(212,85,46,.18); color: var(--marker); font-weight: 700;
}
@media (prefers-reduced-motion: reduce) {
  .uploading .bar span, .upload-tile .tile-bar span { transition: none; }
  .uploading .bar.busy span::after { animation: none; }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --- cart ----------------------------------------------------------------- */

ul.cart { list-style: none; margin: 24px 0 0; padding: 0; }
ul.cart li {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0; border-bottom: .5px solid var(--line);
}
ul.cart .grow { flex: 1; min-width: 0; }
ul.cart .name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
ul.cart .sub { font-size: 13px; color: var(--faint); margin-top: 2px; }

/* The proportion of the thing being bought. The shape is information. */
/* A print, at the proportion it will actually be printed at — 3:2 for a
   landscape photo, 2:3 for a portrait one. The shape is information, and a
   portrait photo shown in a landscape box misrepresents what arrives. Sized by
   height so a row keeps its rhythm whichever way round the photo is. */
.thumb {
  /* `width: auto` is load-bearing: the base `button` rule sets width:100%, and
     as a <button> the thumbnail inherited it and swallowed the whole row. The
     width has to come from the aspect ratio, not from the block default. */
  flex: 0 0 auto; width: auto; height: 44px; aspect-ratio: 3 / 2;
  background: var(--line) center / cover no-repeat;
  border: .5px solid var(--rule); border-radius: var(--sheet-radius);
}
.thumb.portrait { aspect-ratio: 2 / 3; height: 58px; }
.thumb.tappable { cursor: pointer; }

/* A stepper in the shop's own terms. The count sits between the controls, so
   there is no separate label repeating it beside them. */
.stepper {
  display: flex; align-items: center;
  border: 1px solid var(--line); border-radius: 4px;
}
.stepper .count {
  min-width: 30px; text-align: center;
  font-family: Avenir-Medium, Avenir, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
button.step {
  width: 34px; padding: 8px 0; background: none; color: var(--ink);
  border: 0; font-size: 17px; line-height: 1;
}
button.step[disabled] { color: var(--faint); opacity: .5; }

/* A × rather than the word "Remove". The row has a thumbnail, a name, a
   stepper and this in it; spelling it out cost about seventy points of width
   and truncated every filename to make room for a word nobody needs to read. */
button.remove {
  width: 34px; height: 34px; padding: 0; flex: 0 0 auto;
  background: none; color: var(--faint); font-size: 19px; line-height: 1;
}
button.remove:hover { color: var(--marker); }

dl.totals {
  display: grid; grid-template-columns: 1fr auto;
  gap: 8px 16px; margin: 22px 0 0;
}
dl.totals dt { color: var(--soft); }
dl.totals dd { margin: 0; text-align: right; }
dl.totals .grand {
  font-family: Avenir-Heavy, Avenir, system-ui, sans-serif;
  font-weight: 800; padding-top: 10px;
  border-top: .5px solid var(--line);
}
dl.totals dd.grand { color: var(--marker); }

.fine { font-size: 13px; color: var(--faint); margin-top: 10px; }
.fine a { color: inherit; text-underline-offset: 2px; }

/* The file input is hidden inside its label, so the button is the real
   control and there is no browser-styled input to fight. */
label.button { text-align: center; }
label.button:has(input[disabled]) { opacity: .45; cursor: default; }


/* Stripe's iframe. Given room and left alone: its internals are Stripe's, and
   the branding that matters is set in the Dashboard so the form carries the
   same inks as the rest of the shop. */
#stripe-checkout { margin: 20px 0 8px; min-height: 320px; }
/* On a phone, edge to edge, the way Stripe lays it out on its own page. Inside
   main's 22px gutters the form got ~350px on a 393px iPhone (less with Safari
   text zoom) and Stripe clipped its own right-hand column — the prices — with
   no way to scroll to them. */
@media (max-width: 40rem) {
  #stripe-checkout { margin-inline: -22px; }
}


/* --- quality floor -------------------------------------------------------- */

/* Keyboard focus, visible without following a mouse around. The custom
   buttons replace the browser's default appearance, which takes the default
   focus ring with it. */
:focus-visible {
  outline: 2px solid var(--marker);
  outline-offset: 2px;
  border-radius: 3px;
}
/* The picker is a label wrapping a hidden input, so focus lands on the input
   where nothing is visible. Put the ring on the label instead. */
label.button:has(input:focus-visible) {
  outline: 2px solid var(--marker);
  outline-offset: 2px;
}

/* Nothing here animates on its own, but Stripe's iframe does. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Touch targets. The stepper and the remove control are the smallest things
   on the page and the easiest to miss on a phone. */
button.step, button.remove { min-height: 44px; }

@media (min-width: 40rem) {
  /* A print is a small object; a checkout that spans a desktop monitor makes
     it feel like software. The column stays the width of a page of text. */
  main { padding-top: 40px; }
}

/* --- crop editor ---------------------------------------------------------- */

body.locked { overflow: hidden; }

/* A darkroom. The photo is the only lit thing, and the chrome gets out of its
   way — this is the one place in the shop where somebody is judging an image
   rather than reading about one. */
.editor {
  position: fixed; inset: 0; z-index: 10;
  background: #14171a; color: #fbfbfc;
  display: flex; flex-direction: column;
}
.editor:focus { outline: none; }
.editor-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px;
}
.editor-title { font-size: 13px; color: #8b97a3; }
button.editor-action {
  width: auto; padding: 8px 4px; background: none;
  color: #8b97a3; font-size: 15px;
}
button.editor-action.strong { color: #fbfbfc; }

.editor-stage {
  flex: 1; display: grid; place-items: center;
  padding: 0 18px; min-height: 0;
}

/* Shrink-wrapped to the image, so the frame's coordinates and the image's
   coordinates are the same thing. */
.editor-plate {
  position: relative; line-height: 0;
  max-width: 100%; max-height: 100%;
  touch-action: none; cursor: grab;
  /* Clips the frame's shade, which is a single enormous spread rather than
     four strips — see below. */
  overflow: hidden;
}
.editor-plate:active { cursor: grabbing; }
.editor-plate img {
  /* Sized in pixels by editor.js `fit()`; see there for why CSS cannot. */
  display: block; max-width: none; max-height: none;
  user-select: none; -webkit-user-drag: none;
  opacity: 0; transition: opacity .2s;
}
.editor-plate.ready img { opacity: 1; }

/* A paper edge, not a selection marquee: the bright region IS the print, so it
   gets the sheet's own near-square corners.
   
   The dimming outside it is the frame's own shadow with a spread larger than
   any plate, clipped by the plate's overflow. It used to be two strips, which
   worked only while the window spanned one axis completely — with zoom it can
   sit inset on all four sides, and two strips leave the corners lit. One
   shadow covers any shape the window can take. */
.frame {
  position: absolute; pointer-events: none;
  border: 1.5px solid rgba(255, 255, 255, .92);
  border-radius: var(--sheet-radius);
  box-shadow: 0 0 0 9999px rgba(20, 23, 26, .64), 0 0 8px rgba(0, 0, 0, .4);
  opacity: 0; transition: opacity .2s;
}
.editor-plate.ready .frame { opacity: 1; }

/* Zoom. Hidden entirely when the photo has no room for any — a control that
   cannot move reads as broken, and that is a fact about the photo. */
.editor-zoom {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px 0; max-width: 26rem; margin: 0 auto; width: 100%;
}
.editor-zoom[hidden] { display: none; }
.editor-zoom input[type=range] { flex: 1; accent-color: #fbfbfc; }
button.zoom-step {
  background: none; border: none; color: #fbfbfc;
  font-size: 20px; line-height: 1; min-width: 44px; min-height: 44px;
  cursor: pointer;
}

.editor-hint {
  text-align: center; font-size: 13px; color: #8b97a3;
  padding: 16px 32px 28px; margin: 0;
}

/* --- quality floor -------------------------------------------------------- */

/* Keyboard focus, visible without following a mouse around. The custom
   buttons replace the browser's default appearance, which takes the default
   focus ring with it. */
:focus-visible {
  outline: 2px solid var(--marker);
  outline-offset: 2px;
  border-radius: 3px;
}
/* The picker is a label wrapping a hidden input, so focus lands on the input
   where nothing is visible. Put the ring on the label instead. */
label.button:has(input:focus-visible) {
  outline: 2px solid var(--marker);
  outline-offset: 2px;
}

/* Nothing here animates on its own, but Stripe's iframe does. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Touch targets. The stepper and the remove control are the smallest things
   on the page and the easiest to miss on a phone. */
button.step, button.remove { min-height: 44px; }

@media (min-width: 40rem) {
  /* A print is a small object; a checkout that spans a desktop monitor makes
     it feel like software. The column stays the width of a page of text. */
  main { padding-top: 40px; }
}


/* No Edit button: the thumbnail is the control. Tapping the picture to change
   the picture needs no label, and it gives the row its width back. */
button.thumb {
  padding: 0; border: .5px solid var(--rule);
}
button.thumb:hover { border-color: var(--soft); }

/* --- A school's storefront ------------------------------------------------
   The school's name where the wordmark goes, with ours small underneath: it
   is their shop, printed by us. */
header.school { text-align: center; padding: 14px 22px 2px; }
.school-name {
  font: 800 17px/1.3 Avenir-Heavy, Avenir, system-ui, sans-serif;
  color: var(--accent, var(--ink));
}
.printed-by { font-size: 12px; color: var(--faint); margin-top: 2px; }
.printed-by .mark { font-size: 11px; }
.storefront h1 { margin-top: 8px; }
.storefront h2 {
  font: 800 13px Avenir-Heavy, Avenir, system-ui, sans-serif;
  letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
  margin: 34px 0 10px;
}
.earns { color: var(--ink); }
.center { text-align: center; }
.steps, .ways { margin: 0; padding-left: 1.2em; color: var(--soft); }
.steps li, .ways li { margin-bottom: 6px; }
.ways strong { color: var(--ink); font-weight: 500; }
.faq dt { color: var(--ink); margin-top: 12px; }
.faq dd { margin: 2px 0 0; color: var(--soft); }
.faq a, .fine a { color: inherit; }

fieldset.delivery {
  border: 1px solid var(--line); border-radius: 4px;
  margin: 22px 0 0; padding: 12px 14px 14px;
}
fieldset.delivery legend { font-size: 13px; color: var(--faint); padding: 0 4px; }
.choice { display: flex; align-items: center; gap: 8px; margin: 4px 0; color: var(--ink); }
.choice input { width: auto; margin: 0; }
.dropoff[hidden] { display: none; }
.dropoff label { display: block; font-size: 13px; color: var(--soft); margin: 12px 0 4px; }
.dropoff input, .dropoff select {
  width: 100%; font: inherit; padding: 10px 12px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
