/* Inquiry planner: a sentence with blanks to fill in, choices circled in grease pencil, and a
   card that mirrors the answers, tilts toward the pointer and flips to the message that gets copied.
   Desktop: the sentence in columns 1 to 7, the card in 8 to 12 and sticky. Phone: stacked. */

:root {
  --plan-bar-h: 52px;          /* the phone bar, without its safe-area padding */
}
.section--inquire {
  --planner-error: #A3261E;    /* past-date error text, 6.8:1 on --paper */
}

/* ---- the sentence ---- */
.planner {
  display: grid;
  gap: var(--space-2);
  align-content: start;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.45vw, 2.35rem);
  line-height: 1.7;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.planner__line { margin: 0; }
.planner fieldset.planner__line { min-width: 0; margin: 0; padding: 0; border: 0; }
.planner__lead { margin-right: 0.18em; }

/* blanks: inputs set inline in the sentence, written in italic */
.blank { display: inline; }
.blank input,
.blank textarea {
  display: inline-block;
  margin: 0 0.12em;
  padding: 0 0.1em 0.04em;
  border: 0;
  border-bottom: 1px solid var(--ink-2);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-style: italic;
  line-height: 1.25;
  vertical-align: baseline;
  field-sizing: content;
  transition: border-color var(--dur-ui) var(--ease-out);
}
.blank input::placeholder,
.blank textarea::placeholder { color: var(--ink-2); opacity: 0.55; font-style: italic; }
.blank input:focus,
.blank textarea:focus { outline: none; border-bottom-color: var(--ink); border-bottom-width: 2px; }
.blank input:focus-visible,
.blank textarea:focus-visible { outline: 2px solid var(--bluehour); outline-offset: 4px; }
.blank--names input { min-width: 6ch; max-width: 100%; }
.blank--venue input { min-width: 7ch; max-width: 100%; }
/* browsers that cannot size a field to its content get fixed widths and a taller note */
@supports not (field-sizing: content) {
  .blank--names input { width: 9ch; }
  .blank--venue input { width: 11ch; }
  .blank--note textarea { min-height: 4.5em; }
}
.blank--date input { width: auto; font-size: 0.8em; }
.blank--date input::-webkit-date-and-time-value { text-align: left; }
.blank--date input:disabled { opacity: 0.35; cursor: not-allowed; }
.blank--date input[aria-invalid="true"] { border-bottom-color: var(--planner-error); }
.blank--note { display: block; }
.blank--note textarea {
  display: block;
  width: 100%;
  min-height: 1.4em;
  max-height: 8em;
  margin: 0.15em 0 0;
  resize: none;
  overflow-y: auto;
}
.planner .hint {
  margin: -0.35rem 0 0;
  min-height: 1.4em;
  font-family: var(--font-text);
  font-size: var(--step--1);
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}
.planner .hint.is-error { color: var(--planner-error); font-weight: 500; }

/* ---- choices: words in the sentence, circled in grease pencil when picked ---- */
.planner .chip,
.planner .check {
  position: relative;
  display: inline-block;
  margin: 0 0.08em;
  padding: 0.06em 0.32em; /* with the sentence's line height this keeps every choice at least 44 px tall */
  font-style: italic;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: color var(--dur-ui) var(--ease-out);
}
.planner .chip input,
.planner .check input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.planner .chip__text { position: relative; z-index: 1; pointer-events: none; }
.planner .ring {
  position: absolute;
  left: -4%;
  top: -2%;
  width: 108%;
  height: 104%;
  overflow: visible;
  pointer-events: none;
}
.planner .ring path {
  fill: none;
  stroke: var(--grease);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.6s var(--ease-out);
}
/* picked: ink text and the ring drawn. The class is set by inquiry-ui.js for browsers without :has() */
.planner .chip.is-checked, .planner .check.is-checked { color: var(--ink); }
.planner .chip.is-checked .ring path, .planner .check.is-checked .ring path { stroke-dashoffset: 0; }
.planner .chip:has(input:checked), .planner .check:has(input:checked) { color: var(--ink); }
.planner .chip:has(input:checked) .ring path, .planner .check:has(input:checked) .ring path { stroke-dashoffset: 0; }
.planner .chip.is-focused, .planner .check.is-focused { outline: 2px solid var(--bluehour); outline-offset: 2px; border-radius: 2px; }
.planner .chip:has(input:focus-visible), .planner .check:has(input:focus-visible) { outline: 2px solid var(--bluehour); outline-offset: 2px; border-radius: 2px; }

/* ---- circled frames and liked stories (chips that remove themselves), set in the text face ---- */
.planner .field { margin-top: var(--space-5); font-family: var(--font-text); font-size: var(--step-0); line-height: 1.5; }
.planner .field__label {
  margin: 0 0 var(--space-3);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink-2);
}
.picks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pick {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0.3rem 0.8rem 0.3rem 0.35rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color var(--dur-ui) var(--ease-out), transform 120ms var(--ease-out);
}
.pick--text { padding-left: 0.9rem; }
.pick:active { transform: scale(0.97); }
.pick__thumb {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 1px;
  border: 2px solid var(--grease);
  border-radius: 50%;
  background-clip: content-box;
  object-fit: cover;
}
.pick__x { font-size: 1.15em; line-height: 1; color: var(--ink-2); }
.picks-none { margin: 0; max-width: 46ch; font-size: var(--step--1); color: var(--ink-2); }
.picks-none a { color: var(--ink); }

.planner__clear {
  justify-self: start;
  min-height: 44px;
  margin-top: var(--space-3);
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-family: var(--font-text);
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ---- the card ---- */
.note-card {
  display: grid;
  gap: var(--space-5);
  align-content: start;
  margin-top: var(--space-8);
  font-family: var(--font-text);
  perspective: 1600px;
}
.card {
  position: relative;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 4 / 5;
  margin-inline: auto;
  transform-style: preserve-3d;
  will-change: transform;
}
.card__inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.95s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card[data-flipped="true"] .card__inner { transform: rotateY(180deg); }
.card__face {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--space-3);
  padding: clamp(1.75rem, 3vw, 2.75rem);
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(21, 23, 26, 0.08), 0 34px 70px -34px rgba(21, 23, 26, 0.45);
  text-align: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.card__front::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid var(--rule);
  pointer-events: none;
}
.card__front p { margin: 0; }
.card__brand {
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.card__names {
  max-width: 100%;
  margin-top: var(--space-4) !important;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.3vw, 3.1rem);
  font-style: italic;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.card__date {
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.card__where { font-family: var(--font-display); font-size: var(--step-1); }
.card__rule { display: block; width: 48px; height: 1px; margin: var(--space-2) 0; background: var(--ink); }
.card__cover {
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.card__moments { max-width: 26ch; font-family: var(--font-display); font-style: italic; font-size: var(--step-0); line-height: 1.4; }
.card__front [data-card].is-empty { color: var(--ink-2); opacity: 0.45; }
.card__frames { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: 0; margin-top: var(--space-2); }
.card__frames:empty { display: none; }
.card__frames img {
  width: 34px;
  height: 34px;
  padding: 2px;
  border: 2px solid var(--grease);
  border-radius: 50%;
  background-clip: content-box;
  object-fit: cover;
}
.card__frames span { align-self: center; font-size: var(--step--2); letter-spacing: 0.1em; color: var(--ink-2); }
/* the back: a title row, then the message, which scrolls inside the card when it is long */
.card__back {
  transform: rotateY(180deg);
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  justify-items: stretch;
  text-align: left;
}
.note-card__title { margin: 0; font-family: var(--font-display); font-size: var(--step-2); font-weight: 400; }
.note-card__text {
  margin: 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}
.note-card__actions .button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.card-flip {
  min-height: 44px;
  padding: 0 var(--space-2);
  border: 0;
  background: none;
  color: var(--ink);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  cursor: pointer;
}
.note-card__alt { margin: 0; text-align: center; font-size: var(--step--1); color: var(--ink-2); }
.note-card__alt .text-link { color: var(--ink); overflow-wrap: anywhere; }
.note-card .fine { max-width: 52ch; margin: 0 auto; text-align: center; }

/* ---- the phone bar: Plan your date ---- */
.plan-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(16px, env(safe-area-inset-left, 0px));
  background: var(--ink);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform var(--dur-ui) var(--ease-out), visibility 0s linear var(--dur-ui);
}
.plan-bar.is-shown {
  transform: none;
  visibility: visible;
  transition: transform var(--dur-ui) var(--ease-out), visibility 0s linear 0s;
}
.plan-bar__link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--plan-bar-h);
  color: var(--paper);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
.plan-bar__link:active { opacity: 0.8; }
.plan-bar__link:focus-visible { outline-color: var(--paper); outline-offset: -6px; }
html.has-dialog .plan-bar { visibility: hidden; transform: translateY(100%); transition: none; }
html[data-motion="off"] .plan-bar { transition: none; }

@media (max-width: 599px) {
  /* a small card: tighter type, and a long answer never pushes the card's content off its face */
  .card__face { gap: var(--space-2); padding: 1.5rem 1.25rem; }
  .card__front { align-content: safe center; overflow-y: auto; }
  .card__names { font-size: clamp(1.7rem, 8vw, 2.2rem); margin-top: var(--space-2) !important; }
  .card__date, .card__cover { letter-spacing: 0.16em; }
}
@media (max-width: 899px) {
  html:has(.plan-bar.is-shown) { scroll-padding-bottom: calc(var(--plan-bar-h) + env(safe-area-inset-bottom, 0px)); }
  html:has(.plan-bar.is-shown) .toast { bottom: calc(var(--plan-bar-h) + var(--space-3) + env(safe-area-inset-bottom, 0px)); }
}

/* ---- desktop: the sentence left, the card right ---- */
@media (min-width: 900px) {
  .plan-bar { display: none; }
  .planner-wrap {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--col-gap);
    align-items: start;
  }
  .planner-wrap > .section__head { grid-column: 1 / -1; }
  .planner { grid-column: 1 / span 7; grid-row: 2; }
  .note-card { grid-column: 8 / span 5; grid-row: 2; margin-top: 0; }
}
@media (min-width: 900px) and (min-height: 700px) {
  .note-card { position: sticky; top: calc(var(--masthead-h) + 32px + env(safe-area-inset-top, 0px)); }
}

@media (hover: hover) and (pointer: fine) {
  .planner .chip:hover, .planner .check:hover { color: var(--ink); }
  .blank input:hover, .blank textarea:hover { border-bottom-color: var(--ink); }
  .pick:hover { border-color: var(--ink); }
  .planner__clear:hover, .card-flip:hover { color: var(--ink); text-decoration-thickness: 2px; }
}

@media (forced-colors: active) {
  .planner .ring path { stroke: Highlight; }
  .card__face { border: 1px solid CanvasText; }
}
