/*
 * Nokkete 公開ページ共通スタイル
 * 外部フォント・外部リソースは使用しない（CSP: style-src 'self'）。
 * JavaScript は主催者登録フォーム（/contact/）の /assets/contact.js だけ（CSP: script-src 'self'）。
 */

/* ---------- デザイントークン ---------- */
:root {
  color-scheme: light dark;

  --brand-pink: #ff3b6b;
  --brand-indigo: #5e5ce6;

  --bg: #fbfafc;
  --surface: #ffffff;
  --surface-muted: #f4f2f7;
  --text: #1c1c1e;
  --text-secondary: #5c5c66;
  --border: #e6e3ec;
  --link: #c8174c;        /* #ff3b6b を白地で AA を満たすよう暗くした色（5.5:1） */
  --link-hover: #a3103c;
  --accent-text: #5e5ce6; /* 背景 #fbfafc に対し 4.8:1 */
  --focus: #5e5ce6;
  --notice-bg: #fff1f5;
  --notice-border: #ffc2d3;
  --error-text: #b3261e;  /* 白地で 6.4:1 */
  --error-bg: #fff2f0;
  --error-border: #f4b9b2;
  --success-text: #17713a; /* #eefaf2 に対し 5.6:1 */
  --success-bg: #eefaf2;
  --success-border: #b5e3c4;
  --field-bg: #ffffff;

  --radius-lg: 20px;
  --radius-md: 14px;
  --gutter: 16px;
  --measure: 720px;

  --font-body: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  --font-heading: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f13;
    --surface: #1a1a20;
    --surface-muted: #202028;
    --text: #ededf2;
    --text-secondary: #a6a6b2;
    --border: #2e2e38;
    --link: #ff7a9a;
    --link-hover: #ffa3ba;
    --accent-text: #a5a4ff;
    --focus: #a5a4ff;
    --notice-bg: #2a1820;
    --notice-border: #5a2a3b;
    --error-text: #ff9b92;
    --error-bg: #2b1716;
    --error-border: #5e2b27;
    --success-text: #7fdc9f;
    --success-bg: #11241a;
    --success-border: #2b5a3c;
    --field-bg: #0f0f13;
  }
}

/* ---------- ベース ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem; /* 17px */
  line-height: 1.8;
  line-break: strict;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

p,
li,
dd {
  text-wrap: pretty;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

strong {
  font-weight: 700;
}

/* ---------- レイアウト ---------- */
.container {
  width: 100%;
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--link);
  font-weight: 700;
  border: 1px solid var(--border);
}

.skip-link:focus {
  top: 12px;
}

/* ---------- ヘッダー ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header .container {
  display: flex;
  align-items: center;
  min-height: 60px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.wordmark:hover {
  color: var(--text);
}

.wordmark-mark {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-pink) 0%, var(--brand-indigo) 100%);
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.55);
  transform: rotate(-8deg);
}

/* ---------- 本文 ---------- */
main {
  display: block;
  padding-block: 32px 56px;
}

.doc-header {
  margin-bottom: 28px;
}

.doc-header h1 {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);
  font-weight: 800;
}

.doc-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.doc-dates div {
  display: flex;
  gap: 6px;
}

.doc-dates dt,
.doc-dates dd {
  margin: 0;
}

.lead {
  margin: 0 0 28px;
}

.notice {
  margin: 0 0 28px;
  padding: 14px 18px;
  border: 1px solid var(--notice-border);
  border-radius: var(--radius-md);
  background: var(--notice-bg);
  font-size: 0.9375rem;
}

.notice p {
  margin: 0;
}

/* 目次 */
.toc {
  margin: 0 0 40px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.toc h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-text);
  letter-spacing: 0.08em;
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc li {
  border-top: 1px solid var(--border);
}

.toc li:first-child {
  border-top: 0;
}

.toc a {
  display: block;
  padding: 9px 0;
  color: var(--text);
  text-decoration: none;
  line-height: 1.6;
}

.toc a:hover {
  color: var(--link);
}

/* セクション */
.doc-section {
  margin-top: 44px;
  scroll-margin-top: 16px;
}

.doc-section > h2 {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  font-size: 1.3125rem;
  font-weight: 800;
}

.doc-section h3 {
  margin: 28px 0 8px;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--accent-text);
}

.doc-section p {
  margin: 0 0 14px;
}

.doc-section ul,
.doc-section ol {
  margin: 0 0 14px;
  padding-left: 1.6em;
}

.doc-section li {
  margin-bottom: 6px;
}

.doc-section li > ul,
.doc-section li > ol {
  margin-top: 6px;
  margin-bottom: 0;
}

/* 条文の「号」: (1) (2) … */
@counter-style paren-decimal {
  system: extends decimal;
  prefix: "(";
  suffix: ") ";
}

ol.items {
  list-style-type: decimal;
  list-style-type: paren-decimal;
  padding-left: 2.4em;
}

/* 項目と説明の組（取得する情報など） */
.data-list {
  margin: 0 0 16px;
  padding: 4px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.data-list div {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.data-list div:first-child {
  border-top: 0;
}

.data-list dt {
  font-weight: 700;
}

.data-list dd {
  margin: 2px 0 0;
  color: var(--text-secondary);
}

.small {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.supplementary {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
}

.supplementary h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.supplementary p {
  margin: 0;
}

.back-to-top {
  margin: 40px 0 0;
  font-size: 0.9375rem;
}

/* ---------- トップページ ---------- */
.hero {
  padding-block: 24px 8px;
  text-align: center;
}

.hero-mark {
  display: block;
  width: 88px;
  height: 88px;
  margin: 0 auto 20px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 30% 25%, rgb(255 255 255 / 0.45) 0 18%, transparent 19%),
    linear-gradient(135deg, var(--brand-pink) 0%, #c04bd0 50%, var(--brand-indigo) 100%);
  box-shadow:
    inset 0 0 0 4px rgb(255 255 255 / 0.6),
    0 14px 30px -12px rgb(94 92 230 / 0.55);
  transform: rotate(-8deg);
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2.25rem, 1.8rem + 2.4vw, 3rem);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.hero p {
  max-width: 34em;
  margin: 0 auto;
  color: var(--text-secondary);
}

.link-cards {
  display: grid;
  gap: 12px;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 600px) {
  .link-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.link-cards a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.link-cards a:hover {
  border-color: var(--link);
  color: var(--text);
}

.link-cards .card-title {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--link);
}

.link-cards .card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---------- 404 ---------- */
.error-page {
  padding-block: 40px 24px;
  text-align: center;
}

.error-code {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 4rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--accent-text);
}

.error-page h1 {
  margin: 8px 0 12px;
  font-size: 1.5rem;
}

.error-page p {
  margin: 0 0 24px;
  color: var(--text-secondary);
}

.button-link {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 999px;
  background: var(--link);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.button-link:hover {
  background: var(--link-hover);
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .button-link,
  .button-link:hover {
    color: #0f0f13;
  }
}

/* ---------- お問い合わせページ（/contact/）の主催者登録・一般のお問い合わせフォーム ---------- */
[hidden] {
  display: none !important;
}

/* 窓口の選択（ページ内のリンクのカード） */
.contact-chooser .link-cards {
  margin: 0 0 8px;
}

@media (min-width: 600px) {
  .contact-chooser .link-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 自動送信の検出用の欄。画面の外に置き、人には見せない（読み上げ・タブ移動の対象外は HTML 側で指定） */
.form-honeypot {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.doc-section ol.steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.doc-section .steps li {
  position: relative;
  margin: 0;
  padding: 14px 18px 14px 60px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  counter-increment: step;
}

.doc-section .steps li::before {
  content: counter(step);
  position: absolute;
  top: 15px;
  left: 18px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-pink) 0%, var(--brand-indigo) 100%);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 800;
  line-height: 1;
}

.steps .step-title {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
}

.steps .step-desc {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.form-card {
  display: grid;
  gap: 22px;
  margin: 0;
  padding: 24px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.form-card[aria-busy="true"] {
  cursor: progress;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.5;
}

.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0.04em;
}

.badge-required {
  border: 1px solid var(--notice-border);
  background: var(--notice-bg);
  color: var(--link);
}

.badge-optional {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* iOS Safari が入力時に拡大しない大きさ */
  line-height: 1.6;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.field textarea {
  min-height: 8.5em;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--text-secondary);
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

.field [aria-invalid="true"] {
  border-color: var(--error-text);
  box-shadow: 0 0 0 1px var(--error-text);
}

.field-hint {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

.field-error {
  margin: 0;
  color: var(--error-text);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.6;
}

.field-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.field-check input[type="checkbox"] {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--link);
}

.field-check input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.field-check input[aria-invalid="true"] {
  outline: 2px solid var(--error-text);
  outline-offset: 2px;
}

.field-check label {
  font-size: 0.9375rem;
  line-height: 1.6;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.button-primary,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 28px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color 0.15s ease-out, border-color 0.15s ease-out, transform 0.15s ease-out;
}

.button-primary {
  border: 0;
  background: var(--link);
  color: #ffffff;
}

.button-primary:hover {
  background: var(--link-hover);
}

.button-secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover {
  border-color: var(--link);
}

.button-primary:active,
.button-secondary:active {
  transform: scale(0.98);
}

.button-primary:focus-visible,
.button-secondary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.button-primary[disabled] {
  opacity: 0.65;
  cursor: progress;
  transform: none;
}

@media (prefers-color-scheme: dark) {
  .button-primary,
  .button-primary:hover {
    color: #0f0f13;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button-primary,
  .button-secondary,
  .field input,
  .field select,
  .field textarea {
    transition: none;
  }
}

.button-spinner {
  flex: none;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .button-spinner {
    animation-duration: 2.4s;
  }
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

.form-alert {
  margin: 0;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.form-alert:focus {
  outline: none;
}

.form-alert:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.form-alert-error {
  border: 1px solid var(--error-border);
  background: var(--error-bg);
  color: var(--text);
}

.form-result {
  padding: 24px 22px;
  border: 1px solid var(--success-border);
  border-radius: var(--radius-lg);
  background: var(--success-bg);
}

.form-result:focus {
  outline: none;
}

.form-result:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.form-result .form-result-title {
  margin: 0 0 8px;
  color: var(--success-text);
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1.4;
}

.form-result p {
  margin: 0 0 14px;
}

.form-result .data-list {
  background: var(--surface);
}

.debug-code {
  padding: 10px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9375rem;
}

/* ---------- フッター ---------- */
.site-footer {
  padding-block: 28px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.footer-nav a {
  display: inline-block;
  padding-block: 6px;
  color: var(--text);
}

.copyright {
  margin: 0;
}

/* ---------- 印刷 ---------- */
@media print {
  .skip-link,
  .toc,
  .back-to-top,
  .footer-nav,
  .form-card,
  .form-result {
    display: none;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 11pt;
  }

  a {
    color: #000000;
  }

  .doc-section {
    break-inside: auto;
  }

  .doc-section > h2 {
    break-after: avoid;
  }
}
