:root {
  --text-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono-font-family: Menlo, Consolas, monospace;
  --font-size: 13pt;
  --line-height: 1.5em;
  --meta-scaling-factor: 0.82;
  --footnote-scaling-factor: 0.95;
  --max-width: 751px;
  --grid-gap: 10px;
  --default-padding: 20px;
  --border-radius: 10px;
  --border-style: solid;
  --border-width: 3px;
  --body-text: #202020;
  --body-text-light: #202020;
  --body-text-dark: #c7c7c7;
  --accent-grey: #999;
  --block-border: #dfdfdf;
  --block-background: #f3f3f3;
  --screenshot-border: #f0f0f0;
  --background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=");
  --background-color: #fafafa;
  --primary-color-light: #873553;
  --primary-color-dark: #6e2c44;
  --primary-color: #873553;
  --link-color: #873553;
  --nav-background-url: linear-gradient(to right, #873553, #873553);
}

@media(prefers-color-scheme: dark) {
  :root {
    --body-text: #c7c7c7;
    --accent-grey: #9a9a9a;
    --block-border: #434343;
    --block-background: #1d1d1d;
    --screenshot-border: #3f3f3f;
    --background-color: #0d0d0d;
    --background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=");
    --primary-color: #6e2c44;
    --link-color: #6e2c44;
  }
}

body {
  font: var(--font-size) var(--text-font-family);
  line-height: var(--line-height);
  color: var(--body-text);
  margin: 0;
  padding: 0;
  background: var(--background-image) var(--background-color);
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

h1, h2, h3 {
  color: var(--primary-color);
  font-weight: normal;
}

h1 {
  font-size: 2em;
  text-wrap: balance;
}

h2 {
  margin-top: 1em;
  font-size: 1.5em;
  line-height: 1.5em;
  margin-bottom: 0;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--body-text);
}

a:visited {
  color: var(--body-text);
}

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

a:hover {
  color: cyan;
}

main, footer > *, nav > * {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--default-padding);
  padding-right: var(--default-padding);
  width: calc(100vw - 2*var(--default-padding) - env(safe-area-inset-left) - env(safe-area-inset-right));
}

pre, blockquote {
  border: var(--border-width) var(--border-style) var(--block-border);
  border-radius: var(--border-radius);
  background-color: var(--block-background);
}

blockquote {
  padding: 1px var(--default-padding);
}

blockquote p:first-child {
  margin-top: calc(2*var(--default-padding)/3);
}

blockquote p:last-child {
  margin-bottom: calc(2*var(--default-padding)/3);
}

article, main {
  padding-top: 3px;
  padding-bottom: 2em;
}

.meta, figcaption, footer {
  font-size: calc(var(--font-size)*var(--meta-scaling-factor));
  line-height: calc(var(--line-height)*var(--meta-scaling-factor)*1.15);
}

.meta a:hover, figcaption a:hover, footer a:hover {
  text-decoration-thickness: 3px;
}

.title {
  font-size: 1.9em;
  line-height: 1.45em;
  margin-bottom: -6px;
}

.title a {
  text-decoration: none;
}

ul.plain_list, ul.dot_list {
  list-style-type: none;
  padding: 0;
}

ul.dot_list li {
  display: inline;
}

ul.dot_list li:not(:last-child)::after {
  content: "  ";
}

.meta, .meta a, .meta a:visited {
  color: var(--accent-grey);
}

code, pre {
  font-family: var(--mono-font-family);
  overflow-x: auto;
}

code {
  font-size: 88%;
  line-height: 88%;
}

pre {
  padding: calc(2*var(--default-padding)/3) calc(var(--default-padding) - var(--border-width));
  -webkit-text-size-adjust: 100%;
}

pre code {
  margin: 0px;
  padding-left: 0px;
}

nav {
  padding-top: calc(1px + env(safe-area-inset-top));
  padding-bottom: 1px;
  background: var(--nav-background-url) var(--primary-color-light);
  background-size: auto 100%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

nav > * {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1em;
}

nav h1 {
  margin-bottom: 0;
  font-size: 1.8em;
  font-weight: 500;
}

nav h1 a {
  text-decoration: none;
  letter-spacing: -0.02em;
}

nav ul {
  margin-bottom: 0;
  display: flex;
  gap: 1.5em;
}

nav ul li {
  margin: 0;
}

nav ul a {
  padding: 0.5em 1em;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  text-decoration: none;
}

nav ul a:hover {
  background-color: rgba(255, 255, 255, 0.15);
  text-decoration: none;
}

nav ul a[selected] {
  background-color: rgba(255, 255, 255, 0.2);
  font-weight: 500;
  text-decoration: none;
}

nav, nav a, nav a:visited {
  color: white;
}

@media screen and (max-width: 520px) {
  nav > * {
    flex-direction: column;
    align-items: center;
    gap: 0.5em;
  }

  nav h1 {
    font-size: 1.6em;
  }
}

hr {
  width: 105px;
  margin: 3.5em auto;
  height: 5px;
  border: 0;
  background-color: #ccc;
}

a.skip-main {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: -999;
}

footer {
  padding-top: 2em;
  padding-bottom: calc(2em + env(safe-area-inset-bottom));
  font-size: calc(var(--meta-scaling-factor)*var(--font-size));
  background: linear-gradient(135deg, var(--primary-color-light), var(--primary-color-dark));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer, footer a, footer a:hover, footer a:visited {
  color: white;
}

footer a:hover {
  text-decoration: underline;
  color: rgba(255, 255, 255, 0.9);
}

#footer_inner {
  text-align: center;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-gap: calc(3*var(--grid-gap));
  align-items: start;
}

#footer_inner > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 1em;
}

#footer_inner p {
  margin: 0;
  line-height: 1.6;
}

#footer_inner p:first-child {
  font-weight: 500;
  font-size: 1.1em;
}

footer form {
  background: rgba(255, 255, 255, 0.1);
  padding: 1.5em;
  border-radius: var(--border-radius);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 280px;
}

footer form p {
  margin: 0 0 1em 0;
  font-size: 1em;
}

footer form p:last-child {
  margin-bottom: 0;
  font-size: 0.9em;
  opacity: 0.8;
}

footer #bd-email {
  margin-top: 5px;
  margin-bottom: 5px;
  padding: 5px;
  border: none;
  border-radius: 5px;
  font-size: 1.2em;
  width: calc(100% - 6px);
}

footer form input[type=submit] {
  border: 2px solid white;
  border-radius: 5px;
  color: white;
  font-family: var(--text-font-family);
  font-size: 1em;
  background: var(--primary-color-light);
  margin-top: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

footer form input[type=submit]:hover {
  background: white;
  color: var(--primary-color-light);
}

footer form input[type=submit]:active {
  transform: translate(0, 2px);
}

@media screen and (max-width: 720px) {
  #footer_inner {
    grid-template-columns: 1fr;
    gap: 2em;
  }

  footer form {
    min-width: auto;
  }

  footer form p:first-child {
    margin-top: 0;
  }
}

table#sizes {
  width: 100%;
  border: var(--border-width) var(--border-style) var(--block-border);
  border-radius: var(--border-radius);
  background-color: var(--block-background);
  padding: var(--default-padding);
}

table#sizes tr:not(:last-of-type) > th,
table#sizes tr:not(:last-of-type) > td {
  border-bottom: 2px solid var(--block-border);
}

table#sizes td:not(:first-child) {
  text-align: center;
}

table#sizes tr > td:nth-child(2) {
  padding-left: 1em;
}

/* Syntax highlighting */
pre .hll { background-color: #ffc; }
pre .c { color: #408080; font-style: italic; }
pre .k, pre .kc, pre .kd, pre .kn, pre .kr, pre .nt, pre .bp { color: green; font-weight: bold; }
pre .cp { color: #bc7a00; }
pre .ch, pre .cm, pre .cpf, pre .c1, pre .cs { color: #305f5f; font-style: italic; }
pre .gh, pre .gp { color: navy; font-weight: bold; }
pre .gd { color: #a00000; }
pre .ge { font-style: italic; }
pre .gr { color: red; }
pre .gi { color: #00a000; }
pre .go { color: #888; }
pre .gs { font-weight: bold; }
pre .gu { color: purple; font-weight: bold; }
pre .gt { color: #04d; }
pre .kp { color: green; }
pre .kt { color: #b00040; }
pre .na { color: #7d9029; }
pre .nb { color: green; }
pre .nc { color: blue; font-weight: bold; }
pre .no { color: #800; }
pre .nd { color: #a2f; }
pre .ni { color: #999; font-weight: bold; }
pre .ne { color: #d2413a; font-weight: bold; }
pre .nf { color: blue; }
pre .nl { color: #a0a000; }
pre .nn { color: blue; font-weight: bold; }
pre .nv { color: #19177c; }
pre .ow { color: #a2f; font-weight: bold; }
pre .w { color: #bbb; }
pre .o, pre .m, pre .mb, pre .mf, pre .mh, pre .mi, pre .mo, pre .il { color: #585858; }
pre .s, pre .sa, pre .sb, pre .sc, pre .dl, pre .sd, pre .s2, pre .sh, pre .s1 { color: #ba2121; }
pre .sd { font-style: italic; }
pre .se { color: #b62; font-weight: bold; }
pre .si { color: #b68; font-weight: bold; }
pre .sx { color: green; }
pre .sr { color: #b68; }
pre .ss { color: #19177c; }
pre .fm { color: blue; }
pre .vc, pre .vg, pre .vi, pre .vm { color: #19177c; }

@media(prefers-color-scheme: dark) {
  pre .hll { background-color: #424200; }
  pre .c { color: #418383; }
  pre .k, pre .kc, pre .kd, pre .kn, pre .kr, pre .nt, pre .bp { color: #008500; }
  pre .cp { color: #9d6600; }
  pre .ch, pre .cm, pre .cpf, pre .c1, pre .cs { color: #51a4a4; }
  pre .gh, pre .gp { color: #d6d6fe; }
  pre .gd { color: #fe6767; }
  pre .gr { color: #f40000; }
  pre .gi { color: #008600; }
  pre .go { color: #737373; }
  pre .gu { color: #ff61fe; }
  pre .gt { color: #5388ff; }
  pre .kp { color: #008500; }
  pre .kt { color: #ff3a82; }
  pre .na { color: #6b7c23; }
  pre .nb { color: #008500; }
  pre .nc { color: #9393ff; }
  pre .no { color: #ff8d8d; }
  pre .nd { color: #ab27ff; }
  pre .ni { color: #686868; }
  pre .ne { color: #d2453e; }
  pre .nf { color: #9393ff; }
  pre .nl { color: #a0a000; }
  pre .nn { color: #9393ff; }
  pre .nv { color: #cfcef6; }
  pre .ow { color: #ab27ff; }
  pre .w { color: #545454; }
  pre .o, pre .m, pre .mb, pre .mf, pre .mh, pre .mi, pre .mo, pre .il { color: #999; }
  pre .s, pre .sa, pre .sb, pre .sc, pre .dl, pre .sd, pre .s2, pre .sh, pre .s1 { color: #df4d4d; }
  pre .se { color: #b66321; }
  pre .si { color: #b65b7f; }
  pre .sx { color: #008500; }
  pre .sr { color: #b65b7f; }
  pre .ss { color: #cfcef6; }
  pre .fm { color: #9393ff; }
  pre .vc, pre .vg, pre .vi, pre .vm { color: #cfcef6; }
}

.language-console .gp, .language-console .gp + .w {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* App gallery layout with images and descriptions */
.app-gallery {
  display: flex;
  flex-direction: column;
  gap: 2em;
  padding: 0;
  margin: 2em auto;
  max-width: 700px;
}

.app-item {
  display: flex;
  gap: 2em;
  align-items: flex-start;
  padding: 1.5em;
  background: rgba(135, 53, 83, 0.02);
  border-radius: var(--border-radius);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.app-item:hover {
  background: rgba(135, 53, 83, 0.05);
  border-color: var(--block-border);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.app-image {
  flex-shrink: 0;
  width: 120px;
}

.app-image img {
  width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  transition: transform 0.2s ease;
}

.app-image img:hover {
  transform: scale(1.05);
}

.app-description {
  flex: 1;
  min-width: 0;
}

.app-description h3 {
  margin: 0 0 0.8em 0;
  font-size: 1.4em;
  line-height: 1.2;
}

.app-description h3 a {
  text-decoration: none;
  color: var(--primary-color);
}

.app-description h3 a:hover {
  text-decoration: underline;
  color: var(--link-color);
}

.app-description p {
  margin: 0;
  line-height: 1.5;
  color: var(--body-text);
}

/* Mobile responsive design */
@media screen and (max-width: 640px) {
  .app-item {
    flex-direction: column;
    text-align: center;
    gap: 1.5em;
  }

  .app-image {
    width: 100px;
    align-self: center;
  }

  .app-description h3 {
    margin-bottom: 0.6em;
    font-size: 1.3em;
  }
}

@media screen and (max-width: 480px) {
  .app-gallery {
    gap: 1.5em;
    margin: 1.5em auto;
  }

  .app-item {
    padding: 1.2em;
    gap: 1.2em;
  }

  .app-image {
    width: 90px;
  }

  .app-description h3 {
    font-size: 1.2em;
  }

  .app-description p {
    font-size: 0.95em;
  }
}

/* Dark mode adjustments */
@media(prefers-color-scheme: dark) {
  .app-item {
    background: rgba(135, 53, 83, 0.08);
  }

  .app-item:hover {
    background: rgba(135, 53, 83, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

/* Hero section styling */
.hero {
  text-align: center;
  padding: 3em 0;
  background: linear-gradient(135deg, rgba(135, 53, 83, 0.05), rgba(110, 44, 68, 0.05));
  border-radius: var(--border-radius);
  margin-bottom: 3em;
}

.hero h1 {
  font-size: 2.5em;
  margin-bottom: 0.5em;
  font-weight: 300;
}

.hero .subtitle {
  font-size: 1.2em;
  color: var(--accent-grey);
  margin-bottom: 1.5em;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero .contact-info {
  font-size: 1em;
  color: var(--body-text);
  background: rgba(255, 255, 255, 0.8);
  padding: 1em 2em;
  border-radius: var(--border-radius);
  display: inline-block;
  border: 1px solid var(--block-border);
}

.hero .contact-info a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 500;
}

.hero .contact-info a:hover {
  text-decoration: underline;
}

/* Content sections */
.content-section {
  margin-bottom: 4em;
}

.section-title {
  font-size: 1.8em;
  margin-bottom: 1.5em;
  text-align: center;
  color: var(--primary-color);
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--primary-color);
  margin: 0.5em auto;
}

/* Blog post list styling */
.blog-list {
  list-style: none;
  padding: 0;
  max-width: 600px;
  margin: 0 auto;
}

.blog-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1em 1.5em;
  margin-bottom: 0.5em;
  background: rgba(135, 53, 83, 0.02);
  border-radius: var(--border-radius);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.blog-list li:hover {
  background: rgba(135, 53, 83, 0.05);
  border-color: var(--block-border);
  transform: translateY(-2px);
}

.blog-list a {
  text-decoration: none;
  font-weight: 500;
  flex-grow: 1;
}

.blog-list span {
  color: var(--accent-grey);
  font-size: 0.9em;
  white-space: nowrap;
  margin-left: 1em;
}

@media screen and (max-width: 520px) {
  .hero {
    padding: 2em 0;
  }

  .hero h1 {
    font-size: 2em;
  }

  .hero .contact-info {
    padding: 0.8em 1.5em;
  }

  .blog-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5em;
  }

  .blog-list span {
    margin-left: 0;
  }
}

@media(prefers-color-scheme: dark) {
  .hero .contact-info {
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--block-border);
  }

  .blog-list li {
    background: rgba(135, 53, 83, 0.1);
  }

  .blog-list li:hover {
    background: rgba(135, 53, 83, 0.15);
  }
}
