/* Recipe Box — warm kitchen / index-card aesthetic. */

:root {
  --bg: #f3ead9;
  --bg-deep: #eadfc8;
  --ink: #3d2f26;
  --ink-soft: #7a6a5c;
  --paper: #fffdf4;
  --paper-edge: #e4d9bf;
  --red: #c0503c;         /* the top rule on an index card */
  --red-deep: #a4552e;
  --accent: #b3672f;      /* kraft/caramel */
  --accent-soft: #f0dfc4;
  --shadow: 0 2px 10px rgba(80, 55, 30, .12), 0 1px 2px rgba(80, 55, 30, .10);
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background:
    radial-gradient(1200px 500px at 70% -10%, #fbf3e2 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  line-height: 1.55;
  min-height: 100%;
}

.hand { font-family: 'Caveat', cursive; font-weight: 700; letter-spacing: .3px; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
.count { font-size: .6em; color: var(--ink-soft); font-family: 'Nunito', sans-serif; font-weight: 600; }
.opt { font-weight: 400; color: var(--ink-soft); font-size: .85em; }

a { color: var(--red-deep); }

/* ── Top bar ─────────────────────────────────────────────────────────────── */

#topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem clamp(.8rem, 3vw, 1.6rem);
  background: rgba(243, 234, 217, .92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--paper-edge);
}

.brand {
  font-family: 'Caveat', cursive; font-weight: 700; font-size: 1.5rem;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}

.tabs { display: flex; gap: .25rem; flex: 1; min-width: 0; overflow-x: auto; }
.tabs a {
  position: relative;
  padding: .35rem .7rem; border-radius: 999px;
  color: var(--ink-soft); text-decoration: none;
  font-weight: 700; font-size: .9rem; white-space: nowrap;
}
.tabs a.active { background: var(--accent-soft); color: var(--red-deep); }
.tab-badge {
  display: inline-block; margin-left: .35rem;
  background: var(--red); color: #fff;
  border-radius: 999px; font-size: .7rem; line-height: 1;
  padding: .2rem .45rem; vertical-align: middle;
}

.account-btn {
  margin-left: auto;
  border: 1.5px solid var(--red-deep); background: transparent; color: var(--red-deep);
  font: 700 .85rem 'Nunito', sans-serif;
  padding: .4rem .9rem; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.account-btn:hover { background: var(--red-deep); color: #fff; }

/* Hamburger — hidden on desktop, replaces the tab row on phones. */
.menu-btn {
  position: relative;
  display: none;
  border: 1.5px solid var(--paper-edge); background: var(--paper); color: var(--ink);
  font-size: 1.05rem; line-height: 1;
  padding: .4rem .65rem; border-radius: 8px; cursor: pointer;
}
.menu-btn.menu-btn-alert::after {
  content: ''; position: absolute; top: -4px; right: -4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--bg);
}

/* ── Buttons & chips ─────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: none; border-radius: 999px; cursor: pointer;
  font: 700 .92rem 'Nunito', sans-serif; text-decoration: none;
  padding: .55rem 1.15rem;
  transition: transform .06s ease, box-shadow .12s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--red-deep); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: #8f4826; }
.btn-ghost { background: transparent; color: var(--red-deep); border: 1.5px solid rgba(164, 85, 46, .45); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { color: #9c2f22; border-color: rgba(156, 47, 34, .4); }
.btn-danger:hover { background: #f6ded9; }
.btn-sm { font-size: .8rem; padding: .35rem .8rem; }
.btn-big { font-size: 1.05rem; padding: .75rem 1.6rem; }
.btn-block { width: 100%; }
.btn-google { width: 100%; background: #fff; border: 1.5px solid var(--paper-edge); color: var(--ink); }
.btn-google:hover { border-color: var(--ink-soft); }

.linklike {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--red-deep); font: 700 .9rem 'Nunito', sans-serif;
  text-decoration: none;
}
.linklike:hover { text-decoration: underline; }

.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0 1.2rem; }
.chip {
  border: 1.5px solid var(--paper-edge); background: var(--paper);
  color: var(--ink-soft); border-radius: 999px; cursor: pointer;
  font: 700 .8rem 'Nunito', sans-serif; padding: .3rem .8rem;
}
.chip.active { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }

/* ── Layout ──────────────────────────────────────────────────────────────── */

.page { max-width: 1080px; margin: 0 auto; padding: 1.4rem clamp(.8rem, 3vw, 1.6rem) 4rem; }
.page-narrow { max-width: 760px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: .4rem;
}
.page-head h1 { font-size: 2.3rem; }
.page-head-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.page-sub { color: var(--ink-soft); margin-bottom: 1.2rem; max-width: 56ch; }
.section-head {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-soft); margin: 1.6rem 0 .5rem;
}
.owner-head { font-size: 1.7rem; margin: 1.4rem 0 .6rem; }

/* ── Paper cards (the index-card look) ───────────────────────────────────── */

.card-paper {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-topline { height: 4px; background: var(--red); opacity: .75; }

.card-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.recipe-card {
  display: flex; flex-direction: column;
  padding: 0 1rem 0.8rem; text-decoration: none; color: var(--ink);
  transition: transform .1s ease, box-shadow .15s ease;
}
.recipe-card:hover { transform: translateY(-2px) rotate(-.3deg); box-shadow: 0 6px 18px rgba(80,55,30,.18); }
.recipe-card .card-topline { margin: 0 -1rem; }
.recipe-card h3 { font-size: 1.55rem; margin-top: .55rem; line-height: 1.15; }
.card-photo {
  margin: .7rem -1rem 0; height: 130px;
  background-size: cover; background-position: center;
  border-bottom: 1px solid var(--paper-edge);
}
.card-photo + h3 { margin-top: .6rem; }
.card-desc {
  color: var(--ink-soft); font-size: .85rem; margin-top: .3rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot {
  margin-top: auto; padding-top: .7rem;
  display: flex; justify-content: space-between; align-items: center;
  font-size: .8rem; color: var(--ink-soft);
}

.cat-tag {
  display: inline-block; margin-top: .3rem;
  background: var(--accent-soft); color: var(--red-deep);
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  border-radius: 4px; padding: .12rem .5rem;
}
.from-tag { font-size: .8rem; color: var(--ink-soft); font-style: italic; }

/* ── Recipe detail ───────────────────────────────────────────────────────── */

.detail-nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem;
}
.detail-actions { display: flex; gap: .45rem; flex-wrap: wrap; }

.recipe-detail { padding: 0 clamp(1rem, 4vw, 2.2rem) 1.8rem; }
.recipe-detail .card-topline { margin: 0 clamp(-2.2rem, -4vw, -1rem); }
.detail-head h1 { font-size: clamp(2.2rem, 6vw, 3rem); margin-top: 1rem; line-height: 1.1; }
.detail-meta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .2rem; }
.detail-desc { color: var(--ink-soft); margin-top: .6rem; font-style: italic; }

.media-strip {
  display: flex; gap: .6rem; overflow-x: auto; margin: 1.1rem 0 .3rem; padding-bottom: .3rem;
}
.media-thumb {
  height: 110px; width: auto; max-width: 190px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--paper-edge); cursor: zoom-in;
  background: #000; flex-shrink: 0;
}
.video-thumb { position: relative; flex-shrink: 0; cursor: zoom-in; }
.video-thumb .media-thumb { display: block; }
.play-badge {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.65); pointer-events: none;
}

.detail-columns { display: grid; grid-template-columns: 1fr 1.6fr; gap: 2rem; margin-top: 1.4rem; }
@media (max-width: 680px) { .detail-columns { grid-template-columns: 1fr; gap: 1.2rem; } }

.recipe-detail h2 {
  font-size: .82rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--red-deep); margin-bottom: .6rem;
  border-bottom: 1px dashed var(--paper-edge); padding-bottom: .3rem;
}

/* Ruled lines, like the card it replaces */
.detail-ingredients ul { list-style: none; }
.detail-ingredients li {
  padding: .32rem 0; border-bottom: 1px solid #e7ebf2;
  font-size: .93rem;
}
.detail-steps ol { padding-left: 1.3rem; }
.detail-steps li { margin-bottom: .8rem; font-size: .95rem; }
.detail-steps li::marker { color: var(--red-deep); font-weight: 800; }

.detail-notes { margin-top: 1.6rem; background: #fdf6e3; border: 1px dashed #e3d3a9; border-radius: 8px; padding: .9rem 1.1rem; }
.detail-notes h2 { border: none; margin-bottom: .3rem; padding: 0; }
.detail-notes p { font-size: .92rem; color: #6b5d3f; }

/* ── Forms ───────────────────────────────────────────────────────────────── */

.recipe-form { padding: 0 clamp(1rem, 4vw, 2rem) 1.6rem; }
.recipe-form .card-topline { margin: 0 clamp(-2rem, -4vw, -1rem); }
.recipe-form h1 { font-size: 2.2rem; margin: .9rem 0 .8rem; }

.field { margin-bottom: 1rem; }
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 180px; }
.field label { display: block; font-weight: 800; font-size: .85rem; margin-bottom: .3rem; }
.field input, .field textarea, .connect-form input {
  width: 100%; border: 1.5px solid var(--paper-edge); border-radius: 8px;
  background: #fff; color: var(--ink);
  font: 400 .95rem 'Nunito', sans-serif; padding: .55rem .7rem;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .connect-form input:focus {
  outline: none; border-color: var(--red-deep); box-shadow: 0 0 0 3px rgba(164, 85, 46, .15);
}

.form-actions { display: flex; gap: .7rem; margin-top: 1.2rem; flex-wrap: wrap; }
.form-error { color: #9c2f22; font-weight: 700; font-size: .88rem; margin: .5rem 0; }

.file-btn { position: relative; overflow: hidden; }
.media-add-btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.media-hint { font-size: .8rem; color: var(--ink-soft); margin: .4rem 0 0; }

.media-edit-list { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.media-edit-thumb { position: relative; display: inline-block; }
.media-edit-thumb img, .media-edit-thumb video {
  height: 84px; width: 84px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--paper-edge); background: #000; display: block;
}
.media-edit-remove {
  position: absolute; top: -7px; right: -7px;
  width: 22px; height: 22px; border-radius: 50%; border: none;
  background: var(--ink); color: #fff; font-size: .7rem; cursor: pointer;
}
.pending-files { display: flex; flex-direction: column; gap: .3rem; margin-top: .5rem; }
.pending-file {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .82rem; color: var(--ink-soft);
  background: var(--accent-soft); border-radius: 6px; padding: .25rem .6rem; width: fit-content;
}
.pending-file button { border: none; background: none; cursor: pointer; color: var(--ink-soft); font-size: .8rem; }

/* ── People ──────────────────────────────────────────────────────────────── */

.connect-form { display: flex; gap: .6rem; margin-bottom: .6rem; }
.connect-form input { flex: 1; }

.person-row {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  background: var(--paper); border: 1px solid var(--paper-edge); border-radius: var(--radius);
  padding: .65rem .9rem; margin-bottom: .5rem; flex-wrap: wrap;
}
.person-name { font-size: .95rem; }
.person-actions { display: flex; gap: .45rem; flex-wrap: wrap; }

.share-row {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .3rem; border-bottom: 1px solid var(--paper-edge);
  cursor: pointer; font-weight: 700;
}
.share-row input { width: 18px; height: 18px; accent-color: var(--red-deep); }

/* ── Landing ─────────────────────────────────────────────────────────────── */

.landing { display: flex; justify-content: center; padding: clamp(1.5rem, 6vh, 4rem) 1rem 4rem; }
.landing-card { max-width: 620px; padding: 0 clamp(1.2rem, 5vw, 2.4rem) 2rem; transform: rotate(-.4deg); }
.landing-card .card-topline { margin: 0 clamp(-2.4rem, -5vw, -1.2rem); }
.landing-card h1 { font-size: clamp(2.3rem, 7vw, 3.2rem); line-height: 1.1; margin: 1.4rem 0 .8rem; }
.landing-card p { color: var(--ink-soft); }
.landing-points { list-style: none; margin: 1.2rem 0 1.6rem; }
.landing-points li { padding: .3rem 0; font-size: .95rem; }

/* ── Empty states / spinner / toast ──────────────────────────────────────── */

.empty-state {
  text-align: center; padding: 3.5rem 1rem;
  max-width: 460px; margin: 0 auto;
}
.empty-art { font-size: 3.4rem; margin-bottom: .4rem; }
.empty-state h2 { font-size: 2.1rem; }
.empty-state p { color: var(--ink-soft); margin: .5rem 0 1.3rem; }
.empty-actions { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }

.spinner-wrap { text-align: center; padding: 3.5rem 1rem; color: var(--ink-soft); }
.spinner {
  width: 34px; height: 34px; margin: 0 auto .8rem;
  border: 3px solid var(--paper-edge); border-top-color: var(--red-deep);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-weight: 700; font-size: .9rem;
  padding: .6rem 1.2rem; border-radius: 999px; box-shadow: var(--shadow);
  z-index: 200; max-width: min(92vw, 480px); text-align: center;
}
.toast-error { background: #9c2f22; }

/* ── Modals & lightbox ───────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(61, 47, 38, .45);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-card {
  position: relative; width: 100%; max-width: 400px; max-height: 88vh; overflow-y: auto;
  background: var(--paper); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
  padding: 1.6rem 1.4rem 1.4rem;
}
.modal-card h2 { font-family: 'Caveat', cursive; font-size: 1.9rem; margin-bottom: .2rem; }
.modal-sub { color: var(--ink-soft); font-size: .88rem; margin-bottom: 1.1rem; }
.modal-close {
  position: absolute; top: .7rem; right: .7rem;
  border: none; background: none; font-size: 1rem; cursor: pointer; color: var(--ink-soft);
}
.lightbox .modal-close { color: #fff; font-size: 1.4rem; z-index: 2; }

.divider {
  display: flex; align-items: center; gap: .8rem; margin: 1rem 0;
  color: var(--ink-soft); font-size: .8rem;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--paper-edge); }
.auth-links { display: flex; justify-content: space-between; gap: .6rem; margin-top: .9rem; flex-wrap: wrap; }

.lightbox {
  position: fixed; inset: 0; z-index: 150; background: rgba(10, 8, 6, .88);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.lightbox img, .lightbox video { max-width: 92vw; max-height: 88vh; border-radius: 8px; }

/* ── Small screens ───────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .brand { font-size: 1.35rem; }
  .page-head h1 { font-size: 1.9rem; }

  /* The tab row becomes a hamburger-opened dropdown panel. */
  .menu-btn:not(.hidden) { display: inline-flex; }
  #tabs {
    position: absolute; top: 100%; left: 0; right: 0;
    display: none; flex-direction: column; gap: .15rem;
    background: var(--paper); border-bottom: 1px solid var(--paper-edge);
    padding: .5rem .7rem .7rem;
    box-shadow: 0 10px 20px rgba(80, 55, 30, .15);
    overflow-x: visible;
  }
  body.menu-open #tabs:not(.hidden) { display: flex; }
  .tabs a { font-size: 1rem; padding: .65rem .8rem; border-radius: 8px; }
}

/* ── Import screen (photos / voice → AI → draft card) ──────────────────── */
.import-panel { padding: 1.2rem 1.3rem 1.3rem; margin-bottom: 1.1rem; position: relative; }
.import-panel h2 { font-size: 1.7rem; margin-bottom: .2rem; }
.import-sub { color: var(--ink-soft); font-size: .92rem; margin-bottom: .8rem; max-width: 52ch; }
.record-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.rec-time { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--red-deep); }
.recording { animation: rec-pulse 1.2s ease-in-out infinite; }
@keyframes rec-pulse { 50% { opacity: .55; } }
.rec-review { margin-top: .9rem; }
.rec-review audio { width: 100%; max-width: 420px; display: block; }
.rec-name { font-size: .85rem; color: var(--ink-soft); margin: 0 0 .4rem; }

/* Audio attached to a card */
.audio-section { margin: 1rem 0 .2rem; }
.audio-section h2 { font-size: 1.05rem; margin-bottom: .2rem; }
.audio-row { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; }
.audio-row audio { flex: 1; min-width: 0; height: 40px; }
.audio-chip {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; font-size: 1.5rem;
  background: rgba(164, 85, 46, .08);
}
.ai-note {
  font-size: .9rem; color: var(--ink-soft); font-style: italic;
  background: rgba(164, 85, 46, .07); border-radius: 8px;
  padding: .45rem .7rem; margin-bottom: .9rem;
}

/* ── Words of wisdom ────────────────────────────────────────────────────── */
.wisdom-list { list-style: none; margin-top: .4rem; }
.wisdom-list li {
  position: relative; padding-left: 1.4rem; margin-bottom: .45rem;
}
.wisdom-list li::before { content: '✦'; position: absolute; left: 0; color: var(--red-deep); }

/* ── Group boxes ────────────────────────────────────────────────────────── */
.group-list { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.group-row {
  display: flex; flex-direction: column; gap: .15rem;
  padding: 0 1rem .8rem; text-decoration: none; color: var(--ink);
  transition: transform .1s ease, box-shadow .15s ease;
}
.group-row:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(80,55,30,.18); }
.group-row .card-topline { margin: 0 -1rem .55rem; }
.group-name { font-size: 1.5rem; }
.group-create { padding: 1.1rem 1.2rem 1.2rem; }
.member-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: .3rem 0 .9rem; }
.member-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--paper); border: 1.5px solid var(--paper-edge);
  border-radius: 999px; padding: .25rem .75rem; font-size: .85rem; font-weight: 700;
}
.member-chip .person-link { text-decoration: none; }
.chip-pending { opacity: .75; font-style: italic; }
.chip-x { border: none; background: none; cursor: pointer; color: var(--ink-soft); font-size: .75rem; padding: 0 .1rem; }
.chip-x:hover { color: #9c2f22; }
.share-head {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-soft); margin: .9rem 0 .35rem;
}

/* ── Bio page ───────────────────────────────────────────────────────────── */
.bio-head { margin-bottom: .8rem; }
.bio-head h1 { font-size: 2.3rem; }
.wisdom-card { padding: 1.1rem 1.3rem 1.2rem; margin-bottom: 1.2rem; max-width: 760px; }
.wisdom-card h2 { font-size: 1.6rem; }
.person-link { color: inherit; }
.owner-link { color: inherit; text-decoration: none; }
.owner-link:hover, .person-link:hover { color: var(--red-deep); }
