/* =========================================================================
   Base — リセットと基本要素
   ========================================================================= */

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

/* hidden 属性は display を指定した要素でも必ず隠す */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading);
  letter-spacing: 0.04em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
  line-break: strict;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  color: var(--color-heading);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: 0.06em;
  font-feature-settings: "palt" 1;
  text-wrap: balance;
}

/* 日本語の見出し・一覧のタイトルは文節で改行する（対応ブラウザのみ。非対応でも通常の折り返しになる） */
:lang(ja) :is(h1, h2, h3, .news-row__title, .project-tile__title, .project-tile__subtitle, .pub__title) {
  word-break: auto-phrase;
}

/* 英語は和文用の字間を使わない */
:lang(en) { letter-spacing: 0.01em; }
:lang(en) :is(h1, h2, h3, h4) { letter-spacing: 0; line-height: 1.35; }

p { text-wrap: pretty; }
p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
/* :where() で詳細度を 0 にして、クラスで指定した余白を打ち消さないようにする */
:where(ul[class], ol[class]) { list-style: none; padding: 0; }

img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }

a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.28em;
}
a:hover { color: var(--color-primary-hover); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }

hr { border: 0; border-top: var(--hairline); margin: 2rem 0; }

table { border-collapse: collapse; width: 100%; }

::selection { background: var(--color-tint-strong); color: var(--color-heading); }

/* ---------- Utilities ---------- */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 16px; top: -100px;
  z-index: 1000;
  padding: 10px 18px;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--color-on-primary); }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.text-muted { color: var(--color-muted); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  display: inline-block;
  vertical-align: -0.18em;
}
