/* defreez.com - static site stylesheet */

:root {
  --bg: #faf7f2;
  --fg: #23201c;
  --muted: #6b645a;
  --accent: #9c4310;
  --rule: #e3dcd1;
  --badge-bg: #f3e2c6;
  --badge-fg: #7a3c0c;

  --font-body: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

  --step-0: clamp(1.05rem, 1rem + 0.35vw, 1.2rem);
  --step-1: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
  --step-2: clamp(1.35rem, 1.2rem + 0.9vw, 1.75rem);
  --step-3: clamp(1.9rem, 1.5rem + 2vw, 2.6rem);

  --space-s: clamp(0.75rem, 0.6rem + 0.6vw, 1.25rem);
  --space-m: clamp(1.25rem, 1rem + 1.2vw, 2.25rem);
  --space-l: clamp(2rem, 1.5rem + 2.5vw, 4rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16130f;
    --fg: #e8e2d8;
    --muted: #a39a8c;
    --accent: #e2a355;
    --rule: #332d25;
    --badge-bg: #2f2410;
    --badge-fg: #ecc78e;
  }
}

:root[data-theme="dark"] {
  --bg: #16130f;
  --fg: #e8e2d8;
  --muted: #a39a8c;
  --accent: #e2a355;
  --rule: #332d25;
  --badge-bg: #2f2410;
  --badge-fg: #ecc78e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
}

.wrap {
  max-width: 64rem;
  margin-inline: auto;
  padding-inline: var(--space-m);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}

/* Header */

.site-header {
  border-bottom: 1px solid var(--rule);
  padding-block: var(--space-s);
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-s);
}

.site-name {
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
}

.site-header nav ul {
  display: flex;
  gap: var(--space-s);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-header nav a {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--muted);
  text-decoration: none;
}

.site-header nav a[aria-current="page"] {
  color: var(--fg);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.15em;
}

.header-tools {
  display: flex;
  align-items: baseline;
  gap: var(--space-s);
}

.theme-toggle {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.3em 0.6em;
  cursor: pointer;
}

/* Main */

main {
  padding-block: var(--space-l);
}

h1 {
  font-size: var(--step-3);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 var(--space-m);
}

h2 {
  font-size: var(--step-2);
  font-weight: 600;
  line-height: 1.2;
  margin: var(--space-l) 0 var(--space-s);
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--rule);
}

h2:first-of-type {
  margin-top: var(--space-m);
}

p {
  margin: 0 0 var(--space-s);
}

/* About page */

.about {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--space-l);
  align-items: start;
}

.portrait {
  margin: 0;
}

.portrait img {
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 10px;
}

.portrait figcaption {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5em;
  text-align: center;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  list-style: none;
  margin: var(--space-m) 0 0;
  padding: 0;
  font-family: var(--font-ui);
  font-size: 0.95rem;
}

@media (max-width: 46rem) {
  .about {
    grid-template-columns: 1fr;
  }

  .portrait {
    order: -1;
    max-width: 22rem;
  }
}

/* Home page: fit one screen vertically */

.home {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.home main {
  flex: 1;
  display: flex;
  align-items: center;
  padding-block: var(--space-s);
}

.home .about {
  width: 100%;
}

.home h1 {
  margin-bottom: var(--space-s);
}

.home .site-footer {
  margin-top: 0;
}

@media (min-width: 46.01rem) {
  .home .portrait img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: min(62svh, 540px);
    margin-inline: auto;
  }
}

/* Research page */

.research-intro {
  max-width: 46rem;
}

.pub {
  margin-bottom: var(--space-m);
  max-width: 46rem;
}

.pub-title {
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.2em;
}

.pub-title a {
  color: var(--fg);
}

.pub-authors {
  margin: 0 0 0.15em;
  color: var(--muted);
}

.pub-venue {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--muted);
}

.pub-venue a {
  color: var(--accent);
}

.award {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.1em 0.6em;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-fg);
  margin-left: 0.35em;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: var(--space-s);
  margin-top: var(--space-l);
}

.site-footer p {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--muted);
}
