/* ==========================================================================
   Qoobees — shared stylesheet
   Static blog. Plain CSS. Catppuccin Mocha palette, JetBrains Mono.
   ========================================================================== */

:root {
  /* Colour tokens — Catppuccin Mocha */
  --bg:        #11111b; /* page */
  --mantle:    #181825; /* secondary */
  --surface:   #1e1e2e; /* elevated / post card */
  --border:    #45475a; /* borders / dividers */
  --text:      #cdd6f4; /* body text */
  --muted:     #a6adc8; /* muted text */
  --faint:     #7f849c; /* faint text */
  --accent:    #8b6cef; /* links, hover, small rules */
  --mauve:     #cba6f7; /* link hover */

  /* Type */
  --font-mono: 'JetBrainsMono Nerd Font', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 68ch;

  /* Spacing scale */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs:  0.75rem;
  --space-sm:  1rem;
  --space-md:  1.5rem;
  --space-lg:  2.25rem;
  --space-xl:  3.25rem;
  --space-2xl: 4.5rem;
  --space-3xl: 6rem;

  /* Shape */
  --radius: 14px;
  --radius-sm: 8px;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html {
  color-scheme: dark;
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  /* A single, restrained glow behind the logo keeps the dark page from
     feeling flat without turning it into a backdrop. */
  background-image: radial-gradient(
    70ch 55ch at 50% -8%,
    rgba(139, 108, 239, 0.10),
    transparent 72%
  );
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

::selection { background: rgba(139, 108, 239, 0.35); color: #fff; }

a { color: var(--accent); text-decoration-color: rgba(139, 108, 239, 0.5); }
a:hover { color: var(--mauve); }

/* Consistent, visible keyboard focus everywhere. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--space-sm);
}

main { flex: 1 0 auto; padding-bottom: var(--space-3xl); }

/* --------------------------------------------------------------------------
   Site header — home (logo centred)
   -------------------------------------------------------------------------- */

.site-header--home {
  text-align: center;
  padding-block: clamp(3rem, 11vw, 6rem) var(--space-2xl);
}

.brand {
  display: inline-block;
  text-decoration: none;
  color: inherit;
}

.site-header--home .brand { display: block; }

.brand-logo {
  display: block;
  width: clamp(96px, 22vw, 148px);
  height: auto;
  margin-inline: auto;
  filter: drop-shadow(0 22px 44px rgba(139, 108, 239, 0.20));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.site-header--home .brand:hover .brand-logo {
  transform: translateY(-3px);
  filter: drop-shadow(0 26px 50px rgba(139, 108, 239, 0.30));
}

.site-title {
  margin: var(--space-md) 0 0;
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.site-subtitle {
  margin: var(--space-2xs) 0 0;
  color: var(--faint);
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   Site header — compact (post pages)
   -------------------------------------------------------------------------- */

.site-header--compact {
  padding-block: var(--space-md) var(--space-lg);
}

.site-header--compact .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  line-height: 1;
}

.brand-logo--sm {
  width: 34px;
  margin-inline: 0;
  filter: none;
  transition: transform 0.25s ease;
}

.site-header--compact .brand:hover .brand-logo { transform: translateY(-1px); }

.brand-word {
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Post index
   -------------------------------------------------------------------------- */

.posts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.post-card {
  position: relative;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 4vw, 1.6rem);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover,
.post-card:focus-within {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 18px 36px -22px rgba(139, 108, 239, 0.65);
}

.post-card h2 {
  margin: 0;
  font-size: clamp(1.1rem, 3.4vw, 1.4rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.post-card h2 a {
  color: var(--text);
  text-decoration: none;
}

/* Stretched link: the whole card is a click target, the title is the label. */
.post-card h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.post-card:hover h2 a,
.post-card h2 a:focus-visible { color: var(--accent); }

.post-meta {
  margin: var(--space-2xs) 0 0;
  color: var(--faint);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-excerpt {
  margin: var(--space-xs) 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.post-read {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-top: var(--space-sm);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Single post
   -------------------------------------------------------------------------- */

.post-header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.post-title {
  margin: 0 0 var(--space-2xs);
  font-size: clamp(1.65rem, 6vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.post-body { font-size: 1rem; }

.post-body p { margin: 0 0 1.35em; }
.post-body p:last-child { margin-bottom: 0; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  margin-top: var(--space-xl);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover { color: var(--accent); }
.back-link:hover .back-link__arrow { transform: translateX(-3px); }

.back-link__arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 0.78rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2xs) var(--space-md);
  padding-block: var(--space-md);
}

.site-footer a { color: var(--faint); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   Responsive & motion
   -------------------------------------------------------------------------- */

@media (max-width: 420px) {
  .wrap { padding-inline: var(--space-xs); }
  .site-header--home { padding-block: var(--space-xl) var(--space-xl); }
}

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