/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Jacquarda+Bastarda+9&family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&family=Public+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  min-height: 100vh;
}

:root {
  --bg: #ffffff;
  --text: #000000;
  --border: #000000;
  --link: #000000;
  --link-hover: rgb(232, 89, 0);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --text: #ffffff;
    --border: #ffffff;
    --link: #ffffff;
    --link-hover: #ffdd00;
  }
}

body {
  font-family: 'PT Serif', serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
}

main, header {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
}

body.page-loaded {
  opacity: 1;
}

body.page-leaving {
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.6, 1);
}

/* Header */
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

h1 {
  font-family: 'Jacquarda Bastarda 9', serif;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 4px;
}

h1 a {
  text-decoration: none;
  color: var(--text);
}

.subtitle {
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
}

nav a {
  text-decoration: none;
  color: var(--link);
  font-size: 16px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

nav a:hover {
  color: var(--link-hover);
  background-color: rgba(232, 89, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
  nav a:hover {
    background-color: rgba(255, 221, 0, 0.15);
  }
}

/* Year sections on homepage */
.year-section {
  margin-bottom: 60px;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 40px;
}

.year {
  font-family: 'Public Sans', sans-serif;
  font-size: 24px;
  font-weight: 700;
  position: sticky;
  top: 40px;
  align-self: start;
}

/* Three-column grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 40px;
}

.post-card {
  padding: 0;
  min-height: 120px;
}

.post-card h3 {
  font-family: 'Public Sans', sans-serif;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}

.post-card h3 a {
  text-decoration: none;
  color: var(--link);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.post-card h3 a:hover {
  color: var(--link-hover);
  background-color: rgba(232, 89, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
  .post-card h3 a:hover {
    background-color: rgba(255, 221, 0, 0.15);
  }
}

.post-card p {
  font-size: 15px;
  line-height: 1.5;
}
.post-date {
  margin-top: 8px;
  color: #929292;
}

.post-category {
  font-family: 'Public Sans', sans-serif;
  font-style: italic;
  font-weight: 400;
  text-decoration: none;
  color: #929292;
  transition: color 0.3s ease;
}

.post-category:hover {
  color: var(--link-hover);
}

@media (prefers-color-scheme: dark) {
  .post-category {
    color: #929292;
  }
}
/* Post detail page */
.post-detail {
  max-width: 800px;
  margin: 0 auto 120px;
}

/* Posts archive below each post */
/* .posts-archive {
  margin-top: 120px;
  padding-top: 60px;
  border-top: 1px solid var(--border);
} */

.archive-header {
  margin-bottom: 60px;
  padding: 40px 0 0 0;
}

.post-detail h1 {
  font-family: 'Public Sans', sans-serif;
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.2;
}

.post-title-clickable {
  cursor: pointer;
  transition: color 0.2s ease;
}

.post-title-clickable:hover {
  color: var(--link-hover);
}

.post-meta {
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.post-meta time {
  font-size: 14px;
  color: #929292;
}

.post-content {
  font-size: 18px;
  line-height: 1.7;
}

.post-content h2 {
  font-family: 'Public Sans', sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin: 40px 0 20px;
  line-height: 1.3;
}

.post-content h3 {
  font-family: 'Public Sans', sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin: 32px 0 16px;
  line-height: 1.3;
}

.post-content p {
  margin-bottom: 20px;
}

.post-content a {
  color: var(--link-hover);
  background-color: rgba(232, 89, 0, 0.15);
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.post-content a:hover {
  color: rgb(255, 98, 0);
  background-color: rgba(232, 89, 0, 0.25);
}

@media (prefers-color-scheme: dark) {
  .post-content a {
    background-color: rgba(255, 221, 0, 0.15);
  }

  .post-content a:hover {
    color: #ffee33;
    background-color: rgba(255, 221, 0, 0.25);
  }
}

.post-content img {
  max-width: 100%;
  height: auto;
  margin: 32px 0;
  border-radius: 5px;
  transition: filter 0.3s ease, opacity 0.3s ease;
}

.post-content img.img-loading {
  filter: blur(10px);
  opacity: 0.6;
}

.post-content img.img-loaded {
  filter: blur(0);
  opacity: 1;
  -webkit-box-shadow: 0px 4px 16px -6px rgba(0,0,0,0.35); 
  box-shadow: 0px 4px 16px -6px rgba(0,0,0,0.35); 
}

.post-content ul,
.post-content ol {
  margin: 20px 0;
  padding-left: 32px;
}

.post-content li {
  margin-bottom: 8px;
}

.post-content code {
  font-family: "SF Mono", Monaco, Consolas, monospace;
  font-size: 0.9em;
  background: transparent;
  border: 1px solid var(--border);
  padding: 2px 6px;
}

.post-content pre {
  background: transparent;
  border: 1px solid var(--border);
  padding: 16px;
  overflow-x: auto;
  margin: 20px 0;
}

.post-content pre code {
  border: none;
  padding: 0;
}

.post-content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 20px;
  margin: 20px 0;
  font-style: italic;
}

/* Embedded content (YouTube, Figma, etc.) */
.embed-container {
  position: relative;
  height: auto;
  overflow: hidden;
  max-width: 100%;
  margin: 30px 0;
  background: var(--background-secondary);
  border-radius: 8px;
}

.embed-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: none;
  overflow: hidden;
}

/* YouTube and Vimeo embeds use 16:9 aspect ratio */
.embed-youtube,
.embed-vimeo {
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

/* Figma embeds typically need more height */
.embed-figma {
  padding-bottom: 75%; /* 4:3 aspect ratio for better Figma viewing */
  min-height: 450px;
  background: #ffffff !important; /* Always white background for Figma prototypes */
}

/* Local video embeds */
.embed-video {
  position: relative;
  margin: 30px 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.embed-video video {
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: 8px;
  background: #000000;
}

/* Media Grid for images and videos */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.media-grid-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--background-secondary);
}

.media-grid-item img,
.media-grid-item video {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.media-grid-item video {
  background: #000000;
}

/* 2-column grid on larger screens */
@media (min-width: 768px) {
  .media-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
  .embed-container {
    margin: 20px 0;
  }

  .embed-figma {
    min-height: 300px;
  }

  .media-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 20px 0;
  }
}


/* Scroll Navigation Button */
.scroll-nav-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  cursor: pointer;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease, border-color 0.2s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.scroll-nav-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.scroll-nav-btn:hover {
  background: var(--link-hover);
  border-color: var(--link-hover);
}

.scroll-nav-btn span {
  font-family: 'Jacquarda Bastarda 9', serif;
  font-size: 32px;
  color: var(--text);
  line-height: 1;
  margin-top: -5px;
}

.scroll-nav-btn:hover span {
  color: var(--bg);
}

@media (max-width: 768px) {
  .scroll-nav-btn {
    width: 50px;
    height: 50px;
    top: 15px;
    right: 15px;
  }

  .scroll-nav-btn span {
    font-size: 28px;
  }
}

/* Category Archive Page */
.category-archive {
  margin-bottom: 60px;
}

.category-title {
  font-family: 'Public Sans', sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 60px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

/* CV Page */
.cv-page {
  max-width: 800px;
  margin: 0 auto;
}

.cv-page h1 {
  font-family: 'Public Sans', sans-serif;
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.cv-page section {
  margin-bottom: 48px;
}

.cv-page h2 {
  font-family: 'Public Sans', sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 20px;
}

.cv-page h3 {
  font-family: 'Public Sans', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.cv-page p {
  margin-bottom: 12px;
  line-height: 1.6;
}

.cv-page img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 20px 0;
  border-radius: 8px;
}

.cv-page .date {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 8px;
}

.cv-page a {
  color: var(--link);
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.cv-page a:hover {
  color: var(--link-hover);
  background-color: rgba(232, 89, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
  .cv-page a:hover {
    background-color: rgba(255, 221, 0, 0.15);
  }
}

.experience-item {
  margin-bottom: 32px;
}

.cv-page table {
  width: 100%;
  margin: 20px 0;
  border-collapse: collapse;
}

.cv-page table th,
.cv-page table td {
  padding: 8px 20px 8px 0;
  text-align: left;
  vertical-align: top;
}

.cv-page table th {
  font-family: 'Public Sans', sans-serif;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.cv-page table td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
  .cv-page table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* Clouds Section */
.clouds-section {
  position: relative;
  margin-top: 120px;
  padding-top: 72.26%; /* Aspect ratio: 943/1305 = 0.7226 = 72.26% */
  background-image: url('/images/clouds.png');
  background-size: 100% 100%;
  background-position: center top;
  background-repeat: no-repeat;
}

@media (prefers-color-scheme: dark) {
  .clouds-section {
    transform: scaleY(-1);
  }
}

/* Footer Section */
footer {
  background-color: #000000;
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  footer {
    background-color: #ffffff;
    color: #000000;
  }
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  font-size: 14px;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px 40px 40px;
}

.footer-content p {
  margin: 0;
}

.footer-content p:first-child {
  justify-self: start;
}

.footer-location {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-content p:last-child {
  justify-self: end;
}

.texas-icon {
  width: 16px;
  height: 14px;
  display: inline-block;
  vertical-align: middle;
  margin: 0 !important;
  filter: invert(0);
}

.footer-content a {
  color: #ffffff;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-content a:hover {
  color: var(--link-hover);
}

@media (prefers-color-scheme: dark) {
  .footer-content a {
    color: #000000;
  }

  .footer-content a:hover {
    color: var(--link-hover);
  }

  .texas-icon {
    filter: invert(1);
  }
}

/* Responsive design */
@media (max-width: 900px) {
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .year-section {
    grid-template-columns: 100px 1fr;
    gap: 30px;
  }
}

@media (max-width: 600px) {
  main {
    padding: 24px 16px 0 16px;
  }

  .header-content {
    flex-direction: column;
    gap: 16px;
  }

  h1 {
    font-size: 28px;
  }

  .year-section {
    grid-template-columns: 80px 1fr;
    gap: 20px;
    margin-bottom: 40px;
  }

  .year {
    font-size: 20px;
    top: 24px;
  }

  .posts-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .post-detail h1,
  .cv-page h1 {
    font-size: 28px;
  }

  .post-content {
    font-size: 16px;
  }

  .clouds-section {
    padding-top: 72.26%; /* Maintain aspect ratio on mobile */
  }

  .footer-content {
    padding: 30px 16px;
    grid-template-columns: 1fr;
    gap: 12px;
    text-align: center;
  }

  .footer-content p:first-child,
  .footer-content p:last-child,
  .footer-location {
    justify-self: center;
  }
}
