/* ---------------------------------------------------------------
   Joan Giner-Miguelez — minimalist personal site
   Single stylesheet. Plain CSS, no build step, no external fonts.
   --------------------------------------------------------------- */

:root {
  --bg:      #fcfcfb;
  --text:    #1a1c1e;
  --muted:   #676c71;
  --rule:    #e5e6e4;
  --accent:  #2f6d78;   /* muted teal — restrained, cool, "chosen" */
  --social:       #1a6fd0;  /* profile-icon blue */
  --social-hover: #0f4f9c;
  --maxw:    52rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:     #15171a;
    --text:   #e7e8e6;
    --muted:  #969b9f;
    --rule:   #292c30;
    --accent: #6fb3bb;
    --social: #5b9be6;
    --social-hover: #8bbcf0;
  }
}
:root[data-theme="light"] {
  --bg: #fcfcfb; --text: #1a1c1e; --muted: #676c71; --rule: #e5e6e4; --accent: #2f6d78;
  --social: #1a6fd0; --social-hover: #0f4f9c;
}
:root[data-theme="dark"] {
  --bg: #15171a; --text: #e7e8e6; --muted: #969b9f; --rule: #292c30; --accent: #6fb3bb;
  --social: #5b9be6; --social-hover: #8bbcf0;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
               Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) 1.5rem 4rem;
}

/* ---- Masthead ---- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.75rem;
  margin-bottom: 1rem;
}
.name {
  font-size: 1.7rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 0.25rem;
  line-height: 1.15;
}
.role {
  color: var(--muted);
  margin: 0 0 0.6rem;
  font-size: 0.98rem;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  font-size: 0.9rem;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  border: 0;
}
.nav a:hover { color: var(--accent); }

.masthead-social {
  margin-top: 1.4rem;
  font-size: 0.85rem;
}
.masthead-social a { color: var(--text); }
.masthead-social a:hover { color: var(--accent); }

.avatar {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  filter: grayscale(8%);
}

/* ---- Sections ---- */
main section { margin-bottom: 3rem; }

main h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

p { margin: 0 0 1.1rem; }
main section > p:last-child { margin-bottom: 0; }

a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: color 0.15s ease, border-color 0.15s ease;
}
a:hover { color: var(--accent); border-color: var(--accent); }

/* ---- Publications & simple lists ---- */
.pubs { list-style: none; margin: 0; padding: 0; }
.pubs li {
  margin-bottom: 1.15rem;
  padding-left: 0;
}
.pubs li:last-child { margin-bottom: 0; }
.pubs .venue { display: block; color: var(--muted); font-size: 0.92rem; }

/* ---- Projects ---- */
.projects { display: grid; gap: 1.5rem; }
.project h3 { margin: 0 0 0.2rem; font-size: 1.02rem; font-weight: 600; }
.project h3 a { border: 0; }
.project p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ---- Footer ---- */
.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
}
.social { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; }
.social a { color: var(--social); border: 0; display: inline-flex; line-height: 0; }
.social svg { width: 22px; height: 22px; fill: currentColor; display: block; transition: color 0.15s ease, transform 0.15s ease; }
.social a:hover { color: var(--social-hover); }
.social a:hover svg { transform: translateY(-2px); }
.copy { color: var(--muted); margin: 0; font-size: 0.85rem; }

/* ---- Small screens ---- */
@media (max-width: 34rem) {
  .masthead { flex-direction: column-reverse; align-items: flex-start; }
  .avatar { width: 240px; height: 240px; align-self: center; }
}

/* Smooth anchor jumps with a little offset */
html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 1.5rem; }
