/*
Theme Name: FCRM
Theme URI: https://www.fcrm.com.tw/
Description: FCRM — Fields, Crops & Rural Matters。臺灣農業媒體專屬主題：SEO、Google 探索（Discover）與行動裝置優化。
Version: 1.0.6
Requires PHP: 8.3
Text Domain: fcrm
*/

:root {
  --paper: #F7F5EF;
  --ink: #1C2A20;
  --mut: #5F6B5C;
  --field: #24432F;
  --field-2: #1A3123;
  --leaf: #4E7A2E;
  --grain: #B8892A;
  --line: #DED9CB;
  --card: #fff;
  --tint: #EEF2E6;
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --sans: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  --latin: Outfit, system-ui, sans-serif;
  --r: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.75 var(--sans); }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--leaf); }
.in { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.sr, .skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { clip: auto; width: auto; height: auto; z-index: 99; background: var(--field); color: #fff; padding: 8px 14px; left: 8px; top: 8px; }
:focus-visible { outline: 2px solid var(--grain); outline-offset: 2px; }

/* ---------- En-tête ---------- */
.hd { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.hd-in { display: flex; align-items: center; gap: 24px; height: 76px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--field); flex: none; }
.brand:hover { color: var(--field); }
.mark { width: 42px; height: 42px; flex: none; }
.wm { display: block; font: 700 1.45rem/1 var(--latin); letter-spacing: .12em; }
.tag { display: block; font: 500 .62rem/1.3 var(--latin); letter-spacing: .08em; color: var(--mut); text-transform: uppercase; margin-top: 3px; }
.nav { margin-left: auto; }
.nav-list { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.nav-list a { font-size: 15px; font-weight: 600; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav-list .on a, .nav-list .current-menu-item a { border-color: var(--grain); }
.ic { border: 0; background: none; width: 44px; height: 44px; display: grid; place-items: center; color: var(--field); cursor: pointer; flex: none; }
.ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ic-menu { display: none; }
.search { display: none; }
.search.open { display: block; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1px solid var(--line); padding: 12px 24px; }
.search input { width: 100%; max-width: 640px; display: block; margin: auto; font: inherit; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }

/* ---------- Éléments communs ---------- */
.cat { display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--leaf); letter-spacing: .04em; }
.sec { font: 700 1.05rem/1.2 var(--serif); border-top: 3px solid var(--field); padding-top: 12px; margin: 44px 0 18px; display: flex; gap: 10px; align-items: center; }
.sec::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sec a { font: 600 13px var(--sans); color: var(--leaf); order: 2; }
.bc { font-size: 13px; color: var(--mut); margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.bc a { color: var(--mut); }
.av { border-radius: 50%; }
.by { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--mut); margin: 0; }
.by .av { width: 36px; height: 36px; }
.meta { font-size: 13px; color: var(--mut); margin: 0; }

/* ---------- Cartes ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.grid.g4 { grid-template-columns: repeat(4, 1fr); gap: 22px; }
.card .ph img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--r); background: var(--tint); }
.card .cat { margin-top: 12px; }
.card .t { font: 700 1.12rem/1.5 var(--serif); margin: .15em 0 .2em; }
.card-sm .t { font-size: 1rem; }
.card-hero { display: grid; grid-template-columns: 7fr 5fr; gap: 36px; align-items: center; padding: 36px 0 8px; }
.card-hero .t { font-size: 2.1rem; line-height: 1.35; margin: .2em 0 .35em; }
.card-hero .dk { color: var(--mut); font-size: 1.05rem; margin: 0 0 1em; }
.card-hero .cat { margin-top: 0; }

/* ---------- Accueil : dossiers ---------- */
.dos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.d { position: relative; border-radius: var(--r); overflow: hidden; color: #fff; min-height: 150px; background: var(--field); }
.d img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.d::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(20, 35, 24, .88)); }
.d span { position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 1; }
.d b { display: block; font: 700 1.02rem/1.4 var(--serif); }
.d small { opacity: .85; }
.d:hover { color: #fff; }

/* ---------- Article ---------- */
.art { max-width: 800px; padding-top: 28px; padding-bottom: 8px; }
.art h1, .pg h1 { font: 700 2.1rem/1.35 var(--serif); margin: .2em 0 .35em; }
.art .dk { color: var(--mut); font-size: 1.08rem; margin: 0 0 1em; }
.art figure.hero-img { margin: 24px 0; }
.art figure.hero-img img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--r); }
figcaption, .wp-caption-text { font-size: 13px; color: var(--mut); margin-top: 6px; }
.key { background: var(--tint); border-left: 4px solid var(--leaf); border-radius: 6px; padding: 14px 20px; margin: 0 0 24px; }
.key .kh { font-weight: 700; margin: 0 0 4px; }
.key ul { margin: 0; padding-left: 1.2em; }
.body { font-size: 1.06rem; }
.body h2 { font: 700 1.4rem/1.45 var(--serif); margin: 1.7em 0 .5em; }
.body h3 { font: 700 1.15rem/1.5 var(--serif); margin: 1.4em 0 .4em; }
.body a { color: var(--leaf); text-decoration: underline; text-underline-offset: 3px; }
.body img { border-radius: var(--r); }
.body figure { margin: 1.6em 0; }
.body ul, .body ol { padding-left: 1.4em; }
.body table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.body th, .body td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1.4em 0; }
.table-wrap table { margin: 0; }
.body thead th { background: var(--tint); }
.body blockquote { margin: 1.4em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--grain); color: var(--mut); }
.upd { font-size: 13px; color: var(--mut); }
.ab { display: flex; gap: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin: 36px 0; }
.ab .av { width: 84px; height: 84px; flex: none; }
.ab .an { font-weight: 700; margin: 0; }
.ab .ar { font-size: 13px; color: var(--leaf); margin: 0 0 6px; }
.ab p { margin: 0; font-size: 14.5px; color: var(--mut); }
.tags-dos { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; font-size: 14px; }
.tags-dos a { border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; background: var(--card); }

/* ---------- Pages, dossiers, rubriques ---------- */
.pg { max-width: 800px; padding-top: 28px; }
.dhero { position: relative; color: #fff; min-height: 280px; display: flex; align-items: flex-end; background: var(--field); }
.dhero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dhero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(20, 35, 24, .9), rgba(20, 35, 24, .3)); }
.dhero .in { position: relative; z-index: 1; padding-bottom: 30px; width: 100%; }
.dhero h1 { font: 700 2.1rem/1.35 var(--serif); color: #fff; margin: .1em 0 .3em; }
.dhero p { max-width: 600px; margin: 0; }
.eyebrow { font: 600 .8rem/1 var(--latin); letter-spacing: .14em; color: #E9C46A; text-transform: uppercase; }
.sub { display: flex; gap: 8px; margin: 22px 0 26px; flex-wrap: wrap; }
.sub a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 16px; font-size: 14px; background: var(--card); }
.sub a.on { background: var(--field); color: #fff; border-color: var(--field); }
.intro { max-width: 800px; }
.arch-hd { padding: 32px 0 4px; }
.arch-hd h1 { font: 700 2rem/1.3 var(--serif); margin: 0 0 .3em; }
.arch-hd p { color: var(--mut); max-width: 720px; margin: 0; }
.pager { display: flex; gap: 8px; justify-content: center; margin: 40px 0 0; flex-wrap: wrap; }
.pager a, .pager span { min-width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 0 12px; }
.pager .current { background: var(--field); color: #fff; border-color: var(--field); }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.dlist { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ---------- Formulaire ---------- */
.wpcf7 p { margin: 0 0 14px; }
.wpcf7 label { display: block; font-weight: 600; font-size: 15px; }
.wpcf7 input[type=text], .wpcf7 input[type=email], .wpcf7 input[type=tel], .wpcf7 select, .wpcf7 textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); margin-top: 4px; }
.wpcf7 textarea { min-height: 160px; }
.wpcf7 .wpcf7-list-item { margin: 0; }
.wpcf7 .wpcf7-list-item label { font-weight: 400; }
.wpcf7-submit { background: var(--field); color: #fff; border: 0; border-radius: 999px; padding: 12px 28px; font: 700 16px var(--sans); cursor: pointer; min-height: 44px; }

/* ---------- Pied de page ---------- */
.ft { background: var(--field); color: #E8EDE3; margin-top: 64px; padding: 40px 0 18px; font-size: 14px; }
.ft a { color: #E8EDE3; }
.ft a:hover { color: #E9C46A; }
.ft-in { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.ft-about p { margin: 12px 0 0; max-width: 420px; }
.brand.inv, .brand.inv:hover { color: #fff; }
.brand.inv .tag { color: #C9D6C0; }
.fh { font-weight: 700; color: #fff; margin: 0 0 8px; }
.ft-links { list-style: none; margin: 0; padding: 0; }
.ft-links li { margin: 0 0 4px; }
.cp { margin-top: 28px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .15); color: #C9D6C0; font-size: 12.5px; }

/* ---------- Tablette ---------- */
@media (max-width: 1080px) {
  .nav-list { gap: 14px; }
  .nav-list a { font-size: 14px; }
  .tag { display: none; }
}
@media (max-width: 900px) {
  .ic-menu { display: grid; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1px solid var(--line); margin: 0; }
  .nav.open { display: block; }
  .nav-list { flex-direction: column; gap: 0; padding: 6px 24px 14px; }
  .nav-list a { display: block; padding: 10px 0; font-size: 16px; }
  .ic-search { margin-left: auto; }
  .card-hero { grid-template-columns: 1fr; gap: 14px; }
  .grid, .grid.g4 { grid-template-columns: repeat(2, 1fr); }
  .dos, .dlist { grid-template-columns: repeat(2, 1fr); }
  .ft-in { grid-template-columns: 1fr 1fr; }
}

/* ---------- Mobile : contenu utile au-dessus de la ligne de flottaison ---------- */
@media (max-width: 640px) {
  .in { padding: 0 16px; }
  .hd-in { height: 56px; gap: 8px; }
  .mark { width: 32px; height: 32px; }
  .wm { font-size: 1.2rem; }
  .bc { display: none; }
  .card-hero { padding: 14px 0 0; }
  .card-hero .t, .art h1, .pg h1, .dhero h1, .arch-hd h1 { font-size: 1.5rem; line-height: 1.4; }
  .card-hero .dk, .art .dk { display: none; }
  .art, .pg { padding-top: 12px; }
  .art figure.hero-img { margin: 12px 0 16px; }
  .sec { margin: 26px 0 12px; }
  .grid, .grid.g4 { grid-template-columns: 1fr; gap: 14px; }
  .grid .card, .grid.g4 .card { display: grid; grid-template-columns: 112px 1fr; gap: 12px; }
  .grid .card .ph img { aspect-ratio: 4/3; border-radius: 6px; }
  .grid .card .cat { margin-top: 0; }
  .grid .card .t { font-size: .98rem; line-height: 1.45; }
  .dos { gap: 10px; }
  .d { min-height: 110px; }
  .dhero { min-height: 190px; }
  .dhero .in { padding-bottom: 16px; }
  .dhero p { display: none; }
  .arch-hd { padding: 14px 0 0; }
  .body { font-size: 1rem; }
  .body h2 { font-size: 1.22rem; }
  .ab { flex-direction: column; gap: 10px; padding: 16px; }
  /* Tableaux : une ligne = une fiche « intitulé : valeur » */
  .table-cards table, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards thead { display: none; }
  .table-cards tr { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; margin: 0 0 10px; }
  .table-cards td { display: grid; grid-template-columns: 6.5em 1fr; gap: 10px; border-bottom: 1px dashed var(--line); padding: 7px 0; font-size: .95rem; }
  .table-cards td:last-child { border-bottom: 0; }
  .table-cards td::before { content: attr(data-label); font-weight: 700; color: var(--field); }
  .table-cards td:first-child { font-weight: 700; }
  .table-cards td:not([data-label])::before { content: none; }
  .table-cards td:not([data-label]) { grid-template-columns: 1fr; }
  .ft-in { grid-template-columns: 1fr; gap: 20px; }
  .dlist { grid-template-columns: 1fr; }
}
