/*
Theme Name: IssueFM Blog Foundation
Theme URI: https://issuefm.co.kr
Author: IssueFM
Description: IssueFM BLOG 전용 경량 블록 테마의 1차 기반 구조입니다.
Version: 0.5.0
Requires at least: 6.7
Requires PHP: 8.0
Text Domain: issuefm-blog-foundation
*/

:root {
  --ifm-navy: #071a33;
  --ifm-blue: #1769e0;
  --ifm-teal: #0b8f87;
  --ifm-ink: #172033;
  --ifm-muted: #637087;
  --ifm-line: #e3e8ef;
  --ifm-soft: #f5f8fb;
  --ifm-white: #fff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ifm-ink); background: var(--ifm-white); }
a { text-underline-offset: .18em; }
img { height: auto; }

.ifm-site-header { border-bottom: 1px solid var(--ifm-line); background: rgba(255,255,255,.97); position: sticky; top: 0; z-index: 20; }
.ifm-header-inner, .ifm-main, .ifm-footer-inner { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.ifm-header-inner { min-height: 76px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; }
.ifm-brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.ifm-brand a { color: var(--ifm-navy); text-decoration: none; font-weight: 800; font-size: 1.55rem; }
.ifm-brand-badge { color: var(--ifm-teal); font-size: .78rem; font-weight: 800; letter-spacing: .08em; }
.ifm-header-actions { display: flex; align-items: center; gap: 10px; }
.ifm-search { display: flex; align-items: center; min-width: 210px; border: 1px solid var(--ifm-line); border-radius: 999px; overflow: hidden; background: white; }
.ifm-search input { width: 100%; min-width: 0; padding: 9px 4px 9px 14px; border: 0; outline: 0; font: inherit; font-size: .86rem; }
.ifm-search button { width: 38px; height: 36px; border: 0; background: transparent; color: var(--ifm-navy); cursor: pointer; font-size: 1rem; }

.ifm-main { padding-block: 48px 72px; }
.ifm-home-intro { padding-bottom: 22px; }
.ifm-featured-grid { padding-top: 0; padding-bottom: 0; }
.ifm-category-section { padding-top: 0; padding-bottom: 22px; }
.ifm-post-grid { padding-top: 0; padding-bottom: 0; }
.ifm-content-zones { padding-top: 0; }
.ifm-section-title { margin: 0 0 22px; font-size: clamp(1.45rem, 2.4vw, 2rem); }
.ifm-section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 0 0 22px; }
.ifm-section-head .ifm-section-title { margin: 0; }
.ifm-section-head p { margin: 0; color: var(--ifm-muted); font-size: .9rem; }
.ifm-category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 52px; }
.ifm-category-card { min-height: 142px; padding: 24px; border: 1px solid var(--ifm-line); border-radius: 18px; background: var(--ifm-white); }
.ifm-category-card:hover { border-color: #b7c9de; box-shadow: 0 10px 28px rgba(7,26,51,.07); }
.ifm-category-card a { color: var(--ifm-navy); font-weight: 800; font-size: 1.1rem; text-decoration: none; }
.ifm-category-card p { color: var(--ifm-muted); line-height: 1.6; margin: 10px 0 0; font-size: .92rem; }

.ifm-post-grid .wp-block-post-template { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 22px; }
.ifm-post-card { height: 100%; padding: 20px; border: 1px solid var(--ifm-line); border-radius: 18px; background: white; }
.ifm-post-card .wp-block-post-featured-image img { aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; }
.ifm-post-card .wp-block-post-title { margin: 15px 0 8px; font-size: 1.2rem; line-height: 1.42; }
.ifm-post-card .wp-block-post-title a { color: var(--ifm-ink); text-decoration: none; }
.ifm-post-card .wp-block-post-excerpt { color: var(--ifm-muted); font-size: .92rem; line-height: 1.65; }
.ifm-post-card .wp-block-post-date, .ifm-post-card .taxonomy-category { color: var(--ifm-muted); font-size: .8rem; }
.ifm-card-meta { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; color: var(--ifm-muted); font-size: .8rem; }
.ifm-reading-time { color: var(--ifm-muted); font-size: .82rem; white-space: nowrap; }
.ifm-featured-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 22px; margin-bottom: 52px; }
.ifm-featured-panel { min-height: 320px; padding: clamp(24px, 4vw, 44px); border-radius: 22px; background: var(--ifm-soft); border: 1px solid var(--ifm-line); }
.ifm-featured-panel .wp-block-post-title { font-size: clamp(1.7rem, 3.5vw, 2.7rem); line-height: 1.26; }
.ifm-featured-panel .wp-block-post-title a { color: var(--ifm-navy); text-decoration: none; }
.ifm-featured-panel .wp-block-post-excerpt { color: var(--ifm-muted); font-size: 1rem; line-height: 1.75; }
.ifm-side-note { min-height: 320px; padding: 28px; border-radius: 22px; color: white; background: linear-gradient(160deg, var(--ifm-teal), #075f72); display: flex; flex-direction: column; justify-content: space-between; }
.ifm-side-note a { color: white; font-weight: 800; }
.ifm-content-zones { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 22px; margin-top: 52px; }
.ifm-zone { padding: 28px; border: 1px solid var(--ifm-line); border-radius: 20px; background: white; }
.ifm-zone h2 { margin-top: 0; }
.ifm-zone p { color: var(--ifm-muted); line-height: 1.7; }

.ifm-content-shell { width: min(760px, calc(100% - 40px)); margin: 48px auto 80px; }
.ifm-content-shell .wp-block-post-title { color: var(--ifm-navy); font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.2; }
.ifm-content-shell .wp-block-post-content { font-size: 1.06rem; line-height: 1.9; }
.ifm-content-shell .wp-block-post-content h2 { margin-top: 2.2em; }
.ifm-content-shell .wp-block-post-featured-image img { border-radius: 18px; }
.ifm-meta { color: var(--ifm-muted); font-size: .9rem; }
.ifm-article-kicker { color: var(--ifm-teal); font-weight: 800; font-size: .84rem; letter-spacing: .04em; }
.ifm-article-summary { margin: 18px 0 26px; padding: 20px 22px; border-left: 4px solid var(--ifm-teal); background: var(--ifm-soft); color: #354157; font-size: 1.05rem; line-height: 1.75; }
.ifm-related { width: min(980px, calc(100% - 40px)); margin: 0 auto 76px; padding-top: 34px; border-top: 1px solid var(--ifm-line); }
.ifm-related .wp-block-post-template { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.ifm-empty { padding: 44px; text-align: center; border: 1px dashed var(--ifm-line); border-radius: 18px; background: var(--ifm-soft); }

.ifm-site-footer { border-top: 1px solid var(--ifm-line); background: #fff; color: var(--ifm-muted); }
.ifm-footer-inner { padding-block: 44px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 36px; }
.ifm-footer-title { color: var(--ifm-navy); font-size: 1.25rem; font-weight: 800; }
.ifm-footer-links { display: flex; flex-wrap: wrap; gap: 10px 18px; align-content: start; }
.ifm-footer-links a { color: var(--ifm-ink); text-decoration: none; }
.ifm-footer-note { color: var(--ifm-muted); font-size: .83rem; }

@media (max-width: 900px) {
  .ifm-header-inner { padding-block: 16px; grid-template-columns: 1fr auto; gap: 12px; }
  .ifm-search { min-width: 180px; }
  .ifm-site-header { position: static; }
  .ifm-category-grid, .ifm-post-grid .wp-block-post-template, .ifm-related .wp-block-post-template { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ifm-featured-grid { grid-template-columns: 1fr; }
  .ifm-side-note { min-height: 220px; }
}

@media (max-width: 620px) {
  .ifm-header-inner, .ifm-main, .ifm-footer-inner { width: min(100% - 28px, 1180px); }
  .ifm-header-inner { grid-template-columns: 1fr; }
  .ifm-header-actions { width: 100%; }
  .ifm-search { flex: 1; }
  .ifm-main { padding-top: 24px; }
  .ifm-category-grid, .ifm-post-grid .wp-block-post-template, .ifm-footer-inner, .ifm-related .wp-block-post-template, .ifm-content-zones { grid-template-columns: 1fr; }
  .ifm-content-shell { width: calc(100% - 28px); margin-top: 30px; }
  .ifm-section-head { display: block; }
  .ifm-section-head p { margin-top: 6px; }
}

/* Master reference home */
.ifm-master-header { position: relative; background: #fff; }
.ifm-master-header .ifm-header-inner { min-height: 72px; grid-template-columns: minmax(250px,1fr) minmax(300px,420px) auto; gap: 26px; }
.ifm-brand-lockup { display: flex; flex-direction: column; gap: 3px; }
.ifm-wordmark { color: var(--ifm-navy); font-size: 1.75rem; line-height: 1; font-weight: 900; text-decoration: none; letter-spacing: -.04em; }
.ifm-wordmark em { margin-left: .4rem; color: var(--ifm-blue); font-size: .62rem; font-style: normal; letter-spacing: .12em; vertical-align: middle; }
.ifm-tagline { color: var(--ifm-muted); font-size: .76rem; }
.ifm-master-header .ifm-search { width: 100%; min-width: 0; height: 38px; background: #f7f8fa; }
.ifm-menu { position: relative; }
.ifm-menu summary { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 84px; height: 42px; padding: 0 13px; border: 1px solid var(--ifm-line); border-radius: 999px; cursor: pointer; list-style: none; font-size: .83rem; font-weight: 800; }
.ifm-menu summary::-webkit-details-marker { display: none; }
.ifm-menu summary span { display: block; width: 3px; height: 3px; border-radius: 50%; background: var(--ifm-navy); }
.ifm-menu summary b { margin-left: 3px; }
.ifm-menu nav { position: absolute; z-index: 30; top: calc(100% + 10px); right: 0; width: 220px; padding: 12px; border: 1px solid var(--ifm-line); border-radius: 16px; background: #fff; box-shadow: 0 18px 45px rgba(7,26,51,.14); }
.ifm-menu nav a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--ifm-ink); text-decoration: none; font-size: .9rem; font-weight: 700; }
.ifm-menu nav a:hover { background: var(--ifm-soft); }

.ifm-master-home { width: min(1180px, calc(100% - 40px)); margin-inline: auto; padding-bottom: 64px; }
.ifm-home-section { margin-top: 42px; }
.ifm-section-label { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.ifm-section-label > span { width: 8px; height: 8px; border-radius: 50%; background: #ff6247; box-shadow: 0 0 0 5px #fff0ec; }
.ifm-section-label h1, .ifm-section-label h2 { margin: 0; color: var(--ifm-navy); font-size: clamp(1.35rem,2vw,1.7rem); letter-spacing: -.035em; }
.ifm-section-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.ifm-slider-controls { display: flex; gap: 7px; margin-bottom: 20px; }
.ifm-slider-controls button { width: 34px; height: 34px; border: 1px solid var(--ifm-line); border-radius: 50%; background: #fff; color: var(--ifm-navy); cursor: pointer; font-size: .95rem; }
.ifm-slider-controls button:hover { border-color: var(--ifm-navy); }

.ifm-top-grid { display: grid; grid-template-columns: minmax(0,55fr) minmax(340px,45fr); gap: 38px; align-items: center; min-height: 0; background: #fff; }
.ifm-top-media { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 16px; background: linear-gradient(135deg,#edf3f8,#dfe9f2); }
.ifm-top-media:not(:has(img))::before, .ifm-trend-media:not(:has(img))::before, .ifm-latest-media:not(:has(img))::before { content: "IssueFM"; position: absolute; inset: 0; display: grid; place-items: center; color: #9cafc1; font-size: 1.1rem; font-weight: 900; letter-spacing: .08em; background: linear-gradient(135deg,#f0f5f8,#dfe8ef); }
.ifm-top-media .wp-block-post-featured-image, .ifm-top-media img { width: 100%; height: 100%; margin: 0; }
.ifm-top-media img { object-fit: cover; }
.ifm-top-copy { display: flex; flex-direction: column; justify-content: center; padding: 14px 4px; }
.ifm-pick-label { margin: 0 0 12px; color: #ff6247; font-size: .74rem; font-weight: 900; letter-spacing: .12em; }
.ifm-top-copy .wp-block-post-title { margin: 0 0 14px; font-size: clamp(1.8rem,2.5vw,2.15rem); line-height: 1.24; letter-spacing: -.04em; }
.ifm-top-copy .wp-block-post-title a { color: var(--ifm-navy); text-decoration: none; }
.ifm-top-copy .wp-block-post-excerpt { margin: 0; color: var(--ifm-muted); line-height: 1.65; font-size: .94rem; }
.ifm-top-copy .wp-block-post-excerpt__more-link { display: inline-block; margin-top: 12px; color: var(--ifm-navy); font-weight: 850; }

.ifm-trending-query .wp-block-post-template { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 64px) / 5); grid-template-columns: none; gap: 16px; margin: 0; padding: 0 0 8px; overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: inline mandatory; scrollbar-width: none; }
.ifm-trending-query .wp-block-post-template::-webkit-scrollbar { display: none; }
.ifm-trend-card { height: 100%; min-width: 0; scroll-snap-align: start; }
.ifm-trend-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; margin-bottom: 12px; border-radius: 12px; background: var(--ifm-soft); }
.ifm-trend-media .wp-block-post-featured-image, .ifm-trend-media img { width: 100%; height: 100%; margin: 0; }
.ifm-trend-media img { object-fit: cover; }
.ifm-trend-card .taxonomy-category { color: #ff6247; font-size: .76rem; font-weight: 800; }
.ifm-trend-card .wp-block-post-title { margin: 6px 0; font-size: .94rem; line-height: 1.4; }
.ifm-trend-card .wp-block-post-title a { color: var(--ifm-ink); text-decoration: none; }
.ifm-trend-card .wp-block-post-date { color: var(--ifm-muted); font-size: .76rem; }

.ifm-latest-section .wp-block-post-template { margin: 0; padding: 0; }
.ifm-latest-row { display: grid; grid-template-columns: 160px minmax(0,1fr) 38px; gap: 22px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--ifm-line); }
.ifm-latest-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 14px; background: var(--ifm-soft); }
.ifm-latest-media .wp-block-post-featured-image, .ifm-latest-media img { width: 100%; height: 100%; margin: 0; }
.ifm-latest-media img { object-fit: cover; }
.ifm-latest-copy .wp-block-post-title { margin: 0 0 6px; font-size: clamp(1.05rem,1.7vw,1.3rem); line-height: 1.35; }
.ifm-latest-copy .wp-block-post-title a { color: var(--ifm-ink); text-decoration: none; }
.ifm-latest-copy .wp-block-post-excerpt { margin: 0; color: var(--ifm-muted); font-size: .92rem; line-height: 1.65; }
.ifm-row-arrow { margin: 0; text-align: right; }
.ifm-row-arrow a { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--ifm-line); border-radius: 50%; color: transparent; font-size: 0; text-decoration: none; }
.ifm-row-arrow a::after { content: "→"; color: var(--ifm-navy); font-size: 1rem; }
.ifm-more-wrap { margin-top: 28px; text-align: center; }
.ifm-more-button { display: inline-block; padding: 10px 20px; border: 1px solid var(--ifm-navy); border-radius: 999px; color: var(--ifm-navy); text-decoration: none; font-size: .88rem; font-weight: 800; }

.ifm-master-footer .ifm-footer-inner { grid-template-columns: 1.2fr 1fr; align-items: start; padding-block: 36px 24px; }
.ifm-master-footer .ifm-footer-links { display: grid; grid-template-columns: repeat(2,max-content); }
.ifm-footer-copyright { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 18px 0 26px; border-top: 1px solid var(--ifm-line); color: var(--ifm-muted); font-size: .8rem; text-align: center; }

@media (max-width: 900px) {
  .ifm-master-header .ifm-header-inner { grid-template-columns: 1fr auto; padding-block: 16px; }
  .ifm-master-header .ifm-search { grid-column: 1 / -1; grid-row: 2; }
  .ifm-top-grid { grid-template-columns: 1fr 1fr; gap: 24px; min-height: 0; }
  .ifm-trending-query .wp-block-post-template { grid-auto-columns: calc((100% - 32px) / 3); }
  .ifm-latest-row { grid-template-columns: 180px minmax(0,1fr) 42px; gap: 20px; }
  .ifm-master-footer .ifm-footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .ifm-master-header .ifm-header-inner { width: calc(100% - 28px); min-height: 72px; gap: 14px; }
  .ifm-tagline { display: none; }
  .ifm-menu summary { min-width: 54px; width: 54px; padding: 0; }
  .ifm-menu summary b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ifm-menu nav { position: fixed; top: 70px; left: 14px; right: 14px; width: auto; }
  .ifm-master-home { width: calc(100% - 28px); padding-bottom: 60px; }
  .ifm-home-section { margin-top: 38px; }
  .ifm-section-label { margin-bottom: 22px; }
  .ifm-section-bar { align-items: end; }
  .ifm-top-grid { grid-template-columns: 1fr; min-height: 0; gap: 0; }
  .ifm-top-media { min-height: 0; aspect-ratio: 16 / 10; }
  .ifm-top-copy { padding: 24px 4px 8px; }
  .ifm-top-copy .wp-block-post-title { font-size: 1.65rem; }
  .ifm-trending-query { margin-right: -14px; }
  .ifm-trending-query .wp-block-post-template { grid-auto-columns: 76%; padding-right: 14px; }
  .ifm-latest-row { grid-template-columns: 104px minmax(0,1fr) 32px; gap: 13px; padding: 18px 0; }
  .ifm-latest-copy .wp-block-post-excerpt { display: none; }
  .ifm-latest-copy .wp-block-post-title { font-size: 1rem; }
  .ifm-latest-copy .ifm-card-meta { gap: 5px 8px; }
  .ifm-latest-copy .ifm-reading-time { display: none; }
  .ifm-row-arrow a { width: 32px; height: 32px; }
  .ifm-master-footer .ifm-footer-inner { grid-template-columns: 1fr; }
  .ifm-master-footer .ifm-footer-links { grid-template-columns: 1fr 1fr; }
}
