/* The states of the inquiry forms (contact-form.js), on the Top's dialog, /ec-creative and the portfolio
   (2026-11-15 owner chose S1–S9). Each form keeps its own look (top/page.css, ec-shared.css §4); only the new
   states are drawn here, in each form's colours:
     the Top's frosted dialog · data-tone="light" (the EC page) · data-tone="night" (the portfolio) */
.contact-dialog .contact-form {
  --cf-ink: #213b3b;
  --cf-quiet: #526965;
  --cf-error: #8a302b;
  --cf-line: #213b3b24;
  --cf-panel: #ffffff59;
}
.contact-form[data-tone="light"] {
  --cf-ink: var(--form-label);
  --cf-quiet: var(--form-quiet);
  --cf-error: var(--form-error);
  --cf-line: #20222420;
  --cf-panel: #f6f7f8;
}
.contact-form[data-tone="night"] {
  --cf-ink: var(--form-label);
  --cf-quiet: var(--form-quiet);
  --cf-error: var(--form-error);
  --cf-line: #ffffff2e;
  --cf-panel: #ffffff12;
}

.contact-form .field {
  min-width: 0;
}
/* The messages break between phrases only (contact-form.js puts a zero-width space between them) */
.contact-form :is(.field-error, .form-status, .form-alert, .form-done, .form-noscript) {
  word-break: keep-all;
  overflow-wrap: anywhere;
}
/* S9: only the optional field is marked, 「（任意）」 right after its name */
.contact-dialog .contact-form label > span {
  margin-left: 2px;
}
.contact-form[data-tone] label {
  column-gap: 0;
}

/* S2: one line under the field after it is left (or when sending is tried), in words that say how to fix it */
.contact-form .field-error {
  display: flex;
  gap: 0.4em;
  margin: 8px 0 0;
  color: var(--cf-error);
  font-size: 13px;
  font-weight: 450;
  line-height: 1.6;
}
.contact-form .field-error::before {
  content: "";
  flex: none;
  width: 1.05em;
  height: 1.05em;
  margin-top: 0.27em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 1.5a8.5 8.5 0 1 1 0 17 8.5 8.5 0 0 1 0-17Zm0 11.6a1.1 1.1 0 1 0 0 2.2 1.1 1.1 0 0 0 0-2.2Zm.9-7.6H9.1l.3 6h1.2l.3-6Z'/%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 20 20'%3E%3Cpath d='M10 1.5a8.5 8.5 0 1 1 0 17 8.5 8.5 0 0 1 0-17Zm0 11.6a1.1 1.1 0 1 0 0 2.2 1.1 1.1 0 0 0 0-2.2Zm.9-7.6H9.1l.3 6h1.2l.3-6Z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.contact-form .field-error[hidden] {
  display: none;
}
.contact-form :is(input, select, textarea):user-invalid {
  border-color: var(--cf-error);
  box-shadow: 0 0 0 1px var(--cf-error);
}

/* S8: the characters left, only near the limit */
.contact-form .field-count {
  margin: 8px 0 0;
  color: var(--cf-quiet);
  font-size: 12px;
  line-height: 1.5;
  text-align: end;
  font-variant-numeric: tabular-nums;
}
.contact-form .field-count[data-over] {
  color: var(--cf-error);
}
.contact-form .field-count[hidden] {
  display: none;
}

/* S3: the button's words are the state; the button keeps its place and is not disabled (focus stays on it) */
.contact-form [type="submit"][aria-disabled="true"] {
  cursor: progress;
}
.contact-form [type="submit"][data-state="sending"] {
  opacity: 0.72;
}
.contact-form .form-status[data-state="sending"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.contact-form .form-status[data-state="slow"] {
  color: var(--cf-quiet);
}

/* S5: not sent — the message (.form-status), then the e-mail address as another way, with copy buttons */
.contact-form .form-alert {
  margin-top: -6px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--cf-panel);
  color: var(--cf-ink);
  font-size: 13px;
  line-height: 1.7;
}
.contact-form .form-alert[hidden] {
  display: none;
}
.contact-form .form-alert p {
  margin: 0;
}
.contact-form .form-alert a {
  color: inherit;
  text-underline-offset: 3px;
}
.contact-form .form-alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px !important;
}

/* S4: sent — in the form's place: thanks, when we reply, where, the reception number, and a copy of the inquiry */
.contact-form[data-state="sent"] > :not(.form-done) {
  display: none !important;
}
.contact-form .form-done {
  display: grid;
  gap: 14px;
  color: var(--cf-ink);
}
@media (prefers-reduced-motion: no-preference) {
  .contact-form .form-done {
    animation: cf-arrive 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
}
@media (prefers-reduced-motion: reduce) {
  .contact-form .form-done {
    animation: cf-fade 0.3s ease both;
  }
}
@keyframes cf-arrive {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
@keyframes cf-fade {
  from {
    opacity: 0;
  }
}
.contact-form .form-done-title {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.01em;
  scroll-margin-block: 96px 24px;
}
.contact-form .form-done-title::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.45em;
  vertical-align: -0.06em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 1a9 9 0 1 1 0 18 9 9 0 0 1 0-18Zm4.2 5.4-5.4 5.5-2.9-2.8-1.1 1.1 4 4 6.5-6.7-1.1-1.1Z'/%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 20 20'%3E%3Cpath d='M10 1a9 9 0 1 1 0 18 9 9 0 0 1 0-18Zm4.2 5.4-5.4 5.5-2.9-2.8-1.1 1.1 4 4 6.5-6.7-1.1-1.1Z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.contact-form .form-done-title:focus {
  outline: none;
}
.contact-form .form-done-title:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 4px;
}
.contact-form .form-done p {
  margin: 0;
}
.contact-form .form-done-lead {
  font-size: 14px;
  line-height: 1.9;
}
.contact-form .form-done-time {
  color: var(--cf-quiet);
  font-size: 13px;
  line-height: 1.8;
}
.contact-form .form-done-facts {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--cf-panel);
  font-size: 13px;
  line-height: 1.8;
}
.contact-form .form-done-facts div {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.2em;
}
.contact-form .form-done-facts dt {
  min-width: 5.5em;
  color: var(--cf-quiet);
}
.contact-form .form-done-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.contact-form .form-done-copy {
  margin: 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--cf-line);
  border-bottom: 1px solid var(--cf-line);
  border-radius: 0;
  background: none;
}
.contact-form .form-done-copy summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6em;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 0;
  font-size: 13px;
  font-weight: inherit;
  cursor: pointer;
  list-style: none;
}
.contact-form .form-done-copy summary::after {
  content: none;
  display: none;
}
.contact-form .form-done-copy summary::-webkit-details-marker {
  display: none;
}
.contact-form .form-done-copy summary::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
.contact-form .form-done-copy[open] summary::before {
  transform: rotate(45deg);
}
.contact-form .form-done-copy summary:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 4px;
}
.contact-form .form-done-body {
  word-break: normal;
  padding: 0 0 14px;
  color: var(--cf-ink);
  font-size: 13px;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.contact-form .form-done-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}
.contact-form .form-done-again {
  display: inline;
  height: auto;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 4px;
  cursor: pointer;
}
@media (hover: hover) {
  .contact-form .form-done-again:hover {
    text-decoration-color: currentColor;
  }
}
.contact-form .form-done-again:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 3px;
}
@media (prefers-reduced-motion: reduce) {
  .contact-form .form-done-copy summary::before {
    transition: none;
  }
}

/* S6: without JavaScript, the same one line on the three pages, in the form's own colours */
.contact-form .form-noscript {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--cf-panel);
  color: var(--cf-ink);
  font-size: 13px;
  line-height: 1.8;
}
.contact-form .form-noscript a {
  color: inherit;
  text-underline-offset: 3px;
}
.no-js .contact-form[data-tone] [data-submit] {
  display: none;
}
