/* ==========================================================================
   wp.css — WordPress-specific layer on top of the design system:
   core classes, editor content, admin bar, and small pieces the static
   prototype did not need. Loaded after pages.css, before motion.css.
   ========================================================================== */

/* The [hidden] attribute must win over component display values (.check, .notice…). */
[hidden] { display: none !important; }

/* ---------- Core accessibility classes ---------- */
.screen-reader-text {
  border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
  block-size: 1px; inline-size: 1px; margin: -1px; overflow: hidden; padding: 0;
  position: absolute !important; word-wrap: normal !important;
}
.screen-reader-text:focus {
  clip: auto !important; clip-path: none; block-size: auto; inline-size: auto;
  inset-block-start: 5px; inset-inline-start: 5px; z-index: 100000;
  padding: var(--space-3) var(--space-4); background: var(--color-surface); color: var(--color-heading);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
}

/* ---------- Admin bar: keep the sticky header below it ---------- */
.admin-bar .site-header { inset-block-start: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { inset-block-start: 46px; } }
@media (max-width: 600px) { .admin-bar .site-header { inset-block-start: 0; } }

/* ---------- Custom logo from the Customizer ---------- */
.brand .custom-logo, .brand img.brand__logo:only-child { display: block; }

/* ---------- Flags ---------- */
.flag-fallback { color: var(--color-text-muted); }
.lang-card__glyph { font-weight: var(--weight-bold); color: var(--color-primary); }

/* ---------- Editor content (the_content) ---------- */
.entry-content > * + * { margin-block-start: 1em; }
.entry-content img, .entry-content video, .entry-content iframe { max-inline-size: 100%; block-size: auto; border-radius: var(--radius-md); }
.entry-content a { color: var(--color-link); }
.entry-content table { inline-size: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.entry-content th, .entry-content td { border: 1px solid var(--color-border); padding: var(--space-2) var(--space-3); text-align: start; }
.entry-content pre { overflow-x: auto; padding: var(--space-4); background: var(--color-surface-sunk); border-radius: var(--radius-md); direction: ltr; text-align: left; }
.entry-content hr { border: 0; border-block-start: 1px solid var(--color-border); margin-block: var(--space-8); }
.entry-thumb { margin-block-end: var(--space-8); }
.entry-thumb img { inline-size: 100%; block-size: auto; border-radius: var(--radius-lg); }

.alignleft { float: inline-start; margin-inline-end: var(--space-5); margin-block-end: var(--space-3); }
.alignright { float: inline-end; margin-inline-start: var(--space-5); margin-block-end: var(--space-3); }
.aligncenter { display: block; margin-inline: auto; }
.alignwide { margin-inline: calc(-1 * var(--space-8)); max-inline-size: none; }
.alignfull { margin-inline: calc(50% - 50vw); max-inline-size: 100vw; inline-size: 100vw; }
@media (max-width: 700px) { .alignleft, .alignright { float: none; margin-inline: 0; } .alignwide { margin-inline: 0; } }

.wp-caption, figure.wp-block-image { max-inline-size: 100%; }
.wp-caption-text, .wp-element-caption, figcaption { font-size: var(--text-sm); color: var(--color-text-muted); margin-block-start: var(--space-2); text-align: center; }
.gallery { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.wp-block-quote { border-inline-start: 3px solid var(--color-accent); padding-inline-start: var(--space-5); }
.wp-block-button__link { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-5); border-radius: var(--radius-md); background: var(--color-primary); color: var(--color-on-primary); text-decoration: none; font-weight: var(--weight-semibold); }
.page-links { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-block-start: var(--space-6); }
.sticky { position: relative; }

/* ---------- Book details tab: two-column facts table ---------- */
.facts--table { grid-template-columns: 1fr; }
.facts--table > div { grid-template-columns: minmax(110px, 30%) 1fr; align-items: baseline; gap: var(--space-4); }
.facts--table dt { font-size: var(--text-sm); }

/* ---------- Search page ---------- */
.search-page__form { max-inline-size: 820px; }
.search-matches { display: grid; gap: var(--space-4); }
@media (min-width: 900px) { .search-matches { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); } }
.suggest__empty { padding: var(--space-4); color: var(--color-text-muted); font-size: var(--text-sm); display: flex; align-items: center; gap: var(--space-2); }
.suggest__cover img { inline-size: 100%; block-size: 100%; object-fit: cover; border-radius: 3px; }

/* ---------- Toolbar sort form ---------- */
.toolbar__sort { display: contents; }
.filters__more { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }

/* ---------- Submit form ---------- */
.dropzone__file { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-primary); }
.dropzone__file:empty { display: none; }

/* ---------- Comments (core markup) ---------- */
.comments-area .comment-list { list-style: none; padding: 0; }
.comments-area .comment-form { display: grid; gap: var(--space-4); }
.comments-area .form-submit { display: flex; justify-content: flex-end; }
.comment-actions .comment-edit-link { color: var(--color-text-muted); }
.nav-links { display: flex; justify-content: space-between; gap: var(--space-3); }
.logged-in-as { font-size: var(--text-sm); color: var(--color-text-muted); }

/* ---------- Widgets ---------- */
.widget ul { list-style: none; padding: 0; display: grid; gap: var(--space-2); }

/* ---------- Notices inside forms ---------- */
.form-card > .notice, .comment-respond .notice { margin-block-end: var(--space-5); }
