/* ==========================================================================
   JORIE DAILY — profile.css · Phase 30.5
   Header profile avatar + dropdown (authenticated pages only), and the small
   navigation adjustments needed for the sixth main link (Blog).
   Loaded after refresh.css. Uses only existing tokens from style.css /
   refresh.css, so light, dark and seasonal styling follow automatically.
   The sign-in screen (.gate) and its standalone theme switch are NOT touched.
   ========================================================================== */

/* ---------- Header slot ---------------------------------------------------- */
.profile {
  position: relative;
  justify-self: end;
  display: inline-flex;
  align-items: center;
}
.profile[hidden] { display: none; }

/* Desktop: logo · navigation · profile distributed with EQUAL space between
   them (logo→nav gap = nav→profile gap), instead of centring the nav on the page. */
@media (min-width: 900px) {
  .site-header__inner { display: flex; justify-content: space-between; }
  .site-header__inner > .brand,
  .site-header__inner > .nav,
  .site-header__inner > .profile { flex: none; }
}

/* Tablet & phone: avatar in the upper-right corner, menu button beside it */
@media (max-width: 899px) {
  .profile { grid-column: 3; grid-row: 1; }
  .site-header__inner > .menu-toggle { grid-column: 2; grid-row: 1; }
  /* sixth link arrives in sequence like the first five */
  .has-menu.is-menu-open .nav__link:nth-of-type(6) { transition-delay: 150ms; }
}

/* Laptop widths: six links + avatar need a touch less horizontal padding.
   Typography is unchanged; only the link padding and header gap tighten. */
@media (min-width: 900px) and (max-width: 1080px) {
  .site-header__inner { gap: var(--space-3); }
  .nav__link { padding: 0 11px; gap: 6px; }
}
@media (min-width: 900px) and (max-width: 1000px) {
  .nav__link { padding: 0 9px; }
}
/* The site's existing laptop padding (14px), extended to the sixth link's needs */
@media (min-width: 1081px) and (max-width: 1199px) {
  .nav__link { padding: 0 14px; }
}

/* ---------- Avatar button -------------------------------------------------- */
.profile__btn {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.profile__avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--nav-bg);
  color: var(--nav-indicator);
  box-shadow:
    inset 0 1px 0 rgb(var(--white-rgb) / 0.10),
    0 0 0 2px var(--bg),
    0 0 0 3.5px rgb(var(--pink-rgb) / 0.75),
    0 10px 22px -14px rgb(var(--burgundy-rgb) / 0.6);
  transition: transform var(--jd-t2, 260ms) var(--jd-spring, cubic-bezier(0.34, 1.4, 0.64, 1)),
              box-shadow var(--jd-t2, 260ms) ease, background-color var(--dur-2, 280ms) ease;
}
.profile__initial {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
  font-style: italic;
  font-variation-settings: "SOFT" 100;
  line-height: 1;
  letter-spacing: -0.02em;
  transform: translateY(-1px);
}
.profile__btn:hover .profile__avatar { transform: scale(1.05); }
.profile__btn:active .profile__avatar { transform: scale(0.95); }
.profile__btn[aria-expanded="true"] .profile__avatar {
  background: var(--nav-indicator);
  color: var(--nav-ink-active);
  box-shadow:
    inset 0 1px 0 rgb(var(--white-rgb) / 0.55),
    0 0 0 2px var(--bg),
    0 0 0 3.5px var(--nav-bg),
    0 10px 22px -14px rgb(var(--burgundy-rgb) / 0.6);
}
.profile__btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }

/* ---------- Dropdown ------------------------------------------------------- */
.profile__menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 70;
  width: 264px;
  max-width: calc(100vw - 2 * var(--gutter));
  padding: 8px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--jd-highlight, none), var(--shadow-lg);
  transform-origin: top right;
  animation: jdProfileIn 240ms var(--jd-ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}
.profile__menu[hidden] { display: none; }
@keyframes jdProfileIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.profile__who {
  display: grid;
  gap: 2px;
  margin: 0 0 6px;
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--line);
  cursor: default;
  user-select: none;
}
.profile__eyebrow {
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.profile__name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  font-style: italic;
  font-variation-settings: "SOFT" 100;
  letter-spacing: -0.02em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.profile__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--jd-t1, 140ms) ease, color var(--jd-t1, 140ms) ease;
}
.profile__item .icon { flex: none; width: 19px; height: 19px; color: var(--ink-2); }
a.profile__item:hover, button.profile__item:hover,
a.profile__item:focus-visible, button.profile__item:focus-visible { background: rgb(var(--pink-rgb) / 0.45); }
:root[data-theme="dark"] a.profile__item:hover, :root[data-theme="dark"] button.profile__item:hover,
:root[data-theme="dark"] a.profile__item:focus-visible, :root[data-theme="dark"] button.profile__item:focus-visible { background: rgb(var(--pink-rgb) / 0.14); }
.profile__item:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.profile__item[aria-current="page"] { background: rgb(var(--pink-rgb) / 0.32); }
:root[data-theme="dark"] .profile__item[aria-current="page"] { background: rgb(var(--pink-rgb) / 0.10); }

/* Appearance row: label on the left, the site's existing theme switch on the right */
.profile__item--appearance { cursor: default; }
.profile__item--appearance > span { flex: 1; }
.profile__theme { margin-right: -6px; }
.profile__theme:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }

.profile__sep { display: block; height: 1px; margin: 6px 4px; background: var(--line); }

/* ---------- Placeholder pages (Blog, Account Details, Badges) --------------- */
.soon-page { padding-bottom: clamp(32px, 6vw, 72px); }
.soon-hero .page-hero__title { overflow-wrap: anywhere; }
.soon-hero__lede em { font-style: italic; }
.soon-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 520px;
  margin: clamp(8px, 2vw, 20px) auto 0;
  padding: clamp(28px, 5vw, 48px) var(--pad-card);
  text-align: center;
}
.soon-card__heart {
  font-size: 2rem;
  line-height: 1;
  color: var(--ink);
  animation: jdHeartBeat 2.4s var(--jd-ease, ease) 400ms infinite;
}
.soon-card__line { display: block; width: min(260px, 70%); height: 10px; border-radius: var(--radius-pill); background: rgb(var(--pink-rgb) / 0.55); }
.soon-card__line--short { width: min(160px, 45%); opacity: 0.7; }
/* Phase 44.7: Account Details for Marjorie — the real Daily Questions
   Management replaces the "coming soon" placeholder (js/questions-admin.js adds
   .soon-page--managed only after mounting it for the admin account). Scotty's
   page never gets the class, so his placeholder stays exactly as it was. */
.soon-page--managed .soon-hero__lede,
.soon-page--managed .soon-card { display: none; }
:root[data-theme="dark"] .soon-card__line { background: rgb(var(--pink-rgb) / 0.18); }

@media (prefers-reduced-motion: reduce) {
  .profile__menu { animation: none; }
  .profile__avatar { transition: none; }
  .soon-card__heart { animation: none; }
}

@media print { .profile { display: none !important; } }

/* ==========================================================================
   PHASE 31.2 — Calendar menu · one primary-title scale · layout consistency
   Loaded on every authenticated page (after refresh.css). Existing tokens
   only, so light, dark and seasonal styling follow automatically.
   ========================================================================== */

/* ---------- Primary page titles ------------------------------------------
   Reference: Calendar's month heading (“November 2026”) — Fraunces 800,
   SOFT 100, letter-spacing −0.05em, this fluid size and line height.
   Applied to PRIMARY page titles only (.page-hero__title and Today's
   .hero__title); card titles, modal titles and section headings keep their
   own sizes, so the hierarchy below each title is unchanged.
   (The temporary “Coming Soon” launch poster on Today keeps its poster size;
   it disappears automatically on November 1, 2026.) */
:root {
  --fs-page-title: clamp(2.3rem, 1.5rem + 3.4vw, 4.4rem);
  --lh-page-title: 0.95;
}
.page-hero__title,
.hero__title,
.hero--celebrate .hero__title {
  font-size: var(--fs-page-title);
  line-height: var(--lh-page-title);
  letter-spacing: -0.05em;
  overflow-wrap: break-word;
}
/* Today's title sits inside the burgundy card: the size matches the other
   pages; its colour, heart and celebration variants are unchanged. */

/* ---------- Calendar menu (header) --------------------------------------- */
.nav__group {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  flex: none;
  border-radius: var(--radius-pill);
}
.nav__link--split { padding-right: 4px; }
.nav-cal__toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  min-height: 36px;
  margin-right: 6px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--nav-ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--jd-t2, 260ms) ease, background-color var(--jd-t1, 140ms) ease;
}
.nav-cal__toggle .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
  transition: transform var(--jd-t2, 260ms) var(--jd-ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}
.nav-cal__toggle:hover { color: var(--nav-ink-hover); background: rgb(var(--beige-rgb) / 0.12); }
.nav-cal__toggle:focus-visible { outline: 2px solid var(--nav-indicator); outline-offset: 1px; }
.nav-cal.is-open .nav-cal__toggle .icon { transform: rotate(180deg); }
/* On Calendar, Wishlist, Our Dates and Plan a Trip the pill sits under the
   whole group, so the arrow takes the active text colour. */
.nav-cal:has(> .nav__link[aria-current]) .nav-cal__toggle { color: var(--nav-ink-active); }
.nav-cal:has(> .nav__link[aria-current]) .nav-cal__toggle:hover { background: rgb(var(--burgundy-rgb) / 0.10); }

/* The menu: the profile menu's border, radius, surface, shadow and rows */
.nav-cal__menu {
  position: absolute;
  top: calc(100% + 16px);
  left: -6px;
  z-index: 70;
  width: 236px;
  max-width: calc(100vw - 24px);
  padding: 8px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--jd-highlight, none), var(--shadow-lg);
  translate: var(--nav-cal-shift, 0px) 0;
  transform-origin: top left;
  animation: jdProfileIn 200ms var(--jd-ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}
.nav-cal__menu[hidden] { display: none; }
.nav-cal__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--jd-t1, 140ms) ease, color var(--jd-t1, 140ms) ease;
}
.nav-cal__item .icon { flex: none; width: 19px; height: 19px; color: var(--ink-2); }
.nav-cal__item:hover, .nav-cal__item:focus-visible { background: rgb(var(--pink-rgb) / 0.45); }
:root[data-theme="dark"] .nav-cal__item:hover, :root[data-theme="dark"] .nav-cal__item:focus-visible { background: rgb(var(--pink-rgb) / 0.14); }
.nav-cal__item:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.nav-cal__item[aria-current="page"] { background: rgb(var(--pink-rgb) / 0.32); }
:root[data-theme="dark"] .nav-cal__item[aria-current="page"] { background: rgb(var(--pink-rgb) / 0.10); }
.nav-cal__item[aria-current="page"]::after {
  content: "";
  width: 6px; height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

/* Laptop widths: the arrow is a little narrower so all six links still fit */
@media (min-width: 900px) and (max-width: 1080px) {
  .nav-cal__toggle { width: 30px; margin-right: 4px; }
  .nav__link--split { padding-right: 2px; }
}

/* ---------- Phones & tablets: inside the folding menu panel -------------- */
@media (max-width: 899px) {
  /* The open panel never runs below the screen (6 links + Calendar's
     pages on a phone held sideways): it scrolls inside itself instead. */
  .has-menu .nav {
    max-height: calc(100vh - var(--header-h) - 16px);
    max-height: calc(100dvh - var(--header-h) - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  .has-menu .nav__group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px;
    gap: 4px;
    border-radius: var(--radius-md);
  }
  .has-menu .nav__link--split { padding-right: 18px; }
  .has-menu .nav-cal__toggle {
    width: 52px;
    min-height: 52px;
    margin: 0;
    border-radius: var(--radius-md);
    color: var(--nav-ink-hover);
    opacity: 0;
  }
  .has-menu.menu-ready .nav-cal__toggle { transition: color var(--dur-2) ease, background-color var(--dur-2) ease, opacity var(--dur-2) ease 30ms; }
  .has-menu.is-menu-open .nav-cal__toggle { opacity: 1; }
  .has-menu .nav-cal__toggle .icon { width: 20px; height: 20px; }
  .has-menu .nav-cal__toggle:hover { background: rgb(var(--beige-rgb) / 0.08); }
  .has-menu .nav-cal__toggle:focus-visible { outline-offset: 2px; }
  .has-menu .nav-cal:has(> .nav__link[aria-current]) .nav-cal__toggle { color: var(--nav-ink-hover); }
  .has-menu .nav-cal.is-open .nav-cal__toggle { background: rgb(var(--beige-rgb) / 0.10); }

  /* The submenu unfolds in place — it can't be clipped or pushed off screen */
  .has-menu .nav-cal__menu {
    position: static;
    grid-column: 1 / -1;
    width: auto;
    max-width: none;
    margin: 0 0 4px 22px;
    padding: 2px 0 2px 12px;
    border: 0;
    border-left: 1.5px solid rgb(var(--beige-rgb) / 0.22);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    translate: none;
    animation: jdCalSubIn 180ms var(--jd-ease-out, ease) both;
  }
  .has-menu .nav-cal__item {
    min-height: 48px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    color: var(--nav-ink);
    font-size: var(--fs-base);
  }
  .has-menu .nav-cal__item .icon { width: 20px; height: 20px; color: currentColor; opacity: 0.85; }
  .has-menu .nav-cal__item:hover { color: var(--nav-ink-hover); background: rgb(var(--beige-rgb) / 0.08); }
  .has-menu .nav-cal__item:focus-visible { color: var(--nav-ink-hover); background: rgb(var(--beige-rgb) / 0.08); outline: 2px solid var(--nav-indicator); outline-offset: -2px; }
  .has-menu .nav-cal__item[aria-current="page"],
  :root[data-theme="dark"] .has-menu .nav-cal__item[aria-current="page"] { color: var(--nav-ink-hover); background: rgb(var(--beige-rgb) / 0.12); }

  /* The links still arrive one after another (the group shifted the count) */
  .has-menu.is-menu-open .nav > .nav__link:nth-of-type(2) { transition-delay: 60ms; }
  .has-menu.is-menu-open .nav > .nav__link:nth-of-type(3) { transition-delay: 90ms; }
  .has-menu.is-menu-open .nav > .nav__link:nth-of-type(4) { transition-delay: 120ms; }
  .has-menu.is-menu-open .nav > .nav__link:nth-of-type(5) { transition-delay: 150ms; }
  .has-menu.is-menu-open .nav__group .nav__link { transition-delay: 30ms; }
}
@keyframes jdCalSubIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Touch: comfortable targets ----------------------------------- */
@media (pointer: coarse) {
  .cal-textbtn { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-cal__menu, .has-menu .nav-cal__menu { animation: none; }
  .nav-cal__toggle, .nav-cal__toggle .icon { transition: none; }
}
@media print { .nav-cal__menu { display: none !important; } }

/* ==========================================================================
   NEXT PHASE (Part A) — one vertical-spacing system
   Builds on the existing --space-1…8 scale in style.css. Semantic names say
   WHICH relationship a gap expresses, so neighbouring blocks of the same rank
   always get the same separation:
     --space-related   between related items inside one card (chips, buttons)
     --space-inset     padding inside a card
     --space-card      between two independent cards / panels  (= --gap)
     --space-section   between two major page sections
     --space-title     below the primary page-title block
     --space-page-end  between the last content block and the footer
   ========================================================================== */
:root {
  /* phones get 16px instead of 14px between independent cards; ≥ 800px unchanged (16→24) */
  --gap: clamp(16px, 2vw, 24px);
  --space-related: var(--space-2);
  --space-inset: var(--pad-card, clamp(20px, 3vw, 36px));
  --space-card: var(--gap);
  --space-section: clamp(32px, 4.5vw, 56px);
  --space-title: clamp(24px, 3.5vw, 44px);
  --space-page-end: clamp(32px, 4vw, 56px);
}

/* Today: every top-level panel (Birthday wishes, the personalized welcome panel,
   the Coming Soon poster and the Today grid) is separated by the parent's gap.
   A gap only appears between panels that are actually displayed, so a hidden
   birthday or welcome panel can never leave a double space or a glued edge. */
body[data-page="today"] main.page { display: flex; flex-direction: column; gap: var(--space-card); }
body[data-page="today"] main.page > * { margin-block: 0; min-width: 0; }

/* Space below the primary page title: one value for every editorial page hero. */
.page-hero { padding-bottom: var(--space-title); }
.page .blog-hero { padding-bottom: var(--space-title); }   /* blog.css loads later, hence .page */
/* Wishlist kept a 24px top offset from the removed “Back to Calendar” button,
   which pushed its title lower than every other page. */
.wish-hero { margin-top: 0; }
/* Placeholder pages: the card sits exactly one title-gap below the lede. */
.soon-card { margin-top: 0; }

/* Space above the footer: one responsive value on every page. */
.page, main.blog-page, .soon-page, .mc-page { padding-bottom: var(--space-page-end); }

/* Major sections inside one page (Journal: “This month” → “Still to come”). */
.jgroup + .jgroup, .demo-banner + .jgroup, .empty-state + .jgroup, .empty-state + .demo-banner { margin-top: var(--space-section); }
