/* The Ember tab, as the owner decided it (run F-LP2): the smoked bars over
 * the room, and over the room the feed ("For you today"), the celebration
 * card and Saved this month, in clean type. Linked after pages.css, whose
 * palette (--lp-*) the cards take: Plaster in light mode, Lamplit in dark.
 *
 * design/ai-first/layout-pass/v3/NOTES.md §2d, §2e, §2f′ and PARKED.md
 * "Decided"; the prototype's CSS (v3/src/proto.css: .ecard, .feed, .tuck,
 * .party, .swiped, .chr-smoke) is ported here, under ef- names (ember.css
 * already has an .ecard). Motion uses app.css's tokens; reduced motion is
 * app.css's one block. */

/* ---- the bars: smoke, on the Ember tab only ----
 * The room runs on under them (room.js stands its floor on the tab bar and
 * carries the wall up and the floor's dark down), and they're the room's own
 * dark at 62% with a blur, so the chrome belongs to the room on this tab.
 * Every other tab keeps the palette's chrome (pages.css). */
body[data-tab="ember"] > .bar,
body[data-tab="ember"] > .tabbar { position: relative; z-index: 6; }
body[data-tab="ember"] > .bar,
body[data-tab="ember"] .tabs {
  background: rgba(28, 20, 18, .62);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
}
body[data-tab="ember"] > .bar { border-bottom: 1px solid rgba(255, 241, 224, .08); color: #FFF1E0; }
body[data-tab="ember"] .tabs { border-top: 1px solid rgba(255, 241, 224, .08); }
body[data-tab="ember"] .stamp { background: rgba(255, 241, 224, .1); border-color: rgba(255, 241, 224, .14); color: #E3CDB9; }
body[data-tab="ember"] .gear, body[data-tab="ember"] .tab { color: #D2B8A4; }
body[data-tab="ember"] .tab[aria-selected="true"] { color: #FFD166; }
body[data-tab="ember"] .tab svg { opacity: .8; }
body[data-tab="ember"] .tab[aria-selected="true"] svg { opacity: 1; }
body[data-tab="ember"] .mode { color: #F4B183; }
/* The page under the bars: the room's dark, so a bar never shows the body's. */
body[data-tab="ember"] { background: #1E1512; }
/* The room spills out of the stage, up under the status row and down under
 * the tab bar (the stage, the pager and its one page don't clip it). */
body[data-tab="ember"] .stage,
body[data-tab="ember"] .pager,
body[data-tab="ember"] .pager > .screen.roomscreen { overflow: visible; }
body[data-tab="ember"] .pager > .screen.roomscreen > .room {
  top: calc(-1 * var(--bar-h, 0px)); bottom: calc(-1 * var(--tabs-h, 0px));
}
/* The opening (kindle.js) darkens the stage; here its dark runs on under
 * the bars too, so the room doesn't show through them before it's lit. */
body[data-tab="ember"] .kindle { box-shadow: 0 0 0 100vh var(--bg); }
/* Pull to refresh's words wait above the stage, and the stage no longer
 * clips them here: shown only while a pull is on (app.js's .on). */
body[data-tab="ember"] .ptr:not(.on) { visibility: hidden; }
/* While typing to Ember the tab bar goes (ember.css's body.asking): the
 * room stays as it stood. */

/* ---- the headline: the feed tucked, Saved this month in clean type ---- */
.room .text.efhead {
  top: calc(var(--bar-h, 0px) + 12px); left: 14px; right: 14px; padding: 0; max-height: none;
  align-items: stretch; text-align: left; z-index: 3;
  font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body); color: var(--lp-ink);
}
.efhead .eftuck {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  background: var(--lp-card); border: 1px solid var(--lp-edge); border-radius: 22px; padding: 8px 8px 8px 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  transition: opacity var(--dur-fast) var(--ease), visibility 0s linear;
}
/* With nothing to show it stands alone, as tall as with its button. */
.efhead .eftuck:not(:has(.efshow)) { min-height: 46px; }
.efhead[data-feed="open"] .eftuck {
  opacity: 0; visibility: hidden; transition: opacity var(--dur-fast) var(--ease), visibility 0s linear var(--dur-fast);
}
.efhead .efwords { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
.efhead .lab, .efover .lab {
  font-family: var(--body-face); font-weight: 600; font-size: var(--t-label); line-height: var(--lh-label); letter-spacing: var(--ls-label);
  text-transform: uppercase; color: var(--lp-faint); white-space: normal; overflow: visible; max-width: none;
}
.efhead .big, .efover .efsaved .big {
  font-family: var(--body-face); font-weight: 700; font-size: var(--t-title); line-height: var(--lh-title); margin: 0;
  color: var(--lp-money); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: visible; max-width: none;
}
.efhead .sub {
  margin: 6px 4px 0; font-family: var(--body-face); font-size: var(--t-small); line-height: var(--lh-small); color: #FFF1E0; opacity: 1;
  white-space: normal; overflow: visible; max-width: none; text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}
.efhead .efshow {
  position: relative; flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 4px 12px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--lp-accentBg); color: var(--lp-accent); font-family: var(--body-face); font-weight: 700; font-size: var(--t-small); line-height: var(--lh-small); white-space: nowrap;
}
.efhead .efshow::before { content: ''; position: absolute; inset: -8px -4px; } /* 46 px to the finger */
.efhead .efshow .emo, .efover .emo {
  margin: 0; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; line-height: 1;
}

/* ---- over the room: the celebration, then the feed ----
 * Where the tucked line stands, down to the jars on the mantel (room.js's
 * --mantel-top), scrolling inside if it must; the fire, Ember and the cat
 * stay in sight. It settles down var(--rise) as it opens and lifts back as
 * it tucks. */
.room .efover {
  position: absolute; left: 14px; right: 14px; top: calc(var(--bar-h, 0px) + 12px); z-index: 4;
  max-height: max(200px, calc(var(--mantel-top, 100%) - var(--bar-h, 0px) - 20px));
  display: flex; flex-direction: column; gap: 8px;
  font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body); color: var(--lp-ink);
  transform-origin: 50% 0;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.room .efover.away { opacity: 0; transform: translateY(calc(-1 * var(--rise))) scale(.98); pointer-events: none; }
.efcard {
  flex: none; background: var(--lp-card); border: 1px solid var(--lp-edge); border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}

/* The celebration: a card on top, when something has been earned. */
.efparty { animation: rise var(--dur) var(--ease); overflow: hidden; }
.efparty .efph { display: flex; gap: 12px; align-items: center; margin-top: 2px; }
.efparty .emo.big { font-size: 34px; flex: none; }
.efparty .eftt { min-width: 0; }
.efparty .efti { display: block; font-family: var(--body-face); font-weight: 700; font-size: var(--t-title); line-height: var(--lh-title); color: var(--lp-ink); overflow-wrap: anywhere; }
.efparty .sub {
  margin: 0; font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body); color: var(--lp-soft); opacity: 1;
  white-space: normal; overflow: visible; text-overflow: clip; max-width: none; overflow-wrap: anywhere;
}
.efctl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.efbtn {
  position: relative; min-height: 32px; padding: 4px 14px; border: 0; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--body-face); font-weight: 600; font-size: var(--t-body); line-height: var(--lh-body); color: var(--lp-accent); background: var(--lp-accentBg);
}
.efbtn.primary { color: var(--lp-card); background: var(--lp-accent); }
.efbtn::before { content: ''; position: absolute; inset: -6px 0; }

/* "For you today": the head, the rows (they scroll, if the room is short,
 * between the head and Saved this month, which always shows), its Hide. */
.eflist { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
.eflist .efhd, .eflist .efsaved { flex: none; }
.effeed { flex: 0 1 auto; min-height: 44px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.effeed::-webkit-scrollbar { display: none; }
/* More rows than show: the last fades, rather than ending on a cut line. */
.effeed.more {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent);
}
.eflist .efhd { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.efhide {
  position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer;
  font-family: var(--body-face); font-weight: 700; font-size: var(--t-small); line-height: var(--lh-small); color: var(--lp-accent);
}
.efhide::before { content: ''; position: absolute; inset: -14px -10px; }
.efhide .efup { display: inline-block; width: 8px; height: 6px; background: currentColor; clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* The rows: an emoji, the backend's words, one button. No dividers needed
 * for the bars here: the feed's rows keep theirs (NOTES §2b is for bars). */
.effeed { list-style: none; margin: 6px 0 0; padding: 0; }
.efrow { position: relative; overflow: hidden; touch-action: pan-y; }
.efrow + .efrow { border-top: 1px solid var(--lp-edge); }
.efslide {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 7px 0; min-width: 0;
  background: var(--lp-card); transition: transform var(--dur-fast) var(--ease);
}
.efrow.dragging .efslide { transition: none; }
.efslide .emo { flex: none; width: 22px; font-size: 17px; text-align: center; }
.efslide .t { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.efact {
  position: relative; flex: none; height: var(--chip-h); padding: 0 10px; border: 0; border-radius: 8px; cursor: pointer;
  font-family: var(--body-face); font-weight: 700; font-size: var(--t-small); line-height: var(--chip-h); color: var(--lp-accent); background: var(--lp-accentBg); white-space: nowrap;
}
.efact::before { content: ''; position: absolute; inset: -8px -4px; } /* --tap (44) to the finger */
/* Later and Dismiss, under the row, shown by its swipe: the row's button's
 * height (--chip-h, matching File; F-TY1). */
.efsa {
  position: absolute; top: 50%; z-index: 0; width: 62px; height: var(--chip-h); transform: translateY(-50%); padding: 0; border: 0;
  border-radius: 8px; cursor: pointer; font-family: var(--body-face); font-weight: 700; font-size: var(--t-small); line-height: var(--chip-h);
}
.efsa.later { right: 70px; background: var(--lp-accentBg); color: var(--lp-accent); }
.efsa.dismiss { right: 4px; background: var(--lp-accent); color: var(--lp-card); }
/* Shut, the row's own face covers them (they stay in the tab order: a
 * keyboard's focus on one opens the row, ember-feed.js). */
/* A row (or the celebration) on its way out folds shut. */
.efrow.gone, .efparty.gone {
  height: 0 !important; padding-top: 0; padding-bottom: 0; margin-top: 0; opacity: 0; border-color: transparent;
  transition: height var(--dur) var(--ease), opacity var(--dur-fast) var(--ease), padding var(--dur) var(--ease);
}

/* Saved this month: the feed's last line. */
.efsaved { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--lp-edge); font-family: var(--body-face); font-size: var(--t-small); line-height: var(--lh-small); color: var(--lp-soft); }
.efsaved .lab { font-family: var(--body-face); font-weight: 600; font-size: var(--t-label); line-height: var(--lh-label); }
.efsaved .big { font-family: var(--body-face); font-weight: 700; font-size: var(--t-title); line-height: var(--lh-title); }

/* ▲ and ▼ in a row's words, drawn (pages.js' richText). */
.efover .arw {
  display: inline-block; width: 10px; height: 7px; margin: 0 4px 0 0; vertical-align: 1px; -webkit-mask: none; mask: none;
  color: transparent; font-size: 0; text-indent: 0; overflow: hidden;
}
.efover .arw.up { background: var(--lp-up); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.efover .arw.dn { background: var(--lp-down); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.efover .d.up { color: var(--lp-up); font-weight: 600; }
.efover .d.dn { color: var(--lp-down); font-weight: 600; }
.efover button:focus-visible, .efhead button:focus-visible { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
