/* 部室の名札掛け — 全ページ共通の土台。値は tokens.css から取る */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.7;
  font-feature-settings: 'palt';
  overflow-x: hidden;
}

button {
  font: inherit;
  color: inherit;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.page {
  max-width: 64rem;
  margin: 0 auto;
  padding: var(--space-3) var(--gutter) var(--space-section);
}

/* ---------------------------------------------------------------- 上の帯 */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line);
}

.masthead__title {
  margin: 0;
  font-family: var(--font-plaque);
  font-weight: 800;
  font-size: var(--text-lg);
  letter-spacing: 0.12em;
}

/* 設定画面の「← 名札掛けへ」 */
.masthead__days {
  font-size: var(--text-xs);
  color: var(--ink-soft);
  letter-spacing: 0.08em;
}

/* 開室日の札。開いている日だけ朱の印が付く */
.open-day {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.15rem 0.75rem;
  border: 1px solid var(--line-field);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.open-day[data-open='true'] {
  border-color: var(--shu);
  color: var(--ink);
}

.open-day[data-open='true']::before {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--shu);
}

/* ---------------------------------------------------------------- ボタン */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0 var(--space-3);
  border: 1.5px solid var(--line-field);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  transition:
    transform var(--duration-fast) ease,
    background-color var(--duration-fast) ease;
}

.btn:hover {
  background: var(--wall-sunk);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.55;
  cursor: progress;
  transform: none;
}

.btn--primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--wall);
}

.btn--primary:hover {
  background: var(--ink-soft);
}

.btn--big {
  width: 100%;
  min-height: 3.5rem;
  font-size: var(--text-lg);
  border-radius: 14px;
}

.btn--small {
  min-height: 2.5rem;
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
}

.link-quiet {
  padding: 0.5rem;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-quiet:hover {
  color: var(--ink);
}

.link-quiet:disabled {
  opacity: 0.55;
  cursor: progress;
}

/* ---------------------------------------------------------------- ダイアログ（設定画面の編集など）*/

dialog {
  width: min(22rem, calc(100vw - 2 * var(--gutter)));
  padding: var(--space-4) var(--space-3) var(--space-3);
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-card);
}

dialog::backdrop {
  background: var(--scrim);
}

dialog h2 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-lg);
}

.dialog__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

/* ---------------------------------------------------------------- お知らせ・足もと */

.notice {
  margin: var(--space-3) 0 0;
  padding: var(--space-2) var(--space-3);
  border-left: 4px solid var(--shu);
  background: var(--shu-wash);
  border-radius: 0 8px 8px 0;
  font-size: var(--text-sm);
}

.notice[hidden] {
  display: none;
}

.foot {
  margin-top: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--ink-faint);
}

.foot a {
  color: inherit;
  text-underline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
