/* COLOURS */

/* Light mode*/
:root {
  /* --- LIGHT MODE --- */
  --color-bg: #FDFDFE;
  --color-fg: #1E1E1E;
  
  /* Mozilla-Inspired Indigo */
  --color-accent: #0033CC;          /* 9.6:1 AAA */
  --color-accent-visited: #660099;  /* Classic technical purple */
  --color-accent-hover: #002288;    /* Deeper indigo */
  
  --color-muted: #7A828A;
  --color-surface: rgba(0, 0, 0, 0.06);
  --color-border: rgba(0, 0, 0, 0.12);

  /* Semantic tokens */
  --color-text-primary: var(--color-fg);
  --color-text-muted: #5A5A5A;
  --color-surface-bg: var(--color-surface);
  --color-surface-border: var(--color-border);
  --color-accent-strong: var(--color-accent);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* --- DARK MODE --- */
    --color-bg: #1E1E1E;
    --color-fg: #E0E0E0;

    /* Technical Sky Blue */
    --color-accent: #8EB2FF;          /* 7.8:1 AAA */
    --color-accent-visited: #B1B3FF;  /* Periwinkle */
    --color-accent-hover: #ADC8FF;    /* Brightening for feedback */

    --color-surface: #2A2A2A;
    --color-border: rgba(255, 255, 255, 0.1);

    /* Sync semantic tokens */
    --color-text-primary: var(--color-fg);
    --color-text-muted: #8B949E;
    --color-surface-bg: var(--color-surface);
    --color-surface-border: var(--color-border);
    --color-accent-strong: var(--color-accent);
  }
}

@media (prefers-color-scheme: dark) {
  .icon {
    color: var(--color-text-primary);
    fill: currentColor;
  }
}

/* Layout, Scale and Type */
:root {
  --max-width-ch: 55ch;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --gap: 1.5rem;
  --line-height-tight: 1.2;
  --line-height-body: 1.5;

  --font-family: 'Atkinson Hyperlegible Next', system-ui, sans-serif;
  --fs-min: 1rem;
  --fs-max: 1.25rem;
}

/* Base Icon: Always outlines, no interior fill */
.h-icon {
  width: 1em;
  height: 1em;
  stroke: var(--color-fg);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none; /* Default is empty */
  transition: stroke 0.3s ease;
}

/* Modifier: Use this when you want a "solid" background inside an icon */
.h-icon-fill {
  fill: var(--color-bg);
}

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

/* Font loading (variable font, swap for performance) */
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('fonts/AtkinsonHyperlegibleNextVF-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  font-optical-sizing: auto;
}

/* View transitions */
@view-transition {
  navigation: auto;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface-bg);
}

::-webkit-scrollbar-thumb {
  background-color: var(--color-accent-strong);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
}

/* Base */
html {
  scroll-behavior: smooth;
  scrollbar-color: var(--color-accent-strong) rgba(0, 0, 0, 0.1);
  scrollbar-width: auto;
}

body {
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  font-family: var(--font-family);
  font-size: clamp(var(--fs-min), 1rem + 0.6vw, var(--fs-max));
  line-height: var(--line-height-body);
  font-weight: 400;
  max-width: var(--max-width-ch);
  margin: 0 auto;
  padding: 0.8rem 1.75rem;
  box-sizing: border-box;
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: var(--line-height-tight);
  font-family: var(--font-family);
}

h1 {
  display: flex;
  text-align: center;
  align-items: center;
  gap: 1rem;
}

/* Ensure the SVG scales correctly within the flex row */
h1 svg {
  display: block;
  height: 1.2em;
  width: auto;
}

h2 {
  font-size: 1.6rem;
  display: flex;
  text-align: left;
  align-items: center;
  gap: 1rem;
}

h2 svg {
  display: block;
  height: 1em;
  width: auto;
}

h3 {
  font-size: 1.25rem;
}

a {
  transition: color 0.15s ease, background 0.2s ease;
  color: var(--color-accent-strong);
  width: fit-content;
}

a:visited {
  color: var(--color-accent-visited);
}


/* Header and avatar */
header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0rem;
  margin: 0rem auto;
  max-width: 100%;
  text-align: center;
}

.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.5em;
}

.avatar {
  display: block;
  margin: 0 auto 2.5rem;
  object-fit: cover;
  border-radius: var(--radius-lg);
  max-width: 100%;
}

.avatar-caption {
  font-size: 1em;
  text-align: center;
  margin-bottom: 2em;
}

/* Navigation (consolidated selectors to reduce duplication) */
nav {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0;
}

.nav-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface-bg);
  border: 1px solid var(--color-surface-border);
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  box-sizing: border-box;
}

.site-title {
  font-weight: 800;
  font-size: 2rem;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

/* Unify nav link styles */
.nav-links a,
.nav-secondary a {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--color-accent-strong);
  background: transparent;
  transition: color 0.15s ease, background 0.2s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.nav-links {
  display: flex;
  gap: 6px;
}

.nav-links a[aria-current="page"],
.nav-secondary a[aria-current="page"] {
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

.nav-links a:hover,
.nav-secondary a:hover {
  background-color: var(--color-surface); 
  color: var(--color-accent-strong) !important;
  transform: scale(0.98); 
  box-shadow: inset 0 0 0 1px var(--color-surface-border);
}

/* Secondary nav specifics */
.nav-secondary {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.nav-secondary a {
  font-size: 1rem;
  padding: 4px 10px;
  border-radius: 6px;
}

/* Post list / cards */
.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  display: flex;
  gap: var(--gap);
  margin-bottom: 2.5rem;
  padding: 1.5rem;
  background-color: var(--color-surface-bg);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius-lg);
  transition: background 0.2s ease, transform 0.1s ease;
  align-items: flex-start;
}

.post-list li:hover {
  border-color: rgba(0, 0, 0, 0.15);
}

.post-list time {
  flex-shrink: 0;
  width: 70px;
  color: var(--color-text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.post-content a {
  display: block;
  flex: 1;
  font-weight: 700;
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.post-content p {
  margin-top: 0.5rem;
  color: var(--color-text-primary);
}

/* The Container Card */
.uses-group {
  background-color: var(--color-surface-bg);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius-lg);
  overflow: clip;
  margin-bottom: 2.5rem;
}

.uses-row {
  display: grid;
  /* Stack on mobile, side-by-side on desktop */
  grid-template-columns: 1fr;
  padding: 1.25rem 1.5rem;
  transition: background 0.2s ease;
}

@media (min-width: 640px) {
  .uses-row {
    grid-template-columns: 180px 1fr; /* Fixed width for labels looks cleaner */
    gap: 1.5rem;
  }
}

.uses-row:not(:last-child) {
  border-bottom: 1px solid var(--color-surface-border);
}

.uses-row:hover {
  /* Use a variable for hover to support dark mode better */
  background-color: var(--color-hover-bg, rgba(0, 0, 0, 0.02));
}

.uses-row dt {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

@media (min-width: 640px) {
  .uses-row dt {
    margin-bottom: 0;
    align-self: flex-start;
    padding-top: 0.2rem;
  }
}

.uses-row dd {
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
}

.uses-row dd a {
  font-weight: 600;
  width: fit-content;
  padding-right: 1em;
}

.uses-row dd a:hover {
  text-decoration: underline;
}

.uses-row dd small {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--color-text-muted);
  line-height: 1.4;
}



/* Buttons and rows */
.button-stamp {
  display: block;
  margin: 1.5rem 0;
  border-radius: var(--radius-lg);
  transition: transform 0.1s ease;
  line-height: 0;
}

.button-stamp:hover {
  transform: scale(0.98);
}

.button-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5rem;
}

.button-row a {
  display: inline-block;
  line-height: 0;
  vertical-align: middle;
}

/* Misc */
.stats-text {
  font-size: 1rem;
  font-family: monospace;
  margin-bottom: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.site-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-surface-border);
  text-align: center;
  font-size: 1rem;
}

/* Table of Contents */
.toc {
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-accent-strong);
  padding: 0.8rem;
  border-radius: 12px;
  margin-bottom: 2.5rem;
  max-width: fit-content;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toc a {
  font-size: 1rem;
  font-weight: bold;
  color: var(--color-accent);
  padding: 6px 12px;
  border-radius: 6px;
  display: block;
  transition: background 0.2s;
}

.toc a:hover {
  background: rgba(0, 0, 0, 0.05);
}

.toc-header {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-fg);
  list-style: none;
}

/* Remove the margin for the very first header so it doesn't look gappy */
.toc-header:first-child {
  margin-top: 0.2rem;
}

/* Contact page */
.contact-intro b {
  color: var(--color-accent);
  font-weight: 600;
}

.just_testing {
  font-size: 1.5rem;
  font-weight: bold;
  word-break: break-all; /* Prevents long emails from breaking mobile layouts */
}

/* Public keys */
.public-keys {
  margin-top: 4rem;
  border-top: 1px solid var(--color-surface-border);
  padding-top: 2rem;
}

.gpg-metadata {
  font-size: 1rem;
  border-collapse: collapse;
}

.gpg-metadata td {
  padding: 2px 15px 2px 0;
  vertical-align: top;
}

.gpg-metadata code {
  font-family: monospace;
  font-size: 1rem;
  color: var(--color-text-muted);
}

/* Code blocks */
.code-block {
  font-family: "Source Code Pro", "Fira Code", "JetBrains Mono", monospace;
  font-size: 1rem;
  background: var(--color-surface-bg);
  color: var(--color-text-muted);
  padding: 1.25rem;
  border-radius: 12px;
  overflow-x: auto;
  border: 1px solid var(--color-surface-border);
}

/* Focus and keyboard affordances (applies to all interactive elements) */
:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--color-accent-strong);
  outline-offset: 4px;
  box-shadow: 0 0 0 3px rgba(200, 136, 0, 0.12);
  border-radius: 6px;
}

/* Ensure keyboard users see focus on common controls */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-accent-strong);
  outline-offset: 4px;
}

/* Respect reduced motion preferences (performance & accessibility) */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Dark mode (overrides for elements that need more than variable swaps) */
@media (prefers-color-scheme: dark) {
  html {
    scrollbar-color: var(--color-accent-strong) rgba(255, 255, 255, 0.05);
  }

  ::-webkit-scrollbar-track {
    background: #1e1e1e;
  }

  .nav-links a,
  .nav-secondary a {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-accent-strong);
  }

  .nav-links a[aria-current="page"],
  .nav-secondary a[aria-current="page"] {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff !important;
    box-shadow: none;
  }

  .nav-container,
  .post-list li {
    background-color: var(--color-surface);
    border-color: var(--color-border);
  }

  a:hover {
    color: #ffffff;
  }

  .site-title {
    color: var(--color-accent-strong);
  }

  .post-list li:hover {
    border-color: rgba(255, 255, 255, 0.15);
  }

  .toc {
    background: rgba(255, 255, 255, 0.04);
  }

  .toc a:hover {
    background: rgba(255, 255, 255, 0.05);
  }
}

/* Responsive tweaks */
@media (max-width: 570px) {
  .nav-container {
    flex-direction: column;
    border-radius: 20px;
    padding: 12px;
    gap: 10px;
  }

  .site-title {
    font-size: 1.5rem;
    text-align: center;
  }
}

@media (max-width: 500px) {
  .post-list li {
    flex-direction: column;
    gap: 0.5rem;
  }

  .post-list time {
    width: auto;
  }
}

/* Print */
@media print {
  body {
    background: white !important;
    color: black !important;
    max-width: 100%;
    margin: 0;
    padding: 1cm;
  }

  nav,
  .back-to-top,
  .site-footer,
  hr,
  .avatar-caption {
    display: none !important;
  }

  h1,
  h2,
  h3 {
    color: black !important;
    page-break-after: avoid;
  }

  a {
    color: black !important;
    text-decoration: underline;
  }

  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8rem;
  }

  .code-block {
    background: white !important;
    border: 1px solid #ccc !important;
  }
}


/* License note
 * Dedicated to the public domain under CC0 1.0.
 * Except for images and branding, which are All Rights Reserved.
 * Inspired by the Motherfucking Perfect Website & GNOME Adwaita.
 */
 
/* External link icon */
a[href^="http"]::after {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-left: 0.2em;
  vertical-align: baseline;
  background-color: currentColor;
  mask-image: url("icons/external.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-image: url("icons/external.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
}

.nav-links a::after,
.nav-secondary a::after,
.button-row a::after,
.stats-text a::after {
  display: none;
}
