/*
Theme: APTOFI V3
Date: 2026-10-05
Purpose: compact premium technical UI, responsive from 320px, semantic content-first layout.
*/

:root {
    --ap-bg: #f4f6f8;
    --ap-surface: #ffffff;
    --ap-surface-2: #f8fafc;
    --ap-surface-3: #eef2f6;
    --ap-ink: #101722;
    --ap-ink-2: #334155;
    --ap-muted: #64748b;
    --ap-line: #d9e0e7;
    --ap-line-strong: #c5ced8;
    --ap-dark: #0d1624;
    --ap-dark-2: #152237;
    --ap-accent: #1769e0;
    --ap-accent-2: #0f56c4;
    --ap-accent-soft: #eaf2ff;
    --ap-gold: #ad8b55;
    --ap-success: #18794e;
    --ap-danger: #b42318;
    --ap-radius: 10px;
    --ap-radius-sm: 7px;
    --ap-shadow: 0 8px 28px rgba(15, 23, 42, .07);
    --ap-shadow-hover: 0 14px 34px rgba(15, 23, 42, .11);
    --ap-max: 1240px;
    --ap-sidebar: 286px;
    --ap-transition: 160ms ease;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: #a7b2be;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.aptofi-v3 {
    position: relative;
    z-index: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background: transparent;
    color: var(--ap-ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.62;
    overflow-wrap: anywhere;
}

/*
 * One continuous document-height background.
 * It stretches automatically with the page and never restarts at viewport boundaries.
 */
body.aptofi-v3::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(1100px 430px at 50% 0, rgba(255,255,255,.64) 0%, rgba(255,255,255,.18) 45%, rgba(255,255,255,0) 76%),
        linear-gradient(180deg,
            #e3e9ef 0%,
            #dce3ea 14%,
            #d2dae3 30%,
            #c7d0da 48%,
            #bcc6d1 66%,
            #b1bbc7 83%,
            #a7b2be 100%
        );
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

img,
video,
canvas,
svg {
    max-width: 100%;
}

img {
    height: auto;
}

a {
    color: var(--ap-accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--ap-accent-2);
}

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

button,
a,
input,
textarea,
select {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(23, 105, 224, .24);
    outline-offset: 2px;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
    overflow-wrap: break-word;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--ap-ink);
    letter-spacing: -.018em;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.ap-skip-link {
    position: fixed;
    left: 12px;
    top: -60px;
    z-index: 2000;
    padding: 9px 12px;
    border-radius: var(--ap-radius-sm);
    background: var(--ap-dark);
    color: #fff;
    text-decoration: none;
    transition: top var(--ap-transition);
}

.ap-skip-link:focus {
    top: 12px;
}

.container,
.ap-main,
.wrap {
    width: min(calc(100% - 32px), var(--ap-max));
    margin-inline: auto;
}

/* Header */
.ap-top {
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(13, 22, 36, .97);
    border-bottom: 1px solid rgba(255,255,255,.06);
    box-shadow: 0 6px 18px rgba(8, 15, 27, .10);
    backdrop-filter: saturate(130%) blur(12px);
}

.ap-top::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -14px;
    height: 14px;
    background: linear-gradient(180deg, rgba(13, 22, 36, .08), rgba(13, 22, 36, 0));
    pointer-events: none;
}

.ap-menubar {
    position: relative;
}

.ap-menubar-inner {
    width: min(calc(100% - 32px), var(--ap-max));
    min-height: 62px;
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.ap-left,
.ap-right {
    display: flex;
    align-items: center;
    min-width: 0;
}

.ap-left {
    flex: 1 1 auto;
    gap: 24px;
}

.ap-right {
    flex: 0 0 auto;
    gap: 8px;
}

.ap-brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
    color: #fff;
    text-decoration: none;
}

.ap-brand:hover {
    color: #fff;
}

.ap-brand-logo {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    object-fit: contain;
}

.ap-brand-name {
    min-width: 0;
    display: grid;
    gap: 1px;
}

.ap-brand-title {
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: .11em;
}

.ap-brand-slogan {
    max-width: 230px;
    color: #93a4b8;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ap-primary-nav {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
}

.ap-primary-nav > a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 7px;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--ap-transition), color var(--ap-transition);
}

.ap-primary-nav > a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.search {
    display: flex;
    align-items: center;
    height: 36px;
    min-width: 210px;
    max-width: 300px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
    background: rgba(255,255,255,.06);
    overflow: hidden;
}

.search input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 10px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    font-size: 13px;
}

.search input::placeholder {
    color: #8495aa;
}

.search button {
    width: 38px;
    height: 100%;
    flex: 0 0 38px;
    border: 0;
    border-left: 1px solid rgba(255,255,255,.12);
    background: transparent;
    color: #dce6f2;
    font-size: 19px;
    cursor: pointer;
}

.search button:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.ap-lang-select-wrap {
    display: block;
}

.ap-lang-select {
    height: 36px;
    max-width: 118px;
    padding: 0 30px 0 10px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
    background: #132035;
    color: #dbe5f0;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
}

.ap-burger {
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
    background: transparent;
    color: #dbe5f0;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.ap-burger:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.ap-burger-ico {
    width: 15px;
    display: grid;
    gap: 3px;
}

.ap-burger-ico > span {
    height: 1px;
    border-radius: 2px;
    background: currentColor;
}

.ap-burger-menu {
    position: absolute;
    top: calc(100% + 1px);
    right: max(16px, calc((100vw - var(--ap-max)) / 2));
    width: min(360px, calc(100vw - 32px));
    padding: 8px;
    border: 1px solid #26364d;
    border-radius: 0 0 10px 10px;
    background: #0f1b2d;
    box-shadow: 0 20px 50px rgba(4, 9, 17, .28);
}

.ap-burger-menu[hidden] {
    display: none !important;
}

.ap-burger-menu-inner {
    display: grid;
    gap: 2px;
}

.ap-burger-item {
    display: block;
    padding: 9px 10px;
    border-radius: 6px;
    color: #d8e3ef;
    font-size: 13px;
    text-decoration: none;
}

.ap-burger-item:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
}

/* Main layout */
.ap-main,
.wrap {
    flex: 1 0 auto;
    padding-block: 12px 24px;
}

.section-head,
.ap-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 12px;
}

.ap-page-head {
    align-items: center;
    margin-bottom: 10px;
}

.h-title,
.ap-page-title {
    margin: 0;
    font-size: clamp(22px, 2vw, 30px);
    line-height: 1.18;
    font-weight: 800;
}

.h-sub {
    margin-top: 2px;
    color: var(--ap-muted);
    font-size: 13px;
}

.h-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pill,
.cta,
.read-more,
.btn,
.ap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    gap: 6px;
    padding: 6px 11px;
    border: 1px solid var(--ap-line-strong);
    border-radius: 7px;
    background: var(--ap-surface);
    color: var(--ap-ink-2);
    font-size: 12px;
    font-weight: 720;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: border-color var(--ap-transition), color var(--ap-transition), background var(--ap-transition), transform var(--ap-transition);
}

.pill:hover,
.cta:hover,
.read-more:hover,
.btn:hover,
.ap-btn:hover {
    border-color: #9fb4ca;
    background: #f9fbfd;
    color: var(--ap-ink);
}

.cta.primary,
.btn.primary,
.ap-btn-primary {
    border-color: var(--ap-accent);
    background: var(--ap-accent);
    color: #fff;
}

.cta.primary:hover,
.btn.primary:hover,
.ap-btn-primary:hover {
    border-color: var(--ap-accent-2);
    background: var(--ap-accent-2);
    color: #fff;
}

.ap-btn-ghost {
    background: transparent;
}

/* Home: compact, dense */
.hero {
    display: grid;
    grid-template-columns: minmax(300px, .78fr) minmax(0, 1.62fr);
    gap: 12px;
    align-items: stretch;
}

.fixed-box,
.card,
.custom-block,
.ap-sb-box,
.footer-widget,
.ap-page-card {
    border: 1px solid var(--ap-line);
    border-radius: var(--ap-radius);
    background: var(--ap-surface);
    box-shadow: 0 1px 0 rgba(255,255,255,.65), 0 4px 16px rgba(15,23,42,.035);
}

.fixed-box {
    overflow: hidden;
}

.fixed-box-inner {
    padding: 16px;
}

.fixed-kicker {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
}

.badge,
.chip,
.media-pill,
.ap-entry-type,
.ap-page-date-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 7px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    line-height: 1;
    text-transform: uppercase;
}

.badge,
.media-pill,
.ap-entry-type {
    background: var(--ap-dark);
    color: #fff;
}

.chip,
.ap-page-date-pill {
    border: 1px solid var(--ap-line);
    background: var(--ap-surface-2);
    color: var(--ap-muted);
}

.fixed-title {
    margin: 0;
    font-size: 19px;
    line-height: 1.28;
    font-weight: 800;
}

.fixed-desc {
    margin-top: 8px;
    color: var(--ap-ink-2);
    font-size: 13px;
    line-height: 1.58;
}

.fixed-cta-row {
    display: flex;
    gap: 7px;
    margin-top: 13px;
    flex-wrap: wrap;
}

.ap-featured-media {
    height: 152px;
    margin: 0 0 12px !important;
    border-radius: 7px !important;
    background: #e8edf3;
}

.ap-featured-media > div {
    height: 100%;
    border-radius: 7px !important;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.card {
    position: relative;
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    min-width: 0;
    overflow: hidden;
    transition: border-color var(--ap-transition), box-shadow var(--ap-transition), transform var(--ap-transition);
}

.card:hover {
    border-color: #bdc9d5;
    box-shadow: var(--ap-shadow-hover);
    transform: translateY(-1px);
}

.card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.card .media {
    position: relative;
    min-height: 124px;
    background: #e7edf3;
    overflow: hidden;
}

.card .media img,
.card .ap-card-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(6, 13, 22, .46));
    pointer-events: none;
}

.media-pill {
    position: absolute;
    left: 7px;
    bottom: 7px;
    z-index: 2;
    background: rgba(10, 18, 29, .9);
}

.media-pill .dot {
    width: 5px;
    height: 5px;
    margin-right: 5px;
    border-radius: 50%;
    background: #70a8ff;
}

.card-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 11px 12px;
}

.card-title {
    margin: 0 0 5px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
}

.card-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--ap-muted);
    font-size: 11.5px;
    line-height: 1.48;
}

.card-row {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 9px;
}

.read-more {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 11px;
}

.meta,
.mono {
    color: var(--ap-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 10px;
}

.divider {
    height: 1px;
    margin: 22px 0 0;
    background: var(--ap-line);
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr);
    gap: 12px;
    align-items: start;
}

/* Embedded service */
.ap-service-embed {
    margin-top: 12px;
    overflow: hidden;
}

.ap-service-embed-preview {
    max-height: 230px;
    overflow: auto;
    scrollbar-gutter: stable;
    border: 1px solid var(--ap-line);
    border-radius: 8px;
    background: var(--ap-surface-2);
}

.ap-embed-scale {
    min-width: 0;
}

/* Inner pages */
.ap-breadcrumbs {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--ap-muted);
    font-size: 13px;
    line-height: 1.4;
}

.ap-breadcrumbs a {
    color: #53667a;
    font-weight: 560;
    text-decoration: none;
}

.ap-breadcrumbs a:hover {
    color: var(--ap-accent);
}

.ap-bc-sep {
    color: #9aa8b7;
}

.ap-bc-current {
    max-width: 48vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ap-ink-2);
    font-weight: 650;
}

.ap-page-grid,
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.ap-page-grid {
    grid-template-areas: "main";
}

.ap-page-grid.ap-has-left {
    grid-template-columns: 226px minmax(0, 1fr);
    grid-template-areas: "left main";
}

.ap-page-grid.ap-has-right {
    grid-template-columns: minmax(0, 1fr) var(--ap-sidebar);
    grid-template-areas: "main right";
}

.ap-page-grid.ap-has-both {
    grid-template-columns: 214px minmax(0, 1fr) 260px;
    grid-template-areas: "left main right";
}

.layout:has(.ap-sidebar-right:not(:empty)) {
    grid-template-columns: minmax(0, 1fr) var(--ap-sidebar);
}

.ap-page-center,
.center {
    min-width: 0;
}

.ap-page-center { grid-area: main; }
.ap-sidebar-left { grid-area: left; }
.ap-sidebar-right { grid-area: right; }

.ap-archive-page {
    min-width: 0;
}

.ap-archive-inner {
    min-width: 0;
}

.custom-block,
.ap-page-card {
    overflow: hidden;
}

.custom-inner,
.ap-page-card-inner,
.pad {
    padding: clamp(18px, 2.1vw, 28px);
}

.ap-entry-header {
    margin: 0 0 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ap-line);
}

.ap-entry-type {
    margin-bottom: 8px;
}

.ap-content {
    color: var(--ap-ink-2);
    font-size: 15px;
    line-height: 1.72;
}

.ap-content > :first-child {
    margin-top: 0;
}

.ap-content > :last-child {
    margin-bottom: 0;
}

.ap-content h1,
.ap-content h2,
.ap-content h3,
.ap-content h4 {
    scroll-margin-top: 84px;
}

.ap-content h1 {
    margin: 0 0 18px;
    font-size: clamp(25px, 2.5vw, 34px);
    line-height: 1.18;
    font-weight: 840;
}

.ap-content h2 {
    margin: 30px 0 10px;
    padding-top: 2px;
    font-size: clamp(19px, 1.8vw, 24px);
    line-height: 1.25;
    font-weight: 800;
}

.ap-content h3 {
    margin: 22px 0 8px;
    font-size: 17px;
    line-height: 1.3;
    font-weight: 780;
}

.ap-content h4 {
    margin: 18px 0 7px;
    font-size: 15px;
    font-weight: 780;
}

.ap-content p {
    margin: 0 0 13px;
}

.ap-content ul,
.ap-content ol {
    margin: 10px 0 16px;
    padding-left: 23px;
}

.ap-content li + li {
    margin-top: 4px;
}

.ap-content strong,
.ap-content b {
    color: var(--ap-ink);
}

.ap-content a:not(.btn):not(.ap-btn):not(.cta) {
    font-weight: 650;
}

.ap-content blockquote {
    margin: 18px 0;
    padding: 12px 14px;
    border-left: 3px solid var(--ap-accent);
    background: var(--ap-accent-soft);
    color: #253b56;
}

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

.ap-content code {
    padding: .12em .34em;
    border: 1px solid #d5dee8;
    border-radius: 4px;
    background: #f3f6f9;
    color: #173153;
    font-size: .9em;
}

.ap-content pre {
    max-width: 100%;
    overflow: auto;
    padding: 14px;
    border: 1px solid #28384d;
    border-radius: 8px;
    background: #0f1b2d;
    color: #dfe9f5;
    font-size: 12px;
    line-height: 1.55;
}

.ap-content pre code {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
}

.ap-content table {
    width: 100%;
    margin: 16px 0;
    border-collapse: collapse;
    border-spacing: 0;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ap-content th,
.ap-content td {
    min-width: 110px;
    padding: 9px 10px;
    border: 1px solid var(--ap-line);
    text-align: left;
    vertical-align: top;
}

.ap-content th {
    background: #f2f5f8;
    color: var(--ap-ink);
    font-size: 12px;
}

.ap-content figure {
    max-width: 100%;
    margin: 20px 0;
}

.ap-content figure img,
.ap-content > img,
.ap-content p > img,
.ap-content video {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--ap-line);
    border-radius: 8px;
    background: #e9eef3;
}

.ap-content figcaption {
    margin-top: 6px;
    color: var(--ap-muted);
    font-size: 11px;
    text-align: center;
}

/* Sidebar */
.ap-sidebar {
    min-width: 0;
}

.ap-sidebar-left {
    display: block;
}

.ap-sidebar-stack {
    display: grid;
    gap: 10px;
}

.ap-sb-box {
    padding: 12px;
}

.ap-sb-title,
.footer-title {
    margin-bottom: 8px;
    color: var(--ap-ink);
    font-size: 11px;
    font-weight: 840;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.ap-sb-item,
.ap-sb-item-link {
    display: block;
    min-width: 0;
    padding: 7px 8px;
    border-radius: 6px;
    color: var(--ap-ink-2);
    font-size: 12px;
    line-height: 1.4;
    text-decoration: none;
}

.ap-sb-item-link:hover {
    background: var(--ap-surface-3);
    color: var(--ap-ink);
}

.ap-sb-item-title {
    font-weight: 650;
}

.ap-side-comments {
    display: grid;
    gap: 8px;
}

.ap-side-comment {
    padding-top: 8px;
    border-top: 1px solid var(--ap-line);
}

.ap-side-comment:first-child {
    padding-top: 0;
    border-top: 0;
}

.ap-side-comment-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--ap-muted);
    font-size: 9.5px;
}

.ap-side-comment-author {
    color: var(--ap-ink-2);
    font-weight: 760;
}

.ap-side-comment-link {
    display: block;
    margin-top: 3px;
    color: var(--ap-accent);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.ap-side-comment-text,
.ap-side-html,
.ap-side-empty {
    margin-top: 3px;
    color: var(--ap-muted);
    font-size: 11px;
    line-height: 1.45;
}

/* Archives */
.ap-page-card {
    margin-bottom: 12px;
}

.ap-empty,
.ap-muted {
    color: var(--ap-muted);
}

/* Search page */
.ap-search-page .center > .card {
    display: block;
    min-height: 0;
    overflow: hidden;
}

.ap-search-page .layout {
    grid-template-columns: minmax(0, 1fr) var(--ap-sidebar);
}

.ap-search-head {
    margin-bottom: 14px;
}

.ap-search-title {
    margin: 0;
    font-size: 25px;
    font-weight: 820;
    line-height: 1.2;
}

.ap-search-sub {
    margin-top: 4px;
    color: var(--ap-muted);
    font-size: 12px;
}

.ap-search-page .searchBox {
    display: flex;
    gap: 7px;
    align-items: center;
}

.ap-search-page .searchBox input[type="search"] {
    min-width: 0;
    flex: 1;
    height: 40px;
    padding: 0 11px;
    border: 1px solid var(--ap-line-strong);
    border-radius: 7px;
    background: #fff;
    color: var(--ap-ink);
}

.ap-search-list {
    display: grid;
    gap: 0;
    margin-top: 12px;
    border-top: 1px solid var(--ap-line);
}

.ap-search-item {
    padding: 12px 2px;
    border-bottom: 1px solid var(--ap-line);
}

.ap-search-item .t a {
    color: var(--ap-ink);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.ap-search-item .t a:hover {
    color: var(--ap-accent);
}

.ap-search-item .m {
    margin-top: 2px;
    color: var(--ap-muted);
    font-size: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.ap-search-item .d {
    margin-top: 4px;
    color: var(--ap-ink-2);
    font-size: 12px;
}

/* Comments */
.ap-comments-wrap {
    margin-top: 14px;
    border: 1px solid var(--ap-line);
    border-radius: var(--ap-radius);
    background: var(--ap-surface);
    overflow: hidden;
}

.ap-comments-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--ap-line);
    background: var(--ap-surface-2);
}

.ap-comments-title {
    color: var(--ap-ink);
    font-size: 14px;
    font-weight: 820;
}

.ap-comments-sub {
    margin-top: 2px;
    color: var(--ap-muted);
    font-size: 11px;
}

.ap-comments-list {
    padding: 0 16px;
}

.ap-comments-loading,
.ap-comments-error {
    padding: 14px 0;
    color: var(--ap-muted);
    font-size: 12px;
}

.ap-comment {
    padding: 13px 0;
    border-bottom: 1px solid var(--ap-line);
}

.ap-comment-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.ap-comment-author {
    color: var(--ap-ink);
    font-size: 12px;
    font-weight: 800;
}

.ap-comment-date {
    color: var(--ap-muted);
    font-size: 10px;
}

.ap-comment-body {
    margin-top: 5px;
    color: var(--ap-ink-2);
    font-size: 12px;
}

.ap-comments-form-wrap {
    padding: 14px 16px 16px;
}

.ap-com-form {
    display: grid;
    gap: 9px;
}

.ap-com-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.ap-inp,
.ap-ta {
    width: 100%;
    border: 1px solid var(--ap-line-strong);
    border-radius: 7px;
    background: #fff;
    color: var(--ap-ink);
}

.ap-inp {
    min-height: 39px;
    padding: 0 10px;
}

.ap-ta {
    min-height: 100px;
    padding: 10px;
    resize: vertical;
}

.ap-com-hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.ap-privacy {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--ap-muted);
    font-size: 10.5px;
}

.ap-privacy input {
    margin-top: 3px;
}

.ap-privacy-link {
    color: inherit;
}

.ap-com-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

/* Media player */
.ap-video-player,
.ap-gif-player {
    position: relative;
    width: 100%;
    margin: 16px 0;
    border: 1px solid #27384d;
    border-radius: 9px;
    overflow: hidden;
    background: #07111e;
}

.ap-video-stage {
    position: relative;
    background: #050b13;
}

.ap-video-el,
.ap-video-poster {
    display: block;
    width: 100%;
    height: auto;
}

.ap-video-controls {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 9px;
    background: #0d1828;
    color: #fff;
}

.ap-ctl {
    min-width: 30px;
    height: 30px;
    border: 0;
    border-radius: 6px;
    background: #1b2a3f;
    color: #fff;
    cursor: pointer;
}

.ap-progress,
.ap-seek,
.ap-range {
    min-width: 0;
    flex: 1;
}

/* 404 */
.ap-404-page {
    padding-block: 22px 34px;
}

.ap-404-page .ap-404-layout {
    width: 100%;
    margin: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--ap-sidebar);
    grid-template-areas: "main right";
    gap: 14px;
    align-items: start;
}

.ap-404-page .ap-404-main,
.ap-404-page .ap-404-side {
    min-width: 0;
}

.ap-404-page .ap-404-main {
    grid-area: main;
}

.ap-404-page .ap-404-side {
    grid-area: right;
}

.ap-404-page .aptofi-404-card {
    display: block;
    width: 100%;
    min-height: 0 !important;
    height: auto !important;
    margin: 0;
    overflow: hidden;
}

.ap-404-page .aptofi-404-card .pad {
    padding: clamp(30px, 4vw, 48px);
}

.ap-404-page .aptofi-404-top {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 9px;
}

.ap-404-page .aptofi-404-code {
    color: var(--ap-dark);
    font-size: clamp(40px, 5vw, 54px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.04em;
}

.ap-404-page .aptofi-404-emoji {
    font-size: 26px;
    line-height: 1;
}

.ap-404-page .aptofi-404-title {
    margin: 18px 0 8px;
    font-size: clamp(21px, 2.1vw, 27px);
    line-height: 1.25;
    text-align: center;
}

.ap-404-page .aptofi-404-text {
    margin: 0 auto 22px;
    max-width: 650px;
    color: var(--ap-muted);
    text-align: center;
}

.ap-404-page .aptofi-404-search {
    width: min(100%, 560px);
    min-width: 0;
    height: 42px;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid var(--ap-line-strong);
    border-radius: 8px;
    background: var(--ap-surface);
    box-shadow: none;
}

.ap-404-page .aptofi-404-search input[type="text"] {
    display: block;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0 13px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ap-ink);
    font-size: 13px;
}

.ap-404-page .aptofi-404-search input[type="text"]::placeholder {
    color: var(--ap-muted);
    opacity: 1;
}

.ap-404-page .aptofi-404-search button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: auto;
    min-width: 92px;
    height: 100%;
    margin: 0;
    padding: 0 16px;
    border: 0;
    border-left: 1px solid var(--ap-line);
    border-radius: 0;
    background: var(--ap-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 760;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.ap-404-page .aptofi-404-search button:hover {
    background: var(--ap-accent-2);
    color: #fff;
}

.ap-404-page .aptofi-404-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.ap-404-page .ap-404-side {
    align-self: start;
}

.ap-404-page .ap-404-side .ap-sidebar-stack {
    grid-template-columns: 1fr;
    gap: 10px;
}

.ap-404-page .ap-404-side .ap-sb-box {
    width: 100%;
    margin: 0;
}

@media (max-width: 860px) {
    .ap-404-page {
        padding-block: 18px 28px;
    }

    .ap-404-page .ap-404-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "main"
            "right";
    }

    .ap-404-page .ap-404-side {
        order: 2;
    }
}

@media (max-width: 520px) {
    .ap-404-page .aptofi-404-card .pad {
        padding: 26px 18px;
    }

    .ap-404-page .aptofi-404-search {
        height: 40px;
    }

    .ap-404-page .aptofi-404-search button {
        min-width: 80px;
        padding-inline: 12px;
    }
}

/* Footer */
.site-footer {
    flex: 0 0 auto;
    margin-top: auto;
    border-top: 1px solid #223147;
    background: var(--ap-dark);
    color: #b7c4d3;
}

.site-footer .container {
    padding-block: 24px 28px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.footer-col {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 10px;
}

.footer-widget {
    border-color: #26384f;
    background: #111f31;
    box-shadow: none;
    padding: 12px;
}

.footer-title {
    color: #e7eef7;
}

.footer-text,
.footer-links,
.footer-links a {
    color: #9fb0c3;
    font-size: 11px;
}

.footer-links {
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-links li + li {
    margin-top: 5px;
}

.footer-links a {
    text-decoration: none;
}

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

.ap-to-top {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 500;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid #243750;
    border-radius: 8px;
    background: #101d2e;
    color: #fff;
    box-shadow: 0 8px 26px rgba(2, 8, 18, .22);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity var(--ap-transition), transform var(--ap-transition), background var(--ap-transition);
    cursor: pointer;
}

.ap-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.ap-to-top:hover {
    background: var(--ap-accent);
}

/* Privacy banner compatibility */
.aptofi-privacy,
.cookie-banner,
.privacy-banner {
    max-width: 100vw;
}

/* Generic legacy utility compatibility */
.card.shake,
.tilt {
    transform: none;
}

.bg-noise,
.ap-langbar {
    display: none !important;
}

/* Tablet */
@media (max-width: 1080px) {
    .ap-primary-nav {
        display: none;
    }

    .hero {
        grid-template-columns: minmax(0, .88fr) minmax(0, 1.4fr);
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .card {
        grid-template-columns: 118px minmax(0, 1fr);
    }

    .two-col {
        grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
    }
}

@media (max-width: 860px) {
    .container,
    .ap-main,
    .wrap,
    .ap-menubar-inner {
        width: min(calc(100% - 24px), var(--ap-max));
    }

    .ap-brand-slogan {
        display: none;
    }

    .search {
        min-width: 170px;
        max-width: 220px;
    }

    .hero,
    .two-col,
    .ap-page-grid.ap-has-left,
    .ap-page-grid.ap-has-right,
    .ap-page-grid.ap-has-both,
    .layout:has(.ap-sidebar-right:not(:empty)),
    .ap-search-page .layout,
    .ap-404-page .layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .ap-page-grid.ap-has-left { grid-template-areas: "main" "left"; }
    .ap-page-grid.ap-has-right { grid-template-areas: "main" "right"; }
    .ap-page-grid.ap-has-both { grid-template-areas: "main" "left" "right"; }

    .ap-sidebar-right {
        order: 2;
    }

    .ap-sidebar-stack {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ap-featured-media {
        height: 190px;
    }

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

/* Mobile */
@media (max-width: 640px) {
    :root {
        --ap-radius: 8px;
    }

    body.aptofi-v3 {
        font-size: 14px;
    }

    .ap-menubar-inner {
        min-height: 56px;
        gap: 8px;
    }

    .ap-brand-logo {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .ap-brand-title {
        font-size: 13px;
    }

    .ap-right {
        gap: 5px;
    }

    .search {
        width: 38px;
        min-width: 38px;
        max-width: 38px;
        border: 0;
        background: transparent;
    }

    .search input,
    .search > input[type="hidden"] {
        display: none;
    }

    .search button {
        width: 38px;
        border: 1px solid rgba(255,255,255,.14);
        border-radius: 8px;
        background: transparent;
    }

    .ap-lang-select {
        width: auto;
        min-width: 78px;
        max-width: 96px;
        padding: 0 24px 0 8px;
        color: #dbe5f0;
        font-size: 11px;
        text-shadow: none;
    }

    .ap-burger {
        width: 38px;
        padding: 0 10px;
    }

    .ap-burger-txt {
        display: none;
    }

    .ap-main,
    .wrap {
        padding-block: 10px 20px;
    }

    .section-head,
    .ap-page-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .h-actions {
        justify-content: flex-start;
    }

    .h-title,
    .ap-page-title {
        font-size: 22px;
    }

    .cards-grid {
        gap: 8px;
    }

    .card {
        grid-template-columns: 92px minmax(0, 1fr);
    }

    .card .media {
        min-height: 110px;
    }

    .card-body {
        padding: 9px 10px;
    }

    .card-title {
        font-size: 13px;
    }

    .card-text {
        -webkit-line-clamp: 2;
        font-size: 11px;
    }

    .meta {
        display: none;
    }

    .ap-featured-media {
        height: 150px;
    }

    .ap-service-embed-preview {
        max-height: 320px;
    }

    .fixed-box-inner,
    .custom-inner,
    .ap-page-card-inner,
    .pad {
        padding: 14px;
    }

    .ap-content {
        font-size: 14px;
        line-height: 1.66;
    }

    .ap-content h1 {
        font-size: 24px;
    }

    .ap-content h2 {
        margin-top: 25px;
        font-size: 19px;
    }

    .ap-content h3 {
        font-size: 16px;
    }

    .ap-bc-current {
        max-width: 56vw;
    }

    .ap-sidebar-stack,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .ap-com-row {
        grid-template-columns: 1fr;
    }

    .ap-search-page .searchBox {
        flex-wrap: wrap;
    }

    .ap-search-page .searchBox input[type="search"] {
        flex-basis: calc(100% - 82px);
    }

    .ap-to-top {
        right: 12px;
        bottom: 12px;
    }
}

@media (max-width: 420px) {
    .container,
    .ap-main,
    .wrap,
    .ap-menubar-inner {
        width: min(calc(100% - 16px), var(--ap-max));
    }

    .ap-brand-name {
        display: none;
    }

    .ap-lang-select {
        min-width: 74px;
        max-width: 86px;
        padding-right: 21px;
    }

    .card {
        grid-template-columns: 78px minmax(0, 1fr);
    }

    .card .media {
        min-height: 102px;
    }

    .card-text {
        -webkit-line-clamp: 2;
    }

    .read-more {
        min-height: 26px;
        padding: 3px 7px;
    }

    .fixed-cta-row,
    .h-actions {
        gap: 5px;
    }
}

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

/* Semantic layout helpers kept out of template markup */
.section-head-spaced { margin-top: 22px; }
.ap-featured-media { margin: 14px 0 16px; overflow: hidden; }
.ap-featured-media,
.ap-featured-media-clip { border-radius: 12px; }
.ap-featured-media-clip { overflow: hidden; }
