/* ========================================
   CSS VARIABLES & THEME CONFIGURATION
   ======================================== */

:root {
  --background-color: #fff;
  --text-color: #000;
  --text-secondary: #667;
  --link-color: blue;
  --header-border-color: #000;
  --code-background-color: #eee;
  --code-text-color: #ec0000;
  --accent-color: #d21c1c;
  --bg-gray-focus: rgba(0, 0, 0, 0.1);
}

[data-theme='dark'] {
  --background-color: #121212;
  --text-color: #fff;
  --text-secondary: #888;
  --link-color: #bb86fc;
  --header-border-color: #fff;
  --code-background-color: #333;
  --code-text-color: #ff6b6b;
  --accent-color: #ff4757;
  --bg-gray-focus: rgba(255, 255, 255, 0.1);
}

/* ========================================
   RESPONSIVE TYPOGRAPHY & BASE LAYOUT
   ======================================== */

@media all {
  html {
    font-size: 24px;
  }

  body > * {
    font-size: 100%;
    margin-left: 7.5rem;
    margin-right: 7.5rem;
  }
}

@media all and (max-width: 840px) {
  html {
    font-size: 20px;
  }

  body > * {
    margin-left: 5.5rem;
    margin-right: 5.5rem;
  }
}

@media all and (max-width: 760px) {
  body > * {
    margin-left: 2.5rem;
    margin-right: 2.5rem;
  }
}

@media all and (max-width: 580px) {
  html {
    font-size: 18px;
  }

  body > * {
    margin: 0.7rem 1.5rem 0 1.5rem;
  }
}

/* ========================================
   HTML & BODY RESETS
   ======================================== */

html {
  height: 100%;
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  padding: 0rem 0em 0rem 0em;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: 1200px;
  min-height: 100%;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1;
  font-feature-settings: 'liga' 1;
}

* {
  margin: 0;
  padding: 0;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

p {
  text-align: justify;
  margin-bottom: 1em;
  line-height: 1.45;
}

p:has(img) {
  text-align: center;
}

h1 {
  display: block;
  font-size: 170%;
  line-height: 1.1;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  padding-top: 0.02em;
  hyphens: none;
}

h2 {
  padding-top: 0.02em;
  margin-top: 0.7rem;
  margin-bottom: 1.1rem;
}

h3 {
  padding-top: 0.02em;
  margin-top: 0.7rem;
  margin-bottom: 1.1rem;
}

aside {
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

aside em {
  font-size: 0.7rem;
}

/* ========================================
   LISTS & LINKS
   ======================================== */

ul,
ol {
  margin-bottom: 1em;
  padding-left: 1em;
}

li {
  line-height: 1.75;
}

a {
  text-decoration: none;
  color: var(--link-color);
  transition-property: background;
  transition-duration: 0.2s;
}

a:active {
  color: #777;
}

a:hover {
  transition-property: background;
  transition-duration: 0.2s;
  text-decoration: underline;
}

/* ========================================
   CODE BLOCKS & INLINE CODE
   ======================================== */

pre {
  font-size: 0.75rem;
  font-family: courier, monospace;
  margin-bottom: 1em;
  background-color: var(--code-background-color);
  padding: 1em;
  border-radius: 5px;
}

pre > code {
  white-space: pre-wrap;
}

:not(pre) > code {
  hyphens: none;
  border-radius: 3px;
  font-family: courier, monospace;
  font-size: 85%;
  color: var(--code-text-color);
  padding: 0 3px;
  white-space: pre-wrap;
}

/* ========================================
   MAIN LAYOUT & CONTAINER
   ======================================== */

.container {
  display: grid;
  grid-template-columns: auto;
  grid-template-rows: auto auto 30px;
  grid-template-areas: 'header' 'content' 'footer';
  row-gap: 1em;
  margin-left: auto;
  margin-right: auto;
  padding-left: 0.7em;
  padding-right: 0.7em;
}

.container > header {
  margin-top: 1em;
}

@media all and (max-width: 520px) {
  .container > header {
    margin-top: 0;
  }
}

.container .content {
  grid-area: content;
  display: grid;
  grid-auto-flow: row;
  row-gap: 0.6em;
}

@media all and (max-width: 520px) {
  .content {
    padding: 0;
  }
}

.container > footer {
  grid-area: footer;
}

.container > footer > ul {
  display: grid;
  grid-auto-flow: column;
  padding: 0;
  margin: 0;
  gap: 10px;
  justify-content: center;
}

.container > footer > ul > li {
  list-style-type: none;
  line-height: normal;
}

.container > footer > ul > li > a {
  color: var(--text-color);
}

.container > footer > ul > li > a::after {
  position: relative;
  content: '\FEFF°';
  margin-left: 0.1em;
  font-size: 80%;
  top: -0.3em;
  left: -0.1em;
  color: var(--accent-color);
}

/* ========================================
   NAVIGATION & HAMBURGER MENU
   ======================================== */

.main-nav {
  display: grid;
  grid-template-columns: max-content auto;
  padding: 0 0 0.6em 0;
  border-bottom: 0.1em solid var(--header-border-color);
  align-items: center;
}

/* Theme toggle button positioned after nav links on desktop */
.main-nav > #theme-toggle {
  order: 1;
}

.nav-links {
  display: grid;
  grid-template-columns: repeat(4, max-content) max-content 1fr;
  column-gap: 1.3em;
  margin: 0;
  align-items: center;
  padding: 0;
}

/* Theme toggle buttons styling */
#theme-toggle,
#theme-toggle-nav {
  background: none;
  border: none;
  padding: 0.2em;
  font-size: 1.1em;
  transition:
    background 0.18s,
    color 0.18s;
  justify-self: end;
}

#theme-toggle:hover,
#theme-toggle:focus,
#theme-toggle-nav:hover,
#theme-toggle-nav:focus {
  background: var(--bg-gray-focus);
  color: var(--link-color);
  outline: none;
}

.theme-icon {
  display: block;
  font-size: 1em;
}

.nav-links > li {
  list-style-type: none;
  line-height: normal;
}

.nav-links > li > a {
  max-width: fit-content;
  text-transform: lowercase;
  font-weight: bold;
  color: var(--text-color);
}

.nav-links > li > a:after {
  position: relative;
  content: '\FEFF°';
  margin-left: 0.1em;
  font-size: 80%;
  top: -0.3em;
  left: -0.1em;
  color: var(--accent-color);
}

/* Hamburger menu button */
.hamburger {
  display: none;
  grid-auto-flow: row;
  width: 20px;
  height: 25px;
  justify-self: end;
}

.hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: var(--text-color);
  border-radius: 5px;
  transition: all 0.3s ease-in-out;
}

/* Mobile navigation */
@media all and (max-width: 520px) {
  .hamburger {
    display: grid;
  }

  .main-nav > #theme-toggle {
    order: -1;
    padding: 0;
    justify-self: start;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 0;
    margin-top: 50px;
    left: 0;
    width: 100%;
    background-color: var(--background-color);
    grid-template-columns: auto;
    grid-auto-flow: row;
  }

  .main-nav.nav-open .nav-links {
    display: grid;
  }

  .main-nav.nav-open .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 4px);
  }

  .main-nav.nav-open .hamburger span:nth-child(2) {
    opacity: 0;
  }

  .main-nav.nav-open .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -4px);
  }

  .nav-links > li {
    display: flex;
    padding: 1em;
    border-bottom: 1px solid var(--header-border-color);
    justify-content: center;
    align-content: center;
  }
}

/* ========================================
   THEME TOGGLE
   ======================================== */

#theme-toggle {
  background: none;
  border: none;
  /* padding: 0.2em; */
  font-size: 1.1em;
  transition:
    background 0.18s,
    color 0.18s;
  justify-self: end;
}

#theme-toggle:hover,
#theme-toggle:focus {
  background: var(--bg-gray-focus);
  color: var(--link-color);
  outline: none;
}

.theme-icon {
  display: block;
  font-size: 1em;
}

/* ========================================
   BLOG STYLES
   ======================================== */

/* Blog index page */
.blog-month > ul {
  padding: 0;
}

.blog-month > ul > li {
  list-style-type: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.blog-month > ul > li > a {
  grid-column: 1;
  max-width: fit-content;
}

.blog-month > ul > li > span {
  grid-column: 2;
  max-width: fit-content;
  justify-self: end;
}

/* Blog entry page */
.article-header {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas: 'title date';
  align-items: center;
}

.article-header > h1 {
  grid-area: title;
  margin: 0;
  padding: 0;
}

.article-header > h2 {
  grid-area: date;
  align-self: center;
  justify-self: right;
  font-size: 18px;
  margin: 0;
  padding: 0;
}

@media all and (max-width: 840px) {
  .article-header {
    grid-template-rows: auto auto;
    grid-template-areas:
      'title'
      'date';
  }
  .article-header > h2 {
    justify-self: left;
    margin-top: 0.7em;
  }
}

/* Blog table of contents */
nav.blog-toc ul {
  margin-bottom: 0;
}

/* ========================================
   RESUME STYLES
   ======================================== */

.resume {
  display: grid;
  font-size: medium;
  grid-template-areas: 'header' 'summary' 'skills' 'experience' 'side-projects' 'interests';
  background-color: #eeede7;
  margin-top: 4em;
  border: solid #667;
  border-width: 10px 0 0 0;
  padding: 4em;
}

.resume a {
  text-decoration: underline;
  text-decoration-color: #868b8e;
  text-decoration-thickness: 2px;
}

.resume a:hover {
  color: #666;
}

/* Resume header section */
.resume-header {
  grid-area: header;
  display: grid;
  grid-template-areas: 'title links';
  align-items: start;
}

.resume-header > .title {
  grid-area: title;
  align-self: start;
}

.resume-header > .title > h1 {
  margin-top: 0;
}

.resume-header > .title > h2 {
  margin-top: 0;
  font-style: italic;
}

.resume-header > .links {
  grid-area: links;
  text-align: end;
  grid-template-columns: max-content minmax(20px, max-content);
  align-items: center;
  justify-self: end;
}

/* Resume section styling */
.resume-summary {
  margin-top: 3em;
  grid-area: summary;
  border: solid #667;
  border-width: 0 0 1px 0;
}

.resume-skills {
  margin-top: 2em;
  grid-area: skills;
  border: solid #667;
  border-width: 0 0 1px 0;
}

.resume-experience {
  margin-top: 2em;
  grid-area: experience;
  border: solid #667;
  border-width: 0 0 1px 0;
}

.resume-side-projects {
  margin-top: 2em;
  grid-area: side-projects;
  border: solid #667;
  border-width: 0 0 1px 0;
}

.resume-interests {
  margin-top: 2em;
  grid-area: interests;
  border: solid #667;
  border-width: 0 0 1px 0;
}

/* Work experience entries */
.work-experience {
  display: grid;
  grid-template-areas: 'company date' 'job job' 'description description';
  margin-top: 2em;
}

.work-experience > h3 {
  grid-area: company;
  color: #eb1e2b;
  padding: 0;
  margin-top: 0;
}

.work-experience > p {
  grid-area: date;
  justify-self: end;
}

.work-experience > h4 {
  grid-area: job;
  margin-bottom: 1em;
}

.work-experience > div {
  grid-area: description;
}

/* Resume mobile links */
.resume-mobile-links {
  margin-top: 2em;
}

.resume-mobile-links > .links {
  display: grid;
  grid-template-columns: max-content max-content;
  justify-items: start;
  justify-content: space-around;
  align-items: center;
  list-style-type: none;
  margin: 0;
  padding: 0;
}

/* Resume responsive design */
@media all {
  .resume-header > .links {
    display: grid;
  }

  .resume-mobile-links {
    display: none;
  }
}

@media all and (max-width: 840px) {
  .resume {
    padding: 0.7em;
    margin: 0;
  }

  .resume-header > .title > h1 {
    font-size: 24px;
  }

  .resume-header > .title > h2 {
    font-size: 20px;
  }

  .resume-header > .links {
    display: none;
  }

  .resume-mobile-links {
    display: block;
  }
}
