/* General Styles */
:root {
  --primary-color: #4c788c;
  --secondary-color: #ffe5d9;
  --background-color: #fffdfc;
  --text-primary: #1f2937;
  --text-secondary: #4b5560;
  --card-bg: #fff2eb;
  --header-bg: #ffe5d9;
  --nav-bg: #D9F3FF;
  --nav-hover: #4c788c;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --container-width: min(1200px, 90%);
  --section-spacing: 3rem;
  --page-padding: 2rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

/* Base Styles */
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  margin: 0;
  padding: var(--page-padding);
  line-height: 1.5;
  font-size: 14px;
  overflow-wrap: break-word;
}

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

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 1rem;
  line-height: 1.2;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.5rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: #b9420c;
  /* Use your custom color */
  /**/
  text-decoration: none;
  /* Removes underline globally */
}

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


/* Header Styles */
header {
  background-color: var(--header-bg);
  background: url('misc/art/background-img.jpg') no-repeat center center;
  background-size: cover;
  /* Ensures the image covers the entire header */
  color: rgb(0, 0, 0);
  padding: var(--section-spacing) 1rem;
  text-align: center;
  margin: calc(-1 * var(--page-padding));
  margin-bottom: var(--section-spacing);
}

header h1 {
  margin-bottom: 0.25rem;
}

.name-note {
  margin-bottom: 1rem;
  color: rgba(31, 41, 55, 0.65);
  font-size: 0.72rem;
  letter-spacing: 0.025em;
}

.header-role {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

header h2 {
  font-weight: 300;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.25rem;
}

/* Navigation Styles */
nav {
  background-color: var(--nav-bg);
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  margin: calc(-1 * var(--page-padding));
  margin-bottom: var(--section-spacing);
  position: relative;
}

nav ul {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

nav a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  transition: var(--transition);
}

nav a:hover,
nav a:focus {
  background-color: #324762;
  /**/
  color: #CAF0F8;
  /**/
}

/* Section Styles */
section {
  padding: var(--section-spacing) 0;
}

section h2 {
  text-align: center;
  margin-bottom: 2rem;
}

.about {
  display: flex;
  align-items: center;
  gap: 2rem;
  max-width: var(--container-width);
  margin: 0 auto;
}

.profile-pic img {
  width: 350px;
  height: 350px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-md);
}

.profile-container {
  display: flex;
  gap: 2rem;
  align-items: center;
}

/* For mobile screens */
@media (max-width: 768px) {
  :root {
    --page-padding: 1rem;
    --section-spacing: 2rem;
  }

  body {
    font-size: 16px;
  }

  section {
    padding: 2rem 0;
  }

  .about {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 0;
  }

  .profile-pic img {
    display: block;
    width: min(250px, 72vw);
    height: min(250px, 72vw);
    margin: 0 auto;
  }

  .about-text {
    font-size: 1rem;
  }

  .projects,
  .courses {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Older project pages use inline desktop padding. Keep them readable on phones. */
  [style*="padding: 0 50px"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #preview {
    height: 70vh;
    min-height: 420px;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

.about-text {
  flex: 1;
  font-size: 1.2em;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Projects and Courses Sections */
.projects,
.courses {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.card,
.course-card {
  background-color: var(--card-bg);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-md);
  padding: 1rem;
  transition: var(--transition);
  text-decoration: none;
}

.card p {
  color: black;
  /**/
}

.card:hover,
.course-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

/* Short personal stories on the homepage */
.field-notes {
  max-width: var(--container-width);
  margin: 0 auto;
}

.field-notes h2,
.section-intro,
.field-notes-link {
  text-align: center;
}

.section-intro {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin: -0.75rem auto 2rem;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.story-card {
  background: #fff;
  border: 1px solid rgba(76, 120, 140, 0.25);
  border-top: 4px solid var(--primary-color);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.story-card:nth-child(2) {
  border-top-color: #b9420c;
}

.story-card:nth-child(3) {
  border-top-color: #76946a;
}

.story-place {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
}

.story-card h3 {
  font-size: 1.2rem;
}

.story-card p:last-child {
  margin-bottom: 0;
}

.field-notes-link {
  margin-top: 1.5rem;
}

#shi {
  font-size: 1.2rem;
}

.card img,
.course-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 0.25rem;
  margin-bottom: 1rem;
}

.card h3,
.course-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: black;
  /**/
}

.card p,
.course-card p {
  font-size: 0.875rem;
}

.half {
  flex: 1;
  /* Each div takes up half of the available width */
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
  /* Ensure content is scrollable if needed */
}

.note {
  background-color: var(--card-bg);
  /* Consistent with other card backgrounds */
  border-left: 5px solid var(--primary-color);
  /* Use the primary color */
  padding: 15px;
  margin: 20px 0;
  font-family: 'Inter', sans-serif;
  /* Same as body font */
  color: var(--text-primary);
  /* Ensure text color is consistent */
  box-shadow: var(--shadow-sm);
  /* Lighter shadow to match other elements */
}

.note strong {
  font-size: 1.1em;
  /* Slightly larger than regular text */
  color: var(--text-primary);
  /* Strong text in primary text color */
}

.note em {
  color: var(--secondary-color);
  /* Use secondary color for emphasis */
  font-style: italic;
}

.note p {
  font-size: 1em;
  color: var(--text-secondary);
  /* Use secondary text color */
  line-height: 1.6;
}

.gallery h2 {
  text-align: center;
  margin-bottom: 2rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.gallery-item {
  display: block;
  overflow: hidden;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  text-align: center;
  /* Aligns caption below the image */
  background-color: var(--secondary-color);
  /* Matches website theme */
}

.gallery-item img {
  width: 100%;
  height: 400px;
  /* Enforces a square aspect ratio */
  object-fit: cover;
  /* Ensures images fill the square without distortion */
  display: block;
}

.gallery-item .caption {
  font-size: 1rem;
  color: var(--text-primary);
  text-align: center;
  padding: 0.5rem;
  background-color: rgba(255, 229, 217, 0.8);
  /* Subtle background for caption */
  border-radius: 0 0 0.5rem 0.5rem;
}

.gallery-item:hover .caption {
  color: var(--primary-color);
  /* Change text color on hover */
}

.gallery-item:focus {
  outline: none;
}

.gallery-item:focus img {
  transform: scale(1.05);
}

#preview {
  margin-top: 30px;
  width: 100%;
  height: 800px;
  border: 1px solid #ccc;
  background: #fff;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow: auto;
}

.btn-group {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Button Group Styles */
.btn-group a {
  display: inline-block;
  padding: 10px 15px;
  font-size: 1em;
  color: var(--text-primary);
  /* Use your existing primary text color */
  background-color: var(--primary-color);
  /* Use a consistent primary color variable */
  text-decoration: none;
  border-radius: 5px;
  transition: background-color 0.3s, transform 0.3s ease;
  /* Added smooth transition on hover */
  text-align: center;
  /* Center text inside buttons */
  box-shadow: var(--shadow-sm);
  /* Subtle shadow for a consistent look */
}

.btn-group a:hover {
  background-color: var(--primary-color-dark);
  /* Darker shade of primary color */
  transform: translateY(-2px);
  /* Optional: Adds a slight lift on hover */
}



/* Table Styles */
table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--background-color);
  box-shadow: var(--shadow-md);
  border-radius: 0.5rem;
  overflow: hidden;
  font-size: 0.875rem;
}

table th,
table td {
  padding: 0.75rem;
  text-align: left;
}

table th {
  background-color: var(--primary-color);
  color: white;
  font-weight: 600;
}

table tbody tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Footer Styles */
footer {
  background-color: var(--header-bg);
  color: rgb(0, 0, 0);
  text-align: center;
  background: url('misc/art/background-img.jpg') no-repeat center center;
  padding: 2rem 1rem;
  margin: calc(-1 * var(--page-padding));
  margin-top: var(--section-spacing);
  font-size: 0.875rem;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.mb-1 {
  margin-bottom: 1rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
  :root {
    --page-padding: 1.5rem;
  }

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

  .story-grid {
    grid-template-columns: 1fr;
  }
}



@media screen and (max-width: 480px) {
  nav ul {
    flex-direction: column;
    align-items: center;
  }

  nav a {
    display: block;
    width: 100%;
    text-align: center;
  }
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--nav-bg);
  padding: 1rem;
}

nav ul {
  list-style: none;
  display: flex;
  /* Horizontal by default */
  gap: 1rem;
  margin: 0;
  padding: 0;
}

nav ul.nav-links {
  flex-direction: row;
  /* Horizontal for desktop */
}

/* Button Styles */
#menu-toggle {
  display: none;
  /* Hidden on desktop */
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 1.25rem;
}

/* Responsive Design for Small Devices */
@media screen and (max-width: 768px) {
  :root {
    --page-padding: 1rem;
    --section-spacing: 2rem;
  }

  .projects,
  .courses {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  #menu-toggle {
    display: block;
    /* Show button on small screens */
  }

  nav ul {
    display: none;
    /* Hidden by default on mobile */
    flex-direction: column;
    /* Vertical layout for mobile */
    gap: 0.5rem;
    background-color: var(--nav-bg);
    padding: 1rem;
    border-radius: 0.25rem;
    position: absolute;
    top: 100%;
    /* Below the nav bar */
    left: 0;
    width: 100%;
    z-index: 10;
    /* Ensure it stays above other content */
  }

  nav ul.nav-links {
    flex-direction: column;
  }

  nav ul.visible {
    display: flex;
    /* Show menu when toggled */
  }

  nav ul li {
    width: 100%;
  }

  nav ul li a {
    display: block;
    width: 100%;
    padding: 0.5rem 0.5rem;
  }

}
