/* ==========================================================================
   HapyTask website — Contact page
   Builds on site.css tokens and components. Form + side cards, and the
   success / fallback panels that replace the form after sending.
   ========================================================================== */

/* ---------- Hero ---------- */
.contact-hero {
  /* extra room at the bottom: the form card rises into the cloud line */
  padding-bottom: clamp(120px, 13vw, 180px);
}
.contact-hero__inner {
  position: relative; z-index: 2;
  display: grid; align-items: center; gap: 24px;
}
.contact-hero h1 { max-width: 13ch; }
.contact-hero .lede { max-width: 46ch; margin-bottom: 0; }

.contact-hero__art { display: none; position: relative; width: 300px; height: 280px; }
.contact-hero__buddy {
  position: absolute; right: 10px; bottom: -20px; width: 250px;
  filter: drop-shadow(0 22px 22px rgba(3, 25, 69, 0.22));
  animation: bob 5.5s ease-in-out infinite;
}
.contact-hero__bubble {
  position: absolute; top: 18px; left: 0; z-index: 1;
  padding: 10px 18px;
  background: #fff; color: var(--ink);
  border-radius: var(--r-pill);
  font-weight: 900; font-size: 18px; line-height: 1.2; white-space: nowrap;
  box-shadow: inset 0 -3px 0 var(--edge), var(--shadow-soft);
  transform: rotate(-6deg);
}
.contact-hero__bubble::after {
  content: ''; position: absolute; right: 18px; bottom: -9px;
  width: 18px; height: 18px; background: #fff; border-radius: 3px;
  transform: rotate(45deg);
  box-shadow: 3px 3px 0 -1px var(--edge);
}
.contact-hero__coin {
  position: absolute; width: 44px; height: 44px;
  filter: drop-shadow(0 8px 10px rgba(86, 39, 2, 0.25));
  animation: bob-rot 4.5s ease-in-out infinite;
}
.contact-hero__coin--a { left: 34px; bottom: 34px; --rot: -12deg; }
.contact-hero__coin--b { right: -6px; top: 70px; width: 32px; height: 32px; --rot: 14deg; animation-delay: -1.6s; }

.contact-hero__cloud-mid { display: none; }
@media (max-width: 859.98px) {
  .contact-hero .cloud { width: calc(var(--w, 180px) * 0.6); }
}

@media (min-width: 860px) {
  .contact-hero__inner { grid-template-columns: minmax(0, 1fr) auto; }
  .contact-hero__art { display: block; }
  .contact-hero__cloud-mid { display: block; }
}

/* ---------- Layout ---------- */
.page-hero + .section.contact-section { padding-top: 0; }
.contact-grid {
  position: relative; z-index: 2;
  margin-top: calc(-1 * clamp(64px, 8vw, 104px));
  display: grid; gap: clamp(28px, 4vw, 40px); align-items: start;
}
@media (min-width: 960px) {
  .contact-grid { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
}

/* ---------- Form card ---------- */
.contact-card { padding: clamp(24px, 4vw, 44px); }
.contact-card__head h2 { margin-bottom: 6px; }
.contact-card__head p { margin: 0; font-size: 16px; font-weight: 600; }

.contact-form { container-type: inline-size; margin-top: 26px; }
.form-grid { display: grid; gap: 22px; }
@container (min-width: 580px) {
  .form-grid { grid-template-columns: 1fr 1fr; gap: 22px 20px; }
  .form-grid .field--full { grid-column: 1 / -1; }
}
.form-grid .field--full { grid-column: 1 / -1; }

.field__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field .hint { margin: 0; }
.field-error { margin: 0; display: flex; align-items: flex-start; gap: 6px; }
.field-error::before {
  content: '!'; flex: none;
  display: inline-grid; place-items: center;
  width: 18px; height: 18px; margin-top: 1px;
  border-radius: 50%; background: #c62828; color: #fff;
  font-size: 12px; font-weight: 900; line-height: 1;
}
.field-error[hidden] { display: none; }

.counter {
  font-size: 14px; font-weight: 800; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.counter.is-near { color: var(--reward); }
.counter.is-max { color: #c62828; }

/* Account & data hint: shown for that topic (always shown without JS) */
.topic-hint {
  display: flex; align-items: flex-start; gap: 12px;
  margin: -6px 0 0; padding: 12px 16px;
  background: var(--cream); color: var(--reward);
  border-radius: var(--r-md);
  font-size: 15px; font-weight: 700; line-height: 1.45;
}
.topic-hint img { width: 28px; height: 28px; flex: none; }
.topic-hint[hidden] { display: none; }

/* Honeypot: off-screen, never display:none (so bots still see it) */
.hp-field {
  position: absolute !important; left: -10000px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}

/* Submit + notes */
.form-actions { margin-top: 28px; display: grid; gap: 14px; justify-items: start; }
.contact-submit { width: 100%; position: relative; }
@media (min-width: 640px) { .contact-submit { width: auto; min-width: 230px; } }
.contact-submit__coin { display: none; width: 24px; height: 24px; }
.contact-submit[disabled] { cursor: progress; transform: none; box-shadow: 0 5px 0 var(--btn-edge), 0 14px 24px -10px rgba(3, 25, 69, 0.4); }
.is-sending .contact-submit { --btn-bg: var(--green-ui-hover); }
.is-sending .contact-submit__plane { display: none; }
.is-sending .contact-submit__coin { display: block; animation: coin-flip 0.9s linear infinite; }
@keyframes coin-flip { to { transform: rotateY(360deg); } }

.form-status { margin: 0; color: #c62828; font-size: 15px; font-weight: 800; }
.form-status:empty { display: none; }
.privacy-note { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.privacy-note a { font-weight: 800; }

/* `hidden` must win over component display rules such as .btn { display: inline-flex } */
.contact-card [hidden] { display: none !important; }

/* ---------- Result panels (sent / didn't send) ---------- */
.contact-result { display: none; text-align: center; padding: clamp(4px, 2vw, 20px) 0 clamp(4px, 1.5vw, 12px); }
.contact-result.is-shown { display: block; animation: contact-pop 0.55s var(--ease-pop) both; }
/* No-JS: the API redirects to /contact?sent=1#sent or ?error=1#send-error */
.no-js .contact-result:target { display: block; }
.no-js .contact-card:has(.contact-result:target) .contact-form-view { display: none; }

.contact-result__art { position: relative; width: 168px; margin: 0 auto 10px; }
.contact-result__art > img:first-child { width: 100%; filter: drop-shadow(0 18px 20px rgba(3, 25, 69, 0.18)); }
.contact-result--sent .contact-result__art > img:first-child { animation: bob 3.2s ease-in-out infinite; }
.contact-result__title { font-size: clamp(2rem, 4.4vw, 2.7rem); letter-spacing: -0.03em; margin-bottom: 0.35em; }
.contact-result__title:focus { outline: none; }
.contact-result__title:focus-visible { outline: 3px solid var(--blue); outline-offset: 6px; }
.contact-result p { max-width: 44ch; margin-inline: auto; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.contact-result p strong { color: var(--ink); font-weight: 900; }

.twinkle { position: absolute; width: 20px; height: 20px; animation: twinkle 2.4s ease-in-out infinite; }
.twinkle--1 { left: -18px; top: 26%; }
.twinkle--2 { right: -14px; top: 12%; width: 26px; height: 26px; animation-delay: -0.8s; }
.twinkle--3 { right: -26px; top: 58%; width: 16px; height: 16px; animation-delay: -1.5s; }

.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 24px; }
.result-actions .btn { flex: 1 1 100%; }
@media (min-width: 520px) { .result-actions .btn { flex: 0 1 auto; } }
.result-note { margin-top: 18px !important; font-size: 15px !important; color: var(--muted); }

@keyframes contact-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* ---------- Side cards ---------- */
.contact-aside {
  display: grid; gap: 20px; align-content: start;
  padding-top: 78px; /* room for the bear peeking over the first card */
}
/* Tablet: email card full width under the bear, the two taller cards side by side */
@media (min-width: 640px) and (max-width: 959.98px) {
  .contact-aside { grid-template-columns: 1fr 1fr; }
  .contact-aside > .peek { grid-column: 1 / -1; }
}

.side-card { padding: clamp(22px, 2.6vw, 28px); }
.side-card__head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.side-card h2 { font-size: 1.28rem; line-height: 1.15; letter-spacing: -0.015em; margin: 0; }
.side-card p { font-size: 16px; line-height: 1.55; }
.side-card > :last-child { margin-bottom: 0; }

.side-card__icon {
  flex: none; width: 56px; height: 56px; border-radius: 18px;
  display: grid; place-items: center;
  box-shadow: inset 0 -3px 0 rgba(1, 40, 121, 0.1);
}
.side-card__icon img { width: 44px; height: 44px; }
.side-card__icon svg { width: 28px; height: 28px; }
.side-card__icon--blue { background: var(--blue-soft); color: var(--blue-edge); }
.side-card__icon--mint { background: var(--mint); }
.side-card__icon--peach { background: var(--peach); }
.side-card__icon--peach img { width: 48px; height: 48px; margin-top: 4px; }

.email-link {
  display: inline-block;
  color: var(--ink); font-weight: 900; font-size: clamp(1.08rem, 1.5vw, 1.2rem);
  text-decoration: underline; text-decoration-color: var(--gold);
  text-decoration-thickness: 3px; text-underline-offset: 6px;
  overflow-wrap: anywhere;
}
.email-link:hover { color: var(--blue-edge); text-decoration-color: var(--blue); }

.tips { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 14px; }
.tips li { position: relative; padding-left: 32px; font-size: 16px; line-height: 1.5; }
.tips li::before {
  content: ''; position: absolute; left: 0; top: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat;
  box-shadow: inset 0 -2px 0 var(--green-edge);
}
.tips strong { display: block; color: var(--ink); font-weight: 900; }

.more-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--blue); font-weight: 900; text-decoration: none;
}
.more-link svg { width: 18px; height: 18px; transition: transform 0.2s var(--ease-out); }
.more-link:hover { color: var(--blue-edge); text-decoration: underline; }
.more-link:hover svg { transform: translateX(3px); }
.side-card__links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.side-card__links a:not(.more-link) { font-weight: 800; }

/* Cuddles peeking over the first side card */
.peek { position: relative; isolation: isolate; display: flex; flex-direction: column; }
.peek > .card { position: relative; z-index: 1; flex: 1 1 auto; }
.peek__bear {
  position: absolute; z-index: 0; top: -80px; right: 20px;
  width: 150px; height: 150px;
  animation: peek-bob 4s ease-in-out infinite;
}
.peek__bubble {
  position: absolute; z-index: 1; top: -64px; right: 172px;
  padding: 8px 14px;
  background: var(--ink); color: #fff;
  border-radius: var(--r-pill);
  font-size: 14px; font-weight: 900; line-height: 1.2; white-space: nowrap;
  box-shadow: var(--shadow-soft);
  transform: rotate(-4deg);
}
.peek__bubble::after {
  content: ''; position: absolute; right: -5px; top: 50%;
  width: 12px; height: 12px; margin-top: -6px;
  background: var(--ink); border-radius: 2px; transform: rotate(45deg);
}
@keyframes peek-bob { 0%, 100% { transform: translateY(4px); } 50% { transform: translateY(-3px); } }
@media (max-width: 380px) {
  .peek__bear { right: 8px; width: 136px; height: 136px; top: -72px; }
  .peek__bubble { right: 146px; top: -58px; font-size: 13px; padding: 7px 12px; }
}
