/* ============================================================
   Morris Family Recipes
   Design: recipe-box index cards. Paper white, ballpoint ink,
   card ruling blue, jam-berry accent. Type is set large --
   much of the family reading this is over 70.
   ============================================================ */

:root {
    --paper:      #FBF9FB;
    --card:       #FFFFFF;
    --ink:        #2A2233;   /* deep aubergine -- primary text */
    --ink-soft:   #675A72;
    --rule:       #DCCFE4;   /* card ruling, lavender-tinted */
    --lilac:      #9E7CB0;   /* the accent line down each card, from the logo */
    --plum:       #481A65;   /* the logo's script purple */
    --plum-dark:  #35124B;
    --plum-light: #7A4A94;
    --edge:       #E6DFE9;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: Karla, "Segoe UI", -apple-system, Helvetica, Arial, sans-serif;
    font-size: 18px;      /* legibility floor */
    line-height: 1.6;
}

h1, h2, h3, .display {
    font-family: Fraunces, Georgia, "Times New Roman", serif;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 .5em 0;
}

a { color: var(--plum); }
a:hover { color: var(--plum-dark); }

:focus-visible {
    outline: 3px solid var(--plum);
    outline-offset: 2px;
}

.wrap {
    max-width: 880px;
    margin: 0 auto;
    padding: 24px 18px 60px;
}

/* ---------- Site header ---------- */
.site-head {
    border-bottom: 2px solid var(--edge);
    background: var(--card);
}
.site-head .inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.site-head .brand {
    font-family: Fraunces, Georgia, serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}
.site-head .brand img { max-height: 52px; width: auto; display: block; }
.site-head nav { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    background: var(--plum);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 12px 20px;
    font-family: inherit;
    font-size: 17px;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.3;
}
.btn:hover { background: var(--plum-dark); color: #fff; }
.btn.ghost {
    background: transparent;
    color: var(--ink);
    border: 2px solid var(--edge);
}
.btn.ghost:hover { background: #F3EEF6; color: var(--ink); }
.btn.alt { background: var(--plum-light); }
.btn.alt:hover { background: #613878; }
.btn.danger { background: #9B3231; }
.btn.danger:hover { background: #7C2827; }
.btn.small { padding: 7px 14px; font-size: 15px; }
.btn.big { padding: 20px 26px; font-size: 20px; }

/* ---------- Home ---------- */
.home-hero {
    text-align: center;
    padding: 40px 0 10px;
}
.home-hero .logo-slot img { max-width: 400px; width: 100%; height: auto; }
.home-hero h1 { font-size: 42px; margin-bottom: .15em; }
.home-hero .tagline {
    color: var(--ink-soft);
    font-size: 19px;
    margin: 0 0 28px;
}
.home-search { max-width: 560px; margin: 0 auto 26px; display: flex; gap: 8px; }
.home-search input {
    flex: 1;
    padding: 15px 16px;
    font-size: 19px;
    font-family: inherit;
    border: 2px solid var(--edge);
    border-radius: 4px;
    background: var(--card);
    color: var(--ink);
}
.home-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 44px;
}

.section-title {
    font-family: Fraunces, Georgia, serif;
    font-size: 24px;
    border-bottom: 2px solid var(--edge);
    padding-bottom: 8px;
    margin: 0 0 18px;
}

/* ---------- Recipe cards grid (home "recently added") ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.mini-card {
    display: block;
    background: var(--card);
    border: 1px solid var(--edge);
    border-left: 5px solid var(--lilac);
    border-radius: 3px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--ink);
}
.mini-card:hover { background: #FCF9FD; color: var(--ink); }
.mini-card .t {
    font-family: Fraunces, Georgia, serif;
    font-size: 20px;
    display: block;
    margin-bottom: 3px;
}
.mini-card .by { color: var(--ink-soft); font-size: 15px; }

/* ---------- Filters ---------- */
.filters {
    background: var(--card);
    border: 1px solid var(--edge);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.filters .field { display: flex; flex-direction: column; flex: 1 1 150px; }
.filters .field.grow { flex: 2 1 220px; }
.filters label {
    font-size: 14px;
    color: var(--ink-soft);
    margin-bottom: 4px;
    letter-spacing: .02em;
}
.filters input[type=text],
.filters select {
    padding: 11px 12px;
    font-size: 17px;
    font-family: inherit;
    border: 2px solid var(--edge);
    border-radius: 4px;
    background: var(--card);
    color: var(--ink);
    width: 100%;
}

/* ---------- Result list ---------- */
.result-count { color: var(--ink-soft); margin-bottom: 14px; }

.recipe-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card);
    border: 1px solid var(--edge);
    border-left: 5px solid var(--lilac);
    border-radius: 3px;
    padding: 14px 16px;
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--ink);
}
.recipe-row:hover { background: #FCF9FD; color: var(--ink); }
.recipe-row .thumb {
    width: 62px; height: 62px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid var(--edge);
    flex-shrink: 0;
}
.recipe-row .body { flex: 1; min-width: 0; }
.recipe-row .name {
    font-family: Fraunces, Georgia, serif;
    font-size: 21px;
    display: block;
}
.recipe-row .by { color: var(--ink-soft); font-size: 15px; }

.pill {
    display: inline-block;
    background: #F2EAF6;
    color: #4E3560;
    border: 1px solid var(--rule);
    font-size: 13px;
    padding: 2px 9px;
    border-radius: 999px;
    margin: 4px 4px 0 0;
}

.sort-bar { margin-bottom: 14px; font-size: 16px; color: var(--ink-soft); }
.sort-bar a { margin-right: 12px; text-decoration: none; }
.sort-bar a.on { font-weight: 700; text-decoration: underline; }

.empty {
    background: var(--card);
    border: 1px dashed var(--edge);
    border-radius: 4px;
    padding: 44px 20px;
    text-align: center;
    color: var(--ink-soft);
}

/* ---------- Recipe view: the index card ---------- */
.recipe-card {
    background: var(--card);
    border: 1px solid var(--edge);
    border-radius: 3px;
    padding: 0;
    overflow: hidden;
}
.recipe-card .card-head {
    padding: 26px 28px 20px 34px;
    border-bottom: 2px solid var(--rule);
    position: relative;
}
.recipe-card .card-head::before,
.recipe-body::before {
    content: "";
    position: absolute;
    left: 18px; top: 0; bottom: 0;
    width: 2px;
    background: var(--lilac);
}
.recipe-card h1 { font-size: 36px; margin-bottom: 6px; }
.recipe-card .credit {
    font-size: 18px;
    color: var(--ink-soft);
    margin: 0;
}
.recipe-card .credit strong { color: var(--ink); font-weight: 600; }

.recipe-body {
    position: relative;
    padding: 24px 28px 30px 34px;
}
.recipe-body h2 {
    font-size: 22px;
    margin: 26px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--rule);
}
.recipe-body h2:first-child { margin-top: 0; }

.handwriting-photo {
    display: block;
    width: 100%;
    max-height: 460px;
    object-fit: contain;
    background: #F4EFF6;
    border-bottom: 2px solid var(--rule);
}
.photo-caption {
    font-size: 15px;
    color: var(--ink-soft);
    text-align: center;
    padding: 8px 14px 0;
    font-style: italic;
}

/* Ingredient checklist -- tap to cross off while cooking */
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { border-bottom: 1px solid #F1EBF4; }
.check-list label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 4px;
    cursor: pointer;
    font-size: 19px;
}
.check-list input { width: 22px; height: 22px; margin-top: 4px; flex-shrink: 0; accent-color: var(--plum-light); }
.check-list input:checked + span { text-decoration: line-through; color: #A398AB; }

.step-list { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.step-list li {
    counter-increment: step;
    display: flex;
    gap: 14px;
    padding: 12px 0;
    font-size: 19px;
    border-bottom: 1px solid #F1EBF4;
}
.step-list li::before {
    content: counter(step);
    font-family: Fraunces, Georgia, serif;
    font-size: 19px;
    color: var(--plum);
    background: #F1E8F6;
    border-radius: 50%;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
}

.notes-block {
    background: #F7F3F9;
    border-left: 4px solid var(--plum-light);
    padding: 14px 16px;
    border-radius: 3px;
    white-space: pre-wrap;
}

.recipe-foot {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 20px 28px 26px 34px;
    border-top: 2px solid var(--rule);
    background: #FBF8FC;
}

/* ---------- Forms ---------- */
.panel {
    background: var(--card);
    border: 1px solid var(--edge);
    border-radius: 4px;
    padding: 22px 24px;
    margin-bottom: 20px;
}
.panel h2 { font-size: 22px; margin-bottom: 4px; }
.panel .hint { color: var(--ink-soft); font-size: 16px; margin: 0 0 16px; }

.fld { margin-bottom: 20px; }
.fld > label {
    display: block;
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
}
.fld .sub {
    display: block;
    font-weight: 400;
    font-size: 15px;
    color: var(--ink-soft);
    margin-bottom: 8px;
}
.fld input[type=text],
.fld input[type=password],
.fld select,
.fld textarea {
    width: 100%;
    padding: 13px 14px;
    font-size: 18px;
    font-family: inherit;
    border: 2px solid var(--edge);
    border-radius: 4px;
    background: var(--card);
    color: var(--ink);
}
.fld textarea { line-height: 1.7; resize: vertical; }
.fld input[type=file] { font-size: 16px; }

.tag-cols { display: flex; flex-wrap: wrap; gap: 26px; }
.tag-col { min-width: 190px; flex: 1; }
.tag-col h4 {
    font-family: Karla, sans-serif;
    font-size: 14px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 0 0 8px;
}
.tag-col label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 0;
    font-size: 17px;
    cursor: pointer;
}
.tag-col input { width: 20px; height: 20px; accent-color: var(--plum-light); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.notice {
    border-radius: 4px;
    padding: 14px 16px;
    margin-bottom: 18px;
    border: 1px solid;
}
.notice.ok   { background: #F0EAF4; border-color: #C6B0D4; color: #452A55; }
.notice.bad  { background: #FBEEEE; border-color: #E0B4B4; color: #7C2827; }

/* ---------- Edit confirmation modal ---------- */
.modal-veil {
    position: fixed;
    inset: 0;
    background: rgba(42, 34, 51, .55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 60;
}
.modal-veil.open { display: flex; }
.modal {
    background: var(--card);
    border-radius: 5px;
    border-left: 6px solid var(--lilac);
    max-width: 470px;
    width: 100%;
    padding: 28px;
    box-shadow: 0 16px 44px rgba(42, 34, 51, .3);
}
.modal h3 { font-size: 24px; margin-bottom: 10px; }
.modal p { font-size: 18px; margin: 0 0 8px; }
.modal .who { color: var(--ink-soft); font-size: 16px; }
.modal .modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
    flex-wrap: wrap;
}

/* ---------- Admin ---------- */
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
table.data { width: 100%; border-collapse: collapse; background: var(--card); }
table.data th, table.data td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--edge);
    font-size: 16px;
    vertical-align: middle;
}
table.data th { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }

.merge-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.merge-row .field { flex: 1 1 200px; display: flex; flex-direction: column; }

/* ---------- Footer ---------- */
.site-foot {
    border-top: 2px solid var(--edge);
    margin-top: 40px;
    padding: 20px 18px 34px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 15px;
}
.site-foot a { color: var(--ink-soft); }

/* ---------- Mobile ---------- */
@media (max-width: 620px) {
    body { font-size: 17px; }
    .home-hero h1 { font-size: 32px; }
    .recipe-card h1 { font-size: 28px; }
    .recipe-card .card-head { padding: 20px 18px 16px 28px; }
    .recipe-body { padding: 20px 18px 26px 28px; }
    .recipe-foot { padding: 18px; }
    .home-actions .btn { width: 100%; }
}

/* ============================================================
   PRINT -- book layout. One recipe per page, no site chrome.
   ============================================================ */
@media print {
    body { background: #fff; font-size: 12pt; color: #000; }
    .site-head, .site-foot, .recipe-foot, .no-print, .filters, .sort-bar { display: none !important; }
    .wrap { max-width: none; padding: 0; }

    .print-recipe {
        page-break-after: always;
        break-after: page;
        padding: 0 0 12pt;
    }
    .print-recipe:last-child { page-break-after: auto; break-after: auto; }

    .print-recipe h1 { font-size: 22pt; margin-bottom: 2pt; }
    .print-recipe .credit { font-size: 11pt; font-style: italic; margin-bottom: 12pt; }
    .print-recipe h2 {
        font-size: 13pt;
        border-bottom: 1pt solid #999;
        padding-bottom: 2pt;
        margin: 14pt 0 6pt;
    }
    .print-recipe ul, .print-recipe ol { margin: 0; padding-left: 18pt; }
    .print-recipe li { margin-bottom: 4pt; }
    .print-recipe img { max-width: 60%; max-height: 3.2in; }

    .recipe-card, .panel { border: none; box-shadow: none; }
    .check-list input { display: none; }
    a { text-decoration: none; color: #000; }
}

/* Label that's read by screen readers but not shown on screen. */
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}