/* Ei Foundation core layout. Legacy --da2-* variables remain as compatibility aliases. */

:root {
  --ei-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  /* Legacy --da2-* names are stable compatibility tokens. */
  --da2-bg: #ffffff;
  --da2-surface: #f7f8f9;
  --da2-surface-2: #eef0f2;
  --da2-text: #202124;
  --da2-muted: #687078;
  --da2-border: #d9dde2;
  --da2-accent: #24894f;
  --da2-accent-hover: #176c3b;
  --da2-footer: #303846;
  --da2-footer-text: #f2f4f7;
  --da2-sidebar: 274px;
  --da2-reading: 780px;
  --da2-shell: 1120px;
  --da2-header-h: 61px;
  --da2-radius: 8px;
  --da2-shadow: 0 1px 1px rgba(0,0,0,.03);
  --da2-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", Arial, sans-serif;
  --da2-mono: var(--ei-mono);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--da2-text);
  background: var(--da2-bg);
  font-family: var(--da2-font);
  font-size: 17px;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, video, iframe { max-width: 100%; height: auto; }
a { color: var(--da2-accent); text-decoration-thickness: .08em; text-underline-offset: .17em; }
a:hover { color: var(--da2-accent-hover); }
button, input, textarea, select { font: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--da2-accent) 35%, transparent); outline-offset: 2px; }
::selection { background: #c9f0d7; color: #112217; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--da2-header-h);
  border-top: 2px solid #1e2d27;
  border-bottom: 1px solid var(--da2-border);
  background: rgba(255,255,255,.97);
  box-shadow: var(--da2-shadow);
}
.admin-bar .site-header { top: 32px; }
.site-header__inner {
  min-height: calc(var(--da2-header-h) - 2px);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 16px;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 9px;
  color: #151719;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.site-brand:hover { color: #151719; }
.primary-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.primary-nav ul { list-style: none; display: flex; align-items: center; gap: 3px; margin: 0; padding: 0; }
.primary-nav a {
  display: block;
  padding: 17px 10px 16px;
  color: #25292d;
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
}
.primary-nav a:hover, .primary-nav .current-menu-item > a, .primary-nav .current_page_item > a { color: var(--da2-accent); }
.header-spacer { flex: 1 1 auto; }
.header-search { width: min(250px, 24vw); }
.header-search .search-form { position: relative; margin: 0; }
.header-search .search-field {
  width: 100%;
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: #eef0f3;
  padding: 0 12px 0 34px;
  color: #2b3035;
  font-size: 14px;
}
.header-search .search-form::before {
  content: "⌕";
  position: absolute;
  left: 11px; top: 50%; transform: translateY(-52%);
  font: 700 20px/1 var(--da2-mono);
  color: #2f353a;
  pointer-events: none;
}
.header-search .search-submit { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Mobile menu ---------- */
.mobile-nav { display: none; margin-left: auto; }
.mobile-nav > summary {
  position: relative;
  z-index: 121;
  cursor: pointer;
  list-style: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--da2-border);
  border-radius: 6px;
  background: var(--da2-surface);
  color: var(--da2-text);
}
.mobile-nav > summary::-webkit-details-marker { display: none; }
.mobile-nav__menu-icon,
.mobile-nav__close-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  line-height: 1;
}
.mobile-nav__menu-icon { font-size: 20px; font-weight: 800; }
.mobile-nav__close-icon { display: none; font-size: 31px; font-weight: 400; }
.mobile-nav[open] > summary .mobile-nav__menu-icon { display: none; }
.mobile-nav[open] > summary .mobile-nav__close-icon { display: grid; }
.mobile-nav[open]::before {
  content: "";
  position: fixed;
  z-index: 118;
  left: 0;
  right: 0;
  top: var(--da2-header-h);
  bottom: 0;
  background: rgba(18, 27, 38, .54);
}
.mobile-nav__panel {
  position: fixed;
  z-index: 120;
  left: 0;
  top: var(--da2-header-h);
  bottom: 0;
  width: min(86vw, 390px);
  overflow: hidden;
  background: #fff;
  border: 0;
  border-right: 1px solid var(--da2-border);
  border-radius: 0;
  box-shadow: 10px 0 30px rgba(0,0,0,.14);
  padding: 0;
}
.mobile-nav__main { height: 100%; overflow-y: auto; padding: 14px 16px 28px; }
.mobile-nav__panel ul { list-style: none; padding: 0; margin: 0; }
.mobile-nav__panel .menu > li > a {
  display: block;
  padding: 13px 12px;
  color: #24282c;
  text-decoration: none;
  border-radius: 6px;
  font-size: 17px;
}
.mobile-nav__panel .menu > li > a:hover,
.mobile-nav__panel .menu > .current-menu-item > a,
.mobile-nav__panel .menu > .current_page_item > a { background: var(--da2-surface); color: var(--da2-accent); font-weight: 700; }

.mobile-nav__panel .search-form { margin-top: 14px; padding-top: 14px; border-top: 1px dotted var(--da2-border); }
.mobile-nav__panel .search-field { width: 100%; padding: 10px 12px; border: 1px solid var(--da2-border); border-radius: 5px; }
.mobile-nav__panel .search-submit { margin-top: 8px; border: 1px solid var(--da2-border); background: #fff; border-radius: 5px; padding: 8px 12px; }

/* ---------- Main shell ---------- */
.site-shell {
  display: grid;
  grid-template-columns: var(--da2-sidebar) minmax(0, 1fr);
  min-height: calc(100vh - var(--da2-header-h));
}
.site-sidebar {
  border-right: 1px solid var(--da2-border);
  background: #fbfbfc;
  min-width: 0;
}
.site-sidebar__inner {
  position: sticky;
  top: var(--da2-header-h);
  max-height: calc(100vh - var(--da2-header-h));
  overflow: auto;
  padding: 9px 0 28px;
  scrollbar-width: thin;
}
.admin-bar .site-sidebar__inner { top: calc(var(--da2-header-h) + 32px); max-height: calc(100vh - var(--da2-header-h) - 32px); }
.sidebar-title {
  display: block;
  margin: 0 8px 8px;
  padding: 7px 10px;
  color: var(--da2-accent);
  background: #f0f1f2;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}
.sidebar-list { list-style: none; margin: 0; padding: 0; }
.sidebar-list li { margin: 0; }
.sidebar-list a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 38px 7px 18px;
  color: #4a4f55;
  text-decoration: none;
  font-size: 15px;
}
.sidebar-list a::after {
  content: "›";
  position: absolute;
  right: 15px;
  top: 50%; transform: translateY(-52%);
  color: #8b9096;
  font: 700 26px/1 Georgia, serif;
}
.sidebar-list a:hover { background: #f0f2f3; color: #23272b; }
.sidebar-list .current-cat > a, .sidebar-list .current_page_item > a { color: var(--da2-accent); background: #eef7f1; }
.sidebar-list .children { list-style: none; margin: 0; padding: 0 0 0 14px; }
.sidebar-divider { width: 44px; border: 0; border-top: 1px solid #aeb4ba; margin: 18px 18px 0; }
.sidebar-extra { padding: 14px 18px; font-size: 13px; color: var(--da2-muted); }
.sidebar-extra a { color: inherit; }


.site-main { min-width: 0; }
.content-wrap {
  width: min(var(--da2-shell), calc(100% - 56px));
  margin: 0 auto;
  padding: 42px 0 74px;
}
.reading-column { width: min(var(--da2-reading), 100%); }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; color: #899097; font-size: 13px; }
.breadcrumbs a { color: #6a7076; text-decoration: none; }
.breadcrumbs__home { font-size: 15px; color: #222; }
.breadcrumb-chip { padding: 2px 9px; background: #f1f2f2; border-radius: 999px; color: var(--da2-accent); }

/* ---------- Typography ---------- */
.entry-title, .page-title {
  margin: 0 0 14px;
  color: #181a1c;
  font-size: clamp(2rem, 4vw, 2.65rem);
  line-height: 1.2;
  letter-spacing: -.035em;
}
.archive-title { margin-bottom: 28px; }
.entry-meta { margin: -3px 0 28px; color: var(--da2-muted); font-size: 13px; }
.entry-content { font-size: 17px; }
.entry-content > * { max-width: 100%; }
.entry-content p { margin: 0 0 1.3em; }
.entry-content h2 { margin: 2.15em 0 .75em; font-size: 1.55rem; line-height: 1.35; }
.entry-content h3 { margin: 1.8em 0 .65em; font-size: 1.25rem; line-height: 1.4; }
.entry-content h4 { margin: 1.5em 0 .55em; font-size: 1.08rem; }
.entry-content ul, .entry-content ol { padding-left: 1.5em; margin: 0 0 1.4em; }
.entry-content li + li { margin-top: .28em; }
.entry-content blockquote {
  margin: 1.7em 0;
  padding: .5em 1em;
  border-left: 4px solid var(--da2-accent);
  background: #f7faf8;
  color: #41474c;
}
.entry-content blockquote > :last-child { margin-bottom: 0; }
.entry-content code { font-family: var(--da2-mono); background: #f1f3f4; border: 1px solid #e2e5e8; border-radius: 4px; padding: .08em .35em; font-size: .9em; }
.entry-content pre { overflow-x: auto; border: 1px solid #dfe3e6; border-radius: 6px; background: #f7f8f9; padding: 14px 16px; line-height: 1.55; }
.entry-content pre code { border: 0; background: transparent; padding: 0; }
.entry-content hr { border: 0; border-top: 1px solid var(--da2-border); margin: 2.4em 0; }
.entry-content table { border-collapse: collapse; width: 100%; margin: 1.5em 0; font-size: .95em; }
.entry-content th, .entry-content td { border: 1px solid var(--da2-border); padding: 8px 10px; text-align: left; }
.entry-content th { background: var(--da2-surface); }
.entry-content figure { margin: 1.8em 0; }
.entry-content figcaption { color: var(--da2-muted); font-size: 13px; text-align: center; }
.entry-content .alignwide { width: min(980px, calc(100vw - var(--da2-sidebar) - 80px)); max-width: none; }
.entry-content .alignfull { width: calc(100vw - var(--da2-sidebar)); max-width: none; margin-left: calc((var(--da2-reading) - (100vw - var(--da2-sidebar))) / 2); }

/* No featured-image layout on purpose. Images inside Gutenberg content remain supported. */

/* ---------- Lists / archives ---------- */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list__item { padding: 0 0 24px; margin: 0 0 24px; border-bottom: 1px solid #e5e8eb; }
.post-list__title { margin: 0 0 5px; font-size: 1.18rem; line-height: 1.45; }
.post-list__title a { text-decoration: none; color: #24282c; }
.post-list__title a:hover { color: var(--da2-accent); }
.post-list__meta { color: var(--da2-muted); font-size: 12px; margin-bottom: 7px; }
.post-list__excerpt { color: #4d5359; font-size: 15px; }
.post-list__excerpt p { margin: 0; }
.year-heading { margin: 30px 0 8px; font-size: 1.25rem; }
.compact-post-list { margin: 0; padding-left: 1.15em; }
.compact-post-list li { margin: .38em 0; }
.compact-post-list time { display: inline-block; min-width: 6.5em; color: var(--da2-muted); font: 12px/1.4 var(--da2-mono); }

.pagination { margin-top: 38px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; }
.pagination a, .pagination span { display: inline-flex; min-width: 35px; height: 35px; align-items: center; justify-content: center; border: 1px solid var(--da2-border); border-radius: 5px; padding: 0 9px; text-decoration: none; }
.pagination .current { background: var(--da2-accent); color: #fff; border-color: var(--da2-accent); }

/* ---------- Post navigation ---------- */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 44px 0 20px; }
.post-nav a { display: block; min-height: 68px; border: 1px solid var(--da2-border); border-radius: var(--da2-radius); padding: 10px 14px; color: #343a40; text-decoration: none; }
.post-nav a:hover { border-color: #adb6bd; color: var(--da2-accent); }
.post-nav__label { display: block; color: var(--da2-muted); font-size: 12px; }
.post-nav__next { text-align: right; }
.random-bridge { margin: 20px 0 0; }
.random-bridge a { display: inline-block; text-decoration: none; }
.feature-bridge-note { color: var(--da2-muted); font-size: 12px; }

/* ---------- Comments ---------- */
.comments-area { margin-top: 52px; border-top: 1px solid var(--da2-border); padding-top: 28px; }
.comment-list { list-style: none; padding: 0; }
.comment-list .children { list-style: none; padding-left: 24px; }
.comment-body { padding: 16px 0; border-bottom: 1px solid #edf0f2; }
.comment-meta { font-size: 13px; color: var(--da2-muted); }
.comment-content { margin-top: 8px; }
.comment-respond input[type="text"], .comment-respond input[type="email"], .comment-respond input[type="url"], .comment-respond textarea {
  width: 100%; max-width: 650px; border: 1px solid var(--da2-border); border-radius: 5px; padding: 9px 10px; background: #fff;
}
.comment-respond .submit { border: 1px solid #1e6f41; background: var(--da2-accent); color: #fff; border-radius: 5px; padding: 8px 14px; cursor: pointer; }

/* ---------- Footer ---------- */
.site-footer { grid-column: 1 / -1; background: var(--da2-footer); color: var(--da2-footer-text); }
.site-footer__inner { width: min(1160px, calc(100% - 48px)); margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 56px; padding: 32px 0 40px; }
.site-footer h2 { font-size: 14px; margin: 0 0 12px; color: #fff; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 7px 0; }
.site-footer a { color: #e7ebef; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer__fineprint { grid-column: 1 / -1; color: #aeb6c0; font-size: 12px; padding-top: 8px; }

/* ---------- WordPress ---------- */
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.screen-reader-text:focus { position: fixed !important; top: 8px; left: 8px; z-index: 99999; width: auto; height: auto; clip: auto; background: #fff; padding: 10px 14px; border: 2px solid #111; color: #111; }
.wp-block-button__link { background: var(--da2-accent); border-radius: 5px; }
.wp-caption-text { color: var(--da2-muted); font-size: 13px; }
.sticky { background: #fbfdfb; }
.bypostauthor { }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 1020px) {
  .primary-nav, .header-search { display: none; }
  .mobile-nav { display: block; }
  .admin-bar .mobile-nav__panel,
  .admin-bar .mobile-nav[open]::before { top: calc(var(--da2-header-h) + 32px); }
  .site-shell { grid-template-columns: 1fr; }
  .site-sidebar { display: none; }
  .content-wrap { width: min(900px, calc(100% - 36px)); padding-top: 30px; }
  .entry-content .alignwide, .entry-content .alignfull { width: 100%; margin-left: 0; }
}

@media (max-width: 782px) {
  .admin-bar .site-header { top: 46px; }
  .admin-bar .mobile-nav__panel,
  .admin-bar .mobile-nav[open]::before { top: calc(var(--da2-header-h) + 46px); }
  .site-header__inner { gap: 10px; padding: 0 11px; }
  .site-brand { font-size: 15px; }
    .content-wrap { width: min(100% - 28px, 760px); padding: 24px 0 52px; }
  .entry-title, .page-title { font-size: 2rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav__next { text-align: left; }
  .site-footer__inner { width: calc(100% - 36px); grid-template-columns: 1fr; gap: 20px; }
}

