/* CSS Custom Properties for Theming */
:root {
  /* Light theme (default) */
  --color-text: #111111;
  --color-text-secondary: #828282;
  --color-text-muted: #999999;
  --color-background: #fdfdfd;
  --color-background-alt: #f7f7f7;
  --color-background-code: #eeeeff;
  --color-background-dropdown: #dedede;
  --color-border: #e8e8e8;
  --color-border-dark: #e0e0e0;
  --color-link: #2a7ae2;
  --color-link-visited: #1756a9;
  --color-header: #424242;
  --color-header-border: #424242;
  --color-table-text: #3f3f3f;
  --color-table-header-bg: #f0f0f0;
  --color-button-bg: #f3f3f3;
  --color-button-text: black;
  --color-button-border: black;
  --color-button-hover-bg: black;
  --color-button-hover-text: #2ecc71;
  --color-tooltip-bg: hsla(0, 0%, 80%, 0.9);
  
  /* Syntax highlighting - light */
  --hl-comment: #998;
  --hl-error: #a61717;
  --hl-keyword: inherit;
  --hl-type: #458;
  --hl-number: #099;
  --hl-string: #d14;
  --hl-name-attr: #008080;
  --hl-name-builtin: #0086B3;
  --hl-name-class: #458;
  --hl-name-function: #900;
  --hl-name-tag: #000080;
  --hl-name-variable: #008080;
  --hl-operator: inherit;
  --hl-whitespace: #bbb;
  --hl-string-regex: #009926;
  --hl-string-symbol: #990073;
  color-scheme: light;
}

/* Dark theme - applied via system preference OR manual override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Dark theme */
    --color-text: #bbbbbb;
    --color-text-secondary: #999999;
    --color-text-muted: #999999;
    --color-background: #181818;
    --color-background-alt: #222222;
    --color-background-code: #212121;
    --color-background-dropdown: #2b2b2b;
    --color-border: #404040;
    --color-border-dark: #4e4e4e;
    --color-link: #79b8ff;
    --color-link-visited: #79b8ff;
    --color-header: #a6a6a6;
    --color-header-border: #181818;
    --color-table-text: #bbbbbb;
    --color-table-header-bg: #323232;
    --color-button-bg: #212121;
    --color-button-text: #2ecc71;
    --color-button-border: #FAFBFC;
    --color-button-hover-bg: #F3F4F6;
    --color-button-hover-text: #212121;
    --color-tooltip-bg: hsla(0, 0%, 20%, 0.9);
    
    /* Syntax highlighting - dark */
    --hl-comment: #545454;
    --hl-error: #f07178;
    --hl-keyword: #89DDFF;
    --hl-type: #FFCB6B;
    --hl-number: #F78C6C;
    --hl-string: #C3E88D;
    --hl-name-attr: #008080;
    --hl-name-builtin: #EEFFFF;
    --hl-name-class: #FFCB6B;
    --hl-name-function: #82AAFF;
    --hl-name-tag: #FFCB6B;
    --hl-name-variable: #EEFFFF;
    --hl-operator: inherit;
    --hl-whitespace: #EEFFFF;
    --hl-string-regex: #C3E88D;
    --hl-string-symbol: #C3E88D;
    color-scheme: dark;
  }
}

/* Manual dark theme override (when user explicitly selects dark) */
:root[data-theme="dark"] {
  --color-text: #bbbbbb;
  --color-text-secondary: #999999;
  --color-text-muted: #999999;
  --color-background: #181818;
  --color-background-alt: #222222;
  --color-background-code: #212121;
  --color-background-dropdown: #2b2b2b;
  --color-border: #404040;
  --color-border-dark: #4e4e4e;
  --color-link: #79b8ff;
  --color-link-visited: #79b8ff;
  --color-header: #a6a6a6;
  --color-header-border: #181818;
  --color-table-text: #bbbbbb;
  --color-table-header-bg: #323232;
  --color-button-bg: #212121;
  --color-button-text: #2ecc71;
  --color-button-border: #FAFBFC;
  --color-button-hover-bg: #F3F4F6;
  --color-button-hover-text: #212121;
  --color-tooltip-bg: hsla(0, 0%, 20%, 0.9);
  --hl-comment: #545454;
  --hl-error: #f07178;
  --hl-keyword: #89DDFF;
  --hl-type: #FFCB6B;
  --hl-number: #F78C6C;
  --hl-string: #C3E88D;
  --hl-name-attr: #008080;
  --hl-name-builtin: #EEFFFF;
  --hl-name-class: #FFCB6B;
  --hl-name-function: #82AAFF;
  --hl-name-tag: #FFCB6B;
  --hl-name-variable: #EEFFFF;
  --hl-whitespace: #EEFFFF;
  --hl-string-regex: #C3E88D;
  --hl-string-symbol: #C3E88D;
  color-scheme: dark;
}

/* Manual light theme override (when user explicitly selects light) */
:root[data-theme="light"] {
  --color-text: #111111;
  --color-text-secondary: #828282;
  --color-text-muted: #999999;
  --color-background: #fdfdfd;
  --color-background-alt: #f7f7f7;
  --color-background-code: #eeeeff;
  --color-background-dropdown: #dedede;
  --color-border: #e8e8e8;
  --color-border-dark: #e0e0e0;
  --color-link: #2a7ae2;
  --color-link-visited: #1756a9;
  --color-header: #424242;
  --color-header-border: #424242;
  --color-table-text: #3f3f3f;
  --color-table-header-bg: #f0f0f0;
  --color-button-bg: #f3f3f3;
  --color-button-text: black;
  --color-button-border: black;
  --color-button-hover-bg: black;
  --color-button-hover-text: #2ecc71;
  --color-tooltip-bg: hsla(0, 0%, 80%, 0.9);
  --hl-comment: #998;
  --hl-error: #a61717;
  --hl-keyword: inherit;
  --hl-type: #458;
  --hl-number: #099;
  --hl-string: #d14;
  --hl-name-attr: #008080;
  --hl-name-builtin: #0086B3;
  --hl-name-class: #458;
  --hl-name-function: #900;
  --hl-name-tag: #000080;
  --hl-name-variable: #008080;
  --hl-whitespace: #bbb;
  --hl-string-regex: #009926;
  --hl-string-symbol: #990073;
  color-scheme: light;
}

/* Syntax Highlighting */
.highlight .c { color: var(--hl-comment); font-style: italic; }
.highlight .err { color: var(--hl-error); background-color: #e3d2d2; }
.highlight .k { color: var(--hl-keyword); font-weight: bold; }
.highlight .o { font-weight: bold; }
.highlight .cm { color: var(--hl-comment); font-style: italic; }
.highlight .cp { color: var(--hl-comment); font-weight: bold; }
.highlight .c1 { color: var(--hl-comment); font-style: italic; }
.highlight .cs { color: var(--hl-comment); font-weight: bold; font-style: italic; }
.highlight .gd { color: #000; background-color: #fdd; }
.highlight .gd .x { color: #000; background-color: #faa; }
.highlight .ge { font-style: italic; }
.highlight .gr { color: var(--hl-error); }
.highlight .gh { color: #999; }
.highlight .gi { color: #000; background-color: #dfd; }
.highlight .gi .x { color: #000; background-color: #afa; }
.highlight .go { color: #888; }
.highlight .gp { color: #555; }
.highlight .gs { font-weight: bold; }
.highlight .gu { color: #aaa; }
.highlight .gt { color: var(--hl-error); }
.highlight .kc { font-weight: bold; }
.highlight .kd { font-weight: bold; }
.highlight .kp { font-weight: bold; }
.highlight .kr { font-weight: bold; }
.highlight .kt { color: var(--hl-type); font-weight: bold; }
.highlight .m { color: var(--hl-number); }
.highlight .s { color: var(--hl-string); }
.highlight .na { color: var(--hl-name-attr); }
.highlight .nb { color: var(--hl-name-builtin); }
.highlight .nc { color: var(--hl-name-class); font-weight: bold; }
.highlight .no { color: #008080; }
.highlight .ni { color: #800080; }
.highlight .ne { color: #900; font-weight: bold; }
.highlight .nf { color: var(--hl-name-function); font-weight: bold; }
.highlight .nn { color: #555; }
.highlight .nt { color: var(--hl-name-tag); }
.highlight .nv { color: var(--hl-name-variable); }
.highlight .ow { font-weight: bold; }
.highlight .w { color: var(--hl-whitespace); }
.highlight .mf { color: var(--hl-number); }
.highlight .mh { color: var(--hl-number); }
.highlight .mi { color: var(--hl-number); }
.highlight .mo { color: var(--hl-number); }
.highlight .sb { color: var(--hl-string); }
.highlight .sc { color: var(--hl-string); }
.highlight .sd { color: var(--hl-string); }
.highlight .s2 { color: var(--hl-string); }
.highlight .se { color: var(--hl-string); }
.highlight .sh { color: var(--hl-string); }
.highlight .si { color: var(--hl-string); }
.highlight .sx { color: var(--hl-string); }
.highlight .sr { color: var(--hl-string-regex); }
.highlight .s1 { color: var(--hl-string); }
.highlight .ss { color: var(--hl-string-symbol); }
.highlight .bp { color: #999; }
.highlight .vc { color: var(--hl-name-variable); }
.highlight .vg { color: var(--hl-name-variable); }
.highlight .vi { color: var(--hl-name-variable); }
.highlight .il { color: var(--hl-number); }

html { font-size: 16px; }

/** Reset some basic elements */
body, h1, h2, h3, h4, h5, h6, p, blockquote, pre, hr, dl, dd, ol, ul, figure { margin: 0; padding: 0; }

/** Basic styling */
body {
  font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Segoe UI Symbol", "Segoe UI Emoji", "Apple Color Emoji", Roboto, Helvetica, Arial, sans-serif;
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-text-size-adjust: 100%;
  -webkit-font-feature-settings: "kern" 1;
  -moz-font-feature-settings: "kern" 1;
  -o-font-feature-settings: "kern" 1;
  font-feature-settings: "kern" 1;
  font-kerning: normal;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  overflow-wrap: break-word;
}

.background-text { color: var(--color-background) !important; }

/** Set `margin-bottom` to maintain vertical rhythm */
h1, h2, h3, h4, h5, h6, p, blockquote, pre, ul, ol, dl, figure, .highlight { margin-bottom: 15px; }

hr { margin-top: 30px; margin-bottom: 30px; }

/** `main` element */
main { display: block; }

/** Images */
img { max-width: 100%; vertical-align: middle; }

/** Figures */
figure > img { display: block; }

figcaption { font-size: 14px; }

/** Lists */
ul, ol { margin-left: 30px; }

li > ul, li > ol { margin-bottom: 0; }

/** Headings */
h1, h2, h3, h4, h5, h6 { font-weight: 400; }

/** Links */
a { color: var(--color-link); text-decoration: none; }

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

a:hover { color: var(--color-text); text-decoration: underline; }

.social-media-list a:hover, .pagination a:hover { text-decoration: none; }

.social-media-list a:hover .username, .pagination a:hover .username { text-decoration: underline; }

/** Blockquotes */
blockquote {
  color: var(--color-text-secondary);
  border-left: 4px solid var(--color-border);
  padding-left: 15px;
  font-size: 1rem;
  font-style: italic;
}

blockquote > :last-child { margin-bottom: 0; }

blockquote i, blockquote em { font-style: normal; }

/** Code formatting */
pre, code {
  font-family: "Menlo", "Inconsolata", "Consolas", "Roboto Mono", "Ubuntu Mono", "Liberation Mono", "Courier New", monospace;
  font-size: 0.9375em;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background-color: var(--color-background-code);
}

code { padding: 1px 5px; }

pre { padding: 8px 12px; overflow-x: auto; }

pre > code { border: 0; padding-right: 0; padding-left: 0; }

.highlight { border-radius: 3px; background: var(--color-background-code); }

.highlighter-rouge .highlight { background: var(--color-background-code); }

/** Wrapper */
.wrapper { max-width: calc(800px - (30px)); margin-right: auto; margin-left: auto; padding-right: 15px; padding-left: 15px; }

@media screen and (min-width: 800px) { .wrapper { max-width: calc(800px - (30px * 2)); padding-right: 30px; padding-left: 30px; } }

/** Clearfix */
.wrapper:after { content: ""; display: table; clear: both; }

/** Icons */
.orange { color: #f66a0a; }

.grey { color: #828282; }

.svg-icon { width: 16px; height: 16px; display: inline-block; fill: currentColor; padding: 5px 3px 2px 5px; vertical-align: text-bottom; }

/** Tables */
table {
  margin-bottom: 30px;
  width: 100%;
  text-align: left;
  color: var(--color-table-text);
  border-collapse: collapse;
  border: 1px solid var(--color-border);
}

table tr:nth-child(even) { background-color: var(--color-background-alt); }

table th, table td { padding: 10px 15px; }

table th { background-color: var(--color-table-header-bg); border: 1px solid var(--color-border-dark); }

table td { border: 1px solid var(--color-border); }

@media screen and (max-width: 800px) { table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; -ms-overflow-style: -ms-autohiding-scrollbar; } }

/** Site header */
.site-header {
  border-top: 5px solid var(--color-header-border);
  border-bottom: 1px solid var(--color-border);
  min-height: 55.95px;
  line-height: 54px;
  position: relative;
}

.site-title { font-size: 1.625rem; font-weight: 300; letter-spacing: -1px; margin-bottom: 0; float: left; }

@media screen and (max-width: 600px) { .site-title { padding-right: 45px; } }

.site-title, .site-title:visited { color: var(--color-header); }

.site-nav {
  position: absolute;
  top: 9px;
  right: 15px;
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 5px;
  text-align: right;
  z-index: 4;
}

.site-nav .nav-trigger { display: none; }

.site-nav .menu-icon { float: right; width: 36px; height: 26px; line-height: 0; padding-top: 10px; text-align: center; }

.site-nav .menu-icon > svg path { fill: var(--color-text-secondary); }

.site-nav label[for="nav-trigger"] { display: block; float: right; width: 36px; height: 36px; z-index: 2; cursor: pointer; }

.site-nav input ~ .trigger { clear: both; display: none; }

.site-nav input:checked ~ .trigger { display: block; padding-bottom: 5px; }

.site-nav .page-link { color: var(--color-text); line-height: 1.5; display: block; padding: 5px 10px; margin-left: 20px; }

.site-nav .page-link:not(:last-child) { margin-right: 0; }

@media screen and (min-width: 600px) {
  .site-nav {
    position: static;
    float: right;
    border: none;
    background-color: inherit;
  }
  .site-nav label[for="nav-trigger"] { display: none; }
  .site-nav .menu-icon { display: none; }
  .site-nav input ~ .trigger { display: block; }
  .site-nav .page-link { display: inline; padding: 0; margin-left: auto; }
  .site-nav .page-link:not(:last-child) { margin-right: 20px; }
}

/** Site footer */
.site-footer { border-top: 1px solid var(--color-border); padding: 5px 0; }

.footer-heading { font-size: 1.125rem; margin-bottom: 1px; }

.feed-subscribe .svg-icon { padding: 5px 5px 2px 0; }

.contact-list, .social-media-list, .pagination { list-style: none; margin-left: 0; }

.footer-col-wrapper, .social-links { font-size: 0.9375rem; color: var(--color-text-muted); }

.footer-col { margin-bottom: 5px; }

.footer-col-1, .footer-col-2 { width: calc(50% - (30px / 2)); }

.footer-col-3 { width: calc(100% - (30px / 2)); }

@media screen and (min-width: 800px) { .footer-col-1 { width: calc(35% - (30px / 2)); } .footer-col-2 { width: calc(20% - (30px / 2)); } .footer-col-3 { width: calc(45% - (30px / 2)); } }

@media screen and (min-width: 600px) { .footer-col-wrapper { display: flex; } .footer-col { width: calc(100% - (30px / 2)); padding: 0 15px; } .footer-col:first-child { padding-right: 15px; padding-left: 0; } .footer-col:last-child { padding-right: 0; padding-left: 15px; } }

/** Page content */
.page-content { padding: 30px 0; flex: 1 0 auto; }

.page-heading { font-size: 2rem; }

.post-list-heading { font-size: 1.75rem; }

.post-list { margin-left: 0; list-style: none; }

.post-list > li { margin-bottom: 30px; }

.post-meta { font-size: 14px; color: var(--color-text-secondary); }

.post-link { display: block; font-size: 1.5rem; }

/** Posts */
.post-header { margin-bottom: 30px; }

.post-title, .post-content h1 { font-size: 2.625rem; letter-spacing: -1px; line-height: 1.15; }

@media screen and (min-width: 800px) { .post-title, .post-content h1 { font-size: 2.625rem; } }

.post-content { margin-bottom: 30px; }

.post-content h1 { margin-top: 60px; }

.post-content h2, .post-content h3, .post-content h4, .post-content h5, .post-content h6 { margin-top: 30px; }

.post-content h2 { font-size: 1.75rem; }

@media screen and (min-width: 800px) { .post-content h2 { font-size: 2rem; } }

.post-content h3 { font-size: 1.375rem; }

@media screen and (min-width: 800px) { .post-content h3 { font-size: 1.625rem; } }

.post-content h4 { font-size: 1.25rem; }

.post-content h5 { font-size: 1.125rem; }

.post-content h6 { font-size: 1.0625rem; }

.social-media-list, .pagination { display: table; margin: 0 auto; }

.social-media-list li, .pagination li { float: left; margin: 5px 10px 5px 0; }

.social-media-list li:last-of-type, .pagination li:last-of-type { margin-right: 0; }

.social-media-list li a, .pagination li a { display: block; padding: 7.5px; border: 1px solid var(--color-border); }

.social-media-list li a:hover, .pagination li a:hover { border-color: var(--color-header); }

/** Pagination navbar */
.pagination { margin-bottom: 30px; }

.pagination li a, .pagination li div { min-width: 41px; text-align: center; box-sizing: border-box; }

.pagination li div { display: block; padding: 7.5px; border: 1px solid transparent; }

.pagination li div.pager-edge { color: var(--color-border); border: 1px dashed; }

/** Grid helpers */
@media screen and (min-width: 800px) { .one-half { width: calc(50% - (30px / 2)); } }

/** Hamish's custom attributes **/
img {
  display: block;
}

figcaption {
  text-align: center;
}

.svg-icon {
  color: grey;
}

.social-media-list li a:hover > .svg-icon {
  color: #218048;
}

.feed-subscribe a:hover > .svg-icon {
  color: #f26522;
}

/* Button styles */
.button-4 {
  appearance: none;
  background-color: var(--color-button-bg);
  border: 1px solid var(--color-button-border);
  border-radius: 6px;
  box-shadow: rgba(27, 31, 35, 0.04) 0 1px 0, rgba(255, 255, 255, 0.25) 0 1px 0 inset;
  box-sizing: border-box;
  color: var(--color-button-text);
  cursor: pointer;
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  list-style: none;
  position: relative;
  transition: background-color 0.2s cubic-bezier(0.3, 0, 0.5, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  vertical-align: middle;
  white-space: nowrap;
  word-wrap: break-word;
}

.button-4:hover {
  background-color: var(--color-button-hover-bg);
  text-decoration: none;
  color: var(--color-button-hover-text);
  transition-duration: 0.1s;
}

.dropped {
  background-color: var(--color-button-hover-bg);
  text-decoration: none;
  color: var(--color-button-hover-text);
  transition-duration: 0.1s;
}

.button-4:before {
  display: none;
}

.button-4:-webkit-details-marker {
  display: none;
}

.dropDownAbstract {
  background-color: var(--color-background-dropdown);
  padding: 5px;
  border-radius: 6px;
}

/**
 * Tooltip Styles
 */

/* Add this attribute to the element that needs a tooltip */
[data-tooltip] {
  position: relative;
  z-index: 2;
  cursor: pointer;
  color: inherit !important;
  border-bottom: 1px dotted;
}

/* Hide the tooltip content by default */
[data-tooltip]:before,
[data-tooltip]:after {
  visibility: hidden;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);
  opacity: 0;
  pointer-events: none;
  color: inherit !important;
}

/* Position tooltip above the element */
[data-tooltip]:before {
  position: absolute;
  bottom: 150%;
  left: 50%;
  margin-bottom: 5px;
  margin-left: -40px;
  padding: 7px;
  width: max-content;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  border-radius: 3px;
  background-color: var(--color-tooltip-bg);
  color: #fff;
  content: attr(data-tooltip);
  text-align: center;
  font-size: 14px;
  line-height: 1.2;
  color: inherit !important;
}

/* Triangle hack to make tooltip look like a speech bubble */
[data-tooltip]:after {
  position: absolute;
  bottom: 150%;
  left: 50%;
  margin-left: -5px;
  width: 0;
  border-top: 5px solid var(--color-tooltip-bg);
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  content: " ";
  font-size: 0;
  line-height: 0;
  color: inherit !important;
}

/* Show tooltip content on hover */
[data-tooltip]:hover:before,
[data-tooltip]:hover:after {
  visibility: visible;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
  filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
  opacity: 1;
  color: inherit !important;
  text-decoration: none !important;
}

[data-tooltip]:hover {
  text-decoration: none !important;
}

/* Year sections */
.year-content {
  display: none;
  margin-left: 20px;
  color: var(--color-text);
}

.toggle-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2em;
  color: var(--color-text);
}

.toggle-button span {
  display: inline-block;
  transform: rotate(0deg);
  transition: transform 0.3s ease;
}

.toggle-button span.up {
  transform: rotate(180deg);
}

p {
  color: var(--color-text);
}

ul {
  color: var(--color-text);
}

/* no underline on hover for arrow */
a#arrow:hover {
  text-decoration: none;
}

span b:first-of-type {
  display: block;
  font-size: 16px;
}

span *:not(b:first-of-type) {
  font-size: .9em;
}

span {
  font-size: .8em;
}

/* Screen reader only class */
.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;
}
