/* =====================================================================
   phrases.css — view page + capture page

   The view page (/phrases/) is a full-bleed gradient surface. Pills
   sit on top with their text + (when a language is active) translation.
   Custom phrases get a French-blue accent so they stand out from the
   curated set.

   The capture page (/phrases/capture/) is a simple form.
   ===================================================================== */

/* ---------------------------------------------------------------------
   VIEW PAGE — full-bleed gradient
   --------------------------------------------------------------------- */

/* Butter-yellow bloom with film grain.
   Stack from top to bottom in CSS = stack from front to back visually:
     1. noise.png — tiled film grain on top of everything
     2. hotspot — saturated butter yellow, off-center upper-left
     3. mid-bloom — soft warm peach, opposite corner
     4. base — cream → soft mauve at edges (radial ellipse)
   Note: background-attachment: fixed makes the gradient stay put as you
   scroll, like the reference image — feels more atmospheric. */
body.body-phrases {
  background-color: #fff8e7;
  background-image:
    url('/img/noise.png'),
    radial-gradient(circle at 28% 22%,
      rgba(245, 232, 74, 0.85) 0%,
      rgba(245, 232, 74, 0.5) 12%,
      rgba(245, 232, 74, 0) 45%),
    radial-gradient(circle at 78% 70%,
      rgba(255, 200, 160, 0.55) 0%,
      rgba(255, 200, 160, 0) 55%),
    radial-gradient(ellipse at 50% 50%,
      #fff8e7 0%,
      #f5ecd6 45%,
      #d6c8d0 100%);
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
  background-size: 128px 128px, auto, auto, auto;
  background-attachment: fixed, fixed, fixed, fixed;
  min-height: 100vh;
}
@media (prefers-color-scheme: dark) {
  body.body-phrases.dark,
  body.dark.body-phrases {
    background-color: #1f1a26;
    background-image:
      url('/img/noise.png'),
      radial-gradient(circle at 28% 22%,
        rgba(180, 150, 60, 0.4) 0%,
        rgba(180, 150, 60, 0) 50%),
      radial-gradient(ellipse at 50% 50%,
        #2a2030 0%,
        #1d1a28 60%,
        #15131c 100%);
    background-repeat: repeat, no-repeat, no-repeat;
    background-size: 128px 128px, auto, auto;
    background-attachment: fixed, fixed, fixed;
  }
}

/* The page's own header should be transparent so the gradient flows */
.body-phrases .head {
  background: transparent;
  border-bottom: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.page-phrases {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 24px 120px;
}
@media (max-width: 720px) {
  .page-phrases { padding: 16px 16px 120px; }
}

/* ---------------------------------------------------------------------
   LANGUAGE PICKER — quieter dropdown row, sits below category chips
   --------------------------------------------------------------------- */
.ph-lang-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.ph-lang-row__label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ph-lang-select {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: -0.005em;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--rule);
  border-radius: var(--r-input);
  padding: 8px 32px 8px 12px;
  cursor: pointer;
  outline: none;
  /* Custom caret — small native chevron alternative */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%2399988f' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 7px;
}
.ph-lang-select:focus {
  border-color: var(--blue);
}

/* ---------------------------------------------------------------------
   CATEGORY CHIPS
   --------------------------------------------------------------------- */
.ph-cats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.ph-cat {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 0;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.ph-cat:hover { background: rgba(255, 255, 255, 0.85); }
.ph-cat.is-active {
  background: var(--ink);
  color: var(--bg);
}

/* ---------------------------------------------------------------------
   CATEGORY GROUPS
   --------------------------------------------------------------------- */
.ph-group {
  margin-bottom: 36px;
}
.ph-group__head {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 14px;
  padding-left: 4px;
}

.ph-group__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------------------------------------------------------------------
   PHRASE PILL
   --------------------------------------------------------------------- */
.ph-pill {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
}
.ph-pill__main {
  flex: 1;
  min-width: 0;
}
.ph-pill__text {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1.4;
  margin: 0;
  word-wrap: break-word;
}
.ph-pill__translation {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.005em;
  color: var(--ink-2);
  margin: 6px 0 0;
  line-height: 1.4;
  word-wrap: break-word;
}
.ph-pill__translation--pending {
  font-style: italic;
  color: var(--ink-3);
}

/* Custom (user-added) pill: French-blue accent, more visually elevated */
.ph-pill--custom {
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--blue);
  border-width: 1.5px;
}
.ph-pill--custom .ph-pill__text {
  color: var(--blue);
}

/* Delete button on custom pills — inline-row close circle, 28x28.
   Canonical pattern: same shape as .time-card__remove. Always perfectly round. */
.ph-pill__delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  transition: color 140ms ease, border-color 140ms ease;
  align-self: center;
}
.ph-pill__delete:hover {
  color: #c0392b;
  border-color: #c0392b;
}
@media (max-width: 720px) {
  /* Force perfect circle even with mobile touch-target overrides */
  .ph-pill__delete {
    min-height: 28px !important;
    min-width: 28px !important;
    width: 28px !important;
    height: 28px !important;
  }
}

/* "Curated" subtle tag on curated pills (optional, very quiet) */
.ph-pill__source {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  align-self: center;
  flex-shrink: 0;
  opacity: 0.5;
}

/* ---------------------------------------------------------------------
   TOPBAR — just the add-phrase pill, right-aligned
   --------------------------------------------------------------------- */
.ph-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 16px;
}

/* Inline add button — sits to the right of the language picker, never
   collides with floating avatar (which is bottom-right on mobile). */
.ph-add-inline {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--bg);
  background: var(--ink);
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 999px;
  white-space: nowrap;
  transition: opacity 140ms ease;
}
.ph-add-inline:hover { opacity: 0.85; }
@media (max-width: 720px) {
  .ph-add-inline {
    font-size: 12px;
    padding: 8px 14px;
  }
}

/* ---------------------------------------------------------------------
   LOADING / EMPTY STATES
   --------------------------------------------------------------------- */
.ph-loading {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
  padding: 80px 0;
}
.ph-translating {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-left: 12px;
  opacity: 0;
  transition: opacity 140ms ease;
}
.ph-translating.is-visible { opacity: 1; }

/* ---------------------------------------------------------------------
   CAPTURE OVERLAY — phrase-specific tweaks
   The page reuses .capture-fs__* classes from home.css for visual identity.
   Just need to style the small "Saving…/Saved" state ping in the foot.
   --------------------------------------------------------------------- */
.pf-state {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-right: auto;       /* pushes itself left, save stays on the right */
  opacity: 0;
  transition: opacity 140ms ease;
}
.pf-state.is-visible { opacity: 1; }
