/* ====================================================================
   WIDGET STYLING — editorial polish for native WordPress widgets

   The theme exposes 3 widget areas:
   - article-sidebar  (article right column)
   - account-sidebar  (account / register right column)
   - archive-sidebar  (archive right column)

   All three share the same .panel wrapper markup (see inc/setup.php's
   `before_widget` / `before_title`). This stylesheet shapes the
   built-in widgets (search, recent posts, categories, tag cloud,
   calendar, RSS, text, block widgets) so they fit the masthead
   editorial look without admins having to learn custom CSS.

   Theme variants (dark / negative) inherit via CSS variables.
==================================================================== */


/* ========== CONTAINER ========== */

/* Every widget area wraps each widget in <section class="widget panel">.
   The .panel class is shared with the front-page sidebar boxes, so
   styling here keeps everything visually aligned. */
.widget.panel {
    background: var(--bg-elevated, #fafaf9);
    border: 1px solid var(--line, #e6e6e3);
    border-radius: 4px;
    padding: 20px 22px;
    margin-bottom: 18px;
    font-family: "Inter", "Helvetica Neue", sans-serif;
    color: var(--text-strong, #1a1a1a);
}
.widget.panel:last-child { margin-bottom: 0; }

/* Widget title — small uppercase eyebrow */
.widget.panel h2.widget-title,
.widget.panel h3.widget-title,
.widget.panel h4 {
    font-family: "Inter", "Helvetica Neue", sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-strong, #1a1a1a);
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line, #e6e6e3);
}


/* ========== LIST-BASED WIDGETS (categories, recent posts, etc) ========== */

.widget.panel ul,
.widget.panel ol {
    list-style: none;
    margin: 0;
    padding: 0;
}
.widget.panel li {
    padding: 7px 0;
    border-bottom: 1px solid var(--line-subtle, rgba(0,0,0,0.04));
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-strong, #1a1a1a);
}
.widget.panel li:last-child { border-bottom: none; }
.widget.panel li a {
    color: inherit;
    text-decoration: none;
    transition: color 0.12s;
}
.widget.panel li a:hover {
    color: var(--accent, #c1422f);
}

/* Nested lists (categories tree) */
.widget.panel li ul.children,
.widget.panel li ul.sub-menu {
    margin: 6px 0 0 16px;
    padding-left: 0;
    border-left: 2px solid var(--line, #e6e6e3);
    padding-left: 10px;
}
.widget.panel li ul.children li {
    border-bottom: none;
    padding: 3px 0;
    font-size: 12px;
}

/* Post-count suffix that some widgets add — "(42)" — subdued */
.widget.panel .post-count,
.widget.panel li > span:last-child:not(:only-child) {
    color: var(--text-muted, #888);
    font-size: 11px;
    margin-left: 4px;
}


/* ========== SEARCH WIDGET ========== */

.widget.panel .search-form,
.widget.panel form[role="search"],
.widget.panel form.wp-block-search {
    display: flex;
    gap: 6px;
    margin: 0;
}
.widget.panel input[type="search"],
.widget.panel .wp-block-search__input {
    flex: 1 1 auto;
    min-width: 0;  /* prevents overflow inside flex */
    padding: 8px 10px;
    border: 1px solid var(--line, #e6e6e3);
    border-radius: 3px;
    background: var(--bg, #fff);
    color: var(--text-strong, #1a1a1a);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.3;
}
.widget.panel input[type="search"]:focus,
.widget.panel .wp-block-search__input:focus {
    outline: 2px solid var(--accent, #c1422f);
    outline-offset: 1px;
    border-color: var(--accent, #c1422f);
}
.widget.panel input[type="submit"],
.widget.panel button[type="submit"],
.widget.panel .wp-block-search__button {
    padding: 8px 14px;
    background: var(--text-strong, #1a1a1a);
    color: #fff;
    border: 0;
    border-radius: 3px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: opacity 0.12s;
}
.widget.panel input[type="submit"]:hover,
.widget.panel button[type="submit"]:hover,
.widget.panel .wp-block-search__button:hover {
    opacity: 0.85;
}
/* Hidden search label — accessible but visually compact */
.widget.panel .search-form label {
    display: none;
}
.widget.panel .wp-block-search__label {
    display: none;
}


/* ========== TAG CLOUD ========== */

.widget.panel .tagcloud,
.widget.panel .wp-block-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
}
.widget.panel .tagcloud a,
.widget.panel .wp-block-tag-cloud a {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg, #fff);
    border: 1px solid var(--line, #e6e6e3);
    border-radius: 12px;
    color: var(--text-strong, #1a1a1a);
    text-decoration: none;
    font-family: "Inter", "Helvetica Neue", sans-serif;
    /* Tag cloud rolls font-size into inline styles based on usage count
       — we keep that behaviour but cap the visual range so nothing
       becomes huge. */
    font-size: 11px !important;  /* override the inline style */
    line-height: 1.3;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.widget.panel .tagcloud a:hover,
.widget.panel .wp-block-tag-cloud a:hover {
    background: var(--text-strong, #1a1a1a);
    border-color: var(--text-strong, #1a1a1a);
    color: #fff;
}
.widget.panel .tag-cloud-link {
    /* span used inside link by some WP versions */
    display: inline;
}


/* ========== RECENT POSTS / RECENT COMMENTS ========== */

.widget.panel.widget_recent_entries li,
.widget.panel.widget_recent_comments li {
    padding: 9px 0;
    line-height: 1.4;
}
.widget.panel.widget_recent_entries li a,
.widget.panel.widget_recent_comments li a {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-strong, #1a1a1a);
    text-decoration: none;
}
.widget.panel.widget_recent_entries li a:hover,
.widget.panel.widget_recent_comments li a:hover {
    color: var(--accent, #c1422f);
}
.widget.panel.widget_recent_entries .post-date {
    display: block;
    font-family: "Inter", "Helvetica Neue", sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #888);
    margin-top: 4px;
}
.widget.panel.widget_recent_comments .comment-author-link {
    font-weight: 600;
}


/* ========== CALENDAR ========== */

.widget.panel.widget_calendar table,
.widget.panel .wp-block-calendar table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: "Inter", "Helvetica Neue", sans-serif;
}
.widget.panel.widget_calendar caption,
.widget.panel .wp-block-calendar caption {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #888);
    padding-bottom: 8px;
    text-align: left;
}
.widget.panel.widget_calendar th,
.widget.panel .wp-block-calendar th {
    padding: 6px 0;
    font-weight: 600;
    color: var(--text-muted, #888);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
    border-bottom: 1px solid var(--line, #e6e6e3);
}
.widget.panel.widget_calendar td,
.widget.panel .wp-block-calendar td {
    padding: 5px 0;
    text-align: center;
    color: var(--text-strong, #1a1a1a);
}
.widget.panel.widget_calendar td a,
.widget.panel .wp-block-calendar td a {
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    border-radius: 50%;
    background: var(--text-strong, #1a1a1a);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.widget.panel .wp-calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.widget.panel .wp-calendar-nav a {
    color: var(--text-strong, #1a1a1a);
    text-decoration: none;
    font-weight: 600;
}


/* ========== ARCHIVES (year/month dropdown or list) ========== */

.widget.panel.widget_archive select,
.widget.panel.widget_categories select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line, #e6e6e3);
    border-radius: 3px;
    background: var(--bg, #fff);
    color: var(--text-strong, #1a1a1a);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}


/* ========== RSS WIDGET ========== */

.widget.panel.widget_rss .rsswidget {
    font-family: "Source Serif 4", Georgia, serif;
    font-weight: 600;
}
.widget.panel.widget_rss .rss-date {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted, #888);
    margin-top: 2px;
    letter-spacing: 0.05em;
}
.widget.panel.widget_rss .rssSummary {
    font-size: 12px;
    color: var(--text-muted, #888);
    margin: 4px 0 0;
    line-height: 1.4;
}
.widget.panel.widget_rss cite {
    font-size: 10px;
    color: var(--text-muted, #888);
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}


/* ========== TEXT / HTML / BLOCK WIDGETS ========== */

/* The legacy "Text" widget and Gutenberg block widgets need
   typography defaults so admin-written content reads cleanly. */
.widget.panel .textwidget p,
.widget.panel.widget_block p,
.widget.panel .wp-block-paragraph {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 10px;
    color: var(--text-strong, #1a1a1a);
}
.widget.panel .textwidget p:last-child,
.widget.panel.widget_block p:last-child {
    margin-bottom: 0;
}
.widget.panel .textwidget a,
.widget.panel.widget_block a {
    color: var(--accent, #c1422f);
    text-decoration: underline;
}

/* Gutenberg heading block in widget */
.widget.panel .wp-block-heading {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 10px;
}

/* Buttons (Gutenberg button block) inside widgets */
.widget.panel .wp-block-button__link {
    display: inline-block;
    padding: 8px 16px;
    background: var(--text-strong, #1a1a1a);
    color: #fff;
    border: 0;
    border-radius: 3px;
    font-family: "Inter", "Helvetica Neue", sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    transition: opacity 0.12s;
}
.widget.panel .wp-block-button__link:hover {
    opacity: 0.85;
}

/* Gutenberg image block */
.widget.panel .wp-block-image {
    margin: 0 0 12px;
}
.widget.panel .wp-block-image img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 3px;
}

/* Gutenberg separator */
.widget.panel .wp-block-separator {
    border: 0;
    border-top: 1px solid var(--line, #e6e6e3);
    margin: 12px 0;
}


/* ========== NAVIGATION MENU WIDGET ========== */

.widget.panel.widget_nav_menu ul,
.widget.panel .wp-block-navigation {
    list-style: none;
    margin: 0;
    padding: 0;
}
.widget.panel.widget_nav_menu li {
    padding: 6px 0;
}
.widget.panel.widget_nav_menu li a,
.widget.panel .wp-block-navigation a {
    color: var(--text-strong, #1a1a1a);
    text-decoration: none;
    font-size: 13px;
}
.widget.panel.widget_nav_menu li a:hover,
.widget.panel .wp-block-navigation a:hover {
    color: var(--accent, #c1422f);
}


/* ========== META WIDGET (Log in / RSS feed link / etc) ========== */

.widget.panel.widget_meta li a[href*="wp-login"] {
    /* Hide the wp-admin login link in this widget — Masthead routes
       visitors to /account/ instead. Doesn't break anything to keep
       it visible, but cleaner without. Admins who specifically want
       a wp-admin link can use a custom HTML widget. */
    font-family: "Inter", "Helvetica Neue", sans-serif;
    font-size: 12px;
    color: var(--text-muted, #888);
}


/* ========== DARK / NEGATIVE THEME VARIANTS ========== */

/* Widgets pick up theme variants automatically via the CSS variables.
   Just need to redefine `--bg-elevated` so the panel background isn't
   identical to the page bg (loses the card feel otherwise). */
[data-theme="dark"] .widget.panel,
[data-theme="negative"] .widget.panel {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .widget.panel input[type="search"],
[data-theme="dark"] .widget.panel .wp-block-search__input,
[data-theme="negative"] .widget.panel input[type="search"],
[data-theme="negative"] .widget.panel .wp-block-search__input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-strong);
}
[data-theme="dark"] .widget.panel .tagcloud a,
[data-theme="dark"] .widget.panel .wp-block-tag-cloud a,
[data-theme="negative"] .widget.panel .tagcloud a,
[data-theme="negative"] .widget.panel .wp-block-tag-cloud a {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}


/* ========== MOBILE ADJUSTMENTS ========== */

@media (max-width: 1024px) {
    /* Sidebars stack below main on mobile. Widget padding tightens
       slightly so they don't dominate the viewport. */
    .widget.panel {
        padding: 16px 18px;
        margin-bottom: 14px;
    }
}
