@font-face {
  font-family: BYekan;
  src: url('/assets/fonts/BYekan.woff') format('woff');
  font-display: swap;
}

@font-face {
  font-family: BKoodakBold;
  src: url('/assets/fonts/BKoodakBold.woff') format('woff');
  font-display: swap;
}

:root {
  --accent: #e9662c;
  --link: #245b8c;
  --text: #353129;
  --surface: #f7f5ef;
  --page-background: #f7f7f7;
  --muted: color-mix(in srgb, var(--text) 75%, var(--surface));
  --border: color-mix(in srgb, var(--text) 20%, var(--surface));
  --surface-muted: color-mix(in srgb, var(--text) 4%, var(--surface));
  --hover-bg: color-mix(in srgb, var(--accent) 4%, var(--surface));
  --selected-bg: color-mix(in srgb, var(--accent) 8%, var(--surface));
  --button-bg: color-mix(in srgb, var(--accent) 18%, var(--surface));
  --button-hover-bg: color-mix(in srgb, var(--accent) 26%, var(--surface));
  --shadow: color-mix(in srgb, var(--text) 12%, transparent);
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--text);
  background: var(--page-background);
  font:
    14px/1.8 Tahoma,
    Arial,
    sans-serif;
}
a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-thickness: 2px;
}
a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: BKoodakBold, Arial, sans-serif;
  font-weight: normal;
  line-height: 1.5;
}
h1 {
  font-size: 30px;
}
h2 {
  font-size: 25px;
}
h3 {
  font-size: 22px;
}
h4,
h5,
h6 {
  font-size: 19px;
}

/* Desktop sidebar; smaller screens use a native expandable category menu. */
.site-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 24px;
  max-width: 1320px;
  margin: 16px auto;
  padding-inline: 16px;
}
.site-nav,
.main-column {
  min-width: 0;
}
.site-nav {
  align-self: start;
}
.site-logo {
  text-decoration: none;
  display: block;
  max-width: 230px;
  margin-inline: auto;
}
.site-logo img {
  display: block;
  width: 100%;
  height: 80px;
  object-fit: cover;
}
.language-switch {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-block: 12px;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 14px;
}
.language-switch a,
.language-switch span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  text-decoration: none;
}
.language-switch [aria-current] {
  background: var(--selected-bg);
  border-color: var(--accent);
}
.language-switch a:hover {
  background: var(--hover-bg);
}

html[lang='en'] body {
  font-family: Arial, Helvetica, sans-serif;
}
html[lang='en'] :is(h1, h2, h3, h4, h5, h6) {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 600;
}
html[lang='en'] :is(.post-meta, .article-archive-note, .site-footer) {
  font-family: Arial, Helvetica, sans-serif;
}
html[lang='en'] :is(.category-menu a, .mobile-menu summary) {
  font-family: Arial, Helvetica, sans-serif;
}
html[lang='en'] .entry p {
  text-align: start;
}
html[lang='en'] :is(.download, .demo, .contentButton) {
  direction: ltr;
  font-family: Arial, Helvetica, sans-serif;
}
html[lang='en'] .skip-link {
  right: auto;
  left: 16px;
}
.category-menu {
  display: grid;
  gap: 4px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.category-menu li {
  min-width: 0;
}
.category-menu a {
  display: flex;
  align-items: center;
  min-height: 44px;
  height: 100%;
  padding: 8px 12px;
  border-inline-start: 3px solid transparent;
  border-radius: 3px;
  color: var(--text);
  text-align: start;
  text-decoration: none;
  overflow-wrap: break-word;
  font:
    20px/1.5 BKoodakBold,
    Arial,
    sans-serif;
}
.category-menu a:hover,
.category-menu a:focus-visible {
  color: var(--text);
  background: var(--hover-bg);
}
.category-menu a[aria-current='page'] {
  color: var(--text);
  background: var(--selected-bg);
}
.mobile-menu {
  display: none;
}
main {
  background: var(--page-background);
  box-shadow: 0 0 10px var(--shadow);
}
.archive-heading {
  margin: 0;
  padding: 24px 32px 0;
  color: var(--muted);
}
.post {
  padding: 28px 32px;
}
.post-preview h2 {
  margin: 0 0 16px;
}
.post-preview h2 a {
  color: var(--text);
  text-decoration: none;
}
.post-preview h2 a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}
.article-header {
  padding: 24px 32px;
}
.article-header h1 {
  margin: 0;
  color: var(--text);
}
.article-archive-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 24px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--surface));
  border-inline-start: 3px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
  background: var(--selected-bg);
  font-family: BYekan, Tahoma, sans-serif;
  font-size: 0.95rem;
}
.archive-info-icon {
  flex: 0 0 20px;
  margin-top: 3px;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0 0 20px;
  padding: 8px 12px;
  border-inline-start: 3px solid var(--border);
  background: var(--surface-muted);
  font-family: BYekan, Tahoma, sans-serif;
}
.site-footer {
  padding: 20px 10px;
  color: var(--muted);
  font-family: BYekan, Tahoma, sans-serif;
}
.site-footer p {
  margin: 0;
}
.site-footer .archive-note {
  margin-bottom: 12px;
}

/* Article formatting, including the existing imported content classes. */
.entry {
  overflow-wrap: anywhere;
}
.entry a[href]:not(:where(.download, .demo, .contentButton)) {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-skip-ink: auto;
  unicode-bidi: isolate;
}
.entry a[href]:not(:where(.download, .demo, .contentButton)):is(:hover, :focus-visible) {
  text-decoration-thickness: 2px;
}
.article-body .entry {
  max-width: 820px;
  margin-inline: auto;
}
.entry p {
  margin: 0 0 16px;
  text-align: justify;
}
.entry h2,
.entry h3,
.entry h4,
.entry h5,
.entry h6 {
  margin: 24px 0 12px;
  color: var(--text);
}
.entry strong {
  color: inherit;
}
.entry ul,
.entry ol {
  margin: 16px 0;
  padding-inline-start: 24px;
}
.entry li {
  margin-block: 4px;
}
.entry .relatedLink {
  font-weight: bold;
}
.entry img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 20px auto;
}
.entry iframe,
.entry video {
  max-width: 100%;
}
.entry .floatImage {
  float: right;
  margin-inline-end: 12px;
}
.entry .imageDescription {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.entry pre {
  direction: ltr;
  unicode-bidi: isolate;
  overflow-x: auto;
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface-muted);
  font:
    14px/1.6 ui-monospace,
    Menlo,
    Consolas,
    monospace;
  text-align: left;
  white-space: pre;
  overflow-wrap: normal;
  tab-size: 4;
}
.entry code {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.entry pre code {
  display: block;
  font: inherit;
}
.entry pre samp {
  font: inherit;
}
.entry .code-example {
  margin: 20px 0;
}
.entry .code-label {
  margin: 0;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: var(--surface-muted);
  color: var(--muted);
  font:
    12px/1.6 Tahoma,
    Arial,
    sans-serif;
  text-align: left;
}
.entry .code-example pre {
  margin: 0;
  border-radius: 0 0 3px 3px;
}
.entry blockquote {
  margin: 20px 0;
  padding: 12px 16px;
  border-inline-start: 3px solid var(--accent);
  background: var(--surface-muted);
}
.entry hr,
.entry .divider {
  margin: 20px 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.entry table {
  max-width: 100%;
  border-collapse: collapse;
}
.entry th,
.entry td {
  padding: 8px;
  border: 1px solid var(--border);
}
.entry .green {
  color: var(--text);
}
.entry .red {
  color: var(--text);
}
.unavailable-image {
  display: block;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
}

.download,
.demo,
.contentButton {
  direction: rtl;
  display: inline-block;
  padding: 10px 16px;
  border-radius: 3px;
  color: var(--text);
  background: var(--button-bg);
  border: 1px solid var(--accent);
  text-decoration: none;
  font-family: BYekan, Tahoma, sans-serif;
  font-size: 18px;
  text-align: center;
}
.download:hover,
.demo:hover,
.contentButton:hover {
  color: var(--text);
  background: var(--button-hover-bg);
  text-decoration: underline;
}
.buttonWrapper {
  margin: 20px 0;
  text-align: center;
}
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 24px 32px;
}
.pagination a,
.pagination span {
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
}
.pagination [aria-current] {
  background: var(--selected-bg);
  color: var(--text);
}
.pagination .page-count {
  border: 0;
  color: var(--muted);
}
.skip-link {
  position: absolute;
  top: -100px;
  right: 16px;
  padding: 12px;
  background: var(--surface);
  z-index: 1;
}
.skip-link:focus {
  top: 12px;
}

/* Shared article classes replace inline formatting in imported posts. */
.entry .align-center {
  text-align: center;
}
.entry .align-left {
  text-align: left;
}
.entry .align-right {
  text-align: right;
}
.entry .align-justify {
  text-align: justify;
}
.entry .content-center-spacing {
  margin: 15px 0;
}
.entry .content-block-spacing {
  margin: 20px 0;
}
.entry .content-small-spacing {
  margin: 10px 0;
}
.entry .content-list-inset {
  margin: 10px 30px;
}
.entry .content-list-offset {
  margin: 10px 0;
  margin-inline-start: 30px;
}
.entry .content-offset {
  margin: 15px 0;
  margin-inline-start: 20px;
}
.entry .content-inset-narrow {
  margin: 20px 15px;
}
.entry .content-inset {
  margin: 20px;
}
.entry .content-small-inset {
  margin: 15px;
}
.entry .content-gap-before {
  margin-top: 20px;
}
.entry .content-gap-after {
  margin-bottom: 15px;
}
.entry .content-gap-after-small {
  margin-bottom: 10px;
}
.entry .content-padding-after {
  padding-bottom: 10px;
}
.entry .content-list-padding {
  padding-block: 0 15px;
  padding-inline: 30px 0;
}
.entry .content-inline-padding {
  padding-inline: 5px;
}
.entry .list-disc {
  list-style-type: disc;
}
.entry .list-inherit {
  list-style-type: inherit;
}
.entry .content-small-text {
  font-size: 13px;
}
.entry .content-emphasis,
.entry .content-warning {
  color: var(--text);
  font-weight: bold;
}
.entry .plain-link {
  color: var(--text);
  text-decoration: none;
}
.entry img.image-third {
  width: 30%;
}
.entry .content-panel {
  width: 450px;
  max-width: 100%;
  margin: 20px auto;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}
.entry .content-panel-wide {
  width: 625px;
  margin-block: 15px;
  text-align: justify;
}
.entry .content-panel-download {
  width: 400px;
  margin-block: 15px;
  padding: 15px 25px;
  border-style: dashed;
  font-weight: bold;
  text-align: center;
}
.entry .content-panel-example {
  width: 300px;
  margin-block: 15px;
  padding: 15px;
}
.entry .content-equation {
  padding: 15px;
  border: 1px solid var(--accent);
  background: var(--surface-muted);
  text-align: left;
}
.entry .content-section-heading {
  margin-bottom: 5px;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--border);
}

/* Below 1024px, give the article the full width. */
@media (width < 64rem) {
  .site-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .site-logo {
    text-decoration: none;
    max-width: 180px;
  }
  .site-logo img {
    height: 64px;
  }
  .desktop-menu {
    display: none;
  }
  .mobile-menu {
    display: block;
    margin-top: 8px;
  }
  .mobile-menu summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font:
      19px/1.5 BKoodakBold,
      Arial,
      sans-serif;
    list-style: none;
    cursor: pointer;
  }
  .mobile-menu summary::-webkit-details-marker {
    display: none;
  }
  .mobile-menu summary::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
  }
  .mobile-menu[open] summary {
    border-color: var(--accent);
  }
  .mobile-menu[open] summary::after {
    transform: rotate(225deg);
  }
  .mobile-menu summary:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 3px;
  }
  .mobile-menu .category-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
  }
  .category-menu a {
    justify-content: center;
    padding: 10px 8px;
    text-align: center;
    font-size: 18px;
    background: var(--surface-muted);
  }
  .post,
  .article-header {
    padding: 24px;
  }
  .archive-heading {
    padding: 24px 24px 0;
  }
}

/* Below 640px, keep touch targets roomy and use two category columns. */
@media (width < 40rem) {
  .site-layout {
    margin-block: 8px;
    padding-inline: 8px;
  }
  .mobile-menu .category-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .post,
  .article-header {
    padding: 20px 16px;
  }
  .archive-heading {
    padding: 20px 16px 0;
  }
  h1 {
    font-size: 26px;
  }
  h2 {
    font-size: 23px;
  }
  .pagination {
    padding: 20px 16px;
  }
}

/* Article 1137 examples: colors distinguish good and bad markup. */

#post-1137 .green {
  color: #080;
  font-weight: bold;
  margin: 10px 0;
  border-bottom: 1px solid #080;
  display: block;
}
#post-1137 .red {
  color: #b00;
  font-weight: bold;
  margin: 10px 0;
  border-bottom: 1px solid #b00;
  display: block;
}

/* Article 372 examples. */

#post-372 li.menuExample {
  display: inline;
  color: #0a0;
  font-weight: bold;
}
#post-372 li.menuExample a {
  color: #0a0;
  font-weight: bold;
}
