/* A family recipe book: warm paper, ink, and the same Amiri headings as the PDF.
   Large text and big targets, for older users. */
:root {
    --paper: #f3eadc;
    --sheet: #fcf8f1;
    --ink: #2a1f17;
    --ink-soft: #6e5c4c;
    --rule: #cdbba2;
    --line: #e7dbc8;
    --field: #fffdf9;
    --field-border: #b6a287;
    --paprika: #a3432a;
    --paprika-dark: #82331f;
    --olive: #4f6528;
    --olive-bg: #edf0df;
    --error: #9f2a1c;
    --error-bg: #f7e3da;
    --display: "Amiri", "Noto Naskh Arabic", serif;
    --text: "Noto Naskh Arabic", "Amiri", "Segoe UI", Tahoma, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    padding: 28px 16px 56px;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--text);
    font-size: 20px;
    line-height: 1.75;
}

h1, h2, h3, legend { font-family: var(--display); font-weight: 700; line-height: 1.35; }
h1 { font-size: 2.1em; margin: 0 0 6px; }
.intro { color: var(--ink-soft); margin: 0 0 8px; }
.big { font-size: 1.15em; }
.center { text-align: center; }
.optional, .hint { font-size: 0.8em; font-weight: 400; color: var(--ink-soft); }
.hint::before { content: "— "; }

/* ==========================================
   Masthead: the book's title page
   ========================================== */
.masthead { max-width: 760px; margin: 0 auto 30px; text-align: center; }
.kicker { margin: 0; color: var(--ink-soft); font-size: 0.9em; letter-spacing: 0.02em; }
.book-title {
    display: inline-block;
    font-family: var(--display);
    font-size: 2.6em;
    font-weight: 700;
    line-height: 1.2;
    color: var(--ink);
    text-decoration: none;
}
.book-title::after {
    content: "";
    display: block;
    width: 140px;
    height: 7px;
    margin: 10px auto 0;
    border-top: 1px solid var(--paprika);
    border-bottom: 1px solid var(--paprika);
}
.tabs { display: flex; justify-content: center; gap: 6px; margin-top: 18px; }
.tabs a {
    padding: 8px 18px 6px;
    color: var(--ink-soft);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 3px solid transparent;
}
.tabs a:hover { color: var(--ink); border-bottom-color: var(--rule); }
.tabs a[aria-current="page"] { color: var(--paprika); border-bottom-color: var(--paprika); }

/* ==========================================
   The sheet: a page with a double frame
   ========================================== */
.sheet {
    max-width: 760px;
    margin: 0 auto;
    padding: 44px 48px 48px;
    background: var(--sheet);
    border: 1px solid var(--rule);
    outline: 1px solid var(--rule);
    outline-offset: 5px;
}
.sheet.narrow { max-width: 460px; }

/* ==========================================
   Form
   ========================================== */
fieldset { border: 0; padding: 0; margin: 40px 0 0; min-width: 0; }
legend {
    display: block;
    width: 100%;
    padding: 0 0 4px;
    margin-bottom: 6px;
    font-size: 1.55em;
    color: var(--paprika);
    border-bottom: 1px solid var(--rule);
}
legend .optional { font-family: var(--text); font-size: 0.55em; }

.row { display: flex; gap: 0 20px; flex-wrap: wrap; }
.col { flex: 1 1 190px; }

label { display: block; margin: 18px 0 6px; font-weight: 600; }

input, textarea, select {
    width: 100%;
    padding: 10px 14px;
    font: inherit;
    color: var(--ink);
    background: var(--field);
    border: 1.5px solid var(--field-border);
    border-radius: 4px;
}
input::placeholder, textarea::placeholder { color: #a8998a; }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--paprika);
    box-shadow: 0 0 0 3px rgba(163, 67, 42, 0.18);
}
/* Ruled lines, like a recipe card: one ingredient or step per line */
textarea {
    resize: vertical;
    line-height: 1.9em;
    padding: 0.35em 14px;
    background-image: repeating-linear-gradient(
        to bottom, transparent 0, transparent calc(1.9em - 1px), var(--line) calc(1.9em - 1px), var(--line) 1.9em);
    background-position: 0 0.35em;
    background-attachment: local;
}

/* ==========================================
   Buttons and links
   ========================================== */
button, .button {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 15px 20px;
    font: inherit;
    font-size: 1.15em;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    color: var(--sheet);
    background: var(--paprika);
    border: 1.5px solid var(--paprika);
    border-radius: 4px;
    cursor: pointer;
}
button:hover, .button:hover { background: var(--paprika-dark); border-color: var(--paprika-dark); }
button:disabled { background: var(--ink-soft); border-color: var(--ink-soft); cursor: wait; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(163, 67, 42, 0.45); outline-offset: 2px; }
#save { margin-top: 44px; padding: 18px 20px; font-size: 1.25em; }

.secondary-button, .secondary {
    display: block;
    margin-top: 14px;
    padding: 13px 20px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    background: transparent;
    border: 1.5px solid var(--ink);
    border-radius: 4px;
}
.secondary-button:hover, .secondary:hover { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.secondary { margin-top: 32px; }

.link-button {
    width: auto;
    margin: 8px 0 0;
    padding: 4px 0;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--paprika);
    background: none;
    border: 0;
    text-decoration: underline;
    text-underline-offset: 5px;
}
.link-button:hover { background: none; color: var(--paprika-dark); }

/* ==========================================
   Messages
   ========================================== */
.error, .hint-box {
    margin: 18px 0;
    padding: 12px 16px;
    border-inline-start: 4px solid;
}
.error { color: var(--error); background: var(--error-bg); font-weight: 600; }
.hint-box { color: var(--olive); background: var(--olive-bg); }

/* New-category card */
.panel {
    margin: 22px 0 4px;
    padding: 4px 22px 22px;
    background: #f6eee1;
    border: 1.5px dashed var(--field-border);
}
.panel h2 { margin: 14px 0 0; font-size: 1.35em; color: var(--paprika); }

/* After saving */
#done h1 { color: var(--olive); }
#done .big { margin: 18px 0; }

/* ==========================================
   Browse page: like the book's table of contents
   ========================================== */
.main-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 44px 0 6px;
    font-size: 1.65em;
    color: var(--paprika);
}
.main-section::before, .main-section::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.sub-section { margin: 22px 0 4px; font-size: 1.3em; }
.recipe-links { list-style: none; margin: 0; padding: 0; }
.recipe-links a {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 9px 0;
    font-size: 1.05em;
    color: var(--ink);
    text-decoration: none;
}
.recipe-links a::after { content: ""; flex: 1; border-bottom: 2px dotted var(--rule); }
.recipe-links a:hover { color: var(--paprika); }
.recipe-links a:hover::after { border-bottom-color: var(--paprika); }
.delete-hint { margin-top: 44px; padding-top: 14px; border-top: 1px solid var(--rule); }

/* ==========================================
   One recipe
   ========================================== */
#back { display: inline-block; width: auto; margin: 0 0 8px; padding: 8px 16px; font-size: 0.95em; }
#recipe-view h1 { margin: 22px 0 0; font-size: 2.3em; text-align: center; }
#recipe-view h1::after {
    content: "";
    display: block;
    width: 70px;
    margin: 12px auto 0;
    border-top: 2px solid var(--paprika);
}
#recipe-view h2 {
    margin: 34px 0 8px;
    padding-bottom: 4px;
    font-size: 1.45em;
    color: var(--paprika);
    border-bottom: 1px solid var(--rule);
}
#recipe-view h4 { margin: 18px 0 2px; font-size: 1em; }
#recipe-view ul, #recipe-view ol { margin: 6px 0; padding-inline-start: 1.6em; }
#recipe-view li { margin: 6px 0; padding-inline-start: 6px; }
#recipe-view li::marker { color: var(--paprika); }
#recipe-view ol { list-style: arabic-indic; }
#recipe-view ol li::marker { font-weight: 700; }

.facts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 26px 0 0;
    padding: 10px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.facts > div { padding: 4px 22px; text-align: center; }
.facts > div + div { border-inline-start: 1px solid var(--line); }
.facts dt { font-size: 0.8em; color: var(--ink-soft); }
.facts dd { margin: 0; font-weight: 700; }

.notes { margin-top: 34px; padding: 4px 22px 14px; border: 1.5px solid var(--ink); }
.notes h2 { border-bottom: 0 !important; }

button.danger-button {
    color: var(--error);
    background: transparent;
    border: 1.5px solid var(--error);
}
button.danger-button:hover { color: var(--sheet); background: var(--error); border-color: var(--error); }
button.danger-button.small { display: inline-block; width: auto; margin: 4px 0 0; padding: 6px 16px; font-size: 0.85em; }
#delete-recipe { margin-top: 48px; }

/* ==========================================
   Phones
   ========================================== */
@media (max-width: 600px) {
    body { padding: 18px 12px 40px; font-size: 19px; }
    .book-title { font-size: 2.2em; }
    .tabs { margin-top: 14px; }
    .tabs a { flex: 1; padding: 8px 6px 6px; }
    .sheet { padding: 26px 18px 30px; outline-offset: 3px; }
    h1 { font-size: 1.8em; }
    #recipe-view h1 { font-size: 1.9em; }
    .facts > div { padding: 4px 14px; }
}
