* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: #111;
  line-height: 1.6;
  background: var(--page-bg);
  overflow-x: hidden;
  --stroke: #e2d3c4;
  --accent: #F78326;
  --highlight-bg: #ffe2d4;
  --highlight-fg: #111;
  --hover-bg: #ffe0c3;
  --page-bg: #f8f5f1;
  --media-bg: #f4f0ea;
  --input-fg: #111;
  --input-bg: var(--page-bg);
  --post-row-height: 125px;
  --header-height: 56px;
  --footer-height: 48px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
}

a {
  color: var(--accent);
}

::selection {
  background: var(--highlight-bg);
  color: var(--highlight-fg);
}

::-moz-selection {
  background: var(--highlight-bg);
  color: var(--highlight-fg);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.page {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 0;
  background: var(--page-bg);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  overflow: hidden;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.not-found {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Inconsolata', ui-monospace, 'SFMono-Regular', 'Menlo', 'Monaco', monospace;
  font-size: 16px;
  line-height: 1.4;
  padding: 24px;
}

.not-found p {
  margin: 0;
}

.page > main {
  flex: 1;
}

.post-list-wrap {
  margin: 0 -20px;
  position: relative;
  --custom-scrollbar-width: 18px;
  --scroll-thumb-top: 0px;
  --scroll-thumb-height: 28px;
  --scroll-thumb-opacity: 1;
}

.post-list {
  margin: 0;
  padding: 0;
  max-height: min(
    calc(3.5 * var(--post-row-height)),
    calc(70vh - var(--header-height) - var(--footer-height))
  );
  overflow-y: auto;
  scrollbar-width: none;
  scrollbar-color: var(--page-bg) #f8f5f1;
  scrollbar-gutter: stable;
  padding-right: var(--custom-scrollbar-width);
  background: var(--page-bg);
}

.post-list-wrap--no-scroll .post-list {
  padding-right: 0;
  scrollbar-gutter: auto;
  background: var(--media-bg);
}

.post-list-wrap--no-scroll {
  background: var(--media-bg);
}

.post-list--single {
  padding-right: var(--custom-scrollbar-width);
  height: calc(90vh - var(--header-height) - var(--footer-height));
  max-height: calc(90vh - var(--header-height) - var(--footer-height));
  background: var(--page-bg);
}

.post-article {
  padding: 20px;
}

.post-hero {
  margin: 24px -20px;
}

.post-hero img {
  width: 100%;
  height: auto;
  display: block;
  border-top: 1px solid var(--stroke);
  border-bottom: 1px solid var(--stroke);
}

.post-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.post-list::-webkit-scrollbar-track {
  background: #f8f5f1;
  border-left: 1px solid var(--stroke);
  border-right: 1px solid var(--stroke);
}

.post-list::-webkit-scrollbar-thumb {
  background: var(--page-bg);
  border: 1px solid var(--stroke);
  border-radius: 100px;
}

.post-scrollbar {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--custom-scrollbar-width);
  height: 100%;
  background: var(--page-bg);
  border-left: 1px solid var(--stroke);
}

.post-list-wrap--no-scroll .post-scrollbar {
  opacity: 0;
  pointer-events: none;
}

.post-scrollbar-thumb {
  position: absolute;
  right: 3px;
  top: calc(var(--scroll-thumb-top) + 2px);
  width: calc(100% - 6px);
  height: calc(var(--scroll-thumb-height) - 4px);
  background: var(--accent);
  border: none;
  border-radius: 100px;
  opacity: var(--scroll-thumb-opacity);
  cursor: grab;
  transition: none;
}

.post-scrollbar-thumb:active {
  cursor: grabbing;
}

.site-header,
.section-header,
.project-card,
.post-body,
.post-list-wrap,
.project-grid {
  margin-bottom: 20px;
}

.site-header {
  margin: 0 -20px 0;
  padding: 0 20px;
  background: var(--media-bg);
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 0;
  min-height: 56px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "brand actions"
    "intro intro";
  align-items: center;
  column-gap: 16px;
  row-gap: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  grid-area: actions;
  justify-self: end;
}

.site-header .intro {
  margin: 0;
  grid-area: intro;
}

.site-header .intro:empty {
  display: none;
}

.contact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--page-bg);
  color: inherit;
  text-decoration: none;
  font-size: 0.9rem;
  box-sizing: border-box;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.contact-button .contact-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-button:hover {
  background: var(--hover-bg);
}

.contact-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
  background: var(--hover-bg);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

.theme-toggle .icon--sun {
  display: none;
}

body[data-theme='dark'] .theme-toggle .icon--sun {
  display: block;
}

body[data-theme='dark'] .theme-toggle .icon--moon {
  display: none;
}

.post-list-wrap {
  margin-bottom: 0;
}

.post-body {
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.8;
}

.post-body-media {
  margin: 20px auto;
}

.post-body-media img {
  display: block;
  width: 100%;
  height: auto;
}

.post-body-media--small {
  max-width: 360px;
}

.post-body-media--medium {
  max-width: 520px;
}

.post-body-media--large {
  width: min(100vw, 1100px);
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}

.post-body-media--full {
  width: min(100vw, 1100px);
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}

.post-code {
  margin: 20px 0;
  padding: 16px;
  background: var(--media-bg);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  font-family: 'Inconsolata', monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  overflow-x: auto;
}

.post-code::before {
  display: block;
  margin-bottom: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #777;
  content: attr(data-language);
}

.post-code:not([data-language])::before {
  display: none;
}

.post-code__filename {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 8px;
}

.project-card {
  border: 1px solid var(--stroke);
  padding: 16px;
  border-radius: 5px;
}

.post-item {
  border-bottom: 1px solid var(--stroke);
  height: var(--post-row-height);
  padding: 0 20px 0 0;
  border-radius: 0;
  background: var(--page-bg);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.post-item[hidden] {
  display: none;
}

.post-item.is-hidden {
  display: none !important;
}

.post-item:not(.post-item--note):hover {
  background: var(--hover-bg);
}

.post-item--note {
  cursor: default;
  border-bottom: none;
  background: var(--media-bg);
}

.post-item--note:hover {
  background: var(--media-bg);
}

.post-item--note .post-content {
  margin-left: 20px;
}

.post-note {
  margin: 0;
  color: #777;
  font-size: 0.85rem;
}

.post-item .post-media {
  width: 196px;
  flex: 0 0 196px;
  background: var(--media-bg);
  border-right: 1px solid var(--stroke);
  overflow: hidden;
}

.post-item .post-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-item .post-media--empty {
  background: transparent;
}

.post-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 16px 0;
}

.post-content h3 {
  margin: 0;
}

.post-title {
  margin: 6px 0 8px;
  font-size: 2.2rem;
  line-height: 1.2;
}

.post-summary {
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
  max-width: 450px;
}

.post-cta {
  white-space: nowrap;
  align-self: center;
  padding-right: 20px;
}

.project-card h3 {
  margin-top: 0;
}

.post-meta,
.footer {
  color: #555;
  font-size: 0.9rem;
}

.page main article .post-meta {
  margin-top: 8px;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -1px -20px 0;
  padding: 8px 20px;
  background: var(--media-bg);
  border-top: 1px solid var(--stroke);
  position: relative;
  z-index: 2;
  font-size: 0.8rem;
  font-family: 'Inconsolata', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
    'Courier New', monospace;
}

.footer > span {
  flex: 1;
}

.footer-credit {
  text-align: center;
}

.footer-credit a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.footer-favicon {
  width: 14px;
  height: 14px;
}

.post-count {
  text-align: right;
}

.post-meta {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-family: 'Inconsolata', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  letter-spacing: 0.03em;
}

.intro {
  font-size: 1rem;
}

.intro p {
  margin: 0;
}

.page main > .intro {
  margin: 0 -20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--stroke);
  background: var(--media-bg);
}

.tag-filter {
  margin: 0 -20px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--stroke);
  background: var(--media-bg);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  border: 1px solid var(--stroke);
  background: var(--page-bg);
  color: inherit;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tag-pill--static {
  cursor: default;
}

.tag-pill--static:hover {
  background: var(--media-bg);
}

.tag-pill:hover {
  background: var(--hover-bg);
}

.tag-pill[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tag-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.post-tags {
  margin-top: 20px;
}

.post-suggestions {
  padding: 0;
  background: transparent;
}

.post-suggestions h2 {
  margin: 0;
  padding: 16px 20px 12px;
  font-size: 1.1rem;
}

.post-list--suggested {
  height: auto;
  max-height: none;
  overflow: visible;
  padding-right: 0;
  margin: 0 -20px -1px;
  border-top: 1px solid var(--stroke);
}

.post-list--suggested .post-item:last-child {
  border-bottom: none;
}

.contact {
  padding: 0;
  margin: 0 -20px;
  --turnstile-width: 300px;
}

.contact-form {
  max-width: none;
  margin: 0;
  display: grid;
  gap: 0;
}

.contact-field {
  display: grid;
  grid-template-columns: 196px 1fr;
  column-gap: 0;
  align-items: start;
  border-bottom: 1px solid var(--stroke);
}


.contact-field--status {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  border-bottom: 0;
  transition: max-height 0.3s ease, opacity 0.2s ease;
}

.contact-form[data-contact-state] .contact-field--status {
  max-height: 120px;
  opacity: 1;
  pointer-events: auto;
  border-bottom: 1px solid var(--stroke);
}

.contact-field label,
.contact-label {
  margin: 0;
  padding: 12px;
  border-right: 1px solid var(--stroke);
  align-self: stretch;
  background: var(--media-bg);
  text-align: right;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'Inconsolata', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
    'Courier New', monospace;
}

.contact-field input,
.contact-field textarea {
  width: 100%;
  padding: 12px;
  border-radius: 0;
  border: none;
  background: var(--input-bg);
  color: var(--input-fg);
  -webkit-text-fill-color: currentColor;
  font: inherit;
  line-height: 1.5;
  box-shadow: inset 0 0 0 1px transparent;
}

.contact-cell {
  align-self: stretch;
}

.contact-field textarea {
  resize: vertical;
}

.contact-field input,
.contact-field textarea {
  align-self: stretch;
  height: 100%;
}

.contact-field input:focus,
.contact-field textarea:focus {
  outline: none;
}

.contact-field input:-webkit-autofill,
.contact-field input:-webkit-autofill:hover,
.contact-field input:-webkit-autofill:focus,
.contact-field textarea:-webkit-autofill,
.contact-field textarea:-webkit-autofill:hover,
.contact-field textarea:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--input-fg);
  box-shadow: 0 0 0 1000px var(--input-bg) inset;
  transition: background-color 9999s ease-out;
}


.contact-turnstile {
  padding: 16px 0 11px;
  display: flex;
  justify-content: center;
  width: var(--turnstile-width);
  margin: 0 auto;
}


.contact-turnstile--missing {
  padding: 0;
  border-radius: 10px;
  border: 1px dashed var(--stroke);
  background: var(--page-bg);
  color: #777;
  font-size: 0.9rem;
}

.contact-submit {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 14px 18px;
  border-radius: 100px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  width: var(--turnstile-width);
  justify-self: center;
  margin-bottom: 16px;
}

.contact-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.contact-submit:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.contact-status {
  margin: 0;
  min-height: 1.2em;
  padding: 12px 16px;
  font-size: 0.9rem;
}

.contact-status[data-state='success'] {
  color: #1a7f37;
}

.contact-status[data-state='error'] {
  color: #b42318;
}


.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0 -20px 0;
  padding: 0;
  width: 196px;
  height: 56px;
  grid-area: brand;
}

.brand-text {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.brand-logo__image {
  display: block;
  max-width: 80%;
  max-height: 100%;
  object-fit: contain;
}

.brand-logo__image--light {
  display: none;
}

.brand::after {
  content: '';
  width: 1px;
  height: auto;
  margin: -1px 0;
  align-self: stretch;
  background: var(--stroke);
}

@media (max-width: 920px) {
  body {
    padding: 32px 10px;
  }
}

@media (max-width: 720px) {
  body {
    padding: 16px 0;
    align-items: stretch;
    justify-content: flex-start;
    background: var(--page-bg);
  }

  .page {
    border-left: none;
    border-right: none;
    padding: 0 16px;
    border-radius: 0;
    overflow: visible;
    border-top: none;
    border-bottom: none;
    min-height: calc(100vh - 32px);
    background: var(--media-bg);
  }

  .site-header {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "brand actions"
      "intro intro";
    justify-items: stretch;
    gap: 8px 12px;
    padding: 6px 16px 0 0;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--media-bg);
  }

  .header-actions {
    justify-content: flex-end;
    justify-self: end;
    width: auto;
  }

  .brand {
    width: auto;
    height: auto;
    margin: 0;
    padding-left: 16px;
    justify-content: flex-start;
  }

  .brand-logo {
    justify-content: flex-start;
  }

  .brand-logo__image {
    max-width: 50%;
  }

  .brand::after {
    display: none;
  }

  .site-header .intro {
    width: 100%;
    font-size: 0.95rem;
  }

  .page main > .intro {
    margin: 0 -16px;
    padding: 12px 16px;
  }

  .tag-filter {
    margin: 0 -16px;
    padding: 8px 14px;
  }

  .post-list-wrap {
    margin: 0 -16px;
    margin-bottom: 0;
    padding-bottom: 20px;
    background: var(--media-bg);
  }

  .post-list {
    height: auto;
    overflow: visible;
    scrollbar-gutter: auto;
    padding: 12px 0 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }

  .post-list--single {
    height: auto;
    max-height: none;
    padding-right: 0;
  }

  .post-scrollbar {
    display: none;
  }

  .post-item {
    flex-direction: column;
    height: auto;
    padding: 0;
    gap: 0;
    border: 1px solid var(--stroke);
    border-radius: 12px;
    width: min(520px, calc(100% - 32px));
    margin: 0 auto;
  }

  .post-article {
    padding: 16px;
  }

  .post-hero {
    margin: 16px -16px;
  }

  .post-item .post-media {
    width: 100%;
    flex: 0 0 auto;
    height: auto;
    aspect-ratio: 16 / 9;
    border-right: none;
    border-bottom: 1px solid var(--stroke);
  }

  .post-content {
    padding: 0 16px 12px;
  }

  .post-suggestions {
    padding: 16px;
  }

  .post-title {
    font-size: 1.8rem;
  }

  .post-item--note .post-content {
    margin-left: 0;
    padding-top: 12px;
  }

  .post-cta {
    display: none;
  }

  .footer {
    flex-direction: column;
    text-align: center;
    margin: -1px -16px -16px;
    padding: 8px 16px;
    border-top: 1px solid var(--stroke);
    gap: 2px;
  }

  .contact {
    padding: 0;
    margin: 0 -16px;
  }

  .contact-field {
    grid-template-columns: 1fr;
    row-gap: 8px;
  }

  .contact-field label,
  .contact-label {
    padding: 8px 16px 0;
    border-right: none;
    align-self: start;
    text-align: left;
    background: transparent;
  }

  .contact-cell {
    padding: 0 16px 12px;
  }

  .contact-field input,
  .contact-field textarea {
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px var(--stroke);
  }

  .contact-status {
    padding: 0;
  }
}

@media (prefers-color-scheme: dark) {
  body {
    background: #0f0f10;
    color: #f2f2f2;
    --stroke: #2f2b27;
    --highlight-bg: #5a2d1c;
    --highlight-fg: #f2f2f2;
    --hover-bg: #201814;
    --page-bg: #0f0f10;
    --media-bg: #151517;
    --input-fg: #f2f2f2;
    --input-bg: var(--page-bg);
  }

  a {
    color: var(--accent);
  }

  .brand::after {
    background: var(--stroke);
  }

  .site-header {
    border-bottom-color: var(--stroke);
  }

  .page main > .intro {
    border-bottom-color: var(--stroke);
  }

  .page {
    border-color: var(--stroke);
  }

  .project-card,
  .post-item {
    border-color: var(--stroke);
  }

  .post-item .post-media {
    border-right-color: var(--stroke);
  }

  .post-item:not(.post-item--note):hover {
    background: var(--hover-bg);
  }

  .post-note {
    color: #b0b0b5;
  }

  .post-meta,
  .footer {
    color: #b0b0b5;
  }

  .brand-logo .brand-logo__image--light {
    display: block;
  }

  .brand-logo .brand-logo__image--default {
    display: none;
  }
}

body[data-theme='light'] {
  background: #f8f5f1;
  color: #111;
  --stroke: #e2d3c4;
  --accent: #F78326;
  --highlight-bg: #ffe2d4;
  --highlight-fg: #111;
  --hover-bg: #ffe0c3;
  --page-bg: #f8f5f1;
  --media-bg: #f4f0ea;
}

body[data-theme='light'] .brand-logo .brand-logo__image--light {
  display: none;
}

body[data-theme='light'] .brand-logo .brand-logo__image--default {
  display: block;
}

body[data-theme='dark'] {
  background: #0f0f10;
  color: #f2f2f2;
  --stroke: #2f2b27;
  --highlight-bg: #5a2d1c;
  --highlight-fg: #f2f2f2;
  --hover-bg: #201814;
  --page-bg: #0f0f10;
  --media-bg: #151517;
  --input-fg: #f2f2f2;
  --input-bg: var(--page-bg);
}

@media (max-width: 720px) {
  body,
  body[data-theme='light'],
  body[data-theme='dark'] {
    background: var(--media-bg);
  }
}

body[data-theme='dark'] .brand-logo .brand-logo__image--light {
  display: block;
}

body[data-theme='dark'] .brand-logo .brand-logo__image--default {
  display: none;
}

/*
         __            ___          __        __
   _____/ /___  ______/ (_)___     / /_____ _/ /__
  / ___/ __/ / / / __  / / __ \   / __/ __ `/ //_/
 (__  ) /_/ /_/ / /_/ / / /_/ /  / /_/ /_/ / ,<
/____/\__/\__,_/\__,_/_/\____/   \__/\__,_/_/|_|
*/
