/* 土台（tokens.css の変数だけを使う）— docs/ui-guidelines.md・docs/design/README.md */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
/* スマホで横にはみ出さない（はみ出す部品は自分の中で横に流す） */
html, body { max-width: 100%; overflow-x: hidden; }

body {
    margin: 0;
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

/* 農家の画面（マイページ）：文字は 18px 以上。小さい文字も 18px にそろえ、主ボタンは 56px */
html.is-farmer { font-size: var(--font-size-farmer); --font-size-sm: 1rem; --font-size-xs: 1rem; }
html.is-farmer .c-button--primary, html.is-farmer .c-button--large { min-height: var(--tap-large); }

/* 見出しは丸い書体（Zen Maru Gothic）。本文より太く */
h1, h2, h3 { font-family: var(--font-family-heading); font-weight: var(--font-weight-black); line-height: var(--line-height-tight); }
h1 { font-size: var(--font-size-xl); }
h2 { font-size: var(--font-size-lg); }
img { max-width: 100%; height: auto; }
/* hidden を付けたものは必ず隠す（.c-field などの display の指定に負けないように） */
[hidden] { display: none !important; }
a { color: inherit; }
a:hover { color: var(--color-primary); }

/* レイアウト */
.l-page { max-width: var(--width-page); margin: 0 auto; padding: 0 var(--space-4) var(--space-7); }
.l-page--narrow { max-width: var(--width-narrow); }
.l-header { background: var(--color-producer); color: var(--color-primary-text); padding: var(--space-5) 0; }
.l-stack > * + * { margin-top: var(--space-4); }

/* スマホ基準の枠組み（マイページ）。上に見出し、下に大事なボタン */
.l-app { min-height: 100dvh; padding-bottom: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom, 0px)); background: var(--color-bg); }
.l-app__bar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
    min-height: var(--app-bar-height); padding: 0 var(--space-4);
    background: var(--color-surface); color: var(--color-text);
    border-bottom: var(--border-width) solid var(--color-border);
}
.l-app__title { flex: 1; font-size: var(--font-size-md); font-weight: var(--font-weight-black); margin: 0; }
.l-app__bar .c-button { min-height: calc(var(--tap-min) - var(--space-1)); padding: var(--space-2) var(--space-3); }
/* 下の固定ボタンの下に中身が隠れないよう、その分の場所を空ける */
.l-app__body { padding: var(--space-4); padding-bottom: calc(var(--bottom-bar-height) + var(--space-4)); }
.l-app__body > * + * { margin-top: var(--space-4); }
/* パソコンで見たときに横に伸びきらないよう、中身の幅を抑える（農家の画面はスマホ基準） */
.l-app__body, .l-bottom-bar { max-width: var(--width-narrow); margin-left: auto; margin-right: auto; }
.l-bottom-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex; gap: var(--space-2); align-items: center;
    padding: var(--space-2) var(--space-4) calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
    background: var(--color-surface-glass); border-top: var(--border-width) solid var(--color-border);
    box-shadow: var(--shadow-sm);
}
.l-bottom-bar > * { flex: 1; }

/* 買う人・行く人の画面（横幅いっぱい。中身は --width-wide に寄せる） */
.l-site { min-height: 100dvh; display: flex; flex-direction: column; background: var(--color-bg); }
.l-site__main { flex: 1; min-width: 0; max-width: 100%; }
.l-site__body { padding: var(--space-4); }
/* 写真を端まで出す画面（農園ページ）。余白は中の部品が持つ */
.l-site__body--flush { padding: 0; }
.l-site__body--flush > * + * { margin-top: 0; }
.l-site__body > * + * { margin-top: var(--space-4); }
.l-wide { max-width: var(--width-wide); margin: 0 auto; padding: 0 var(--space-4); min-width: 0; }
@media (min-width: 900px) { .l-wide { padding: 0 var(--space-6); } }
.l-site--tabs { padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px)); }

/* 補助 */
.u-muted { color: var(--color-text-muted); }
.u-sm { font-size: var(--font-size-sm); }
.u-xs { font-size: var(--font-size-xs); }
.u-bold { font-weight: var(--font-weight-bold); }
/* 途中で折り返させない（「9月22日 注文」の「注文」だけが次の行に落ちるのを防ぐ） */
.u-nowrap { white-space: nowrap; }
.u-visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
/* パソコンだけ・スマホだけに出すもの（中身は同じ。見せ方だけ変える） */
@media (max-width: 899px) { .u-pc-only { display: none !important; } }
@media (min-width: 900px) { .u-sp-only { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 買う人の画面の足もと */
.l-footer { padding: var(--space-5) var(--space-4) var(--space-6); text-align: center; }

/* 運営の画面：左に濃い帯（メニュー）、右に中身（Admin.html）。スマホでは帯が上に来る */
.l-admin-shell { min-height: 100dvh; display: flex; flex-direction: column; background: var(--color-bg-admin); }
.l-admin-shell__main { flex: 1; min-width: 0; padding: var(--space-5) var(--space-4); display: flex; flex-direction: column; gap: var(--space-5); }
@media (min-width: 900px) {
    .l-admin-shell { flex-direction: row; }
    .l-admin-shell__main { padding: var(--space-6) var(--space-6); }
}
.l-admin { max-width: var(--width-wide); width: 100%; margin: 0 auto; }
/* 中身の縦並び */
.l-admin > * + * { margin-top: var(--space-4); }
/* 表は横に長くなるので、はみ出す分だけ横に流す */
.l-table { overflow-x: auto; }
