/* ==========================================================================
   RYUHEIDOU / Base — reset, typography, 紙のテクスチャ
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + var(--sp-4));
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: var(--lh-body);
    font-weight: 400;
    color: var(--ink);
    /* body には単色だけを置く。
       テクスチャ（縦の擦れ・ざらつき）を body の background に敷くと、
       ページ全高（約1万px）× 画面幅ぶんを Chrome がラスタライズしようとして
       メインスレッドが固まり、スクロール先が真っ白になる。 */
    background-color: var(--paper);
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* 紙の質感はビューポート固定の1枚のオーバーレイにまとめる。
   position: fixed なので描画面積は常に画面ぶんだけで済む。
   mix-blend-mode は使わない（合成レイヤーが肥大するため）。クリックは透過。 */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        var(--grain),
        repeating-linear-gradient(90deg,
            rgba(22, 18, 15, 0.05) 0 1px,
            transparent 1px 3px);
    background-size: 160px 160px, auto;
    opacity: 0.34;
    pointer-events: none;
    z-index: 9999;
}

/* ----- 見出し ---------------------------------------------------------- */
h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: var(--lh-tight);
    letter-spacing: 0.01em;
}

/* 日本語見出しはAntonが効かないので極太ゴシックに落とす */
:lang(ja) h1,
:lang(ja) h2,
:lang(ja) h3,
:lang(ja) h4 {
    font-weight: 900;
}

p {
    text-wrap: pretty;
}

/* ----- リンク ---------------------------------------------------------- */
a {
    color: inherit;
    text-decoration: none;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: var(--bw-thick) solid var(--blue);
    outline-offset: 2px;
}

/* ----- メディア -------------------------------------------------------- */
img,
picture,
video,
iframe {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

/* ----- フォーム要素 ---------------------------------------------------- */
button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

ul,
ol {
    list-style: none;
}

hr {
    border: none;
}

/* ----- ユーティリティ -------------------------------------------------- */
.u-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* 内蔵SVGアイコン（currentColor で親の色に追従する） */
.icon {
    width: 20px;
    height: 20px;
    display: block;
    color: inherit;
    fill: none;
    pointer-events: none;
}

/* 語中で折り返させたくないひとかたまり */
.u-nowrap {
    white-space: nowrap;
}

.u-mono {
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
}

.u-en {
    font-family: var(--font-display);
    letter-spacing: 0.02em;
}

/* スキップリンク */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--sp-4);
    z-index: 10000;
    padding: var(--sp-2) var(--sp-4);
    background: var(--acid);
    border: var(--border-thick);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
}

.skip-link:focus {
    top: var(--sp-2);
}
