/* Igor Bispo, personal site.
   One typeface (Atkinson Hyperlegible Next), white page, one green accent
   taken from the portrait. The yellow is only used for the detection box. */

:root {
  --bg: #ffffff;
  --text: #1c1c1c;
  --muted: #5c5c5c;
  --line: #e2e2e2;
  --accent: #1e6b56;
  --detect: #f2cc4b;

  --font: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --width: 720px;
  --gutter: 20px;
  --nav-h: 60px;

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #161616;
  --text: #e8e8e8;
  --muted: #a3a3a3;
  --line: #2e2e2e;
  --accent: #7cc4a9;

  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
p { margin: 0; }
ul, dl, dd { margin: 0; padding: 0; list-style: none; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap {
  max-width: calc(var(--width) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  padding: 8px 12px; background: var(--text); color: var(--bg);
}
.skip:focus { top: 12px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 24px; height: var(--nav-h); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; margin-right: auto; }
.nav-links { display: flex; gap: 20px; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 10px; }

.lang button {
  background: none; border: 0; padding: 4px 3px; cursor: pointer;
  font: inherit; font-size: .9rem; color: var(--muted);
}
.lang button[aria-pressed="true"] { color: var(--text); font-weight: 700; }

.theme-toggle {
  display: grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  background: none; border: 0; color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Intro */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 40px;
  align-items: start;
  padding-top: 64px;
}
.intro h1 { font-size: 2.4rem; font-weight: 700; margin-bottom: 6px; }
.intro-role { color: var(--muted); margin-bottom: 20px; }
.intro-links {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px;
  margin-top: 24px;
}
.btn {
  display: inline-block;
  padding: 9px 16px;
  background: var(--accent); color: var(--bg);
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { text-decoration: underline; }

.portrait { position: relative; margin: 6px 0 0; }
.portrait img { width: 100%; height: auto; border-radius: 6px; }

/* Detection box over the face, drawn like a detector's output. */
.bbox {
  position: absolute;
  left: 25%; top: 10%; width: 50.5%; height: 64%;
  border: 2px solid var(--detect);
  opacity: 0;
  animation: show .4s ease-out .6s forwards;
}
.bbox-label {
  position: absolute; left: -2px; bottom: 100%;
  padding: 1px 5px;
  background: var(--detect); color: #1c1c1c;
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}
@keyframes show { to { opacity: 1; } }

/* Sections */
.section { padding-top: 72px; }
.section h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 20px; }
.section > p { max-width: 65ch; }
.section > p + p { margin-top: 14px; }

h3.sub { font-size: 1.2rem; font-weight: 700; margin: 48px 0 18px; }
h2 + h3.sub { margin-top: 0; }

/* Entries */
.entry + .entry { margin-top: 30px; }
.entry-small + .entry-small { margin-top: 20px; }
.entry-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
}
.entry h3 { font-size: 1.1rem; font-weight: 700; }
.entry h4 { font-size: 1.02rem; font-weight: 600; }
.entry-date { color: var(--muted); font-size: .95rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.entry-org { color: var(--muted); }
.entry > p:not(.entry-org) { margin-top: 8px; max-width: 65ch; }
.entry-small > p:not(.entry-org) { margin-top: 4px; }

.tools { margin-top: 10px; color: var(--muted); font-size: .92rem; max-width: 65ch; }
.tools-label { font-weight: 600; }
.tools .inline-list { display: inline; }

.inline-list li { display: inline; }
.inline-list li:not(:last-child)::after { content: ", "; }

.entry-links { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: .95rem; }

/* Tools */
.stack > div {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 2px 20px;
}
.stack > div + div { margin-top: 10px; }
.stack dt { font-weight: 600; }
.stack dd { color: var(--muted); }

/* Teaching */
.module { margin-top: 32px; }
.module h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.module-date { font-weight: 400; color: var(--muted); margin-left: 6px; }

.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.shot {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 4px;
  background: var(--line);
}
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot:hover { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Contact */
.contact { margin-top: 20px; }
.contact > div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 2px 20px;
  padding: 5px 0;
}
.contact dt { color: var(--muted); }
.contact dd { overflow-wrap: anywhere; }

/* Footer */
.site-footer {
  margin-top: 96px;
  padding-bottom: 40px;
  color: var(--muted);
  font-size: .9rem;
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 56px 16px 24px;
  background: rgba(0, 0, 0, .92);
}
.lightbox[data-open] { display: flex; }
.lightbox img { max-width: min(1280px, 100%); max-height: calc(100vh - 120px); }
.lb-close {
  position: absolute; top: 12px; right: 12px;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  background: none; border: 0; color: #eee; cursor: pointer;
}
.lb-count { color: #aaa; font-size: .9rem; }

/* Small screens */
@media (max-width: 760px) {
  .nav { flex-wrap: wrap; height: auto; padding-top: 12px; gap: 0 16px; }
  .nav-links {
    order: 3; width: 100%;
    overflow-x: auto; scrollbar-width: none;
    gap: 14px; padding: 8px 0 10px;
  }
  .nav-links a { font-size: .88rem; }
  .nav-links::-webkit-scrollbar { display: none; }
  html { scroll-padding-top: 110px; }

  .intro { grid-template-columns: 1fr; gap: 24px; padding-top: 40px; }
  .portrait { order: -1; width: 160px; margin-top: 14px; }
  .bbox-label { font-size: 10px; }

  .entry-head { flex-direction: column; gap: 0; }
  .stack > div, .contact > div { grid-template-columns: 1fr; }
  .stack > div + div { margin-top: 12px; }
  .contact > div { padding: 6px 0; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bbox { animation: none; opacity: 1; }
}

@media print {
  .site-header, .gallery, .lightbox, .skip { display: none !important; }
}
