/*
Theme Name: Ohtsuji Plain Frame 95
Description: ひつじの旅々日記用テーマ。濃紺のタイトルバー、銀灰の面、凸ボタンと凹み欄、白地の本文。Web フォントなし、1 カラム。
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: ohtsuji-plain95
*/

/* Layout: one column, 1px frames, flat white reading surface; navy marks only "what you are looking at". */
:root {
  --bg: #f3f3ef;
  --surface: #ffffff;
  --surface-2: #dcdcd6;
  --text: #1a1a1a;
  --muted: #55554f;
  --border: #b8b8b0;
  --border-strong: #6b6b64;
  --accent: #000080;
  --accent-ink: #000080;
  --on-accent: #ffffff;
  --link: #0b50b3;
  --link-hover: #073b87;
  --visited: #6a2f8f;
  --focus: #b45309;
  --focus-on-accent: #ffe27a;
  --bevel-hi: #ffffff;
  --bevel-lo: #8c8c85;
  --memo-bg: #fff8d6;
  --memo-border: #8a6d00;
  --alert: #b3261e;
  --dither-a: #e4e4de;
  --dither-b: #f0f0eb;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "BIZ UDPGothic", "Yu Gothic UI", Meiryo, "Noto Sans JP", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "BIZ UDGothic", "MS Gothic", monospace;
  --bevel-raised: inset 1px 1px 0 var(--bevel-hi), inset -1px -1px 0 var(--bevel-lo);
  --bevel-sunken: inset 1px 1px 0 var(--bevel-lo), inset -1px -1px 0 var(--bevel-hi);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --tap: 44px;
  --measure: 42rem;
  --logo: url("assets/logo-light.png");
  color-scheme: light;
}
/* Light is the default. Following the OS setting is opt-in: the 自動 button sets data-theme="auto". */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #101214;
    --surface: #181b1e;
    --surface-2: #23272b;
    --text: #e6e6e1;
    --muted: #a7aaa6;
    --border: #34393e;
    --border-strong: #8a9096;
    --accent: #2a4aa8;
    --accent-ink: #9db4ff;
    --on-accent: #ffffff;
    --link: #8ab4ff;
    --link-hover: #b5d0ff;
    --visited: #c9a7f5;
    --focus: #fbbf24;
    --focus-on-accent: #ffe27a;
    --bevel-hi: #4a5056;
    --bevel-lo: #0c0e10;
    --memo-bg: #2e2a12;
    --memo-border: #b39b2e;
    --alert: #ff9a8f;
    --dither-a: #1f2327;
    --dither-b: #262b2f;
    --logo: url("assets/logo-dark.png");
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101214;
  --surface: #181b1e;
  --surface-2: #23272b;
  --text: #e6e6e1;
  --muted: #a7aaa6;
  --border: #34393e;
  --border-strong: #8a9096;
  --accent: #2a4aa8;
  --accent-ink: #9db4ff;
  --on-accent: #ffffff;
  --link: #8ab4ff;
  --link-hover: #b5d0ff;
  --visited: #c9a7f5;
  --focus: #fbbf24;
  --focus-on-accent: #ffe27a;
  --bevel-hi: #4a5056;
  --bevel-lo: #0c0e10;
  --memo-bg: #2e2a12;
  --memo-border: #b39b2e;
  --alert: #ff9a8f;
  --dither-a: #1f2327;
  --dither-b: #262b2f;
  --logo: url("assets/logo-dark.png");
  color-scheme: dark;
}

/* Home-page mark: black-on-transparent on light surfaces, white-on-transparent on dark ones (see --logo). */
.p95-logo {
  display: block;
  width: clamp(112px, 24vw, 168px);
  aspect-ratio: 1;
  margin: var(--s4) auto var(--s3);
  background: var(--logo) center / contain no-repeat;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--s4); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(1.0625rem, 1rem + .25vw, 1.125rem);
  line-height: 1.9;
  letter-spacing: .02em;
  line-break: strict;
  overflow-wrap: anywhere;
  font-synthesis: none;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:visited { color: var(--visited); }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.titlebar :focus-visible, .menubar :focus-visible, .is-nav-on :focus-visible { outline-color: var(--focus-on-accent); }
.mono { font-family: var(--font-mono); font-size: .875rem; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.screen-reader-text, .skip:not(:focus) {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip:focus { position: fixed; top: var(--s2); left: var(--s2); z-index: 10; padding: var(--s2) var(--s4); background: var(--surface); border: 2px solid var(--focus); }

.p95-page {
  max-width: 1080px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: var(--s4) var(--s7);
  display: flex;
  flex-direction: column;
  gap: var(--s6);
}
@media (min-width: 600px) { .p95-page { padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); } }
@media (min-width: 960px) { .p95-page { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); } }
.main { display: flex; flex-direction: column; gap: var(--s6); min-width: 0; }

/* ---------- site chrome ---------- */
.site-head { display: flex; flex-direction: column; }
.titlebar {
  display: flex; align-items: center; gap: var(--s3);
  min-height: var(--tap);
  padding: 0 var(--s3);
  background: var(--accent); color: var(--on-accent);
  font-family: var(--font-mono); font-weight: 700; font-size: 1rem; line-height: 1.45;
}
.titlebar a, .titlebar a:visited { color: inherit; text-decoration: none; }
.titlebar a:hover { text-decoration: underline; color: inherit; }
.titlebar .win-icon {
  flex: none; width: 16px; height: 16px;
  background: linear-gradient(var(--on-accent) 0 0) 0 0 / 100% 4px no-repeat, var(--accent);
  border: 1px solid var(--on-accent);
}
.titlebar .grow { flex: 1; min-width: 0; margin: 0; font: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.themes { display: flex; gap: 2px; }
.themes button {
  min-height: 32px; min-width: 44px; padding: 0 var(--s2);
  font: inherit; font-size: .875rem; font-weight: 400;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); box-shadow: var(--bevel-raised); cursor: pointer; border-radius: 0;
}
.themes button[aria-pressed="true"] { box-shadow: var(--bevel-sunken); background: var(--surface); font-weight: 700; }

.menubar {
  display: none;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
  border-left: 1px solid var(--border-strong); border-right: 1px solid var(--border-strong);
}
.menubar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.menubar a, .menubar a:visited { display: block; padding: 0 var(--s4); line-height: 40px; color: var(--text); text-decoration: none; font-size: 1rem; }
.menubar a:hover, .menubar a:focus-visible, .menubar a[aria-current] { background: var(--accent); color: var(--on-accent); }
@media (min-width: 600px) { .menubar { display: block; } }
.mobile-menu { border: 1px solid var(--border-strong); border-top: 0; background: var(--surface-2); }
.mobile-menu summary { min-height: var(--tap); display: flex; align-items: center; padding: 0 var(--s4); cursor: pointer; font-family: var(--font-mono); font-size: .875rem; }
.mobile-menu ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border-strong); }
.mobile-menu a, .mobile-menu a:visited { display: flex; align-items: center; min-height: 48px; padding: 0 var(--s4); color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.mobile-menu a:hover, .mobile-menu a[aria-current] { background: var(--accent); color: var(--on-accent); }
@media (min-width: 600px) { .mobile-menu { display: none; } }

.address { display: flex; gap: var(--s2); align-items: center; margin-top: var(--s2); }
.address .up { flex: none; min-height: var(--tap); min-width: var(--tap); justify-content: center; padding: 0 var(--s2); }
.address nav { flex: 1; min-width: 0; }
.address ol {
  list-style: none; margin: 0; padding: 0 var(--s3);
  display: flex; align-items: center; gap: var(--s2);
  min-height: var(--tap); white-space: nowrap; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--bevel-sunken);
  font-family: var(--font-mono); font-size: .875rem; line-height: 1.4;
}
.address li { flex: none; }
.address li:last-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.address li + li::before { content: "›"; margin-right: var(--s2); color: var(--muted); }
.address a, .address a:visited { color: var(--text); text-decoration: none; }
.address a:hover { text-decoration: underline; }

/* ---------- windows ---------- */
.window { background: var(--surface); border: 1px solid var(--border-strong); min-width: 0; }
.window > .titlebar { min-height: 40px; }
.window--quiet > .titlebar { background: var(--surface-2); color: var(--text); border-bottom: 1px solid var(--border-strong); }
.window--quiet > .titlebar .win-icon { background: var(--surface-2); border-color: var(--border-strong); }
.window h1, .window h2.bar { margin: 0; font: inherit; text-wrap: balance; overflow-wrap: anywhere; }
.window-body { padding: var(--s5) var(--s4); display: flex; flex-direction: column; gap: var(--s5); min-width: 0; }
@media (min-width: 600px) { .window-body { padding: var(--s5); } }
@media (max-width: 599px) { .window { border-left: 0; border-right: 0; margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); } }
.prose { max-width: var(--measure); }
.prose > * { margin: 0; }
.prose > * + * { margin-top: 1em; }
.note { color: var(--muted); font-size: .875rem; line-height: 1.7; }

/* ---------- buttons / tags / fields ---------- */
.btn, .btn:visited {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s4);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); box-shadow: var(--bevel-raised); border-radius: 0;
  font: inherit; font-size: 1rem; line-height: 1.5; text-decoration: none; cursor: pointer;
}
.btn:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.btn:active, .btn.is-pressed { box-shadow: var(--bevel-sunken); padding: 1px var(--s4) 0 17px; }
.btn--primary, .btn--primary:visited { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent); color: var(--on-accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); }
.tag, .tag:visited {
  display: inline-block; padding: .1em .6em; border: 1px solid var(--border-strong);
  font-family: var(--font-mono); font-size: .875rem; line-height: 1.6; color: var(--text); text-decoration: none; background: var(--surface);
}
.tag:hover { background: var(--accent); color: var(--on-accent); text-decoration: none; }
.field { display: flex; gap: var(--s2); flex-wrap: wrap; }
.field input[type="search"], .field input[type="text"] {
  flex: 1; min-width: 12em; min-height: var(--tap); padding: 0 var(--s3);
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--bevel-sunken); border-radius: 0;
}
.statusbar { display: grid; gap: var(--s2); grid-template-columns: 1fr; }
@media (min-width: 720px) { .statusbar { grid-template-columns: repeat(3, 1fr); } }
.statusbar span { display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--s3); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--bevel-sunken); font-family: var(--font-mono); font-size: .875rem; }
.site-foot { display: flex; flex-direction: column; gap: var(--s4); }
.site-foot .field { max-width: var(--measure); }

/* ---------- photo frames ---------- */
.photo {
  position: relative; width: 100%; aspect-ratio: 3 / 2; overflow: hidden;
  background: repeating-conic-gradient(var(--dither-a) 0 25%, var(--dither-b) 0 50%) 0 0 / 8px 8px;
  border: 1px solid var(--border);
}
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.photo span { position: absolute; left: var(--s2); bottom: var(--s2); padding: 0 var(--s2); background: var(--surface); border: 1px solid var(--border); font-family: var(--font-mono); font-size: .875rem; line-height: 1.6; color: var(--muted); }

/* ---------- list cards: container queries on the wrapper ---------- */
.stage { container-type: inline-size; container-name: stage; min-width: 0; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); grid-template-columns: 1fr; }
.card { position: relative; display: grid; grid-template-columns: 120px 1fr; gap: var(--s3); align-items: start; min-width: 0; }
.card .excerpt { display: none; }
.card h2.t { margin: 0; padding: 0 var(--s1); border: 0; font-size: 1rem; line-height: 1.5; font-weight: 700; text-wrap: balance; }
.card h2.t a, .card h2.t a:visited { color: var(--text); text-decoration: none; }
.card h2.t a::after { content: ""; position: absolute; inset: 0; }
.card .meta { margin: 0; padding: 0 var(--s1); color: var(--muted); }
.card:hover h2.t, .card:focus-within h2.t { background: var(--accent); color: var(--on-accent); }
.card:hover h2.t a, .card:focus-within h2.t a { color: var(--on-accent); }
.card--lead { grid-template-columns: 1fr; }
@container stage (min-width: 600px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: var(--s5); }
  .card { grid-template-columns: 1fr; gap: var(--s2); }
  .card--lead { grid-column: 1 / -1; }
  .card .excerpt { display: block; font-size: .9375rem; line-height: 1.7; margin: 0; padding: 0 var(--s1); }
}
@container stage (min-width: 900px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- article ---------- */
.metaline { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; padding: var(--s2) var(--s4); background: var(--surface-2); border-bottom: 1px solid var(--border-strong); }
.metaline > * { white-space: nowrap; }
.entry { container-type: inline-size; container-name: entry; min-width: 0; }
.entry > * { max-width: var(--measure); margin-inline: auto; }
.entry > :where(figure, .wp-block-image, .wp-block-gallery, .wp-block-columns, .wp-caption, .p95-scroll, iframe, table, .strava-embed-placeholder) { max-width: 100%; }
.entry > * { margin-top: 0; margin-bottom: 0; }
.entry > * + * { margin-top: 1em; }
.entry img { display: block; margin-inline: auto; }
.entry figcaption, .wp-element-caption, .wp-caption-text { font-family: var(--font-mono); font-size: .875rem; line-height: 1.6; color: var(--muted); margin-top: var(--s2); }
.entry figcaption::before { content: "■ "; color: var(--accent-ink); }
.entry h2 { margin-top: 2em; padding: .4em .75em; background: var(--surface-2); border: 1px solid var(--border-strong); font-size: 1.25rem; line-height: 1.5; font-weight: 700; text-wrap: balance; font-feature-settings: "palt"; }
.entry h3 { margin-top: 1.8em; font-size: 1.125rem; line-height: 1.5; text-wrap: balance; font-feature-settings: "palt"; border-bottom: 2px solid var(--border-strong); padding-bottom: .25em; }
.entry h3::before { content: "▪ "; color: var(--accent-ink); }
.entry h4 { margin-top: 1.5em; font-size: 1.0625rem; line-height: 1.5; }
.entry h4::before { content: "■ "; color: var(--accent-ink); font-size: .75em; }
.entry a { overflow-wrap: anywhere; }
.entry ul, .entry ol { padding-left: 1.5em; }
.entry blockquote { margin-inline: auto; padding: var(--s2) var(--s4); border-left: 4px solid var(--border-strong); background: var(--surface-2); }
.entry hr { border: 0; border-top: 2px solid var(--border-strong); }
.entry hr.dotted { border-top: 2px dotted var(--border-strong); }
.entry pre, .entry code { font-family: var(--font-mono); font-size: .875rem; }
.entry pre { overflow-x: auto; padding: var(--s3); background: var(--surface-2); border: 1px solid var(--border-strong); }
.entry iframe { display: block; max-width: 100%; margin-inline: auto; border: 1px solid var(--border-strong); }
.alignleft { float: left; margin: 0 var(--s4) var(--s3) 0; }
.alignright { float: right; margin: 0 0 var(--s3) var(--s4); }
.aligncenter { display: block; margin-inline: auto; }
.page-links { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; max-width: var(--measure); margin-inline: auto; font-family: var(--font-mono); font-size: .875rem; }
.page-links > .post-page-numbers, .page-links > a, .page-links-title { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); min-width: var(--tap); padding: 0 var(--s3); }
.page-links > a, .page-links > .post-page-numbers { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--bevel-raised); text-decoration: none; }
.page-links > .current { box-shadow: var(--bevel-sunken); background: var(--surface); font-weight: 700; }
.page-links-title { padding: 0; min-width: 0; }

.ad-slot { margin: var(--s5) auto 0; width: 100%; max-width: 728px; min-height: 280px; }
.ad-slot::before { content: "広告"; display: block; margin-bottom: var(--s1); font-family: var(--font-mono); font-size: .875rem; color: var(--muted); }
.ad-slot .widget { margin: 0; }
.pager { display: flex; flex-wrap: wrap; gap: var(--s2); }
.pager .btn { flex: 1 1 14em; justify-content: center; text-align: center; padding-block: var(--s2); }
.pager .btn small { display: block; font-family: var(--font-mono); font-size: .875rem; color: var(--muted); }

/* ---------- pagination ---------- */
.pagination ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); font-family: var(--font-mono); font-size: .875rem; }
.pagination a, .pagination span.page-numbers {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); min-width: var(--tap); padding: 0 var(--s3);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--bevel-raised); text-decoration: none;
}
.pagination a:hover { background: var(--surface); }
.pagination .current { box-shadow: var(--bevel-sunken); background: var(--surface); font-weight: 700; }
.pagination .dots { border-color: transparent; background: none; box-shadow: none; min-width: 0; }

/* ---------- table of contents ---------- */
.acc { border: 1px solid var(--border); }
.acc > summary { list-style: none; display: flex; align-items: center; gap: var(--s3); min-height: var(--tap); padding: 0 var(--s3); cursor: pointer; background: var(--surface-2); }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::before { content: "+"; flex: none; display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1px solid var(--border-strong); background: var(--surface); font-family: var(--font-mono); font-size: 12px; line-height: 1; }
.acc[open] > summary::before { content: "−"; }
.acc > div { padding: var(--s3); }
.toc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s1); }
.toc-list li::before { font-family: var(--font-mono); font-weight: 700; margin-right: .4em; }
.toc-list .l2::before { content: "■"; color: var(--accent-ink); font-size: .75em; }
.toc-list .l3 { padding-left: 1.6em; }
.toc-list .l3::before { content: "▪"; color: var(--accent-ink); }
.featured { margin: 0; }
.featured img { display: block; width: 100%; height: auto; border: 1px solid var(--border); }
.window > .titlebar { padding-block: var(--s2); }

/* ---------- comments ---------- */
.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s4); }
.comment-list .children { list-style: none; margin: var(--s4) 0 0; padding-left: var(--s4); border-left: 1px dotted var(--border-strong); display: flex; flex-direction: column; gap: var(--s4); }
.comment-body { border: 1px solid var(--border); }
.comment-meta { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); padding: var(--s1) var(--s3); background: var(--surface-2); border-bottom: 1px solid var(--border); font-family: var(--font-mono); font-size: .875rem; }
.comment-meta a, .comment-meta a:visited { color: var(--text); text-decoration: none; }
.comment-content { padding: var(--s3) var(--s4); }
.comment-content > :first-child { margin-top: 0; }
.comment-content > :last-child { margin-bottom: 0; }
.comment-body .reply { padding: 0 var(--s4) var(--s3); }
.comment-form { display: flex; flex-direction: column; gap: var(--s3); max-width: var(--measure); }
.comment-form p { margin: 0; display: flex; flex-direction: column; gap: var(--s1); }
.comment-form label { font-family: var(--font-mono); font-size: .875rem; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
  width: 100%; min-height: var(--tap); padding: var(--s2) var(--s3); font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--bevel-sunken); border-radius: 0;
}
.comment-form .form-submit { flex-direction: row; }
.comment-form .comment-form-cookies-consent { flex-direction: row; align-items: center; gap: var(--s2); }
.comment-form .form-submit input[type="submit"] { min-height: var(--tap); padding: 0 var(--s4); background: var(--accent); color: var(--on-accent); border: 1px solid var(--border-strong); box-shadow: var(--bevel-raised); font: inherit; cursor: pointer; border-radius: 0; }
.comment-notes, .logged-in-as { color: var(--muted); font-size: .875rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .themes, .menubar, .mobile-menu, .address, .ad-slot, .site-foot .field { display: none !important; }
  body { background: #fff; color: #000; }
}
