/* =========================================================================
   SABI · LAYOUT.CSS · Foundation Layer 2
   Body baseline, reset, container primitives.
   Pattern TCSK 4-layer architecture (verified live tochucsukien.com.vn).
   Depends on: bien-thiet-ke.css
   Since: Phase T0 (v0.12.0)
   ========================================================================= */

/* ===== Universal reset ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== HTML root ===== */
html {
    scroll-behavior: smooth;
    font-size: 16px;
}

/* ===== Body baseline (Typography v1.0 — serif default) ===== */
body.sabi-body {
    background: var(--sumi);
    color: var(--bone-warm);
    font-family: var(--serif);
    font-weight: var(--fw-regular);
    font-size: var(--fs-lead);
    line-height: var(--lh-relaxed);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ===== Subtle film grain overlay (signature wabi-sabi texture) ===== */
body.sabi-body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.035;
    z-index: 9999;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' /></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/></svg>");
    mix-blend-mode: overlay;
}

/* ===== Element baselines ===== */
img, video {
    max-width: 100%;
    display: block;
    height: auto;
}
a {
    color: inherit;
    text-decoration: none;
}
button {
    font-family: inherit;
    cursor: pointer;
    background: none;
    border: none;
    color: inherit;
}
::selection {
    background: var(--bronze);
    color: var(--sumi);
}

/* ===== Container primitives — 4 tiers (theo bien-thiet-ke.css) ===== */
.sabi-container-wide {
    width: min(var(--container-wide), calc(100% - var(--pad-x) * 2));
    margin-inline: auto;
}
.sabi-container-default {
    width: min(var(--container-default), calc(100% - var(--pad-x) * 2));
    margin-inline: auto;
}
.sabi-container-narrow {
    width: min(var(--container-narrow), calc(100% - var(--pad-x) * 2));
    margin-inline: auto;
}
.sabi-container-prose {
    width: min(var(--container-prose), calc(100% - var(--pad-x) * 2));
    margin-inline: auto;
}

/* Điện thoại: chữ trong ô nhập tối thiểu 16px để iPhone không tự phóng to khi bấm vào ô (phóng to bằng 2 ngón vẫn dùng được). */
@media (max-width: 767.98px) {
    input:not([type=checkbox], [type=radio], [type=range], [type=color], [type=file], [type=button], [type=submit], [type=hidden]),
    select,
    textarea {
        font-size: 16px;
    }
}
