/*
Theme Name: TODO.a
Theme URI: https://todo-a.tw/
Description: 台灣開放民主守望協會官網。Twenty Twenty-Five 子主題，配色與字型照 civic-tw 設計 token（茄紫 #4e3480、標題明體、介面黑體）。
Template: twentytwentyfive
Version: 0.3.0
Requires at least: 7.1
Text Domain: todoa
*/

html { scrollbar-gutter: stable; }
:lang(zh) h1, :lang(zh) h2, :lang(zh) h3, .wp-block-post-title { text-wrap: balance; }
p, li { text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--wp--preset--color--accent-3); outline-offset: 2px; }

/* Shared civic top bar (same on iVoter / iConcern / TODO.a) */
.civic-topbar { padding-block: 6px; color: #dddddd; }
.civic-topbar p { margin: 0; font-size: 13px; line-height: 1.6; }
.civic-topbar a { color: #ffffff; text-decoration: none; }
.civic-topbar a:hover { text-decoration: underline; }

/* Sticky header */
.civic-header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--wp--preset--color--accent-6); padding-block: 8px; }
.admin-bar .civic-header { top: var(--wp-admin--admin-bar--height, 0); }
.civic-header .wp-block-navigation a { color: var(--wp--preset--color--body); }
.civic-header .wp-block-navigation a:hover { color: var(--wp--preset--color--accent-3); }
/* 44px touch targets. Never set `display` on the menu toggle: WordPress hides it on desktop with display:none. */
.civic-header .wp-block-navigation__responsive-container-open { min-width: 44px; min-height: 44px; }
.civic-header .wp-block-button__link { min-height: 44px; display: inline-flex; align-items: center; padding-block: 0; }
.civic-header .wp-block-navigation__container { flex-wrap: nowrap; }
@media (max-width: 599px) { .civic-header .wp-block-site-logo img { width: 104px !important; height: auto; } }

/* Page and post titles */
.civic-page-hero .wp-block-post-terms,
.civic-kicker { margin-bottom: 0.25rem; letter-spacing: 0.05em; }
.civic-page-hero .wp-block-post-title,
.civic-page-title { font-size: var(--wp--preset--font-size--xx-large); margin-block: 0.25rem 0.75rem; }

/* Borderless cards */
.civic-cards { row-gap: 40px; }
.civic-cards > li { display: flex; flex-direction: column; gap: 6px; }
.civic-cards .wp-block-post-featured-image { margin-bottom: 8px; background: var(--wp--preset--color--accent-5); }
.civic-cards .wp-block-post-featured-image img { object-fit: cover; }
.civic-cards .wp-block-post-title { margin: 0; line-height: 1.45; }

/* Tags as pills */
.wp-block-post-terms.taxonomy-post_tag a { display: inline-block; border: 1px solid var(--wp--preset--color--accent-6); border-radius: 999px; padding: 2px 12px; color: var(--wp--preset--color--accent-4); }

/* Outline button */
.wp-block-button.is-style-outline > .wp-block-button__link { border: 2px solid var(--wp--preset--color--accent-3); color: var(--wp--preset--color--accent-3); background: transparent; }
.wp-block-button.is-style-outline > .wp-block-button__link:hover { background: var(--wp--preset--color--accent-1); }

/* Footer */
.civic-footer a { color: #ffffff; }
.civic-footer p { line-height: 1.8; }

/* Imported classic content: tables and images behave on phones */
.wp-block-post-content table { display: block; overflow-x: auto; max-width: 100%; border-collapse: collapse; }
.wp-block-post-content td, .wp-block-post-content th { border: 1px solid var(--wp--preset--color--accent-6); padding: 6px 10px; }
.wp-block-post-content img { max-width: 100%; height: auto; }
.wp-block-post-content .aligncenter { display: block; margin-inline: auto; }

/* Board roster (converted from Team Members plugin) */
.civic-roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 16px 24px; list-style: none; padding: 0; }
.civic-roster li { border-top: 1px solid var(--wp--preset--color--accent-6); padding-top: 8px; }
.civic-roster strong { display: block; font-size: var(--wp--preset--font-size--lead); color: var(--wp--preset--color--contrast); }
.civic-roster span { color: var(--wp--preset--color--accent-4); font-size: var(--wp--preset--font-size--small); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Old content pastes fixed-size iframes (YouTube 1120×630): keep them inside the column. */
.wp-block-post-content iframe { max-width: 100%; }
.wp-block-post-content iframe[src*="youtube.com"], .wp-block-post-content iframe[src*="youtube-nocookie.com"] { width: 100%; height: auto; aspect-ratio: 16 / 9; }

/* ---------------------------------------------------------------------------------------------------------
 * Article typography: one font, size, line height and spacing for every post and page body, whatever the old
 * editor pasted in. Old content still carries inline font-family / font-size / color / line-height (cleaned from
 * the DB on 2026-11-27, but editors can paste more): the theme wins over them. Layout settings (text-align,
 * float, width, margin, padding, borders, grids) are not touched. Preset classes (has-*-font-size,
 * has-*-color) are left alone so blocks and patterns keep their sizes and colours.
 * ------------------------------------------------------------------------------------------------------- */
.wp-block-post-content { font-family: var(--wp--preset--font-family--sans); font-size: var(--wp--preset--font-size--medium); line-height: 1.9; color: var(--wp--preset--color--body); overflow-wrap: anywhere; }
@media (min-width: 768px) { .wp-block-post-content { font-size: var(--wp--preset--font-size--lead); } }
.wp-block-post-content :where(p, ul, ol, table, blockquote, figure) { margin-block: 0 1.1em; }
.wp-block-post-content :where(h2, h3, h4, h5, h6) { margin-block: 1.8em 0.6em; }
.wp-block-post-content :where(h2, h3, h4, h5, h6):first-child { margin-top: 0; }
.wp-block-post-content :where(li) { margin-block: 0.25em; }
.wp-block-post-content :where(ul, ol) { padding-inline-start: 1.5em; }
.wp-block-post-content a:where(:not(.wp-element-button)) { color: var(--wp--preset--color--accent-3); text-decoration: underline; text-underline-offset: 0.15em; }
.wp-block-post-content a:where(:not(.wp-element-button)):hover { color: var(--wp--preset--color--brand-dark); }
.wp-block-post-content :where(figcaption, .wp-caption-text, .wp-element-caption) { color: var(--wp--preset--color--accent-4); font-size: var(--wp--preset--font-size--small); line-height: 1.6; margin-top: 0.4em; }
.wp-block-post-content blockquote { border-left: 4px solid var(--wp--preset--color--accent-2); padding-left: 1em; color: var(--wp--preset--color--accent-4); }
.wp-block-post-content th { background: var(--wp--preset--color--accent-5); font-weight: 700; }
.wp-block-post-content :where(td, th) { font-size: var(--wp--preset--font-size--medium); line-height: 1.6; vertical-align: top; }
/* Inline typography from old content: font tags and style attributes lose to the theme. */
.wp-block-post-content font { font: inherit !important; color: inherit !important; }
.wp-block-post-content [style*="font-family"] { font-family: inherit !important; }
.wp-block-post-content :where(p, span, div, li, td, th, strong, b, em, i, a, section, footer)[style*="font-size"]:not([class*="font-size"]) { font-size: inherit !important; }
.wp-block-post-content h2[style*="font-size"]:not([class*="font-size"]) { font-size: var(--wp--preset--font-size--x-large) !important; }
.wp-block-post-content h3[style*="font-size"]:not([class*="font-size"]) { font-size: var(--wp--preset--font-size--large) !important; }
.wp-block-post-content h4[style*="font-size"]:not([class*="font-size"]) { font-size: var(--wp--preset--font-size--lead) !important; }
.wp-block-post-content h5[style*="font-size"]:not([class*="font-size"]) { font-size: var(--wp--preset--font-size--medium) !important; }
.wp-block-post-content h6[style*="font-size"]:not([class*="font-size"]) { font-size: var(--wp--preset--font-size--small) !important; }
.wp-block-post-content [style*="line-height"] { line-height: inherit !important; }
.wp-block-post-content :where(p, span, div, li, td, th, strong, b, em, i, section, footer, h2, h3, h4)[style*="color"]:not([class*="-color"]) { color: inherit !important; }
.wp-block-post-content a[style*="color"]:not([class*="-color"]) { color: var(--wp--preset--color--accent-3) !important; }
/* Old classic posts put images straight into paragraphs: no inline gaps under them, floats clear the column on phones. */
.wp-block-post-content img { vertical-align: middle; }
@media (max-width: 599px) { .wp-block-post-content :where(.alignleft, .alignright, img[style*="float"]) { float: none !important; display: block; margin: 0 auto 1em; } }
.wp-block-post-content::after { content: ""; display: table; clear: both; }

/* Footer: contact and follow are separate headings, never one link run */
.civic-footer .wp-block-heading { font-family: var(--wp--preset--font-family--sans); }
.civic-footer p a { text-underline-offset: 0.15em; }
