/* Contact page (/contact) — MOBILE and TABLET (below 1024 px). Owner: CONTACT. Designed on its own for phones first.
   Every selector starts with .contact-main. Tokens and components come from base.css; the only extra colours are the
   app's own error tokens (Palette.danger / dangerLine / dangerPale), which base.css does not carry.
   Phones: the words, then the star stage (star + bubble side by side), then the form, then a centred press-and-hold.
   Tablets (700 px+): a centred 640 px column with a bigger star and the send row laid out like desktop.
   No wrapper box: every field, the chooser and the send button stand on the sky themselves (brief §14). */

.contact-main {
  --ct-danger: #D13438;        /* app Palette.danger */
  --ct-danger-line: #F0C9CA;   /* app Palette.dangerLine */
  --ct-danger-pale: #FDECEC;   /* app Palette.dangerPale */
  --ct-h: 96px;                /* the star's body height on the stage: every pose stands at this size */
}

.contact-main [hidden] { display: none !important; }

/* ============================================================ the band: Today's sky, fading into the white footer */
.contact-main .ct {
  position: relative;
  overflow-x: clip;
  margin-top: calc(var(--header-h) * -1);                 /* the sky runs behind the glass header */
  padding: calc(var(--header-h) + 34px) 0 var(--section-y);
  background: linear-gradient(180deg, var(--sky-0) 0%, var(--sky-1) 40%, #fff 100%);
}
.contact-main .ct-in {
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.contact-main .ct-title {
  font-size: clamp(42px, 11.6vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.034em;
  font-weight: 500;
  color: var(--ink);
}
.contact-main .ct-lede { max-width: 30em; margin-top: 14px; }

/* page-load rise (CSS only; base.css turns it off for reduced motion) */
.contact-main .ct-rise { animation: ct-rise .8s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes ct-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ============================================================ the star stage */
.contact-main .ct-stage {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  min-height: calc(var(--ct-h) + 40px);
}
.contact-main .ct-glow {
  position: absolute; z-index: -1;
  left: -70px; top: -50px;
  width: calc(var(--ct-h) * 1.25 + 140px); height: calc(var(--ct-h) + 110px);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .92), rgba(255, 255, 255, .5) 55%, rgba(255, 255, 255, 0));
  pointer-events: none;
}
.contact-main .ct-star {
  position: relative;
  flex: none;
  width: calc(var(--ct-h) * 1.2);
  height: calc(var(--ct-h) + 18px);
}
.contact-main .ct-float {
  position: absolute; left: 0; right: 0; top: 0;
  height: var(--ct-h);
  animation: ct-float 3s ease-in-out infinite alternate;
}
.contact-main .ct-act,
.contact-main .ct-wave {
  position: absolute; inset: 0;
  transform-origin: 50% 100%;
}
/* Every pose is sized by its BODY height (not the image box), so the star never grows or shrinks between poses. */
.contact-main .ct-pose {
  position: absolute;
  bottom: 0;
  width: calc(var(--ct-h) / var(--r));
  max-width: none;
  left: calc(50% - var(--ct-h) / var(--r) * var(--cx));
  opacity: 0;
  transform: scale(.86);
  transform-origin: 50% 100%;
  transition: opacity .2s var(--ease), transform .55s var(--spring);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.contact-main .ct-pose.is-on { opacity: 1; transform: none; transition: opacity .26s var(--ease) .04s, transform .6s var(--spring); }
.contact-main .ct-shadow {
  position: absolute;
  left: 50%; bottom: 0;
  width: 44%; margin: 0;
  transform: translateX(-50%);
  background: rgba(var(--deep-rgb), .13);
  animation: ct-shadow 3s ease-in-out infinite alternate;
}
@keyframes ct-float { from { transform: translateY(2px) rotate(-1.2deg); } to { transform: translateY(-7px) rotate(1.2deg); } }
@keyframes ct-shadow { from { transform: translateX(-50%) scaleX(1); opacity: 1; } to { transform: translateX(-50%) scaleX(.84); opacity: .7; } }

/* one-shot reactions (js adds the class) */
.contact-main .ct-act.is-hop { animation: ct-hop .62s var(--ease); }
.contact-main .ct-act.is-shake { animation: ct-shake .56s var(--ease); }
.contact-main .ct-act.is-joy { animation: ct-joy .9s var(--ease); }
@keyframes ct-hop {
  0% { transform: none; }
  18% { transform: translateY(2px) scale(1.05, .94); }
  45% { transform: translateY(-18px) scale(.97, 1.04); }
  72% { transform: translateY(0) scale(1.04, .95); }
  88% { transform: scale(.99, 1.01); }
  100% { transform: none; }
}
@keyframes ct-shake {
  0%, 100% { transform: none; }
  15% { transform: translateX(-8px) rotate(-3deg); }
  32% { transform: translateX(7px) rotate(2.5deg); }
  50% { transform: translateX(-5px) rotate(-1.5deg); }
  68% { transform: translateX(3px) rotate(1deg); }
  84% { transform: translateX(-1px); }
}
@keyframes ct-joy {
  0% { transform: none; }
  16% { transform: translateY(3px) scale(1.08, .9); }
  40% { transform: translateY(-26px) scale(.96, 1.05) rotate(-4deg); }
  62% { transform: translateY(0) scale(1.06, .93); }
  78% { transform: translateY(-6px) rotate(2deg); }
  100% { transform: none; }
}
/* the waving pose waves in three bursts around its feet */
.contact-main .ct-stage[data-pose="waving"] .ct-wave { animation: ct-wave 2.8s var(--ease) .5s 3; }
@keyframes ct-wave {
  0%, 44%, 100% { transform: none; }
  8% { transform: rotate(-6deg); }
  16% { transform: rotate(5deg); }
  24% { transform: rotate(-4deg); }
  32% { transform: rotate(2deg); }
}

/* the app's speech bubble: white, radius 12, a 2 px under-line and a tail pointing at the star */
.contact-main .ct-bubble {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 52px;
  max-width: 250px;
  padding: 10px 16px;
  border-radius: var(--r-row);
  background: #fff;
  border: 1px solid var(--edge);
  box-shadow: 0 2px 0 var(--edge), var(--depth-1);
  transform-origin: 0 50%;
  margin-bottom: 18px;                                   /* its centre sits level with the star's body */
}
.contact-main .ct-bubble::before {
  content: "";
  position: absolute;
  left: -7.5px; top: 50%;
  width: 13px; height: 13px;
  margin-top: -6.5px;
  background: #fff;
  border-left: 1px solid var(--edge);
  border-bottom: 1px solid var(--edge);
  border-bottom-left-radius: 3px;
  transform: rotate(45deg);
}
.contact-main .ct-say {
  font-size: 15.5px;
  line-height: 1.4;
  font-weight: 400;
  color: var(--ink);
  text-wrap: balance;
}
.contact-main .ct-bubble.is-new { animation: ct-pop .46s var(--spring); }
@keyframes ct-pop { from { transform: scale(.9); opacity: .2; } to { transform: none; opacity: 1; } }

/* ============================================================ the form */
.contact-main .ct-main { margin-top: 22px; }
.contact-main .ct-swap { position: relative; transition: height .5s var(--ease); }
.contact-main .ct-form {
  container-type: inline-size;
  display: grid;
  gap: 20px;
}
.contact-main .ct-pair { display: grid; gap: 20px; }
.contact-main .ct-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.contact-main .ct-label {
  display: block;
  float: none;
  padding: 0;
  margin-bottom: 9px;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--ink);
}
.contact-main .ct-input {
  display: block;
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--edge);
  border-radius: var(--r-row);
  background: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 400;
  color: var(--ink);
  box-shadow: var(--highlight), var(--depth-1);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.contact-main .ct-input::placeholder { color: var(--secondary); opacity: .72; font-weight: 350; }
@media (hover: hover) { .contact-main .ct-input:hover { border-color: var(--edge-strong); } }
.contact-main .ct-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 5px rgba(var(--accent-rgb), .12);
}
.contact-main .has-error .ct-input,
.contact-main .has-error .ct-input:hover {
  border-color: var(--ct-danger);
  box-shadow: 0 0 0 1px var(--ct-danger), 0 0 0 5px rgba(209, 52, 56, .08);
}
.contact-main .ct-area {
  height: auto;
  min-height: 168px;
  padding: 14px 16px;
  line-height: 1.55;
  resize: vertical;
}
.contact-main .ct-err {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--ct-danger);
  text-wrap: pretty;
  animation: ct-err .3s var(--ease);
}
.contact-main .ct-err:empty { display: none; }
@keyframes ct-err { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.contact-main .ct-foot { display: flex; align-items: flex-start; gap: 16px; }
.contact-main .ct-foot .ct-err { flex: 1; }
.contact-main .ct-count {
  margin: 8px 0 0 auto;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.contact-main .ct-count.is-near { color: var(--ink); }

/* the honeypot: off screen, never tabbed to */
.contact-main .ct-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---- "What's it about?": five choice tiles, each with the app's star in that mood (owner, 29 Sep) ----
   Unselected: white, soft edge, depth-1, hover lift. Selected: a 2 px accent edge drawn INSIDE (the tile never changes
   size), the --selected fill, the label in --accent-edge, and its mini star hops. The art stands free (no box behind it). */
.contact-main .ct-topics legend { display: block; }
.contact-main .ct-tile { position: relative; display: flex; min-width: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.contact-main .ct-tile input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.contact-main .ct-tile-box {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  border-radius: var(--r-tile);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--edge), var(--depth-1);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .2s var(--ease);
}
@media (hover: hover) {
  .contact-main .ct-tile:hover .ct-tile-box { transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--edge-strong), var(--depth-2); }
  .contact-main .ct-tile:hover input:checked + .ct-tile-box { box-shadow: inset 0 0 0 2px var(--accent), var(--depth-2); }
}
.contact-main .ct-tile:active .ct-tile-box { transform: scale(.97); }
.contact-main .ct-tile input:checked + .ct-tile-box { background: var(--selected); box-shadow: inset 0 0 0 2px var(--accent), var(--depth-1); }
.contact-main .ct-tile input:focus-visible + .ct-tile-box { outline: 2px solid var(--accent); outline-offset: 3px; }
/* every pose is sized by its BODY height, so the five stars stand at exactly the same size */
.contact-main .ct-tile-art { position: relative; display: block; width: 100%; height: calc(var(--art-h) * 1.14); }
.contact-main .ct-tile-art img {
  position: absolute; bottom: 1px;
  width: calc(var(--art-h) / var(--r));
  max-width: none;
  left: calc(50% - var(--art-h) / var(--r) * var(--cx));
  filter: drop-shadow(0 4px 5px rgba(15, 26, 43, .14));
  transform-origin: 50% 100%;
  pointer-events: none;
  user-select: none; -webkit-user-select: none;
}
.contact-main .ct-tiles.is-live .ct-tile input:checked + .ct-tile-box img { animation: ct-mini-hop .56s var(--ease); }
@keyframes ct-mini-hop {
  0% { transform: none; }
  20% { transform: translateY(1px) scale(1.08, .9); }
  48% { transform: translateY(-9px) scale(.96, 1.05); }
  74% { transform: translateY(0) scale(1.04, .96); }
  100% { transform: none; }
}
.contact-main .ct-tile-label {
  display: flex; align-items: center; justify-content: center;
  min-height: 2.5em;                                   /* room for two lines, so all five tiles are the same size */
  line-height: 1.25;
  font-weight: 500;
  color: var(--ink);
  text-align: center;
  text-wrap: balance;
  transition: color .2s var(--ease);
}
.contact-main .ct-tile input:checked + .ct-tile-box .ct-tile-label { color: var(--accent-edge); }
/* phones: a 3 + 2 grid, the second row centred; tablets: all five in one row */
.contact-main .ct-tiles { --art-h: 50px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.contact-main .ct-tile { grid-column: span 2; }
.contact-main .ct-tile:nth-child(4) { grid-column: 2 / span 2; }
.contact-main .ct-tile:nth-child(5) { grid-column: 4 / span 2; }
.contact-main .ct-tile-box { padding: 12px 3px 9px; }
.contact-main .ct-tile-label { font-size: 14px; }
@media (max-width: 359.98px) {
  .contact-main .ct-tiles { --art-h: 44px; gap: 8px; }
  .contact-main .ct-tile-box { padding: 10px 2px 8px; }
  .contact-main .ct-tile-label { font-size: 13px; }
}
@media (min-width: 700px) {
  .contact-main .ct-tiles { --art-h: 54px; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
  .contact-main .ct-tile, .contact-main .ct-tile:nth-child(4), .contact-main .ct-tile:nth-child(5) { grid-column: auto; }
  .contact-main .ct-tile-box { padding: 14px 4px 10px; }
  .contact-main .ct-tile-label { font-size: 15px; }
}

/* ---- the send: press and hold the star (the app's promise ring) ---- */
/* phones: the hold is the finale, centred like the app's promise */
.contact-main .ct-send { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 10px; text-align: center; }
.contact-main .ct-hold {
  --s: 112px;
  position: relative;
  flex: none;
  width: var(--s); height: var(--s);
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--highlight), 0 0 0 1px var(--edge), var(--depth-2);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
@media (hover: hover) {
  .contact-main .ct-hold:hover { transform: translateY(-2px); box-shadow: var(--highlight), 0 0 0 1px var(--edge-strong), var(--depth-hover); }
}
.contact-main .ct-hold:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; border-radius: 50%; }
.contact-main .ct-hold:active { transform: scale(.97); }
.contact-main .ct-hold.is-holding,
.contact-main .ct-hold.is-full { transform: scale(.97); box-shadow: var(--highlight), 0 0 0 1px var(--tint-line), var(--depth-1); }
.contact-main .ct-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.contact-main .ct-ring circle { fill: none; stroke-width: 6; }
.contact-main .ct-ring-track { stroke: var(--tint-line); }
.contact-main .ct-ring-fill {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 314.16;
  stroke-dashoffset: 314.16;
  opacity: 0;
  transition: stroke-dashoffset .38s var(--ease), opacity .2s var(--ease) .18s;
}
.contact-main .ct-hold.is-holding .ct-ring-fill,
.contact-main .ct-hold.is-full .ct-ring-fill { opacity: 1; transition: none; }
.contact-main .ct-hold.is-sending .ct-ring-fill { animation: ct-breathe 1.1s ease-in-out infinite alternate; }
@keyframes ct-breathe { from { opacity: 1; } to { opacity: .55; } }
.contact-main .ct-face {
  position: absolute; inset: 14px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #fff;
  transition: background-color .2s var(--ease);
  pointer-events: none;
}
.contact-main .ct-hold.is-holding .ct-face,
.contact-main .ct-hold.is-full .ct-face { background: var(--selected); }
.contact-main .ct-face-star { width: 64px; max-width: none; transform-origin: 50% 90%; pointer-events: none; }
.contact-main .ct-status {
  font-size: 17px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--ink);
  text-wrap: balance;                                    /* "Please check the highlighted fields." never leaves one word */
}
.contact-main .ct-status.is-bad { color: var(--ct-danger); }
.contact-main .ct-note { margin: 4px auto 0; max-width: 300px; }

.contact-main .ct-mail { margin-top: 26px; font-size: 15.5px; line-height: 1.5; color: var(--body); text-align: center; }
.contact-main .ct-mail a {
  color: var(--accent-edge);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(var(--accent-rgb), .35);
  transition: text-decoration-color .2s var(--ease);
}
@media (hover: hover) { .contact-main .ct-mail a:hover { text-decoration-color: currentColor; } }

/* ============================================================ after the send */
.contact-main .ct-form.is-leaving { animation: ct-leave .32s var(--ease) forwards; pointer-events: none; }
@keyframes ct-leave { to { opacity: 0; transform: translateY(-10px) scale(.985); } }
.contact-main .ct-done { padding-top: 10px; animation: ct-rise .7s var(--ease) both; }
.contact-main .ct-done-title {
  font-size: clamp(30px, 8.4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.028em;
  font-weight: 500;
  color: var(--ink);
  text-wrap: balance;
}
.contact-main .ct-done-title:focus { outline: none; }
.contact-main .ct-done-text { max-width: 480px; margin-top: 14px; }
/* the message you sent, as a note card (the app's journal note: an item, not a wrapper) */
.contact-main .ct-sent {
  max-width: 560px;
  margin-top: 24px;
  padding: 16px 18px 18px;
  border-radius: var(--r-tile);
  background: #fff;
  border: 1px solid var(--edge);
  box-shadow: var(--highlight), var(--depth-2);
  animation: ct-rise .7s var(--ease) .12s both;
}
.contact-main .ct-sent-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; line-height: 1.4; }
.contact-main .ct-sent-topic { color: var(--accent-edge); font-weight: 600; }
.contact-main .ct-sent-state { display: inline-flex; align-items: center; gap: 6px; color: var(--secondary); font-weight: 500; }
.contact-main .ct-sent-state::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  background: var(--leaf) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.5 12.5l3.6 3.6L17.5 8.7' fill='none' stroke='white' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.contact-main .ct-sent-msg {
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-line;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.contact-main .ct-sent-from { margin-top: 12px; font-size: 14px; line-height: 1.4; color: var(--secondary); overflow-wrap: anywhere; }
.contact-main .ct-again {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  margin-top: 18px;
  font-size: 16px;
  font-weight: 500;
  color: var(--accent-edge);
  border-radius: 8px;
  transition: color .2s var(--ease), transform .2s var(--ease);
}
.contact-main .ct-again::after {
  content: ""; width: 16px; height: 16px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12h13M13 6.5l5.5 5.5-5.5 5.5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12h13M13 6.5l5.5 5.5-5.5 5.5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .25s var(--spring);
}
@media (hover: hover) { .contact-main .ct-again:hover { color: var(--accent); } .contact-main .ct-again:hover::after { transform: translateX(3px); } }
.contact-main .ct-again:active { transform: scale(.97); }

/* the confetti and hearts layer (js adds it for a moment) */
.contact-main .ct-confetti { position: fixed; inset: 0; z-index: 60; width: 100vw; height: 100vh; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .contact-main .ct-pose, .contact-main .ct-pose.is-on { transition: none; transform: none; }
  .contact-main .ct-float, .contact-main .ct-shadow, .contact-main .ct-wave { animation: none !important; }
}

/* ---- tablets (700–1023 px): a centred column, a bigger star, the send row laid out beside its words ---- */
@media (min-width: 700px) {
  .contact-main { --ct-h: 128px; }
  .contact-main .ct { padding-top: calc(var(--header-h) + 56px); }
  .contact-main .ct-in { max-width: calc(640px + var(--gutter) * 2); }
  .contact-main .ct-stage { gap: 20px; margin-top: 30px; }
  .contact-main .ct-bubble { max-width: 290px; padding: 12px 20px; min-height: 56px; margin-bottom: 22px; }
  .contact-main .ct-say { font-size: 17px; }
  .contact-main .ct-main { margin-top: 30px; }
  .contact-main .ct-form { gap: 24px; }
  .contact-main .ct-pair { grid-template-columns: 1fr 1fr; gap: 18px; }
  .contact-main .ct-send { flex-direction: row; gap: 22px; text-align: left; }
  .contact-main .ct-note { margin-left: 0; }
  .contact-main .ct-mail { text-align: left; }
}
/* very small phones (320): a slightly smaller star so the bubble keeps its room */
@media (max-width: 359.98px) {
  .contact-main { --ct-h: 84px; }
  .contact-main .ct-stage { gap: 12px; }
  .contact-main .ct-bubble { padding: 9px 13px; }
  .contact-main .ct-say { font-size: 15px; }
}
/* after the send, the email line lines up with the left-aligned thank-you */
.contact-main .ct-main:has(.ct-done:not([hidden])) .ct-mail { text-align: left; }
