/* Recipe Box: a sample HTML app that is ready to become an Android APK.
   Every rule here follows htmltoapk.com/guides/make-html-mobile-ready-for-apk/ */
:root {
  --brand: #c96a4a;
  --brand-dark: #a9553a;
  --bg: #f6f1ea;
  --card: #ffffff;
  --text: #2b211b;
  --muted: #6f625a;
  --line: #eadfd4;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1d1916; --card: #2a2420; --text: #f3ece6; --muted: #b9aca3; --line: #3b332d; }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--bg); -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); }
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

/* header + menu */
.top { background: var(--brand); color: #fff; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.brand { color: #fff; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; min-height: 48px; }
.nav { display: flex; align-items: center; }
.nav a, .more summary {
  color: #fff; text-decoration: none; display: inline-flex; align-items: center;
  min-height: 48px; padding: 0 12px; cursor: pointer;
}
.nav a[aria-current="page"] { font-weight: 700; text-decoration: underline; text-underline-offset: 6px; }
.more { position: relative; }
.more summary { list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more ul {
  position: absolute; right: 0; top: 100%; z-index: 10; min-width: 190px; margin: 0; padding: 6px 0;
  list-style: none; background: var(--card); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.more ul a { color: var(--text); display: flex; min-height: 48px; padding: 0 16px; }

/* hero + search */
.hero { padding: 28px 0 20px; }
.hero h1 { font-size: clamp(28px, 7vw, 40px); line-height: 1.15; margin: 0 0 6px; }
.hero p { margin: 0 0 16px; color: var(--muted); }
.search { display: flex; gap: 8px; }
.search input {
  flex: 1; min-height: 48px; padding: 0 14px; font-size: 16px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}

/* recipe cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; padding: 8px 0 32px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card img { aspect-ratio: 16 / 10; width: 100%; object-fit: cover; }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card h2 { font-size: 19px; margin: 0; }
.card .meta { color: var(--muted); font-size: 15px; margin: 0 0 8px; }
.actions { display: flex; gap: 8px; margin-top: auto; }
.btn {
  flex: 1; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--brand);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; touch-action: manipulation;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn[aria-pressed="true"] { background: #fbeee8; border-color: var(--brand); }
.btn.primary[aria-pressed="true"] { color: var(--brand); }  /* a saved primary button keeps readable text */
@media (prefers-color-scheme: dark) { .btn[aria-pressed="true"] { background: #3a2a22; } }
@media (hover: hover) { .btn:hover { border-color: var(--brand); } .btn.primary:hover { background: var(--brand-dark); } }
.empty { padding: 32px 0; color: var(--muted); }

/* recipe page */
.recipe img.photo { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius); margin: 16px 0; }
.recipe h1 { font-size: clamp(28px, 7vw, 40px); line-height: 1.15; margin: 0; }
.recipe h2 { font-size: 21px; margin: 24px 0 8px; }
.recipe ol, .recipe ul { padding-left: 22px; }
.recipe li { margin: 6px 0; }
.back { display: inline-flex; align-items: center; min-height: 48px; text-decoration: none; font-weight: 600; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; background: var(--card); min-width: 100%; }
th, td { border: 1px solid var(--line); padding: 10px 12px; white-space: nowrap; text-align: left; }
p, li, td { overflow-wrap: anywhere; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; transition: .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
footer { color: var(--muted); padding: 24px 0 32px; font-size: 15px; }
