/* Runs on iPadOS 13 Safari: no flex gap, no inset, no aspect-ratio. */

@font-face {
  font-family: 'Literata';
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/literata-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Literata';
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/literata-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo Narrow';
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/archivo-narrow-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo Narrow';
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/archivo-narrow-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #E8E8E3;
  --ink: #111111;
  --done: #62625E;
  --serif: 'Literata', Charter, Georgia, serif;
  --sans: 'Archivo Narrow', 'Avenir Next Condensed', 'Arial Narrow', sans-serif;
}

html, body { height: 100%; margin: 0; }
body {
  /* The strip under the iPad status bar stays black, so the clock reads white on it. */
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top);
  background: var(--ink);
  color: var(--ink);
  font-family: var(--serif);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
#app { display: flex; flex-direction: column; height: 100%; background: var(--paper); overflow: hidden; }
a { color: var(--ink); text-decoration: none; }
svg { display: block; width: 26px; height: 26px; }

header { flex: none; display: flex; align-items: center; height: 72px; }
h1 {
  flex: 1; min-width: 0; margin: 0 20px 0 16px;
  font-size: 32px; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.back { flex: none; display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; background: var(--ink); color: var(--paper); }
.tool {
  flex: none; display: flex; align-items: center; justify-content: center; width: 60px; height: 72px; margin: 0; padding: 0;
  border: 0; border-left: 1px solid var(--ink); border-radius: 0; background: none; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
.tool.on { background: var(--ink); color: var(--paper); }
.factor { flex: none; width: 64px; height: 72px; border-left: 1px solid var(--ink); text-align: center; font: 700 24px/72px var(--sans); }

/* Home: the alphabet. A recipe is filed under every word you might look it up by. */
.letters { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); border-top: 4px solid var(--ink); }
.letters > * { position: relative; display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); font-size: 80px; line-height: 1; font-weight: 800; }
.letters .off { color: #BDBDB6; }
.letters .count { position: absolute; top: 10px; right: 12px; font: 600 17px var(--sans); }
.letters .all { grid-column: span 2; font: 700 22px var(--sans); letter-spacing: 0.1em; text-transform: uppercase; }

/* One letter: recipes with a photo as square tiles, the rest as a list below. */
.browse { flex: 1; min-height: 0; padding: 16px; border-top: 4px solid var(--ink); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-gap: 16px; margin-bottom: 20px; }
.photo { position: relative; display: block; margin-bottom: 8px; padding-top: 100%; background: #D2D2CC; }
.photo img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.rows { -webkit-columns: 3; columns: 3; -webkit-column-gap: 24px; column-gap: 24px; border-top: 1px solid var(--ink); }
.rows a { display: block; padding: 12px 0 11px; border-bottom: 1px solid var(--ink); -webkit-column-break-inside: avoid; break-inside: avoid; }
.name { display: block; font: 400 19px/21px var(--sans); }
.name strong { font-weight: 700; }

/* Every recipe on one screen, alphabetical down the columns. */
.index { flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); column-gap: 24px; padding: 0 16px; border-top: 4px solid var(--ink); }
.index a { display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 8px; align-items: center; min-height: 0; border-bottom: 1px solid var(--ink); }
.index .name { max-height: 42px; overflow: hidden; }
.initial { font-size: 22px; line-height: 1; font-weight: 800; }

/* Cook screen. Sizes are in em: app.js sets the font size to the largest that fits the page. */
.body { flex: 1; min-height: 0; display: flex; border-top: 4px solid var(--ink); font-size: 21px; }
.steps { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.step {
  flex: 1 0 auto; display: block; width: 100%; margin: 0; padding: 0;
  border: 0; border-top: 1px solid var(--ink); border-radius: 0;
  background: none; color: var(--ink); font: inherit; text-align: left;
  -webkit-appearance: none; appearance: none;
}
.step:first-child { border-top-width: 0; }
.step.group, .step.group + .step { border-top-width: 4px; }
.step.group:first-child { border-top-width: 0; }
.done { color: var(--done); }
.current { background: var(--ink); color: var(--paper); }
.row { display: grid; grid-template-columns: 3.1em minmax(0, 1.15fr) minmax(0, 1fr); column-gap: 1em; align-items: center; padding: 0.48em 16px; }
.split .row { grid-template-columns: 2em minmax(0, 1fr); }

.mark { display: flex; align-items: center; font-family: var(--sans); font-weight: 700; }
.label {
  flex: none; width: 1.15em; margin-right: 0.75em;
  font-size: 0.62em; line-height: 1.15; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap;
  -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; transform: rotate(180deg);
}
.num { font-size: 1.6em; line-height: 1; }
.check { display: none; }
.check svg { width: 1.45em; height: 1.45em; }
.step.done .num { display: none; }
.step.done .check { display: block; }

.ings { display: block; font-family: var(--sans); line-height: 1.29; }
/* CSS columns, not a grid: a wrapped name in one column must not open a gap in the other. */
.ings.two { -webkit-column-count: 2; column-count: 2; -webkit-column-gap: 0.8em; column-gap: 0.8em; }
/* The quantity column widens for the odd long one ("4½–6 cups") instead of running into the name. */
.ing { display: grid; grid-template-columns: minmax(3.5em, max-content) minmax(0, 1fr); column-gap: 0.5em; -webkit-column-break-inside: avoid; break-inside: avoid; }
.qty { text-align: right; white-space: nowrap; }
.ing strong { font-weight: 700; }
.text { line-height: 1.33; }

.list { flex: none; width: 37%; box-sizing: border-box; padding: 0.5em 0; border-right: 1px solid var(--ink); overflow: hidden; font-family: var(--sans); line-height: 1.29; }
.list h2 { margin: 0.9em 0 0.25em; padding-left: calc(4em / 0.68 + 16px / 0.68); font-size: 0.68em; line-height: 1.2; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.list h2:first-child { margin-top: 0.2em; }
.list .ing { padding: 0 16px; }

.finish { flex: none; height: 56px; border-top: 4px solid var(--ink); text-align: center; font: 700 20px/56px var(--sans); letter-spacing: 0.12em; text-transform: uppercase; }

/* Shown once per device, when the recipes answer 401: the key from the invite link. */
.gate { align-items: center; justify-content: center; }
.gate form { width: 360px; }
.gate h1 { margin: 0 0 20px; }
.gate input, .gate button {
  display: block; box-sizing: border-box; width: 100%; height: 56px; margin: 0 0 12px; padding: 0 14px;
  border: 3px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink);
  font: 400 22px var(--sans); -webkit-appearance: none; appearance: none;
  /* The body switches text selection off, which on iOS also blocks typing. */
  -webkit-user-select: text; user-select: text;
}
.gate button { background: var(--ink); color: var(--paper); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.gate p { margin: 0; font: 400 19px var(--sans); }
