/* driesdeboosere.dev: hand-written port of the former MudBlazor theme.
   Breakpoints follow MudBlazor: sm 600px, md 960px, lg 1280px. */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #5b21b6;
  --primary-hover: #4c1c98;
  --primary-text: #fff;
  --appbar: #5b21b6;
  --appbar-text: #fff;
  --background: #32333d;
  --surface: #373740;
  --text: rgba(255, 255, 255, 0.7);
  --text-secondary: rgba(255, 255, 255, 0.5);
  --lines: rgba(255, 255, 255, 0.12);
  --link: #b69cf7;
  --code-bg: #2a2b33;
  --code-text: #e6e6ef;
  --tok-comment: #8b8fa3;
  --tok-keyword: #c3a6ff;
  --tok-string: #a5d6a7;
  --tok-number: #ffcc80;
  --tok-function: #81d4fa;
  --tok-punct: #b0b3c2;
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #f8fafc;
  --surface: #fff;
  --text: #424242;
  --text-secondary: rgba(0, 0, 0, 0.54);
  --lines: rgba(0, 0, 0, 0.12);
  --link: #5b21b6;
  --code-bg: #f3f2f8;
  --code-text: #24292f;
  --tok-comment: #6a737d;
  --tok-keyword: #6f42c1;
  --tok-string: #22863a;
  --tok-number: #b35900;
  --tok-function: #005cc5;
  --tok-punct: #57606a;
}

:root {
  --elevation-2: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
  --elevation-4: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);
  --elevation-5: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 5px 8px 0 rgba(0, 0, 0, 0.14), 0 1px 14px 0 rgba(0, 0, 0, 0.12);
  --font: Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 400 0.875rem/1.43 var(--font);
  letter-spacing: 0.01071em;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s, color 0.2s;
}

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

a {
  color: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

/* Typography (MainLayout.razor theme) */
h1 {
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.0075em;
}

h2 {
  font-size: 2rem;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.00833em;
}

h3 {
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.167;
}

.body1 {
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: 0.00938em;
}

.body2 {
  font-size: 0.875rem;
  line-height: 1.43;
  letter-spacing: 0.01071em;
}

.subtitle1 {
  font-size: 1rem;
  line-height: 1.75;
  letter-spacing: 0.00938em;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

/* Page skeleton. The full-height rule lives on <body>: AdSense sets inline
   "min-height: 0 !important; height: auto !important" on ad ancestors (.page,
   .container), so those elements must grow via flex-grow, which it leaves alone. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.page {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
}

.container {
  width: 100%;
  max-width: 1920px;
  margin: 16px auto;
  padding: 0 16px;
  flex: 1;
}

@media (min-width: 600px) {
  .container {
    padding: 0 24px;
  }
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.layout__spacer,
.layout__side {
  display: none;
}

.layout__main {
  margin-bottom: 96px;
  min-width: 0;
}

@media (min-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  }

  .layout__side {
    display: block;
  }
}

@media (min-width: 1280px) {
  .layout {
    grid-template-columns: minmax(0, 3fr) minmax(0, 6fr) minmax(0, 3fr);
  }

  .layout__spacer {
    display: block;
  }
}

/* App bar (NavMenu.razor / Footer.razor) */
.appbar {
  background: var(--appbar);
  color: var(--appbar-text);
  box-shadow: var(--elevation-4);
  position: relative;
  z-index: 2;
}

.appbar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 16px;
  min-height: 56px;
  padding: 0 16px;
}

@media (min-width: 600px) {
  .appbar__inner {
    gap: 0 32px;
    min-height: 64px;
    padding: 0 24px;
  }
}

.appbar a {
  color: inherit;
  text-decoration: none;
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: 0.00938em;
}

.appbar a:hover,
.appbar a:focus-visible {
  text-decoration: underline;
}

.appbar__brand {
  display: flex;
  align-items: center;
}

.appbar__avatar {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--elevation-4);
}

.appbar__brand-text {
  display: none;
}

@media (min-width: 600px) {
  .appbar__brand-text {
    display: inline;
  }

  .appbar__avatar {
    display: none;
  }
}

.appbar__links {
  display: flex;
  gap: 20px;
}

@media (min-width: 600px) {
  .appbar__links {
    gap: 32px;
  }
}

.appbar__links a[aria-current="page"] {
  font-weight: 500;
}

.spacer {
  flex: 1 1 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: -8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.12);
}

.theme-toggle__moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle__sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle__moon {
  display: block;
}

.appbar--footer {
  padding: 16px 0;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 64px;
  padding: 0 24px;
}

.footer__copy {
  display: flex;
  gap: 4px;
  font-size: 1rem;
  line-height: 1.5;
}

.footer__badge {
  display: flex;
}

/* Content blocks (Title.razor / Content.razor) */
.title {
  margin-bottom: 16px;
}

.content,
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.content a:not(.button):not(.chip):not(.post-card__title),
.markdown a {
  color: var(--link);
}

.paper {
  background: var(--surface);
  border-radius: 4px;
  box-shadow: var(--elevation-5);
}

.paper--outlined {
  border: 1px solid var(--lines);
  box-shadow: var(--elevation-2);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  border-radius: 4px;
  background: var(--primary);
  color: var(--primary-text) !important;
  box-shadow: var(--elevation-2);
  font: 500 0.875rem/1.75 var(--font);
  letter-spacing: 0.02857em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.25s, box-shadow 0.25s;
}

.button:hover,
.button:focus-visible {
  background: var(--primary-hover);
  box-shadow: var(--elevation-4);
}

/* Post list (PostCollection.razor) */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 12px 0;
}

.post-card {
  overflow: hidden;
}

.post-card__media {
  display: block;
  flex: none;
  padding: 12px;
}

.post-card__media picture {
  display: block;
}

.post-card__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 632;
  object-fit: cover;
  object-position: left bottom;
}

.post-card__body {
  margin: 8px;
  padding: 12px;
}

.post-card__title {
  text-decoration: none;
}

.post-card__title:hover {
  text-decoration: underline;
}

@media (min-width: 960px) {
  .post-card {
    display: flex;
    gap: 8px;
  }

  .post-card__media {
    width: 324px;
    max-width: 50%;
  }
}

/* Portfolio (PortfolioCollection.razor) */
.portfolio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  padding: 12px 0;
}

@media (min-width: 600px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.portfolio-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.portfolio-card__media {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  padding: 8px;
  border-radius: 4px 4px 0 0;
}

.portfolio-card__media img {
  max-height: 134px;
  width: auto;
  object-fit: scale-down;
}

.portfolio-card__body {
  padding: 8px;
}

.portfolio-card__action {
  display: flex;
  justify-content: center;
}

.portfolio-card__action img {
  display: block;
  height: 60px;
  width: auto;
}

/* About */
.about-intro {
  display: flex;
  align-items: center;
  gap: 16px;
}

.about-intro__img {
  flex: none;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--elevation-4);
}

@media (max-width: 599px) {
  .about-intro__img {
    width: 120px;
    height: 120px;
  }
}

.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tech-list li {
  padding: 4px 8px;
  font-size: 1rem;
  line-height: 1.5;
}

/* Post (BlogPost.razor + MudMarkdown) */
.post__meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--lines);
  border-radius: 16px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-decoration: none;
}

.chip:hover,
.chip:focus-visible {
  color: var(--text);
  border-color: var(--text-secondary);
}

.markdown {
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: 0.00938em;
  overflow-wrap: break-word;
}

.markdown > * + * {
  margin-top: 20px;
}

.markdown h2 {
  margin-top: 32px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--lines);
}

.markdown h2.md-h1 {
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.0075em;
  padding-bottom: 0;
  border-bottom: 0;
}

.markdown h3 {
  margin-top: 24px;
}

.markdown h4 {
  margin-top: 20px;
  font-size: 1.25rem;
  font-weight: 500;
}

.markdown ul,
.markdown ol {
  padding-left: 28px;
}

.markdown li + li {
  margin-top: 4px;
}

.markdown img {
  display: block;
  border-radius: 8px;
  box-shadow: var(--elevation-4);
}

.markdown picture {
  display: block;
}

.markdown p > img,
.markdown picture > img {
  margin: 0 auto;
}

.markdown blockquote {
  margin-left: 0;
  margin-right: 0;
  padding: 4px 16px;
  border-left: 4px solid var(--primary);
  color: var(--text-secondary);
}

.markdown table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}

.markdown th,
.markdown td {
  padding: 8px 12px;
  border: 1px solid var(--lines);
  text-align: left;
}

.markdown :not(pre) > code {
  padding: 2.5px 7.5px;
  border-radius: 5px;
  background: var(--lines);
  font-family: var(--mono);
  font-size: 0.9em;
}

.markdown .video iframe,
.markdown iframe {
  max-width: 100%;
}

/* Code blocks (Prism tokens, built at compile time) */
pre[class*="language-"] {
  margin: 20px 0 0;
  padding: 14px;
  overflow: auto;
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--code-text);
  font: 0.875rem/1.5 var(--mono);
  tab-size: 4;
}

code[class*="language-"] {
  font-family: var(--mono);
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--tok-comment);
  font-style: italic;
}

.token.keyword,
.token.atrule,
.token.important,
.token.selector,
.token.tag {
  color: var(--tok-keyword);
}

.token.string,
.token.char,
.token.attr-value,
.token.regex,
.token.inserted {
  color: var(--tok-string);
}

.token.number,
.token.boolean,
.token.constant,
.token.symbol,
.token.deleted {
  color: var(--tok-number);
}

.token.function,
.token.class-name,
.token.attr-name,
.token.property,
.token.builtin {
  color: var(--tok-function);
}

.token.punctuation,
.token.operator {
  color: var(--tok-punct);
}

/* Ads: labelled, space reserved up front so nothing jumps when they load */
.ad {
  display: block;
  text-align: center;
}

.ad__label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad--feed {
  padding: 8px;
  min-height: 140px;
}

.ad--in-article {
  margin: 28px 0;
  padding: 8px 0;
  min-height: 280px;
  border-top: 1px solid var(--lines);
  border-bottom: 1px solid var(--lines);
}

.ad--sidebar {
  position: sticky;
  top: 16px;
  width: 100%;
  max-width: 300px;
  min-height: 600px;
  margin: 0 auto;
}

.ad ins.adsbygoogle[data-ad-status="unfilled"] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
