/* me/assets/me.css - 自己紹介ページ（白と淡いグレーに、差し色1色だけの落ち着いた見た目）
 *
 * スマホの縦画面（幅 360〜430px）を基本に書き、画面が広いときだけ @media (min-width) で広げる。
 * 入力欄の文字は 16px 以上にする（それより小さいと、iPhone で入力欄を押したときに画面が勝手に拡大されるため）。
 */

/* hidden 属性を、ほかの display の指定より必ず優先する（CLAUDE.md 8.1節） */
[hidden] { display: none !important; }

/* 差し色。テーマで変わるのはここだけ */
:root, body[data-theme="indigo"] { --accent: #403999; --accent-soft: #efedfa; --accent-line: #d9d4f3; }
body[data-theme="navy"] { --accent: #24456e; --accent-soft: #eaeff5; --accent-line: #ccd8e6; }
body[data-theme="rose"] { --accent: #983657; --accent-soft: #f7edf1; --accent-line: #ebcdd8; }
body[data-theme="sage"] { --accent: #4b6a4f; --accent-soft: #edf2ec; --accent-line: #cfdccf; }
:root {
    --bg: #f7f7f9; --paper: #ffffff;
    --ink: #1f1e29; --ink-2: #4a4857; --muted: #8a8796; --line: #e6e5ec;
    --radius: 16px; --radius-sm: 12px;
    --shadow: 0 1px 2px rgba(31, 30, 41, .04), 0 8px 24px rgba(31, 30, 41, .06);
    --serif: "Shippori Mincho", "Yu Mincho", "Hiragino Mincho ProN", serif;
    --sans: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
    --en: "Outfit", "Zen Kaku Gothic New", sans-serif;
    --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; min-height: 100svh;
    background: var(--bg); color: var(--ink);
    font: 15px/1.85 var(--sans); letter-spacing: .02em;
    overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
img { display: block; max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { width: 20px; height: 20px; flex-shrink: 0; }

.eyebrow { display: block; margin: 0; font: 500 11px/1.4 var(--en); letter-spacing: .24em; text-transform: uppercase; color: var(--accent); }

/* ===== ボタン ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--paper); color: var(--ink); font-size: 14px; font-weight: 500; text-decoration: none;
    cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.btn .icon { width: 18px; height: 18px; }
.btn:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); filter: brightness(1.12); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.ext { font-size: 11px; }
.text-btn {
    display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 4px;
    border: 0; background: none; color: var(--ink-2); font-size: 13px; cursor: pointer;
}
.text-btn .icon { width: 16px; height: 16px; }
.text-btn:hover { color: var(--accent); }

/* ===== お知らせ（5秒で消える） ===== */
.flash-message {
    /* left:50% と translate で真ん中に置くと、使える幅が画面の半分になり、スマホで細長く折り返すため、左右から寄せる */
    position: fixed; top: 14px; left: 16px; right: 16px; z-index: 60; width: fit-content; max-width: calc(100% - 32px); margin: 0 auto;
    padding: 10px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: var(--shadow);
    animation: flash-in .35s ease-out; transition: opacity .4s, translate .4s;
}
.flash-error { background: #fff; color: #9b2c3f; border: 1px solid #ebc3cb; }
.flash-message.fade-out { opacity: 0; translate: 0 -12px; }
@keyframes flash-in { from { opacity: 0; translate: 0 -12px; } }

/* ===== パスワードを入れる画面 ===== */
.lock { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 32px 20px calc(32px + var(--safe-b)); }
.lock-card {
    width: 100%; max-width: 380px; padding: 36px 24px 26px; text-align: center;
    background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
}
.lock-card.is-shake { animation: shake .4s; }
@keyframes shake { 25%, 75% { translate: -6px 0; } 50% { translate: 6px 0; } }
.lock-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: 18px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.lock-icon .icon { width: 24px; height: 24px; }
.lock-title { margin: 8px 0 8px; font: 700 28px/1.4 var(--serif); letter-spacing: .08em; }
.lock-lead { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.lock-form { display: grid; gap: 10px; }
.lock-form input {
    width: 100%; min-height: 50px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--bg); font-size: 16px; text-align: center; letter-spacing: .12em;
}
.lock-form input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.lock-form .btn { min-height: 50px; font-size: 15px; }
.lock-login { display: inline-block; margin-top: 20px; color: var(--muted); font-size: 12px; }

/* ===== 上のバー ===== */
.site-top {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 20px; background: rgba(247, 247, 249, .86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.wordmark { font: 500 18px/1 var(--en); letter-spacing: .08em; color: var(--ink); }
.user-wrap { position: relative; }
.topuser-btn { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); cursor: pointer; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 14px; font-weight: 500; }
.topuser-name { display: none; max-width: 10em; padding-right: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.user-popover[hidden] { display: none; }
.user-popover:not([hidden]) {
    display: flex; flex-direction: column; gap: 8px; position: absolute; right: 0; top: calc(100% + 8px); width: min(240px, calc(100vw - 40px));
    padding: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.user-popover-name { font-weight: 700; }
.user-popover-id { margin-top: -6px; color: var(--muted); font-size: 12px; }

.notice-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 20px 0; padding: 12px 16px;
    background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius-sm); font-size: 13px; line-height: 1.7;
}
.notice-bar span { flex: 1 1 200px; }

/* ===== ページ ===== */
.page { max-width: 760px; margin: 0 auto; padding: 24px 20px 72px; }
.is-dev .page { padding-bottom: calc(150px + var(--safe-b)); }   /* 下のバーに最後の行が隠れないように */

/* ===== はじめに ===== */
.hero { display: grid; justify-items: center; gap: 22px; text-align: center; padding: 8px 0 8px; }
.hero-face {
    position: relative; width: 132px; height: 132px; overflow: hidden; border-radius: 50%; background: var(--accent-soft);
    /* 写真のまわりに、背景色の余白を挟んだ細い輪を付ける */
    box-shadow: 0 0 0 6px var(--bg), 0 0 0 7px var(--accent-line);
}
.hero-face img { width: 100%; height: 100%; object-fit: cover; }
.hero-face-empty { display: grid; place-items: center; height: 100%; color: var(--accent); }
.hero-face-empty .icon { width: 48px; height: 48px; }
.hero-text { min-width: 0; max-width: 100%; }
.hero-kana { margin: 0 0 6px; font: 400 12px/1.6 var(--en); letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }
.hero-name { margin: 0; font: 700 clamp(30px, 8.6vw, 52px)/1.35 var(--serif); letter-spacing: .06em; overflow-wrap: anywhere; text-wrap: balance; }
.hero-nick { display: inline-flex; align-items: center; gap: 8px; margin: 10px 0 0; color: var(--ink-2); font-size: 14px; }
.hero-nick span { padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; line-height: 20px; }
.hero-catch { position: relative; margin: 22px auto 0; padding-top: 18px; max-width: 30em; font: 500 16px/1.9 var(--serif); color: var(--ink-2); overflow-wrap: anywhere; }
.hero-catch::before { content: ""; position: absolute; top: 0; left: 50%; width: 24px; height: 1px; margin-left: -12px; background: var(--accent); }

/* ===== ブロック ===== */
.block { margin-top: 56px; }
.block-title { display: flex; flex-direction: column; gap: 4px; margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font: 700 22px/1.4 var(--serif); letter-spacing: .06em; }
.empty { margin: 0; padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--muted); font-size: 13px; }
.icon-badge { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }

/* わたしのこと */
.facts { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0; }
.fact { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.fact-text { min-width: 0; }
.fact dt { color: var(--muted); font-size: 12px; line-height: 1.5; }
.fact dd { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.fact dd small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.bio { margin-top: 22px; color: var(--ink-2); font-size: 15px; line-height: 2.05; overflow-wrap: anywhere; }

/* 好きなもの */
.likes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.like {
    display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color .2s, transform .2s;
}
.like:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.like-text { display: flex; flex-direction: column; min-width: 0; padding-top: 2px; }
.like-title { font-size: 16px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.like-body { color: var(--muted); font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }

/* これまでの歩み */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; top: 20px; bottom: 20px; left: 19.5px; width: 1px; background: var(--line); }
.tl { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; padding-bottom: 22px; }
.tl:last-child { padding-bottom: 0; }
.tl-dot { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--paper); border: 1px solid var(--line); color: var(--accent); }
.tl-dot .icon { width: 18px; height: 18px; }
.tl-body { display: flex; flex-direction: column; min-width: 0; padding-top: 1px; }
.tl-period { font: 500 13px/1.6 var(--en); letter-spacing: .08em; color: var(--accent); font-variant-numeric: tabular-nums; }
.tl-title { font-size: 16px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.tl-text { margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }

/* 読み進めると、そっと現れる（me.js が .is-in を付ける） */
.js .fact, .js .like, .js .tl { opacity: 0; translate: 0 12px; transition: opacity .6s ease, translate .6s ease, border-color .2s, transform .2s; }
.js .is-in { opacity: 1 !important; translate: 0 0 !important; }

.bye { margin-top: 72px; padding-top: 32px; border-top: 1px solid var(--line); text-align: center; }
.bye-text { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

/* ===== 開発者の下のバー ===== */
.devbar {
    /* 画面の一番下（メンテナンス中の帯と、iPhone の下の余白の上）に置く（CLAUDE.md 5.8節） */
    position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b) + var(--nkmry-maint-bar, 0px)); z-index: 40;
    display: flex; flex-direction: column; gap: 6px;
}
.devbar-view, .devbar-edit {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px;
    background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
}
.devbar-view .btn { flex: 1 1 0; }
.devbar-edit { justify-content: space-between; }
.devbar-actions { display: flex; gap: 8px; flex: 1 1 auto; justify-content: flex-end; }
.devbar-status { align-self: center; margin: 0; padding: 4px 14px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 12px; text-align: center; }
.devbar-status:empty { display: none; }
.theme-picker { display: flex; gap: 8px; padding: 0 6px; }
.theme-chip { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; }
.theme-chip[data-theme-pick="indigo"] { background: #403999; }
.theme-chip[data-theme-pick="navy"]   { background: #24456e; }
.theme-chip[data-theme-pick="rose"]   { background: #983657; }
.theme-chip[data-theme-pick="sage"]   { background: #4b6a4f; }
.theme-chip[aria-checked="true"] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink); }

/* ===== 編集中の入力欄（me.js が、表示と同じ場所に出す） ===== */
.ed-field { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; text-align: left; }
.ed-field input, .ed-field textarea, .ed-row input, .ed-row textarea {
    width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
    background: #fff; color: var(--ink); font-size: 16px; line-height: 1.6;
}
.ed-field textarea, .ed-row textarea { resize: vertical; min-height: 72px; }
.ed-field input:focus, .ed-field textarea:focus, .ed-row input:focus, .ed-row textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ed-hero { display: grid; gap: 12px; width: 100%; max-width: 460px; margin: 0 auto; }
.ed-photo { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.ed-panel { display: grid; gap: 14px; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.ed-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.ed-list { display: grid; gap: 10px; }
.ed-row {
    display: grid; gap: 8px; padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-areas: "icon title tools" "body body body" "picker picker picker";
}
.ed-row.is-timeline { grid-template-areas: "icon period tools" "title title title" "body body body" "picker picker picker"; }
.ed-icon-btn { grid-area: icon; width: 44px; height: 44px; padding: 0; border: 1px solid var(--accent-line); border-radius: 50%; background: var(--accent-soft); color: var(--accent); cursor: pointer; display: grid; place-items: center; }
.ed-row [data-k="title"] { grid-area: title; }
.ed-row [data-k="period"] { grid-area: period; }
.ed-row [data-k="body"] { grid-area: body; }
.ed-tools { grid-area: tools; display: flex; gap: 2px; align-self: center; }
.ed-tool { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer; }
.ed-tool .icon { width: 16px; height: 16px; }
.ed-tool:hover { background: var(--bg); color: var(--accent); }
.ed-tool.is-danger:hover { color: #9b2c3f; }
.ed-icons { grid-area: picker; display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; padding-top: 4px; }
.ed-icons button { display: grid; place-items: center; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-2); cursor: pointer; }
.ed-icons button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.ed-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.ed-count { color: var(--muted); font-size: 12px; }

/* ===== パスワードを変える窓 ===== */
.dialog { width: min(420px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(31, 30, 41, .4); }
.pw-form { display: grid; gap: 12px; padding: 22px 20px 18px; }
.pw-form h2 { margin: 0; font: 700 20px/1.4 var(--serif); letter-spacing: .06em; }
.pw-form p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.pw-form label { display: grid; gap: 4px; color: var(--ink-2); font-size: 12px; }
.pw-form input { min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }
.pw-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pw-error { color: #9b2c3f !important; }
.pw-error:empty { display: none; }
.pw-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ===== 広い画面 ===== */
@media (min-width: 560px) {
    .likes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .ed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topuser-name { display: block; }
    .topuser-btn { padding-right: 3px; }
    .devbar { left: 50%; right: auto; translate: -50% 0; width: max-content; max-width: calc(100% - 24px); }
    .devbar-view, .devbar-edit { border-radius: 999px; }
    .devbar-view .btn { flex: 0 0 auto; }
}
@media (min-width: 720px) {
    body { font-size: 16px; }
    .site-top { padding: 14px 32px; }
    .page { padding: 48px 32px 96px; }
    .notice-bar { margin: 4px auto 0; max-width: 696px; }
    .hero { grid-template-columns: auto minmax(0, 1fr); justify-items: start; align-items: center; gap: 40px; text-align: left; }
    .hero-face { width: 168px; height: 168px; }
    .hero-catch { margin-left: 0; padding: 0 0 0 16px; }
    .hero-catch::before { top: 6px; bottom: 6px; left: 0; width: 1px; height: auto; margin: 0; }
    .block { margin-top: 72px; }
    .block-title { font-size: 26px; }
    .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
    .ed-row.is-timeline { grid-template-columns: 44px 140px minmax(0, 1fr) auto; grid-template-areas: "icon period title tools" "body body body body" "picker picker picker picker"; }
}

/* 動きを減らす設定の人には、現れる動き・揺れを止める */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .js .fact, .js .like, .js .tl { opacity: 1; translate: 0 0; }
}
