/* ============================================================
   A TO Z OF CYBER — GHOST THEME
   screen.css  |  No external frameworks or fonts
   ============================================================ */

/* ── 1. CSS Custom Properties ───────────────────────────────── */

:root {
    --color-bg:            #0f172a;
    --color-surface:       #1e293b;
    --color-surface-hover: #334155;
    --color-text:          #ffffff;
    --color-text-muted:    #94a3b8;
    --color-accent:        #f97316;
    --color-border:        #334155;
    --radius:              12px;

    --font-sans:  system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono:  ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;

    --nav-height: 64px;
    --container:  1200px;
    --narrow:     720px;
}

/* ── 2. Reset ────────────────────────────────────────────────── */

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

html, body, h1, h2, h3, h4, h5, h6,
p, ul, ol, li, figure, figcaption,
blockquote, dl, dd {
    margin: 0;
    padding: 0;
}

body {
    font-family:      var(--font-sans);
    background-color: var(--color-bg);
    color:            var(--color-text);
    line-height:      1.6;
    -webkit-font-smoothing: antialiased;
}

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

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    font-family: inherit;
}

ul, ol {
    list-style: none;
}

/* ── 3. Utility ──────────────────────────────────────────────── */

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

.container {
    max-width:  var(--container);
    margin-inline: auto;
    padding-inline: 1.5rem;
}

.container--narrow {
    max-width: var(--narrow);
}

/* ── 4. Skip Link ────────────────────────────────────────────── */

.skip-link {
    position:   absolute;
    top:        -100%;
    left:       1rem;
    z-index:    999;
    padding:    0.5rem 1rem;
    background: var(--color-text);
    color:      var(--color-bg);
    font-weight: 700;
    font-size:  0.875rem;
    border-radius: var(--radius);
    transition: top 0.1s;
}

.skip-link:focus {
    top: 1rem;
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ── 5. Site Header & Navigation ─────────────────────────────── */

.site-header {
    position:   sticky;
    top:        0;
    z-index:    100;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    height:     var(--nav-height);
}

.site-nav {
    height: 100%;
}

.site-nav__inner {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    max-width:       var(--container);
    margin-inline:   auto;
    padding-inline:  1.5rem;
    height:          100%;
}

/* Brand / Logo */
.site-nav__brand {
    display:     flex;
    align-items: center;
    gap:         0.625rem;
    text-decoration: none;
    flex-shrink: 0;
}

.site-nav__logo {
    flex-shrink: 0;
}

.site-nav__name {
    font-size:   1rem;
    font-weight: 800;
    color:       var(--color-text);
    white-space: nowrap;
}

/* Nav links */
.nav-links {
    display:     flex;
    align-items: center;
    gap:         0.25rem;
    list-style:  none;
}

.nav-links__item {
    display:       block;
    padding:       0.375rem 0.75rem;
    font-size:     0.9375rem;
    font-weight:   600;
    color:         var(--color-text-muted);
    border-radius: 6px;
    transition:    color 0.15s, background-color 0.15s;
}

.nav-links__item:hover {
    color:            var(--color-text);
    background-color: rgba(255 255 255 / 0.06);
}

.nav-links__item--active {
    color: var(--color-accent);
    position: relative;
}

.nav-links__item--active::after {
    content:          '';
    position:         absolute;
    bottom:           -2px;
    left:             0.75rem;
    right:            0.75rem;
    height:           2px;
    background-color: var(--color-accent);
    border-radius:    1px;
}

.nav-links__item:focus-visible {
    outline:        2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Hamburger toggle */
.nav-toggle {
    display:     none;
    flex-direction: column;
    justify-content: center;
    gap:         5px;
    padding:     8px;
    background:  none;
    border:      none;
    border-radius: 6px;
    cursor:      pointer;
}

.nav-toggle:focus-visible {
    outline:        2px solid var(--color-accent);
    outline-offset: 2px;
}

.nav-toggle__bar {
    display:    block;
    width:      22px;
    height:     2px;
    background: var(--color-text);
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.is-active .nav-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle.is-active .nav-toggle__bar:nth-child(2) {
    opacity: 0;
}
.nav-toggle.is-active .nav-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── 6. Mobile Navigation ────────────────────────────────────── */

@media (max-width: 767px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        display:          none;
        position:         absolute;
        top:              var(--nav-height);
        left:             0;
        right:            0;
        flex-direction:   column;
        align-items:      stretch;
        background-color: var(--color-surface);
        border-bottom:    1px solid var(--color-border);
        padding:          0.75rem 1.5rem 1rem;
        gap:              0.25rem;
    }

    .nav-links.is-open {
        display: flex;
    }

    .nav-links__item {
        padding:    0.625rem 0.75rem;
        font-size:  1rem;
    }
}

/* ── 7. Hero Section ─────────────────────────────────────────── */

.hero {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 55%, #1a1a3e 100%);
    padding: 6rem 1.5rem 4rem;
    text-align: center;
}

.hero__inner {
    max-width: 680px;
    margin-inline: auto;
}

.hero__badge {
    display:       inline-block;
    padding:       0.25rem 0.875rem;
    margin-bottom: 1rem;
    background:    rgba(59 130 246 / 0.15);
    border:        1px solid rgba(59 130 246 / 0.3);
    color:         #93c5fd;
    font-size:     0.8125rem;
    font-weight:   700;
    border-radius: 9999px;
    letter-spacing: 0.02em;
}

.hero__title {
    font-size:     clamp(2.25rem, 5vw, 3.5rem);
    font-weight:   900;
    line-height:   1.1;
    color:         var(--color-text);
    margin-bottom: 1rem;
}

.hero__title-accent {
    color: var(--color-accent);
}

.hero__sub {
    font-size:  1.125rem;
    color:      var(--color-text-muted);
    max-width:  480px;
    margin-inline: auto;
    line-height: 1.6;
}

/* Tag hero (same base as hero, different colour scheme) */
.tag-hero {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding:    5rem 1.5rem 3.5rem;
    text-align: center;
}

.tag-hero__inner {
    max-width: 680px;
    margin-inline: auto;
}

.tag-hero__badge {
    display:       inline-block;
    padding:       0.25rem 0.875rem;
    margin-bottom: 0.875rem;
    background:    rgba(249 115 22 / 0.15);
    border:        1px solid rgba(249 115 22 / 0.3);
    color:         #fdba74;
    font-size:     0.8125rem;
    font-weight:   700;
    border-radius: 9999px;
}

.tag-hero__title {
    font-size:     clamp(1.75rem, 4vw, 2.75rem);
    font-weight:   900;
    color:         var(--color-text);
    margin-bottom: 0.75rem;
}

.tag-hero__description {
    font-size:  1rem;
    color:      var(--color-text-muted);
    max-width:  520px;
    margin-inline: auto;
}

/* ── 8. Post Grid ────────────────────────────────────────────── */

.post-section {
    padding: 4rem 0 5rem;
}

.post-grid {
    display:               grid;
    grid-template-columns: 1fr;
    gap:                   1.5rem;
    list-style:            none;
}

@media (min-width: 640px) {
    .post-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .post-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.post-grid--related {
    margin-top: 1.5rem;
}

/* ── 9. Post Card ─────────────────────────────────────────────── */

.post-card {
    background:    var(--color-surface);
    border-radius: var(--radius);
    overflow:      hidden;
    transition:    background-color 0.15s;
}

.post-card:hover {
    background-color: var(--color-surface-hover);
}

.post-card__link {
    display:         flex;
    flex-direction:  column;
    height:          100%;
    text-decoration: none;
    color:           inherit;
}

.post-card__link:focus-visible {
    outline:        2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius:  var(--radius);
}

.post-card__image {
    width:        100%;
    aspect-ratio: 16 / 9;
    object-fit:   cover;
    border-radius: var(--radius) var(--radius) 0 0;
}

.post-card__image-placeholder {
    width:         100%;
    aspect-ratio:  16 / 9;
    background:    linear-gradient(135deg, #334155 0%, #7c2d12 100%);
    border-radius: var(--radius) var(--radius) 0 0;
}

.post-card__body {
    display:        flex;
    flex-direction: column;
    flex:           1;
    padding:        1.25rem;
}

.post-card__tag {
    display:       inline-block;
    align-self:    flex-start;
    margin-bottom: 0.625rem;
    padding:       0.2rem 0.625rem;
    background:    rgba(249 115 22 / 0.15);
    color:         var(--color-accent);
    font-size:     0.6875rem;
    font-weight:   700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 9999px;
}

.post-card__title {
    font-size:      1.0625rem;
    font-weight:    700;
    color:          var(--color-text);
    line-height:    1.35;
    margin-bottom:  0.5rem;

    display:            -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow:           hidden;
}

.post-card__excerpt {
    font-size:   0.875rem;
    color:       var(--color-text-muted);
    line-height: 1.6;
    flex:        1;
    margin-bottom: 1rem;

    display:            -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow:           hidden;
}

.post-card__footer {
    display:     flex;
    align-items: center;
    gap:         0.375rem;
    margin-top:  auto;
    font-size:   0.75rem;
    color:       var(--color-text-muted);
}

.post-card__sep {
    opacity: 0.5;
}

/* ── 10. Post Full (Article page) ───────────────────────────── */

.post-full {
    padding-bottom: 5rem;
}

.post-full__header {
    padding: 5rem 1.5rem 2.5rem;
    background: linear-gradient(180deg, #1e293b 0%, var(--color-bg) 100%);
}

.post-full__tag {
    display:       inline-block;
    margin-bottom: 1rem;
    padding:       0.25rem 0.75rem;
    background:    rgba(249 115 22 / 0.15);
    color:         var(--color-accent);
    font-size:     0.75rem;
    font-weight:   700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 9999px;
    text-decoration: none;
    transition:    background-color 0.15s;
}

.post-full__tag:hover {
    background-color: rgba(249 115 22 / 0.25);
}

.post-full__tag:focus-visible {
    outline:        2px solid var(--color-accent);
    outline-offset: 2px;
}

.post-full__title {
    font-size:     clamp(1.75rem, 4vw, 2.75rem);
    font-weight:   900;
    line-height:   1.15;
    color:         var(--color-text);
    margin-bottom: 1rem;
}

.post-full__excerpt {
    font-size:     1.125rem;
    color:         #cbd5e1;
    line-height:   1.6;
    margin-bottom: 1.25rem;
}

.post-full__meta {
    display:     flex;
    align-items: center;
    flex-wrap:   wrap;
    gap:         0.375rem;
    font-size:   0.875rem;
    color:       var(--color-text-muted);
}

.post-full__author {
    font-weight: 600;
    color:       var(--color-text);
}

.post-full__meta-sep {
    opacity: 0.5;
}

.post-full__image-wrap {
    margin-top: 2rem;
}

.post-full__image {
    width:         100%;
    max-height:    480px;
    object-fit:    cover;
    border-radius: var(--radius);
}

.post-full__image-caption {
    margin-top:  0.5rem;
    font-size:   0.8125rem;
    color:       var(--color-text-muted);
    text-align:  center;
    font-style:  italic;
}

/* ── 11. Post Body Prose Styles ─────────────────────────────── */

.post-body {
    padding-top:    3rem;
    padding-bottom: 3rem;
}

.post-body > * + * {
    margin-top: 1.5rem;
}

.post-body h2 {
    font-size:   1.5rem;
    font-weight: 700;
    color:       var(--color-text);
    line-height: 1.25;
    margin-top:  2.5rem;
}

.post-body h3 {
    font-size:   1.25rem;
    font-weight: 700;
    color:       var(--color-text);
    line-height: 1.3;
    margin-top:  2rem;
}

.post-body h4 {
    font-size:   1.0625rem;
    font-weight: 700;
    color:       var(--color-text);
    margin-top:  1.75rem;
}

.post-body p {
    font-size:   1.0625rem;
    color:       #cbd5e1;
    line-height: 1.8;
}

.post-body strong {
    font-weight: 700;
    color:       var(--color-text);
}

.post-body em {
    font-style: italic;
}

.post-body a {
    color:           var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition:      color 0.15s;
}

.post-body a:hover {
    color: #fb923c;
}

.post-body a:focus-visible {
    outline:        2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius:  2px;
}

.post-body ul,
.post-body ol {
    color:        #cbd5e1;
    padding-left: 1.5rem;
    font-size:    1.0625rem;
    line-height:  1.8;
}

.post-body ul {
    list-style: disc;
}

.post-body ol {
    list-style: decimal;
}

.post-body li + li {
    margin-top: 0.5rem;
}

.post-body blockquote {
    border-left:  4px solid var(--color-accent);
    padding-left: 1.25rem;
    font-style:   italic;
    color:        #94a3b8;
    font-size:    1.0625rem;
    line-height:  1.8;
}

.post-body code {
    font-family:      var(--font-mono);
    font-size:        0.875em;
    color:            var(--color-accent);
    background-color: rgba(249 115 22 / 0.1);
    padding:          0.1em 0.4em;
    border-radius:    4px;
}

.post-body pre {
    background-color: var(--color-surface);
    border:           1px solid var(--color-border);
    border-radius:    var(--radius);
    padding:          1.25rem;
    overflow-x:       auto;
    font-size:        0.875rem;
    line-height:      1.6;
}

.post-body pre code {
    background: none;
    padding:    0;
    color:      #e2e8f0;
}

.post-body hr {
    border:        none;
    border-top:    1px solid var(--color-border);
    margin-block:  2.5rem;
}

/* Ghost-generated card wrappers */
.post-body .kg-card {
    margin-block: 2rem;
}

.post-body .kg-image-card img,
.post-body .kg-image {
    width:         100%;
    border-radius: var(--radius);
}

.post-body figcaption {
    text-align:  center;
    font-size:   0.8125rem;
    color:       var(--color-text-muted);
    margin-top:  0.5rem;
    font-style:  italic;
}

/* ── 12. Human Factor Callout ───────────────────────────────── */

.human-factor {
    display:          flex;
    gap:              1rem;
    margin-block:     2.5rem;
    padding:          1.5rem;
    background-color: var(--color-surface);
    border-left:      4px solid var(--color-accent);
    border-radius:    0 var(--radius) var(--radius) 0;
}

.human-factor__icon {
    font-size:   1.5rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top:  0.125rem;
}

.human-factor__content {
    flex: 1;
}

.human-factor__heading {
    font-size:     0.75rem;
    font-weight:   700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color:         var(--color-accent);
    margin-bottom: 0.875rem;
}

.human-factor__list {
    display:    flex;
    flex-direction: column;
    gap:        0.625rem;
}

.human-factor__row {
    display:     flex;
    gap:         0.5rem;
    flex-wrap:   wrap;
    align-items: baseline;
}

.human-factor__label {
    font-size:   0.8125rem;
    font-weight: 700;
    color:       var(--color-text);
    white-space: nowrap;
    flex-shrink: 0;
}

.human-factor__label::after {
    content: ':';
}

.human-factor__value {
    font-size:  0.875rem;
    color:      var(--color-text-muted);
    line-height: 1.5;
}

/* ── 13. Related Posts ───────────────────────────────────────── */

.related-posts {
    border-top: 1px solid var(--color-border);
    padding:    3.5rem 1.5rem 4rem;
    margin-top: 1rem;
}

.related-posts__heading {
    font-size:     1.25rem;
    font-weight:   800;
    color:         var(--color-text);
    margin-bottom: 0;
}

/* ── 14. Pagination ──────────────────────────────────────────── */

.pagination {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             1rem;
    margin-top:      3rem;
    flex-wrap:       wrap;
}

.pagination .newer-posts,
.pagination .older-posts {
    display:       inline-flex;
    align-items:   center;
    padding:       0.5rem 1.25rem;
    background:    var(--color-surface);
    border:        1px solid var(--color-border);
    border-radius: 9999px;
    font-size:     0.9375rem;
    font-weight:   600;
    color:         var(--color-text);
    text-decoration: none;
    transition:    background-color 0.15s, border-color 0.15s;
}

.pagination .newer-posts:hover,
.pagination .older-posts:hover {
    background-color: var(--color-surface-hover);
    border-color:     var(--color-accent);
}

.pagination .newer-posts:focus-visible,
.pagination .older-posts:focus-visible {
    outline:        2px solid var(--color-accent);
    outline-offset: 2px;
}

.pagination .page-number {
    font-size:  0.875rem;
    color:      var(--color-text-muted);
    padding:    0.5rem 0.75rem;
}

/* ── 15. Page Full (static pages) ───────────────────────────── */

.page-full__header {
    padding: 5rem 1.5rem 2.5rem;
    background: linear-gradient(180deg, #1e293b 0%, var(--color-bg) 100%);
}

.page-full__title {
    font-size:   clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 900;
    color:       var(--color-text);
    line-height: 1.15;
}

.page-full__excerpt {
    margin-top:  1rem;
    font-size:   1.125rem;
    color:       #cbd5e1;
    line-height: 1.6;
}

/* ── 16. Site Footer ─────────────────────────────────────────── */

.site-footer {
    background:    var(--color-surface);
    border-top:    1px solid var(--color-border);
    padding-block: 3rem;
}

.site-footer__inner {
    max-width:       var(--container);
    margin-inline:   auto;
    padding-inline:  1.5rem;
    display:         flex;
    align-items:     center;
    flex-wrap:       wrap;
    gap:             1.5rem;
    justify-content: space-between;
}

.site-footer__brand {
    display:    flex;
    flex-direction: column;
    gap:        0.375rem;
}

.site-footer__logo {
    text-decoration: none;
}

.site-footer__logo-text {
    font-size:   1.5rem;
    font-weight: 900;
    color:       var(--color-text);
    letter-spacing: -0.02em;
}

.site-footer__logo-to {
    color: var(--color-accent);
}

.site-footer__tagline {
    font-size: 0.875rem;
    color:     var(--color-text-muted);
}

.site-footer__nav {
    display:  flex;
    gap:      1.5rem;
    flex-wrap: wrap;
}

.site-footer__link {
    font-size:       0.9375rem;
    color:           var(--color-text-muted);
    text-decoration: none;
    transition:      color 0.15s;
}

.site-footer__link:hover {
    color: var(--color-text);
}

.site-footer__link:focus-visible {
    outline:        2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius:  2px;
}

.site-footer__copy {
    font-size:  0.8125rem;
    color:      var(--color-text-muted);
    opacity:    0.7;
}

/* ── 17. Error / 404 Page ────────────────────────────────────── */

.error-page {
    display:         flex;
    align-items:     center;
    justify-content: center;
    min-height:      calc(100dvh - var(--nav-height));
    padding:         3rem 1.5rem;
    text-align:      center;
}

.error-page__inner {
    max-width: 480px;
}

.error-page__code {
    font-size:     5rem;
    font-weight:   900;
    color:         var(--color-border);
    line-height:   1;
    margin-bottom: 0.5rem;
}

.error-page__title {
    font-size:     2rem;
    font-weight:   800;
    color:         var(--color-text);
    margin-bottom: 1rem;
}

.error-page__body {
    font-size:     1rem;
    color:         var(--color-text-muted);
    line-height:   1.6;
    margin-bottom: 2rem;
}

.error-page__cta {
    display:         inline-flex;
    align-items:     center;
    padding:         0.625rem 1.5rem;
    background:      var(--color-accent);
    color:           #fff;
    font-weight:     700;
    font-size:       1rem;
    border-radius:   9999px;
    text-decoration: none;
    transition:      background-color 0.15s;
}

.error-page__cta:hover {
    background-color: #ea6c0a;
}

.error-page__cta:focus-visible {
    outline:        2px solid var(--color-text);
    outline-offset: 2px;
}

/* ── 18. Ghost Card Classes ──────────────────────────────────── */

/* Required by Ghost theme validation */

.kg-image {
    max-width:     100%;
    height:        auto;
    border-radius: var(--radius);
}

.kg-image-card {
    margin: 2rem 0;
}

.kg-image-card figcaption {
    text-align:  center;
    font-size:   0.85rem;
    color:       var(--color-text-muted);
    margin-top:  0.5rem;
}

/* Wide card: bleeds past the narrow content column */
.kg-width-wide {
    margin-left:  calc(50% - 50vw + 2rem);
    margin-right: calc(50% - 50vw + 2rem);
    max-width:    none;
}

/* Full-bleed card: edge to edge */
.kg-width-full {
    margin-left:  calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    max-width:    none;
    width:        100vw;
}

.kg-bookmark-card {
    border:        1px solid var(--color-border);
    border-radius: var(--radius);
    overflow:      hidden;
    margin:        2rem 0;
}

.kg-video-card {
    margin: 2rem 0;
}

/* Post comments section */
.post-comments {
    max-width:     var(--narrow);
    margin-inline: auto;
    padding:       2rem 1.5rem 4rem;
}

/* ── 19. Reduced Motion ──────────────────────────────────────── */

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