/* DAKOKU contact form: input, confirmation and completion pages.
   Load this file after the site's common stylesheet. */

:root {
  --contact-ink: #272621;
  --contact-muted: #77746d;
  --contact-gold: #ad9463;
  --contact-line: #ded9cf;
  --contact-paper: #fffefa;
}

/* Limit the rules to the mail form so shared navigation stays intact. */
form:has(> .section) {
  display: block;
  padding: clamp(42px, 7vw, 100px) 24px clamp(70px, 9vw, 130px);
  background: linear-gradient(135deg, #f8f7f3, #f0eeea 72%, #f8f7f3);
  color: var(--contact-ink);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.9;
}

form:has(> .section) *,
form:has(> .section) *::before,
form:has(> .section) *::after { box-sizing: border-box; }

form:has(> .section) > .section {
  width: min(100%, 880px);
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px);
  background: var(--contact-paper);
  border: 1px solid #e9e5dd;
  box-shadow: 0 22px 70px rgba(38, 33, 25, .055);
}

/* The mail form may wrap .section in another element. Keep its card centered
   even when the site's generic .section width rule takes precedence. */
.section:has(.section__body .table) {
  width: calc(100% - 48px) !important;
  max-width: 1320px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

form:has(> .section) .section__body { width: 100%; }

form:has(> .section) #txt_explain {
  margin: 0 0 42px;
  padding-left: 20px;
  border-left: 2px solid var(--contact-gold);
  color: var(--contact-ink);
  letter-spacing: .055em;
}

form:has(> .section) #txt_explain p { margin: 0; }
form:has(> .section) .red_txt {
  margin: 0 0 24px;
  color: #a24c42;
  font-weight: 600;
}

form:has(> .section) .table {
  width: 100%;
  border: 0;
  border-collapse: collapse;
  table-layout: fixed;
  background: transparent;
}

form:has(> .section) .table tr {
  border-top: 1px solid var(--contact-line);
}
form:has(> .section) .table tr:last-child { border-bottom: 1px solid var(--contact-line); }

form:has(> .section) .table th,
form:has(> .section) .table td {
  padding: 22px 10px;
  border: 0;
  background: transparent;
  vertical-align: top;
  font-size: 15px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

form:has(> .section) .table th {
  width: 36%;
  padding-left: 0;
  text-align: left;
  font-weight: 500;
  letter-spacing: .07em;
}

form:has(> .section) .table td { padding-right: 0; }
form:has(> .section) .table input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]),
form:has(> .section) .table textarea,
form:has(> .section) .table select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  padding: 11px 15px;
  border: 1px solid #d8d3ca;
  border-radius: 0;
  outline: none;
  background: #fff;
  color: var(--contact-ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.6;
  transition: border-color .25s ease, box-shadow .25s ease;
}

form:has(> .section) .table textarea {
  min-height: 190px;
  resize: vertical;
}

form:has(> .section) .table :is(input, textarea, select):focus-visible {
  border-color: var(--contact-gold);
  box-shadow: 0 0 0 3px rgba(173, 148, 99, .16);
}

form:has(> .section) .table :is(input, textarea)::placeholder { color: #aaa69d; }
form:has(> .section) .table input[type="checkbox"],
form:has(> .section) .table input[type="radio"] { accent-color: var(--contact-gold); }

form:has(> .section) .button_box {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 44px;
  text-align: center;
}

form:has(> .section) .button_box :is(input[type="submit"], button, a) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 190px;
  min-height: 52px;
  padding: 12px 26px;
  border: 1px solid var(--contact-ink);
  border-radius: 0;
  background: var(--contact-ink);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .16em;
  cursor: pointer;
  transition: background .25s ease, color .25s ease, border-color .25s ease, transform .25s ease;
}

form:has(> .section) .button_box :is(input[type="submit"], button, a):hover {
  border-color: var(--contact-gold);
  background: var(--contact-gold);
  transform: translateY(-2px);
}

form:has(> .section) .button_box :is(input[type="submit"], button, a):focus-visible {
  outline: 2px solid var(--contact-gold);
  outline-offset: 3px;
}

form:has(> .section) .button_box input[value="戻る"] {
  border-color: var(--contact-line);
  background: transparent;
  color: var(--contact-ink);
}

/* Completion template has a section without a surrounding form. */
.section:has(> .section__body > #txt_explain):not(form .section) {
  width: min(100% - 48px, 880px);
  margin: clamp(42px, 7vw, 100px) auto clamp(70px, 9vw, 130px);
  padding: clamp(32px, 6vw, 72px);
  border: 1px solid #e9e5dd;
  background: var(--contact-paper);
  box-shadow: 0 22px 70px rgba(38, 33, 25, .055);
  color: var(--contact-ink);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.9;
  box-sizing: border-box;
}

.section:has(> .section__body > #txt_explain):not(form .section) #txt_explain {
  padding-left: 20px;
  border-left: 2px solid var(--contact-gold);
}

.section:has(> .section__body > #txt_explain):not(form .section) .button_box {
  margin-top: 40px;
  text-align: center;
}

.section:has(> .section__body > #txt_explain):not(form .section) .button_box a {
  display: inline-block;
  padding: 14px 30px;
  border: 1px solid var(--contact-ink);
  background: var(--contact-ink);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  letter-spacing: .12em;
  transition: background .25s ease, border-color .25s ease;
}

.section:has(> .section__body > #txt_explain):not(form .section) .button_box a:hover {
  background: var(--contact-gold);
  border-color: var(--contact-gold);
}

@media (max-width: 640px) {
  .section:has(.section__body .table) { width: calc(100% - 32px) !important; }
  form:has(> .section) { padding: 24px 16px 72px; }
  form:has(> .section) > .section { padding: 28px 20px 36px; }
  form:has(> .section) #txt_explain { margin-bottom: 28px; }
  form:has(> .section) .table,
  form:has(> .section) .table tbody,
  form:has(> .section) .table tr,
  form:has(> .section) .table th,
  form:has(> .section) .table td { display: block; width: 100%; }
  form:has(> .section) .table th { padding: 17px 0 5px; }
  form:has(> .section) .table td { padding: 0 0 18px; }
  form:has(> .section) .button_box { margin-top: 32px; }
  form:has(> .section) .button_box :is(input[type="submit"], button, a) { min-width: 140px; }
  .section:has(> .section__body > #txt_explain):not(form .section) { width: calc(100% - 32px); }
}

@media (prefers-reduced-motion: reduce) {
  form:has(> .section) *,
  .section:has(> .section__body > #txt_explain):not(form .section) * { transition: none !important; }
}
