/* =========================================
   init.css (2025 Normalize-lean, no Sass)
========================================= */

:root {
    --font-sans: "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN",
        "メイリオ", Meiryo, "游ゴシック", YuGothic, system-ui,
        -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;

    --base-font-size: 16px;
    --base-line-height: 1.7;

    --color-text: #333;
    --color-text-base: #333;
    --color-text-subtle: #999;
    --color-bg: #fff;

    --color-link: #0066cc;
    --link-color: var(--color-link);
    --link-hover-color: var(--color-link);
    --link-active-color: var(--color-link);
    --link-underline-offset: 0.12em;

    --focus-ring-color: var(--color-link);
    --focus-ring-width: 3px;
    --focus-ring-offset: 2px;

    --border-color-weak: #ccc;
    --selection-bg: rgba(0, 0, 0, 0.12);

    --fw-bold: 700;
}

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

:where([hidden]:not([hidden="until-found"])) {
    display: none !important;
}

:where(html) {
    -webkit-text-size-adjust: 100%;
    color-scheme: light;
    tab-size: 2;
    scrollbar-gutter: stable;
    font-size: var(--base-font-size);
    scroll-behavior: smooth;
}

:where(html:has(dialog:modal[open])) {
    overflow: clip;
}

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

:where(body) {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: var(--base-line-height);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
}

:where(h1, h2, h3, h4, h5, h6, p, figure, blockquote) {
    margin: 0;
}

:where(p, h1, h2, h3, h4, h5, h6) {
    overflow-wrap: break-word;
}

:where(h1, h2, h3) {
    line-height: calc(1em + 0.5rem);
}

:where(a) {
    color: var(--link-color);
    text-decoration: none;
    text-underline-offset: var(--link-underline-offset);
    text-decoration-skip-ink: auto;
    background-color: transparent;
    transition: color 0.2s ease;
}

:where(a:hover) {
    color: var(--link-hover-color);
    text-decoration: underline;
}

:where(a:active) {
    color: var(--link-active-color);
}

:where(ul, ol) {
    margin-block: 0;
    padding-inline-start: 0;
    list-style: none;
}

:where(dl) {
    margin-block: 0;
}

:where(dd) {
    margin-inline-start: 0;
}

:where(img, svg, video, canvas, audio, iframe, embed, object) {
    display: block;
    max-width: 100%;
}

:where(img, video) {
    height: auto;
}

:where(button, input, select, textarea, optgroup) {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
}

:where(button) {
    appearance: none;
    background: none;
    border: 0;
    padding: 0;
    line-height: inherit;
}

:where(button, input[type="button"], input[type="submit"]) {
    cursor: pointer;
}

:where(:disabled) {
    cursor: not-allowed;
}

:where(textarea) {
    resize: vertical;
}

:where(fieldset) {
    margin: 0;
    padding: 0;
    border: 0;
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-subtle);
    opacity: 1;
}

input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
    color: var(--color-text-subtle);
}

:where(
    input[type="text"],
    input[type="search"],
    input[type="number"],
    input[type="email"],
    input[type="password"]
) {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #fff;
    color: var(--color-text-base);
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

input[type="checkbox"] {
    accent-color: #555;
    width: 1em;
    height: 1em;
}

:where(table) {
    border-collapse: collapse;
    border-spacing: 0;
}

:where(hr) {
    height: 1px;
    border: 0;
    background: var(--border-color-weak);
    margin: 1em 0;
}

:where(blockquote, q) {
    quotes: none;
}

:where(blockquote::before, blockquote::after, q::before, q::after) {
    content: "";
}

:where(dialog, [popover]) {
    border: none;
    background: Canvas;
    color: CanvasText;
    inset: unset;
    max-width: unset;
    max-height: unset;
}

:where(dialog:not([open], [popover]), [popover]:not(:popover-open)) {
    display: none !important;
}

:where(:focus-visible) {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}

:where(:focus) {
    outline: none;
}

:where(:focus-visible, :target) {
    scroll-margin-block: 8vh;
}

::selection {
    background: var(--selection-bg);
}

:where(.visually-hidden:not(:focus-within, :active)) {
    clip-path: inset(50%) !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden !important;
    position: absolute !important;
    white-space: nowrap !important;
    border: 0 !important;
    user-select: none !important;
}

:where(strong) {
    font-weight: var(--fw-bold);
}

:where(time) {
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}
