/* ========================================
   Root Variables
======================================== */
:root {
  --font-serif: "Yrsa", serif;
  --font-sans: "Public Sans", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --color-bg-rgb: 248, 248, 248;
  --color-bg: rgb(var(--color-bg-rgb));

  --color-fg-rgb: 16, 16, 16;
  --color-fg: rgb(var(--color-fg-rgb));

  --color-fg-low-rgb: 187, 187, 187;
  --color-fg-low: rgb(var(--color-fg-low-rgb));

  --color-fg-high-rgb: 34, 119, 255;
  --color-fg-high: rgb(var(--color-fg-high-rgb));

  --color-pre-border-rgb: 238, 238, 238;
  --color-pre-border: rgb(var(--color-pre-border-rgb));

  --header-height: 47px;
  --main-max-width: clamp(200px, 1200px, 90%);

  --font-size-body: 14pt;
  --font-size-home: 22pt;
  --font-weight-default: 300;
  --font-weight-strong: 500;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg-rgb: 2, 9, 18;
    --color-bg: rgb(var(--color-bg-rgb));

    --color-fg-rgb: 238, 238, 238;
    --color-fg: rgb(var(--color-fg-rgb));

    --color-fg-low-rgb: 68, 68, 68;
    --color-fg-low: rgb(var(--color-fg-low-rgb));

    --color-fg-high-rgb: 34, 119, 255;
    --color-fg-high: rgb(var(--color-fg-high-rgb));

    --color-pre-border-rgb: 40, 40, 40;
    --color-pre-border: rgb(var(--color-pre-border-rgb));
  }
}

/* ========================================
   Base Layout
======================================== */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  font-family: var(--font-serif);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-default);
  color: var(--color-fg);
}

/* ========================================
   Header (Fixed Top Bar)
======================================== */
header {
  position: relative;
  z-index: 1000;
  font-family: var(--font-sans);
  font-size: 11pt;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  border-bottom: 1px solid var(--color-fg-low);
  color: var(--color-fg-low);
  min-height: var(--header-height);
}

.main-nav {
  display: flex;
  align-items: center;
}

.main-nav ul {
  display: flex;
  justify-content: space-around;
  gap: 1.2rem;
  align-items: center;
  flex: 1;
  list-style: none;
  width: 100%;
  margin: 0;
}

.main-nav li {
  display: flex;
  align-items: center;
}

.main-nav a {
  color: var(--color-fg);
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* ========================================
   Main Content Area
======================================== */
main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.container {
  max-width: var(--main-max-width);
  margin: 0 auto;
  text-align: left;
  line-height: 1.5;
}

a {
  color: var(--color-fg);
  text-decoration: underline;
}

strong {
  font-weight: var(--font-weight-strong);
}

img {
  width: clamp(350px, 80%, 850px);
  display: block;
  margin: 1rem auto;
}

/* ========================================
   Icons on home page
======================================== */
.icons {
  display: flex;
  gap: 20px;
}

.icons svg {
  width: 20px;
  height: 20px;
}

.icons svg path {
  fill: var(--color-fg-low);
  transition: fill 0.5s ease;
}

.icons a:hover svg path,
.icons a:focus svg path {
  fill: var(--color-fg);
}

.icons a {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========================================
   Page Entry
======================================== */
.page-entry {
  display: block;
  margin-bottom: 2rem;
  border-radius: 8px;
  text-decoration: none;
  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease;
  background-color: transparent;
}

.page-entry:hover {
  text-decoration: underline;
}

.page-date {
  display: block;
  color: var(--color-fg-high);
  font-family: var(--font-mono);
  font-size: 11pt;
  margin-bottom: 0.5rem;
}

.page-entry.external .page-date {
  color: #00b783;
}

.page-title {
  margin: 0 0 0.5rem;
  font-size: 16pt;
  font-weight: var(--font-weight-strong);
  color: var(--color-fg);
}

.page-subtitle {
  margin: 0;
  color: var(--color-fg);
  font-size: 14pt;
}

/* ========================================
   Basic styles for Markdown
======================================== */

pre {
  font-size: 10pt;
  line-height: 1.5;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid var(--color-pre-border);
  overflow: scroll;
}

pre::-webkit-scrollbar {
  display: none;
}

code {
  font-family: var(--font-mono);
}

p code,
ol li code,
ul li code {
  font-size: 11pt;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-sans);
}

h1 {
  font-weight: 600;
}

h2,
h3,
h4,
h5 {
  font-weight: 300;
}

h1 {
  font-size: 20pt;
}
h2 {
  font-size: 18pt;
}
h3 {
  font-size: 16pt;
}
h4 {
  font-size: 14pt;
}

/* ========================================
   Blog page
======================================== */

div.container.blog.page code.date {
  font-size: 11pt;
}

div.container.blog.page code.date span {
  color: var(--color-fg-high);
}

/* ========================================
   Home page
======================================== */

div.container.home {
  max-width: 90%;
  width: 90%;
  text-align: right;
  height: calc(100dvh - var(--header-height) - 1px);
  display: flex;
  flex-direction: column;
}

#home-headline {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

#home-headline h1 {
  font-size: 40pt;
  font-size: clamp(28pt, 6vw, 40pt);
  font-family: var(--font-serif);
  font-weight: var(--font-weight-default);
}

#home-headline h1 span {
  font-weight: var(--font-weight-strong);
}

#home-description {
  max-width: 1200px;
  font-size: 18pt;
  align-self: flex-end;
  padding-bottom: 3rem;
}

#home-description p, #home-headline h1 {
  margin: 0;
  margin-top: 2rem;
}
