:root {
  --bg-color: #fff;
  --text-color: #020817;
  --heading-1: 2rem;
  --heading-2: 1.8rem;
  --heading-3: 1.5rem;
  --heading-4: 1.2rem;
  --paragraph: 1rem;
  --small: 0.8rem;
}

/* General Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
  overflow-anchor: none;
}

a {
  text-decoration: none;
  color: inherit;
}

img,
svg {
  max-width: 100%;
}

ol,
ul,
dl {
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
}

h1 {
  font-size: var(--heading-1);
}

h2 {
  font-size: var(--heading-2);
}

h3 {
  font-size: var(--heading-3);
}

h4 {
  font-size: var(--heading-4);
}

p {
  font-size: var(--paragraph);
}

body {
  font-weight: normal;
  line-height: 1.6;
  font-size: 1rem;
  font-family: InterVariable, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
}

/* Utility Classes */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.grid-cols-6 {
  grid-template-columns: repeat(6, 1fr);
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.justify-start {
  justify-content: start;
}

.justify-end {
  justify-content: end;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: start;
}

.items-end {
  align-items: end;
}

.items-baseline {
  align-items: baseline;
}

.items-stretch {
  align-items: stretch;
}

.text-center {
  text-align: center;
}

.btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid #aaa;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: #000;
  color: #fff;
}

.btn-primary:hover {
  background-color: #fff;
  color: #000;
}

.btn-secondary {
  background-color: #fff;
  color: #000;
}

.btn-secondary:hover {
  background-color: #000;
  color: #fff;
}

.container {
  width: 90%;
  margin-inline: auto;
}

/* Others */
.logo {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(2, 8, 23, 0.06), 0 4px 12px rgba(2, 8, 23, 0.18);
}

.logo img {
  position: absolute;
  inset: 0;
  display: block;
  object-fit: cover;
  border-radius: 50%;
  width: 100%;
  height: 100%;
  color: transparent;
  cursor: pointer;
}

.content {
  min-height: calc(100vh - 80px);
  padding-top: 2rem;
}

.hero {
  padding-block: 6rem 2rem;
  text-align: start;
}

.hero .logo {
  margin-bottom: 1.5rem;
}

.hero .helpers {
  margin-block: 0.5rem 1.5rem;
}

.intro-copy {
  gap: 1rem;
  max-width: 60ch;
}

/* Where I've worked */
#work .section-heading,
#writing .section-heading,
#contact .section-heading,
#projects .section-heading {
  font-size: var(--paragraph);
  margin-bottom: 0.5rem;
}

.section-copy {
  gap: 1rem;
  max-width: 60ch;
}

.contact-list {
  margin-top: 1rem;
  gap: 1.1rem;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  width: fit-content;
}

.contact-item svg {
  width: 16px;
  height: 16px;
  color: #64748b;
  flex-shrink: 0;
}

.contact-item.email span {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

/* click-to-copy email button */
button.contact-item {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.copy-email {
  position: relative;
}

.copy-email::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  white-space: nowrap;
  background-color: #0f172a;
  color: #fff;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.copy-email:hover::after,
.copy-email:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.writing-list {
  margin-top: 1rem;
  gap: 1.4rem;
}

.writing-list a {
  width: fit-content;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

#work > p {
  max-width: 60ch;
}

.work-grid {
  grid-template-columns: 1fr;
  gap: 2.5rem 2rem;
  margin-top: 2rem;
}

.work-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.work-tile.growy,
.work-tile.lumilearn,
.work-tile.nuvo,
.work-tile.pullus,
.work-tile.wike,
.work-tile.xurl {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.work-tile.wike,
.work-tile.xurl {
  color: var(--text-color);
}

.work-tile.growy img {
  width: 40%;
  max-width: 180px;
}

.work-tile img {
  width: 60%;
  max-width: 240px;
  height: auto;
}

.work-card h4 {
  font-size: var(--paragraph);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.work-card .arrow {
  font-size: 0.8em;
}

.work-card > p {
  color: #64748b;
  font-size: var(--small);
}

@media (min-width: 768px) {
  .work-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Preloader */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
  color: #fff;
  transition: opacity 0.6s ease;
}

.preloader p {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.15rem, 0.5vw, 0.3rem);
  padding-inline: 1.5rem;
  text-align: center;
  animation: preloaderIn 0.8s ease both;
}

.preloader-name {
  font-size: clamp(1.25rem, 6vw, 1.75rem);
  line-height: 1.2;
}

/* blinking cursor shown while the name is being typed */
.preloader-name::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.12em;
  background-color: currentColor;
  opacity: 0;
}

.preloader.typing .preloader-name::after {
  opacity: 1;
  animation: preloaderCaret 0.8s step-end infinite;
}

.preloader-role {
  font-size: clamp(0.75rem, 3vw, 0.9rem);
  color: #94a3b8;
  opacity: 0;
}

/* role appears instantly once the name has finished typing */
.preloader.typed .preloader-role {
  opacity: 1;
}

@keyframes preloaderCaret {
  50% {
    opacity: 0;
  }
}

.preloader.done {
  opacity: 0;
  pointer-events: none;
}

@keyframes preloaderIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .preloader p {
    animation: none;
  }

  /* no typing animation runs, so show the role and hide the caret */
  .preloader-role {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .preloader-name::after {
    display: none;
  }
}

/* Side navigation */
.side-nav {
  position: fixed;
  left: 2rem;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 50;
}

.side-nav a {
  width: fit-content;
  color: #94a3b8;
  transition: color 0.2s ease;
}

.side-nav a:hover,
.side-nav a.active {
  color: var(--text-color);
}

@media (min-width: 1100px) {
  .side-nav {
    display: flex;
  }
}

/* Single-page sections */
.page-section {
  padding-block: 4rem;
  scroll-margin-top: 2rem;
}

@media (max-width: 767px) {
  .hero {
    padding-block: 4rem 1.5rem;
  }

  .page-section {
    padding-block: 2.5rem;
  }
}

.section-heading {
  margin-bottom: 1.5rem;
}

/* Scroll reveal effect */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.hero h1 {
  font-size: var(--paragraph);
  font-weight: 400;
}

.hero-name {
  text-decoration: underline;
  text-decoration-color: red;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.articles,
.projects {
  margin-bottom: 3rem;
}

.helpers {
  position: relative;
  height: 2.5em;
  overflow: hidden;
  gap: 1rem;
}

.helper {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  font-size: var(--small);
}

.helper.show {
  animation: slideIn 0.5s ease-out forwards;
  pointer-events: auto;
}

.helper.hide {
  animation: slideOut 0.4s ease-in forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

.pronunciation {
  background-color: #eee;
  padding: 2px 4px;
}

.details {
  gap: 2rem;
  margin-block: 2rem;
  list-style-type: square;
  padding-left: 1rem;
}

.details li {
  text-align: justify;
}

.intro-start h3 {
  font-size: var(--heading-4);
  text-decoration: underline;
  text-decoration-color: red;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.1em;
}

.career {
  padding-bottom: 2rem;
}

.career dt {
  font-size: var(--heading-4);
  font-weight: 700;
}

.career dt:not(:first-child) {
  margin-top: 1.5rem;
}

.backstory,
.experience {
  margin-top: 2rem;
}

/*.experience  dl, */
.experience dd {
  display: list-item;
  list-style-type: disc;
  margin-left: 1rem;
}

.external-link {
  text-decoration: underline;
  text-decoration-color: red;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.writings {
  margin-top: 1.5rem;
  gap: 1rem;
}

.writing p {
  font-size: var(--small);
  font-style: italic;
}

.article-title {
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.article-content {
  gap: 1.5rem;
  padding-bottom: 4rem;
}

.article-content pre {
  background-color: #f6f8fa;
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  margin: 0;
}

.article-content pre code {
  background-color: transparent;
  padding: 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
  line-height: 1.5;
}

.article-content code {
  background-color: #f6f8fa;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
}

.lost {
  height: calc(100vh - 192px);
  gap: 0.8rem;
}

.lost .back-home {
  margin-top: 2rem;
}

.footer {
  margin-top: auto;
  padding-block: 1rem;
  height: 80px;
}

@media (min-width: 768px) {
  .content > .container {
    width: min(90%, 680px);
  }

  .intro-start {
    flex-direction: row;
    gap: 0.3rem;
    align-items: center;
  }

  .intro-start h3 {
    font-size: var(--heading-3);
  }

  .helpers {
    height: 2em;
  }
}

