/* =========================================================================
   POUSSE CAFÉ — Phase 3 · COCKTAIL COLLECTION
   A quiet cocktail book: navy paper, brass rules, one card shape for all.
   ========================================================================= */

#codex {
  background-image: url("../assets/title/title_bg.webp");
}
#codex::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(3,5,10,.88), rgba(3,5,10,.94));
}

/* ---------- header ----------------------------------------------------- */
.c-head {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  padding: 6px 0 8px;
  text-align: center;
}
.c-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3em;
  color: var(--gold-hi);
}
.c-head .tally {
  margin: 5px 0 0;
  font-size: 16px;
  letter-spacing: .16em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.c-head .meter {
  width: min(76%, 320px);
  height: 3px;
  margin: 7px auto 0;
  border-radius: 3px;
  background: rgba(232,189,106,.16);
  overflow: hidden;
}
.c-head .meter span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #a8781f, #e8bd6a 60%, #fff0c6);
  box-shadow: 0 0 8px rgba(255,196,96,.5);
  transition: width .5s var(--ease);
}
.c-head .hint {
  margin: 6px 0 0;
  min-height: 12px;
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--gold-dim);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
}

/* filters: one line, swipeable, never wider than the screen ------------- */
.filters {
  display: flex;
  gap: 7px;
  margin-top: 9px;
  padding: 2px 10px 4px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chipf {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 6px 13px;
  border: 1px solid rgba(232,189,106,.3);
  border-radius: 40px;
  background: rgba(10,16,32,.6);
  color: var(--gold-dim);
  font-family: inherit;
  font-size: 10.5px;
  letter-spacing: .16em;
  white-space: nowrap;
  cursor: pointer;
}
.chipf.owned { font-family: "Hiragino Mincho ProN", serif; letter-spacing: .06em; }
.chipf.on {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(216,169,79,.9), rgba(157,111,33,.9));
  color: #14100a;
}

/* ---------- grid ------------------------------------------------------- */
.cgrid {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  /* wrapped flexbox rather than grid: a card's height comes from its own
     photo well, and flex lines never stretch it to fit a row. */
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 10px;
  padding: 4px 10px 26px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.cc { flex: 0 0 calc((100% - 10px) / 2); }
@media (min-width: 560px)  { .cc { flex-basis: calc((100% - 20px) / 3); } }
@media (min-width: 820px)  { .cc { flex-basis: calc((100% - 30px) / 4); } }
/* Five across looks tidy and reads badly: on a wide window the cards fall
   under 140px and the names start to crowd. Four is the ceiling.          */

.cgrid .empty {
  flex: 1 1 100%;
  padding: 40px 0;
  text-align: center;
  font-family: "Hiragino Mincho ProN", serif;
  font-size: 12px;
  color: var(--gold-dim);
}

/* every card is the same shape, always ---------------------------------- */
.cc {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px 9px;
  border: 1px solid rgba(232,189,106,.3);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(17,27,50,.94), rgba(6,10,20,.94));
  box-shadow: inset 0 1px 0 rgba(255,224,160,.14), 0 6px 14px rgba(0,0,0,.45);
  color: var(--gold);
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: transform .12s var(--ease), border-color .2s linear;
}
.cc:active { transform: translateY(2px); }
.cc > * { flex: 0 0 auto; max-width: 100%; }
.cc .no {
  font-size: 9px;
  letter-spacing: .18em;
  color: var(--gold-dim);
}
.cc .shot {
  /* The square photo well drives the card's shape: image area + one line of
     each label lands on roughly 3:4, and every card gets the identical box.
     (The ratio lives here rather than on the card because a grid row will not
     size itself from an aspect-ratio'd flex container.) */
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 3px 0;
}
.cc .shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.55));
}
.cc .en {
  font-size: 11px;
  letter-spacing: .07em;
  color: var(--gold-hi);
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc .ja {
  margin-top: 1px;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 9.5px;
  color: var(--gold-dim);
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc .tags {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 6px;
  padding-top: 6px;
  width: 86%;
  border-top: 1px solid rgba(232,189,106,.22);
}
.cc .tag img { width: 17px; height: 17px; display: block; }
.cc .tag b { display: none; }

.cc.locked {
  border-color: rgba(150,140,120,.2);
  background: linear-gradient(180deg, rgba(12,13,17,.94), rgba(5,6,9,.95));
  color: #6d6558;
  cursor: default;
}
.cc.locked .shot img {
  filter: grayscale(1) brightness(.22) contrast(.9);
  opacity: .85;
}
.cc.locked .en { color: #6d6558; letter-spacing: .2em; }
.cc.locked .ja { font-size: 9px; color: #5c5449; }
.cc.locked .tags { border-top-color: rgba(150,140,120,.16); }
.cc.locked .ico-lock { width: 15px; height: 15px; }

/* ---------- detail sheet ----------------------------------------------- */
#detail {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(2,4,8,.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadein .25s ease-out;
}

.sheet {
  position: relative;
  width: min(100%, 420px);
  max-height: 100%;
  padding: 22px 20px 18px;
  border: 1px solid rgba(232,189,106,.45);
  border-radius: 5px;
  background:
    url("../assets/codex/corner.png") left 8px top 8px / 40px auto no-repeat,
    linear-gradient(180deg, #101c36, #070c18);
  box-shadow: 0 22px 60px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,224,160,.22);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  text-align: center;
}
.sheet .x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--gold-dim);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.sheet .no {
  margin: 0;
  font-size: 10px;
  letter-spacing: .3em;
  color: var(--gold-dim);
}
.sheet h3 {
  margin: 6px 0 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .09em;
  color: var(--gold-hi);
  text-shadow: 0 0 18px rgba(255,190,90,.35);
}
.sheet .ja {
  margin: 3px 0 0;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--gold);
}
.sheet .hero {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 200px;
  margin: 12px 0 4px;
}
.sheet .hero img {
  max-height: 100%;
  max-width: 70%;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px rgba(0,0,0,.6));
}

.tags.big {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.tags.big .tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 3px;
  border: 1px solid rgba(232,189,106,.28);
  border-radius: 40px;
  background: rgba(9,14,28,.7);
}
.tags.big .tag img { width: 24px; height: 24px; }
.tags.big .tag b {
  display: inline;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--gold);
}

.sheet .rule {
  height: 16px;
  margin: 16px 0 12px;
  background: url("../assets/codex/divider.png") center / contain no-repeat;
}
.sheet .plate {
  height: 30px;
  margin: 0 auto 10px;
  width: min(72%, 240px);
  background: url("../assets/codex/plate.png") center / 100% 100% no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet .plate h4 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .34em;
  text-indent: .34em;
  color: var(--gold-hi);
}

.sheet .story {
  margin: 0;
  padding: 0 2px;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 12.5px;
  line-height: 1.85;
  text-align: left;
  color: #e6dcc4;
}

.sheet .recipe {
  padding: 12px 12px 10px;
  border: 1px solid rgba(232,189,106,.28);
  border-radius: 3px;
  background: rgba(8,13,26,.6);
}
.sheet .ing {
  margin: 0;
  padding: 0;
  list-style: none;
}
.sheet .ing li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dotted rgba(232,189,106,.22);
  font-size: 12.5px;
}
.sheet .ing li:last-child { border-bottom: 0; }
.sheet .ing span {
  flex: 1 1 auto;
  text-align: left;
  color: #efe3c6;
  letter-spacing: .02em;
}
.sheet .ing b {
  flex: 0 0 auto;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
.sheet .how {
  margin: 10px 0 0;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 12px;
  line-height: 1.8;
  text-align: left;
  color: #cfc4ad;
}

.sheet .close {
  width: 100%;
  min-height: 44px;
  margin-top: 18px;
  border: 1px solid var(--gold);
  border-radius: 3px;
  background: linear-gradient(180deg, #d8a94f, #9d6f21);
  color: #14100a;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .2em;
  cursor: pointer;
}
.sheet .close:active { transform: translateY(1px); filter: brightness(.95); }

/* PREV / NEXT — the pair under CLOSE.  Outlined rather than filled, so the
   gold CLOSE stays the one obvious way out and these read as the quieter
   way onward. */
.sheet .pager {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.sheet .page {
  flex: 1;
  min-height: 44px;
  border: 1px solid rgba(216, 169, 79, .55);
  border-radius: 3px;
  background: rgba(216, 169, 79, .07);
  color: var(--gold);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .16em;
  cursor: pointer;
}

.sheet .page:active { transform: translateY(1px); filter: brightness(.95); }

/* at the ends: still there, still the same size, just plainly out of reach */
.sheet .page:disabled {
  opacity: .32;
  cursor: default;
}

.sheet .page:disabled:active { transform: none; }

/* the page turn: the new sheet arrives from the side the old one left towards.
   Short and small on purpose — this is a page turning, not a slide deck. */
@keyframes turn-in-next {
  from { opacity: 0; transform: translateX(22px); }
  to   { opacity: 1; transform: none; }
}

@keyframes turn-in-prev {
  from { opacity: 0; transform: translateX(-22px); }
  to   { opacity: 1; transform: none; }
}

#detailBody.turn-next { animation: turn-in-next .16s ease-out; }
#detailBody.turn-prev { animation: turn-in-prev .16s ease-out; }

@media (prefers-reduced-motion: reduce) {
  #detailBody.turn-next, #detailBody.turn-prev { animation: none; }
}

@media (max-height: 700px) {
  .sheet .hero { height: 150px; }
}

/* =========================================================================
   Phase 4–6 — modals that reuse the codex sheet
   ========================================================================= */
#settings, #dailyIntro {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(2,4,8,.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadein .25s ease-out;
}
#settings .sheet, #dailyIntro .sheet { width: min(100%, 360px); }

.sheet .tag {
  margin: 0 0 2px;
  font-size: 10px;
  letter-spacing: .34em;
  color: var(--gold-dim);
}
.sheet .tag.small { margin-top: 14px; }

/* ---------- settings rows ---------------------------------------------- */
#settings .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 2px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(232,189,106,.18);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 15px;
  color: var(--gold-hi);
}
.tog {
  position: relative;
  flex: 0 0 auto;
  width: 58px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(232,189,106,.5);
  border-radius: 999px;
  background: rgba(6,10,20,.9);
  cursor: pointer;
  transition: background .18s linear, border-color .18s linear;
}
.tog i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #6c6250, #37312a);
  transition: transform .18s var(--ease), background .18s linear;
}
.tog[aria-checked="true"] { background: rgba(232,189,106,.22); border-color: var(--gold); }
.tog[aria-checked="true"] i {
  transform: translateX(26px);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  box-shadow: 0 0 12px rgba(255,190,90,.6);
}
#settings .note {
  margin: 14px 0 0;
  font-size: 10.5px;
  line-height: 1.7;
  letter-spacing: .06em;
  color: var(--gold-dim);
}

/* ---------- daily briefing --------------------------------------------- */
#dailyIntro .meta {
  margin: 6px 0 0;
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--gold-dim);
}
#dailyIntro .streak {
  margin: 6px 0 0;
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--amber);
}
#dailyIntro .rule {
  height: 1px;
  margin: 16px 0 0;
  background: linear-gradient(90deg, transparent, rgba(232,189,106,.45), transparent);
}
.today {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 16px;
  padding: 10px;
  border: 1px solid rgba(232,189,106,.28);
  border-radius: 4px;
  background: rgba(9,15,30,.7);
  text-align: left;
}
.today img {
  width: 62px;
  height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,.6));
}
.today .txt { flex: 1 1 auto; min-width: 0; }
.today b {
  display: block;
  font-family: Cinzel, serif;
  font-size: 14px;
  letter-spacing: .06em;
  color: var(--gold-hi);
}
.today .txt > span {
  display: block;
  margin-top: 2px;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 11px;
  color: var(--gold);
}
.today em {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--gold-dim);
}
#dailyStart {
  display: block;
  width: 100%;
  padding: 13px 0;
  border: 0;
  border-radius: 3px;
  background: linear-gradient(180deg, #f2d79b, #c9973f);
  color: #2a1b06;
  font-family: Cinzel, serif;
  font-size: 14px;
  letter-spacing: .22em;
  cursor: pointer;
}
#dailyStart:active { transform: translateY(1px); filter: brightness(.95); }

/* =========================================================================
   Favourites — the heart on a card, in the sheet, and in the filter row
   ========================================================================= */

/* Drawn, not shipped: two rounded lobes pinned at the bottom point, so the
   shape stays crisp at any size and state is only a matter of colour.      */
.heart {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.heart::before, .heart::after {
  content: "";
  position: absolute;
  top: 8px;
  width: 11px;
  height: 17px;
  border-radius: 11px 11px 0 0;
  background: rgba(232,189,106,.4);
  transition: background .18s linear, box-shadow .18s linear;
}
.heart::before { left: 17px; transform: rotate(-45deg); transform-origin: 0 100%; }
.heart::after  { left: 6px;  transform: rotate(45deg);  transform-origin: 100% 100%; }

.heart.on::before, .heart.on::after {
  background: linear-gradient(180deg, #f4b3b8, #c9505c);
  box-shadow: 0 0 12px rgba(240,120,130,.5);
}
@keyframes heartbeat {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.34); }
  60%  { transform: scale(.93); }
  100% { transform: scale(1); }
}
.heart.beat { animation: heartbeat .42s var(--ease); }
.heart:active { filter: brightness(1.15); }

/* ---------- on a card --------------------------------------------------- */
.cc { position: relative; }
.cc .heart {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 30px;
  height: 30px;
}
.cc .heart::before, .cc .heart::after {
  top: 7px;
  width: 9px;
  height: 14px;
  border-radius: 9px 9px 0 0;
}
.cc .heart::before { left: 15px; }
.cc .heart::after  { left: 6px; }
.cc .heart:not(.on)::before, .cc .heart:not(.on)::after { background: rgba(232,189,106,.26); }
.cc.locked .heart { display: none; }

/* ---------- in the open sheet ------------------------------------------- */
#detailBody { position: relative; }
#detailBody .heart {
  position: absolute;
  top: 44px;
  right: 2px;
  width: 44px;
  height: 44px;
}
#detailBody .heart::before, #detailBody .heart::after {
  top: 11px;
  width: 14px;
  height: 22px;
  border-radius: 14px 14px 0 0;
}
#detailBody .heart::before { left: 22px; }
#detailBody .heart::after  { left: 8px; }

/* ---------- the filter chip -------------------------------------------- */
.chipf.fav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Hiragino Mincho ProN", serif;
  letter-spacing: .06em;
}
.chipf.fav .heart {
  width: 14px;
  height: 13px;
  pointer-events: none;
}
.chipf.fav .heart::before, .chipf.fav .heart::after {
  top: 1px;
  width: 5px;
  height: 8px;
  border-radius: 5px 5px 0 0;
  background: currentColor;
  box-shadow: none;
}
.chipf.fav .heart::before { left: 7px; }
.chipf.fav .heart::after  { left: 2px; }

@media (prefers-reduced-motion: reduce) { .heart.beat { animation: none; } }

/* =========================================================================
   Codex header — the way back sits beside the title, never on top of it
   ========================================================================= */
.c-top {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 0 6px;
}
.c-title { flex: 1 1 auto; min-width: 0; }
.c-spacer,
#codex .chip.wide { flex: 0 0 92px; }      /* equal sides keep the title centred */
#codex .chip.wide {
  position: static;
  width: 92px;
  height: 34px;
  margin-top: 1px;
}
/* On a narrow phone the title needs the room more than perfect symmetry
   does: the spacer gives most of it back and the heading tightens up.     */
@media (max-width: 420px) {
  #codex .chip.wide { flex-basis: 74px; width: 74px; padding: 0 8px; }
  #codex .chip.wide .lbl { font-size: 10px; letter-spacing: .1em; }
  .c-spacer { flex-basis: 20px; }
  .c-head h2 { letter-spacing: .16em; }
  .c-head .hint { letter-spacing: .04em; }
}
