@import url('theme.css');

:root {
  --header-height: 80px;
}

@view-transition {
  navigation: auto;
}

* {
  box-sizing: border-box;
  scroll-behavior: smooth;
}

body {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  margin: 0;
  line-height: 1.6;
  min-height: 100vh;
  background-color: var(--bg-primary);
}

.content-wrapper {
  display: flex;
  flex: 1;
}

aside {
  width: var(--sidebar-width);
  padding: 1.5rem;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  position: sticky;
  height: calc(100vh - var(--header-height, 0px));
  top: var(--header-height, 0px);
}

main {
  flex: 1;
  padding: 2rem;
  max-width: 850px;
  margin: 0 auto;
}

nav ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

nav ul li {
  margin: 0;
  width: fit-content;
}

nav ul a {
  padding-left: 1rem;
  border-left: 1px solid transparent;
}

nav a:hover {
  color: var(--primary-hover);
  text-decoration: none;
}

nav a.active {
  color: var(--primary-hover);
  font-weight: 500;
  text-decoration: underline;
  border-left: 1px solid var(--primary-color);
}
nav :has(.secondLevelHeadlines) a.active::after {
  content: " >";
  text-decoration: none;
}

details {
  margin-bottom: 1rem;
}

summary {
  cursor: pointer;
  font-weight: 500;
  margin-bottom: 0.5rem;
  user-select: none;
}

summary::marker {
  content: none;
}
summary::after {
  content: ">";
  margin-right: 0.5rem;
  display: inline-block;
  transition: transform 0.2s ease;
  position: absolute;
  right: 1rem;
}
details[open] summary::after {
  transform: rotate(90deg);
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
  font-weight: 600;
}

h1 {
  font-size: 2rem;
  margin-top: 0;
  padding-bottom: 0.5rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

a {
  color: var(--primary-color);
}
a:hover {
  color: var(--primary-hover);
}

a[href^="http"]:not([href*="picossg.dev"])::after {
  content: "↗";
}

nav a {
  color: var(--text-color);
  display: block;
  transition: color 0.2s;
}

p, ul, ol {
  margin-bottom: 1.5rem;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  background-color: var(--code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
  border: 1px solid var(--border-color);
  color: var(--code-text);
}

nav li code {
  border: none;
  padding: 0;
}

pre {
  background-color: var(--code-bg);
  padding: 1rem;
  border-radius: 5px;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
}

pre code {
  background-color: transparent;
  padding: 0;
  border: none;
}

blockquote {
  border-left: 4px solid var(--primary-color);
  margin-left: 0;
  padding-left: 1rem;
  color: var(--blockquote-text);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

th, td {
  padding: 0.75rem;
  border: 1px solid var(--border-color);
}

th {
  background-color: var(--bg-secondary);
  font-weight: 600;
  text-align: left;
}


/* Theme toggle button */
.theme-toggle {
  background: var(--theme-toggle-bg);
  border: 1px solid var(--theme-toggle-border);
  color: var(--theme-toggle-text);
  cursor: pointer;
  padding: 0.5rem;
  margin: 0.5rem;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  color: var(--primary-hover);
  border-color: var(--primary-color);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  
  border-bottom: 1px solid var(--primary-color);
  position: sticky;
  top: 0;
  background-color: var(--bg-primary);
  z-index: 100;
  height: var(--header-height);
}

.secondLevelHeadlines {
  font-size: smaller;
  position: absolute;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  transition-delay: 0.5s;
  background: var(--bg-primary);
  border: 1px solid var(--primary-color);
  border-radius: 4px;
  padding: 8px;
  z-index: 10;
  left: 100%;
  top: 0;
  min-width: 200px;
}

nav li {
  position: relative;
}

nav li:hover .secondLevelHeadlines {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

ul.secondLevelHeadlines {
  margin-top: 0;
}
.secondLevelHeadlines li {
  margin: 0;
  white-space: nowrap;
}
.secondLevelHeadlines a {
  padding: 0;
}

/* Add scroll offset for main content to account for sticky header */
main :is(h1, h2, h3, h4, h5, h6) {
  scroll-margin-top: calc(var(--header-height) + 1rem);
}



@media (max-width: 768px) {
  .content-wrapper {
    flex-direction: column;
  }

  aside {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  aside .meta {
    display: none;
  }

  main {
    padding: 1.5rem;
  }
}

