/* =================================================================
 *  BentoGrid_Showroom — Apple-style Bento Grid Theme
 *  CSS prefix: bg-
 *  Palette: Apple whites (#fbfbfd) → blue accent (#0071e3)
 * ================================================================= */

:root {
  --bg-bg: #fbfbfd; --bg-surface: #fff; --bg-surface2: #f5f5f7;
  --bg-line: #d2d2d7; --bg-line2: #e8e8ed;
  --bg-text: #1d1d1f; --bg-text-dim: #333336; --bg-muted: #86868b;
  --bg-accent: #0071e3; --bg-accent2: #2997ff; --bg-red: #ff3b30;
  --bg-green: #34c759; --bg-orange: #ff9f0a;
  --bg-font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  --bg-radius: 16px; --bg-radius-sm: 10px; --bg-radius-xs: 6px;
  --bg-shadow-sm: 0 1px 3px rgba(0,0,0,.04);
  --bg-shadow: 0 4px 12px rgba(0,0,0,.06);
  --bg-shadow-lg: 0 8px 30px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--bg-font); background: var(--bg-bg); color: var(--bg-text); line-height: 1.6; font-size: 15px; -webkit-font-smoothing: antialiased; }

a { color: var(--bg-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; border-radius: var(--bg-radius-sm); }
h1,h2,h3,h4,h5,h6 { color: var(--bg-text-dim); font-weight: 600; }
blockquote { margin: 16px 0; padding: 14px 20px; border-left: 4px solid var(--bg-accent); background: var(--bg-surface2); border-radius: 0 var(--bg-radius-sm) var(--bg-radius-sm) 0; color: var(--bg-muted); }
code { background: var(--bg-surface2); padding: 2px 6px; border-radius: 4px; font-size: .9em; }
pre { background: var(--bg-surface2); padding: 16px; border-radius: var(--bg-radius-sm); overflow-x: auto; font-size: 13px; }

/* =================================================================
 *  LAYOUT
 * ================================================================= */
.bg-wrap { width: min(100% - 40px, 1160px); margin: 0 auto; }
.bg-main { min-height: 70vh; padding-top: 20px; padding-bottom: 40px; }

/* =================================================================
 *  HEADER — Frosted glass sticky
 * ================================================================= */
.bg-header { position: sticky; top: 0; z-index: 100; background: rgba(251,251,253,.8); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid rgba(0,0,0,.06); }
.bg-header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 48px; gap: 16px; padding: 0 2px; }
.bg-brand { display: flex; align-items: center; gap: 8px; }
.bg-brand-icon { font-size: 22px; }
.bg-brand-name { font-size: 19px; font-weight: 700; color: var(--bg-text-dim); letter-spacing: -.01em; }
.bg-brand-name span { color: var(--bg-accent); }
.bg-header-actions { display: flex; align-items: center; gap: 8px; }
.bg-header-search { display: grid; grid-template-columns: 140px auto; }
.bg-header-search input { height: 32px; border-radius: 8px 0 0 8px; border: 1px solid var(--bg-line); border-right: none; background: var(--bg-surface2); padding: 0 12px; color: var(--bg-text); font-size: 13px; outline: none; transition: .2s; }
.bg-header-search input:focus { background: var(--bg-surface); border-color: var(--bg-accent); }
.bg-header-search button { height: 32px; border: 1px solid var(--bg-line); border-radius: 0 8px 8px 0; background: var(--bg-surface2); color: var(--bg-accent); padding: 0 12px; cursor: pointer; font-size: 14px; transition: .2s; }
.bg-header-search button:hover { background: var(--bg-accent); color: #fff; }
.bg-menu-toggle { display: none; width: 32px; height: 32px; border: none; border-radius: 8px; background: var(--bg-surface2); color: var(--bg-text); font-size: 18px; cursor: pointer; align-items: center; justify-content: center; }
.bg-nav { display: flex; gap: 2px; padding: 4px 0 8px; }
.bg-nav a { display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 8px; color: var(--bg-muted); font-size: 13px; font-weight: 500; transition: .15s; }
.bg-nav a:hover { color: var(--bg-text); background: var(--bg-surface2); text-decoration: none; }
.bg-nav a.active { color: var(--bg-accent); background: rgba(0,113,227,.08); }

/* =================================================================
 *  HERO — Bento grid hero
 * ================================================================= */
.bg-hero { display: grid; grid-template-columns: 1.5fr 1fr; grid-template-rows: 220px 220px; gap: 14px; margin-bottom: 28px; }
.bg-hero-main { grid-row: 1 / -1; position: relative; border-radius: var(--bg-radius); overflow: hidden; background: var(--bg-surface); box-shadow: var(--bg-shadow-lg); }
.bg-hero-main img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.bg-hero-main-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.7) 0%, rgba(0,0,0,0) 50%); display: flex; align-items: flex-end; padding: 28px 32px; }
.bg-hero-main-text h1 { font-size: 30px; color: #fff; margin: 0 0 6px; font-weight: 700; line-height: 1.2; }
.bg-hero-main-text h1 a { color: #fff; }
.bg-hero-main-text h1 a:hover { color: var(--bg-accent2); text-decoration: none; }
.bg-hero-main-text p { color: rgba(255,255,255,.7); font-size: 14px; margin: 0 0 12px; }
.bg-hero-sub { border-radius: var(--bg-radius); overflow: hidden; background: var(--bg-surface); box-shadow: var(--bg-shadow); display: flex; flex-direction: column; justify-content: center; padding: 20px 24px; position: relative; }
.bg-hero-sub h2 { font-size: 20px; margin: 0 0 4px; font-weight: 600; line-height: 1.25; }
.bg-hero-sub h2 a { color: var(--bg-text-dim); }
.bg-hero-sub h2 a:hover { color: var(--bg-accent); text-decoration: none; }
.bg-hero-sub p { color: var(--bg-muted); font-size: 13px; margin: 0; }
.bg-hero-label { font-size: 11px; font-weight: 600; color: var(--bg-accent); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.bg-hero-sub-img { border-radius: var(--bg-radius); overflow: hidden; background: var(--bg-surface2); box-shadow: var(--bg-shadow); }
.bg-hero-sub-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }

/* =================================================================
 *  BUTTONS & BADGES
 * ================================================================= */
.bg-btn { display: inline-flex; align-items: center; gap: 4px; padding: 7px 16px; border-radius: 20px; font-size: 13px; font-weight: 500; background: var(--bg-surface2); color: var(--bg-text); border: none; cursor: pointer; transition: .15s; }
.bg-btn:hover { background: var(--bg-line2); text-decoration: none; }
.bg-btn-primary { background: var(--bg-accent); color: #fff; }
.bg-btn-primary:hover { background: var(--bg-accent2); }
.bg-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; background: var(--bg-surface2); color: var(--bg-muted); }

/* =================================================================
 *  SECTION HEAD
 * ================================================================= */
.bg-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.bg-section-head h2 { font-size: 24px; margin: 0; font-weight: 700; letter-spacing: -.01em; }

/* =================================================================
 *  BENTO GRID — Adaptive layout
 * ================================================================= */
.bg-bento { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.bg-bento-card { background: var(--bg-surface); border-radius: var(--bg-radius); overflow: hidden; box-shadow: var(--bg-shadow-sm); transition: .2s; }
.bg-bento-card:hover { box-shadow: var(--bg-shadow-lg); transform: translateY(-2px); }
.bg-bento-card.span-2 { grid-column: span 2; }
.bg-bento-card.span-2-tall { grid-column: span 2; grid-row: span 2; }
.bg-bento-card.span-full { grid-column: span 4; }
.bg-bento-thumb { display: block; aspect-ratio: 16/10; overflow: hidden; background: var(--bg-surface2); }
.bg-bento-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; transition: transform .4s; }
.bg-bento-card:hover .bg-bento-thumb img { transform: scale(1.03); }
.bg-bento-body { padding: 16px 18px; }
.bg-bento-body h3 { font-size: 17px; margin: 0 0 4px; font-weight: 600; line-height: 1.3; }
.bg-bento-body h3 a { color: var(--bg-text-dim); }
.bg-bento-body h3 a:hover { color: var(--bg-accent); text-decoration: none; }
.bg-bento-body p { color: var(--bg-muted); font-size: 13px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bg-bento-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

/* =================================================================
 *  STREAM
 * ================================================================= */
.bg-stream { display: grid; gap: 12px; margin-bottom: 28px; }
.bg-stream-item { display: grid; grid-template-columns: 160px minmax(0,1fr); gap: 16px; padding: 14px; background: var(--bg-surface); border-radius: var(--bg-radius); box-shadow: var(--bg-shadow-sm); transition: .2s; }
.bg-stream-item:hover { box-shadow: var(--bg-shadow); }
.bg-stream-thumb { display: block; border-radius: var(--bg-radius-sm); overflow: hidden; background: var(--bg-surface2); aspect-ratio: 16/11; }
.bg-stream-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; transition: transform .4s; }
.bg-stream-item:hover .bg-stream-thumb img { transform: scale(1.03); }
.bg-stream-body { display: flex; flex-direction: column; justify-content: center; }
.bg-stream-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bg-stream-body h4 { font-size: 16px; margin: 0 0 4px; font-weight: 600; line-height: 1.3; }
.bg-stream-body h4 a { color: var(--bg-text-dim); }
.bg-stream-body h4 a:hover { color: var(--bg-accent); text-decoration: none; }
.bg-stream-excerpt { color: var(--bg-muted); font-size: 13px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* =================================================================
 *  TWO-COLUMN + SIDEBAR
 * ================================================================= */
.bg-content-grid { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 20px; }
.bg-sidebar { display: grid; gap: 14px; align-content: start; }
.bg-side-panel { padding: 18px; background: var(--bg-surface); border-radius: var(--bg-radius); box-shadow: var(--bg-shadow-sm); }
.bg-side-title { font-size: 13px; font-weight: 700; color: var(--bg-muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 12px; }
.bg-side-list { list-style: none; padding: 0; margin: 0; }
.bg-side-list li { padding: 7px 0; border-bottom: 1px solid var(--bg-line2); font-size: 13px; }
.bg-side-list li:last-child { border-bottom: none; }
.bg-side-list a { color: var(--bg-text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-side-list a:hover { color: var(--bg-accent); text-decoration: none; }
.bg-side-count { font-size: 11px; color: var(--bg-muted); }
.bg-tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; }
.bg-tag-cloud a { display: inline-flex; align-items: center; gap: 2px; padding: 4px 10px; border-radius: 12px; background: var(--bg-surface2); font-size: 12px; color: var(--bg-muted); transition: .15s; }
.bg-tag-cloud a:hover { background: var(--bg-accent); color: #fff; text-decoration: none; }
.bg-tag-cloud a span { font-size: 10px; }

/* =================================================================
 *  LIST HEAD & BREADCRUMB
 * ================================================================= */
.bg-breadcrumb { margin-bottom: 14px; font-size: 12px; color: var(--bg-muted); }
.bg-breadcrumb a { color: var(--bg-muted); }
.bg-breadcrumb a:hover { color: var(--bg-accent); }
.bg-list-head { padding: 24px 28px; background: var(--bg-surface); border-radius: var(--bg-radius); box-shadow: var(--bg-shadow-sm); margin-bottom: 16px; }
.bg-list-head h1 { margin: 0 0 4px; font-size: 28px; font-weight: 700; }
.bg-list-head p { color: var(--bg-muted); font-size: 14px; margin: 0; }
.bg-list-count { font-size: 12px; color: var(--bg-green); margin-top: 6px; font-weight: 500; }

/* =================================================================
 *  PAGINATION
 * ================================================================= */
.bg-pagination,.pagination { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.pagination a,.pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 10px; border-radius: 8px; font-size: 12px; color: var(--bg-muted); background: var(--bg-surface2); transition: .15s; }
.pagination a:hover { background: var(--bg-line2); color: var(--bg-accent); text-decoration: none; }
.pagination .current,.pagination .active { background: var(--bg-accent); color: #fff; font-weight: 600; }

/* =================================================================
 *  ARTICLE DETAIL
 * ================================================================= */
.bg-detail { padding: 32px; background: var(--bg-surface); border-radius: var(--bg-radius); box-shadow: var(--bg-shadow-sm); margin-bottom: 20px; }
.bg-detail-header h1 { font-size: 32px; line-height: 1.2; font-weight: 700; margin: 10px 0; }
.bg-detail-meta { font-size: 13px; color: var(--bg-muted); margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 14px; }
.bg-detail-cover { margin-bottom: 20px; border-radius: var(--bg-radius-sm); overflow: hidden; aspect-ratio: 16/8; }
.bg-detail-cover img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.bg-detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0; }
.bg-detail-tags a { padding: 4px 12px; border-radius: 12px; background: var(--bg-surface2); font-size: 12px; color: var(--bg-muted); }
.bg-detail-tags a:hover { background: var(--bg-accent); color: #fff; text-decoration: none; }
.bg-article-content { color: var(--bg-text); font-size: 16px; line-height: 1.8; }
.bg-article-content p { margin: .8em 0; }
.bg-article-content h1,.bg-article-content h2,.bg-article-content h3,.bg-article-content h4 { margin: 1.4em 0 .5em; font-weight: 700; }
.bg-article-content h1 { font-size: 26px; } .bg-article-content h2 { font-size: 22px; }
.bg-article-content h3 { font-size: 18px; }
.bg-article-content img { border-radius: var(--bg-radius-sm); margin: 14px 0; }
.bg-article-content a { color: var(--bg-accent); }

/* =================================================================
 *  TAGS PAGE
 * ================================================================= */
.bg-tag-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.bg-tag-card { padding: 20px; background: var(--bg-surface); border-radius: var(--bg-radius); box-shadow: var(--bg-shadow-sm); text-align: center; transition: .2s; }
.bg-tag-card:hover { box-shadow: var(--bg-shadow); transform: translateY(-2px); text-decoration: none; }
.bg-tag-card h3 { font-size: 17px; margin: 0 0 4px; font-weight: 600; color: var(--bg-text-dim); }
.bg-tag-card p { font-size: 12px; color: var(--bg-muted); margin: 0; }

/* =================================================================
 *  SEARCH (so.html)
 * ================================================================= */
.bg-so-wrap { width: min(100% - 40px, 680px); margin: 0 auto; padding: 80px 0; text-align: center; }
.bg-so-icon { font-size: 42px; margin-bottom: 10px; }
.bg-so-title { font-size: 34px; font-weight: 700; color: var(--bg-text-dim); margin: 0 0 8px; }
.bg-so-subtitle { color: var(--bg-muted); font-size: 15px; margin-bottom: 28px; }
.bg-so-form { display: flex; gap: 0; max-width: 520px; margin: 0 auto; box-shadow: var(--bg-shadow-lg); border-radius: 12px; overflow: hidden; }
.bg-so-form input { flex: 1; height: 48px; border: none; background: var(--bg-surface); padding: 0 18px; color: var(--bg-text); font-size: 15px; outline: none; }
.bg-so-form button { height: 48px; padding: 0 24px; border: none; background: var(--bg-accent); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; transition: .2s; }
.bg-so-form button:hover { background: var(--bg-accent2); }
.bg-so-hot { margin-top: 32px; }
.bg-so-hot h3 { font-size: 13px; color: var(--bg-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .04em; }

/* =================================================================
 *  SEARCH RESULTS
 * ================================================================= */
.bg-search-panel { padding: 24px 28px; background: var(--bg-surface); border-radius: var(--bg-radius); box-shadow: var(--bg-shadow-sm); margin-bottom: 16px; }
.bg-search-panel h1 { margin: 0; font-size: 24px; font-weight: 700; }
.bg-search-panel p { color: var(--bg-muted); font-size: 13px; margin: 4px 0 0; }
.bg-search-item { padding: 16px 0; border-bottom: 1px solid var(--bg-line2); }
.bg-search-item:last-child { border-bottom: none; }
.bg-search-item h3 { font-size: 18px; margin: 0 0 6px; }
.bg-search-item h3 a { color: var(--bg-text-dim); }
.bg-search-item p { color: var(--bg-muted); font-size: 13px; margin: 0; }

/* =================================================================
 *  DIY PAGE
 * ================================================================= */
.bg-diy-panel { padding: 28px; background: var(--bg-surface); border-radius: var(--bg-radius); box-shadow: var(--bg-shadow-sm); }

/* =================================================================
 *  EMPTY PAGE
 * ================================================================= */
.bg-empty { text-align: center; padding: 100px 20px; }
.bg-empty-icon { font-size: 64px; margin-bottom: 12px; }
.bg-empty h1 { font-size: 28px; margin-bottom: 10px; font-weight: 700; }
.bg-empty p { color: var(--bg-muted); font-size: 15px; margin-bottom: 24px; max-width: 440px; margin-left: auto; margin-right: auto; }

/* =================================================================
 *  FOOTER
 * ================================================================= */
.bg-footer { margin-top: 40px; border-top: 1px solid var(--bg-line2); padding: 24px 0; background: var(--bg-surface); }
.bg-footer-inner { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--bg-muted); }
.bg-footer-links { display: flex; gap: 16px; }
.bg-footer-links a { color: var(--bg-muted); font-size: 12px; }
.bg-footer-links a:hover { color: var(--bg-accent); }

/* =================================================================
 *  RESPONSIVE
 * ================================================================= */
@media (max-width: 1100px) {
  .bg-hero { grid-template-columns: 1fr 1fr; grid-template-rows: 240px 180px; }
  .bg-bento { grid-template-columns: repeat(2, 1fr); }
  .bg-bento-card.span-2-tall { grid-column: span 2; grid-row: auto; }
  .bg-bento-card.span-full { grid-column: span 2; }
  .bg-tag-grid { grid-template-columns: repeat(3, 1fr); }
  .bg-content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 991px) {
  .bg-menu-toggle { display: inline-flex; }
  .bg-nav { display: none; }
  .bg-nav.open { display: flex; flex-direction: column; }
}
@media (max-width: 768px) {
  .bg-wrap { width: min(100% - 20px, 1160px); }
  .bg-main { padding-top: 12px; }
  .bg-hero { grid-template-columns: 1fr 1fr; grid-template-rows: 200px 140px; }
  .bg-hero-main-text h1 { font-size: 20px; }
  .bg-hero-sub h2 { font-size: 16px; }
  .bg-bento { grid-template-columns: 1fr; gap: 10px; }
  .bg-bento-card.span-2,.bg-bento-card.span-2-tall,.bg-bento-card.span-full { grid-column: span 1; }
  .bg-tag-grid { grid-template-columns: repeat(2, 1fr); }
  .bg-stream-item { grid-template-columns: 1fr; }
  .bg-stream-thumb { aspect-ratio: 16/9; }
  .bg-footer-inner { flex-direction: column; gap: 8px; text-align: center; }
  .bg-list-head,.bg-search-panel,.bg-detail,.bg-diy-panel { padding: 18px; }
  .bg-detail-header h1 { font-size: 22px; }
  .bg-article-content { font-size: 14px; }
}
