/*
 * Copyright (c) 2023 Taḋg Paul
 * SPDX-License-Identifier: Apache-2.0
 * See LICENSE file in the repository root.
 */

/* CSS Custom Properties */
:root {
  /* Issue #80: Primary and secondary accent colors defined in CSS (not Hugo) */
  --color-primary: #b5122f;
  --color-secondary: #12b5a0;

  /* Light mode hover derivatives - mix with BLACK for darker variants */
  --color-primary-hover: color-mix(in srgb, var(--color-primary) 80%, black);
  --color-secondary-hover: color-mix(in srgb, var(--color-secondary) 80%, black);

  /* Light theme colors */
  --color-border: #8a7070;
  --color-callout: #2a7d8a;
  --color-text: #232333;
  --color-text-muted: #6b6b7a;
  --color-text-meta: #999999;
  --color-background: #ffffff;
  --color-background-code: #f1f1f1;
  --color-background-pre: #505348;
  --color-background-toc: #ececec;
  --color-background-draft: #f9f2f4;

  /* Dark theme colors - non-accent colors remain here */
  --color-border-dark: #0066ff;
  --color-text-dark: #ffffff;
  --color-text-muted-dark: #9999bb;
  --color-background-dark: #202124;
  --color-background-code-dark: #3a3a3a;
  --color-background-pre-dark: #505348;
  --color-background-toc-dark: #272822;
  --color-background-draft-dark: #0066ff;
  
  /* Font families — override these to change site fonts */
  --font-body: 'Asap', sans-serif;
  --font-heading: "Special Elite", monospace;
  --font-mono: 'IosevkaCustom', 'Courier New', monospace;
  --font-caption: 'IosevkaQuasiProportional Condensed', sans-serif;
  --font-nav: "Special Elite", monospace;
  --font-accent: 'IosevkaCustom Extended', monospace;
  --font-serif: "IM Fell Extended", serif;
  --font-gaeilge: 'Iosevka Gaeilge', Helvetica, sans-serif;

  /* Heading prefix characters — override to change the decorative marks before headings */
  --prefix-h1: '# ';
  --prefix-h2: '## ';
  --prefix-h3: '### ';
  --prefix-h4: '#### ';
  --prefix-h5: '##### ';
  --prefix-h6: '###### ';
  /* Article body: content headings shift down one level (h2 displays as h1 prefix, etc.) */
  --prefix-article-h2: '# ';
  --prefix-article-h3: '## ';
  --prefix-article-h4: '### ';
  --prefix-article-h5: '#### ';
  --prefix-article-h6: '##### ';

  /* Spacing and sizing */
  --content-max-width: 40rem;
  --content-padding: 1ch;
  --border-radius: 5px;
  --font-size-base: 1rem;
  --line-height-base: 1.6;
  --line-height-content: 1.7;
}

@media screen and (max-width: 47.99rem) {
  p {
    font-stretch: 100%;
  }
  .verse-block {
    padding: 0.75rem 1rem;
  }
}

@media screen and (min-width: 48rem) {
  :root {
    --font-size-base: 1.2rem;
    --content-padding: 2ch;
  }
}

/* Reset and base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color: var(--color-text, #232333);
  font-family: var(--font-body);
  font-weight: 450;

  font-size: var(--font-size-base, 1rem);
  line-height: var(--line-height-base, 1.6);
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 8px;
  background-color: var(--color-background, #ffffff);
  transition: background-color 0.2s ease, color 0.2s ease;
}

* {
  -webkit-tap-highlight-color: transparent;
}

/* Selection styles */
::selection {
  background: var(--color-primary);
  color: #ffffff;
}

::-moz-selection {
  background: var(--color-primary);
  color: #ffffff;
}

/* Typography */
p {
  font-stretch: 115%;
  line-height: var(--line-height-content, 1.7);
  /* Fallback for older browsers */
  margin-top: 1em;
  margin-bottom: 1em;
}

/* Irish language content uses Iosevka Gaeilge (wedge serifs) */
:lang(ga) {
  font-family: var(--font-gaeilge);
}

@supports (margin-block: 1em) {
  p {
    margin-top: unset;
    margin-bottom: unset;
    margin-block: 1em;
  }
}

hr {
  border: 0;
  /* Fallback for older browsers */
  /* Issue #90: Changed from --color-border to --color-secondary */
  border-top: 3px dotted var(--color-secondary, hsl(27, 100%, 35%));
  margin-top: 1em;
  margin-bottom: 1em;
}

@supports (border-block-start: 3px dotted var(--color-secondary)) {
  hr {
    border-top: unset;
    margin-top: unset;
    margin-bottom: unset;
    border-block-start: 3px dotted var(--color-secondary, hsl(27, 100%, 35%));
    margin-block: 1em;
  }
}

blockquote {
  /* Fallback for older browsers */
  border-left: 3px solid var(--color-border, #663399);
  padding-left: 1em;
  color: var(--color-text-muted, #737373);
  margin: 0;
  font-style: italic;
}

@supports (border-inline-start: 3px solid var(--color-border, #663399)) {
  blockquote {
    border-left: unset;
    padding-left: unset;
    border-inline-start: 3px solid var(--color-border, #663399);
    padding-inline-start: 1em;
  }
}

/* Links - Issue #75: wavy orange underline, wobble on hover, NO fill */
a {
  /* Remove border-based underline */
  border-bottom: none;
  border-block-end: none;
  /* Issue #116: purple underline to avoid resemblance to spellcheck squiggles */
  text-decoration: underline;
  text-decoration-style: solid;
  text-decoration-color: #be8acf;
  text-decoration-thickness: 0.2em;
  text-underline-offset: 3px;
  color: inherit;
  transition: color 0.2s ease;
}

/* Wobble animation for link hover */
@keyframes link-wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-1.5deg); }
  75% { transform: rotate(1.5deg); }
}

a:hover,
a:focus {
  /* NO FILL - firm requirement from Issue #75 */
  background-color: transparent;
  color: inherit;
  animation: link-wobble 0.25s ease-in-out;
  outline: none;
}

a:focus-visible {
  /* Accessibility: visible focus for keyboard users */
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Lists */
ul {
  list-style: none;
  /* Fallback for older browsers */
  padding-left: 2ch;
  /* Modern logical properties */
  padding-inline-start: 2ch;
}

ul li {
  text-indent: -2ch;
}

ul > li::before {
  content: '* ';
  font-weight: bold;
  color: var(--color-primary);
}

/* Images */
img {
  border: 3px solid var(--color-background-pre, #ececec);
  /* Fallback for older browsers */
  max-width: 100%;
  height: auto;
  /* Modern logical properties */
  max-inline-size: 100%;
  block-size: auto;
  border-radius: var(--border-radius, 5px);
}

figure {
  display: inline-block;
  margin: 0;
  /* Fallback for older browsers */
  max-width: 100%;
  /* Modern logical properties */
  max-inline-size: 100%;
}

figure img {
  /* Fallback for older browsers */
  max-height: 500px;
  /* Modern logical properties */
  max-block-size: 500px;
}

@media screen and (min-width: 37.5em) {
  figure {
    /* Fallback for older browsers */
    padding-left: 2.5rem;
    padding-right: 2.5rem;
    /* Modern logical properties */
    padding-inline: 2.5rem;
  }
}

figure h4 {
  font-size: 1rem;
  margin: 0;
  /* Fallback for older browsers */
  margin-bottom: 1em;
  /* Modern logical properties */
  margin-block-end: 1em;
}

figure h4::before {
  content: '↳ ';
  color: var(--color-primary);
}

/* Code blocks */
code {
  background-color: var(--color-background-code, #f1f1f1);
  padding: 0.1em 0.2em;
  border-radius: 3px;
  font-size: 0.9em;
}

pre {
  background-color: var(--color-background-pre, #ececec);
  line-height: 1.4;
  overflow-x: auto;
  padding: 1em;
  border-radius: var(--border-radius, 5px);
  border: 1px solid var(--color-border, #663399);
}

.highlight pre ::selection {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
}

pre code {
  background-color: transparent;
  color: inherit;
  font-size: 100%;
  padding: 0;
}

/* Layout containers */
.content {
  /* Fallback for older browsers */
  margin-bottom: 4em;
  margin-left: auto;
  margin-right: auto;
  max-width: var(--content-max-width, 50rem);
  padding-left: var(--content-padding, 1ch);
  padding-right: var(--content-padding, 1ch);
  /* Modern logical properties */
  margin-block-end: 4em;
  margin-inline: auto;
  max-inline-size: var(--content-max-width, 50rem);
  padding-inline: var(--content-padding, 1ch);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Header */
header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  /* Fallback for older browsers */
  margin-top: 1em;
  margin-bottom: 1em;
  /* Modern logical properties */
  margin-block: 1em;
  line-height: 2.5em;
  gap: 1rem;
}

header .main {
  font-size: 1.5rem;
  font-weight: bold;
}

/* Headings — Issue #25: Special Elite for all headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  /* Fallback for older browsers */
  margin-top: 2em;
  margin-bottom: 0.5em;
  /* Modern logical properties */
  margin-block-start: 2em;
  margin-block-end: 0.5em;
  line-height: 1.2;
}

h1 { margin-top: 0; margin-block-start: 0; }
h2 { font-size: clamp(1.3rem, 3.5vw, 1.6rem); }
h3 { font-size: clamp(1.15rem, 3vw, 1.35rem); }
h4 { font-size: clamp(1.05rem, 2.5vw, 1.2rem); }
h5 { font-size: clamp(1.0rem, 2.2vw, 1.1rem); }
h6 { font-size: clamp(0.95rem, 2vw, 1.0rem); }

/* Heading hash marks — bold, primary colour */
h1::before { color: var(--color-primary); content: var(--prefix-h1); font-weight: 700; font-synthesis: weight; }
h2::before { color: var(--color-primary); content: var(--prefix-h2); font-weight: 700; font-synthesis: weight; }
h3::before { color: var(--color-primary); content: var(--prefix-h3); font-weight: 700; font-synthesis: weight; }
h4::before { color: var(--color-primary); content: var(--prefix-h4); font-weight: 700; font-synthesis: weight; }
h5::before { color: var(--color-primary); content: var(--prefix-h5); font-weight: 700; font-synthesis: weight; }
h6::before { color: var(--color-primary); content: var(--prefix-h6); font-weight: 700; font-synthesis: weight; }

/* Article body: no hash on title (h1), shift content headings down one level */
.title h1::before { content: none; }
article .body h2::before { content: var(--prefix-article-h2); }
article .body h3::before { content: var(--prefix-article-h3); }
article .body h4::before { content: var(--prefix-article-h4); }
article .body h5::before { content: var(--prefix-article-h5); }
article .body h6::before { content: var(--prefix-article-h6); }

.meta {
  color: var(--color-text-meta, #999999);
  letter-spacing: -0.5px;
  font-size: 0.9em;
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}

/* Breadcrumb trail — connected ribbon with arrow segments */
.breadcrumb {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  gap: 0;
  font-size: 0.85rem !important;
  line-height: 1.4;
}

/* Chevron spans removed — arrow shape handled by clip-path */

.breadcrumb-seg {
  display: inline-block;
  padding: 0.2em 1.2em 0.2em 1em;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  color: #fff;
  position: relative;
  margin-right: -2px;
  white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 0.5em) 0, 100% 50%, calc(100% - 0.5em) 100%, 0 100%, 0.5em 50%);
}

/* First segment — flat left edge */
.breadcrumb-seg:first-child {
  padding-left: 0.6em;
  clip-path: polygon(0 0, calc(100% - 0.5em) 0, 100% 50%, calc(100% - 0.5em) 100%, 0 100%);
  border-radius: 0.2em 0 0 0.2em;
}

a.breadcrumb-seg:hover {
  filter: brightness(1.3);
}

/* Last segment — keeps the arrow right edge (no flat end) */

/* First + last (single segment) — arrow right, flat left */
.breadcrumb-seg:first-child:last-child {
  clip-path: polygon(0 0, calc(100% - 0.5em) 0, 100% 50%, calc(100% - 0.5em) 100%, 0 100%);
  padding-left: 0.6em;
}

/* Alternating bright/dim pattern for contrast between adjacent segments */
/* Section segments — purple accent, descending opacity */
.breadcrumb-section.breadcrumb-bright { background: color-mix(in srgb, var(--color-border, #9370db) 90%, black); }
.breadcrumb-section.breadcrumb-dim { background: color-mix(in srgb, var(--color-border, #9370db) 80%, black); }
.breadcrumb-section.breadcrumb-dim2 { background: color-mix(in srgb, var(--color-border, #9370db) 70%, black); }
/* Author/date segments — orange accent */
.breadcrumb-meta-bright { background: color-mix(in srgb, var(--color-secondary, hsl(27, 100%, 50%)) 80%, black); }
.breadcrumb-meta-dim { background: color-mix(in srgb, var(--color-secondary, hsl(27, 100%, 50%)) 60%, black); }

/* Ellipsis — not used currently */
.breadcrumb-ellipsis {
  display: none;
}

/* Mobile: horizontal scroll breadcrumb with fade hint */
@media screen and (max-width: 30em) {
  .breadcrumb {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent);
  }
  .breadcrumb::-webkit-scrollbar {
    display: none;
  }
}

/* Post layout */
.post-container {
  /* Flexbox fallback for older browsers */
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
}

@supports (display: grid) {
  .post-container {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media screen and (min-width: 60em) {
  .post-container {
    /* Flexbox fallback */
    flex-wrap: nowrap;
  }
}

.post-content {
  /* Flexbox fallback */
  flex: 1;
  min-width: 0;
  /* Modern properties */
  min-inline-size: 0;
  overflow-wrap: break-word;
  /* Clear floats (e.g. hero image) so tags/footer sit below */
  overflow: auto;
}

.toc {
  background: var(--sidebar-bg, rgba(0, 0, 0, 0.03));
  border-radius: 0.5rem;
  border-left: 2px solid var(--color-border, #663399);
  border-top: none;
  border-right: none;
  border-bottom: none;
  color: var(--color-text, #232333);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  /* Fallback for older browsers */
  max-width: 18.75rem;
  /* Flexbox fallback */
  flex: 0 0 auto;
  /* Modern properties */
  max-inline-size: 18.75rem;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.toc > strong {
  font-family: var(--font-heading);
  font-size: 1rem;
  display: block;
  margin-bottom: 0.75rem;
  color: color-mix(in srgb, var(--color-border, #663399) 70%, black);
}

[data-theme="dark"] .toc > strong {
  color: color-mix(in srgb, var(--color-border, #663399) 65%, white);
}

.toc li {
  margin-bottom: 0.55em;
  margin-block-end: 0.55em;
  line-height: 1.5;
}

.toc li:last-child {
  margin-bottom: 0;
  margin-block-end: 0;
}

.toc ul ul {
  margin-top: 0.55em;
  margin-block-start: 0.55em;
}

.toc a {
  text-decoration: none;
}

.toc ul > li::before {
  content: '\25B6  ';
}

/* Sticky positioning handled by .article-sidebar wrapper on desktop */

@media screen and (max-width: 59.99em) {
  .toc {
    /* Fallback for older browsers */
    margin-bottom: 1.5rem;
    /* Modern logical properties */
    margin-block-end: 1.5rem;
    order: -1;
  }
}

/* Two-column layout: content + TOC sidebar
   Only applies when toc: true — article gets .has-toc class */
@media screen and (min-width: 60em) {
  article.has-toc {
    display: grid;
    grid-template-columns: 1fr 18.75rem;
    gap: 1.5rem;
    align-items: start;
  }

  /* Hide mobile TOC and mobile related on desktop */
  article.has-toc .toc-mobile,
  article.has-toc .related-mobile {
    display: none;
  }

  /* Content column — auto row so banner/signpost can precede it */
  article.has-toc .post-container {
    grid-column: 1;
  }

  /* Sidebar container — single card wrapping TOC + related */
  article.has-toc .article-sidebar {
    grid-column: 2;
    margin-top: 1rem;
    position: sticky;
    top: 1.25rem;
    background: var(--sidebar-bg, rgba(0, 0, 0, 0.03));
    border-radius: 0.5rem;
    border-left: 2px solid var(--color-border, #663399);
    padding: 1rem 1.25rem;
  }

  article.has-toc .article-sidebar .toc {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
  }

  article.has-toc .article-sidebar .related-articles {
    padding: 1.25rem 0 0;
    margin-top: 1.25rem;
    border-top: 1px solid var(--sidebar-border, rgba(0, 0, 0, 0.08));
    background: none;
    border-left: none;
    border-radius: 0;
  }

  /* Other children (e.g. Disqus) span both columns */
  article.has-toc > :not(.post-container):not(.article-sidebar):not(.toc-mobile) {
    grid-column: 1 / -1;
  }
}

@media screen and (max-width: 59.99em) {
  article.has-toc {
    display: flex;
    flex-direction: column;
  }
}

/* Footer */
footer {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Fallback for older browsers */
  border-top: 0.4rem dotted var(--color-primary);
  padding-top: 2rem;
  padding-bottom: 2rem;
  margin-top: 2rem;
  /* Modern logical properties */
  border-block-start: 0.4rem dotted var(--color-primary);
  padding-block: 2rem;
  margin-block-start: 2rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.soc {
  display: flex;
  align-items: center;
  /* Issue #75: No underline on social links */
  border-bottom: none;
  border-block-end: none;
  text-decoration: none;
  transition: color 0.2s ease;
}

.soc:hover,
.soc:focus {
  color: var(--color-primary);
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.border {
  margin-inline: 0.5rem;
  border: 1px solid var(--color-border, #663399);
}

/* Common elements */
.title h1 {
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  /* Fallback for older browsers */
  margin-top: 0;
  margin-bottom: 0;
  /* Modern logical properties */
  margin-block: 0;
}

time {
  color: var(--color-text-muted, #737373);
  font-size: 0.9em;
}

/* Posts */
article .title {
  /* Fallback for older browsers */
  margin-bottom: 1em;
  /* Modern logical properties */
  margin-block-end: 1em;
}


/* Callouts */
.callout {
  background-color: var(--color-callout, #1e90ff);
  color: #ffffff;
  padding: 1em;
  border-radius: var(--border-radius, 5px);
  /* Fallback for older browsers */
  margin-top: 1.5em;
  margin-bottom: 1.5em;
  /* Modern logical properties */
  margin-block: 1.5em;
}

.callout .callout-title a {
  text-decoration: underline;
  text-decoration-skip-ink: auto;
}

.callout .callout-link {
  text-decoration: none;
  color: inherit;
}

.callout .callout-title {
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}


.callout-float-left {
  float: left;
  clear: left;
  max-width: 40%;
  margin: 0.5em 1.5em 1em 0;
}

.callout-float-right {
  float: right;
  clear: right;
  max-width: 40%;
  margin: 0.5em 0 1em 1.5em;
}

.callout p {
  font-family: var(--font-mono);
  margin: 0;
}

.callout a {
  text-decoration: underline;
  text-decoration-skip-ink: auto;
  text-underline-offset: 0.15em;
  border-bottom: none;
  color: inherit;
}

.callout a:hover,
.callout a:focus {
  color: inherit;
  opacity: 0.8;
}

/* Callout variants */
.callout-alert {
  color: #721c24;
  background-color: #f8d7da;
  border: 3px solid #f5c2c7;
}

.callout-tip {
  color: #fff;
  background: linear-gradient(145deg, #048a5e, #0da874);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 0.75rem;
  box-shadow:
    0 6px 20px rgba(4, 138, 94, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.callout-warning {
  color: #664d03;
  background-color: #fff3cd;
  border: 3px solid #ffecb5;
}

.callout-info {
  color: #fff;
  background: linear-gradient(145deg, #1e56cc, #2d6ce0);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 0.75rem;
  box-shadow:
    0 6px 20px rgba(30, 86, 204, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.callout-custom {
  /* Custom styles will be applied inline */
  color: inherit;
}

/* Pull-quote — for {{< quote attribution="..." >}} shortcode */
.pull-quote {
  display: block;
  position: relative;
  margin-block: 2.5rem;
  margin-inline: 0;
  padding-block: 1.5rem 0.5rem;
  padding-inline: 4rem 1rem;
}

.pull-quote::before {
  content: '\201C';
  position: absolute;
  top: -2.5rem;
  left: -0.5rem;
  font-family: var(--font-serif);
  font-size: 20rem;
  line-height: 1;
  color: var(--color-primary);
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}


.pull-quote blockquote {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  border: 0;
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.55;
  /* Inherit from body so light/dark mode both work via the theme cascade.
     Explicit `inherit` is needed to win against dark.css's blockquote{color:muted} rule via specificity. */
  color: inherit;
}

.pull-quote blockquote p {
  margin-block: 0 0.5rem;
}

.pull-quote blockquote p:last-child {
  margin-block-end: 0;
}

.pull-quote figcaption {
  margin-block-start: 0.75rem;
  text-align: end;
  font-size: 0.95rem;
  font-style: normal;
  /* Faded version of the body colour — works in both light and dark mode */
  color: color-mix(in srgb, currentColor 65%, transparent);
}

.pull-quote figcaption::before {
  content: '— ';
}

/* Narrow screens — pull the decorative quote mark in a bit */
@media (max-width: 32rem) {
  .pull-quote {
    padding-inline: 1.2rem 0.5rem;
    max-width: 100%;
    margin-inline: 0;
  }
  .pull-quote::before {
    font-size: 9rem;
    top: -0.5rem;
    left: -0.3rem;
  }
}

/* Site and content elements */
.site-description {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.tags li::before {
  content: "🏷 ";
  margin-inline-start: 2rem;
}

.tags a {
  /* Issue #75: No wavy underline on tag pills, keep border for pill shape */
  text-decoration: none;
  /* Fallback for older browsers */
  border-bottom: 3px solid var(--color-primary);
  /* Modern logical properties */
  border-block-end: 3px solid var(--color-primary);
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.tags a:hover,
.tags a:focus {
  /* Issue #75: NO fill on links */
  color: inherit;
  background-color: transparent;
}

/* Icons and media */
svg {
  /* Fallback for older browsers */
  max-height: 1rem;
  max-width: 1rem;
  /* Modern logical properties */
  max-block-size: 1rem;
  max-inline-size: 1rem;
}

.feather {
  /* Fallback for older browsers */
  width: 1.5rem;
  height: 1.5rem;
  /* Modern logical properties */
  inline-size: 1.5rem;
  block-size: 1.5rem;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display: inline-block;
  vertical-align: middle;
}

/* Draft label */
.draft-label {
  color: var(--color-border, #663399);
  text-decoration: none;
  padding: 0.125rem 0.25rem;
  border-radius: 4px;
  /* Fallback for older browsers */
  margin-left: 0.375rem;
  /* Modern logical properties */
  margin-inline-start: 0.375rem;
  background-color: var(--color-background-draft, #f9f2f4);
  font-size: 0.8em;
  font-weight: bold;
}
/* Code highlighting */
.highlight {
  position: relative;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--border-radius, 5px);
  overflow: hidden;
}

/* Remove default browser margin on pre inside .highlight to prevent
   background colour bleeding beyond the code block border */
.highlight pre {
  margin: 0;
}
/* Code language badges — uses .code-block wrapper from render-codeblock hook */
.code-block {
  position: relative;
}

.code-block[data-lang]::before {
  content: attr(data-lang);
  font-family: var(--font-mono);
  background: #000000;
  border-radius: 0 0 0.25rem 0.25rem;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.025rem;
  padding: 0.1rem 0.5rem;
  position: absolute;
  z-index: 1;
  /* Fallback for older browsers */
  right: 1rem;
  top: 0;
  /* Modern logical properties */
  inset-inline-end: 1rem;
  inset-block-start: 0;
  text-align: right;
  text-transform: uppercase;
}

/* Language-specific badge colours */
.code-block[data-lang="js"]::before,
.code-block[data-lang="javascript"]::before {
  content: "js";
  background: #f7df1e;
  color: #000000;
}

.code-block[data-lang="ts"]::before,
.code-block[data-lang="typescript"]::before {
  content: "ts";
  background: #3178c6;
  color: #ffffff;
}

.code-block[data-lang="py"]::before,
.code-block[data-lang="python"]::before {
  content: "python";
  background: #3776ab;
  color: #ffffff;
}

.code-block[data-lang="go"]::before {
  content: "go";
  background: #00add8;
  color: #ffffff;
}

.code-block[data-lang="css"]::before {
  content: "css";
  background: #1572b6;
  color: #ffffff;
}

.code-block[data-lang="html"]::before {
  content: "html";
  background: #e34f26;
  color: #ffffff;
}

.code-block[data-lang="json"]::before {
  content: "json";
  background: #000000;
  color: #ffffff;
}

.code-block[data-lang="yml"]::before,
.code-block[data-lang="yaml"]::before {
  content: "yaml";
  background: #cc1018;
  color: #ffffff;
}

.code-block[data-lang="shell"]::before,
.code-block[data-lang="bash"]::before,
.code-block[data-lang="sh"]::before {
  content: "shell";
  background: #4eaa25;
  color: #ffffff;
}

.code-block[data-lang="md"]::before,
.code-block[data-lang="markdown"]::before {
  content: "markdown";
  background: #083fa1;
  color: #ffffff;
}

/* Styled details/summary — bordered box with inset label and ellipsis hint */
details.styled-details {
  position: relative;
  border: 1px solid var(--color-border, #663399);
  border-radius: var(--border-radius, 5px);
  /* Fallback for older browsers */
  margin-top: 1.5em;
  margin-bottom: 1.5em;
  /* Modern logical properties */
  margin-block: 1.5em;
}

/* Summary: block-level, pulled up to sit on the top border (legend-style) */
details.styled-details > summary {
  position: relative;
  display: block;
  /* Fallback for older browsers */
  margin-top: -0.7em;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0;
  padding: 0;
  cursor: pointer;
  list-style: none;
  text-decoration: none;
  color: inherit;
}

/* Hide default marker across browsers */
details.styled-details > summary::-webkit-details-marker {
  display: none;
}

/* Summary label text — inset into border with background to cut the line */
details.styled-details > summary > span {
  display: inline-block;
  /* Fallback for older browsers */
  margin-left: 1em;
  /* Modern logical properties */
  margin-inline-start: 1em;
  padding: 0 0.5em;
  background-color: var(--color-background, #ffffff);
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Arrow indicator after label text */
details.styled-details > summary > span::after {
  content: ' \25B6';
  font-size: 1.2em;
  display: inline-block;
  /* Fallback for older browsers */
  margin-left: 0.3em;
  /* Modern logical properties */
  margin-inline-start: 0.3em;
  color: var(--color-secondary);
}

details.styled-details[open] > summary > span::after {
  content: ' \25BC';
}

/* Ellipsis hint when collapsed — left-aligned, normal text size */
details.styled-details:not([open]) > summary::after {
  content: '\2026';
  display: block;
  text-align: left;
  padding: 0.3em 0 0.3em 1.5em;
  font-size: 1.4em;
  color: var(--color-secondary);
}

/* Content area when expanded */
details.styled-details .details-content {
  padding: 0.5em 1.5em 1.5em;
}

/* Hover: summary label changes colour */
details.styled-details > summary:hover > span {
  color: var(--color-secondary);
}

/* Tables */
table {
  border-spacing: 0;
  border-collapse: collapse;
  width: 100%;
  margin-top: 1rem;
  margin-bottom: 1rem;
  inline-size: 100%;
  margin-block: 1rem;
  border-radius: var(--border-radius, 5px);
  overflow: hidden;
  background-color: var(--bg-secondary, #f9f9f9);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

table th {
  padding: 0.75rem;
  border: 1px solid var(--border-color, #ddd);
  font-weight: bold;
  background-color: var(--bg-hover, #f0f0f0);
  text-align: start;
}

table td {
  padding: 0.75rem;
  border: 1px solid var(--border-color, #ddd);
}

/* Navigation and theme toggle */
nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-toggle {
  /* Reset button styles */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none;
  background: none;
  margin: 0;
  font: inherit;
  cursor: pointer;
  
  /* Custom styling */
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-toggle {
  /* Ensure icon is always visible */
  color: var(--color-text, #232333);
}

.nav-toggle:hover,
.nav-toggle:focus {
  background-color: var(--color-primary);
  color: #ffffff;
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.nav-toggle:focus {
  outline-style: solid;
}

.nav-toggle:active {
  transform: scale(0.95);
}

/* Media queries for responsive design */
@media (max-width: 37.4em) {
  .content {
    /* Fallback for older browsers */
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    /* Modern logical properties */
    padding-inline: 0.5rem;
  }
  
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .site-description {
    flex-direction: column;
    align-items: flex-start;
  }
}
