/* Fonts (self-hosted, SIL Open Font License) */
@font-face { font-family: "Crimson"; src: url("fonts/crimson-300.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Crimson"; src: url("fonts/crimson-400.woff2") format("woff2"); font-weight: 400 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Crimson"; src: url("fonts/crimson-400-italic.woff2") format("woff2"); font-weight: 400 600; font-style: italic; font-display: swap; }
@font-face { font-family: "Jost"; src: url("fonts/jost-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jost"; src: url("fonts/jost-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

/* Ismaili Centre palette: ivory stone, carved lattice, champagne bronze */
:root {
  --bg: #f6f2eb;
  --white: #fffdf9;
  --ink: #3a332c;
  --muted: #8a8076;
  --hair: #e6ddcd;
  --hair-2: #d6c9b3;
  --emerald: #7a6340;
  --emerald-dark: #5a482c;
  --emerald-tint: #f1ebdf;
  --gold: #a88f62;
  --gold-tint: #f4ecdd;
  --danger: #9a3a2c;
  --serif: "Crimson", "Crimson Pro", Georgia, serif;
  --sans: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { font-variant-numeric: lining-nums; margin: 0; min-height: 100vh; color: var(--ink); font: 400 17px/1.6 var(--sans); background: var(--bg) url("bg.svg") repeat; background-size: 27px 36px;
       -webkit-font-smoothing: antialiased; }
a { color: var(--emerald); text-underline-offset: 4px; text-decoration-thickness: 1px; text-decoration-color: rgba(122,99,64,.35); }
h1 { font: 300 42px/1.1 var(--serif); color: var(--ink); margin: 6px 0 22px; letter-spacing: .005em; }
h2 { font: 400 27px/1.2 var(--serif); color: var(--ink); margin: 0 0 14px; }
main { max-width: 720px; margin: 0 auto; padding: 28px 20px 120px; }
[hidden] { display: none !important; }
::placeholder { color: #b0b4b1; }

/* Small-caps label style used for nav, labels, meta */
nav a, nav .linkbtn, label, .tile, .chip, table.ing th, .num.big, .btn {
  font-family: var(--sans); text-transform: uppercase; letter-spacing: .16em; }

/* header: centred wordmark, quiet nav, gold hairline */
header.top { position: sticky; top: 0; z-index: 10; background: rgba(246,242,235,.95);
             -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
             padding: max(12px, env(safe-area-inset-top)) 16px 0; border-bottom: 1px solid var(--hair-2); }
header.top::after { content: ""; display: block; height: 12px; margin: 0 -16px; background: url("band.svg") repeat-x; border-top: 1px solid var(--hair-2); }
.brand { position: relative; text-align: center; max-width: 720px; margin: 0 auto; }
.brand a { font: 300 28px/1.2 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: .02em; }
.who { position: absolute; right: 0; top: 8px; font: 400 11px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
nav { display: flex; justify-content: flex-start; gap: 0; overflow-x: auto; max-width: 720px; margin: 2px auto 0; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav > :first-child { margin-left: auto; }
nav > :last-child { margin-right: auto; }
nav a, nav .linkbtn { white-space: nowrap; padding: 8px 7px 11px; letter-spacing: .11em; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500;
                      border-bottom: 1px solid transparent; background: none; }
nav a.on { color: var(--emerald-dark); border-bottom-color: var(--gold); }
nav form { margin: 0; }
@media (max-width: 420px) { .who { display: none; } }

/* panels: plain white, one hairline, generous space */
.card { background: var(--white); border: 1px solid var(--hair); border-radius: 2px; padding: 28px 22px; margin: 0 0 22px;
        box-shadow: 0 18px 40px -32px rgba(29,38,35,.35); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hint { color: var(--muted); font-size: 15px; margin: -6px 0 14px; }
.flash { background: var(--emerald-tint); border-left: 2px solid var(--emerald); color: var(--emerald-dark); padding: 12px 16px; margin: 0 0 20px; }
.error { background: #fbefed; border-left: 2px solid var(--danger); color: var(--danger); padding: 12px 16px; }
.inline { display: inline; }

label { display: block; font-size: 11px; font-weight: 500; margin: 0 0 20px; color: var(--muted); }
label small { text-transform: none; letter-spacing: 0; font-size: 12px; color: #a0a5a2; }
input, select, textarea { display: block; width: 100%; margin-top: 8px; font: 400 17px/1.45 var(--sans); color: var(--ink); letter-spacing: 0; text-transform: none;
  background: var(--white); border: 1px solid var(--hair-2); border-radius: 2px; padding: 12px 14px; min-height: 50px; }
textarea { resize: vertical; }
textarea[name="special_instructions"] { font: italic 400 21px/1.5 var(--serif); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(168,143,98,.2); }
select { appearance: none; -webkit-appearance: none;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23a88f62' stroke-width='1.3'/%3E%3C/svg%3E") no-repeat right 14px center; padding-right: 36px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 10px 24px; font-size: 12px; font-weight: 500;
       border-radius: 2px; border: 1px solid var(--emerald); background: transparent; color: var(--emerald); text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--emerald); color: #fff; box-shadow: inset 0 0 0 1px var(--emerald), inset 0 0 0 3px rgba(255,248,232,.25); }
.btn.primary:active { background: var(--emerald-dark); }
.btn.wide { width: 100%; margin: 0 0 24px; }
.linkbtn { background: none; border: 0; padding: 8px 4px; font: 400 15px var(--sans); color: var(--emerald); cursor: pointer; }
.linkbtn.danger { color: var(--danger); }
.mini { min-width: 44px; min-height: 40px; border: 1px solid var(--hair-2); border-radius: 2px; background: #fff; font-size: 16px; color: var(--gold); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 24px; }

.chip { display: inline-block; font-size: 10px; font-weight: 500; padding: 3px 8px; border-radius: 1px; vertical-align: middle; }
.st-draft { color: #8a8378; border: 1px solid var(--hair-2); }
.st-clarify { color: #8a6526; border: 1px solid #e0cda8; background: var(--gold-tint); }
.st-collected { color: var(--emerald); border: 1px solid #c5dbd2; background: var(--emerald-tint); }
.num { display: inline-block; min-width: 2em; color: var(--gold); font: 400 18px var(--serif); }
.num.big { font-size: 11px; font-weight: 500; font-style: normal; color: var(--gold); min-width: 0; }
.meta { color: var(--muted); font-size: 14px; }

/* section headings: star ornament + hairline */
main > h2, .card > h2 { display: flex; align-items: center; gap: 12px; }
main > h2 { margin-top: 40px; }
main > h2::after, .card > h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--hair-2), transparent); }
main > h2::before, .card > h2::before { content: ""; width: 14px; height: 14px; flex: none; background: url("star.svg") no-repeat center / contain; }

/* login & setup */
.login { max-width: 400px; margin: 3vh auto 0; text-align: center; }
.login::before { content: ""; display: block; height: 230px; background: url("crest.svg") no-repeat center bottom / contain; margin: 0 -16px 18px; }
.login h1 { font: 300 54px/1.05 var(--serif); color: var(--ink); margin: 0 0 12px; letter-spacing: .01em; }
.login .sub { font: 500 11px/1.9 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin: 0 auto 30px; max-width: 300px; text-wrap: balance; }
.login .sub::after { content: ""; display: block; width: 18px; height: 18px; margin: 18px auto 0; background: url("star.svg") no-repeat center / contain; }
.login > form { text-align: left; background: var(--white); border: 1px solid var(--hair); padding: 30px 24px 8px; box-shadow: 0 24px 48px -36px rgba(29,38,35,.45); }
.login .error { text-align: left; margin-bottom: 16px; }
.login.wide { max-width: 560px; }
.login.wide > form { background: none; border: 0; padding: 0; box-shadow: none; }

/* dashboard */
.progress { text-align: center; }
.progress .big { font: 300 76px/1 var(--serif); color: var(--emerald-dark); }
.progress .big span { display: block; margin-top: 6px; font: italic 400 20px var(--serif); color: var(--muted); }
.bar { height: 2px; background: var(--hair); margin: 22px 0 8px; }
.bar .fill { height: 100%; width: 0; background: var(--gold); transition: width .4s; }
.progress > .muted { font-size: 13px; letter-spacing: .08em; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; margin-top: 22px; border-top: 1px solid var(--hair); }
.tile { display: block; padding: 16px 8px; text-decoration: none; color: var(--muted); font-size: 10px; font-weight: 500; text-align: center;
        border-bottom: 1px solid var(--hair); }
.tile:nth-child(odd) { border-right: 1px solid var(--hair); }
.tile b { display: block; font: 300 38px/1.1 var(--serif); color: var(--ink); letter-spacing: 0; text-transform: none; margin-bottom: 2px; }
ul.recent, ul.cats, ul.recipes { list-style: none; padding: 0; margin: 0; }
ul.recent li, ul.recipes li { padding: 14px 0; border-bottom: 1px solid var(--hair); }
ul.recent li:last-child, ul.recipes li:last-child, ul.cats li:last-child { border-bottom: 0; }
ul.recent a { text-decoration: none; color: var(--ink); font: 400 22px var(--serif); }
ul.cats li { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--hair); }
ul.cats a { font: 400 22px var(--serif); text-decoration: none; color: var(--ink); }

/* list */
.filters { display: grid; gap: 10px; margin-bottom: 10px; }
.filters input, .filters select { margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
ul.recipes li > a { display: flex; gap: 8px; align-items: baseline; text-decoration: none; color: var(--ink); font: 400 24px var(--serif); }
ul.recipes .t em { color: var(--muted); }

/* recipe view */
.rhead { margin-top: 4px; }
.family { font: italic 400 24px var(--serif); color: var(--gold); margin: -14px 0 10px; }
.facts span { margin-right: 18px; }
table.ing { width: 100%; border-collapse: collapse; font-size: 16px; }
table.ing th { text-align: left; font-size: 10px; font-weight: 500; color: var(--muted); padding: 0 8px 10px 0; border-bottom: 1px solid var(--gold); }
table.ing td { padding: 12px 8px 12px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
ol.steps { padding-left: 1.4em; }
ol.steps li { margin-bottom: 12px; padding-left: 4px; }
ol.steps li::marker { font: italic 400 20px var(--serif); color: var(--gold); }
.special { position: relative; background: var(--white); border: 1px solid var(--hair); padding: 48px 24px 24px; font: italic 400 23px/1.5 var(--serif); color: #2b3632; }
.special::before { content: "“"; position: absolute; top: 8px; left: 20px; font: 400 60px/1 var(--serif); color: var(--gold); }
.missing { background: var(--gold-tint); border-left: 2px solid var(--gold); padding: 14px 16px; margin-bottom: 20px; }
.missing h2 { font: 500 11px var(--sans); letter-spacing: .16em; text-transform: uppercase; color: #8a6526; margin-bottom: 6px; }
.missing h2::before, .missing h2::after { display: none; }
form.del { margin-top: 40px; }

ul.files { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
li.file { border: 1px solid var(--hair); padding: 8px; background: #fff; font-size: 13px; overflow-wrap: anywhere; }
li.file img { width: 100%; height: 140px; object-fit: cover; display: block; }
li.file audio { width: 100%; }
li.file .doc { display: flex; align-items: center; justify-content: center; height: 80px; background: var(--bg); font-weight: 500; letter-spacing: .1em; text-decoration: none; }
.fmeta { margin: 8px 0 2px; color: var(--muted); }
.fmeta b { color: var(--ink); font-weight: 500; }

/* edit form */
.ing-row { border: 1px solid var(--hair); padding: 12px; margin-bottom: 10px; display: grid; gap: 8px; grid-template-columns: 1fr 1fr; background: var(--bg); }
.ing-row input { margin: 0; }
.ing-row .i-item, .ing-row .i-notes { grid-column: 1 / -1; }
.ing-row .linkbtn { justify-self: start; }
ol.step-list { padding-left: 1.6em; margin: 0 0 12px; }
ol.step-list li::marker { font: italic 400 20px var(--serif); color: var(--gold); }
.step-row { margin-bottom: 14px; }
.step-row textarea { margin: 0; }
.step-tools { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.row3 { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 18px; }
.filepick input { padding: 10px; }
#upload-status { display: block; color: var(--muted); font-size: 15px; min-height: 1.5em; }

.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
           padding: 12px 20px max(12px, env(safe-area-inset-bottom)); background: rgba(250,248,244,.96);
           border-top: 1px solid var(--hair); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
#save-status { font-size: 13px; color: var(--muted); letter-spacing: .04em; }
#save-status.err { color: var(--danger); }

@media (min-width: 640px) {
  .ing-row { grid-template-columns: 2fr 1fr 1fr; }
  .ing-row .i-item { grid-column: auto; }
  .ing-row .i-notes { grid-column: 1 / 3; }
  .ing-row .linkbtn { align-self: center; }
  .row3 { grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .tile { border-right: 1px solid var(--hair); }
  .tile:last-child { border-right: 0; }
  .savebar { padding-left: calc(50% - 340px); padding-right: calc(50% - 340px); }
}

/* media panel */
.media .mtiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
.mtile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 104px; padding: 14px 10px;
         border: 1px solid var(--hair-2); background: var(--white); color: var(--emerald-dark); cursor: pointer; text-align: center;
         font: 500 11px/1.35 var(--sans); letter-spacing: .12em; text-transform: uppercase; -webkit-tap-highlight-color: transparent; border-radius: 2px; }
.mtile svg { color: var(--gold); }
.mtile:active { background: var(--gold-tint); }
.mtile.big { background: var(--emerald); color: #fff; border-color: var(--emerald); box-shadow: inset 0 0 0 3px rgba(255,248,232,.25); }
.mtile.big svg { color: #fff; }
.mtile.wide { grid-column: 1 / -1; min-height: 64px; flex-direction: row; }
.mtile.recording { background: #9a3a2c; border-color: #9a3a2c; color: #fff; }
.mtile.recording svg { color: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
#upload-box { margin: 0 0 14px; }
.ubar { height: 4px; background: var(--hair); margin-bottom: 8px; }
.ufill { height: 100%; width: 0; background: var(--gold); transition: width .3s; }
li.file.wide { grid-column: 1 / -1; }
li.file video { width: 100%; max-height: 420px; background: #000; display: block; }
