/*
 * Loaded after app.css in the Kindle build only. The Kindle browser is an old
 * WebKit without custom properties, flexbox or :has(), and renders pages at
 * the full 1072 px width with no zoom, so everything here uses plain values
 * and large sizes that are still easy to tap. See KINDLE.md.
 */

/* The Kindle has no dark mode, but browsers viewing the Kindle build (the
   emulator, ?build=kindle on a laptop) may pick app.css's dark colours, which
   then mix with the plain light colours below. Keep app.css's light colours.
   The Kindle itself ignores custom properties. */
:root {
    --page-background: white;
    --background: white;
    --foreground: black;
    --nav: gray;
    --original-title: gray;
    --icons-separator: #ccc;
    --search-bar: #ddd;
    --search-bar-outline: #ccc;
    --search-results-separator: #ddd;
    --highlighted-search-result: #f8f8f8;
    --h2: gray;
    --link: black;
    --attention: #810;
    --horizontal-rule: #aaa;
    --footer: #bbb;
}

html {
    font-size: 28px;
    font-family: Georgia, serif;
}
body {
    background-color: white;
    color: black;
}
a {
    color: black;
}

/* No cursor on the Kindle, and a tap can leave :hover stuck on, so undo
   app.css's hover effects. */
a:hover,
.servingsuggestion a:hover {
    opacity: 1;
}
.tag:hover,
.tag:disabled:hover {
    border: none;
}

/* Small print in the sans font, like on the web site: tags, the link back
   to the index, the recipe details line and the footer. Other text on the
   Kindle is serif (see html above). */
.tag,
header nav,
header ul,
footer.site {
    font-family: Barlow, Fabrikat, Helvetica, sans-serif;
    font-weight: 500;
}

/* Black text and underlined links. Set explicitly, since app.css makes the
   text grey and removes the underline. */
footer.site {
    margin: 1em 0 0.6em;
    font-size: 0.55rem;
    color: black;
}
footer.site a {
    text-decoration: underline;
}

/* Back-to-top link, shown by the script in app.html. The old Kindle browser
   treats position: fixed as static, so there it sits at the end of the page. */
#totop {
    font-family: Barlow, Fabrikat, Helvetica, sans-serif;
    font-size: 0.7rem;
    padding: 0.4em 0.8em;
    color: black;
    background-color: #ccc;
    border: solid 3px white;
}
#totop:hover {
    opacity: 1;
}

/* Index */

.kindle {
    padding: 0.4em 0.6em;
}
.kindle h1 {
    font-size: 1.3rem;
    margin: 1.5em 0em;
    text-align: center;
}
.kindle h1 a {
    text-decoration: none;
}
.kindle h1 small {
    font-size: 0.6em;
    font-weight: normal;
    color: #666;
    padding-left: 0.5em;
}

.kindle-letters {
    margin: 0 0 0.4em;
    font-size: 0.9rem;
    font-weight: bold;
}
.kindle-letters a,
.kindle-letters span {
    display: inline-block;
    min-width: 1.4em;
    padding: 0.15em 0;
    text-align: center;
    text-decoration: none;
}
.kindle-letters span {
    color: #bbb;
    font-weight: normal;
}

.kindle-tags {
    margin: 0 0 0.5em;
    font-size: 0.75rem;
}
.kindle-tags a,
.kindle-tags span.disabled {
    display: inline-block;
    padding: 0.2em 0.5em;
    margin: 0 0.25em 0.35em 0;
    border-radius: 0.2em;
    background-color: #ddd;
    text-decoration: none;
}
.kindle-tags a.selected {
    background-color: black;
    color: white;
}
.kindle-tags small {
    color: #444;  /* readable on the grey background */
}
.kindle-tags a.selected small {
    color: #ccc;
}
.kindle-tags span.disabled {
    color: #aaa;
    background-color: #eee;
}
.kindle-tags span.disabled small {
    color: #aaa;
}
.kindle-tags .clear {
    display: inline-block;
    padding: 0.2em 0.5em;
    border: 1px solid #888;
    border-radius: 0.2em;
    background-color: transparent;
}
.kindle-tags span.clear {
    color: #bbb;
    border-color: #ddd;
}

.kindle-list {
    overflow: hidden;  /* clearfix */
}
.kindle-list.wide {
    margin-top: 1.2em;  /* Paperwhite 4 only */
}
.kindle-list ul {
    float: left;
    width: 33.33%;
    margin: 0;
    padding-right: 0.6em;
    list-style: none;
}
/* Long titles wrap with a hanging indent, like ingredients on recipe pages.
   Vertical padding keeps one-line rows as tall as before, for tapping. */
.kindle-list li {
    line-height: 1.4;
    padding: 0.4em 0.1em 0.4em 1.4em;
    text-indent: -1em;
    border-bottom: 1px solid #ccc;
}
.kindle-list li.letter {
    font-weight: bold;
    border-bottom: 4px double black;
    padding-top: 1em;
    text-align: center;
}
.kindle-list li a {
    text-decoration: none;
}

/* Kindle 10 (600 px wide): two columns and a 25% smaller font. The index has
   one letter row and list per layout; show the one that fits. */
.kindle .narrow {
    display: none;
}
@media screen and (max-width: 700px) {
    html {
        font-size: 21px;
    }
    .kindle .wide {
        display: none;
    }
    .kindle .narrow {
        display: block;
    }
    .kindle-list ul {
        width: 50%;
    }
    .kindle-letters {
        font-size: 0.8rem;
    }
    .kindle-letters a,
    .kindle-letters span {
        min-width: 1.15em;  /* all 29 letters on one line */
    }
}

/* Recipe page. app.css sizes are relative to the root font size, which is
   larger here, so headings and spacing are set again and smaller. Its
   side-by-side step layout needs :has() and var(), so floats do it here. */

.recipe header {
    padding: 0.6em;
    margin-bottom: 0;
}
.recipe header nav {
    font-size: 0.6rem;
}
.recipe h1 {
    font-size: 1.3rem;
    margin: 1em 0 0.6em;
}
.recipe header ul {
    float: none;
    margin: 0 0 0.3em;
    font-size: 0.6rem;
}
.recipe header ul li {
    display: inline-block;
    padding: 0 0.6em 0 0;
    margin-right: 0.6em;
    border-right: 1px solid #888;
}
.recipe header ul li:last-child {
    border-right: none;
}

.tags {
    display: block;
    margin: 0.3em 0;
}
.tag {
    display: inline-block;
    font-size: 0.6rem;
    padding: 0.15em 0.45em;
    margin: 0 0.25em 0.3em 0;
    border: none;
    border-radius: 0.2em;
    background-color: #ddd;
}

.recipe section {
    max-width: none;
    margin: 0;
    padding: 0 0.6em;
    font-size: 0.85rem;
    line-height: 1.35;
}
.recipe section ul,
.recipe section p,
.recipe section blockquote {
    margin: .4em 0;
}
/* Steps: ingredients in the left 40%, instructions in the right 60%, also
   on the 600 px Kindle 10, where app.css would stack them. */
/* display: block undoes app.css's grid, in case the browser has it (the
   emulator, or a Kindle with the newer browser). The 40% and 60% below would
   otherwise apply within the grid columns and leave half of each empty. */
.recipe .step {
    display: block;
    padding: 1em 0;
    border-top: none; /* app.css puts a line above each step; here it goes below */
    border-bottom: 1px solid #aaa;
}
.recipe .step:first-child {
    border-top: 1px solid #aaa;
}
.recipe .ingredients {
    float: left;
    width: 40%;
    padding-right: 0.8em;
}
.recipe .instructions {
    float: right;
    width: 60%;
    margin-top: 0;
    font-size: 1.1em;
    line-height: 1.55;
}
.recipe .instructions p {
    margin: 0.64em 0; /* the same space as before the larger font */
}
.recipe .ingredients li {
    margin-bottom: 0.3em;
}
.recipe .ingredients::before {
    min-width: 1.4em;
    padding: 0;
    margin-bottom: 0.2em;
    color: white;
    background-color: black;
}
.recipe footer {
    margin: 1em 0;
    font-size: 0.6rem;
}
