@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;1,6..72,400&display=swap');

/* ============================================================================
   ALEX IMAS — PERSONAL ACADEMIC WEBSITE (www.aleximas.com)
   SWISS TYPOGRAPHIC INDEX THEME (Matching AGI Economics Lab @GoogleDeepMind)
   ============================================================================ */

:root,
[data-design="index"] {
  --bg: #FFFFFF;
  --bg-hover: #F7F7F8;
  --text: #09090B;
  --text-secondary: #52525B;
  --text-muted: #71717A;
  --accent: #09090B;
  --rule: #E4E4E7;
  --rule-strong: #18181B;
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --container-width: 960px;
  --body-size: 0.94rem;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: 1.65;
  padding-bottom: 6rem;
}

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

/* ============================================================================
   LAYOUT CONTAINER
   ============================================================================ */
.page-shell {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 4.5rem 2rem 2rem;
}

/* ============================================================================
   TOP BAR / HEADER PROFILE
   ============================================================================ */
.site-intro {
  margin-bottom: 3.25rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 2.25rem;
  align-items: center;
  margin-bottom: 1.85rem;
}

.profile-portrait {
  width: 210px;
  height: 210px;
  object-fit: cover;
  object-position: center top;
  border-radius: 5px;
  border: 1px solid var(--rule);
  filter: grayscale(10%) contrast(1.02);
  transition: filter 0.2s ease;
}

.profile-portrait:hover {
  filter: grayscale(0%);
}

.profile-meta {
  min-width: 0;
}

.name-contact-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.author-title {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 3vw, 2.15rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.1;
  font-optical-sizing: auto;
  font-feature-settings: "kern" 1, "liga" 1;
}

.site-top-nav {
  display: flex;
  align-items: center;
  gap: 1.65rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
}

.site-nav-item {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.site-nav-item:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.site-nav-item.active-page {
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
}

.teaching-page-topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.teaching-page-topbar .author-title a:hover {
  opacity: 0.75;
}

.positions-list {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin-bottom: 0.55rem;
}

.position-item {
  font-size: 0.87rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.45;
}

.position-item.prominent-role {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.008em;
  margin-bottom: 0.08rem;
}

.position-item.prominent-role strong {
  font-weight: 700;
  color: var(--text);
}

.position-item a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.leave-tag {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.affiliations-block {
  display: flex;
  flex-direction: column;
  gap: 0.16rem;
  margin-bottom: 0.85rem;
}

.affil-row {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.48;
}

.affil-row a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.header-links-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.3rem 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.header-link {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

.header-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-sep {
  color: var(--text-muted);
}

/* ============================================================================
   BIOGRAPHY BLOCK
   ============================================================================ */
.bio-block {
  padding-top: 1.35rem;
  border-top: 1px solid var(--rule);
}

.bio-prose {
  width: 100%;
}

.bio-prose p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.66;
  margin-bottom: 0.75rem;
}

.bio-prose p:last-child {
  margin-bottom: 0;
}

.bio-prose em {
  color: var(--text);
  font-style: italic;
}

.bio-prose a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule-strong);
}

.bio-prose a:hover {
  text-decoration-color: var(--text);
}

.featured-bullets {
  margin: 1.05rem 0 0 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  list-style-type: disc;
}

.featured-bullets li {
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.55;
  padding-left: 0.2rem;
}

.featured-bullets li::marker {
  color: var(--text);
}

.featured-bullets a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--text);
  transition: opacity 0.15s ease;
}

.featured-bullets a:hover {
  opacity: 0.72;
}

/* ============================================================================
   MINIMAL NAVIGATION BAR
   ============================================================================ */
.minimal-nav {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule-strong);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.minimal-nav a {
  transition: color 0.15s ease;
}

.minimal-nav a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-num {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-right: 0.3rem;
}

/* ============================================================================
   CATEGORY FILTER & SEARCH BAR
   ============================================================================ */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 2.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.topic-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.topic-filter-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-right: 0.3rem;
}

.topic-tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--rule-strong);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.topic-tag:hover {
  color: var(--text);
  border-color: var(--text);
}

.topic-tag.active-topic {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.utility-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.search-input {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.24rem 0.75rem;
  width: 190px;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input:focus {
  border-color: var(--rule-strong);
}

.expand-all-btn {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.expand-all-btn:hover {
  color: var(--text);
  border-color: var(--rule-strong);
}

/* ============================================================================
   SECTIONS & SWISS TABULAR GRID
   ============================================================================ */
.minimal-section {
  margin-bottom: 4.25rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: 1.15rem;
}

.section-label {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
}

.section-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.writing-table-head {
  display: grid;
  gap: 1.25rem;
  padding: 0 0.5rem 0.45rem;
  margin: 0 -0.5rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.research-grid {
  grid-template-columns: minmax(0, 52%) minmax(0, 24%) minmax(0, 24%);
}

.teaching-grid {
  grid-template-columns: minmax(0, 52%) minmax(0, 24%) minmax(0, 24%);
}

.writing-table-head > div:last-child {
  text-align: right;
}

.writing-list {
  display: flex;
  flex-direction: column;
}

.writing-row {
  padding: 0.9rem 0.5rem;
  margin: 0 -0.5rem;
  border-bottom: 1px solid var(--rule);
  border-radius: 3px;
  transition: background-color 0.15s ease;
}

.writing-row:hover {
  background-color: var(--bg-hover);
}

.writing-main {
  display: grid;
  gap: 1.25rem;
  align-items: baseline;
}

.writing-main.has-abstract {
  cursor: pointer;
}

.writing-title-col {
  min-width: 0;
}

.writing-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.42;
}

.writing-row:hover .writing-main.has-abstract .writing-title {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.item-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  border: 1px solid var(--rule-strong);
  padding: 0.04rem 0.38rem;
  border-radius: 3px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.award-line {
  margin-top: 0.25rem;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.inline-links-bar {
  margin-top: 0.38rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.71rem;
}

.inline-link,
.abstract-toggle-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.inline-link:hover,
.abstract-toggle-btn:hover {
  opacity: 0.7;
}

.media-links-group {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.74rem;
}

.media-links-group a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.media-links-group a:hover {
  color: var(--text);
}

.writing-authors {
  font-family: var(--font-sans);
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.writing-venue {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  text-align: right;
}

.writing-venue strong {
  font-weight: 700;
  color: var(--text);
}

.writing-venue em {
  font-style: italic;
}

.writing-venue strong em,
.writing-venue em strong {
  font-weight: 700;
  font-style: italic;
  color: var(--text);
}

/* Quiet Literary Margin-Rule Drawer for Abstract & Summary */
.writing-drawer {
  display: none;
  margin: 0.8rem 0 0.2rem 0.15rem;
  padding: 0.15rem 0 0.15rem 1rem;
  border-left: 1.5px solid var(--rule-strong);
  font-size: 0.89rem;
  color: var(--text-secondary);
  max-width: 72ch;
  line-height: 1.66;
}

.writing-drawer p + p {
  margin-top: 0.65rem;
}

.writing-row.expanded .writing-drawer {
  display: block;
}

/* Teaching Subheaders */
.teaching-subhead {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 1.25rem 0 0.35rem;
}

.teaching-subhead:first-of-type {
  margin-top: 0.25rem;
}

.teaching-note {
  margin-top: 1.25rem;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.teaching-note a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============================================================================
   MICRO-EDIT MODE
   ============================================================================ */
.ref-code {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  color: #B45309;
  background: #FEF3C7;
  padding: 0.06rem 0.32rem;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: baseline;
  user-select: all;
}

body.edit-mode .ref-code {
  display: inline-block;
}

body.edit-mode [data-editable="true"] {
  outline: 1px dashed rgba(180, 83, 9, 0.45);
  outline-offset: 2px;
  border-radius: 2px;
  cursor: text;
}

body.edit-mode [data-editable="true"]:focus {
  outline: 1.5px solid #B45309;
  background: rgba(254, 243, 199, 0.25);
}

.edit-mode-banner {
  display: none;
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #18181B;
  color: #FAFAFA;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

body.edit-mode .edit-mode-banner {
  display: inline-flex;
}

.edit-mode-banner button {
  background: #FAFAFA;
  color: #18181B;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

/* ============================================================================
   FOOTER
   ============================================================================ */
.minimal-footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 820px) {
  .page-shell {
    padding: 2.25rem 1.25rem 2rem;
  }
  .profile-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .bio-block {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .quick-notes {
    border-left: none;
    border-top: 1px solid var(--rule);
    padding-left: 0;
    padding-top: 1rem;
  }
  .writing-table-head {
    display: none;
  }
  .research-grid,
  .teaching-grid {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .writing-venue {
    text-align: left;
  }
}
