/*
Theme Name: OFuyuan Blog
Description: Responsive editorial layout for blog.ofuyuan.com. Colours are the svrguard.ofuyuan.com variables; no new colours.
Version: 1.0.0
Requires at least: 6.5
Requires PHP: 7.4
Text Domain: ofuyuan-blog
*/

:root {
  --ink: #1f2933;
  --soft: #52606d;
  --link: #0b5f9e;
  --accent: #237a52;
  --navy: #0d1b2a;
  --bg-soft: #f5f7fa;
  --line: #e4e7eb;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 16px/1.7 -apple-system, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { color: var(--navy); line-height: 1.3; }

.wrap { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }

.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus {
  clip: auto; width: auto; height: auto; z-index: 100;
  left: 8px; top: 8px; padding: 8px 12px; background: #fff;
}

/* header */
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; min-height: 64px; padding-block: 10px; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--navy); text-decoration: none; }
.site-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-nav a { color: var(--ink); text-decoration: none; }
.site-nav a:hover { color: var(--link); }

/* intro + tools */
.intro { padding-block: 36px 20px; }
.intro h1 { margin: 0; font-size: clamp(1.8rem, 4.5vw, 2.8rem); }
.intro p { margin: 6px 0 0; color: var(--soft); }
.tools { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; padding-block: 14px; border-block: 1px solid var(--line); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.filters a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--ink); text-decoration: none; font-size: .95rem;
}
.filters a:hover { border-color: var(--link); color: var(--link); }
.filters a[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.search-form { display: flex; gap: 8px; flex: 0 1 300px; }
.search-form input[type="search"] {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 8px 12px;
  font: inherit; border: 1px solid #cbd2d9; border-radius: 6px; background: #fff; color: var(--ink);
}
.search-form button {
  min-height: 44px; padding: 8px 16px; font: inherit; font-weight: 600;
  border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer;
}
.search-form button:hover { filter: brightness(.88); }

/* featured */
.feature { display: grid; grid-template-columns: 1fr 1fr; margin-block: 28px 40px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.feature-copy { padding: clamp(22px, 4vw, 48px); align-self: center; }
.feature h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin: 8px 0 12px; }
.feature h2 a { color: var(--navy); text-decoration: none; }
.feature p { margin: 0 0 14px; color: var(--soft); }
.feature .more { font-weight: 600; }
.feature-visual { display: block; background: #fff; }
.feature-visual img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 16 / 10; }

/* list */
.listing { padding-bottom: 48px; }
.listing > h2 { font-size: 1.4rem; margin: 0 0 16px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 24px; }
.card { border-top: 2px solid var(--navy); padding-top: 14px; min-width: 0; }
.card-thumb { display: block; margin-bottom: 12px; }
.card-thumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--bg-soft); }
.card h3 { font-size: 1.15rem; margin: 6px 0 8px; overflow-wrap: anywhere; }
.card h3 a { color: var(--navy); text-decoration: none; }
.card h3 a:hover { color: var(--link); }
.card p { margin: 0; color: var(--soft); font-size: .95rem; }
.meta { color: var(--soft); font-size: .875rem; }
.meta a { color: inherit; }
.empty { padding-block: 32px; color: var(--soft); }

.pagination { margin-top: 32px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--ink); }
.pagination .page-numbers.current { background: var(--navy); border-color: var(--navy); color: #fff; }

/* single post */
.article { width: min(740px, calc(100% - 32px)); margin-inline: auto; padding-block: 32px 48px; }
.article-header h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 6px 0 10px; overflow-wrap: anywhere; }
.entry-content { font-size: 1.0625rem; line-height: 1.85; overflow-wrap: anywhere; }
.entry-content h2 { font-size: 1.45rem; margin: 2em 0 .6em; }
.entry-content h3 { font-size: 1.2rem; margin: 1.6em 0 .5em; }
.entry-content img, .entry-content video, .entry-content iframe { max-width: 100%; height: auto; }
.entry-content figure { margin: 1.5em 0; max-width: 100%; }
.entry-content figcaption { color: var(--soft); font-size: .9rem; text-align: center; }
.entry-content pre { overflow-x: auto; background: var(--bg-soft); padding: 14px 16px; border-radius: 6px; font-size: .9rem; line-height: 1.6; }
.entry-content code { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: .92em; }
.entry-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 6px 10px; }
.entry-content blockquote { margin: 1.5em 0; padding: 4px 0 4px 18px; border-left: 4px solid var(--line); color: var(--soft); }
.entry-content .alignleft { float: left; margin: 0 1.5em 1em 0; }
.entry-content .alignright { float: right; margin: 0 0 1em 1.5em; }
/* Centred figures stay display:table (core) so their table-caption keeps the image width. */
.entry-content img.aligncenter { display: block; }
.entry-content .aligncenter { margin-inline: auto; }
.entry-content::after { content: ""; display: table; clear: both; }
.post-nav { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); }
.post-nav a { max-width: 48%; }

/* comments */
.comments { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); }
.comments h2 { font-size: 1.2rem; }
.comment-list { padding-left: 0; list-style: none; }
.comment-list .comment { margin-bottom: 18px; }
.comment-meta { color: var(--soft); font-size: .875rem; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
  width: 100%; padding: 8px 10px; font: inherit; border: 1px solid #cbd2d9; border-radius: 6px;
}
.comment-form .submit { min-height: 44px; padding: 8px 18px; font: inherit; font-weight: 600; border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }

/* footer */
.site-footer { border-top: 1px solid var(--line); color: var(--soft); font-size: .875rem; }
.site-footer .wrap { padding-block: 22px; }
.site-footer a { color: inherit; }

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .feature, .grid { grid-template-columns: minmax(0, 1fr); }
  .feature-visual { order: -1; }
  .intro { padding-top: 24px; }
  .search-form { flex-basis: 100%; }
  .entry-content .alignleft, .entry-content .alignright { float: none; margin: 1em 0; }
}
