/*
Theme Name: DNSLister
Theme URI: https://dnslister.com/
Author: DNSLister
Author URI: https://dnslister.com/
Description: A lightweight, no-setup WordPress theme matching the DNSLister application header. Built for blog.dnslister.com and forum.dnslister.com.
Version: 1.1.0
Requires at least: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: dnslister
Tags: blog, one-column, two-columns, custom-logo, featured-images, threaded-comments, translation-ready
*/

:root {
    --dns-navy: #101c30;
    --dns-navy-light: #1a2c49;
    --dns-blue: #0d6efd;
    --dns-blue-dark: #0b5ed7;
    --dns-cyan: #3adde6;
    --dns-gold: #ffc107;
    --dns-ink: #212529;
    --dns-muted: #6c757d;
    --dns-border: #dee2e6;
    --dns-surface: #ffffff;
    --dns-canvas: #f8f9fa;
    --dns-radius: 0.5rem;
    --dns-shadow: 0 0.25rem 0.75rem rgba(16, 28, 48, 0.08);
    --dns-content: 1120px;
    --dns-reading: 760px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    color: var(--dns-ink);
    background: var(--dns-canvas);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.55;
    text-rendering: optimizeLegibility;
}

body.admin-bar .dns-navbar {
    top: 32px;
}

a {
    color: var(--dns-blue);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.15em;
}

a:hover {
    color: var(--dns-blue-dark);
}

img {
    max-width: 100%;
    height: auto;
}

button,
input,
textarea,
select {
    font: inherit;
}

.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 {
    z-index: 100000;
    top: 0.5rem;
    left: 0.5rem;
    width: auto;
    height: auto;
    padding: 0.75rem 1rem;
    clip: auto;
    color: var(--dns-ink);
    background: var(--dns-surface);
    border-radius: 0.25rem;
}

/* DNSLister application header */
.dns-navbar {
    position: sticky;
    z-index: 1000;
    top: 0;
    min-height: 64px;
    color: rgba(255, 255, 255, 0.65);
    background: var(--dns-navy);
}

.dns-navbar__inner {
    width: 100%;
    min-height: 64px;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.dns-navbar__brand {
    flex: 0 0 auto;
    padding: 0.3rem 0;
    display: block;
}

.dns-navbar__logo {
    display: block;
    width: auto;
    height: 38px;
}

.dns-navbar__toggle {
    display: none;
    margin-left: auto;
    padding: 0.35rem 0.65rem;
    color: rgba(255, 255, 255, 0.75);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0.375rem;
    cursor: pointer;
}

.dns-navbar__toggle-bars,
.dns-navbar__toggle-bars::before,
.dns-navbar__toggle-bars::after {
    width: 22px;
    height: 2px;
    display: block;
    background: currentColor;
    content: "";
}

.dns-navbar__toggle-bars {
    position: relative;
    margin: 0.35rem 0;
}

.dns-navbar__toggle-bars::before {
    position: absolute;
    top: -6px;
}

.dns-navbar__toggle-bars::after {
    position: absolute;
    top: 6px;
}

.dns-navbar__menu {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.dns-navbar__search {
    position: relative;
    flex: 0 1 220px;
    min-width: 155px;
    margin-right: 0.1rem;
}

.dns-navbar__search input[type="search"] {
    width: 100%;
    height: 31px;
    padding: 0.25rem 0.55rem;
    color: var(--dns-ink);
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.dns-navbar__search input[type="search"]:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.dns-nav,
.dns-nav ul {
    padding: 0;
    margin: 0;
    list-style: none;
}

.dns-nav {
    display: flex;
    align-items: center;
}

.dns-nav--primary {
    flex: 1 1 auto;
}

.dns-nav--account {
    flex: 0 0 auto;
    margin-left: auto;
}

.dns-nav__link,
.dns-nav__summary,
.dns-nav > li > a {
    min-height: 40px;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: rgba(255, 255, 255, 0.58);
    background: transparent;
    border: 0;
    font-size: 1rem;
    line-height: 1.5;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.dns-nav__link:hover,
.dns-nav__link:focus,
.dns-nav > li > a:hover,
.dns-nav > li > a:focus,
.dns-nav__summary:hover,
.dns-nav__summary:focus {
    color: rgba(255, 255, 255, 0.85);
}

.dns-nav__link--premium,
.dns-nav__link--premium:hover,
.dns-nav__link--premium:focus {
    color: var(--dns-gold);
    font-weight: 600;
}

.dns-icon {
    width: 1.05em;
    display: inline-grid;
    place-items: center;
    color: currentColor;
    font-size: 0.95em;
    font-weight: 700;
    line-height: 1;
    opacity: 0.9;
}

.dns-nav__dropdown {
    position: relative;
}

.dns-nav__summary {
    list-style: none;
}

.dns-nav__summary::-webkit-details-marker {
    display: none;
}

.dns-nav__summary::after {
    content: "";
    width: 0;
    height: 0;
    margin-left: 0.1rem;
    border-top: 0.3em solid currentColor;
    border-right: 0.3em solid transparent;
    border-left: 0.3em solid transparent;
}

.dns-nav__dropdown-menu {
    position: absolute;
    z-index: 10;
    top: 100%;
    left: 0;
    min-width: 205px;
    padding: 0.35rem 0 !important;
    color: var(--dns-ink);
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dns-nav__dropdown-menu a {
    padding: 0.45rem 1rem;
    display: block;
    color: var(--dns-ink);
    text-decoration: none;
    white-space: nowrap;
}

.dns-nav__dropdown-menu a:hover,
.dns-nav__dropdown-menu a:focus {
    background: #e9ecef;
}

/* Submenus created with Appearance > Menus. */
.dns-nav .menu-item-has-children {
    position: relative;
}

.dns-nav .menu-item-has-children > a::after {
    content: "";
    width: 0;
    height: 0;
    margin-left: 0.15rem;
    border-top: 0.3em solid currentColor;
    border-right: 0.3em solid transparent;
    border-left: 0.3em solid transparent;
}

.dns-nav .sub-menu {
    position: absolute;
    z-index: 10;
    top: 100%;
    left: 0;
    min-width: 205px;
    padding: 0.35rem 0;
    display: none;
    color: var(--dns-ink);
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dns-nav .menu-item-has-children:hover > .sub-menu,
.dns-nav .menu-item-has-children:focus-within > .sub-menu {
    display: block;
}

.dns-nav .sub-menu a {
    padding: 0.45rem 1rem;
    display: block;
    color: var(--dns-ink);
    text-decoration: none;
    white-space: nowrap;
}

.dns-nav .sub-menu a:hover,
.dns-nav .sub-menu a:focus {
    background: #e9ecef;
}

.dns-nav .current-menu-item > a,
.dns-nav .current_page_item > a {
    color: #fff;
}

/* Local site identity, immediately below the shared app navigation. */
.dns-sitebar {
    background: #fff;
    border-bottom: 1px solid #edf0f2;
}

.dns-sitebar__inner {
    width: min(calc(100% - 2rem), var(--dns-content));
    min-height: 74px;
    margin-inline: auto;
    padding-block: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dns-sitebar__identity {
    min-width: 0;
}

.dns-sitebar__title {
    margin: 0;
    color: var(--dns-ink);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
}

.dns-sitebar__title:hover {
    color: var(--dns-ink);
}

.dns-sitebar__tagline {
    margin: 0.15rem 0 0;
    color: var(--dns-muted);
    font-size: 0.875rem;
}

.dns-sitebar__links {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.dns-sitebar__links a {
    color: var(--dns-muted);
    text-decoration: none;
}

.dns-sitebar__links a:hover,
.dns-sitebar__links a[aria-current="page"] {
    color: var(--dns-blue);
}

/* Content */
.dns-main {
    width: min(calc(100% - 2rem), var(--dns-content));
    margin-inline: auto;
    padding-block: 2.5rem 4rem;
    flex: 1 0 auto;
}

.dns-main--reading {
    max-width: var(--dns-reading);
}

.dns-page-header {
    margin-bottom: 2rem;
}

.dns-page-title,
.dns-entry-title {
    margin: 0;
    color: var(--dns-ink);
    line-height: 1.15;
}

.dns-page-title {
    font-size: clamp(2rem, 5vw, 2.5rem);
}

.dns-page-description {
    max-width: 720px;
    margin: 0.7rem 0 0;
    color: var(--dns-muted);
    font-size: 1.08rem;
}

.dns-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.dns-card {
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--dns-surface);
    border: 1px solid var(--dns-border);
    border-radius: var(--dns-radius);
    box-shadow: var(--dns-shadow);
}

.dns-card__image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    display: block;
    background: #e9ecef;
}

.dns-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 180ms ease;
}

.dns-card__image:hover img {
    transform: scale(1.02);
}

.dns-card__body {
    padding: 1.1rem;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
}

.dns-card__title {
    margin: 0 0 0.55rem;
    font-size: 1.25rem;
    line-height: 1.25;
}

.dns-card__title a {
    color: var(--dns-ink);
    text-decoration: none;
}

.dns-card__title a:hover {
    color: var(--dns-blue);
}

.dns-card__meta,
.dns-entry-meta {
    color: var(--dns-muted);
    font-size: 0.84rem;
}

.dns-card__excerpt {
    margin: 0.8rem 0 1rem;
    color: #495057;
}

.dns-card__more {
    margin-top: auto;
    font-weight: 600;
    text-decoration: none;
}

.dns-entry {
    overflow-wrap: break-word;
}

.dns-entry-header {
    margin-bottom: 2rem;
}

.dns-entry-title {
    font-size: clamp(2rem, 6vw, 3rem);
}

.dns-entry-meta {
    margin-top: 0.75rem;
}

.dns-entry-thumbnail {
    margin: 0 0 2rem;
    overflow: hidden;
    border-radius: var(--dns-radius);
}

.dns-entry-content {
    font-size: 1.05rem;
}

.dns-entry-content > *:first-child {
    margin-top: 0;
}

.dns-entry-content h2,
.dns-entry-content h3,
.dns-entry-content h4 {
    margin-top: 1.8em;
    line-height: 1.25;
}

.dns-entry-content blockquote {
    margin-inline: 0;
    padding: 0.25rem 0 0.25rem 1rem;
    color: #495057;
    border-left: 4px solid var(--dns-blue);
}

.dns-entry-content pre,
.dns-entry-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.dns-entry-content pre {
    max-width: 100%;
    padding: 1rem;
    overflow-x: auto;
    color: #f8f9fa;
    background: var(--dns-navy);
    border-radius: 0.375rem;
}

.dns-entry-content table {
    width: 100%;
    border-collapse: collapse;
}

.dns-entry-content th,
.dns-entry-content td {
    padding: 0.65rem;
    border: 1px solid var(--dns-border);
    text-align: left;
}

.dns-entry-content .alignwide {
    width: min(100vw - 2rem, var(--dns-content));
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}

.dns-entry-content .alignfull {
    width: 100vw;
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}

.dns-button,
input[type="submit"],
.wp-block-button__link {
    padding: 0.55rem 0.9rem;
    display: inline-block;
    color: #fff;
    background: var(--dns-blue);
    border: 1px solid var(--dns-blue);
    border-radius: 0.375rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
}

.dns-button:hover,
input[type="submit"]:hover,
.wp-block-button__link:hover {
    color: #fff;
    background: var(--dns-blue-dark);
    border-color: var(--dns-blue-dark);
}

.dns-empty {
    padding: 2rem;
    background: #fff;
    border: 1px solid var(--dns-border);
    border-radius: var(--dns-radius);
}

.dns-pagination {
    margin-top: 2rem;
}

.dns-pagination .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.dns-pagination .page-numbers {
    min-width: 2.35rem;
    padding: 0.4rem 0.65rem;
    color: var(--dns-ink);
    background: #fff;
    border: 1px solid var(--dns-border);
    border-radius: 0.3rem;
    text-align: center;
    text-decoration: none;
}

.dns-pagination .current,
.dns-pagination a:hover {
    color: #fff;
    background: var(--dns-blue);
    border-color: var(--dns-blue);
}

/* Comments */
.comments-area {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--dns-border);
}

.comment-list {
    padding: 0;
    list-style: none;
}

.comment-list .children {
    list-style: none;
}

.comment-body {
    margin-block: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--dns-border);
    border-radius: var(--dns-radius);
}

.comment-form label {
    display: block;
    font-weight: 600;
}

.comment-form input:not([type="checkbox"]):not([type="submit"]),
.comment-form textarea,
.dns-search-form input[type="search"] {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
}

/* Forum plugin compatibility (bbPress and wpForo keep their own layouts). */
#bbpress-forums,
#wpforo-wrap {
    font-family: inherit;
}

#bbpress-forums {
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--dns-border);
    border-radius: var(--dns-radius);
}

#bbpress-forums .bbp-header,
#bbpress-forums .bbp-footer {
    background: #eef2f6;
}

/* Footer */
.dns-footer {
    margin-top: auto;
    color: rgba(255, 255, 255, 0.67);
    background: var(--dns-navy);
}

.dns-footer__inner {
    width: min(calc(100% - 2rem), var(--dns-content));
    min-height: 94px;
    margin-inline: auto;
    padding-block: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dns-footer p {
    margin: 0;
}

.dns-footer a {
    color: rgba(255, 255, 255, 0.76);
    text-decoration: none;
}

.dns-footer a:hover {
    color: #fff;
}

.dns-footer__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
}

.dns-footer__nav ul {
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    list-style: none;
}

@media (max-width: 1120px) {
    .dns-navbar__toggle {
        display: block;
    }

    .dns-navbar__menu {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        max-height: calc(100vh - 64px);
        max-height: calc(100dvh - 64px);
        padding: 0.75rem;
        overflow-x: hidden;
        overflow-y: auto;
        display: none;
        align-items: stretch;
        flex-direction: column;
        background: var(--dns-navy);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.18);
    }

    .dns-navbar__menu.is-open {
        display: flex;
    }

    .dns-navbar__search {
        width: 100%;
        min-width: 0;
        flex-basis: auto;
    }

    .dns-nav,
    .dns-nav--primary,
    .dns-nav--account {
        width: 100%;
        margin: 0;
        align-items: stretch;
        flex-direction: column;
    }

    .dns-nav__link,
    .dns-nav__summary,
    .dns-nav > li > a {
        width: 100%;
    }

    .dns-nav__dropdown-menu {
        position: static;
        margin-bottom: 0.5rem !important;
        box-shadow: none;
    }

    .dns-nav .sub-menu {
        position: static;
        width: calc(100% - 1rem);
        margin: 0 0 0.5rem 1rem;
        box-shadow: none;
    }

    .dns-nav .menu-item-has-children > .sub-menu {
        display: block;
    }

    .dns-posts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 782px) {
    body.admin-bar .dns-navbar {
        top: 46px;
    }
}

@media (max-width: 640px) {
    .dns-navbar__inner {
        padding-inline: 0.75rem;
    }

    .dns-navbar__logo {
        height: 32px;
    }

    .dns-sitebar__inner,
    .dns-footer__inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .dns-sitebar__links {
        width: 100%;
        padding-top: 0.5rem;
        border-top: 1px solid #edf0f2;
    }

    .dns-main {
        width: min(calc(100% - 1.25rem), var(--dns-content));
        padding-block: 1.75rem 3rem;
    }

    .dns-posts-grid {
        grid-template-columns: 1fr;
    }
}

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