@font-face {
  font-family: "Domaine";
  src: url(../fonts/TestDomaineSansDisplay-Medium.otf) format("opentype");
}

@font-face {
  font-family: "Montreal";
  src: url(../fonts/PPNeueMontreal-Medium.otf) format("opentype");
}
@font-face {
  font-family: "Montreal-Book";
  src: url(../fonts/PPNeueMontreal-Book.otf) format("opentype");
}

@font-face {
  font-family: "Suisse";
  src: url(../fonts/SuisseIntl-Regular.ttf) format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Financier";
  src: url(../fonts/TestFinancierDisplay-Regular.otf) format("opentype");
}

::selection {
  background: #000000;
  color: #ffffff;
}

html,
body {
  margin: 0;
  font-family: "Suisse";
}

main {
  background-color: white;
  margin-bottom: 80px;
}

/* Navigation */

nav {
  margin: 45px auto;
  width: calc(100% - 60px);
  max-width: 1750px;
  box-sizing: border-box;
  padding-left: 100px;
  margin-left: 20px;
}

nav a {
  padding: 10px;
  padding-bottom: 18px;
  padding-top: 6px;
  display: inline-block;
  text-decoration: none;
  border-radius: 10px;
  margin-right: 16px;
  font-size: 25px;
  font-weight: 400;
  font-family: Georgia, "Times New Roman", Times, serif;
  color: black;
}

nav a:hover {
  position: relative;
  top: -5px;
}

/* Page Title */

header {
  margin: 0;
}

h1 {
  font-weight: 600;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-size: 90px;
  margin: 0px;
  padding-left: 120px;
}

/* Gallery Grid */

#gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(300px, 1fr));
  gap: 5rem;
  margin: 0 auto;
  max-width: 1400px;
  margin-left: 120px;
  align-items: stretch;
  cursor: crosshair;
}

/* Cards */

.card {
  display: none;
  cursor: crosshair;
}

.card.show {
  display: initial;
  margin-top: 60px;
  margin-bottom: -60px;
  cursor: crosshair;
}

.card a {
  text-decoration: none;
  color: black;
}

.card_img_zoom_container {
  overflow: hidden;
}

.card_img_container,
.card_img_zoom_container {
  height: 260px;
  width: 460px;
}

.card_img_container {
  max-width: 100%;
  filter: grayscale(100%);
  cursor: crosshair;
  object-fit: cover;
  transition: transform 0.5s, filter 0.5s;
  transform: scale(1.01);
}

.card:hover .card_img_container {
  filter: grayscale(0%);
  transform: scale(1.04);
}

.definition {
  font-size: 19px;
  line-height: 28px;
  cursor: crosshair;
  color: rgba(0, 0, 1, 0.75);
  display: inline-block;
}

.card:hover .definition {
  background: #fff495;
}

.more-details {
  font-size: 16px;
  color: #a7a7a7;
  font-weight: 200;
  margin-top: -10px;
  cursor: crosshair;
  font-style: italic;
}

.demo-link {
  color: #a7a7a7;
  text-decoration: underline;
  text-decoration-color: #dcd3d3;
  font-style: normal;
  transition: background 0.2s;
}

.demo-link:hover {
  background: #fff495;
  color: #000;
}

/* Title styles */

.title-design {
  font-family: "Montreal";
  font-size: 100px;
  margin: 0px;
  padding-top: 170px;
  padding-left: 120px;
}

.content-block {
  max-width: 1000px;
}

.meta-data {
  padding-left: 120px;
  color: rgb(156, 156, 156);
  padding-top: 24px;
}

/* Homepage */

.main-paragraph {
  margin-left: 130px;
  max-width: 1400px;
}

.front-intro-photo {
  float: right;
  width: 300px;
  margin-left: 48px;
  margin-bottom: 24px;
}

.front-intro-photo img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.front-text {
  font-size: 19px;
  max-width: 68ch;
  text-align: left;
  line-height: 1.6em;
}

.front-text a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #dcd3d3;
  transition: text-decoration-color 0.2s, background 0.2s;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 1px;
}

.front-text a:hover {
  background: #fff495;
  text-decoration-color: transparent;
}

.front-header {
  font-weight: 800;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-size: 24px;
  margin: 0px;
  text-align: left;
}

.front-subheader {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-weight: 800;
  font-size: 18px;
  margin-top: 28px;
  position: relative;
}

.front-subheader::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 140px;
  display: block;
  height: 2px;
  width: calc(68ch - 140px);
  max-width: calc(100% - 140px);
  background: linear-gradient(to right, #bbbbbb, transparent);
}

ul.front-company-list {
  padding-left: 0;
  columns: 2;
  max-width: 52ch;
}

.front-company-list li {
  list-style: none;
  line-height: 1.8em;
  font-size: 19px;
}

.front-company-list li a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #dcd3d3;
  transition: text-decoration-color 0.2s, background 0.2s;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 1px;
}

.front-company-list li a:hover {
  background: #fff495;
  text-decoration-color: transparent;
}

/* Publications */

.publications {
  max-width: 700px;
  font-family: Arial, Helvetica, sans-serif;
  margin-bottom: 40px;
  margin-top: 20px;
}

.publications .title {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  color: rgb(148 33 13 / 90%);
}

.authors {
  font-size: 14px;
  color: rgb(61, 60, 60);
  margin-top: -4px;
}

.paper {
  margin-bottom: 12px;
}

.paper .type {
  font-size: 14px;
  color: rgb(93, 93, 93);
  margin-top: -8px;
  font-style: italic;
}

.paper .details {
  font-size: 13px;
  color: rgb(93, 93, 93);
  margin-top: -4px;
  line-height: 1.5em;
}

.misc {
  display: flex;
  gap: 5px;
  margin-top: -2px;
}

.authors a {
  font-weight: 700;
}

.misc a {
  color: rgb(84, 71, 71);
  transition: background 0.2s;
}

.misc a:hover {
  background: #fff495;
}

/* Page content — left-aligned reference pages (bookshelf, misc) */

.page-content {
  margin-left: 130px;
  max-width: 700px;
  font-size: 19px;
  line-height: 1.7em;
  color: rgb(77, 77, 77);
}

.page-content h2 {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-weight: 800;
  font-size: 18px;
  margin-top: 32px;
  position: relative;
  color: #333;
}

.page-content h2::after {
  content: "";
  position: relative;
  top: -2px;
  display: inline-block;
  height: 2px;
  vertical-align: middle;
  width: 200px;
  margin-left: 16px;
  background: linear-gradient(to right, #bbbbbb, transparent);
}

.page-content h3 {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #666;
  margin-top: 24px;
  margin-bottom: 4px;
}

.page-content p {
  margin: 4px 0;
}

.page-content hr {
  border: none;
  border-top: 1px solid #e8e8e8;
  margin: 24px 0;
}

.page-content ul {
  padding-left: 20px;
  margin-top: 4px;
}

.page-content li {
  line-height: 1.8em;
  font-size: 17px;
}

/* Bookshelf */

.page-content.bookshelf {
  max-width: 960px;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px 48px;
  margin-top: 20px;
  margin-bottom: 48px;
}

.book-card {
  display: flex;
  flex-direction: column;
}

.book-cover {
  width: 55%;
  margin-bottom: 14px;
}

.book-cover img {
  width: 100%;
  height: auto;
  display: block;
}

/* Placeholder covers (no image) */
.book-cover:not(:has(img)) {
  aspect-ratio: 2 / 3;
  background: #f0ece6;
  border: 1px solid #e8e4de;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
  box-sizing: border-box;
}

.book-cover span {
  font-family: "Financier", Georgia, serif;
  font-size: 13px;
  line-height: 1.45;
  color: #999;
  letter-spacing: 0.01em;
}

.book-card:nth-child(5n+2) .book-cover:not(:has(img)) { background: #eaeff2; border-color: #dde4e8; }
.book-card:nth-child(5n+3) .book-cover:not(:has(img)) { background: #f2efe8; border-color: #e8e4dc; }
.book-card:nth-child(5n+4) .book-cover:not(:has(img)) { background: #ece8f0; border-color: #e0dce6; }
.book-card:nth-child(5n+5) .book-cover:not(:has(img)) { background: #e8ede9; border-color: #dce2dd; }

.book-card .book-title {
  font-weight: 700;
  font-size: 16px;
  color: #333;
  line-height: 1.35;
}

.book-card .book-author {
  font-size: 13px;
  color: #a7a7a7;
  margin-top: 4px;
}

.book-card .book-author::before {
  content: "by ";
}

.book-desc {
  font-size: 13px;
  line-height: 1.55;
  color: #777;
  margin-top: 10px;
  text-align: left;
  align-self: stretch;
}

@media only screen and (max-width: 700px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px 28px;
  }
}

@media only screen and (max-width: 480px) {
  .book-grid {
    grid-template-columns: 1fr;
    gap: 36px;
    max-width: 240px;
  }
}

/* Course list */

.course-group {
  margin-top: 8px;
}

.course-group ul {
  padding-left: 18px;
  margin-top: 4px;
  margin-bottom: 16px;
}

.course-group li {
  font-size: 16px;
  line-height: 1.6em;
  color: rgb(77, 77, 77);
}

.course-semester {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: #a7a7a7;
  margin-top: 16px;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.page-content a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #dcd3d3;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 1px;
  transition: background 0.2s;
}

.page-content a:hover {
  background: #fff495;
  text-decoration-color: transparent;
}

/* Footer */

.site-footer {
  margin-top: 120px;
  padding: 40px 0;
}

/* Writing container — centered layout for articles */

.writing-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 32px;
}

.writing-title {
  font-family: "Montreal";
  font-weight: 600;
  font-size: 36px;
  line-height: 1.25em;
  margin-top: 40px;
  margin-bottom: 0;
  text-align: left;
}

.writing-date {
  color: #a7a7a7;
  font-size: 16px;
  margin-top: 8px;
  margin-bottom: 40px;
}

.writing-intro {
  margin-left: 130px;
  font-size: 19px;
  color: #a7a7a7;
  font-style: italic;
  margin-top: 10px;
  margin-bottom: 0;
}

/* Writing filters */

.writing-filters {
  margin-left: 130px;
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 8px;
}

.writing-filters label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Suisse", sans-serif;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #444;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 4px;
  background: var(--tag-color);
  transition: opacity 0.2s, box-shadow 0.2s, transform 0.15s;
  user-select: none;
}

.writing-filters label:hover {
  opacity: 0.85;
}

/* When any filter is active, dim the inactive ones */
.writing-filters.has-active label {
  opacity: 0.28;
}

.writing-filters.has-active label.active {
  opacity: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.writing-filters input[type="checkbox"] {
  display: none;
}

/* Tag colors — matched from Alfredo's palette */
.writing-filters label[data-tag="food"]     { --tag-color: #8cd8ea; }
.writing-filters label[data-tag="chess"]    { --tag-color: #f8e494; }
.writing-filters label[data-tag="quotes"]   { --tag-color: #f0b0b8; }
.writing-filters label[data-tag="poetry"]   { --tag-color: #f5c4a4; }
.writing-filters label[data-tag="games"]    { --tag-color: #a8e0b0; }
.writing-filters label[data-tag="code"]     { --tag-color: #b8e86c; }
.writing-filters label[data-tag="painting"] { --tag-color: #2898f0; color: #fff; }
.writing-filters label[data-tag="music"]    { --tag-color: #f04e3e; color: #fff; }
.writing-filters label[data-tag="math"]     { --tag-color: #f5c020; }

/* Post visibility: hidden by default, shown when grid has matching class */
#writing-grid a.post {
  display: none;
}

#writing-grid.math a.post.tag-math,
#writing-grid.code a.post.tag-code,
#writing-grid.music a.post.tag-music,
#writing-grid.chess a.post.tag-chess,
#writing-grid.poetry a.post.tag-poetry,
#writing-grid.quotes a.post.tag-quotes,
#writing-grid.painting a.post.tag-painting,
#writing-grid.games a.post.tag-games,
#writing-grid.food a.post.tag-food {
  display: flex;
}

/* Blog list — left-aligned like Karina's */

.blog-list {
  margin-left: 130px;
  margin-top: 40px;
}

a.post {
  font-size: 18px;
  display: flex;
  text-decoration: none;
  color: inherit;
  width: 100%;
  max-width: 90ch;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.1em;
}

a.post:hover .title {
  background: #fff495;
}

a.post .hline {
  height: 0;
  border-top: 4px dotted #d5d5d5;
  width: 3ch;
  flex-shrink: 0;
  flex-grow: 1;
  margin: 0 1ch;
}

a.post .publishDate {
  color: #a7a7a7;
  flex-shrink: 0;
}

/* Article content (default — for project singles etc.) */

article {
  font-family: "Suisse", sans-serif;
}

article h2 {
  padding-left: 120px;
  color: rgb(156, 156, 156);
  font-size: 24px;
  padding-top: 30px;
}

article p {
  font-size: 20px;
  line-height: 1.7em;
  color: rgb(77, 77, 77);
}

article p,
article hr {
  max-width: 80ch;
  margin-left: 120px;
}

article p a,
article li a {
  color: inherit;
  text-decoration: none;
  background: #fff495;
}

article p a:hover,
article li a:hover {
  background: #fbda28;
}

/* Writing article — overrides for centered container */

.writing-article p {
  margin-left: 0;
  max-width: none;
}

.writing-article hr {
  margin-left: 0;
  max-width: none;
}

.writing-article p a,
.writing-article li a {
  background: none;
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #dcd3d3;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 1px;
}

.writing-article p a:hover,
.writing-article li a:hover {
  background: none;
  text-decoration-color: #333;
}

.writing-article ul,
.writing-article ol {
  padding-left: 24px;
  font-size: 20px;
  line-height: 1.7em;
  color: rgb(77, 77, 77);
}

.writing-article h1 {
  padding-left: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-weight: 700;
  font-size: 26px;
  margin-top: 40px;
  color: #333;
}

.writing-article h2 {
  padding-left: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-weight: 700;
  font-size: 22px;
  margin-top: 36px;
  color: #333;
}

.writing-article h3 {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-weight: 700;
  font-size: 18px;
  margin-top: 28px;
  color: #333;
}

.writing-article pre,
.writing-article .highlight pre {
  background: #f8f8f8;
  padding: 20px 24px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6em;
  border-radius: 4px;
}

.writing-article pre code,
.writing-article .highlight pre code {
  font-family: "IBM Plex Mono", monospace;
  background: none;
}

.writing-article .highlight {
  background: none;
}

.writing-article code {
  font-family: "IBM Plex Mono", monospace;
}

.writing-article p code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 15px;
}

.writing-article figure {
  margin: 32px 0;
}

.writing-article figure.align-center {
  text-align: center;
}

.writing-article figure img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.writing-article figcaption {
  font-size: 14px;
  color: #a7a7a7;
  margin-top: 8px;
  font-style: italic;
}

.writing-article .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 0;
  max-width: 100%;
}

/* Responsive */

@media only screen and (max-width: 1600px) {
  #gallery-grid {
    grid-template-columns: repeat(2, minmax(50px, 1fr));
    margin-left: auto;
    margin-right: auto;
    max-width: 1000px;
    gap: 3rem;
    padding: 0 40px;
  }
}

@media only screen and (max-width: 1400px) {
  .main-paragraph {
    max-width: 1000px;
  }
}

@media only screen and (max-width: 1200px) {
  .main-paragraph {
    max-width: 800px;
  }

  #gallery-grid {
    grid-template-columns: repeat(1, minmax(50px, 1fr));
    margin-left: 120px;
    max-width: 600px;
    gap: 2rem;
  }
}

@media only screen and (max-width: 800px) {
  .front-intro-photo {
    float: none;
    width: 240px;
    margin-left: 0;
    margin-bottom: 20px;
  }
}

@media only screen and (max-width: 1067px) {
  nav {
    padding-left: 20px;
  }
  .main-paragraph {
    margin-left: 40px;
    max-width: 600px;
  }

  #gallery-grid {
    margin-left: 40px;
    max-width: 600px;
    gap: 2rem;
  }

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

  .blog-list {
    margin-left: 40px;
  }

  .writing-filters {
    margin-left: 40px;
  }

  .page-content {
    margin-left: 40px;
  }

  .page-content.bookshelf {
    max-width: calc(100% - 80px);
  }
}

@media only screen and (max-width: 820px) {
  nav {
    padding-left: 20px;
  }

  nav a {
    font-size: 20px;
    margin-right: 5px;
  }

  #gallery-grid {
    margin-left: 40px;
    max-width: 600px;
    gap: 2rem;
  }
}

@media only screen and (max-width: 800px) {
  main {
    width: calc(100% - 10px);
  }
  .main-paragraph {
    max-width: 500px;
  }

  #gallery-grid {
    grid-template-columns: repeat(1, minmax(50px, 1fr));
    margin-left: 30px;
    max-width: 600px;
    gap: 2rem;
  }

  h1 {
    padding-left: 60px;
    font-size: 70px;
  }
}

@media only screen and (max-width: 650px) {
  .main-paragraph {
    max-width: 450px;
  }

  #gallery-grid {
    margin-left: 30px;
  }

  .front-subheader::after {
    display: none;
  }
}

@media only screen and (max-width: 600px) {
  .main-paragraph {
    max-width: 300px;
    margin-left: 30px;
  }

  nav {
    padding-left: 8px;
  }

  nav a {
    font-size: 13px;
    margin-right: -10px;
  }

  h1 {
    padding-left: 40px;
    font-size: 50px;
    padding-top: 20px;
  }

  #gallery-grid {
    grid-template-columns: repeat(1, minmax(50px, 1fr));
    margin-left: 30px;
    max-width: 600px;
    gap: 2rem;
  }

  .card_img_container,
  .card_img_zoom_container {
    height: 180px;
    width: 300px;
  }

  ul.front-company-list {
    columns: 1;
  }
}

@media only screen and (max-width: 395px) {
  nav {
    padding-left: 8px;
  }

  nav a {
    font-size: 13px;
    margin-right: -10px;
  }
}

@media only screen and (max-width: 290px) {
  .main-paragraph {
    max-width: 200px;
  }
  .front-text {
    font-size: 16px;
  }
}
