/* Defaults */
:root {
  --font-family: 'Verdana', -apple-system, system-ui, sans-serif;
  --font-family-monospace:
    Consolas, Menlo, Monaco, Andale Mono WT, Andale Mono, Lucida Console, Lucida Sans Typewriter, DejaVu Sans Mono,
    Bitstream Vera Sans Mono, Liberation Mono, Nimbus Mono L, Courier New, Courier, monospace;
}

/* Theme colors */
:root {
  --color-gray-20: #e5e5e5;
  --color-gray-50: #666;
  --color-gray-90: #202020;

  --background-color: #fff;
  --component-background-color: #fff;
  --surface-border-color: #202020;
  --blockquote-background-color: #f7f7f7;
  --code-background-color: #f2f2f2;

  --text-color: #202020;
  --text-color-muted: #555;
  --text-color-link: #a80000;
  --text-color-link-active: #780000;

  --bubble-tag-background-color: #eee;
  --bubble-tag-text-color: var(--text-color);

  --syntax-tab-size: 2;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-gray-20: #3a3a3a;
    --color-gray-50: #a9a9a9;
    --color-gray-90: #f1f1f1;

    --background-color: #171717;
    --component-background-color: #202020;
    --surface-border-color: rgba(255, 255, 255, 0.1);
    --surface-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
    --surface-shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.2);
    --blockquote-background-color: rgba(255, 255, 255, 0.03);
    --code-background-color: rgba(255, 255, 255, 0.04);

    --text-color-link: #ff7070;
    --text-color-link-active: #ffa0a0;
    --text-color: var(--color-gray-90);
    --text-color-muted: #bdbdbd;

    --bubble-tag-background-color: rgba(255, 255, 255, 0.08);
    --bubble-tag-text-color: var(--color-gray-90);
    color-scheme: dark;
  }
}

/* Global stylesheet */
* {
  box-sizing: border-box;
}

html,
body {
  padding: 0;
  margin: 0;
  font-family: var(--font-family);
  color: var(--text-color);
  background-color: var(--background-color);
}
html {
  overflow-y: scroll;
}
body {
  padding-left: 2rem;
  padding-right: 2rem;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.text-centered {
  text-align: center;
}

.lime {
  color: #7adf2d;
  text-shadow: 0 0px 1px rgba(16, 22, 15, 0.35);
}

.venezuela-yellow {
  color: #fce300;
}

.venezuela-blue {
  color: #0033a0;
}

.venezuela-red {
  color: #ef3340;
}

.venezuela-yellow,
.venezuela-blue,
.venezuela-red {
  text-shadow: 0 0 1px var(--text-color);
}

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.skip-link:focus-visible {
  clip: auto;
  clip-path: none;
  height: auto;
  left: 1rem;
  overflow: visible;
  padding: 0.5rem 0.75rem;
  position: fixed;
  top: 1rem;
  white-space: normal;
  width: auto;
  z-index: 1000;
  background-color: var(--component-background-color);
}

p:last-child {
  margin-bottom: 0;
}
p {
  line-height: 1.6;
}

li {
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.2;
  letter-spacing: -0.01em;
}

a[href] {
  color: var(--text-color-link);
  text-decoration: none;
  text-underline-offset: 0.14em;
  text-decoration-thickness: 0.08em;
  transition:
    color 0.15s ease,
    text-decoration-color 0.15s ease,
    opacity 0.15s ease;
}
a[href]:hover,
a[href]:active {
  color: var(--text-color-link-active);
  text-decoration: none;
}
a[href]:focus-visible {
  outline: 2px solid var(--text-color-link);
  outline-offset: 3px;
  border-radius: 0.2em;
}

main {
  max-width: 64rem;
  padding: 2.5rem 0.75rem;
  margin: 0;
}
main :first-child {
  margin-top: 0;
}

main h1,
main h2,
main h3 {
  margin-top: 1.5em;
  margin-bottom: 1em;
}

header {
  border-bottom: 2px solid transparent;
}
header:after {
  content: '';
  display: table;
  clear: both;
}

.links-nextprev {
  list-style: none;
  border-top: 1px solid var(--text-color);
  padding: 1em 0;
}

table {
  margin: 1em 0;
  border-collapse: collapse;
}
table td,
table th {
  padding: 0.65em 1em 0.65em 0;
  border-bottom: 1px solid var(--surface-border-color);
  vertical-align: top;
}
table th {
  text-align: left;
  color: var(--text-color);
  font-weight: 700;
}

blockquote {
  margin: 1.5em 0;
  padding: 1em 1.25em;
  border: 0;
  border-radius: 0.75rem;
  background-color: var(--blockquote-background-color);
  color: var(--text-color);
}

blockquote > :first-child {
  margin-top: 0;
}

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

pre,
code {
  font-family: var(--font-family-monospace);
}
pre:not([class*='language-']) {
  margin: 0.5em 0;
  line-height: 1.375; /* 22px /16 */
  padding: 1em 1.25em;
  border: 1px solid var(--surface-border-color);
  border-radius: 0.85rem;
  background-color: var(--code-background-color);
  overflow-x: auto;
  -moz-tab-size: var(--syntax-tab-size);
  -o-tab-size: var(--syntax-tab-size);
  tab-size: var(--syntax-tab-size);
  -webkit-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
  direction: ltr;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
}
code {
  word-break: break-word;
  overflow-wrap: anywhere;
  padding: 0.08em 0.32em;
  border-radius: 0.35rem;
  background-color: var(--code-background-color);
}
pre code {
  padding: 0;
  border-radius: 0;
  background-color: transparent;
}
pre[class*='language-'],
code[class*='language-'] {
  font-size: 0.9375em; /* 15px /16 */
}

/* Header */
header {
  position: relative;
  --separator-height: 10px;
  display: flex;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.6rem 0.75rem 1rem;
}
.page-shell {
  width: calc(100vw - 26rem);
  max-width: 64rem;
  margin: 0 auto;
}
.site-identity {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 15rem;
}
.home-link {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
}
.home-link:link:not(:hover) {
  text-decoration: none;
}

/* Nav */
header nav {
  flex: 1 1 auto;
  padding-top: 0.2rem;
}

.nav {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.25rem 0.8rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.nav-item {
  display: inline-block;
  font-size: 1rem;
}
.nav-item a[href]:not(:hover) {
  text-decoration: none;
}
.nav a[href][aria-current='page'] {
  color: var(--text-color);
  font-weight: 700;
  text-decoration: none;
}

/* Posts list */
.postlist {
  list-style: none;
  padding: 0;
  padding-left: 1.5rem;
}
.postlist-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  counter-increment: start-from -1;
  margin-bottom: 1.2em;
}
.postlist-item:before {
  display: inline-block;
  pointer-events: none;
  content: '' counter(start-from, decimal-leading-zero) '. ';
  line-height: 100%;
  text-align: right;
  margin-left: -1.5rem;
}
.postlist-date,
.postlist-item:before,
.postlist-tags,
.postlist-time {
  font-size: 0.8125em; /* 13px /16 */
  color: var(--text-color-muted);
}
.postlist-date,
.postlist-tags,
.postlist-time {
  word-spacing: -0.5px;
}
.postlist-date,
.post-metadata-date {
  text-transform: capitalize;
}
.postlist-description {
  font-size: 0.9375em; /* 15px /16 */
  margin-top: 0.5em;
  display: block;
  width: 100%;
}
.postlist-link {
  font-size: 1.1875em; /* 19px /16 */
  font-weight: 700;
  flex-basis: calc(100% - 1.5rem);
  padding-left: 0.25em;
  padding-right: 0.5em;
  text-underline-position: from-font;
  text-underline-offset: 0;
  text-decoration-thickness: 1px;
}
.postlist-item-active .postlist-link {
  font-weight: bold;
}
.postlist-tags,
.postlist-time {
  padding-left: 1em;
}

/* Tags */
.post-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-style: italic;
}
.postlist-item > .post-tag {
  align-self: center;
}

/* Tags list */
.post-metadata {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5em;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9em; /* 14px /16 */
}

.post-metadata-date::before,
.postlist-item time::before {
  content: '📅';
  margin-right: 0.4em;
}
.post-metadata li.post-metadata-tag:nth-of-type(2)::before,
.postlist-tags::before {
  content: '🏷️';
  margin-right: 0.4em;
}
.post-metadata-time::before,
.postlist-time::before {
  content: '⏰';
  margin-right: 0.4em;
}

/* Direct Links / Markdown Headers */
.header-anchor {
  text-decoration: none;
  font-style: normal;
  font-size: 1em;
  margin-left: 0.1em;
}
a[href].header-anchor,
a[href].header-anchor:visited {
  color: transparent;
}
a[href].header-anchor:focus,
a[href].header-anchor:hover {
  text-decoration: underline;
}
a[href].header-anchor:focus,
:hover > a[href].header-anchor {
  color: var(--text-color-muted);
}

h2 + .header-anchor {
  font-size: 1.5em;
}

/* Footer */
footer {
  position: relative;
  --separator-height: 10px;
  max-width: 64rem;
  padding: 1rem 0.75rem 2rem;
  border-top: 2px solid transparent;
}

header:not(.bsky-reply-header)::before,
footer::before,
hr:not(.asterisk-divider) {
  height: var(--separator-height, 10px);
  background: linear-gradient(90deg, var(--text-color), var(--text-color-link), var(--text-color));
  background-size: 200% 100%;
  clip-path: polygon(
    0 50%,
    6.25% 29%,
    12.5% 20%,
    18.75% 29%,
    25% 50%,
    31.25% 71%,
    37.5% 80%,
    43.75% 71%,
    50% 50%,
    56.25% 29%,
    62.5% 20%,
    68.75% 29%,
    75% 50%,
    81.25% 71%,
    87.5% 80%,
    93.75% 71%,
    100% 50%,
    100% 80%,
    93.75% 100%,
    87.5% 100%,
    81.25% 100%,
    75% 80%,
    68.75% 59%,
    62.5% 50%,
    56.25% 59%,
    50% 80%,
    43.75% 100%,
    37.5% 100%,
    31.25% 100%,
    25% 80%,
    18.75% 59%,
    12.5% 50%,
    6.25% 59%,
    0 80%
  );
  animation:
    separator-pulse 3.5s ease-in-out infinite alternate,
    separator-wobble 5s ease-in-out infinite alternate;
}

header::before,
footer::before {
  position: absolute;
  left: 0;
  right: 0;
  content: '';
  pointer-events: none;
}

hr:not(.asterisk-divider) {
  --separator-height: 6px;
  height: var(--separator-height);
  margin-block: calc(0.5em - 2px);
  border: 0;
}

header::before {
  bottom: -2px;
}

footer::before {
  top: -2px;
}

@keyframes separator-pulse {
  from {
    background-position: 0 50%;
    opacity: 0.65;
  }

  to {
    background-position: 100% 50%;
    opacity: 1;
  }
}

@keyframes separator-wobble {
  from {
    clip-path: polygon(
      0 50%,
      6.25% 29%,
      12.5% 20%,
      18.75% 29%,
      25% 50%,
      31.25% 71%,
      37.5% 80%,
      43.75% 71%,
      50% 50%,
      56.25% 29%,
      62.5% 20%,
      68.75% 29%,
      75% 50%,
      81.25% 71%,
      87.5% 80%,
      93.75% 71%,
      100% 50%,
      100% 80%,
      93.75% 100%,
      87.5% 100%,
      81.25% 100%,
      75% 80%,
      68.75% 59%,
      62.5% 50%,
      56.25% 59%,
      50% 80%,
      43.75% 100%,
      37.5% 100%,
      31.25% 100%,
      25% 80%,
      18.75% 59%,
      12.5% 50%,
      6.25% 59%,
      0 80%
    );
  }

  to {
    clip-path: polygon(
      0 29%,
      6.25% 20%,
      12.5% 29%,
      18.75% 50%,
      25% 71%,
      31.25% 80%,
      37.5% 71%,
      43.75% 50%,
      50% 29%,
      56.25% 20%,
      62.5% 29%,
      68.75% 50%,
      75% 71%,
      81.25% 80%,
      87.5% 71%,
      93.75% 50%,
      100% 29%,
      100% 59%,
      93.75% 80%,
      87.5% 100%,
      81.25% 100%,
      75% 100%,
      68.75% 80%,
      62.5% 59%,
      56.25% 50%,
      50% 59%,
      43.75% 80%,
      37.5% 100%,
      31.25% 100%,
      25% 100%,
      18.75% 80%,
      12.5% 59%,
      6.25% 50%,
      0 59%
    );
  }
}

@media (prefers-reduced-motion: reduce) {
  header::before,
  footer::before {
    animation: none;
    background-position: 50% 50%;
    opacity: 1;
  }
}

footer p {
  text-align: left;
  line-height: 1.3;
  font-size: 0.75em;
  margin: 0.35em 0;
}

.side-rail {
  position: fixed;
  top: 0;
  left: max(0px, calc(50% - 32rem - 13rem));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 11rem;
  height: 100vh;
  padding: 1.5rem 1rem;
}
.side-mark {
  align-self: flex-end;
  color: var(--text-color-link);
  font-size: calc((100vh - 3rem) / 3.6);
  font-weight: 700;
  line-height: 0.9;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
.side-note {
  max-width: 8rem;
  font-size: 0.9rem;
  line-height: 1.2;
  text-align: center;
}

.music-widget-container {
  display: none;
  align-items: center;
  font-size: 0.95rem;
}

.music-widget-container.active {
  display: flex;
}

.music-status {
  color: var(--text-color-muted);
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28rem;
  font-size: 0.75rem;
}

@media (max-width: 77rem) {
  .side-rail {
    display: none;
  }

  .page-shell {
    width: auto;
  }
}

@media (max-width: 768px) {
  body {
    padding: 0 1rem;
  }

  .side-rail {
    display: none;
  }

  .page-shell {
    width: auto;
  }

  header {
    gap: 0.75rem;
    padding: 1rem 0.25rem;
  }

  .site-identity {
    min-width: 0;
    flex: 1 1 auto;
  }

  .home-link {
    font-size: 1.2rem;
  }

  header nav {
    flex: 0 0 auto;
  }

  main {
    padding: 2rem 0.25rem;
  }

  footer {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }
}

/* Misc */
.emphasis-red {
  color: #b34a4a;
  font-weight: bold;
}

picture,
img {
  display: block;
  margin: 0 auto;
}
figcaption {
  text-align: center;
  font-size: 0.8125em; /* 13px /16 */
  color: var(--text-color-muted);
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.profile-picture {
  border-radius: 0.9em;
  width: 300px;
  height: 300px;
  border: 1px solid var(--surface-border-color);
  box-shadow: var(--surface-shadow-soft);
  background-color: var(--component-background-color);
}

/* External links */
a[href^='http']:not([href*='aitorres.com'])::after {
  content: ' ↗️';
  font-size: 0.75em;
  color: var(--text-color-muted);
}

/* Bubble lists */
ul.bubble-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.bubble-list li {
  display: inline-block;
  margin-right: 0.5em;
  margin-bottom: 0.5em;
  padding: 0.25em 0.5em;
  border-radius: 0.9em;
  border: 1px solid var(--surface-border-color);
  background-color: var(--bubble-tag-background-color);
  color: var(--bubble-tag-text-color);
  font-size: 0.8125em; /* 13px /16 */
}

nav.translations {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0;
}

pre.post-poetry,
p.post-poetry {
  margin-top: 2em;
  margin-bottom: 2em;
  font-family: 'Courier New', Courier, monospace;
}

p.post-footer,
p.post-header-note {
  margin-top: 2em;
  margin-bottom: 2em;
  padding-top: 1em;
  border-top: 1px solid var(--surface-border-color);
  font-size: 0.8125em; /* 13px /16 */
}

p.post-header-note {
  padding-bottom: 1em;
  border-bottom: 1px solid var(--surface-border-color);
}

/* Project List */
article.projectlist-item {
  display: flex;
  padding-top: 1.5em;
  padding-bottom: 1.5em;
}

article.projectlist-item:not(:last-child) {
  border-bottom: 1px solid var(--surface-border-color);
}

article.projectlist-item .projectlist-image {
  flex: 0 0 40%;
  display: flex;
  align-items: center;
  justify-content: center;

  margin: 0.5em;
}

article.projectlist-item .projectlist-summary {
  flex: 1;
  display: flex;
  justify-content: center;
  flex-direction: column;

  margin: 0.5em;
}

article.projectlist-item .projectlist-summary h2 {
  margin-bottom: 0.25em;
}

article.projectlist-item .projectlist-summary p {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.projectlist-image img {
  width: 250px;
  height: 220px;
  border: 1px solid var(--surface-border-color);
  box-shadow: var(--surface-shadow-soft);
}

@media (max-width: 768px) {
  article.projectlist-item {
    flex-direction: column;
  }

  article.projectlist-item .projectlist-image {
    flex: 0 0 100%;
  }

  article.projectlist-item .projectlist-summary {
    flex: 1;
  }

  .postlist-tags {
    width: 100%;
    margin-left: 0;
    padding-left: 0;
  }

  h1 {
    font-size: 1.5em;
  }
}

/* Project Page */
.projectpage-image {
  width: 80%;
  height: auto;
  margin: 1.5em auto;
  box-shadow: var(--surface-shadow-soft);
}

.projectpage-links {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1em;
}

.projectpage-projecturl,
.projectpage-sourceurl {
  font-size: 0.8125em; /* 13px /16 */
}

.projectpage-projecturl::before {
  content: '🔗';
  margin-right: 0.2em;
}

.projectpage-sourceurl::before {
  content: '📦';
  margin-right: 0.2em;
}

main p picture img {
  max-width: 85%;
  object-fit: contain;
  height: auto;
}

main h1 {
  margin-block-start: 0.35em;
  margin-block-end: 0.35em;
}

.projectlist-year {
  font-size: 0.8125em; /* 13px /16 */
}

.now-page-note {
  font-size: 0.6875em; /* 11px /16 */
  color: var(--text-color-muted);
  text-align: right;
}

hr.asterisk-divider {
  border: none;
}

hr.asterisk-divider::before {
  content: '* * *';
  display: block;
  text-align: center;
  color: var(--text-color-muted);
  letter-spacing: 0.25em;
}

.hamburger,
.mobile-nav-close {
  display: none;
}

/* Hamburger menu */
/* ref: https://dev.to/ljcdev/hamburger-css-no-js-2dfa */
@media (max-width: 1024px) {
  .mobile-nav-close {
    display: block;
  }

  .hamburger {
    /* a large z-index puts the ham button above the rest of the page*/
    z-index: 99;
    border: none;
    cursor: pointer;
    top: 1rem;
    right: 1rem;
    display: block;
    text-align: right;
  }

  ul#nav-menu {
    position: fixed;
    /* give the menu a larger z-index than the ham link
    to put the menu above it */
    z-index: 100;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    /* basic menu styling*/
    list-style: none;
    background: var(--component-background-color);
    display: flex;

    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* animate slide up/down */
    transform: translateY(-100%);
    transition: transform 0.2s ease;
  }

  nav.main-nav ul li a[href],
  nav.main-nav ul li a[href]:visited {
    color: var(--text-color);
    top: 3rem;
    right: 3rem;
    font-size: 1.8rem;
  }

  nav.main-nav ul a.mobile-nav-close[href],
  nav.main-nav ul a.mobile-nav-close[href]:visited {
    position: absolute;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
  }

  ul#nav-menu:target {
    /* show menu */
    transform: translateY(0);
  }

  svg rect {
    fill: var(--text-color);
  }
}

.bluesky-embed {
  margin: 1em auto;
  display: block;
  max-width: 100%;
  overflow: hidden;
  border-radius: 2rem;
  background: var(--background-color);
}

.bluesky-embed iframe {
  display: block;
  width: 100%;
  border: 0;
  background: var(--component-background-color) !important;
  border-radius: inherit;
  clip-path: inset(0 round 0.9rem);
}

blockquote.bluesky-embed {
  padding: 0;
  border: 0;
}

/* Bluesky comments */
.bsky-comments {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--surface-border-color);
}

.bsky-comments h2 {
  margin-bottom: 0.5rem;
}

.bsky-comments-intro,
.bsky-comments-stats,
.bsky-empty {
  font-size: 0.9rem;
  color: var(--text-color);
}

.bsky-comments-stats span {
  margin-right: 0.25rem;
}

.bsky-replies {
  list-style: none;
  padding-left: 0;
  margin-top: 1rem;
}

.bsky-replies .bsky-replies {
  padding-left: 1rem;
  border-left: 2px solid var(--color-gray-20);
  margin-top: 0.75rem;
}

.bsky-reply {
  margin-bottom: 1rem;
}

.bsky-reply-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 0;
  margin-bottom: 0.25rem;
  flex-wrap: nowrap;
}

.bsky-reply-avatar img,
.bsky-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-gray-20);
  font-size: 1.1rem;
  object-fit: cover;
}

.bsky-reply-meta {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  line-height: 1.2;
}

.bsky-reply-meta a {
  text-decoration: none;
}

.bsky-handle {
  color: var(--color-gray-50);
  margin-left: 0.25rem;
  font-weight: normal;
}

.bsky-reply-date {
  color: var(--color-gray-50);
  font-size: 0.75rem;
}

.bsky-reply-text {
  margin: 0.25rem 0 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

a.bsky-reply-avatar[href^='http']:not([href*='aitorres.com'])::after {
  content: none !important;
}
