:root {
    --nav-height: 40px;
    --nav-padding-y: 15px;
    --anchor-gap: 0.75rem;
    --nav-offset: calc(var(--nav-height) + (var(--nav-padding-y) * 2) + var(--anchor-gap));
    --ff: sans-serif;
    --text-width: 80ch;


    --bg:		 hsl(0 0% 98%);
    --bg-dark:		 hsl(0 0% 95%);
    --bg-light:		 hsl(0 0% 99%);
    --nav-bg:		 hsla(0 0% 98% / 0.5);

    --color-text:	 hsl(0, 0%, 10%);
    --color-text-muted:	 hsl(0, 0%, 40%);
    --color-accent:	 hsl(327, 100%, 45%); /* e5007e */
    --color-border:	 hsl(0 0% 50%);

    --h1:	 600 1.6rem/1em var(--ff);
    --h2:	 500 1.2rem/1.2em var(--ff);
    --h3:	 500 1.05rem/1.2em var(--ff);
    --p:	 400 1rem/1.65em var(--ff);
    --p2:	 0.875rem/1.45em var(--ff);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:			hsl(0 0% 8%);
        --bg-dark:		hsl(0 0% 12%);
        --bg-light:		hsl(0 0% 10%);
        --nav-bg:		hsla(0 0% 8% / 0.5);

        --color-text:		hsl(0 0% 92%);
        --color-text-muted:	hsl(0 0% 65%);
        --color-accent:		hsl(327 100% 60%);
        --color-border:		hsl(0 0% 30%);
    }
}

:root[data-theme="dark"] {
    --bg:            hsl(0 0% 8%);
    --bg-dark:       hsl(0 0% 12%);
    --bg-light:      hsl(0 0% 10%);
    --nav-bg:        hsla(0 0% 8% / 0.5);

    --color-text:    hsl(0 0% 92%);
    --color-text-muted: hsl(0 0% 65%);
    --color-accent:  hsl(327 100% 60%);
    --color-border:  hsl(0 0% 30%);
}

:root[data-theme="light"] {
    --bg:         hsl(0 0% 98%);
    --bg-dark:    hsl(0 0% 95%);
    --bg-light:   hsl(0 0% 99%);
    --nav-bg:     hsla(0 0% 98% / 0.5);

    --color-text:       hsl(0, 0%, 10%);
    --color-text-muted: hsl(0, 0%, 40%);
    --color-accent:     hsl(327, 100%, 45%);
    --color-border:     hsl(0 0% 50%);
}

body {
    padding: 0;
    margin: 0;
    font-family: var(--ff);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    background: var(--bg);
    color: var(--color-text);
}

footer {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-light);
    border-top: 1px solid var(--bg-dark);
    height: 3rem;
}

footer p {
    font: var(--p2);
    
color: var(--color-text-muted);
    margin: 0;
    padding: 0;
}

ul {
    padding: 1rem;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  scroll-margin-top: var(--nav-offset);
}

h1 {
    font: var(--h1);
}

h2 {
    font: var(--h2);
}

h3 {
    font: var(--h3);
}

blockquote p {
    color: var(--color-text-muted);
    font-style: italic;
}

p {
  font: var(--p);
  margin: 0 0 1.2em;
}

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

.hero {
    height: 92vh;
    padding: 0;
    margin: 0;
}

.hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

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

.navbar {
    /* position: sticky; */
    /* top: 0; */
    /* z-index: 1000; */
    /* background: var(--bg-light); */
    /* display: flex; */
    /* justify-content: center; */
    /* align-items: center; */
    /* border-bottom: 0.1px solid var(--bg-dark); */
    /* border-top: 0.1px solid var(--bg-dark); */
    /* padding: var(--nav-padding-y) 0; */
    /* height: var(--nav-height); */
    display: flex;
    min-height: var(--nav-height);
    margin: 0.75rem;
    justify-content: space-between;
    align-items: center;
    
}

.top {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-columns: 1fr 90ch 1fr;
    border-bottom: 0.1px solid var(--bg-dark);
    border-top: 0.1px solid var(--bg-dark);
    background: var(--bg-light);
}

.navbar-logo {
    height: 45px;
}

.navbar-logo--dark {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .navbar-logo--light {
        display: none;
    }

    :root:not([data-theme="light"]) .navbar-logo--dark {
        display: inline;
    }
}

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

:root[data-theme="dark"] .navbar-logo--dark {
    display: inline;
}

.theme-logo {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 0 1.5rem;
}

.theme-logo--light {
    display: block;
}

.theme-logo--dark {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-logo--light {
        display: none;
    }

    :root:not([data-theme="light"]) .theme-logo--dark {
        display: block;
    }
}

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

:root[data-theme="dark"] .theme-logo--dark {
    display: block;
}

.navbar-buttons {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    font-size: 1.1rem;
    margin-left: 1.5rem;
    color: var(--color-text);
    font-weight: 400;
    font-family: sans-serif;
    align-items: center;
}

.navbar-buttons li {
    position: relative;
}

.navbar-buttons a,
.navbar-buttons button {
    text-decoration: none;
    color: var(--color-text);
    padding: 0.5rem 0;
    display: inline-block;
    white-space: nowrap;
}

.navbar-buttons a:hover {
    color: var(--color-accent);
}

.theme-toggle {
    margin-left: 0;
    border: none;
    background: transparent;
    color: var(--color-text);
    padding: 0;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    line-height: 1;
}

.theme-toggle:hover {
    background: transparent;
    color: var(--color-accent);
}

.theme-toggle .icon {
    display: none;
    width: 1rem;
    height: 1rem;
}

.theme-toggle .icon svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: currentColor;
}

.theme-toggle[data-state="light"] .icon-sun {
    display: block;
}

.theme-toggle[data-state="dark"] .icon-moon {
    display: block;
}

.content {
    display: grid;
    grid-template-columns: 1fr var(--text-width) 1fr;
    min-height: 100vh;
    padding-bottom: 2rem;
}


.blog-title {
    font-size: var(--h2);
}

.article-title {
    margin-bottom: 0.25rem;
    font: 600 1.65rem/1.2em var(--ff);
}

.article-title a {
    text-decoration: none;
    color: var(--color-text);
}

.article-meta {
    color: var(--color-text-muted);
    font: var(--p2);
}

.excerpt {
    margin: 0.9rem 0 0;
}

.read-more {
    margin: 0.75rem 0 1rem;
    font: var(--p2);
}

.read-more a {
    color: var(--color-text-muted);
    text-decoration: none;
}

.read-more a:hover {
    color: var(--color-accent);
}

.back-link {
    margin: 1rem 0 1.75rem;
}

.back-link .btn {
    display: inline;
    padding: 0;
    font: var(--p2);
    font-weight: 500;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    border-radius: 0;
    text-decoration: none;
}

.back-link .btn:hover {
    color: var(--color-accent);
    background: transparent;
}

.blog-article {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--bg-dark);
}

.blog-article:first-of-type {
    padding-top: 0.5rem;
}

.blog-article:last-of-type {
    border-bottom: none;
    padding-bottom: 0.5rem;
}

.logo-gallery {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  width: 100%;
  padding: 0 1rem;
}

.logo-gallery img {
  height: 150px;
}


/* submenu box */
.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--bg-light);
  border: 1px solid var(--bg-dark);
  border-radius: 0.5rem;
  list-style: none;
  padding: 0.5rem 0;
  margin: 0;

  opacity: 0;
  visibility: hidden;
  transform: translateY(5px);
  transition: 0.15s ease;
  z-index: 3000;
}

/* submenu items */
.submenu li a {
  display: block;
  padding: 0.5rem 1rem;
  white-space: nowrap;
  font-size: 0.95rem;
}

.submenu li button {
  display: inline-flex;
  align-items: center;
  width: 100%;
  padding: 0.5rem 1rem;
  text-align: left;
  white-space: nowrap;
  background: transparent;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.2;
}

.submenu-icon {
  width: 0.95rem;
  height: 0.95rem;
  margin-right: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.submenu-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
}

.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.submenu li a:hover {
  background: var(--bg-dark);
}

.submenu li button:hover {
  background: var(--bg-dark);
}

.submenu li button[aria-current="true"] {
  font-weight: 600;
}


/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.gallery a {
  display: block;
  border-radius: 0.75rem;
  overflow: hidden;
  line-height: 0;
}

.gallery img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  transition: transform 160ms ease;
}

@media (hover: hover) {
  .gallery a:hover img { transform: scale(1.03); }
}

.gallery figcaption {
  line-height: 1.3;
  font-size: 0.9rem;
  margin-top: 0.35rem;
  opacity: 0.85;
}

.plain-list {
    list-style: none;
    padding: 0;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 0.5rem;
  background: var(--bg-dark, #0055cc);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn:hover {
  background: color-mix(in srgb, var(--color-accent) 85%, white);
}

.btn:active {
  transform: translateY(1px);
}

.right {
    padding: 2em 2em;
    color: var(--color-text-muted);
    overflow-y: auto;
    max-height: 70vh;
    position: sticky;
    top: 1rem;
}

#TableOfContents ul {
    list-style: none;
    padding: 0;
    font: var(--p2);
}

#TableOfContents a {
    text-decoration: none;
    color: var(--color-text-muted);
}

#TableOfContents a:hover {
    color: var(--color-accent);
}

#TableOfContents ul>li>ul {
    padding-left: 1em;
}

@media (max-width: 1300px) {
    .content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        row-gap: 0;
        justify-items: center;
    }

    .content > :first-child {
        display: none;
    }

    .content > :nth-child(2) {
        grid-row: 2;
        width: min(100%, var(--text-width));
    }

    .content > :nth-child(3) {
        grid-row: 1;
        width: min(100%, var(--text-width));
    }

    .right {
        position: static;
        top: auto;
        max-height: none;
        overflow: visible;
        padding: 1rem 0 0.75rem;
    }

    .right h2 {
        margin-top: 0;
    }
}
